@restatedev/restate-sdk-clients 0.9.2 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +29 -0
  2. package/dist/cjs/package.json +1 -0
  3. package/dist/cjs/src/api.d.ts +198 -0
  4. package/dist/cjs/src/api.d.ts.map +1 -0
  5. package/dist/{src → cjs/src}/api.js +8 -0
  6. package/dist/cjs/src/api.js.map +1 -0
  7. package/dist/cjs/src/ingress.d.ts +15 -0
  8. package/dist/cjs/src/ingress.d.ts.map +1 -0
  9. package/dist/cjs/src/ingress.js +361 -0
  10. package/dist/cjs/src/ingress.js.map +1 -0
  11. package/dist/cjs/src/public_api.d.ts +4 -0
  12. package/dist/cjs/src/public_api.d.ts.map +1 -0
  13. package/dist/{src → cjs/src}/public_api.js +5 -5
  14. package/dist/cjs/src/public_api.js.map +1 -0
  15. package/dist/cjs/tsconfig.tsbuildinfo +1 -0
  16. package/dist/esm/src/api.d.ts +198 -0
  17. package/dist/esm/src/api.d.ts.map +1 -0
  18. package/dist/esm/src/api.js +30 -0
  19. package/dist/esm/src/api.js.map +1 -0
  20. package/dist/esm/src/ingress.d.ts +15 -0
  21. package/dist/esm/src/ingress.d.ts.map +1 -0
  22. package/dist/esm/src/ingress.js +356 -0
  23. package/dist/esm/src/ingress.js.map +1 -0
  24. package/dist/esm/src/public_api.d.ts +4 -0
  25. package/dist/esm/src/public_api.d.ts.map +1 -0
  26. package/dist/esm/src/public_api.js +13 -0
  27. package/dist/esm/src/public_api.js.map +1 -0
  28. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  29. package/package.json +26 -18
  30. package/dist/src/api.d.ts +0 -75
  31. package/dist/src/api.d.ts.map +0 -1
  32. package/dist/src/api.js.map +0 -1
  33. package/dist/src/ingress.d.ts +0 -9
  34. package/dist/src/ingress.d.ts.map +0 -1
  35. package/dist/src/ingress.js +0 -209
  36. package/dist/src/ingress.js.map +0 -1
  37. package/dist/src/public_api.d.ts +0 -4
  38. package/dist/src/public_api.d.ts.map +0 -1
  39. package/dist/src/public_api.js.map +0 -1
  40. package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md CHANGED
@@ -9,6 +9,23 @@
9
9
 
10
10
  This package contains the clients to interact with your Restate services, using `fetch`.
11
11
 
12
+ ```typescript
13
+ import * as restate from "@restatedev/restate-sdk-clients";
14
+
15
+ // Import the type of the service to call
16
+ import type { Greeter } from "./greeter-service";
17
+ const Greeter: Greeter = { name: "greeter" };
18
+
19
+ // Instantiate the Restate client
20
+ const rs = restate.connect({ url: "http://localhost:8080" });
21
+
22
+ // Get a typed client for Greeter
23
+ const greeter = rs.serviceClient(Greeter);
24
+
25
+ // Send a request to greet
26
+ const greeting = await greeter.greet(name);
27
+ ```
28
+
12
29
  ## Community
13
30
 
