@restatedev/restate-sdk-clients 1.16.2 → 1.16.4
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.
- package/dist/api.d.cts +40 -15
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.ts +40 -15
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/ingress.cjs +58 -61
- package/dist/ingress.d.cts.map +1 -1
- package/dist/ingress.d.ts.map +1 -1
- package/dist/ingress.js +58 -61
- package/dist/ingress.js.map +1 -1
- package/dist/retry.test.js +76 -0
- package/dist/retry.test.js.map +1 -1
- package/package.json +2 -2
package/dist/api.d.cts
CHANGED
|
@@ -246,6 +246,14 @@ type WorkflowSubmission<T> = {
|
|
|
246
246
|
*
|
|
247
247
|
*/
|
|
248
248
|
readonly invocationId: string;
|
|
249
|
+
/**
|
|
250
|
+
* Whether the workflow was accepted by this request or had already been
|
|
251
|
+
* accepted.
|
|
252
|
+
*
|
|
253
|
+
* When automatic retries are enabled, this may be `PreviouslyAccepted` if an
|
|
254
|
+
* earlier attempt from the same `workflowSubmit` call was accepted but its
|
|
255
|
+
* response was not observed by the client.
|
|
256
|
+
*/
|
|
249
257
|
readonly status: "Accepted" | "PreviouslyAccepted";
|
|
250
258
|
readonly attachable: true;
|
|
251
259
|
};
|
|
@@ -267,8 +275,9 @@ type IngressWorkflowClient<M> = Omit<{ [K in keyof M as M[K] extends never ? nev
|
|
|
267
275
|
*
|
|
268
276
|
* This instructs restate to execute the 'run' handler of the workflow, idempotently.
|
|
269
277
|
* The workflow will be executed asynchronously, and the promise will resolve when the workflow has been accepted.
|
|
270
|
-
* Please note that submitting a workflow does not wait for it to completion
|
|
271
|
-
*
|
|
278
|
+
* Please note that submitting a workflow does not wait for it to completion.
|
|
279
|
+
* When automatic retries are enabled on the connection, the client safely retries
|
|
280
|
+
* ambiguous submission failures using the workflow ID as the request identity.
|
|
272
281
|
*
|
|
273
282
|
* @param argument the same argument type as defined by the 'run' handler.
|
|
274
283
|
*/
|
|
@@ -281,6 +290,8 @@ type IngressWorkflowClient<M> = Omit<{ [K in keyof M as M[K] extends never ? nev
|
|
|
281
290
|
* The promise will resolve when the workflow has completed either successfully with a result,
|
|
282
291
|
* or be rejected with an error.
|
|
283
292
|
* This operation is safe to retry many times, and it will always return the same result.
|
|
293
|
+
* When automatic retries are enabled on the connection, the client retries
|
|
294
|
+
* ambiguous attach failures according to the configured retry policy.
|
|
284
295
|
*
|
|
285
296
|
* @returns a promise that resolves when the workflow has completed.
|
|
286
297
|
*/
|
|
@@ -292,6 +303,8 @@ type IngressWorkflowClient<M> = Omit<{ [K in keyof M as M[K] extends never ? nev
|
|
|
292
303
|
* The returned Output object will have a 'ready' field set to true if the output is ready.
|
|
293
304
|
* If the output is ready, the 'result' field will contain the output.
|
|
294
305
|
* note: that this operation will not wait for the workflow to complete, to do so use 'workflowAttach'.
|
|
306
|
+
* When automatic retries are enabled on the connection, the client retries
|
|
307
|
+
* ambiguous output retrieval failures according to the configured retry policy.
|
|
295
308
|
*
|
|
296
309
|
* @returns a promise that resolves if the workflow's output is ready/available.
|
|
297
310
|
*/
|
|
@@ -339,10 +352,11 @@ type RetryFailure = {
|
|
|
339
352
|
* Policy controlling automatic retries of ambiguous ingress failures.
|
|
340
353
|
*
|
|
341
354
|
* Retries are **opt-in**: they happen only when a policy is configured (see
|
|
342
|
-
* {@link ConnectionOpts.retry})
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
355
|
+
* {@link ConnectionOpts.retry}) and the request is safe to repeat. Regular
|
|
356
|
+
* calls require an `idempotencyKey` (see
|
|
357
|
+
* {@link IngressCallOptions.idempotencyKey}); workflow submissions are
|
|
358
|
+
* idempotent by workflow ID, while workflow attaches and output retrieval only
|
|
359
|
+
* observe the existing workflow.
|
|
346
360
|
*
|
|
347
361
|
* By default the following failures are retried: network errors (the underlying
|
|
348
362
|
* `fetch` rejecting), HTTP `429`, and HTTP `5xx` responses. Override this with
|
|
@@ -374,10 +388,11 @@ interface RetryPolicy {
|
|
|
374
388
|
* Decide whether a given failure should be retried. When provided, this
|
|
375
389
|
* fully replaces the built-in rule (network / `429` / `5xx`).
|
|
376
390
|
*
|
|
377
|
-
* The idempotency-key gate
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
391
|
+
* The idempotency-key gate still applies to regular invocations; workflow
|
|
392
|
+
* submissions, attaches, and output retrieval remain eligible without an
|
|
393
|
+
* idempotency key. The `maxAttempts` cap applies to all of them. This predicate
|
|
394
|
+
* only narrows or broadens *which failures* are retryable within those bounds.
|
|
395
|
+
* Compose with the built-in rule via the exported `defaultShouldRetry`.
|
|
381
396
|
*
|
|
382
397
|
* @param failure the failure being considered
|
|
383
398
|
* @param attempt the zero-based index of the attempt that just failed
|
|
@@ -402,11 +417,13 @@ type ConnectionOpts = {
|
|
|
402
417
|
* Retries are **disabled by default**. Set `true` to enable the built-in
|
|
403
418
|
* policy ({@link RetryPolicy}), or pass a {@link RetryPolicy} to tune it.
|
|
404
419
|
*
|
|
405
|
-
* Even when enabled,
|
|
406
|
-
*
|
|
407
|
-
* invocation.
|
|
408
|
-
*
|
|
409
|
-
*
|
|
420
|
+
* Even when enabled, regular calls are retried **only** when an
|
|
421
|
+
* `idempotencyKey` is set — without one a retry could double-execute a
|
|
422
|
+
* non-idempotent invocation. Workflow submissions, attaches, and output
|
|
423
|
+
* retrieval are also retried: submissions are idempotent by workflow ID,
|
|
424
|
+
* while attach and output operations only observe the existing workflow. If a
|
|
425
|
+
* submission retry observes a workflow accepted by an earlier attempt, its
|
|
426
|
+
* status is `PreviouslyAccepted`.
|
|
410
427
|
*/
|
|
411
428
|
retry?: RetryPolicy | boolean;
|
|
412
429
|
/**
|
|
@@ -423,6 +440,14 @@ type ConnectionOpts = {
|
|
|
423
440
|
* @experimental
|
|
424
441
|
*/
|
|
425
442
|
journalValueCodec?: JournalValueCodec;
|
|
443
|
+
/**
|
|
444
|
+
* Custom fetch client
|
|
445
|
+
*
|
|
446
|
+
* Allows you to provide a different fetch implementation (e.g., undici fetch for HTTP/2 support).
|
|
447
|
+
*
|
|
448
|
+
* @defaultValue `globalThis.fetch`
|
|
449
|
+
*/
|
|
450
|
+
fetch?: typeof globalThis.fetch;
|
|
426
451
|
};
|
|
427
452
|
//#endregion
|
|
428
453
|
export { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, RetryFailure, RetryPolicy, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc };
|
package/dist/api.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.cts","names":[],"sources":["../src/api.ts"],"sourcesContent":[],"mappings":";;;;;;AAwBA;;;;;;;AAYU,UAZO,OAAA,CAYP;EAE0B;;;EAOE,aAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EAjBb,qBAiBa,CAjBS,CAiBT,CAAA,CAAA,EAjBc,aAiBd,CAjB4B,OAiB5B,CAjBoC,CAiBpC,CAAA,CAAA;EAA5B;;;;;EAQA,cAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EAjBA,sBAiBA,CAjBuB,CAiBvB,CAAA,EAAA,GAAA,EAAA,MAAA,CAAA,EAfL,qBAeK,CAfiB,QAejB,CAf0B,CAe1B,CAAA,CAAA;EACqB;;;;EAMrB,YAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EAfA,2BAeA,CAf4B,CAe5B,CAAA,EAAA,GAAA,EAAA,MAAA,CAAA,EAbL,aAaK,CAbS,aAaT,CAbuB,CAavB,CAAA,CAAA;EAE2B;;;EAOvB,iBAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EAhBJ,qBAgBI,CAhBkB,CAgBlB,CAAA,CAAA,EAfT,iBAeS,CAfS,OAeT,CAfiB,CAejB,CAAA,CAAA;EACW;;;EAMsB,gBAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EAhB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,KAAG,SAAE,KAAA,KAAA;8BAEvB,mBAAmB,SAAE,SAAA;;;;;UAOxC;;;;;;;;UASP;;;;;;KAQE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BA,2BAA2B,mBAEvB,KAAK,EAAE,2BAA2B,IAAI,EAAE,4CAG/C,sCAEc,cAAc,KAAK,aAAa,IAAI,SAC9C,YAAY;;;;;;;;;;;;kBAcL,UAAU,0BACtB,kDAAiD,kCAEhC,cAAc,SAAS,aAAa,UAC9C,QAAQ,mBAAmB;;;;;;;;;;;;;;kBAiBtB,UAAU,0BACtB,oCAAmC,4BACzB,WAAW,OAAO,QAAQ;;;;;;;;;;;;;kBAgBxB,UAAU,0BACtB,oCAAmC,4BACzB,WAAW,OAAO,QAAQ,OAAO;;;;;;;KAavC;;;;;;;;;;;KAcA,qCACE,KAAK,EAAE,2BAA2B,IAAI,EAAE,4CAG/C,sCAEc,cAAc,SAAS,aAAa,UAC9C,QAAQ,KAAK;;;;;;;KAUZ,YAAA;;;;;;;;oBAUY;;;;;;;;;;;;;;;;;;;;;UAsBP,WAAA;;;;;;;;;;;oBAYG;;;;;gBAMJ;;;;;;;;;;;;;;;;;;;0BAqBU;;KAGd,cAAA;;;;;;;;;;YAUA;;;;;;;;;;;;;;;;UAiBF;;;;;;;;UASA;;;;;;sBAOY;;;;;;;;iBASL,UAAA,CAAW"}
|
package/dist/api.d.ts
CHANGED
|
@@ -246,6 +246,14 @@ type WorkflowSubmission<T> = {
|
|
|
246
246
|
*
|
|
247
247
|
*/
|
|
248
248
|
readonly invocationId: string;
|
|
249
|
+
/**
|
|
250
|
+
* Whether the workflow was accepted by this request or had already been
|
|
251
|
+
* accepted.
|
|
252
|
+
*
|
|
253
|
+
* When automatic retries are enabled, this may be `PreviouslyAccepted` if an
|
|
254
|
+
* earlier attempt from the same `workflowSubmit` call was accepted but its
|
|
255
|
+
* response was not observed by the client.
|
|
256
|
+
*/
|
|
249
257
|
readonly status: "Accepted" | "PreviouslyAccepted";
|
|
250
258
|
readonly attachable: true;
|
|
251
259
|
};
|
|
@@ -267,8 +275,9 @@ type IngressWorkflowClient<M> = Omit<{ [K in keyof M as M[K] extends never ? nev
|
|
|
267
275
|
*
|
|
268
276
|
* This instructs restate to execute the 'run' handler of the workflow, idempotently.
|
|
269
277
|
* The workflow will be executed asynchronously, and the promise will resolve when the workflow has been accepted.
|
|
270
|
-
* Please note that submitting a workflow does not wait for it to completion
|
|
271
|
-
*
|
|
278
|
+
* Please note that submitting a workflow does not wait for it to completion.
|
|
279
|
+
* When automatic retries are enabled on the connection, the client safely retries
|
|
280
|
+
* ambiguous submission failures using the workflow ID as the request identity.
|
|
272
281
|
*
|
|
273
282
|
* @param argument the same argument type as defined by the 'run' handler.
|
|
274
283
|
*/
|
|
@@ -281,6 +290,8 @@ type IngressWorkflowClient<M> = Omit<{ [K in keyof M as M[K] extends never ? nev
|
|
|
281
290
|
* The promise will resolve when the workflow has completed either successfully with a result,
|
|
282
291
|
* or be rejected with an error.
|
|
283
292
|
* This operation is safe to retry many times, and it will always return the same result.
|
|
293
|
+
* When automatic retries are enabled on the connection, the client retries
|
|
294
|
+
* ambiguous attach failures according to the configured retry policy.
|
|
284
295
|
*
|
|
285
296
|
* @returns a promise that resolves when the workflow has completed.
|
|
286
297
|
*/
|
|
@@ -292,6 +303,8 @@ type IngressWorkflowClient<M> = Omit<{ [K in keyof M as M[K] extends never ? nev
|
|
|
292
303
|
* The returned Output object will have a 'ready' field set to true if the output is ready.
|
|
293
304
|
* If the output is ready, the 'result' field will contain the output.
|
|
294
305
|
* note: that this operation will not wait for the workflow to complete, to do so use 'workflowAttach'.
|
|
306
|
+
* When automatic retries are enabled on the connection, the client retries
|
|
307
|
+
* ambiguous output retrieval failures according to the configured retry policy.
|
|
295
308
|
*
|
|
296
309
|
* @returns a promise that resolves if the workflow's output is ready/available.
|
|
297
310
|
*/
|
|
@@ -339,10 +352,11 @@ type RetryFailure = {
|
|
|
339
352
|
* Policy controlling automatic retries of ambiguous ingress failures.
|
|
340
353
|
*
|
|
341
354
|
* Retries are **opt-in**: they happen only when a policy is configured (see
|
|
342
|
-
* {@link ConnectionOpts.retry})
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
355
|
+
* {@link ConnectionOpts.retry}) and the request is safe to repeat. Regular
|
|
356
|
+
* calls require an `idempotencyKey` (see
|
|
357
|
+
* {@link IngressCallOptions.idempotencyKey}); workflow submissions are
|
|
358
|
+
* idempotent by workflow ID, while workflow attaches and output retrieval only
|
|
359
|
+
* observe the existing workflow.
|
|
346
360
|
*
|
|
347
361
|
* By default the following failures are retried: network errors (the underlying
|
|
348
362
|
* `fetch` rejecting), HTTP `429`, and HTTP `5xx` responses. Override this with
|
|
@@ -374,10 +388,11 @@ interface RetryPolicy {
|
|
|
374
388
|
* Decide whether a given failure should be retried. When provided, this
|
|
375
389
|
* fully replaces the built-in rule (network / `429` / `5xx`).
|
|
376
390
|
*
|
|
377
|
-
* The idempotency-key gate
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
391
|
+
* The idempotency-key gate still applies to regular invocations; workflow
|
|
392
|
+
* submissions, attaches, and output retrieval remain eligible without an
|
|
393
|
+
* idempotency key. The `maxAttempts` cap applies to all of them. This predicate
|
|
394
|
+
* only narrows or broadens *which failures* are retryable within those bounds.
|
|
395
|
+
* Compose with the built-in rule via the exported `defaultShouldRetry`.
|
|
381
396
|
*
|
|
382
397
|
* @param failure the failure being considered
|
|
383
398
|
* @param attempt the zero-based index of the attempt that just failed
|
|
@@ -402,11 +417,13 @@ type ConnectionOpts = {
|
|
|
402
417
|
* Retries are **disabled by default**. Set `true` to enable the built-in
|
|
403
418
|
* policy ({@link RetryPolicy}), or pass a {@link RetryPolicy} to tune it.
|
|
404
419
|
*
|
|
405
|
-
* Even when enabled,
|
|
406
|
-
*
|
|
407
|
-
* invocation.
|
|
408
|
-
*
|
|
409
|
-
*
|
|
420
|
+
* Even when enabled, regular calls are retried **only** when an
|
|
421
|
+
* `idempotencyKey` is set — without one a retry could double-execute a
|
|
422
|
+
* non-idempotent invocation. Workflow submissions, attaches, and output
|
|
423
|
+
* retrieval are also retried: submissions are idempotent by workflow ID,
|
|
424
|
+
* while attach and output operations only observe the existing workflow. If a
|
|
425
|
+
* submission retry observes a workflow accepted by an earlier attempt, its
|
|
426
|
+
* status is `PreviouslyAccepted`.
|
|
410
427
|
*/
|
|
411
428
|
retry?: RetryPolicy | boolean;
|
|
412
429
|
/**
|
|
@@ -423,6 +440,14 @@ type ConnectionOpts = {
|
|
|
423
440
|
* @experimental
|
|
424
441
|
*/
|
|
425
442
|
journalValueCodec?: JournalValueCodec;
|
|
443
|
+
/**
|
|
444
|
+
* Custom fetch client
|
|
445
|
+
*
|
|
446
|
+
* Allows you to provide a different fetch implementation (e.g., undici fetch for HTTP/2 support).
|
|
447
|
+
*
|
|
448
|
+
* @defaultValue `globalThis.fetch`
|
|
449
|
+
*/
|
|
450
|
+
fetch?: typeof globalThis.fetch;
|
|
426
451
|
};
|
|
427
452
|
//#endregion
|
|
428
453
|
export { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, RetryFailure, RetryPolicy, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc };
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","names":[],"sources":["../src/api.ts"],"sourcesContent":[],"mappings":";;;;;;AAwBA;;;;;;;AAYU,UAZO,OAAA,CAYP;EAE0B;;;EAOE,aAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EAjBb,qBAiBa,CAjBS,CAiBT,CAAA,CAAA,EAjBc,aAiBd,CAjB4B,OAiB5B,CAjBoC,CAiBpC,CAAA,CAAA;EAA5B;;;;;EAQA,cAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EAjBA,sBAiBA,CAjBuB,CAiBvB,CAAA,EAAA,GAAA,EA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BF;;;;;;;;UASA;;;;;;sBAOY;;;;;;;;iBASL,UAAA,CAAW"}
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","names":["opts: IngressCallOptions<I, O>","opts: IngressSendOptions<I>"],"sources":["../src/api.ts"],"sourcesContent":["import type {\n Service,\n VirtualObjectDefinitionFrom,\n Workflow,\n VirtualObject,\n ServiceDefinitionFrom,\n WorkflowDefinitionFrom,\n Serde,\n Duration,\n JournalValueCodec,\n} from \"@restatedev/restate-sdk-core\";\nimport { millisOrDurationToMillis } from \"@restatedev/restate-sdk-core\";\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * A remote client for a Restate service.\n *\n * Use the following client to interact with services defined\n * - `serviceClient` to create a client for a service.\n * - `workflowClient` to create a client for a workflow.\n * - `objectClient` to create a client for a virtual object.\n *\n */\nexport interface Ingress {\n /**\n * Create a client from a {@link ServiceDefinition}.\n */\n serviceClient<D>(opts: ServiceDefinitionFrom<D>): IngressClient<Service<D>>;\n\n /**\n * Create a client from a {@link WorkflowDefinition}.\n *\n * @param key the key of the workflow.\n */\n workflowClient<D>(\n opts: WorkflowDefinitionFrom<D>,\n key: string\n ): IngressWorkflowClient<Workflow<D>>;\n\n /**\n * Create a client from a {@link VirtualObjectDefinition}.\n * @param key the key of the virtual object.\n */\n objectClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressClient<VirtualObject<D>>;\n\n /**\n * Create a client from a {@link ServiceDefinition}.\n */\n serviceSendClient<D>(\n opts: ServiceDefinitionFrom<D>\n ): IngressSendClient<Service<D>>;\n\n /**\n * Create a client from a {@link VirtualObjectDefinition}.\n */\n objectSendClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressSendClient<VirtualObject<D>>;\n\n /**\n * Resolve an awakeable from the ingress client.\n */\n resolveAwakeable<T>(\n id: string,\n payload?: T,\n payloadSerde?: Serde<T>\n ): Promise<void>;\n\n /**\n * Reject an awakeable from the ingress client.\n */\n rejectAwakeable(id: string, reason: string): Promise<void>;\n\n /**\n * Obtain the result of a service that was asynchronously submitted (via a sendClient).\n *\n * @param send either the send response or the workflow submission as obtained by the respective clients.\n */\n result<T>(\n send: Send<T> | WorkflowSubmission<T>,\n resultSerde?: Serde<T>\n ): Promise<T>;\n\n /** Generic request-response call. Routes directly by service name without a typed definition. */\n call<I = Uint8Array, O = Uint8Array>(opts: {\n service: string;\n handler: string;\n parameter: I;\n key?: string;\n /**\n * Route this call within the given scope. See {@link Ingress.scope}.\n *\n * *NOTE:* This API is experimental. To use it you need a restate-server >= 1.7,\n * configured to enable\n * [service protocol v7](https://github.com/restatedev/restate/blob/main/release-notes/v1.7.0.md#service-protocol-v7)\n * and [flow control](https://github.com/restatedev/restate/blob/main/release-notes/v1.7.0.md#flow-control).\n * For example, start the restate-server with the environment variables\n * `RESTATE_EXPERIMENTAL_ENABLE_PROTOCOL_V7=true` and `RESTATE_EXPERIMENTAL_ENABLE_VQUEUES=true`.\n *\n * @experimental\n */\n scope?: string;\n opts?: Opts<I, O>;\n }): Promise<O>;\n\n /** Generic fire-and-forget send. Routes directly by service name without a typed definition. */\n send<I = Uint8Array>(opts: {\n service: string;\n handler: string;\n parameter: I;\n key?: string;\n /**\n * Route this send within the given scope. See {@link Ingress.scope}.\n *\n * *NOTE:* This API is experimental. To use it you need a restate-server >= 1.7,\n * configured to enable\n * [service protocol v7](https://github.com/restatedev/restate/blob/main/release-notes/v1.7.0.md#service-protocol-v7)\n * and [flow control](https://github.com/restatedev/restate/blob/main/release-notes/v1.7.0.md#flow-control).\n * For example, start the restate-server with the environment variables\n * `RESTATE_EXPERIMENTAL_ENABLE_PROTOCOL_V7=true` and `RESTATE_EXPERIMENTAL_ENABLE_VQUEUES=true`.\n *\n * @experimental\n */\n scope?: string;\n opts?: SendOpts<I>;\n }): Promise<Send>;\n\n /**\n * Returns a {@link ScopedIngress} that routes all calls within the given scope.\n *\n * **NOTE:** This API is in preview and is not enabled by default.\n * To use it in restate-server 1.7, enable the flow control and protocol v7 experimental features,\n * via `RESTATE_EXPERIMENTAL_ENABLE_PROTOCOL_V7=true` and `RESTATE_EXPERIMENTAL_ENABLE_VQUEUES=true`.\n * These can be enabled only on **new clusters**, for more info check out https://docs.restate.dev/services/flow-control#enabling-flow-control.\n * If these experimental features aren't enabled, the invocation won't be ingested and the client request fails.\n *\n * A scope is a sub-grouping of resources (invocations, virtual object instances, workflow\n * instances, concurrency limits) within the Restate cluster.\n * It becomes part of the target identity tuple:\n * - `scope, service, handler, idempotencyKey?`\n * - `scope, virtualObject, objectKey, handler, idempotencyKey?`\n * - `scope, workflow, workflowKey, handler`\n *\n * Under the hood, the scope contributes to the partition key, so all resources in a scope get co-located by the restate-server.\n *\n * Omitting the scope (i.e. using the regular `serviceClient` / `workflowClient` methods)\n * is equivalent to calling with no scope, which is the existing behavior.\n *\n * The scope key must consist only of `[a-zA-Z0-9_.-]` characters, with 1 <= length <= 36 chars.\n *\n * @example\n * ```ts\n * // Route a call into a named scope\n * await ingress.scope(\"tenant-123\").serviceClient(MyService).process(payload);\n *\n * // Idempotency keys are scoped — \"req-1\" in \"tenant-123\" is distinct from \"req-1\" in \"tenant-456\"\n * await ingress.scope(\"tenant-123\").serviceClient(MyService)\n * .process(payload, rpc.opts({ idempotencyKey: \"req-1\" }));\n *\n * // Combine with a limit key to enforce per-scope concurrency limits\n * await ingress.scope(\"tenant-123\").workflowClient(MyWorkflow, \"wf-key\")\n * .run(input, rpc.opts({ limitKey: \"api-key/user42\" }));\n * ```\n *\n * @param scopeKey the scope identifier\n * @see https://docs.restate.dev/services/flow-control\n * @experimental\n */\n scope(scopeKey: string): ScopedIngress;\n}\n\n/**\n * An ingress client for making RPC calls within a specific scope.\n *\n * @see {@link Ingress.scope}\n * @experimental\n * @interface\n */\nexport type ScopedIngress = Pick<\n Ingress,\n | \"serviceClient\"\n | \"serviceSendClient\"\n | \"objectClient\"\n | \"objectSendClient\"\n | \"workflowClient\"\n>;\n\nexport interface IngressCallOptions<I = unknown, O = unknown> {\n /**\n * Key to use for idempotency key.\n *\n * See https://docs.restate.dev/operate/invocation#invoke-a-handler-idempotently for more details.\n */\n idempotencyKey?: string;\n\n /**\n * An optional concurrency limit key within the scope.\n * A limit key can only be used in conjunction with a scope (see {@link Ingress.scope}).\n *\n * **NOTE:** This API is in preview and is not enabled by default.\n * To use it in restate-server 1.7, enable the flow control and protocol v7 experimental features,\n * via `RESTATE_EXPERIMENTAL_ENABLE_PROTOCOL_V7=true` and `RESTATE_EXPERIMENTAL_ENABLE_VQUEUES=true`.\n * These can be enabled only on **new clusters**, for more info check out https://docs.restate.dev/services/flow-control#enabling-flow-control.\n * If these experimental features aren't enabled, the invocation isn't ingested and the client request fails.\n *\n * The limit key enforces hierarchical concurrency limits on invocations sharing the same scope.\n * It can have one or two levels separated by `/` (e.g. `\"tenant1\"` or `\"tenant1/user42\"`).\n * Each level must consist only of `[a-zA-Z0-9_.-]` characters, and 1 <= length <= 36.\n *\n * The limit key is **not** part of the request identity: two calls to the same target with the\n * same scope and object key but different limit keys refer to the **same** resource instance.\n * The limit key only affects concurrency limits, not resource identity.\n *\n * @experimental\n */\n limitKey?: string;\n\n /**\n * Headers to attach to the request.\n */\n headers?: Record<string, string>;\n\n input?: Serde<I>;\n\n output?: Serde<O>;\n\n /**\n * Timeout to be used when executing the request. In milliseconds.\n *\n * Same as {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal#aborting_a_fetch_with_timeout_or_explicit_abort | AbortSignal.timeout()}.\n *\n * This field is exclusive with `signal`, and using both of them will result in a runtime failure.\n */\n timeout?: number;\n\n /**\n * Signal to abort the underlying `fetch` operation. See {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}.\n *\n * This field is exclusive with `timeout`, and using both of them will result in a runtime failure.\n */\n signal?: AbortSignal;\n}\n\nexport interface IngressSendOptions<I> extends IngressCallOptions<I, void> {\n /**\n * If set, the invocation will be enqueued now to be executed after the provided delay. In milliseconds.\n */\n delay?: number | Duration;\n}\n\nexport class Opts<I, O> {\n /**\n * Create a call configuration from the provided options.\n *\n * @param opts the call configuration\n */\n public static from<I = unknown, O = unknown>(\n opts: IngressCallOptions<I, O>\n ): Opts<I, O> {\n return new Opts(opts);\n }\n\n constructor(readonly opts: IngressCallOptions<I, O>) {}\n}\n\nexport class SendOpts<I = unknown> {\n /**\n * @param opts Create send options\n */\n public static from<I = unknown>(opts: IngressSendOptions<I>): SendOpts<I> {\n return new SendOpts(opts);\n }\n\n delay(): number | undefined {\n if (this.opts.delay !== undefined) {\n return millisOrDurationToMillis(this.opts.delay);\n }\n return undefined;\n }\n\n constructor(readonly opts: IngressSendOptions<I>) {}\n}\n\nexport type InferArgType<P> = P extends [infer A, ...any[]] ? A : unknown;\n\nexport type IngressClient<M> = {\n [K in keyof M as M[K] extends never ? never : K]: M[K] extends (\n arg: any,\n ...args: infer P\n ) => PromiseLike<infer O>\n ? (...args: [...P, ...[opts?: Opts<InferArgType<P>, O>]]) => PromiseLike<O>\n : never;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace rpc {\n export const opts = <I, O>(opts: IngressCallOptions<I, O>) => Opts.from(opts);\n\n export const sendOpts = <I>(opts: IngressSendOptions<I>) =>\n SendOpts.from(opts);\n}\n\n/**\n * Represents the output of a workflow.\n */\nexport interface Output<O> {\n /**\n * Whether the output is ready.\n */\n ready: boolean;\n\n /**\n * The output of the workflow.\n */\n result: O;\n}\n\n/**\n * Represents a successful workflow submission.\n *\n */\n/* eslint-disable-next-line @typescript-eslint/no-unused-vars */\nexport type WorkflowSubmission<T> = {\n /**\n * The invocation id of the workflow. You can use that id to\n * with the introspection tools (restate cli, logging, metrics)\n *\n */\n readonly invocationId: string;\n readonly status: \"Accepted\" | \"PreviouslyAccepted\";\n readonly attachable: true;\n};\n\n/**\n * A client for a workflow.\n *\n * This client represents the workflow definition, with the following additional methods:\n * - `workflowSubmit` to submit the workflow.\n * - `workflowAttach` to attach to the workflow and wait for its completion\n * - `workflowOutput` to check if the workflow's output is ready/available.\n *\n * Once a workflow is submitted, it can be attached to, and the output can be retrieved.\n *\n * @typeParam M the type of the workflow.\n */\nexport type IngressWorkflowClient<M> = Omit<\n {\n [K in keyof M as M[K] extends never ? never : K]: M[K] extends (\n arg: any,\n ...args: infer P\n ) => PromiseLike<infer O>\n ? (\n ...args: [...P, ...[opts?: Opts<InferArgType<P>, O>]]\n ) => PromiseLike<O>\n : never;\n } & {\n /**\n * Submit this workflow.\n *\n * This instructs restate to execute the 'run' handler of the workflow, idempotently.\n * The workflow will be executed asynchronously, and the promise will resolve when the workflow has been accepted.\n * Please note that submitting a workflow does not wait for it to completion, and it is safe to retry the submission,\n * in case of failure.\n *\n * @param argument the same argument type as defined by the 'run' handler.\n */\n workflowSubmit: M extends Record<string, unknown>\n ? M[\"run\"] extends (arg: any, ...args: infer I) => Promise<infer O>\n ? (\n ...args: [...I, ...[opts?: SendOpts<InferArgType<I>>]]\n ) => Promise<WorkflowSubmission<O>>\n : never\n : never;\n\n /**\n * Attach to this workflow.\n *\n * This instructs restate to attach to the workflow and wait for it to complete.\n * It is only possible to 'attach' to a workflow that has been previously submitted.\n * The promise will resolve when the workflow has completed either successfully with a result,\n * or be rejected with an error.\n * This operation is safe to retry many times, and it will always return the same result.\n *\n * @returns a promise that resolves when the workflow has completed.\n */\n workflowAttach: M extends Record<string, unknown>\n ? M[\"run\"] extends (...args: any) => Promise<infer O>\n ? (opts?: Opts<void, O>) => Promise<O>\n : never\n : never;\n\n /**\n * Try retrieving the output of this workflow.\n *\n * This instructs restate to check if the workflow's output is ready/available.\n * The returned Output object will have a 'ready' field set to true if the output is ready.\n * If the output is ready, the 'result' field will contain the output.\n * note: that this operation will not wait for the workflow to complete, to do so use 'workflowAttach'.\n *\n * @returns a promise that resolves if the workflow's output is ready/available.\n */\n workflowOutput: M extends Record<string, unknown>\n ? M[\"run\"] extends (...args: any) => Promise<infer O>\n ? (opts?: Opts<void, O>) => Promise<Output<O>>\n : never\n : never;\n },\n \"run\"\n>;\n\n/**\n * A send response.\n *\n * @typeParam T the type of the response.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type Send<T = unknown> = {\n /**\n * The invocation id of the send.\n */\n invocationId: string;\n\n /**\n * The status of the send.\n */\n status: \"Accepted\" | \"PreviouslyAccepted\";\n\n attachable: boolean;\n};\n\nexport type IngressSendClient<M> = {\n [K in keyof M as M[K] extends never ? never : K]: M[K] extends (\n arg: any,\n ...args: infer P\n ) => PromiseLike<infer O>\n ? (\n ...args: [...P, ...[opts?: SendOpts<InferArgType<P>>]]\n ) => Promise<Send<O>>\n : never;\n};\n\n/**\n * An ambiguous ingress failure that may be retried.\n *\n * Passed to {@link RetryPolicy.shouldRetry} so a caller can inspect the failure\n * and decide whether to retry.\n */\nexport type RetryFailure =\n | {\n /** The underlying `fetch` call rejected (connection refused/reset, DNS). */\n readonly kind: \"network\";\n readonly error: unknown;\n }\n | {\n /** The server returned a non-2xx response. */\n readonly kind: \"response\";\n readonly status: number;\n readonly headers: Headers;\n /**\n * The response body, decoded as text, when the response carried a\n * non-empty body; `undefined` otherwise.\n */\n readonly body?: string;\n };\n\n/**\n * Policy controlling automatic retries of ambiguous ingress failures.\n *\n * Retries are **opt-in**: they happen only when a policy is configured (see\n * {@link ConnectionOpts.retry}) **and** the call carries an `idempotencyKey`\n * (see {@link IngressCallOptions.idempotencyKey}). Retrying without a key could\n * double-execute a non-idempotent invocation, so the idempotency key is the\n * safety boundary that a policy can never bypass.\n *\n * By default the following failures are retried: network errors (the underlying\n * `fetch` rejecting), HTTP `429`, and HTTP `5xx` responses. Override this with\n * {@link RetryPolicy.shouldRetry}.\n */\nexport interface RetryPolicy {\n /**\n * Max number of attempts (including the initial), before giving up.\n *\n * Defaults to `6` (the initial attempt plus up to 5 retries).\n */\n maxAttempts?: number;\n\n /**\n * Initial backoff interval. If a number is provided, it is interpreted as\n * milliseconds. Defaults to `100` milliseconds.\n */\n initialInterval?: Duration | number;\n\n /**\n * Maximum backoff interval. If a number is provided, it is interpreted as\n * milliseconds. Defaults to `2000` milliseconds.\n */\n maxInterval?: Duration | number;\n\n /**\n * Exponentiation factor to use when computing the next retry delay.\n * Defaults to `2`.\n */\n exponentiationFactor?: number;\n\n /**\n * Decide whether a given failure should be retried. When provided, this\n * fully replaces the built-in rule (network / `429` / `5xx`).\n *\n * The idempotency-key gate and the `maxAttempts` cap still apply — this\n * predicate only narrows or broadens *which failures* are retryable within\n * those bounds. Compose with the built-in rule via the exported\n * `defaultShouldRetry`.\n *\n * @param failure the failure being considered\n * @param attempt the zero-based index of the attempt that just failed\n */\n shouldRetry?: (failure: RetryFailure, attempt: number) => boolean;\n}\n\nexport type ConnectionOpts = {\n /**\n * Restate ingress URL.\n * For example: http://localhost:8080\n */\n url: string;\n /**\n * Headers to attach on every request.\n * Use this to attach authentication headers.\n */\n headers?: Record<string, string>;\n\n /**\n * Opt in to automatic retries of ambiguous ingress failures (network errors,\n * HTTP `429`, HTTP `5xx`).\n *\n * Retries are **disabled by default**. Set `true` to enable the built-in\n * policy ({@link RetryPolicy}), or pass a {@link RetryPolicy} to tune it.\n *\n * Even when enabled, retries fire **only** when an `idempotencyKey` is set on\n * the call — without one a retry could double-execute a non-idempotent\n * invocation. With a key, Restate dedupes the request, so a retry safely\n * attaches to the in-flight or completed invocation instead of starting a new\n * one.\n */\n retry?: RetryPolicy | boolean;\n\n /**\n * Default serde to use for ingress payloads when no operation-specific serde\n * is provided. Applies to handler calls, workflow attaches/output polling,\n * awakeable resolution, and attached invocation results.\n *\n * Defaults to `restate.serde.json`.\n */\n serde?: Serde<any>;\n\n /**\n * Codec to use for input/outputs. Check {@link JournalValueCodec} for more details\n *\n * @experimental\n */\n journalValueCodec?: JournalValueCodec;\n};\n"],"mappings":";;;AA+PA,IAAa,OAAb,MAAa,KAAW;;;;;;CAMtB,OAAc,KACZ,MACY;AACZ,SAAO,IAAI,KAAK,KAAK;;CAGvB,YAAY,AAASA,MAAgC;EAAhC;;;AAGvB,IAAa,WAAb,MAAa,SAAsB;;;;CAIjC,OAAc,KAAkB,MAA0C;AACxE,SAAO,IAAI,SAAS,KAAK;;CAG3B,QAA4B;AAC1B,MAAI,KAAK,KAAK,UAAU,OACtB,QAAO,yBAAyB,KAAK,KAAK,MAAM;;CAKpD,YAAY,AAASC,MAA6B;EAA7B;;;;;cAgBM,SAAmC,KAAK,KAAK,KAAK;kBAEjD,SAC1B,SAAS,KAAK,KAAK"}
|
|
1
|
+
{"version":3,"file":"api.js","names":["opts: IngressCallOptions<I, O>","opts: IngressSendOptions<I>"],"sources":["../src/api.ts"],"sourcesContent":["import type {\n Service,\n VirtualObjectDefinitionFrom,\n Workflow,\n VirtualObject,\n ServiceDefinitionFrom,\n WorkflowDefinitionFrom,\n Serde,\n Duration,\n JournalValueCodec,\n} from \"@restatedev/restate-sdk-core\";\nimport { millisOrDurationToMillis } from \"@restatedev/restate-sdk-core\";\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * A remote client for a Restate service.\n *\n * Use the following client to interact with services defined\n * - `serviceClient` to create a client for a service.\n * - `workflowClient` to create a client for a workflow.\n * - `objectClient` to create a client for a virtual object.\n *\n */\nexport interface Ingress {\n /**\n * Create a client from a {@link ServiceDefinition}.\n */\n serviceClient<D>(opts: ServiceDefinitionFrom<D>): IngressClient<Service<D>>;\n\n /**\n * Create a client from a {@link WorkflowDefinition}.\n *\n * @param key the key of the workflow.\n */\n workflowClient<D>(\n opts: WorkflowDefinitionFrom<D>,\n key: string\n ): IngressWorkflowClient<Workflow<D>>;\n\n /**\n * Create a client from a {@link VirtualObjectDefinition}.\n * @param key the key of the virtual object.\n */\n objectClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressClient<VirtualObject<D>>;\n\n /**\n * Create a client from a {@link ServiceDefinition}.\n */\n serviceSendClient<D>(\n opts: ServiceDefinitionFrom<D>\n ): IngressSendClient<Service<D>>;\n\n /**\n * Create a client from a {@link VirtualObjectDefinition}.\n */\n objectSendClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressSendClient<VirtualObject<D>>;\n\n /**\n * Resolve an awakeable from the ingress client.\n */\n resolveAwakeable<T>(\n id: string,\n payload?: T,\n payloadSerde?: Serde<T>\n ): Promise<void>;\n\n /**\n * Reject an awakeable from the ingress client.\n */\n rejectAwakeable(id: string, reason: string): Promise<void>;\n\n /**\n * Obtain the result of a service that was asynchronously submitted (via a sendClient).\n *\n * @param send either the send response or the workflow submission as obtained by the respective clients.\n */\n result<T>(\n send: Send<T> | WorkflowSubmission<T>,\n resultSerde?: Serde<T>\n ): Promise<T>;\n\n /** Generic request-response call. Routes directly by service name without a typed definition. */\n call<I = Uint8Array, O = Uint8Array>(opts: {\n service: string;\n handler: string;\n parameter: I;\n key?: string;\n /**\n * Route this call within the given scope. See {@link Ingress.scope}.\n *\n * *NOTE:* This API is experimental. To use it you need a restate-server >= 1.7,\n * configured to enable\n * [service protocol v7](https://github.com/restatedev/restate/blob/main/release-notes/v1.7.0.md#service-protocol-v7)\n * and [flow control](https://github.com/restatedev/restate/blob/main/release-notes/v1.7.0.md#flow-control).\n * For example, start the restate-server with the environment variables\n * `RESTATE_EXPERIMENTAL_ENABLE_PROTOCOL_V7=true` and `RESTATE_EXPERIMENTAL_ENABLE_VQUEUES=true`.\n *\n * @experimental\n */\n scope?: string;\n opts?: Opts<I, O>;\n }): Promise<O>;\n\n /** Generic fire-and-forget send. Routes directly by service name without a typed definition. */\n send<I = Uint8Array>(opts: {\n service: string;\n handler: string;\n parameter: I;\n key?: string;\n /**\n * Route this send within the given scope. See {@link Ingress.scope}.\n *\n * *NOTE:* This API is experimental. To use it you need a restate-server >= 1.7,\n * configured to enable\n * [service protocol v7](https://github.com/restatedev/restate/blob/main/release-notes/v1.7.0.md#service-protocol-v7)\n * and [flow control](https://github.com/restatedev/restate/blob/main/release-notes/v1.7.0.md#flow-control).\n * For example, start the restate-server with the environment variables\n * `RESTATE_EXPERIMENTAL_ENABLE_PROTOCOL_V7=true` and `RESTATE_EXPERIMENTAL_ENABLE_VQUEUES=true`.\n *\n * @experimental\n */\n scope?: string;\n opts?: SendOpts<I>;\n }): Promise<Send>;\n\n /**\n * Returns a {@link ScopedIngress} that routes all calls within the given scope.\n *\n * **NOTE:** This API is in preview and is not enabled by default.\n * To use it in restate-server 1.7, enable the flow control and protocol v7 experimental features,\n * via `RESTATE_EXPERIMENTAL_ENABLE_PROTOCOL_V7=true` and `RESTATE_EXPERIMENTAL_ENABLE_VQUEUES=true`.\n * These can be enabled only on **new clusters**, for more info check out https://docs.restate.dev/services/flow-control#enabling-flow-control.\n * If these experimental features aren't enabled, the invocation won't be ingested and the client request fails.\n *\n * A scope is a sub-grouping of resources (invocations, virtual object instances, workflow\n * instances, concurrency limits) within the Restate cluster.\n * It becomes part of the target identity tuple:\n * - `scope, service, handler, idempotencyKey?`\n * - `scope, virtualObject, objectKey, handler, idempotencyKey?`\n * - `scope, workflow, workflowKey, handler`\n *\n * Under the hood, the scope contributes to the partition key, so all resources in a scope get co-located by the restate-server.\n *\n * Omitting the scope (i.e. using the regular `serviceClient` / `workflowClient` methods)\n * is equivalent to calling with no scope, which is the existing behavior.\n *\n * The scope key must consist only of `[a-zA-Z0-9_.-]` characters, with 1 <= length <= 36 chars.\n *\n * @example\n * ```ts\n * // Route a call into a named scope\n * await ingress.scope(\"tenant-123\").serviceClient(MyService).process(payload);\n *\n * // Idempotency keys are scoped — \"req-1\" in \"tenant-123\" is distinct from \"req-1\" in \"tenant-456\"\n * await ingress.scope(\"tenant-123\").serviceClient(MyService)\n * .process(payload, rpc.opts({ idempotencyKey: \"req-1\" }));\n *\n * // Combine with a limit key to enforce per-scope concurrency limits\n * await ingress.scope(\"tenant-123\").workflowClient(MyWorkflow, \"wf-key\")\n * .run(input, rpc.opts({ limitKey: \"api-key/user42\" }));\n * ```\n *\n * @param scopeKey the scope identifier\n * @see https://docs.restate.dev/services/flow-control\n * @experimental\n */\n scope(scopeKey: string): ScopedIngress;\n}\n\n/**\n * An ingress client for making RPC calls within a specific scope.\n *\n * @see {@link Ingress.scope}\n * @experimental\n * @interface\n */\nexport type ScopedIngress = Pick<\n Ingress,\n | \"serviceClient\"\n | \"serviceSendClient\"\n | \"objectClient\"\n | \"objectSendClient\"\n | \"workflowClient\"\n>;\n\nexport interface IngressCallOptions<I = unknown, O = unknown> {\n /**\n * Key to use for idempotency key.\n *\n * See https://docs.restate.dev/operate/invocation#invoke-a-handler-idempotently for more details.\n */\n idempotencyKey?: string;\n\n /**\n * An optional concurrency limit key within the scope.\n * A limit key can only be used in conjunction with a scope (see {@link Ingress.scope}).\n *\n * **NOTE:** This API is in preview and is not enabled by default.\n * To use it in restate-server 1.7, enable the flow control and protocol v7 experimental features,\n * via `RESTATE_EXPERIMENTAL_ENABLE_PROTOCOL_V7=true` and `RESTATE_EXPERIMENTAL_ENABLE_VQUEUES=true`.\n * These can be enabled only on **new clusters**, for more info check out https://docs.restate.dev/services/flow-control#enabling-flow-control.\n * If these experimental features aren't enabled, the invocation isn't ingested and the client request fails.\n *\n * The limit key enforces hierarchical concurrency limits on invocations sharing the same scope.\n * It can have one or two levels separated by `/` (e.g. `\"tenant1\"` or `\"tenant1/user42\"`).\n * Each level must consist only of `[a-zA-Z0-9_.-]` characters, and 1 <= length <= 36.\n *\n * The limit key is **not** part of the request identity: two calls to the same target with the\n * same scope and object key but different limit keys refer to the **same** resource instance.\n * The limit key only affects concurrency limits, not resource identity.\n *\n * @experimental\n */\n limitKey?: string;\n\n /**\n * Headers to attach to the request.\n */\n headers?: Record<string, string>;\n\n input?: Serde<I>;\n\n output?: Serde<O>;\n\n /**\n * Timeout to be used when executing the request. In milliseconds.\n *\n * Same as {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal#aborting_a_fetch_with_timeout_or_explicit_abort | AbortSignal.timeout()}.\n *\n * This field is exclusive with `signal`, and using both of them will result in a runtime failure.\n */\n timeout?: number;\n\n /**\n * Signal to abort the underlying `fetch` operation. See {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}.\n *\n * This field is exclusive with `timeout`, and using both of them will result in a runtime failure.\n */\n signal?: AbortSignal;\n}\n\nexport interface IngressSendOptions<I> extends IngressCallOptions<I, void> {\n /**\n * If set, the invocation will be enqueued now to be executed after the provided delay. In milliseconds.\n */\n delay?: number | Duration;\n}\n\nexport class Opts<I, O> {\n /**\n * Create a call configuration from the provided options.\n *\n * @param opts the call configuration\n */\n public static from<I = unknown, O = unknown>(\n opts: IngressCallOptions<I, O>\n ): Opts<I, O> {\n return new Opts(opts);\n }\n\n constructor(readonly opts: IngressCallOptions<I, O>) {}\n}\n\nexport class SendOpts<I = unknown> {\n /**\n * @param opts Create send options\n */\n public static from<I = unknown>(opts: IngressSendOptions<I>): SendOpts<I> {\n return new SendOpts(opts);\n }\n\n delay(): number | undefined {\n if (this.opts.delay !== undefined) {\n return millisOrDurationToMillis(this.opts.delay);\n }\n return undefined;\n }\n\n constructor(readonly opts: IngressSendOptions<I>) {}\n}\n\nexport type InferArgType<P> = P extends [infer A, ...any[]] ? A : unknown;\n\nexport type IngressClient<M> = {\n [K in keyof M as M[K] extends never ? never : K]: M[K] extends (\n arg: any,\n ...args: infer P\n ) => PromiseLike<infer O>\n ? (...args: [...P, ...[opts?: Opts<InferArgType<P>, O>]]) => PromiseLike<O>\n : never;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace rpc {\n export const opts = <I, O>(opts: IngressCallOptions<I, O>) => Opts.from(opts);\n\n export const sendOpts = <I>(opts: IngressSendOptions<I>) =>\n SendOpts.from(opts);\n}\n\n/**\n * Represents the output of a workflow.\n */\nexport interface Output<O> {\n /**\n * Whether the output is ready.\n */\n ready: boolean;\n\n /**\n * The output of the workflow.\n */\n result: O;\n}\n\n/**\n * Represents a successful workflow submission.\n *\n */\n/* eslint-disable-next-line @typescript-eslint/no-unused-vars */\nexport type WorkflowSubmission<T> = {\n /**\n * The invocation id of the workflow. You can use that id to\n * with the introspection tools (restate cli, logging, metrics)\n *\n */\n readonly invocationId: string;\n /**\n * Whether the workflow was accepted by this request or had already been\n * accepted.\n *\n * When automatic retries are enabled, this may be `PreviouslyAccepted` if an\n * earlier attempt from the same `workflowSubmit` call was accepted but its\n * response was not observed by the client.\n */\n readonly status: \"Accepted\" | \"PreviouslyAccepted\";\n readonly attachable: true;\n};\n\n/**\n * A client for a workflow.\n *\n * This client represents the workflow definition, with the following additional methods:\n * - `workflowSubmit` to submit the workflow.\n * - `workflowAttach` to attach to the workflow and wait for its completion\n * - `workflowOutput` to check if the workflow's output is ready/available.\n *\n * Once a workflow is submitted, it can be attached to, and the output can be retrieved.\n *\n * @typeParam M the type of the workflow.\n */\nexport type IngressWorkflowClient<M> = Omit<\n {\n [K in keyof M as M[K] extends never ? never : K]: M[K] extends (\n arg: any,\n ...args: infer P\n ) => PromiseLike<infer O>\n ? (\n ...args: [...P, ...[opts?: Opts<InferArgType<P>, O>]]\n ) => PromiseLike<O>\n : never;\n } & {\n /**\n * Submit this workflow.\n *\n * This instructs restate to execute the 'run' handler of the workflow, idempotently.\n * The workflow will be executed asynchronously, and the promise will resolve when the workflow has been accepted.\n * Please note that submitting a workflow does not wait for it to completion.\n * When automatic retries are enabled on the connection, the client safely retries\n * ambiguous submission failures using the workflow ID as the request identity.\n *\n * @param argument the same argument type as defined by the 'run' handler.\n */\n workflowSubmit: M extends Record<string, unknown>\n ? M[\"run\"] extends (arg: any, ...args: infer I) => Promise<infer O>\n ? (\n ...args: [...I, ...[opts?: SendOpts<InferArgType<I>>]]\n ) => Promise<WorkflowSubmission<O>>\n : never\n : never;\n\n /**\n * Attach to this workflow.\n *\n * This instructs restate to attach to the workflow and wait for it to complete.\n * It is only possible to 'attach' to a workflow that has been previously submitted.\n * The promise will resolve when the workflow has completed either successfully with a result,\n * or be rejected with an error.\n * This operation is safe to retry many times, and it will always return the same result.\n * When automatic retries are enabled on the connection, the client retries\n * ambiguous attach failures according to the configured retry policy.\n *\n * @returns a promise that resolves when the workflow has completed.\n */\n workflowAttach: M extends Record<string, unknown>\n ? M[\"run\"] extends (...args: any) => Promise<infer O>\n ? (opts?: Opts<void, O>) => Promise<O>\n : never\n : never;\n\n /**\n * Try retrieving the output of this workflow.\n *\n * This instructs restate to check if the workflow's output is ready/available.\n * The returned Output object will have a 'ready' field set to true if the output is ready.\n * If the output is ready, the 'result' field will contain the output.\n * note: that this operation will not wait for the workflow to complete, to do so use 'workflowAttach'.\n * When automatic retries are enabled on the connection, the client retries\n * ambiguous output retrieval failures according to the configured retry policy.\n *\n * @returns a promise that resolves if the workflow's output is ready/available.\n */\n workflowOutput: M extends Record<string, unknown>\n ? M[\"run\"] extends (...args: any) => Promise<infer O>\n ? (opts?: Opts<void, O>) => Promise<Output<O>>\n : never\n : never;\n },\n \"run\"\n>;\n\n/**\n * A send response.\n *\n * @typeParam T the type of the response.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type Send<T = unknown> = {\n /**\n * The invocation id of the send.\n */\n invocationId: string;\n\n /**\n * The status of the send.\n */\n status: \"Accepted\" | \"PreviouslyAccepted\";\n\n attachable: boolean;\n};\n\nexport type IngressSendClient<M> = {\n [K in keyof M as M[K] extends never ? never : K]: M[K] extends (\n arg: any,\n ...args: infer P\n ) => PromiseLike<infer O>\n ? (\n ...args: [...P, ...[opts?: SendOpts<InferArgType<P>>]]\n ) => Promise<Send<O>>\n : never;\n};\n\n/**\n * An ambiguous ingress failure that may be retried.\n *\n * Passed to {@link RetryPolicy.shouldRetry} so a caller can inspect the failure\n * and decide whether to retry.\n */\nexport type RetryFailure =\n | {\n /** The underlying `fetch` call rejected (connection refused/reset, DNS). */\n readonly kind: \"network\";\n readonly error: unknown;\n }\n | {\n /** The server returned a non-2xx response. */\n readonly kind: \"response\";\n readonly status: number;\n readonly headers: Headers;\n /**\n * The response body, decoded as text, when the response carried a\n * non-empty body; `undefined` otherwise.\n */\n readonly body?: string;\n };\n\n/**\n * Policy controlling automatic retries of ambiguous ingress failures.\n *\n * Retries are **opt-in**: they happen only when a policy is configured (see\n * {@link ConnectionOpts.retry}) and the request is safe to repeat. Regular\n * calls require an `idempotencyKey` (see\n * {@link IngressCallOptions.idempotencyKey}); workflow submissions are\n * idempotent by workflow ID, while workflow attaches and output retrieval only\n * observe the existing workflow.\n *\n * By default the following failures are retried: network errors (the underlying\n * `fetch` rejecting), HTTP `429`, and HTTP `5xx` responses. Override this with\n * {@link RetryPolicy.shouldRetry}.\n */\nexport interface RetryPolicy {\n /**\n * Max number of attempts (including the initial), before giving up.\n *\n * Defaults to `6` (the initial attempt plus up to 5 retries).\n */\n maxAttempts?: number;\n\n /**\n * Initial backoff interval. If a number is provided, it is interpreted as\n * milliseconds. Defaults to `100` milliseconds.\n */\n initialInterval?: Duration | number;\n\n /**\n * Maximum backoff interval. If a number is provided, it is interpreted as\n * milliseconds. Defaults to `2000` milliseconds.\n */\n maxInterval?: Duration | number;\n\n /**\n * Exponentiation factor to use when computing the next retry delay.\n * Defaults to `2`.\n */\n exponentiationFactor?: number;\n\n /**\n * Decide whether a given failure should be retried. When provided, this\n * fully replaces the built-in rule (network / `429` / `5xx`).\n *\n * The idempotency-key gate still applies to regular invocations; workflow\n * submissions, attaches, and output retrieval remain eligible without an\n * idempotency key. The `maxAttempts` cap applies to all of them. This predicate\n * only narrows or broadens *which failures* are retryable within those bounds.\n * Compose with the built-in rule via the exported `defaultShouldRetry`.\n *\n * @param failure the failure being considered\n * @param attempt the zero-based index of the attempt that just failed\n */\n shouldRetry?: (failure: RetryFailure, attempt: number) => boolean;\n}\n\nexport type ConnectionOpts = {\n /**\n * Restate ingress URL.\n * For example: http://localhost:8080\n */\n url: string;\n /**\n * Headers to attach on every request.\n * Use this to attach authentication headers.\n */\n headers?: Record<string, string>;\n\n /**\n * Opt in to automatic retries of ambiguous ingress failures (network errors,\n * HTTP `429`, HTTP `5xx`).\n *\n * Retries are **disabled by default**. Set `true` to enable the built-in\n * policy ({@link RetryPolicy}), or pass a {@link RetryPolicy} to tune it.\n *\n * Even when enabled, regular calls are retried **only** when an\n * `idempotencyKey` is set — without one a retry could double-execute a\n * non-idempotent invocation. Workflow submissions, attaches, and output\n * retrieval are also retried: submissions are idempotent by workflow ID,\n * while attach and output operations only observe the existing workflow. If a\n * submission retry observes a workflow accepted by an earlier attempt, its\n * status is `PreviouslyAccepted`.\n */\n retry?: RetryPolicy | boolean;\n\n /**\n * Default serde to use for ingress payloads when no operation-specific serde\n * is provided. Applies to handler calls, workflow attaches/output polling,\n * awakeable resolution, and attached invocation results.\n *\n * Defaults to `restate.serde.json`.\n */\n serde?: Serde<any>;\n\n /**\n * Codec to use for input/outputs. Check {@link JournalValueCodec} for more details\n *\n * @experimental\n */\n journalValueCodec?: JournalValueCodec;\n\n /**\n * Custom fetch client\n *\n * Allows you to provide a different fetch implementation (e.g., undici fetch for HTTP/2 support).\n *\n * @defaultValue `globalThis.fetch`\n */\n fetch?: typeof globalThis.fetch;\n};\n"],"mappings":";;;AA+PA,IAAa,OAAb,MAAa,KAAW;;;;;;CAMtB,OAAc,KACZ,MACY;AACZ,SAAO,IAAI,KAAK,KAAK;;CAGvB,YAAY,AAASA,MAAgC;EAAhC;;;AAGvB,IAAa,WAAb,MAAa,SAAsB;;;;CAIjC,OAAc,KAAkB,MAA0C;AACxE,SAAO,IAAI,SAAS,KAAK;;CAG3B,QAA4B;AAC1B,MAAI,KAAK,KAAK,UAAU,OACtB,QAAO,yBAAyB,KAAK,KAAK,MAAM;;CAKpD,YAAY,AAASC,MAA6B;EAA7B;;;;;cAgBM,SAAmC,KAAK,KAAK,KAAK;kBAEjD,SAC1B,SAAS,KAAK,KAAK"}
|
package/dist/ingress.cjs
CHANGED
|
@@ -47,7 +47,47 @@ function optsFromArgs(args) {
|
|
|
47
47
|
}
|
|
48
48
|
const IDEMPOTENCY_KEY_HEADER = "idempotency-key";
|
|
49
49
|
const LIMIT_KEY_HEADER = "x-restate-limit-key";
|
|
50
|
-
const
|
|
50
|
+
const getFetch = (opts) => opts.fetch ?? globalThis.fetch;
|
|
51
|
+
const fetchWithRetries = async (opts, url, init, callOpts, retryPolicy) => {
|
|
52
|
+
const userSignal = callOpts?.opts.signal;
|
|
53
|
+
const timeout = callOpts?.opts.timeout;
|
|
54
|
+
if (userSignal !== void 0 && timeout !== void 0) throw new Error("You can't specify both signal and timeout options at the same time");
|
|
55
|
+
const attemptSignal = () => userSignal ?? (timeout !== void 0 ? AbortSignal.timeout(timeout) : void 0);
|
|
56
|
+
const shouldRetry = retryPolicy?.shouldRetry ?? require_retry.defaultShouldRetry;
|
|
57
|
+
for (let attempt = 0;; attempt++) {
|
|
58
|
+
let response;
|
|
59
|
+
let errorBody;
|
|
60
|
+
try {
|
|
61
|
+
response = await getFetch(opts)(url, {
|
|
62
|
+
...init,
|
|
63
|
+
signal: attemptSignal()
|
|
64
|
+
});
|
|
65
|
+
if (response.ok) return new Uint8Array(await response.arrayBuffer());
|
|
66
|
+
errorBody = await response.text();
|
|
67
|
+
} catch (e) {
|
|
68
|
+
if (retryPolicy && attempt < retryPolicy.maxAttempts - 1 && !userSignal?.aborted && shouldRetry({
|
|
69
|
+
kind: "network",
|
|
70
|
+
error: e
|
|
71
|
+
}, attempt)) {
|
|
72
|
+
await require_retry.abortableSleep(require_retry.backoffDelay(retryPolicy, attempt), userSignal);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
77
|
+
if (retryPolicy && attempt < retryPolicy.maxAttempts - 1 && !userSignal?.aborted && shouldRetry({
|
|
78
|
+
kind: "response",
|
|
79
|
+
status: response.status,
|
|
80
|
+
headers: response.headers,
|
|
81
|
+
body: errorBody || void 0
|
|
82
|
+
}, attempt)) {
|
|
83
|
+
const retryAfter = require_retry.parseRetryAfter(response.headers);
|
|
84
|
+
await require_retry.abortableSleep(require_retry.backoffDelay(retryPolicy, attempt, retryAfter), userSignal);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
throw new HttpCallError(response.status, errorBody, `Request failed: ${response.status}\n${errorBody}`);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const doComponentInvocation = async (opts, params, canBeRetried = Boolean(params.opts?.opts.idempotencyKey)) => {
|
|
51
91
|
let attachable = false;
|
|
52
92
|
let url;
|
|
53
93
|
if (params.scope) {
|
|
@@ -88,46 +128,12 @@ const doComponentInvocation = async (opts, params) => {
|
|
|
88
128
|
}
|
|
89
129
|
const limitKey = params.opts?.opts.limitKey;
|
|
90
130
|
if (limitKey) headers[LIMIT_KEY_HEADER] = limitKey;
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
let httpResponse;
|
|
98
|
-
for (let attempt = 0;; attempt++) {
|
|
99
|
-
try {
|
|
100
|
-
httpResponse = await fetch(url, {
|
|
101
|
-
method: params.method ?? "POST",
|
|
102
|
-
headers,
|
|
103
|
-
body,
|
|
104
|
-
signal: attemptSignal()
|
|
105
|
-
});
|
|
106
|
-
} catch (e) {
|
|
107
|
-
if (retryPolicy && attempt < retryPolicy.maxAttempts - 1 && !userSignal?.aborted && shouldRetry({
|
|
108
|
-
kind: "network",
|
|
109
|
-
error: e
|
|
110
|
-
}, attempt)) {
|
|
111
|
-
await require_retry.abortableSleep(require_retry.backoffDelay(retryPolicy, attempt), userSignal);
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
throw e;
|
|
115
|
-
}
|
|
116
|
-
if (httpResponse.ok) break;
|
|
117
|
-
const errorBody = await httpResponse.text();
|
|
118
|
-
if (retryPolicy && attempt < retryPolicy.maxAttempts - 1 && !userSignal?.aborted && shouldRetry({
|
|
119
|
-
kind: "response",
|
|
120
|
-
status: httpResponse.status,
|
|
121
|
-
headers: httpResponse.headers,
|
|
122
|
-
body: errorBody || void 0
|
|
123
|
-
}, attempt)) {
|
|
124
|
-
const retryAfter = require_retry.parseRetryAfter(httpResponse.headers);
|
|
125
|
-
await require_retry.abortableSleep(require_retry.backoffDelay(retryPolicy, attempt, retryAfter), userSignal);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
throw new HttpCallError(httpResponse.status, errorBody, `Request failed: ${httpResponse.status}\n${errorBody}`);
|
|
129
|
-
}
|
|
130
|
-
const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());
|
|
131
|
+
const retryPolicy = canBeRetried ? require_retry.resolveRetryPolicy(opts.retry) : void 0;
|
|
132
|
+
const responseBuf = await fetchWithRetries(opts, url, {
|
|
133
|
+
method: params.method ?? "POST",
|
|
134
|
+
headers,
|
|
135
|
+
body
|
|
136
|
+
}, params.opts, retryPolicy);
|
|
131
137
|
if (!params.send) {
|
|
132
138
|
const decodedBuf = opts.journalValueCodec ? await opts.journalValueCodec.decode(responseBuf) : responseBuf;
|
|
133
139
|
return (params.opts?.opts.output ?? opts.serde ?? __restatedev_restate_sdk_core.serde.json).deserialize(decodedBuf);
|
|
@@ -141,22 +147,13 @@ const doWorkflowHandleCall = async (opts, wfName, wfKey, op, callOpts) => {
|
|
|
141
147
|
const outputSerde = callOpts?.opts.output ?? opts.serde ?? __restatedev_restate_sdk_core.serde.json;
|
|
142
148
|
const headers = { ...opts.headers ?? {} };
|
|
143
149
|
const url = `${opts.url}/restate/workflow/${wfName}/${encodeURIComponent(wfKey)}/${op}`;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
else if (callOpts?.opts?.signal !== void 0) signal = callOpts?.opts?.signal;
|
|
147
|
-
else if (callOpts?.opts?.timeout !== void 0) signal = AbortSignal.timeout(callOpts?.opts?.timeout);
|
|
148
|
-
const httpResponse = await fetch(url, {
|
|
150
|
+
const retryPolicy = require_retry.resolveRetryPolicy(opts.retry);
|
|
151
|
+
const responseBuf = await fetchWithRetries(opts, url, {
|
|
149
152
|
method: "GET",
|
|
150
|
-
headers
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());
|
|
155
|
-
const decodedBuf = opts.journalValueCodec ? await opts.journalValueCodec.decode(responseBuf) : responseBuf;
|
|
156
|
-
return outputSerde.deserialize(decodedBuf);
|
|
157
|
-
}
|
|
158
|
-
const body = await httpResponse.text();
|
|
159
|
-
throw new HttpCallError(httpResponse.status, body, `Request failed: ${httpResponse.status}\n${body}`);
|
|
153
|
+
headers
|
|
154
|
+
}, callOpts, retryPolicy);
|
|
155
|
+
const decodedBuf = opts.journalValueCodec ? await opts.journalValueCodec.decode(responseBuf) : responseBuf;
|
|
156
|
+
return outputSerde.deserialize(decodedBuf);
|
|
160
157
|
};
|
|
161
158
|
var HttpIngress = class {
|
|
162
159
|
constructor(opts) {
|
|
@@ -196,7 +193,7 @@ var HttpIngress = class {
|
|
|
196
193
|
send: true,
|
|
197
194
|
parameter,
|
|
198
195
|
opts: opts$1
|
|
199
|
-
});
|
|
196
|
+
}, true);
|
|
200
197
|
return {
|
|
201
198
|
invocationId: res.invocationId,
|
|
202
199
|
status: res.status,
|
|
@@ -277,7 +274,7 @@ var HttpIngress = class {
|
|
|
277
274
|
parameter,
|
|
278
275
|
opts: opts$1,
|
|
279
276
|
scope: scopeKey
|
|
280
|
-
});
|
|
277
|
+
}, true);
|
|
281
278
|
return {
|
|
282
279
|
invocationId: res.invocationId,
|
|
283
280
|
status: res.status,
|
|
@@ -348,7 +345,7 @@ var HttpIngress = class {
|
|
|
348
345
|
const { body, contentType } = serializeBodyWithContentType(payload, payloadSerde ?? this.opts.serde ?? __restatedev_restate_sdk_core.serde.json, this.opts.journalValueCodec);
|
|
349
346
|
const headers = { ...this.opts.headers ?? {} };
|
|
350
347
|
if (contentType) headers["Content-Type"] = contentType;
|
|
351
|
-
const httpResponse = await
|
|
348
|
+
const httpResponse = await getFetch(this.opts)(url, {
|
|
352
349
|
method: "POST",
|
|
353
350
|
headers,
|
|
354
351
|
body
|
|
@@ -364,7 +361,7 @@ var HttpIngress = class {
|
|
|
364
361
|
"Content-Type": "text/plain",
|
|
365
362
|
...this.opts.headers ?? {}
|
|
366
363
|
};
|
|
367
|
-
const httpResponse = await
|
|
364
|
+
const httpResponse = await getFetch(this.opts)(url, {
|
|
368
365
|
method: "POST",
|
|
369
366
|
headers,
|
|
370
367
|
body: reason
|
|
@@ -379,7 +376,7 @@ var HttpIngress = class {
|
|
|
379
376
|
A service's result is stored only with an idempotencyKey is supplied when invocating the service.`);
|
|
380
377
|
const headers = { ...this.opts.headers ?? {} };
|
|
381
378
|
const url = `${this.opts.url}/restate/invocation/${send.invocationId}/attach`;
|
|
382
|
-
const httpResponse = await
|
|
379
|
+
const httpResponse = await getFetch(this.opts)(url, {
|
|
383
380
|
method: "GET",
|
|
384
381
|
headers
|
|
385
382
|
});
|
package/dist/ingress.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingress.d.cts","names":[],"sources":["../src/ingress.ts"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ingress.d.cts","names":[],"sources":["../src/ingress.ts"],"sourcesContent":[],"mappings":";;;;;;AAkDA;AAIA;;;iBAJgB,OAAA,OAAc,iBAAiB;cAIlC,aAAA,SAAsB,KAAA"}
|
package/dist/ingress.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingress.d.ts","names":[],"sources":["../src/ingress.ts"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ingress.d.ts","names":[],"sources":["../src/ingress.ts"],"sourcesContent":[],"mappings":";;;;;;AAkDA;AAIA;;;iBAJgB,OAAA,OAAc,iBAAiB;cAIlC,aAAA,SAAsB,KAAA"}
|
package/dist/ingress.js
CHANGED
|
@@ -45,7 +45,47 @@ function optsFromArgs(args) {
|
|
|
45
45
|
}
|
|
46
46
|
const IDEMPOTENCY_KEY_HEADER = "idempotency-key";
|
|
47
47
|
const LIMIT_KEY_HEADER = "x-restate-limit-key";
|
|
48
|
-
const
|
|
48
|
+
const getFetch = (opts) => opts.fetch ?? globalThis.fetch;
|
|
49
|
+
const fetchWithRetries = async (opts, url, init, callOpts, retryPolicy) => {
|
|
50
|
+
const userSignal = callOpts?.opts.signal;
|
|
51
|
+
const timeout = callOpts?.opts.timeout;
|
|
52
|
+
if (userSignal !== void 0 && timeout !== void 0) throw new Error("You can't specify both signal and timeout options at the same time");
|
|
53
|
+
const attemptSignal = () => userSignal ?? (timeout !== void 0 ? AbortSignal.timeout(timeout) : void 0);
|
|
54
|
+
const shouldRetry = retryPolicy?.shouldRetry ?? defaultShouldRetry;
|
|
55
|
+
for (let attempt = 0;; attempt++) {
|
|
56
|
+
let response;
|
|
57
|
+
let errorBody;
|
|
58
|
+
try {
|
|
59
|
+
response = await getFetch(opts)(url, {
|
|
60
|
+
...init,
|
|
61
|
+
signal: attemptSignal()
|
|
62
|
+
});
|
|
63
|
+
if (response.ok) return new Uint8Array(await response.arrayBuffer());
|
|
64
|
+
errorBody = await response.text();
|
|
65
|
+
} catch (e) {
|
|
66
|
+
if (retryPolicy && attempt < retryPolicy.maxAttempts - 1 && !userSignal?.aborted && shouldRetry({
|
|
67
|
+
kind: "network",
|
|
68
|
+
error: e
|
|
69
|
+
}, attempt)) {
|
|
70
|
+
await abortableSleep(backoffDelay(retryPolicy, attempt), userSignal);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
throw e;
|
|
74
|
+
}
|
|
75
|
+
if (retryPolicy && attempt < retryPolicy.maxAttempts - 1 && !userSignal?.aborted && shouldRetry({
|
|
76
|
+
kind: "response",
|
|
77
|
+
status: response.status,
|
|
78
|
+
headers: response.headers,
|
|
79
|
+
body: errorBody || void 0
|
|
80
|
+
}, attempt)) {
|
|
81
|
+
const retryAfter = parseRetryAfter(response.headers);
|
|
82
|
+
await abortableSleep(backoffDelay(retryPolicy, attempt, retryAfter), userSignal);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
throw new HttpCallError(response.status, errorBody, `Request failed: ${response.status}\n${errorBody}`);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const doComponentInvocation = async (opts, params, canBeRetried = Boolean(params.opts?.opts.idempotencyKey)) => {
|
|
49
89
|
let attachable = false;
|
|
50
90
|
let url;
|
|
51
91
|
if (params.scope) {
|
|
@@ -86,46 +126,12 @@ const doComponentInvocation = async (opts, params) => {
|
|
|
86
126
|
}
|
|
87
127
|
const limitKey = params.opts?.opts.limitKey;
|
|
88
128
|
if (limitKey) headers[LIMIT_KEY_HEADER] = limitKey;
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
let httpResponse;
|
|
96
|
-
for (let attempt = 0;; attempt++) {
|
|
97
|
-
try {
|
|
98
|
-
httpResponse = await fetch(url, {
|
|
99
|
-
method: params.method ?? "POST",
|
|
100
|
-
headers,
|
|
101
|
-
body,
|
|
102
|
-
signal: attemptSignal()
|
|
103
|
-
});
|
|
104
|
-
} catch (e) {
|
|
105
|
-
if (retryPolicy && attempt < retryPolicy.maxAttempts - 1 && !userSignal?.aborted && shouldRetry({
|
|
106
|
-
kind: "network",
|
|
107
|
-
error: e
|
|
108
|
-
}, attempt)) {
|
|
109
|
-
await abortableSleep(backoffDelay(retryPolicy, attempt), userSignal);
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
throw e;
|
|
113
|
-
}
|
|
114
|
-
if (httpResponse.ok) break;
|
|
115
|
-
const errorBody = await httpResponse.text();
|
|
116
|
-
if (retryPolicy && attempt < retryPolicy.maxAttempts - 1 && !userSignal?.aborted && shouldRetry({
|
|
117
|
-
kind: "response",
|
|
118
|
-
status: httpResponse.status,
|
|
119
|
-
headers: httpResponse.headers,
|
|
120
|
-
body: errorBody || void 0
|
|
121
|
-
}, attempt)) {
|
|
122
|
-
const retryAfter = parseRetryAfter(httpResponse.headers);
|
|
123
|
-
await abortableSleep(backoffDelay(retryPolicy, attempt, retryAfter), userSignal);
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
throw new HttpCallError(httpResponse.status, errorBody, `Request failed: ${httpResponse.status}\n${errorBody}`);
|
|
127
|
-
}
|
|
128
|
-
const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());
|
|
129
|
+
const retryPolicy = canBeRetried ? resolveRetryPolicy(opts.retry) : void 0;
|
|
130
|
+
const responseBuf = await fetchWithRetries(opts, url, {
|
|
131
|
+
method: params.method ?? "POST",
|
|
132
|
+
headers,
|
|
133
|
+
body
|
|
134
|
+
}, params.opts, retryPolicy);
|
|
129
135
|
if (!params.send) {
|
|
130
136
|
const decodedBuf = opts.journalValueCodec ? await opts.journalValueCodec.decode(responseBuf) : responseBuf;
|
|
131
137
|
return (params.opts?.opts.output ?? opts.serde ?? serde.json).deserialize(decodedBuf);
|
|
@@ -139,22 +145,13 @@ const doWorkflowHandleCall = async (opts, wfName, wfKey, op, callOpts) => {
|
|
|
139
145
|
const outputSerde = callOpts?.opts.output ?? opts.serde ?? serde.json;
|
|
140
146
|
const headers = { ...opts.headers ?? {} };
|
|
141
147
|
const url = `${opts.url}/restate/workflow/${wfName}/${encodeURIComponent(wfKey)}/${op}`;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
else if (callOpts?.opts?.signal !== void 0) signal = callOpts?.opts?.signal;
|
|
145
|
-
else if (callOpts?.opts?.timeout !== void 0) signal = AbortSignal.timeout(callOpts?.opts?.timeout);
|
|
146
|
-
const httpResponse = await fetch(url, {
|
|
148
|
+
const retryPolicy = resolveRetryPolicy(opts.retry);
|
|
149
|
+
const responseBuf = await fetchWithRetries(opts, url, {
|
|
147
150
|
method: "GET",
|
|
148
|
-
headers
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());
|
|
153
|
-
const decodedBuf = opts.journalValueCodec ? await opts.journalValueCodec.decode(responseBuf) : responseBuf;
|
|
154
|
-
return outputSerde.deserialize(decodedBuf);
|
|
155
|
-
}
|
|
156
|
-
const body = await httpResponse.text();
|
|
157
|
-
throw new HttpCallError(httpResponse.status, body, `Request failed: ${httpResponse.status}\n${body}`);
|
|
151
|
+
headers
|
|
152
|
+
}, callOpts, retryPolicy);
|
|
153
|
+
const decodedBuf = opts.journalValueCodec ? await opts.journalValueCodec.decode(responseBuf) : responseBuf;
|
|
154
|
+
return outputSerde.deserialize(decodedBuf);
|
|
158
155
|
};
|
|
159
156
|
var HttpIngress = class {
|
|
160
157
|
constructor(opts) {
|
|
@@ -194,7 +191,7 @@ var HttpIngress = class {
|
|
|
194
191
|
send: true,
|
|
195
192
|
parameter,
|
|
196
193
|
opts: opts$1
|
|
197
|
-
});
|
|
194
|
+
}, true);
|
|
198
195
|
return {
|
|
199
196
|
invocationId: res.invocationId,
|
|
200
197
|
status: res.status,
|
|
@@ -275,7 +272,7 @@ var HttpIngress = class {
|
|
|
275
272
|
parameter,
|
|
276
273
|
opts: opts$1,
|
|
277
274
|
scope: scopeKey
|
|
278
|
-
});
|
|
275
|
+
}, true);
|
|
279
276
|
return {
|
|
280
277
|
invocationId: res.invocationId,
|
|
281
278
|
status: res.status,
|
|
@@ -346,7 +343,7 @@ var HttpIngress = class {
|
|
|
346
343
|
const { body, contentType } = serializeBodyWithContentType(payload, payloadSerde ?? this.opts.serde ?? serde.json, this.opts.journalValueCodec);
|
|
347
344
|
const headers = { ...this.opts.headers ?? {} };
|
|
348
345
|
if (contentType) headers["Content-Type"] = contentType;
|
|
349
|
-
const httpResponse = await
|
|
346
|
+
const httpResponse = await getFetch(this.opts)(url, {
|
|
350
347
|
method: "POST",
|
|
351
348
|
headers,
|
|
352
349
|
body
|
|
@@ -362,7 +359,7 @@ var HttpIngress = class {
|
|
|
362
359
|
"Content-Type": "text/plain",
|
|
363
360
|
...this.opts.headers ?? {}
|
|
364
361
|
};
|
|
365
|
-
const httpResponse = await
|
|
362
|
+
const httpResponse = await getFetch(this.opts)(url, {
|
|
366
363
|
method: "POST",
|
|
367
364
|
headers,
|
|
368
365
|
body: reason
|
|
@@ -377,7 +374,7 @@ var HttpIngress = class {
|
|
|
377
374
|
A service's result is stored only with an idempotencyKey is supplied when invocating the service.`);
|
|
378
375
|
const headers = { ...this.opts.headers ?? {} };
|
|
379
376
|
const url = `${this.opts.url}/restate/invocation/${send.invocationId}/attach`;
|
|
380
|
-
const httpResponse = await
|
|
377
|
+
const httpResponse = await getFetch(this.opts)(url, {
|
|
381
378
|
method: "GET",
|
|
382
379
|
headers
|
|
383
380
|
});
|
package/dist/ingress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingress.js","names":["status: number","responseText: string","message: string","parameter: unknown","opts: Opts<unknown, unknown> | SendOpts<unknown> | undefined","url: string","httpResponse: Response","signal: AbortSignal | undefined","opts: ConnectionOpts","res: Send","opts","body","serde"],"sources":["../src/ingress.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH\n *\n * This file is part of the Restate SDK for Node.js/TypeScript,\n * which is released under the MIT license.\n *\n * You can find a copy of the license in file LICENSE in the root\n * directory of this repository or package, or at\n * https://github.com/restatedev/sdk-typescript/blob/main/LICENSE\n */\n\nimport {\n type Service,\n type ServiceDefinitionFrom,\n type VirtualObject,\n type WorkflowDefinitionFrom,\n type Workflow,\n type VirtualObjectDefinitionFrom,\n type Serde,\n serde,\n type JournalValueCodec,\n} from \"@restatedev/restate-sdk-core\";\nimport {\n ConnectionOpts,\n Ingress,\n IngressClient,\n IngressSendClient,\n IngressWorkflowClient,\n Output,\n Send,\n ScopedIngress,\n WorkflowSubmission,\n} from \"./api.js\";\n\nimport { Opts, SendOpts } from \"./api.js\";\nimport {\n abortableSleep,\n backoffDelay,\n defaultShouldRetry,\n parseRetryAfter,\n resolveRetryPolicy,\n} from \"./retry.js\";\n\n/**\n * Connect to the restate Ingress\n *\n * @param opts connection options\n * @returns a connection the the restate ingress\n */\nexport function connect(opts: ConnectionOpts): Ingress {\n return new HttpIngress(opts);\n}\n\nexport class HttpCallError extends Error {\n constructor(\n public readonly status: number,\n public readonly responseText: string,\n public override readonly message: string\n ) {\n super(message);\n }\n}\n\ntype InvocationParameters<I> = {\n component: string;\n handler: string;\n key?: string;\n send?: boolean;\n opts?: Opts<I, unknown> | SendOpts<I>;\n parameter?: I;\n method?: string;\n scope?: string;\n};\n\nfunction optsFromArgs(args: unknown[]): {\n parameter?: unknown;\n opts?: Opts<unknown, unknown> | SendOpts<unknown>;\n} {\n let parameter: unknown;\n let opts: Opts<unknown, unknown> | SendOpts<unknown> | undefined;\n switch (args.length) {\n case 0: {\n break;\n }\n case 1: {\n if (args[0] instanceof Opts) {\n opts = args[0];\n } else if (args[0] instanceof SendOpts) {\n opts = args[0];\n } else {\n parameter = args[0];\n }\n break;\n }\n case 2: {\n parameter = args[0];\n if (args[1] instanceof Opts) {\n opts = args[1];\n } else if (args[1] instanceof SendOpts) {\n opts = args[1];\n } else {\n throw new TypeError(\n \"The second argument must be either Opts or SendOpts\"\n );\n }\n break;\n }\n default: {\n throw new TypeError(\"unexpected number of arguments\");\n }\n }\n return {\n parameter,\n opts,\n };\n}\n\nconst IDEMPOTENCY_KEY_HEADER = \"idempotency-key\";\nconst LIMIT_KEY_HEADER = \"x-restate-limit-key\";\n\nconst doComponentInvocation = async <I, O>(\n opts: ConnectionOpts,\n params: InvocationParameters<I>\n): Promise<O> => {\n let attachable = false;\n //\n // ingress URL\n //\n let url: string;\n if (params.scope) {\n // Scoped path: /restate/scope/{scope}/{call|send}/{service}/{key?}/{handler}\n const pathType = params.send ? \"send\" : \"call\";\n const parts = [\n opts.url,\n \"restate/scope\",\n encodeURIComponent(params.scope),\n pathType,\n params.component,\n ];\n if (params.key) {\n parts.push(encodeURIComponent(params.key));\n }\n parts.push(params.handler);\n url = parts.join(\"/\");\n if (params.send && params.opts instanceof SendOpts) {\n const delay = params.opts.delay();\n if (delay) url += `?delay=${delay}ms`;\n }\n } else {\n const fragments = [opts.url, params.component];\n if (params.key) {\n fragments.push(encodeURIComponent(params.key));\n }\n fragments.push(params.handler);\n if (params.send ?? false) {\n if (params.opts instanceof SendOpts) {\n fragments.push(computeDelayAsIso(params.opts));\n } else {\n fragments.push(\"send\");\n }\n }\n url = fragments.join(\"/\");\n }\n //\n // request body\n //\n const inputSerde = params.opts?.opts.input ?? opts.serde ?? serde.json;\n\n const { body, contentType } = serializeBodyWithContentType(\n params.parameter,\n inputSerde,\n opts.journalValueCodec\n );\n //\n // headers\n //\n const headers = {\n ...(opts.headers ?? {}),\n ...(params.opts?.opts?.headers ?? {}),\n };\n if (contentType) {\n headers[\"Content-Type\"] = contentType;\n }\n //\n // idempotency\n //\n const idempotencyKey = params.opts?.opts.idempotencyKey;\n if (idempotencyKey) {\n headers[IDEMPOTENCY_KEY_HEADER] = idempotencyKey;\n attachable = true;\n }\n //\n // limit key\n //\n const limitKey = params.opts?.opts.limitKey;\n if (limitKey) {\n headers[LIMIT_KEY_HEADER] = limitKey;\n }\n\n // Abort signal, if any\n const userSignal = params.opts?.opts.signal;\n const timeout = params.opts?.opts.timeout;\n if (userSignal !== undefined && timeout !== undefined) {\n throw new Error(\n \"You can't specify both signal and timeout options at the same time\"\n );\n }\n // A fresh timeout signal is minted per attempt below — a single\n // AbortSignal.timeout() would already be aborted on the second attempt.\n const attemptSignal = (): AbortSignal | undefined =>\n userSignal ??\n (timeout !== undefined ? AbortSignal.timeout(timeout) : undefined);\n\n //\n // retries\n //\n // Retries are opt-in (opts.retry) AND only ever attempted when the call\n // carries an idempotency key: Restate then dedupes the request, so re-issuing\n // it after an ambiguous failure (network error, 429, 5xx) safely attaches to\n // the in-flight/completed invocation instead of starting a duplicate. Without\n // a key, retrying is unsafe.\n //\n const retryPolicy = idempotencyKey\n ? resolveRetryPolicy(opts.retry)\n : undefined;\n const shouldRetry = retryPolicy?.shouldRetry ?? defaultShouldRetry;\n\n //\n // make the call\n //\n let httpResponse: Response;\n for (let attempt = 0; ; attempt++) {\n try {\n httpResponse = await fetch(url, {\n method: params.method ?? \"POST\",\n headers,\n body,\n signal: attemptSignal(),\n });\n } catch (e) {\n // network error (fetch rejected) — ambiguous\n if (\n retryPolicy &&\n attempt < retryPolicy.maxAttempts - 1 &&\n !userSignal?.aborted &&\n shouldRetry({ kind: \"network\", error: e }, attempt)\n ) {\n await abortableSleep(backoffDelay(retryPolicy, attempt), userSignal);\n continue;\n }\n throw e;\n }\n if (httpResponse.ok) {\n break;\n }\n // Read the error body once; it is reused for the retry decision and, if we\n // give up, for the thrown HttpCallError.\n const errorBody = await httpResponse.text();\n if (\n retryPolicy &&\n attempt < retryPolicy.maxAttempts - 1 &&\n !userSignal?.aborted &&\n shouldRetry(\n {\n kind: \"response\",\n status: httpResponse.status,\n headers: httpResponse.headers,\n body: errorBody || undefined,\n },\n attempt\n )\n ) {\n const retryAfter = parseRetryAfter(httpResponse.headers);\n await abortableSleep(\n backoffDelay(retryPolicy, attempt, retryAfter),\n userSignal\n );\n continue;\n }\n throw new HttpCallError(\n httpResponse.status,\n errorBody,\n `Request failed: ${httpResponse.status}\\n${errorBody}`\n );\n }\n const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());\n if (!params.send) {\n const decodedBuf = opts.journalValueCodec\n ? await opts.journalValueCodec.decode(responseBuf)\n : responseBuf;\n const outputSerde = params.opts?.opts.output ?? opts.serde ?? serde.json;\n return outputSerde.deserialize(decodedBuf) as O;\n }\n const json = serde.json.deserialize(responseBuf) as O;\n return { ...json, attachable };\n};\n\nconst doWorkflowHandleCall = async <O>(\n opts: ConnectionOpts,\n wfName: string,\n wfKey: string,\n op: \"output\" | \"attach\",\n callOpts?: Opts<unknown, O> | SendOpts<unknown>\n): Promise<O> => {\n const outputSerde = callOpts?.opts.output ?? opts.serde ?? serde.json;\n //\n // headers\n //\n const headers = {\n ...(opts.headers ?? {}),\n };\n //\n // make the call\n //\n const url = `${opts.url}/restate/workflow/${wfName}/${encodeURIComponent(\n wfKey\n )}/${op}`;\n\n // Abort signal, if any\n let signal: AbortSignal | undefined;\n if (\n callOpts?.opts?.signal !== undefined &&\n callOpts?.opts?.timeout !== undefined\n ) {\n throw new Error(\n \"You can't specify both signal and timeout options at the same time\"\n );\n } else if (callOpts?.opts?.signal !== undefined) {\n signal = callOpts?.opts?.signal;\n } else if (callOpts?.opts?.timeout !== undefined) {\n signal = AbortSignal.timeout(callOpts?.opts?.timeout);\n }\n\n const httpResponse = await fetch(url, {\n method: \"GET\",\n headers,\n signal,\n });\n if (httpResponse.ok) {\n const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());\n const decodedBuf = opts.journalValueCodec\n ? await opts.journalValueCodec.decode(responseBuf)\n : responseBuf;\n return outputSerde.deserialize(decodedBuf) as O;\n }\n const body = await httpResponse.text();\n throw new HttpCallError(\n httpResponse.status,\n body,\n `Request failed: ${httpResponse.status}\\n${body}`\n );\n};\n\nclass HttpIngress implements Ingress {\n constructor(private readonly opts: ConnectionOpts) {}\n\n private proxy(component: string, key?: string, send?: boolean) {\n return new Proxy(\n {},\n {\n get: (_target, prop) => {\n const handler = prop as string;\n return (...args: unknown[]) => {\n const { parameter, opts } = optsFromArgs(args);\n return doComponentInvocation<unknown, unknown>(this.opts, {\n component,\n handler,\n key,\n parameter,\n opts,\n send,\n });\n };\n },\n }\n );\n }\n\n serviceClient<D>(opts: ServiceDefinitionFrom<D>): IngressClient<Service<D>> {\n return this.proxy(opts.name) as IngressClient<Service<D>>;\n }\n\n objectClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressClient<VirtualObject<D>> {\n return this.proxy(opts.name, key) as IngressClient<VirtualObject<D>>;\n }\n\n workflowClient<D>(\n opts: WorkflowDefinitionFrom<D>,\n key: string\n ): IngressWorkflowClient<Workflow<D>> {\n const component = opts.name;\n const conn = this.opts;\n\n const workflowSubmit = async (\n ...args: unknown[]\n ): Promise<WorkflowSubmission<unknown>> => {\n const { parameter, opts } = optsFromArgs(args);\n const res: Send = await doComponentInvocation(conn, {\n component,\n handler: \"run\",\n key,\n send: true,\n parameter,\n opts,\n });\n\n return {\n invocationId: res.invocationId,\n status: res.status,\n attachable: true,\n };\n };\n\n const workflowAttach = (opts?: Opts<void, unknown>) =>\n doWorkflowHandleCall(conn, component, key, \"attach\", opts);\n\n const workflowOutput = async (\n opts?: Opts<void, unknown>\n ): Promise<Output<unknown>> => {\n try {\n const result = await doWorkflowHandleCall(\n conn,\n component,\n key,\n \"output\",\n opts\n );\n\n return {\n ready: true,\n result,\n };\n } catch (e) {\n if (!(e instanceof HttpCallError) || e.status !== 470) {\n throw e;\n }\n return {\n ready: false,\n get result() {\n throw new Error(\"Calling result() on a non ready workflow\");\n },\n };\n }\n };\n\n return new Proxy(\n {},\n {\n get: (_target, prop) => {\n const handler = prop as string;\n if (handler === \"workflowSubmit\") {\n return workflowSubmit;\n } else if (handler === \"workflowAttach\") {\n return workflowAttach;\n } else if (handler === \"workflowOutput\") {\n return workflowOutput;\n }\n // shared handlers pass trough via the ingress's normal invocation form\n // i.e. POST /<svc>/<key>/<handler>\n return (...args: unknown[]) => {\n const { parameter, opts } = optsFromArgs(args);\n return doComponentInvocation(conn, {\n component,\n handler,\n key,\n parameter,\n opts,\n });\n };\n },\n }\n ) as IngressWorkflowClient<Workflow<D>>;\n }\n\n objectSendClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressSendClient<VirtualObject<D>> {\n return this.proxy(opts.name, key, true) as IngressSendClient<\n VirtualObject<D>\n >;\n }\n\n serviceSendClient<D>(\n opts: ServiceDefinitionFrom<D>\n ): IngressSendClient<Service<D>> {\n return this.proxy(opts.name, undefined, true) as IngressSendClient<\n Service<D>\n >;\n }\n\n scope(scopeKey: string): ScopedIngress {\n const conn = this.opts;\n const scopedProxy = (component: string, key?: string, send?: boolean) =>\n new Proxy(\n {},\n {\n get: (_target, prop) => {\n const handler = prop as string;\n return (...args: unknown[]) => {\n const { parameter, opts } = optsFromArgs(args);\n return doComponentInvocation<unknown, unknown>(conn, {\n component,\n handler,\n key,\n parameter,\n opts,\n send,\n scope: scopeKey,\n });\n };\n },\n }\n );\n\n return {\n serviceClient: <D>(opts: ServiceDefinitionFrom<D>) =>\n scopedProxy(opts.name) as IngressClient<Service<D>>,\n serviceSendClient: <D>(opts: ServiceDefinitionFrom<D>) =>\n scopedProxy(opts.name, undefined, true) as IngressSendClient<\n Service<D>\n >,\n objectClient: <D>(opts: VirtualObjectDefinitionFrom<D>, key: string) =>\n scopedProxy(opts.name, key) as IngressClient<VirtualObject<D>>,\n objectSendClient: <D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ) =>\n scopedProxy(opts.name, key, true) as IngressSendClient<\n VirtualObject<D>\n >,\n workflowClient: <D>(\n opts: WorkflowDefinitionFrom<D>,\n key: string\n ): IngressWorkflowClient<Workflow<D>> => {\n const component = opts.name;\n\n const workflowSubmit = async (\n ...args: unknown[]\n ): Promise<WorkflowSubmission<unknown>> => {\n const { parameter, opts } = optsFromArgs(args);\n const res: Send = await doComponentInvocation(conn, {\n component,\n handler: \"run\",\n key,\n send: true,\n parameter,\n opts,\n scope: scopeKey,\n });\n return {\n invocationId: res.invocationId,\n status: res.status,\n attachable: true,\n };\n };\n\n const workflowAttach = (opts?: Opts<void, unknown>) =>\n doWorkflowHandleCall(conn, component, key, \"attach\", opts);\n\n const workflowOutput = async (\n opts?: Opts<void, unknown>\n ): Promise<Output<unknown>> => {\n try {\n const result = await doWorkflowHandleCall(\n conn,\n component,\n key,\n \"output\",\n opts\n );\n return { ready: true, result };\n } catch (e) {\n if (!(e instanceof HttpCallError) || e.status !== 470) {\n throw e;\n }\n return {\n ready: false,\n get result() {\n throw new Error(\"Calling result() on a non ready workflow\");\n },\n };\n }\n };\n\n return new Proxy(\n {},\n {\n get: (_target, prop) => {\n const handler = prop as string;\n if (handler === \"workflowSubmit\") {\n return workflowSubmit;\n } else if (handler === \"workflowAttach\") {\n return workflowAttach;\n } else if (handler === \"workflowOutput\") {\n return workflowOutput;\n }\n return (...args: unknown[]) => {\n const { parameter, opts } = optsFromArgs(args);\n return doComponentInvocation(conn, {\n component,\n handler,\n key,\n parameter,\n opts,\n scope: scopeKey,\n });\n };\n },\n }\n ) as IngressWorkflowClient<Workflow<D>>;\n },\n };\n }\n\n async call<I, O>(opts: {\n service: string;\n handler: string;\n parameter: I;\n key?: string;\n scope?: string;\n opts?: Opts<I, O>;\n }): Promise<O> {\n return doComponentInvocation<I, O>(this.opts, {\n component: opts.service,\n handler: opts.handler,\n key: opts.key,\n scope: opts.scope,\n parameter: opts.parameter,\n send: false,\n opts: opts.opts,\n });\n }\n\n async send<I>(opts: {\n service: string;\n handler: string;\n parameter: I;\n key?: string;\n scope?: string;\n opts?: SendOpts<I>;\n }): Promise<Send> {\n return doComponentInvocation<I, Send>(this.opts, {\n component: opts.service,\n handler: opts.handler,\n key: opts.key,\n scope: opts.scope,\n parameter: opts.parameter,\n send: true,\n opts: opts.opts,\n });\n }\n\n async resolveAwakeable<T>(\n id: string,\n payload?: T,\n payloadSerde?: Serde<T>\n ): Promise<void> {\n const url = `${this.opts.url}/restate/a/${id}/resolve`;\n const { body, contentType } = serializeBodyWithContentType(\n payload,\n payloadSerde ?? this.opts.serde ?? serde.json,\n this.opts.journalValueCodec\n );\n const headers = {\n ...(this.opts.headers ?? {}),\n };\n if (contentType) {\n headers[\"Content-Type\"] = contentType;\n }\n const httpResponse = await fetch(url, {\n method: \"POST\",\n headers,\n body,\n });\n if (!httpResponse.ok) {\n const body = await httpResponse.text();\n throw new HttpCallError(\n httpResponse.status,\n body,\n `Request failed: ${httpResponse.status}\\n${body}`\n );\n }\n }\n\n async rejectAwakeable(id: string, reason: string): Promise<void> {\n const url = `${this.opts.url}/restate/a/${id}/reject`;\n const headers = {\n \"Content-Type\": \"text/plain\",\n ...(this.opts.headers ?? {}),\n };\n const httpResponse = await fetch(url, {\n method: \"POST\",\n headers,\n body: reason,\n });\n if (!httpResponse.ok) {\n const body = await httpResponse.text();\n throw new HttpCallError(\n httpResponse.status,\n body,\n `Request failed: ${httpResponse.status}\\n${body}`\n );\n }\n }\n\n async result<T>(\n send: Send<T> | WorkflowSubmission<T>,\n resultSerde?: Serde<T>\n ): Promise<T> {\n if (!send.attachable) {\n throw new Error(\n `Unable to fetch the result for ${send.invocationId}.\n A service's result is stored only with an idempotencyKey is supplied when invocating the service.`\n );\n }\n //\n // headers\n //\n const headers = {\n ...(this.opts.headers ?? {}),\n };\n //\n // make the call\n const url = `${this.opts.url}/restate/invocation/${send.invocationId}/attach`;\n\n const httpResponse = await fetch(url, {\n method: \"GET\",\n headers,\n });\n if (httpResponse.ok) {\n const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());\n const decodedBuf = this.opts.journalValueCodec\n ? await this.opts.journalValueCodec.decode(responseBuf)\n : responseBuf;\n return (resultSerde ?? this.opts.serde ?? serde.json).deserialize(\n decodedBuf\n ) as T;\n }\n const body = await httpResponse.text();\n throw new HttpCallError(\n httpResponse.status,\n body,\n `Request failed: ${httpResponse.status}\\n${body}`\n );\n }\n}\n\nfunction computeDelayAsIso(opts: SendOpts): string {\n const delay = opts.delay();\n if (!delay) {\n return \"send\";\n }\n return `send?delay=${delay}ms`;\n}\n\nfunction serializeBodyWithContentType(\n body: unknown,\n serde: Serde<unknown>,\n journalValueCodec?: JournalValueCodec\n): {\n body?: Uint8Array;\n contentType?: string;\n} {\n let buffer = serde.serialize(body);\n if (journalValueCodec) {\n buffer = journalValueCodec.encode(buffer);\n }\n return {\n body: buffer,\n contentType: serde.contentType,\n };\n}\n"],"mappings":";;;;;;;;;;;AAiDA,SAAgB,QAAQ,MAA+B;AACrD,QAAO,IAAI,YAAY,KAAK;;AAG9B,IAAa,gBAAb,cAAmC,MAAM;CACvC,YACE,AAAgBA,QAChB,AAAgBC,cAChB,AAAyBC,SACzB;AACA,QAAM,QAAQ;EAJE;EACA;EACS;;;AAiB7B,SAAS,aAAa,MAGpB;CACA,IAAIC;CACJ,IAAIC;AACJ,SAAQ,KAAK,QAAb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AQ,KAAK,OAAO;AAC1B,KAAI,CAAC,MACH,QAAO;AAET,QAAO,cAAc,MAAM;;AAG7B,SAAS,6BACP,MACA,SACA,mBAIA;CACA,IAAI,SAASC,QAAM,UAAU,KAAK;AAClC,KAAI,kBACF,UAAS,kBAAkB,OAAO,OAAO;AAE3C,QAAO;EACL,MAAM;EACN,aAAaA,QAAM;EACpB"}
|
|
1
|
+
{"version":3,"file":"ingress.js","names":["status: number","responseText: string","message: string","parameter: unknown","opts: Opts<unknown, unknown> | SendOpts<unknown> | undefined","response: Response","errorBody: string","url: string","opts: ConnectionOpts","res: Send","opts","body","serde"],"sources":["../src/ingress.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH\n *\n * This file is part of the Restate SDK for Node.js/TypeScript,\n * which is released under the MIT license.\n *\n * You can find a copy of the license in file LICENSE in the root\n * directory of this repository or package, or at\n * https://github.com/restatedev/sdk-typescript/blob/main/LICENSE\n */\n\nimport {\n type Service,\n type ServiceDefinitionFrom,\n type VirtualObject,\n type WorkflowDefinitionFrom,\n type Workflow,\n type VirtualObjectDefinitionFrom,\n type Serde,\n serde,\n type JournalValueCodec,\n} from \"@restatedev/restate-sdk-core\";\nimport {\n ConnectionOpts,\n Ingress,\n IngressClient,\n IngressSendClient,\n IngressWorkflowClient,\n Output,\n Send,\n ScopedIngress,\n WorkflowSubmission,\n} from \"./api.js\";\n\nimport { Opts, SendOpts } from \"./api.js\";\nimport {\n abortableSleep,\n backoffDelay,\n defaultShouldRetry,\n parseRetryAfter,\n type ResolvedRetryPolicy,\n resolveRetryPolicy,\n} from \"./retry.js\";\n\n/**\n * Connect to the restate Ingress\n *\n * @param opts connection options\n * @returns a connection the the restate ingress\n */\nexport function connect(opts: ConnectionOpts): Ingress {\n return new HttpIngress(opts);\n}\n\nexport class HttpCallError extends Error {\n constructor(\n public readonly status: number,\n public readonly responseText: string,\n public override readonly message: string\n ) {\n super(message);\n }\n}\n\ntype InvocationParameters<I> = {\n component: string;\n handler: string;\n key?: string;\n send?: boolean;\n opts?: Opts<I, unknown> | SendOpts<I>;\n parameter?: I;\n method?: string;\n scope?: string;\n};\n\nfunction optsFromArgs(args: unknown[]): {\n parameter?: unknown;\n opts?: Opts<unknown, unknown> | SendOpts<unknown>;\n} {\n let parameter: unknown;\n let opts: Opts<unknown, unknown> | SendOpts<unknown> | undefined;\n switch (args.length) {\n case 0: {\n break;\n }\n case 1: {\n if (args[0] instanceof Opts) {\n opts = args[0];\n } else if (args[0] instanceof SendOpts) {\n opts = args[0];\n } else {\n parameter = args[0];\n }\n break;\n }\n case 2: {\n parameter = args[0];\n if (args[1] instanceof Opts) {\n opts = args[1];\n } else if (args[1] instanceof SendOpts) {\n opts = args[1];\n } else {\n throw new TypeError(\n \"The second argument must be either Opts or SendOpts\"\n );\n }\n break;\n }\n default: {\n throw new TypeError(\"unexpected number of arguments\");\n }\n }\n return {\n parameter,\n opts,\n };\n}\n\nconst IDEMPOTENCY_KEY_HEADER = \"idempotency-key\";\nconst LIMIT_KEY_HEADER = \"x-restate-limit-key\";\n\nconst getFetch = (opts: ConnectionOpts): NonNullable<ConnectionOpts[\"fetch\"]> =>\n opts.fetch ?? globalThis.fetch;\n\nconst fetchWithRetries = async (\n opts: ConnectionOpts,\n url: string,\n init: RequestInit,\n callOpts: Opts<unknown, unknown> | SendOpts<unknown> | undefined,\n retryPolicy: ResolvedRetryPolicy | undefined\n): Promise<Uint8Array> => {\n const userSignal = callOpts?.opts.signal;\n const timeout = callOpts?.opts.timeout;\n if (userSignal !== undefined && timeout !== undefined) {\n // The caller configured two mutually exclusive ways to abort each attempt.\n throw new Error(\n \"You can't specify both signal and timeout options at the same time\"\n );\n }\n // A fresh timeout signal is minted per attempt below — a single\n // AbortSignal.timeout() would already be aborted on the second attempt.\n const attemptSignal = (): AbortSignal | undefined =>\n userSignal ??\n (timeout !== undefined ? AbortSignal.timeout(timeout) : undefined);\n const shouldRetry = retryPolicy?.shouldRetry ?? defaultShouldRetry;\n\n for (let attempt = 0; ; attempt++) {\n let response: Response;\n let errorBody: string;\n try {\n response = await getFetch(opts)(url, {\n ...init,\n signal: attemptSignal(),\n });\n if (response.ok) {\n // A 2xx response was received. Keep the body read inside this try so a\n // connection failure while streaming the body is retried as ambiguous.\n return new Uint8Array(await response.arrayBuffer());\n }\n // fetch resolves normally for non-2xx statuses. Read the body here both\n // for RetryFailure inspection and the final HttpCallError.\n errorBody = await response.text();\n } catch (e) {\n // fetch rejected, or the response body failed while streaming. Both are\n // ambiguous because the server may already have processed the request.\n if (\n retryPolicy &&\n attempt < retryPolicy.maxAttempts - 1 &&\n !userSignal?.aborted &&\n shouldRetry({ kind: \"network\", error: e }, attempt)\n ) {\n // Retries are enabled, attempts remain, the caller did not abort, and\n // the policy accepted this network failure.\n await abortableSleep(backoffDelay(retryPolicy, attempt), userSignal);\n continue;\n }\n // Retries are disabled or exhausted, the caller aborted, or the policy\n // rejected this failure.\n throw e;\n }\n if (\n retryPolicy &&\n attempt < retryPolicy.maxAttempts - 1 &&\n !userSignal?.aborted &&\n shouldRetry(\n {\n kind: \"response\",\n status: response.status,\n headers: response.headers,\n body: errorBody || undefined,\n },\n attempt\n )\n ) {\n // A non-2xx response was received, attempts remain, and the policy chose\n // to retry it (by default, HTTP 429 and 5xx).\n const retryAfter = parseRetryAfter(response.headers);\n await abortableSleep(\n backoffDelay(retryPolicy, attempt, retryAfter),\n userSignal\n );\n continue;\n }\n // The response is not retryable, retries are disabled or exhausted, the\n // caller aborted, or the policy rejected this response.\n throw new HttpCallError(\n response.status,\n errorBody,\n `Request failed: ${response.status}\\n${errorBody}`\n );\n }\n};\n\nconst doComponentInvocation = async <I, O>(\n opts: ConnectionOpts,\n params: InvocationParameters<I>,\n canBeRetried = Boolean(params.opts?.opts.idempotencyKey)\n): Promise<O> => {\n let attachable = false;\n //\n // ingress URL\n //\n let url: string;\n if (params.scope) {\n // Scoped path: /restate/scope/{scope}/{call|send}/{service}/{key?}/{handler}\n const pathType = params.send ? \"send\" : \"call\";\n const parts = [\n opts.url,\n \"restate/scope\",\n encodeURIComponent(params.scope),\n pathType,\n params.component,\n ];\n if (params.key) {\n parts.push(encodeURIComponent(params.key));\n }\n parts.push(params.handler);\n url = parts.join(\"/\");\n if (params.send && params.opts instanceof SendOpts) {\n const delay = params.opts.delay();\n if (delay) url += `?delay=${delay}ms`;\n }\n } else {\n const fragments = [opts.url, params.component];\n if (params.key) {\n fragments.push(encodeURIComponent(params.key));\n }\n fragments.push(params.handler);\n if (params.send ?? false) {\n if (params.opts instanceof SendOpts) {\n fragments.push(computeDelayAsIso(params.opts));\n } else {\n fragments.push(\"send\");\n }\n }\n url = fragments.join(\"/\");\n }\n //\n // request body\n //\n const inputSerde = params.opts?.opts.input ?? opts.serde ?? serde.json;\n\n const { body, contentType } = serializeBodyWithContentType(\n params.parameter,\n inputSerde,\n opts.journalValueCodec\n );\n //\n // headers\n //\n const headers = {\n ...(opts.headers ?? {}),\n ...(params.opts?.opts?.headers ?? {}),\n };\n if (contentType) {\n headers[\"Content-Type\"] = contentType;\n }\n //\n // idempotency\n //\n const idempotencyKey = params.opts?.opts.idempotencyKey;\n if (idempotencyKey) {\n headers[IDEMPOTENCY_KEY_HEADER] = idempotencyKey;\n attachable = true;\n }\n //\n // limit key\n //\n const limitKey = params.opts?.opts.limitKey;\n if (limitKey) {\n headers[LIMIT_KEY_HEADER] = limitKey;\n }\n\n //\n // retries\n //\n // Regular invocations default eligibility from the idempotency key, while\n // workflow submissions opt in because the workflow ID identifies the run.\n const retryPolicy = canBeRetried ? resolveRetryPolicy(opts.retry) : undefined;\n\n //\n // make the call\n //\n const responseBuf = await fetchWithRetries(\n opts,\n url,\n {\n method: params.method ?? \"POST\",\n headers,\n body,\n },\n params.opts,\n retryPolicy\n );\n if (!params.send) {\n const decodedBuf = opts.journalValueCodec\n ? await opts.journalValueCodec.decode(responseBuf)\n : responseBuf;\n const outputSerde = params.opts?.opts.output ?? opts.serde ?? serde.json;\n return outputSerde.deserialize(decodedBuf) as O;\n }\n const json = serde.json.deserialize(responseBuf) as O;\n return { ...json, attachable };\n};\n\nconst doWorkflowHandleCall = async <O>(\n opts: ConnectionOpts,\n wfName: string,\n wfKey: string,\n op: \"output\" | \"attach\",\n callOpts?: Opts<unknown, O> | SendOpts<unknown>\n): Promise<O> => {\n const outputSerde = callOpts?.opts.output ?? opts.serde ?? serde.json;\n //\n // headers\n //\n const headers = {\n ...(opts.headers ?? {}),\n };\n //\n // make the call\n //\n const url = `${opts.url}/restate/workflow/${wfName}/${encodeURIComponent(\n wfKey\n )}/${op}`;\n // Attach and output only observe the existing workflow, so both are eligible\n // when the connection has a retry policy.\n const retryPolicy = resolveRetryPolicy(opts.retry);\n\n const responseBuf = await fetchWithRetries(\n opts,\n url,\n { method: \"GET\", headers },\n callOpts,\n retryPolicy\n );\n const decodedBuf = opts.journalValueCodec\n ? await opts.journalValueCodec.decode(responseBuf)\n : responseBuf;\n return outputSerde.deserialize(decodedBuf) as O;\n};\n\nclass HttpIngress implements Ingress {\n constructor(private readonly opts: ConnectionOpts) {}\n\n private proxy(component: string, key?: string, send?: boolean) {\n return new Proxy(\n {},\n {\n get: (_target, prop) => {\n const handler = prop as string;\n return (...args: unknown[]) => {\n const { parameter, opts } = optsFromArgs(args);\n return doComponentInvocation<unknown, unknown>(this.opts, {\n component,\n handler,\n key,\n parameter,\n opts,\n send,\n });\n };\n },\n }\n );\n }\n\n serviceClient<D>(opts: ServiceDefinitionFrom<D>): IngressClient<Service<D>> {\n return this.proxy(opts.name) as IngressClient<Service<D>>;\n }\n\n objectClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressClient<VirtualObject<D>> {\n return this.proxy(opts.name, key) as IngressClient<VirtualObject<D>>;\n }\n\n workflowClient<D>(\n opts: WorkflowDefinitionFrom<D>,\n key: string\n ): IngressWorkflowClient<Workflow<D>> {\n const component = opts.name;\n const conn = this.opts;\n\n const workflowSubmit = async (\n ...args: unknown[]\n ): Promise<WorkflowSubmission<unknown>> => {\n const { parameter, opts } = optsFromArgs(args);\n const res: Send = await doComponentInvocation(\n conn,\n {\n component,\n handler: \"run\",\n key,\n send: true,\n parameter,\n opts,\n },\n true\n );\n\n return {\n invocationId: res.invocationId,\n status: res.status,\n attachable: true,\n };\n };\n\n const workflowAttach = (opts?: Opts<void, unknown>) =>\n doWorkflowHandleCall(conn, component, key, \"attach\", opts);\n\n const workflowOutput = async (\n opts?: Opts<void, unknown>\n ): Promise<Output<unknown>> => {\n try {\n const result = await doWorkflowHandleCall(\n conn,\n component,\n key,\n \"output\",\n opts\n );\n\n return {\n ready: true,\n result,\n };\n } catch (e) {\n if (!(e instanceof HttpCallError) || e.status !== 470) {\n throw e;\n }\n return {\n ready: false,\n get result() {\n throw new Error(\"Calling result() on a non ready workflow\");\n },\n };\n }\n };\n\n return new Proxy(\n {},\n {\n get: (_target, prop) => {\n const handler = prop as string;\n if (handler === \"workflowSubmit\") {\n return workflowSubmit;\n } else if (handler === \"workflowAttach\") {\n return workflowAttach;\n } else if (handler === \"workflowOutput\") {\n return workflowOutput;\n }\n // shared handlers pass trough via the ingress's normal invocation form\n // i.e. POST /<svc>/<key>/<handler>\n return (...args: unknown[]) => {\n const { parameter, opts } = optsFromArgs(args);\n return doComponentInvocation(conn, {\n component,\n handler,\n key,\n parameter,\n opts,\n });\n };\n },\n }\n ) as IngressWorkflowClient<Workflow<D>>;\n }\n\n objectSendClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressSendClient<VirtualObject<D>> {\n return this.proxy(opts.name, key, true) as IngressSendClient<\n VirtualObject<D>\n >;\n }\n\n serviceSendClient<D>(\n opts: ServiceDefinitionFrom<D>\n ): IngressSendClient<Service<D>> {\n return this.proxy(opts.name, undefined, true) as IngressSendClient<\n Service<D>\n >;\n }\n\n scope(scopeKey: string): ScopedIngress {\n const conn = this.opts;\n const scopedProxy = (component: string, key?: string, send?: boolean) =>\n new Proxy(\n {},\n {\n get: (_target, prop) => {\n const handler = prop as string;\n return (...args: unknown[]) => {\n const { parameter, opts } = optsFromArgs(args);\n return doComponentInvocation<unknown, unknown>(conn, {\n component,\n handler,\n key,\n parameter,\n opts,\n send,\n scope: scopeKey,\n });\n };\n },\n }\n );\n\n return {\n serviceClient: <D>(opts: ServiceDefinitionFrom<D>) =>\n scopedProxy(opts.name) as IngressClient<Service<D>>,\n serviceSendClient: <D>(opts: ServiceDefinitionFrom<D>) =>\n scopedProxy(opts.name, undefined, true) as IngressSendClient<\n Service<D>\n >,\n objectClient: <D>(opts: VirtualObjectDefinitionFrom<D>, key: string) =>\n scopedProxy(opts.name, key) as IngressClient<VirtualObject<D>>,\n objectSendClient: <D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ) =>\n scopedProxy(opts.name, key, true) as IngressSendClient<\n VirtualObject<D>\n >,\n workflowClient: <D>(\n opts: WorkflowDefinitionFrom<D>,\n key: string\n ): IngressWorkflowClient<Workflow<D>> => {\n const component = opts.name;\n\n const workflowSubmit = async (\n ...args: unknown[]\n ): Promise<WorkflowSubmission<unknown>> => {\n const { parameter, opts } = optsFromArgs(args);\n const res: Send = await doComponentInvocation(\n conn,\n {\n component,\n handler: \"run\",\n key,\n send: true,\n parameter,\n opts,\n scope: scopeKey,\n },\n true\n );\n return {\n invocationId: res.invocationId,\n status: res.status,\n attachable: true,\n };\n };\n\n const workflowAttach = (opts?: Opts<void, unknown>) =>\n doWorkflowHandleCall(conn, component, key, \"attach\", opts);\n\n const workflowOutput = async (\n opts?: Opts<void, unknown>\n ): Promise<Output<unknown>> => {\n try {\n const result = await doWorkflowHandleCall(\n conn,\n component,\n key,\n \"output\",\n opts\n );\n return { ready: true, result };\n } catch (e) {\n if (!(e instanceof HttpCallError) || e.status !== 470) {\n throw e;\n }\n return {\n ready: false,\n get result() {\n throw new Error(\"Calling result() on a non ready workflow\");\n },\n };\n }\n };\n\n return new Proxy(\n {},\n {\n get: (_target, prop) => {\n const handler = prop as string;\n if (handler === \"workflowSubmit\") {\n return workflowSubmit;\n } else if (handler === \"workflowAttach\") {\n return workflowAttach;\n } else if (handler === \"workflowOutput\") {\n return workflowOutput;\n }\n return (...args: unknown[]) => {\n const { parameter, opts } = optsFromArgs(args);\n return doComponentInvocation(conn, {\n component,\n handler,\n key,\n parameter,\n opts,\n scope: scopeKey,\n });\n };\n },\n }\n ) as IngressWorkflowClient<Workflow<D>>;\n },\n };\n }\n\n async call<I, O>(opts: {\n service: string;\n handler: string;\n parameter: I;\n key?: string;\n scope?: string;\n opts?: Opts<I, O>;\n }): Promise<O> {\n return doComponentInvocation<I, O>(this.opts, {\n component: opts.service,\n handler: opts.handler,\n key: opts.key,\n scope: opts.scope,\n parameter: opts.parameter,\n send: false,\n opts: opts.opts,\n });\n }\n\n async send<I>(opts: {\n service: string;\n handler: string;\n parameter: I;\n key?: string;\n scope?: string;\n opts?: SendOpts<I>;\n }): Promise<Send> {\n return doComponentInvocation<I, Send>(this.opts, {\n component: opts.service,\n handler: opts.handler,\n key: opts.key,\n scope: opts.scope,\n parameter: opts.parameter,\n send: true,\n opts: opts.opts,\n });\n }\n\n async resolveAwakeable<T>(\n id: string,\n payload?: T,\n payloadSerde?: Serde<T>\n ): Promise<void> {\n const url = `${this.opts.url}/restate/a/${id}/resolve`;\n const { body, contentType } = serializeBodyWithContentType(\n payload,\n payloadSerde ?? this.opts.serde ?? serde.json,\n this.opts.journalValueCodec\n );\n const headers = {\n ...(this.opts.headers ?? {}),\n };\n if (contentType) {\n headers[\"Content-Type\"] = contentType;\n }\n const httpResponse = await getFetch(this.opts)(url, {\n method: \"POST\",\n headers,\n body,\n });\n if (!httpResponse.ok) {\n const body = await httpResponse.text();\n throw new HttpCallError(\n httpResponse.status,\n body,\n `Request failed: ${httpResponse.status}\\n${body}`\n );\n }\n }\n\n async rejectAwakeable(id: string, reason: string): Promise<void> {\n const url = `${this.opts.url}/restate/a/${id}/reject`;\n const headers = {\n \"Content-Type\": \"text/plain\",\n ...(this.opts.headers ?? {}),\n };\n const httpResponse = await getFetch(this.opts)(url, {\n method: \"POST\",\n headers,\n body: reason,\n });\n if (!httpResponse.ok) {\n const body = await httpResponse.text();\n throw new HttpCallError(\n httpResponse.status,\n body,\n `Request failed: ${httpResponse.status}\\n${body}`\n );\n }\n }\n\n async result<T>(\n send: Send<T> | WorkflowSubmission<T>,\n resultSerde?: Serde<T>\n ): Promise<T> {\n if (!send.attachable) {\n throw new Error(\n `Unable to fetch the result for ${send.invocationId}.\n A service's result is stored only with an idempotencyKey is supplied when invocating the service.`\n );\n }\n //\n // headers\n //\n const headers = {\n ...(this.opts.headers ?? {}),\n };\n //\n // make the call\n const url = `${this.opts.url}/restate/invocation/${send.invocationId}/attach`;\n\n const httpResponse = await getFetch(this.opts)(url, {\n method: \"GET\",\n headers,\n });\n if (httpResponse.ok) {\n const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());\n const decodedBuf = this.opts.journalValueCodec\n ? await this.opts.journalValueCodec.decode(responseBuf)\n : responseBuf;\n return (resultSerde ?? this.opts.serde ?? serde.json).deserialize(\n decodedBuf\n ) as T;\n }\n const body = await httpResponse.text();\n throw new HttpCallError(\n httpResponse.status,\n body,\n `Request failed: ${httpResponse.status}\\n${body}`\n );\n }\n}\n\nfunction computeDelayAsIso(opts: SendOpts): string {\n const delay = opts.delay();\n if (!delay) {\n return \"send\";\n }\n return `send?delay=${delay}ms`;\n}\n\nfunction serializeBodyWithContentType(\n body: unknown,\n serde: Serde<unknown>,\n journalValueCodec?: JournalValueCodec\n): {\n body?: Uint8Array;\n contentType?: string;\n} {\n let buffer = serde.serialize(body);\n if (journalValueCodec) {\n buffer = journalValueCodec.encode(buffer);\n }\n return {\n body: buffer,\n contentType: serde.contentType,\n };\n}\n"],"mappings":";;;;;;;;;;;AAkDA,SAAgB,QAAQ,MAA+B;AACrD,QAAO,IAAI,YAAY,KAAK;;AAG9B,IAAa,gBAAb,cAAmC,MAAM;CACvC,YACE,AAAgBA,QAChB,AAAgBC,cAChB,AAAyBC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SAAS,kBAAkB,MAAwB;CACjD,MAAM,QAAQ,KAAK,OAAO;AAC1B,KAAI,CAAC,MACH,QAAO;AAET,QAAO,cAAc,MAAM;;AAG7B,SAAS,6BACP,MACA,SACA,mBAIA;CACA,IAAI,SAASC,QAAM,UAAU,KAAK;AAClC,KAAI,kBACF,UAAS,kBAAkB,OAAO,OAAO;AAE3C,QAAO;EACL,MAAM;EACN,aAAaA,QAAM;EACpB"}
|
package/dist/retry.test.js
CHANGED
|
@@ -146,6 +146,20 @@ describe("ingress auto-retry", () => {
|
|
|
146
146
|
const ok = (body = { ok: true }) => () => Promise.resolve(new Response(JSON.stringify(body), { status: 200 }));
|
|
147
147
|
const fail = (status, headers) => () => Promise.resolve(new Response("nope", { status, headers }));
|
|
148
148
|
const neterr = (msg) => () => Promise.reject(new TypeError(msg));
|
|
149
|
+
const streamerr = (msg) => () => {
|
|
150
|
+
let sentChunk = false;
|
|
151
|
+
const body = new ReadableStream({
|
|
152
|
+
pull(controller) {
|
|
153
|
+
if (!sentChunk) {
|
|
154
|
+
controller.enqueue(new TextEncoder().encode('{"partial":'));
|
|
155
|
+
sentChunk = true;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
controller.error(new TypeError(msg));
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
return Promise.resolve(new Response(body, { status: 200 }));
|
|
162
|
+
};
|
|
149
163
|
// A fetch mock that plays back a queued sequence, repeating the last item.
|
|
150
164
|
const queue = (...attempts) => {
|
|
151
165
|
let i = 0;
|
|
@@ -162,6 +176,11 @@ describe("ingress auto-retry", () => {
|
|
|
162
176
|
parameter: {},
|
|
163
177
|
opts: idempotencyKey ? Opts.from({ idempotencyKey }) : undefined,
|
|
164
178
|
});
|
|
179
|
+
const testWorkflow = { name: "workflow" };
|
|
180
|
+
const workflow = (retry) => connect({ url: URL, retry }).workflowClient(testWorkflow, "workflow-id");
|
|
181
|
+
const scopedWorkflow = (retry) => connect({ url: URL, retry })
|
|
182
|
+
.scope("scope")
|
|
183
|
+
.workflowClient(testWorkflow, "workflow-id");
|
|
165
184
|
beforeEach(() => {
|
|
166
185
|
fetchMock = vi.fn();
|
|
167
186
|
vi.stubGlobal("fetch", fetchMock);
|
|
@@ -199,6 +218,63 @@ describe("ingress auto-retry", () => {
|
|
|
199
218
|
await expect(call("k1", fastRetry)).resolves.toEqual({ ok: true });
|
|
200
219
|
expect(fetchMock).toHaveBeenCalledTimes(2);
|
|
201
220
|
});
|
|
221
|
+
it("retries when a successful response body stream fails", async () => {
|
|
222
|
+
queue(streamerr("stream interrupted"), ok({ greeting: "hi" }));
|
|
223
|
+
await expect(call("k1", fastRetry)).resolves.toEqual({ greeting: "hi" });
|
|
224
|
+
expect(fetchMock).toHaveBeenCalledTimes(2);
|
|
225
|
+
});
|
|
226
|
+
it("does NOT retry workflow submission without a retry policy", async () => {
|
|
227
|
+
queue(fail(503), ok());
|
|
228
|
+
await expect(workflow().workflowSubmit({})).rejects.toBeInstanceOf(HttpCallError);
|
|
229
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
230
|
+
});
|
|
231
|
+
it("retries workflow submission without an idempotency key", async () => {
|
|
232
|
+
queue(neterr("response lost"), ok({ invocationId: "invocation-id", status: "PreviouslyAccepted" }));
|
|
233
|
+
await expect(workflow(fastRetry).workflowSubmit({})).resolves.toMatchObject({
|
|
234
|
+
invocationId: "invocation-id",
|
|
235
|
+
status: "PreviouslyAccepted",
|
|
236
|
+
});
|
|
237
|
+
expect(fetchMock).toHaveBeenCalledTimes(2);
|
|
238
|
+
});
|
|
239
|
+
it("retries scoped workflow submission without an idempotency key", async () => {
|
|
240
|
+
queue(fail(503), ok({ invocationId: "invocation-id", status: "Accepted" }));
|
|
241
|
+
await expect(scopedWorkflow(fastRetry).workflowSubmit({})).resolves.toMatchObject({
|
|
242
|
+
invocationId: "invocation-id",
|
|
243
|
+
status: "Accepted",
|
|
244
|
+
});
|
|
245
|
+
expect(fetchMock).toHaveBeenCalledTimes(2);
|
|
246
|
+
});
|
|
247
|
+
it("does NOT retry workflow attach without a retry policy", async () => {
|
|
248
|
+
queue(fail(503), ok());
|
|
249
|
+
await expect(workflow().workflowAttach()).rejects.toBeInstanceOf(HttpCallError);
|
|
250
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
251
|
+
});
|
|
252
|
+
it("retries workflow attach without an idempotency key", async () => {
|
|
253
|
+
queue(fail(503), ok({ result: "done" }));
|
|
254
|
+
await expect(workflow(fastRetry).workflowAttach()).resolves.toEqual({
|
|
255
|
+
result: "done",
|
|
256
|
+
});
|
|
257
|
+
expect(fetchMock).toHaveBeenCalledTimes(2);
|
|
258
|
+
});
|
|
259
|
+
it("does NOT retry workflow output without a retry policy", async () => {
|
|
260
|
+
queue(fail(503), ok({ result: "done" }));
|
|
261
|
+
await expect(workflow().workflowOutput()).rejects.toBeInstanceOf(HttpCallError);
|
|
262
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
263
|
+
});
|
|
264
|
+
it("retries workflow output without an idempotency key", async () => {
|
|
265
|
+
queue(fail(503), ok({ result: "done" }));
|
|
266
|
+
await expect(workflow(fastRetry).workflowOutput()).resolves.toEqual({
|
|
267
|
+
ready: true,
|
|
268
|
+
result: { result: "done" },
|
|
269
|
+
});
|
|
270
|
+
expect(fetchMock).toHaveBeenCalledTimes(2);
|
|
271
|
+
});
|
|
272
|
+
it("does NOT retry workflow output when it is not ready by default", async () => {
|
|
273
|
+
queue(fail(470), ok({ result: "done" }));
|
|
274
|
+
const output = await workflow(fastRetry).workflowOutput();
|
|
275
|
+
expect(output.ready).toBe(false);
|
|
276
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
277
|
+
});
|
|
202
278
|
it("does NOT retry on a non-retryable 4xx", async () => {
|
|
203
279
|
queue(fail(409), ok());
|
|
204
280
|
await expect(call("k1", fastRetry)).rejects.toBeInstanceOf(HttpCallError);
|
package/dist/retry.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1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CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACvB,MAAM,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC;YACjD,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,EAAE;YACb,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SAC3D,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CACtC,CAAC,CAAC,EAAE,EAAE,CAAE,CAAC,CAAC,CAAC,CAAiB,CAAC,MAAM,CACpC,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restatedev/restate-sdk-clients",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.4",
|
|
4
4
|
"description": "Typescript SDK for Restate",
|
|
5
5
|
"author": "Restate Developers",
|
|
6
6
|
"email": "code@restate.dev",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@restatedev/restate-sdk-core": "1.16.
|
|
35
|
+
"@restatedev/restate-sdk-core": "1.16.4"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {},
|
|
38
38
|
"scripts": {
|