Skip to content

Commit f878330

Browse files
committed
Rough-in the contracts.
Signed-off-by: Alexander Trauzzi <[email protected]>
1 parent 541ef6b commit f878330

File tree

8 files changed

+183
-0
lines changed

8 files changed

+183
-0
lines changed

src/implementation/Client/DaprClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import IClientSecret from "../../interfaces/Client/IClientSecret";
2626
import IClientSidecar from "../../interfaces/Client/IClientSidecar";
2727
import IClientState from "../../interfaces/Client/IClientState";
2828
import IClientWorkflow from "../../interfaces/Client/IClientWorkflow";
29+
import IClientJobs from "../../interfaces/Client/IClientJobs";
2930

3031
import GRPCClient from "./GRPCClient/GRPCClient";
3132
import GRPCClientActor from "./GRPCClient/actor";
@@ -41,6 +42,7 @@ import GRPCClientSecret from "./GRPCClient/secret";
4142
import GRPCClientSidecar from "./GRPCClient/sidecar";
4243
import GRPCClientState from "./GRPCClient/state";
4344
import GRPCClientWorkflow from "./GRPCClient/workflow";
45+
import GRPCClientJobs from "./GRPCClient/jobs";
4446

4547
import HTTPClient from "./HTTPClient/HTTPClient";
4648
import HTTPClientActor from "./HTTPClient/actor";
@@ -57,6 +59,7 @@ import HTTPClientSecret from "./HTTPClient/secret";
5759
import HTTPClientSidecar from "./HTTPClient/sidecar";
5860
import HTTPClientState from "./HTTPClient/state";
5961
import HTTPClientWorkflow from "./HTTPClient/workflow";
62+
import HTTPClientJobs from "./HTTPClient/jobs";
6063

