@restatedev/restate-sdk-clients 1.15.0 → 1.16.0
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 +86 -2
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.ts +86 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/ingress.cjs +41 -13
- package/dist/ingress.d.cts.map +1 -1
- package/dist/ingress.d.ts.map +1 -1
- package/dist/ingress.js +41 -13
- package/dist/ingress.js.map +1 -1
- package/dist/retry.cjs +101 -0
- package/dist/retry.d.cts +13 -0
- package/dist/retry.d.cts.map +1 -0
- package/dist/retry.d.ts +13 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +96 -0
- package/dist/retry.js.map +1 -0
- package/dist/retry.test.d.ts +2 -0
- package/dist/retry.test.d.ts.map +1 -0
- package/dist/retry.test.js +251 -0
- package/dist/retry.test.js.map +1 -0
- package/package.json +2 -2
package/dist/api.d.cts
CHANGED
|
@@ -141,7 +141,7 @@ interface Ingress {
|
|
|
141
141
|
* @experimental
|
|
142
142
|
* @interface
|
|
143
143
|
*/
|
|
144
|
-
type ScopedIngress = Pick<Ingress, "serviceClient" | "serviceSendClient" | "workflowClient">;
|
|
144
|
+
type ScopedIngress = Pick<Ingress, "serviceClient" | "serviceSendClient" | "objectClient" | "objectSendClient" | "workflowClient">;
|
|
145
145
|
interface IngressCallOptions<I$1 = unknown, O$1 = unknown> {
|
|
146
146
|
/**
|
|
147
147
|
* Key to use for idempotency key.
|
|
@@ -314,6 +314,76 @@ type Send<T = unknown> = {
|
|
|
314
314
|
attachable: boolean;
|
|
315
315
|
};
|
|
316
316
|
type IngressSendClient<M> = { [K in keyof M as M[K] extends never ? never : K]: M[K] extends ((arg: any, ...args: infer P) => PromiseLike<infer O>) ? (...args: [...P, ...[opts?: SendOpts<InferArgType<P>>]]) => Promise<Send<O>> : never };
|
|
317
|
+
/**
|
|
318
|
+
* An ambiguous ingress failure that may be retried.
|
|
319
|
+
*
|
|
320
|
+
* Passed to {@link RetryPolicy.shouldRetry} so a caller can inspect the failure
|
|
321
|
+
* and decide whether to retry.
|
|
322
|
+
*/
|
|
323
|
+
type RetryFailure = {
|
|
324
|
+
/** The underlying `fetch` call rejected (connection refused/reset, DNS). */
|
|
325
|
+
readonly kind: "network";
|
|
326
|
+
readonly error: unknown;
|
|
327
|
+
} | {
|
|
328
|
+
/** The server returned a non-2xx response. */
|
|
329
|
+
readonly kind: "response";
|
|
330
|
+
readonly status: number;
|
|
331
|
+
readonly headers: Headers;
|
|
332
|
+
/**
|
|
333
|
+
* The response body, decoded as text, when the response carried a
|
|
334
|
+
* non-empty body; `undefined` otherwise.
|
|
335
|
+
*/
|
|
336
|
+
readonly body?: string;
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* Policy controlling automatic retries of ambiguous ingress failures.
|
|
340
|
+
*
|
|
341
|
+
* Retries are **opt-in**: they happen only when a policy is configured (see
|
|
342
|
+
* {@link ConnectionOpts.retry}) **and** the call carries an `idempotencyKey`
|
|
343
|
+
* (see {@link IngressCallOptions.idempotencyKey}). Retrying without a key could
|
|
344
|
+
* double-execute a non-idempotent invocation, so the idempotency key is the
|
|
345
|
+
* safety boundary that a policy can never bypass.
|
|
346
|
+
*
|
|
347
|
+
* By default the following failures are retried: network errors (the underlying
|
|
348
|
+
* `fetch` rejecting), HTTP `429`, and HTTP `5xx` responses. Override this with
|
|
349
|
+
* {@link RetryPolicy.shouldRetry}.
|
|
350
|
+
*/
|
|
351
|
+
interface RetryPolicy {
|
|
352
|
+
/**
|
|
353
|
+
* Max number of attempts (including the initial), before giving up.
|
|
354
|
+
*
|
|
355
|
+
* Defaults to `6` (the initial attempt plus up to 5 retries).
|
|
356
|
+
*/
|
|
357
|
+
maxAttempts?: number;
|
|
358
|
+
/**
|
|
359
|
+
* Initial backoff interval. If a number is provided, it is interpreted as
|
|
360
|
+
* milliseconds. Defaults to `100` milliseconds.
|
|
361
|
+
*/
|
|
362
|
+
initialInterval?: Duration | number;
|
|
363
|
+
/**
|
|
364
|
+
* Maximum backoff interval. If a number is provided, it is interpreted as
|
|
365
|
+
* milliseconds. Defaults to `2000` milliseconds.
|
|
366
|
+
*/
|
|
367
|
+
maxInterval?: Duration | number;
|
|
368
|
+
/**
|
|
369
|
+
* Exponentiation factor to use when computing the next retry delay.
|
|
370
|
+
* Defaults to `2`.
|
|
371
|
+
*/
|
|
372
|
+
exponentiationFactor?: number;
|
|
373
|
+
/**
|
|
374
|
+
* Decide whether a given failure should be retried. When provided, this
|
|
375
|
+
* fully replaces the built-in rule (network / `429` / `5xx`).
|
|
376
|
+
*
|
|
377
|
+
* The idempotency-key gate and the `maxAttempts` cap still apply — this
|
|
378
|
+
* predicate only narrows or broadens *which failures* are retryable within
|
|
379
|
+
* those bounds. Compose with the built-in rule via the exported
|
|
380
|
+
* `defaultShouldRetry`.
|
|
381
|
+
*
|
|
382
|
+
* @param failure the failure being considered
|
|
383
|
+
* @param attempt the zero-based index of the attempt that just failed
|
|
384
|
+
*/
|
|
385
|
+
shouldRetry?: (failure: RetryFailure, attempt: number) => boolean;
|
|
386
|
+
}
|
|
317
387
|
type ConnectionOpts = {
|
|
318
388
|
/**
|
|
319
389
|
* Restate ingress URL.
|
|
@@ -325,6 +395,20 @@ type ConnectionOpts = {
|
|
|
325
395
|
* Use this to attach authentication headers.
|
|
326
396
|
*/
|
|
327
397
|
headers?: Record<string, string>;
|
|
398
|
+
/**
|
|
399
|
+
* Opt in to automatic retries of ambiguous ingress failures (network errors,
|
|
400
|
+
* HTTP `429`, HTTP `5xx`).
|
|
401
|
+
*
|
|
402
|
+
* Retries are **disabled by default**. Set `true` to enable the built-in
|
|
403
|
+
* policy ({@link RetryPolicy}), or pass a {@link RetryPolicy} to tune it.
|
|
404
|
+
*
|
|
405
|
+
* Even when enabled, retries fire **only** when an `idempotencyKey` is set on
|
|
406
|
+
* the call — without one a retry could double-execute a non-idempotent
|
|
407
|
+
* invocation. With a key, Restate dedupes the request, so a retry safely
|
|
408
|
+
* attaches to the in-flight or completed invocation instead of starting a new
|
|
409
|
+
* one.
|
|
410
|
+
*/
|
|
411
|
+
retry?: RetryPolicy | boolean;
|
|
328
412
|
/**
|
|
329
413
|
* Default serde to use for ingress payloads when no operation-specific serde
|
|
330
414
|
* is provided. Applies to handler calls, workflow attaches/output polling,
|
|
@@ -341,5 +425,5 @@ type ConnectionOpts = {
|
|
|
341
425
|
journalValueCodec?: JournalValueCodec;
|
|
342
426
|
};
|
|
343
427
|
//#endregion
|
|
344
|
-
export { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc };
|
|
428
|
+
export { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, RetryFailure, RetryPolicy, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc };
|
|
345
429
|
//# sourceMappingURL=api.d.cts.map
|
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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2BAA2B,IAAI,EAAE,4CAG/C,sCAEc,cAAc,KAAK,aAAa,IAAI,SAC9C,YAAY;;;;;;;;;;;kBAaL,UAAU,0BACtB,kDAAiD,kCAEhC,cAAc,SAAS,aAAa,UAC9C,QAAQ,mBAAmB;;;;;;;;;;;;kBAetB,UAAU,0BACtB,oCAAmC,4BACzB,WAAW,OAAO,QAAQ;;;;;;;;;;;kBAcxB,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;;;;;;;;;;;;;;;;;;;;UAqBP,WAAA;;;;;;;;;;;oBAYG;;;;;gBAMJ;;;;;;;;;;;;;;;;;;0BAoBU;;KAGd,cAAA;;;;;;;;;;YAUA;;;;;;;;;;;;;;UAeF;;;;;;;;UASA;;;;;;sBAOY"}
|
package/dist/api.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ interface Ingress {
|
|
|
141
141
|
* @experimental
|
|
142
142
|
* @interface
|
|
143
143
|
*/
|
|
144
|
-
type ScopedIngress = Pick<Ingress, "serviceClient" | "serviceSendClient" | "workflowClient">;
|
|
144
|
+
type ScopedIngress = Pick<Ingress, "serviceClient" | "serviceSendClient" | "objectClient" | "objectSendClient" | "workflowClient">;
|
|
145
145
|
interface IngressCallOptions<I$1 = unknown, O$1 = unknown> {
|
|
146
146
|
/**
|
|
147
147
|
* Key to use for idempotency key.
|
|
@@ -314,6 +314,76 @@ type Send<T = unknown> = {
|
|
|
314
314
|
attachable: boolean;
|
|
315
315
|
};
|
|
316
316
|
type IngressSendClient<M> = { [K in keyof M as M[K] extends never ? never : K]: M[K] extends ((arg: any, ...args: infer P) => PromiseLike<infer O>) ? (...args: [...P, ...[opts?: SendOpts<InferArgType<P>>]]) => Promise<Send<O>> : never };
|
|
317
|
+
/**
|
|
318
|
+
* An ambiguous ingress failure that may be retried.
|
|
319
|
+
*
|
|
320
|
+
* Passed to {@link RetryPolicy.shouldRetry} so a caller can inspect the failure
|
|
321
|
+
* and decide whether to retry.
|
|
322
|
+
*/
|
|
323
|
+
type RetryFailure = {
|
|
324
|
+
/** The underlying `fetch` call rejected (connection refused/reset, DNS). */
|
|
325
|
+
readonly kind: "network";
|
|
326
|
+
readonly error: unknown;
|
|
327
|
+
} | {
|
|
328
|
+
/** The server returned a non-2xx response. */
|
|
329
|
+
readonly kind: "response";
|
|
330
|
+
readonly status: number;
|
|
331
|
+
readonly headers: Headers;
|
|
332
|
+
/**
|
|
333
|
+
* The response body, decoded as text, when the response carried a
|
|
334
|
+
* non-empty body; `undefined` otherwise.
|
|
335
|
+
*/
|
|
336
|
+
readonly body?: string;
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* Policy controlling automatic retries of ambiguous ingress failures.
|
|
340
|
+
*
|
|
341
|
+
* Retries are **opt-in**: they happen only when a policy is configured (see
|
|
342
|
+
* {@link ConnectionOpts.retry}) **and** the call carries an `idempotencyKey`
|
|
343
|
+
* (see {@link IngressCallOptions.idempotencyKey}). Retrying without a key could
|
|
344
|
+
* double-execute a non-idempotent invocation, so the idempotency key is the
|
|
345
|
+
* safety boundary that a policy can never bypass.
|
|
346
|
+
*
|
|
347
|
+
* By default the following failures are retried: network errors (the underlying
|
|
348
|
+
* `fetch` rejecting), HTTP `429`, and HTTP `5xx` responses. Override this with
|
|
349
|
+
* {@link RetryPolicy.shouldRetry}.
|
|
350
|
+
*/
|
|
351
|
+
interface RetryPolicy {
|
|
352
|
+
/**
|
|
353
|
+
* Max number of attempts (including the initial), before giving up.
|
|
354
|
+
*
|
|
355
|
+
* Defaults to `6` (the initial attempt plus up to 5 retries).
|
|
356
|
+
*/
|
|
357
|
+
maxAttempts?: number;
|
|
358
|
+
/**
|
|
359
|
+
* Initial backoff interval. If a number is provided, it is interpreted as
|
|
360
|
+
* milliseconds. Defaults to `100` milliseconds.
|
|
361
|
+
*/
|
|
362
|
+
initialInterval?: Duration | number;
|
|
363
|
+
/**
|
|
364
|
+
* Maximum backoff interval. If a number is provided, it is interpreted as
|
|
365
|
+
* milliseconds. Defaults to `2000` milliseconds.
|
|
366
|
+
*/
|
|
367
|
+
maxInterval?: Duration | number;
|
|
368
|
+
/**
|
|
369
|
+
* Exponentiation factor to use when computing the next retry delay.
|
|
370
|
+
* Defaults to `2`.
|
|
371
|
+
*/
|
|
372
|
+
exponentiationFactor?: number;
|
|
373
|
+
/**
|
|
374
|
+
* Decide whether a given failure should be retried. When provided, this
|
|
375
|
+
* fully replaces the built-in rule (network / `429` / `5xx`).
|
|
376
|
+
*
|
|
377
|
+
* The idempotency-key gate and the `maxAttempts` cap still apply — this
|
|
378
|
+
* predicate only narrows or broadens *which failures* are retryable within
|
|
379
|
+
* those bounds. Compose with the built-in rule via the exported
|
|
380
|
+
* `defaultShouldRetry`.
|
|
381
|
+
*
|
|
382
|
+
* @param failure the failure being considered
|
|
383
|
+
* @param attempt the zero-based index of the attempt that just failed
|
|
384
|
+
*/
|
|
385
|
+
shouldRetry?: (failure: RetryFailure, attempt: number) => boolean;
|
|
386
|
+
}
|
|
317
387
|
type ConnectionOpts = {
|
|
318
388
|
/**
|
|
319
389
|
* Restate ingress URL.
|
|
@@ -325,6 +395,20 @@ type ConnectionOpts = {
|
|
|
325
395
|
* Use this to attach authentication headers.
|
|
326
396
|
*/
|
|
327
397
|
headers?: Record<string, string>;
|
|
398
|
+
/**
|
|
399
|
+
* Opt in to automatic retries of ambiguous ingress failures (network errors,
|
|
400
|
+
* HTTP `429`, HTTP `5xx`).
|
|
401
|
+
*
|
|
402
|
+
* Retries are **disabled by default**. Set `true` to enable the built-in
|
|
403
|
+
* policy ({@link RetryPolicy}), or pass a {@link RetryPolicy} to tune it.
|
|
404
|
+
*
|
|
405
|
+
* Even when enabled, retries fire **only** when an `idempotencyKey` is set on
|
|
406
|
+
* the call — without one a retry could double-execute a non-idempotent
|
|
407
|
+
* invocation. With a key, Restate dedupes the request, so a retry safely
|
|
408
|
+
* attaches to the in-flight or completed invocation instead of starting a new
|
|
409
|
+
* one.
|
|
410
|
+
*/
|
|
411
|
+
retry?: RetryPolicy | boolean;
|
|
328
412
|
/**
|
|
329
413
|
* Default serde to use for ingress payloads when no operation-specific serde
|
|
330
414
|
* is provided. Applies to handler calls, workflow attaches/output polling,
|
|
@@ -341,5 +425,5 @@ type ConnectionOpts = {
|
|
|
341
425
|
journalValueCodec?: JournalValueCodec;
|
|
342
426
|
};
|
|
343
427
|
//#endregion
|
|
344
|
-
export { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc };
|
|
428
|
+
export { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, RetryFailure, RetryPolicy, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc };
|
|
345
429
|
//# sourceMappingURL=api.d.ts.map
|
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,EAAA,MAAA,CAAA,EAfL,qBAeK,CAfiB,QAejB,CAf0B,CAe1B,CAAA,CAAA;EACqB;;;;EAMrB,YAAA,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ACtB,kDAAiD,kCAEhC,cAAc,SAAS,aAAa,UAC9C,QAAQ,mBAAmB;;;;;;;;;;;;kBAetB,UAAU,0BACtB,oCAAmC,4BACzB,WAAW,OAAO,QAAQ;;;;;;;;;;;kBAcxB,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;;;;;;;;;;;;;;;;;;;;UAqBP,WAAA;;;;;;;;;;;oBAYG;;;;;gBAMJ;;;;;;;;;;;;;;;;;;0BAoBU;;KAGd,cAAA;;;;;;;;;;YAUA;;;;;;;;;;;;;;UAeF;;;;;;;;UASA;;;;;;sBAOY"}
|
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\" | \"serviceSendClient\" | \"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\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 * 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":";;;AA2PA,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 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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_api = require('./api.cjs');
|
|
3
|
+
const require_retry = require('./retry.cjs');
|
|
3
4
|
const require_ingress = require('./ingress.cjs');
|
|
4
5
|
let __restatedev_restate_sdk_core = require("@restatedev/restate-sdk-core");
|
|
5
6
|
__restatedev_restate_sdk_core = require_rolldown_runtime.__toESM(__restatedev_restate_sdk_core);
|
|
@@ -8,6 +9,7 @@ exports.HttpCallError = require_ingress.HttpCallError;
|
|
|
8
9
|
exports.Opts = require_api.Opts;
|
|
9
10
|
exports.SendOpts = require_api.SendOpts;
|
|
10
11
|
exports.connect = require_ingress.connect;
|
|
12
|
+
exports.defaultShouldRetry = require_retry.defaultShouldRetry;
|
|
11
13
|
Object.defineProperty(exports, 'rpc', {
|
|
12
14
|
enumerable: true,
|
|
13
15
|
get: function () {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc } from "./api.cjs";
|
|
1
|
+
import { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, RetryFailure, RetryPolicy, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc } from "./api.cjs";
|
|
2
2
|
import { HttpCallError, connect } from "./ingress.cjs";
|
|
3
|
+
import { defaultShouldRetry } from "./retry.cjs";
|
|
3
4
|
import { Duration, JournalValueCodec, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, serde } from "@restatedev/restate-sdk-core";
|
|
4
|
-
export { type ConnectionOpts, type Duration, HttpCallError, type InferArgType, type Ingress, type IngressCallOptions, type IngressClient, type IngressSendClient, type IngressSendOptions, type IngressWorkflowClient, type JournalValueCodec, Opts, type Output, type ScopedIngress, type Send, SendOpts, type Serde, type Service, type ServiceDefinition, type ServiceDefinitionFrom, type VirtualObject, type VirtualObjectDefinition, type VirtualObjectDefinitionFrom, type Workflow, type WorkflowDefinition, type WorkflowDefinitionFrom, type WorkflowSubmission, connect, rpc, serde };
|
|
5
|
+
export { type ConnectionOpts, type Duration, HttpCallError, type InferArgType, type Ingress, type IngressCallOptions, type IngressClient, type IngressSendClient, type IngressSendOptions, type IngressWorkflowClient, type JournalValueCodec, Opts, type Output, type RetryFailure, type RetryPolicy, type ScopedIngress, type Send, SendOpts, type Serde, type Service, type ServiceDefinition, type ServiceDefinitionFrom, type VirtualObject, type VirtualObjectDefinition, type VirtualObjectDefinitionFrom, type Workflow, type WorkflowDefinition, type WorkflowDefinitionFrom, type WorkflowSubmission, connect, defaultShouldRetry, rpc, serde };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc } from "./api.js";
|
|
1
|
+
import { ConnectionOpts, InferArgType, Ingress, IngressCallOptions, IngressClient, IngressSendClient, IngressSendOptions, IngressWorkflowClient, Opts, Output, RetryFailure, RetryPolicy, ScopedIngress, Send, SendOpts, WorkflowSubmission, rpc } from "./api.js";
|
|
2
2
|
import { HttpCallError, connect } from "./ingress.js";
|
|
3
|
+
import { defaultShouldRetry } from "./retry.js";
|
|
3
4
|
import { Duration, JournalValueCodec, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, serde } from "@restatedev/restate-sdk-core";
|
|
4
|
-
export { type ConnectionOpts, type Duration, HttpCallError, type InferArgType, type Ingress, type IngressCallOptions, type IngressClient, type IngressSendClient, type IngressSendOptions, type IngressWorkflowClient, type JournalValueCodec, Opts, type Output, type ScopedIngress, type Send, SendOpts, type Serde, type Service, type ServiceDefinition, type ServiceDefinitionFrom, type VirtualObject, type VirtualObjectDefinition, type VirtualObjectDefinitionFrom, type Workflow, type WorkflowDefinition, type WorkflowDefinitionFrom, type WorkflowSubmission, connect, rpc, serde };
|
|
5
|
+
export { type ConnectionOpts, type Duration, HttpCallError, type InferArgType, type Ingress, type IngressCallOptions, type IngressClient, type IngressSendClient, type IngressSendOptions, type IngressWorkflowClient, type JournalValueCodec, Opts, type Output, type RetryFailure, type RetryPolicy, type ScopedIngress, type Send, SendOpts, type Serde, type Service, type ServiceDefinition, type ServiceDefinitionFrom, type VirtualObject, type VirtualObjectDefinition, type VirtualObjectDefinitionFrom, type Workflow, type WorkflowDefinition, type WorkflowDefinitionFrom, type WorkflowSubmission, connect, defaultShouldRetry, rpc, serde };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD,YAAY,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,IAAI,EACJ,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,MAAM,GACP,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD,YAAY,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,MAAM,GACP,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Opts, SendOpts, rpc } from "./api.js";
|
|
2
|
+
import { defaultShouldRetry } from "./retry.js";
|
|
2
3
|
import { HttpCallError, connect } from "./ingress.js";
|
|
3
4
|
import { serde } from "@restatedev/restate-sdk-core";
|
|
4
5
|
|
|
5
|
-
export { HttpCallError, Opts, SendOpts, connect, rpc, serde };
|
|
6
|
+
export { HttpCallError, Opts, SendOpts, connect, defaultShouldRetry, rpc, serde };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAiBH,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAiBH,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAkBrD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/ingress.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_api = require('./api.cjs');
|
|
3
|
+
const require_retry = require('./retry.cjs');
|
|
3
4
|
let __restatedev_restate_sdk_core = require("@restatedev/restate-sdk-core");
|
|
4
5
|
__restatedev_restate_sdk_core = require_rolldown_runtime.__toESM(__restatedev_restate_sdk_core);
|
|
5
6
|
|
|
@@ -87,19 +88,44 @@ const doComponentInvocation = async (opts, params) => {
|
|
|
87
88
|
}
|
|
88
89
|
const limitKey = params.opts?.opts.limitKey;
|
|
89
90
|
if (limitKey) headers[LIMIT_KEY_HEADER] = limitKey;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
const userSignal = params.opts?.opts.signal;
|
|
92
|
+
const timeout = params.opts?.opts.timeout;
|
|
93
|
+
if (userSignal !== void 0 && timeout !== void 0) throw new Error("You can't specify both signal and timeout options at the same time");
|
|
94
|
+
const attemptSignal = () => userSignal ?? (timeout !== void 0 ? AbortSignal.timeout(timeout) : void 0);
|
|
95
|
+
const retryPolicy = idempotencyKey ? require_retry.resolveRetryPolicy(opts.retry) : void 0;
|
|
96
|
+
const shouldRetry = retryPolicy?.shouldRetry ?? require_retry.defaultShouldRetry;
|
|
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}`);
|
|
103
129
|
}
|
|
104
130
|
const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());
|
|
105
131
|
if (!params.send) {
|
|
@@ -237,6 +263,8 @@ var HttpIngress = class {
|
|
|
237
263
|
return {
|
|
238
264
|
serviceClient: (opts) => scopedProxy(opts.name),
|
|
239
265
|
serviceSendClient: (opts) => scopedProxy(opts.name, void 0, true),
|
|
266
|
+
objectClient: (opts, key) => scopedProxy(opts.name, key),
|
|
267
|
+
objectSendClient: (opts, key) => scopedProxy(opts.name, key, true),
|
|
240
268
|
workflowClient: (opts, key) => {
|
|
241
269
|
const component = opts.name;
|
|
242
270
|
const workflowSubmit = async (...args) => {
|
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":";;;;;;AAiDA;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":";;;;;;AAiDA;AAIA;;;iBAJgB,OAAA,OAAc,iBAAiB;cAIlC,aAAA,SAAsB,KAAA"}
|
package/dist/ingress.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Opts, SendOpts } from "./api.js";
|
|
2
|
+
import { abortableSleep, backoffDelay, defaultShouldRetry, parseRetryAfter, resolveRetryPolicy } from "./retry.js";
|
|
2
3
|
import { serde } from "@restatedev/restate-sdk-core";
|
|
3
4
|
|
|
4
5
|
//#region src/ingress.ts
|
|
@@ -85,19 +86,44 @@ const doComponentInvocation = async (opts, params) => {
|
|
|
85
86
|
}
|
|
86
87
|
const limitKey = params.opts?.opts.limitKey;
|
|
87
88
|
if (limitKey) headers[LIMIT_KEY_HEADER] = limitKey;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
const userSignal = params.opts?.opts.signal;
|
|
90
|
+
const timeout = params.opts?.opts.timeout;
|
|
91
|
+
if (userSignal !== void 0 && timeout !== void 0) throw new Error("You can't specify both signal and timeout options at the same time");
|
|
92
|
+
const attemptSignal = () => userSignal ?? (timeout !== void 0 ? AbortSignal.timeout(timeout) : void 0);
|
|
93
|
+
const retryPolicy = idempotencyKey ? resolveRetryPolicy(opts.retry) : void 0;
|
|
94
|
+
const shouldRetry = retryPolicy?.shouldRetry ?? defaultShouldRetry;
|
|
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}`);
|
|
101
127
|
}
|
|
102
128
|
const responseBuf = new Uint8Array(await httpResponse.arrayBuffer());
|
|
103
129
|
if (!params.send) {
|
|
@@ -235,6 +261,8 @@ var HttpIngress = class {
|
|
|
235
261
|
return {
|
|
236
262
|
serviceClient: (opts) => scopedProxy(opts.name),
|
|
237
263
|
serviceSendClient: (opts) => scopedProxy(opts.name, void 0, true),
|
|
264
|
+
objectClient: (opts, key) => scopedProxy(opts.name, key),
|
|
265
|
+
objectSendClient: (opts, key) => scopedProxy(opts.name, key, true),
|
|
238
266
|
workflowClient: (opts, key) => {
|
|
239
267
|
const component = opts.name;
|
|
240
268
|
const workflowSubmit = async (...args) => {
|