14
31
  * 🤗️ [Join our online community](https://discord.gg/skW3AZ6uGd) for help, sharing feedback and talking to the community.
@@ -16,3 +33,15 @@ This package contains the clients to interact with your Restate services, using
16
33
  * 📣 [Follow us on Twitter](https://twitter.com/restatedev) for staying up to date.
17
34
  * 🙋 [Create a GitHub issue](https://github.com/restatedev/sdk-typescript/issues) for requesting a new feature or reporting a problem.
18
35
  * 🏠 [Visit our GitHub org](https://github.com/restatedev) for exploring other repositories.
36
+
37
+ ## Using the SDK
38
+
39
+ To use this client, add the dependency to your project:
40
+
41
+ ```shell
42
+ npm install @restatedev/restate-sdk-clients
43
+ ```
44
+
45
+ ## Versions
46
+
47
+ This library follows [Semantic Versioning](https://semver.org/).
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,198 @@
1
+ import type { Service, VirtualObjectDefinitionFrom, Workflow, VirtualObject, ServiceDefinitionFrom, WorkflowDefinitionFrom } from "@restatedev/restate-sdk-core";
2
+ /**
3
+ * A remote client for a Restate service.
4
+ *
5
+ * Use the following client to interact with services defined
6
+ * - `serviceClient` to create a client for a service.
7
+ * - `workflowClient` to create a client for a workflow.
8
+ * - `objectClient` to create a client for a virtual object.
9
+ *
10
+ */
11
+ export interface Ingress {
12
+ /**
13
+ * Create a client from a {@link ServiceDefinition}.
14
+ */
15
+ serviceClient<D>(opts: ServiceDefinitionFrom<D>): IngressClient<Service<D>>;
16
+ /**
17
+ * Create a client from a {@link WorkflowDefinition}.
18
+ *
19
+ * @param key the key of the workflow.
20
+ */
21
+ workflowClient<D>(opts: WorkflowDefinitionFrom<D>, key: string): IngressWorkflowClient<Workflow<D>>;
22
+ /**
23
+ * Create a client from a {@link VirtualObjectDefinition}.
24
+ * @param key the key of the virtual object.
25
+ */
26
+ objectClient<D>(opts: VirtualObjectDefinitionFrom<D>, key: string): IngressClient<VirtualObject<D>>;
27
+ /**
28
+ * Create a client from a {@link ServiceDefinition}.
29
+ */
30
+ serviceSendClient<D>(opts: ServiceDefinitionFrom<D>): IngressSendClient<Service<D>>;
31
+ /**
32
+ * Create a client from a {@link VirtualObjectDefinition}.
33
+ */
34
+ objectSendClient<D>(opts: VirtualObjectDefinitionFrom<D>, key: string): IngressSendClient<VirtualObject<D>>;
35
+ /**
36
+ * Resolve an awakeable from the ingress client.
37
+ */
38
+ resolveAwakeable<T>(id: string, payload?: T): Promise<void>;
39
+ /**
40
+ * Reject an awakeable from the ingress client.
41
+ */
42
+ rejectAwakeable(id: string, reason: string): Promise<void>;
43
+ /**
44
+ * Obtain the result of a service that was asynchronously submitted (via a sendClient).
45
+ *
46
+ * @param send either the send response or the workflow submission as obtained by the respective clients.
47
+ */
48
+ result<T>(send: Send<T> | WorkflowSubmission<T>): Promise<T>;
49
+ }
50
+ export interface IngresCallOptions {
51
+ /**
52
+ * Key to use for idempotency key.
53
+ *
54
+ * See https://docs.restate.dev/operate/invocation#invoke-a-handler-idempotently for more details.
55
+ */
56
+ idempotencyKey?: string;
57
+ /**
58
+ * Headers to attach to the request.
59
+ */
60
+ headers?: Record<string, string>;
61
+ }
62
+ export interface IngresSendOptions extends IngresCallOptions {
63
+ /**
64
+ * If set, the invocation will be executed after the provided delay. In milliseconds.
65
+ */
66
+ delay?: number;
67
+ }
68
+ export declare class Opts {
69
+ readonly opts: IngresCallOptions;
70
+ /**
71
+ * Create a call configuration from the provided options.
72
+ *
73
+ * @param opts the call configuration
74
+ */
75
+ static from(opts: IngresCallOptions): Opts;
76
+ constructor(opts: IngresCallOptions);
77
+ }
78
+ export declare class SendOpts {
79
+ readonly opts: IngresSendOptions;
80
+ /**
81
+ * @param opts Create send options
82
+ */
83
+ static from(opts: IngresSendOptions): SendOpts;
84
+ delay(): number | undefined;
85
+ constructor(opts: IngresSendOptions);
86
+ }
87
+ export type IngressClient<M> = {
88
+ [K in keyof M as M[K] extends never ? never : K]: M[K] extends (arg: any, ...args: infer P) => PromiseLike<infer O> ? (...args: [...P, ...[opts?: Opts]]) => PromiseLike<O> : never;
89
+ };
90
+ /**
91
+ * Represents the output of a workflow.
92
+ */
93
+ export interface Output<O> {
94
+ /**
95
+ * Whether the output is ready.
96
+ */
97
+ ready: boolean;
98
+ /**
99
+ * The output of the workflow.
100
+ */
101
+ result: O;
102
+ }
103
+ /**
104
+ * Represents a successful workflow submission.
105
+ *
106
+ */
107
+ export type WorkflowSubmission<T> = {
108
+ /**
109
+ * The invocation id of the workflow. You can use that id to
110
+ * with the introspection tools (restate cli, logging, metrics)
111
+ *
112
+ */
113
+ readonly invocationId: string;
114
+ readonly status: "Accepted" | "PreviouslyAccepted";
115
+ readonly attachable: true;
116
+ };
117
+ /**
118
+ * A client for a workflow.
119
+ *
120
+ * This client represents the workflow definition, with the following additional methods:
121
+ * - `workflowSubmit` to submit the workflow.
122
+ * - `workflowAttach` to attach to the workflow and wait for its completion
123
+ * - `workflowOutput` to check if the workflow's output is ready/available.
124
+ *
125
+ * Once a workflow is submitted, it can be attached to, and the output can be retrieved.
126
+ *
127
+ * @typeParam M the type of the workflow.
128
+ */
129
+ export type IngressWorkflowClient<M> = Omit<{
130
+ [K in keyof M as M[K] extends never ? never : K]: M[K] extends (arg: any, ...args: infer P) => PromiseLike<infer O> ? (...args: P) => PromiseLike<O> : never;
131
+ } & {
132
+ /**
133
+ * Submit this workflow.
134
+ *
135
+ * This instructs restate to execute the 'run' handler of the workflow, idempotently.
136
+ * The workflow will be executed asynchronously, and the promise will resolve when the workflow has been accepted.
137
+ * Please note that submitting a workflow does not wait for it to completion, and it is safe to retry the submission,
138
+ * in case of failure.
139
+ *
140
+ * @param argument the same argument type as defined by the 'run' handler.
141
+ */
142
+ workflowSubmit: M extends Record<string, unknown> ? M["run"] extends (arg: any, ...args: infer I) => Promise<infer O> ? (...args: I) => Promise<WorkflowSubmission<O>> : never : never;
143
+ /**
144
+ * Attach to this workflow.
145
+ *
146
+ * This instructs restate to attach to the workflow and wait for it to complete.
147
+ * It is only possible to 'attach' to a workflow that has been previously submitted.
148
+ * The promise will resolve when the workflow has completed either successfully with a result,
149
+ * or be rejected with an error.
150
+ * This operation is safe to retry many times, and it will always return the same result.
151
+ *
152
+ * @returns a promise that resolves when the workflow has completed.
153
+ */
154
+ workflowAttach: M extends Record<string, unknown> ? M["run"] extends (...args: any) => Promise<infer O> ? () => Promise<O> : never : never;
155
+ /**
156
+ * Try retrieving the output of this workflow.
157
+ *
158
+ * This instructs restate to check if the workflow's output is ready/available.
159
+ * The returned Output object will have a 'ready' field set to true if the output is ready.
160
+ * If the output is ready, the 'result' field will contain the output.
161
+ * note: that this operation will not wait for the workflow to complete, to do so use 'workflowAttach'.
162
+ *
163
+ * @returns a promise that resolves if the workflow's output is ready/available.
164
+ */
165
+ workflowOutput: M extends Record<string, unknown> ? M["run"] extends (...args: any) => Promise<infer O> ? () => Promise<Output<O>> : never : never;
166
+ }, "run">;
167
+ /**
168
+ * A send response.
169
+ *
170
+ * @typeParam T the type of the response.
171
+ */
172
+ export type Send<T = unknown> = {
173
+ /**
174
+ * The invocation id of the send.
175
+ */
176
+ invocationId: string;
177
+ /**
178
+ * The status of the send.
179
+ */
180
+ status: "Accepted" | "PreviouslyAccepted";
181
+ attachable: boolean;
182
+ };
183
+ export type IngressSendClient<M> = {
184
+ [K in keyof M as M[K] extends never ? never : K]: M[K] extends (arg: any, ...args: infer P) => infer O ? (...args: [...P, ...[opts?: SendOpts]]) => Promise<Send<O>> : never;
185
+ };
186
+ export type ConnectionOpts = {
187
+ /**
188
+ * Restate ingress URL.
189
+ * For example: http://localhost:8080
190
+ */
191
+ url: string;
192
+ /**
193
+ * Headers to attach on every request.
194
+ * Use this to attach authentication headers.
195
+ */
196
+ headers?: Record<string, string>;
197
+ };
198
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,2BAA2B,EAC3B,QAAQ,EACR,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AAItC;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5E;;;;OAIG;IACH,cAAc,CAAC,CAAC,EACd,IAAI,EAAE,sBAAsB,CAAC,CAAC,CAAC,EAC/B,GAAG,EAAE,MAAM,GACV,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtC;;;OAGG;IACH,YAAY,CAAC,CAAC,EACZ,IAAI,EAAE,2BAA2B,CAAC,CAAC,CAAC,EACpC,GAAG,EAAE,MAAM,GACV,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnC;;OAEG;IACH,iBAAiB,CAAC,CAAC,EACjB,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAC7B,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjC;;OAEG;IACH,gBAAgB,CAAC,CAAC,EAChB,I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AAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAC3D,KAAK;CACV,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC"}
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SendOpts = exports.Opts = void 0;
4
4
  class Opts {
5
5
  opts;
6
+ /**
7
+ * Create a call configuration from the provided options.
8
+ *
9
+ * @param opts the call configuration
10
+ */
6
11
  static from(opts) {
7
12
  return new Opts(opts);
8
13
  }
@@ -13,6 +18,9 @@ class Opts {
13
18
  exports.Opts = Opts;
14
19
  class SendOpts {
15
20
  opts;
21
+ /**
22
+ * @param opts Create send options
23
+ */
16
24
  static from(opts) {
17
25
  return new SendOpts(opts);
18
26
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/api.ts"],"names":[],"mappings":";;;AAmGA,MAAa,IAAI;IAUM;IATrB;;;;OAIG;IACI,MAAM,CAAC,IAAI,CAAC,IAAuB;QACxC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,YAAqB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;CACjD;AAXD,oBAWC;AAED,MAAa,QAAQ;IAYE;IAXrB;;OAEG;IACI,MAAM,CAAC,IAAI,CAAC,IAAuB;QACxC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACzB,CAAC;IAED,YAAqB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;CACjD;AAbD,4BAaC"}
@@ -0,0 +1,15 @@
1
+ import type { ConnectionOpts, Ingress } from "./api.js";
2
+ /**
3
+ * Connect to the restate Ingress
4
+ *
5
+ * @param opts connection options
6
+ * @returns a connection the the restate ingress
7
+ */
8
+ export declare function connect(opts: ConnectionOpts): Ingress;
9
+ export declare class HttpCallError extends Error {
10
+ readonly status: number;
11
+ readonly responseText: string;
12
+ readonly message: string;
13
+ constructor(status: number, responseText: string, message: string);
14
+ }
15
+ //# sourceMappingURL=ingress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingress.d.ts","sourceRoot":"","sources":["../../../src/ingress.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EAOR,MAAM,UAAU,CAAC;AAIlB;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAErD;AAED,qBAAa,aAAc,SAAQ,KAAK;aAEpB,MAAM,EAAE,MAAM;aACd,YAAY,EAAE,MAAM;aACpB,OAAO,EAAE,MAAM;gBAFf,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM;CAIlC"}
@@ -0,0 +1,361 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH
4
+ *
5
+ * This file is part of the Restate SDK for Node.js/TypeScript,
6
+ * which is released under the MIT license.
7
+ *
8
+ * You can find a copy of the license in file LICENSE in the root
9
+ * directory of this repository or package, or at
10
+ * https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.HttpCallError = exports.connect = void 0;
14
+ const api_js_1 = require("./api.js");
15
+ /**
16
+ * Connect to the restate Ingress
17
+ *
18
+ * @param opts connection options
19
+ * @returns a connection the the restate ingress
20
+ */
21
+ function connect(opts) {
22
+ return new HttpIngress(opts);
23
+ }
24
+ exports.connect = connect;
25
+ class HttpCallError extends Error {
26
+ status;
27
+ responseText;
28
+ message;
29
+ constructor(status, responseText, message) {
30
+ super(message);
31
+ this.status = status;
32
+ this.responseText = responseText;
33
+ this.message = message;
34
+ }
35
+ }
36
+ exports.HttpCallError = HttpCallError;
37
+ function optsFromArgs(args) {
38
+ let parameter;
39
+ let opts;
40
+ switch (args.length) {
41
+ case 0: {
42
+ break;
43
+ }
44
+ case 1: {
45
+ if (args[0] instanceof api_js_1.Opts) {
46
+ opts = args[0];
47
+ }
48
+ else if (args[0] instanceof api_js_1.SendOpts) {
49
+ opts = args[0];
50
+ }
51
+ else {
52
+ parameter = args[0];
53
+ }
54
+ break;
55
+ }
56
+ case 2: {
57
+ parameter = args[0];
58
+ if (args[1] instanceof api_js_1.Opts) {
59
+ opts = args[1];
60
+ }
61
+ else if (args[1] instanceof api_js_1.SendOpts) {
62
+ opts = args[1];
63
+ }
64
+ else {
65
+ throw new TypeError("The second argument must be either Opts or SendOpts");
66
+ }
67
+ break;
68
+ }
69
+ default: {
70
+ throw new TypeError("unexpected number of arguments");
71
+ }
72
+ }
73
+ return {
74
+ parameter,
75
+ opts,
76
+ };
77
+ }
78
+ const IDEMPOTENCY_KEY_HEADER = "idempotency-key";
79
+ const doComponentInvocation = async (opts, params) => {
80
+ let attachable = false;
81
+ const fragments = [];
82
+ //
83
+ // ingress URL
84
+ //
85
+ fragments.push(opts.url);
86
+ //
87
+ // component
88
+ //
89
+ fragments.push(params.component);
90
+ //
91
+ // has key?
92
+ //
93
+ if (params.key) {
94
+ const key = encodeURIComponent(params.key);
95
+ fragments.push(key);
96
+ }
97
+ //
98
+ // handler
99
+ //
100
+ fragments.push(params.handler);
101
+ if (params.send ?? false) {
102
+ if (params.opts instanceof api_js_1.SendOpts) {
103
+ const sendString = computeDelayAsIso(params.opts);
104
+ fragments.push(sendString);
105
+ }
106
+ else {
107
+ fragments.push("send");
108
+ }
109
+ }
110
+ //
111
+ // request body
112
+ //
113
+ const { body, contentType } = serializeBodyWithContentType(params.parameter);
114
+ //
115
+ // headers
116
+ //
117
+ const headers = {
118
+ ...(opts.headers ?? {}),
119
+ ...(params.opts?.opts?.headers ?? {}),
120
+ };
121
+ if (contentType) {
122
+ headers["Content-Type"] = contentType;
123
+ }
124
+ //
125
+ //idempotency
126
+ //
127
+ const idempotencyKey = params.opts?.opts.idempotencyKey;
128
+ if (idempotencyKey) {
129
+ headers[IDEMPOTENCY_KEY_HEADER] = idempotencyKey;
130
+ attachable = true;
131
+ }
132
+ //
133
+ // make the call
134
+ //
135
+ const url = fragments.join("/");
136
+ const httpResponse = await fetch(url, {
137
+ method: params.method ?? "POST",
138
+ headers,
139
+ body,
140
+ });
141
+ if (!httpResponse.ok) {
142
+ const body = await httpResponse.text();
143
+ throw new HttpCallError(httpResponse.status, body, `Request failed: ${httpResponse.status}\n${body}`);
144
+ }
145
+ const responseBuf = await httpResponse.arrayBuffer();
146
+ const json = deserializeJson(new Uint8Array(responseBuf));
147
+ if (!params.send) {
148
+ return json;
149
+ }
150
+ return { ...json, attachable };
151
+ };
152
+ const doWorkflowHandleCall = async (opts, wfName, wfKey, op) => {
153
+ //
154
+ // headers
155
+ //
156
+ const headers = {
157
+ ...(opts.headers ?? {}),
158
+ };
159
+ //
160
+ // make the call
161
+ //
162
+ const url = `${opts.url}/restate/workflow/${wfName}/${encodeURIComponent(wfKey)}/${op}`;
163
+ const httpResponse = await fetch(url, {
164
+ method: "GET",
165
+ headers,
166
+ });
167
+ if (httpResponse.ok) {
168
+ const responseBuf = await httpResponse.arrayBuffer();
169
+ return deserializeJson(new Uint8Array(responseBuf));
170
+ }
171
+ const body = await httpResponse.text();
172
+ throw new HttpCallError(httpResponse.status, body, `Request failed: ${httpResponse.status}\n${body}`);
173
+ };
174
+ class HttpIngress {
175
+ opts;
176
+ constructor(opts) {
177
+ this.opts = opts;
178
+ }
179
+ proxy(component, key, send) {
180
+ return new Proxy({}, {
181
+ get: (_target, prop) => {
182
+ const handler = prop;
183
+ return (...args) => {
184
+ const { parameter, opts } = optsFromArgs(args);
185
+ return doComponentInvocation(this.opts, {
186
+ component,
187
+ handler,
188
+ key,
189
+ parameter,
190
+ opts,
191
+ send,
192
+ });
193
+ };
194
+ },
195
+ });
196
+ }
197
+ serviceClient(opts) {
198
+ return this.proxy(opts.name);
199
+ }
200
+ objectClient(opts, key) {
201
+ return this.proxy(opts.name, key);
202
+ }
203
+ workflowClient(opts, key) {
204
+ const component = opts.name;
205
+ const conn = this.opts;
206
+ const workflowSubmit = async (parameter) => {
207
+ const res = await doComponentInvocation(conn, {
208
+ component,
209
+ handler: "run",
210
+ key,
211
+ send: true,
212
+ parameter,
213
+ });
214
+ return {
215
+ invocationId: res.invocationId,
216
+ status: res.status,
217
+ attachable: true,
218
+ };
219
+ };
220
+ const workflowAttach = () => doWorkflowHandleCall(conn, component, key, "attach");
221
+ const workflowOutput = async () => {
222
+ try {
223
+ const result = await doWorkflowHandleCall(conn, component, key, "output");
224
+ return {
225
+ ready: true,
226
+ result,
227
+ };
228
+ }
229
+ catch (e) {
230
+ if (!(e instanceof HttpCallError) || e.status != 470) {
231
+ throw e;
232
+ }
233
+ return {
234
+ ready: false,
235
+ get result() {
236
+ throw new Error("Calling result() on a non ready workflow");
237
+ },
238
+ };
239
+ }
240
+ };
241
+ return new Proxy({}, {
242
+ get: (_target, prop) => {
243
+ const handler = prop;
244
+ if (handler == "workflowSubmit") {
245
+ return workflowSubmit;
246
+ }
247
+ else if (handler == "workflowAttach") {
248
+ return workflowAttach;
249
+ }
250
+ else if (handler == "workflowOutput") {
251
+ return workflowOutput;
252
+ }
253
+ // shared handlers pass trough via the ingress's normal invocation form
254
+ // i.e. POST /<svc>/<key>/<handler>
255
+ return (...args) => {
256
+ const { parameter, opts } = optsFromArgs(args);
257
+ return doComponentInvocation(conn, {
258
+ component,
259
+ handler,
260
+ key,
261
+ parameter,
262
+ opts,
263
+ });
264
+ };
265
+ },
266
+ });
267
+ }
268
+ objectSendClient(opts, key) {
269
+ return this.proxy(opts.name, key, true);
270
+ }
271
+ serviceSendClient(opts) {
272
+ return this.proxy(opts.name, undefined, true);
273
+ }
274
+ async resolveAwakeable(id, payload) {
275
+ const url = `${this.opts.url}/restate/a/${id}/resolve`;
276
+ const { body, contentType } = serializeBodyWithContentType(payload);
277
+ const headers = {
278
+ ...(this.opts.headers ?? {}),
279
+ };
280
+ if (contentType) {
281
+ headers["Content-Type"] = contentType;
282
+ }
283
+ const httpResponse = await fetch(url, {
284
+ method: "POST",
285
+ headers,
286
+ body,
287
+ });
288
+ if (!httpResponse.ok) {
289
+ const body = await httpResponse.text();
290
+ throw new HttpCallError(httpResponse.status, body, `Request failed: ${httpResponse.status}\n${body}`);
291
+ }
292
+ }
293
+ async rejectAwakeable(id, reason) {
294
+ const url = `${this.opts.url}/restate/a/${id}/reject`;
295
+ const headers = {
296
+ "Content-Type": "text/plain",
297
+ ...(this.opts.headers ?? {}),
298
+ };
299
+ const httpResponse = await fetch(url, {
300
+ method: "POST",
301
+ headers,
302
+ body: reason,
303
+ });
304
+ if (!httpResponse.ok) {
305
+ const body = await httpResponse.text();
306
+ throw new HttpCallError(httpResponse.status, body, `Request failed: ${httpResponse.status}\n${body}`);
307
+ }
308
+ }
309
+ async result(send) {
310
+ if (!send.attachable) {
311
+ throw new Error(`Unable to fetch the result for ${send.invocationId}.
312
+ A service's result is stored only with an idempotencyKey is supplied when invocating the service.`);
313
+ }
314
+ //
315
+ // headers
316
+ //
317
+ const headers = {
318
+ ...(this.opts.headers ?? {}),
319
+ };
320
+ //
321
+ // make the call
322
+ const url = `${this.opts.url}/restate/invocation/${send.invocationId}/attach`;
323
+ const httpResponse = await fetch(url, {
324
+ method: "GET",
325
+ headers,
326
+ });
327
+ if (httpResponse.ok) {
328
+ const responseBuf = await httpResponse.arrayBuffer();
329
+ return deserializeJson(new Uint8Array(responseBuf));
330
+ }
331
+ const body = await httpResponse.text();
332
+ throw new HttpCallError(httpResponse.status, body, `Request failed: ${httpResponse.status}\n${body}`);
333
+ }
334
+ }
335
+ function computeDelayAsIso(opts) {
336
+ const delay = opts.delay();
337
+ if (!delay) {
338
+ return "send";
339
+ }
340
+ return `send?delay=${delay}ms`;
341
+ }
342
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
343
+ function deserializeJson(what) {
344
+ if (what === undefined || what.length == 0) {
345
+ return undefined;
346
+ }
347
+ const json = new TextDecoder().decode(what);
348
+ return JSON.parse(json);
349
+ }
350
+ function serializeBodyWithContentType(body) {
351
+ if (body === undefined) {
352
+ return {};
353
+ }
354
+ const json = JSON.stringify(body);
355
+ const buffer = new TextEncoder().encode(json);
356
+ return {
357
+ body: buffer,
358
+ contentType: "application/json",
359
+ };
360
+ }
361
+ //# sourceMappingURL=ingress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingress.js","sourceRoot":"","sources":["../../../src/ingress.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAqBH,qCAA0C;AAE1C;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,IAAoB;IAC1C,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAFD,0BAEC;AAED,MAAa,aAAc,SAAQ,KAAK;IAEpB;IACA;IACA;IAHlB,YACkB,MAAc,EACd,YAAoB,EACpB,OAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,WAAM,GAAN,MAAM,CAAQ;QACd,iBAAY,GAAZ,YAAY,CAAQ;QACpB,YAAO,GAAP,OAAO,CAAQ;IAGjC,CAAC;CACF;AARD,sCAQC;AAYD,SAAS,YAAY,CAAC,IAAe;IAInC,IAAI,SAAkB,CAAC;IACvB,IAAI,IAAiC,CAAC;IACtC,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,CAAC,CAAC,CAAC;YACP,MAAM;QACR,CAAC;QACD,KAAK,CAAC,CAAC,CAAC,CAAC;YACP,IAAI,IAAI,CAAC,CAAC,CAAC,Y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AW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,4BAA4B,CAAC,IAAa;IAIjD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE9C,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,kBAAkB;KAChC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { ServiceDefinition, VirtualObjectDefinition, WorkflowDefinition, ServiceDefinitionFrom, VirtualObjectDefinitionFrom, WorkflowDefinitionFrom, } from "@restatedev/restate-sdk-core";
2
+ export { Ingress, ConnectionOpts, IngressClient, IngressSendClient, IngressWorkflowClient, Opts, IngresCallOptions, SendOpts, Send, IngresSendOptions, } from "./api.js";
3
+ export { connect } from "./ingress.js";
4
+ //# sourceMappingURL=public_api.d.ts.map