6164
import CommunicationProtocolEnum from "../../enum/CommunicationProtocol.enum";
6265
import { DaprClientOptions } from "../../types/DaprClientOptions";
@@ -83,6 +86,7 @@ export default class DaprClient {
8386
readonly sidecar: IClientSidecar;
8487
readonly state: IClientState;
8588
readonly workflow: IClientWorkflow;
89+
readonly jobs: IClientJobs;
8690

8791
private readonly logger: Logger;
8892

@@ -119,6 +123,7 @@ export default class DaprClient {
119123
this.crypto = new GRPCClientCrypto(client);
120124
this.actor = new GRPCClientActor(client); // we use an abstractor here since we interface through a builder with the Actor Runtime
121125
this.workflow = new GRPCClientWorkflow(client);
126+
this.jobs = new GRPCClientJobs(client);
122127
break;
123128
}
124129
case CommunicationProtocolEnum.HTTP:
@@ -140,6 +145,7 @@ export default class DaprClient {
140145
this.sidecar = new HTTPClientSidecar(client);
141146
this.state = new HTTPClientState(client);
142147
this.workflow = new HTTPClientWorkflow(client);
148+
this.jobs = new HTTPClientJobs(client);
143149
break;
144150
}
145151
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright 2025 The Dapr Authors
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
import IClientJobs from "../../../interfaces/Client/IClientJobs";
15+
import GRPCClient from "./GRPCClient";
16+
17+
18+
export default class GRPCClientJobs implements IClientJobs {
19+
20+
private readonly grpcClient: GRPCClient;
21+
22+
constructor(grpcClient: GRPCClient) {
23+
this.grpcClient = grpcClient;
24+
}
25+
26+
schedule(): Promise<unknown> {
27+
throw new Error("Not yet!");
28+
}
29+
get(): Promise<unknown> {
30+
throw new Error("Not yet!");
31+
}
32+
delete(): Promise<unknown> {
33+
throw new Error("Not yet!");
34+
}
35+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
Copyright 2025 The Dapr Authors
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
import IClientJobs from "../../../interfaces/Client/IClientJobs";
15+
import HTTPClient from "./HTTPClient";
16+
17+
export default class HTTPClientJobs implements IClientJobs {
18+
19+
private readonly httpClient: HTTPClient;
20+
21+
constructor(httpClient: HTTPClient) {
22+
this.httpClient = httpClient;
23+
}
24+
25+
schedule(): Promise<unknown> {
26+
throw new Error("Not yet!");
27+
}
28+
get(): Promise<unknown> {
29+
throw new Error("Not yet!");
30+
}
31+
delete(): Promise<unknown> {
32+
throw new Error("Not yet!");
33+
}
34+
}

src/implementation/Server/DaprServer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,30 @@ import IServerPubSub from "../../interfaces/Server/IServerPubSub";
1616
import IServerBinding from "../../interfaces/Server/IServerBinding";
1717
import IServerInvoker from "../../interfaces/Server/IServerInvoker";
1818
import IServerActor from "../../interfaces/Server/IServerActor";
19+
import IServerJobs from "../../interfaces/Server/IServerJobs";
1920

2021
import CommunicationProtocolEnum from "../../enum/CommunicationProtocol.enum";
2122
import GRPCServer from "./GRPCServer/GRPCServer";
2223
import GRPCServerPubSub from "./GRPCServer/pubsub";
2324
import GRPCServerBinding from "./GRPCServer/binding";
2425
import GRPCServerInvoker from "./GRPCServer/invoker";
2526
import GRPCServerActor from "./GRPCServer/actor";
27+
import GRPCServerJobs from "./GRPCServer/jobs";
2628

2729
import HTTPServer from "./HTTPServer/HTTPServer";
2830
import HTTPServerPubSub from "./HTTPServer/pubsub";
2931
import HTTPServerBinding from "./HTTPServer/binding";
3032
import HTTPServerInvoker from "./HTTPServer/invoker";
3133
import HTTPServerActor from "./HTTPServer/actor";
34+
import HTTPServerJobs from "./HTTPServer/jobs";
35+
3236
import { Settings } from "../../utils/Settings.util";
3337
import { DaprServerOptions } from "../../types/DaprServerOptions";
3438
import DaprClient from "../Client/DaprClient";
3539
import { getClientOptions } from "../../utils/Client.util";
3640

41+
42+
3743
export default class DaprServer {
3844
// App details
3945
private readonly serverOptions: DaprServerOptions;
@@ -43,6 +49,7 @@ export default class DaprServer {
4349
readonly binding: IServerBinding;
4450
readonly invoker: IServerInvoker;
4551
readonly actor: IServerActor;
52+
readonly jobs: IServerJobs;
4653
readonly client: DaprClient;
4754

4855
constructor(serverOptions: Partial<DaprServerOptions> = {}) {
@@ -90,6 +97,7 @@ export default class DaprServer {
9097
this.binding = new GRPCServerBinding(server);
9198
this.invoker = new GRPCServerInvoker(server);
9299
this.actor = new GRPCServerActor(server);
100+
this.jobs = new GRPCServerJobs(server);
93101
break;
94102
}
95103
case CommunicationProtocolEnum.HTTP:
@@ -101,6 +109,7 @@ export default class DaprServer {
101109
this.binding = new HTTPServerBinding(server);
102110
this.invoker = new HTTPServerInvoker(server);
103111
this.actor = new HTTPServerActor(server, this.client);
112+
this.jobs = new HTTPServerJobs(server);
104113
break;
105114
}
106115
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
Copyright 2025 The Dapr Authors
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
import IServerJobs from "../../../interfaces/Server/IServerJobs";
15+
import GRPCServer from "./GRPCServer";
16+
17+
export default class GRPCServerJobs implements IServerJobs {
18+
19+
private readonly server: GRPCServer;
20+
21+
constructor(server: GRPCServer) {
22+
this.server = server;
23+
}
24+
25+
listen(): Promise<unknown> {
26+
throw new Error("Not yet!");
27+
}
28+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Copyright 2025 The Dapr Authors
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
import IServerJobs from "../../../interfaces/Server/IServerJobs";
15+
import HTTPServer from "./HTTPServer";
16+
import { Logger } from "../../../logger/Logger";
17+
18+
export default class HTTPServerJobs implements IServerJobs {
19+
20+
private readonly httpServer: HTTPServer;
21+
private readonly logger: Logger;
22+
23+
constructor(httpServer: HTTPServer) {
24+
this.logger = new Logger("HTTPServer", "Jobs", httpServer.client.options.logger);
25+
this.httpServer = httpServer;
26+
}
27+
28+
listen(): Promise<unknown> {
29+
30+
// this.httpServer.server.post();
31+
32+
}
33+
}

src/interfaces/Client/IClientJobs.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Copyright 2025 The Dapr Authors
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
export default interface IClientJobs {
15+
16+
schedule(): Promise<unknown>;
17+
get(): Promise<unknown>;
18+
delete(): Promise<unknown>;
19+
20+
}

src/interfaces/Server/IServerJobs.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
Copyright 2025 The Dapr Authors
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
export default interface IServerJobs {
15+
16+
listen(): Promise<unknown>;
17+
18+
}

0 commit comments

Comments
 (0)