@restatedev/restate-sdk-clients 1.17.4 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.cts +4 -1
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.ts +4 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/env.cjs +65 -0
- package/dist/env.js +65 -0
- package/dist/env.js.map +1 -0
- package/dist/ingress.cjs +15 -4
- package/dist/ingress.d.cts +13 -3
- package/dist/ingress.d.cts.map +1 -1
- package/dist/ingress.d.ts +13 -3
- package/dist/ingress.d.ts.map +1 -1
- package/dist/ingress.js +15 -4
- package/dist/ingress.js.map +1 -1
- package/package.json +2 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/retry.test.d.ts +0 -2
- package/dist/retry.test.d.ts.map +0 -1
- package/dist/retry.test.js +0 -518
- package/dist/retry.test.js.map +0 -1
package/dist/api.d.cts
CHANGED
|
@@ -464,8 +464,11 @@ type ConnectionOpts = {
|
|
|
464
464
|
/**
|
|
465
465
|
* Restate ingress URL.
|
|
466
466
|
* For example: http://localhost:8080
|
|
467
|
+
*
|
|
468
|
+
* Optional for `connect()`: when omitted, the ingress comes from
|
|
469
|
+
* `RESTATE_INGRESS_KEY` (see `connect()`).
|
|
467
470
|
*/
|
|
468
|
-
url
|
|
471
|
+
url?: string;
|
|
469
472
|
/**
|
|
470
473
|
* Headers to attach on every request.
|
|
471
474
|
* Use this to attach authentication headers.
|
package/dist/api.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.cts","names":[],"sources":["../src/api.ts"],"sourcesContent":[],"mappings":";;;;;;AA8BA;;;;;;;AAYU,UAZO,OAAA,CAYP;EAE0B;;;EAOE,aAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EAjBb,qBAiBa,CAjBS,CAiBT,CAAA,CAAA,EAjBc,aAi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,2BAA2B,IAAI,EAAE,4CAG/C,sCAEc,cAAc,SAAS,aAAa,UAC9C,QAAQ,KAAK;;;;;;;KAUZ,YAAA;;;;;;;;oBAUY;;;;;;;;;;;;;;;;;;;;;;UAuBP,WAAA;;;;;;;;;;;;;;;;;;;;;gBAsBD;;;;;oBAMI;;;;;gBAMJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAoCU;;KAGd,cAAA;;;;;;;;;;;;;YAaA;;;;;;;;;;;;;;;;;UAkBF;;;;;;;;UASA;;;;;;sBAOY;;;;;;;;iBASL,UAAA,CAAW"}
|
package/dist/api.d.ts
CHANGED
|
@@ -464,8 +464,11 @@ type ConnectionOpts = {
|
|
|
464
464
|
/**
|
|
465
465
|
* Restate ingress URL.
|
|
466
466
|
* For example: http://localhost:8080
|
|
467
|
+
*
|
|
468
|
+
* Optional for `connect()`: when omitted, the ingress comes from
|
|
469
|
+
* `RESTATE_INGRESS_KEY` (see `connect()`).
|
|
467
470
|
*/
|
|
468
|
-
url
|
|
471
|
+
url?: string;
|
|
469
472
|
/**
|
|
470
473
|
* Headers to attach on every request.
|
|
471
474
|
* Use this to attach authentication headers.
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","names":[],"sources":["../src/api.ts"],"sourcesContent":[],"mappings":";;;;;;AA8BA;;;;;;;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,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;;;;0BAoCU;;KAGd,cAAA;;;;;;;;;;;;;YAaA;;;;;;;;;;;;;;;;;UAkBF;;;;;;;;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 HandlerDescriptor,\n ServiceDescriptor,\n ObjectDescriptor,\n WorkflowDescriptor,\n InferInput,\n InferOutput,\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 send client from a {@link ServiceDefinition}.\n */\n serviceSendClient<D>(\n opts: ServiceDefinitionFrom<D>\n ): IngressSendClient<Service<D>>;\n\n /**\n * Create a send client from a {@link VirtualObjectDefinition}.\n */\n objectSendClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressSendClient<VirtualObject<D>>;\n\n /**\n * Create a request/response client from a service interface / `Descriptor`.\n *\n * @example\n * ```ts\n * ingress.client(greeter).greet(req); // service\n * ingress.client(counter, \"k\").add(1); // virtual object / workflow\n * ```\n */\n client<P extends string, H extends Record<string, HandlerDescriptor>>(\n serviceInterface: ServiceDescriptor<P, H>\n ): IngressClientFromDescriptors<H>;\n client<P extends string, H extends Record<string, HandlerDescriptor>>(\n objectOrWorkflowInterface:\n | ObjectDescriptor<P, H>\n | WorkflowDescriptor<P, H>,\n key: string\n ): IngressClientFromDescriptors<H>;\n\n /**\n * Send-client (one-way) counterpart of {@link Ingress.client}.\n *\n * @example\n * ```ts\n * ingress.sendClient(greeter).greet(req);\n * ingress.sendClient(counter, \"k\").add(1);\n * ```\n */\n sendClient<P extends string, H extends Record<string, HandlerDescriptor>>(\n serviceInterface: ServiceDescriptor<P, H>\n ): IngressSendClientFromDescriptors<H>;\n sendClient<P extends string, H extends Record<string, HandlerDescriptor>>(\n objectOrWorkflowInterface:\n | ObjectDescriptor<P, H>\n | WorkflowDescriptor<P, H>,\n key: string\n ): IngressSendClientFromDescriptors<H>;\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 | \"client\"\n | \"sendClient\"\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/**\n * Typed ingress request/response client derived from a service interface's\n * handler descriptor map `H` (see `iface` in `@restatedev/restate-sdk-core`).\n * Recovers the input/output types directly from the descriptors, so a code-free\n * interface value produces a fully typed client that reuses the declared serdes.\n */\nexport type IngressClientFromDescriptors<\n H extends Record<string, HandlerDescriptor>,\n> = {\n readonly [K in keyof H]: [InferInput<H[K]>] extends [void]\n ? (\n opts?: Opts<InferInput<H[K]>, InferOutput<H[K]>>\n ) => Promise<InferOutput<H[K]>>\n : (\n input: InferInput<H[K]>,\n opts?: Opts<InferInput<H[K]>, InferOutput<H[K]>>\n ) => Promise<InferOutput<H[K]>>;\n};\n\n/** One-way (send) counterpart of {@link IngressClientFromDescriptors}. */\nexport type IngressSendClientFromDescriptors<\n H extends Record<string, HandlerDescriptor>,\n> = {\n readonly [K in keyof H]: [InferInput<H[K]>] extends [void]\n ? (opts?: SendOpts<InferInput<H[K]>>) => Promise<Send<InferOutput<H[K]>>>\n : (\n input: InferInput<H[K]>,\n opts?: SendOpts<InferInput<H[K]>>\n ) => Promise<Send<InferOutput<H[K]>>>;\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) and responses with a transient status (`408`, `425`, `429`,\n * or `5xx`). A terminal error of the invocation is never retried, whatever its status code.\n * Override all of this with {@link RetryPolicy.shouldRetry}.\n */\nexport interface RetryPolicy {\n /**\n * Max number of attempts (including the initial), before giving up.\n *\n * Retrying stops as soon as **either** `maxDuration` or {@link maxAttempts} is reached.\n *\n * Defaults to `6` (the initial attempt plus up to 5 retries). Pass `false` to\n * remove the attempt bound.\n */\n maxAttempts?: number | false;\n\n /**\n * Max total duration of retries, measured from the first attempt, before\n * giving up. If a number is provided, it is interpreted as milliseconds.\n *\n * This bound is checked only when deciding whether to start another\n * attempt after a failure: it never aborts an in-flight request.\n *\n * Retrying stops as soon as **either** {@link maxDuration} or {@link maxAttempts} is reached.\n *\n * Defaults to 60 seconds. Pass `false` to remove the duration bound.\n */\n maxDuration?: Duration | number | false;\n\n /**\n * Initial backoff interval. If a number is provided, it is interpreted as\n * milliseconds. Defaults to `250` 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 `3000` 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 * Whether to honor a `Retry-After` response header when the server provides\n * one. When `true` (the default), a `Retry-After` value overrides the computed\n * exponential backoff for that attempt.\n *\n * Set to `false` to always use the exponential backoff and ignore the header.\n *\n * Note that `Retry-After` never extends the number of retries: {@link maxAttempts} and\n * {@link maxDuration} is always respected regardless of this setting.\n *\n * Defaults to `true`.\n */\n respectRetryAfter?: boolean;\n\n /**\n * Decide whether a given failure should be retried. When provided, this\n * fully replaces the built-in rule (network / transient `408`/`425`/`429`/`5xx`,\n * excluding invocation-sourced errors).\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 * and transient HTTP statuses `408`/`425`/`429`/`5xx`, excluding errors\n * restate attributes to the invocation itself).\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":";;;AA6SA,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;;;;;cA+CM,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 HandlerDescriptor,\n ServiceDescriptor,\n ObjectDescriptor,\n WorkflowDescriptor,\n InferInput,\n InferOutput,\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 send client from a {@link ServiceDefinition}.\n */\n serviceSendClient<D>(\n opts: ServiceDefinitionFrom<D>\n ): IngressSendClient<Service<D>>;\n\n /**\n * Create a send client from a {@link VirtualObjectDefinition}.\n */\n objectSendClient<D>(\n opts: VirtualObjectDefinitionFrom<D>,\n key: string\n ): IngressSendClient<VirtualObject<D>>;\n\n /**\n * Create a request/response client from a service interface / `Descriptor`.\n *\n * @example\n * ```ts\n * ingress.client(greeter).greet(req); // service\n * ingress.client(counter, \"k\").add(1); // virtual object / workflow\n * ```\n */\n client<P extends string, H extends Record<string, HandlerDescriptor>>(\n serviceInterface: ServiceDescriptor<P, H>\n ): IngressClientFromDescriptors<H>;\n client<P extends string, H extends Record<string, HandlerDescriptor>>(\n objectOrWorkflowInterface:\n | ObjectDescriptor<P, H>\n | WorkflowDescriptor<P, H>,\n key: string\n ): IngressClientFromDescriptors<H>;\n\n /**\n * Send-client (one-way) counterpart of {@link Ingress.client}.\n *\n * @example\n * ```ts\n * ingress.sendClient(greeter).greet(req);\n * ingress.sendClient(counter, \"k\").add(1);\n * ```\n */\n sendClient<P extends string, H extends Record<string, HandlerDescriptor>>(\n serviceInterface: ServiceDescriptor<P, H>\n ): IngressSendClientFromDescriptors<H>;\n sendClient<P extends string, H extends Record<string, HandlerDescriptor>>(\n objectOrWorkflowInterface:\n | ObjectDescriptor<P, H>\n | WorkflowDescriptor<P, H>,\n key: string\n ): IngressSendClientFromDescriptors<H>;\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 | \"client\"\n | \"sendClient\"\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/**\n * Typed ingress request/response client derived from a service interface's\n * handler descriptor map `H` (see `iface` in `@restatedev/restate-sdk-core`).\n * Recovers the input/output types directly from the descriptors, so a code-free\n * interface value produces a fully typed client that reuses the declared serdes.\n */\nexport type IngressClientFromDescriptors<\n H extends Record<string, HandlerDescriptor>,\n> = {\n readonly [K in keyof H]: [InferInput<H[K]>] extends [void]\n ? (\n opts?: Opts<InferInput<H[K]>, InferOutput<H[K]>>\n ) => Promise<InferOutput<H[K]>>\n : (\n input: InferInput<H[K]>,\n opts?: Opts<InferInput<H[K]>, InferOutput<H[K]>>\n ) => Promise<InferOutput<H[K]>>;\n};\n\n/** One-way (send) counterpart of {@link IngressClientFromDescriptors}. */\nexport type IngressSendClientFromDescriptors<\n H extends Record<string, HandlerDescriptor>,\n> = {\n readonly [K in keyof H]: [InferInput<H[K]>] extends [void]\n ? (opts?: SendOpts<InferInput<H[K]>>) => Promise<Send<InferOutput<H[K]>>>\n : (\n input: InferInput<H[K]>,\n opts?: SendOpts<InferInput<H[K]>>\n ) => Promise<Send<InferOutput<H[K]>>>;\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) and responses with a transient status (`408`, `425`, `429`,\n * or `5xx`). A terminal error of the invocation is never retried, whatever its status code.\n * Override all of this with {@link RetryPolicy.shouldRetry}.\n */\nexport interface RetryPolicy {\n /**\n * Max number of attempts (including the initial), before giving up.\n *\n * Retrying stops as soon as **either** `maxDuration` or {@link maxAttempts} is reached.\n *\n * Defaults to `6` (the initial attempt plus up to 5 retries). Pass `false` to\n * remove the attempt bound.\n */\n maxAttempts?: number | false;\n\n /**\n * Max total duration of retries, measured from the first attempt, before\n * giving up. If a number is provided, it is interpreted as milliseconds.\n *\n * This bound is checked only when deciding whether to start another\n * attempt after a failure: it never aborts an in-flight request.\n *\n * Retrying stops as soon as **either** {@link maxDuration} or {@link maxAttempts} is reached.\n *\n * Defaults to 60 seconds. Pass `false` to remove the duration bound.\n */\n maxDuration?: Duration | number | false;\n\n /**\n * Initial backoff interval. If a number is provided, it is interpreted as\n * milliseconds. Defaults to `250` 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 `3000` 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 * Whether to honor a `Retry-After` response header when the server provides\n * one. When `true` (the default), a `Retry-After` value overrides the computed\n * exponential backoff for that attempt.\n *\n * Set to `false` to always use the exponential backoff and ignore the header.\n *\n * Note that `Retry-After` never extends the number of retries: {@link maxAttempts} and\n * {@link maxDuration} is always respected regardless of this setting.\n *\n * Defaults to `true`.\n */\n respectRetryAfter?: boolean;\n\n /**\n * Decide whether a given failure should be retried. When provided, this\n * fully replaces the built-in rule (network / transient `408`/`425`/`429`/`5xx`,\n * excluding invocation-sourced errors).\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 * Optional for `connect()`: when omitted, the ingress comes from\n * `RESTATE_INGRESS_KEY` (see `connect()`).\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 * and transient HTTP statuses `408`/`425`/`429`/`5xx`, excluding errors\n * restate attributes to the invocation itself).\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":";;;AA6SA,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;;;;;cA+CM,SAAmC,KAAK,KAAK,KAAK;kBAEjD,SAC1B,SAAS,KAAK,KAAK"}
|
package/dist/env.cjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/env.ts
|
|
3
|
+
const INGRESS_KEY_ENV = "RESTATE_INGRESS_KEY";
|
|
4
|
+
/** Where to get an ingress key (Development → Configure Client), linked in every error. */
|
|
5
|
+
const INGRESS_KEY_URL = "https://cloud.restate.dev/to/developers/integration#configure-client";
|
|
6
|
+
/**
|
|
7
|
+
* The ingress URL and bearer an ingress key stands for:
|
|
8
|
+
* `restate://<api key>@<bare environment id>.env.<region domain>/`, parsed
|
|
9
|
+
* with `new URL()`. The host is the environment's own hostname, so the
|
|
10
|
+
* ingress is `https://<host>:8080`. Query parameters are ignored with one
|
|
11
|
+
* warning (none are defined for this key).
|
|
12
|
+
*/
|
|
13
|
+
function ingressFromKey(value, what = INGRESS_KEY_ENV) {
|
|
14
|
+
const fail = (reason) => {
|
|
15
|
+
throw new Error(`${what} is not a Restate Cloud key (${reason}); expected restate://<api key>@<environment id>.env.<region domain>/ — copy it again from ${INGRESS_KEY_URL}`);
|
|
16
|
+
};
|
|
17
|
+
let url;
|
|
18
|
+
try {
|
|
19
|
+
url = new URL(value.trim());
|
|
20
|
+
} catch {
|
|
21
|
+
return fail("not a URL");
|
|
22
|
+
}
|
|
23
|
+
if (url.protocol !== "restate:") return fail(`the scheme is ${JSON.stringify(url.protocol.replace(/:$/, ""))}, not restate`);
|
|
24
|
+
if (url.port !== "") return fail("the host must not carry a port");
|
|
25
|
+
if (url.pathname !== "" && url.pathname !== "/") return fail("the path must be empty");
|
|
26
|
+
if (url.hash !== "") return fail("a fragment is not allowed");
|
|
27
|
+
const host = url.hostname.toLowerCase();
|
|
28
|
+
const match = /^([a-z0-9_-]+)\.env\.[a-z0-9-]+(\.[a-z0-9-]+)*$/.exec(host);
|
|
29
|
+
if (match === null || match[1].startsWith("env_")) return fail("the host must be <environment id>.env.<region domain>");
|
|
30
|
+
if (url.username === "" && url.password === "") throw new Error(`${what} carries no API key (restate://<api key>@…); copy it again from ${INGRESS_KEY_URL}`);
|
|
31
|
+
const raw = url.password === "" ? url.username : `${url.username}:${url.password}`;
|
|
32
|
+
let token;
|
|
33
|
+
try {
|
|
34
|
+
token = decodeURIComponent(raw);
|
|
35
|
+
} catch {
|
|
36
|
+
return fail("the API key is not valid percent-encoding");
|
|
37
|
+
}
|
|
38
|
+
if (!/^[\x21-\x7e]+$/.test(token)) return fail("the API key contains characters that cannot travel in an HTTP header");
|
|
39
|
+
const params = [...url.searchParams.keys()];
|
|
40
|
+
if (params.length > 0) console.warn(`clients.connect(): ignoring unknown ${what} parameter(s) ${params.map((name) => JSON.stringify(name)).join(", ")}`);
|
|
41
|
+
return {
|
|
42
|
+
url: `https://${host}:8080`,
|
|
43
|
+
token
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** Resolve the connection options: the `url` (and bearer) from `RESTATE_INGRESS_KEY` when not given. */
|
|
47
|
+
function resolveConnectionOpts(opts) {
|
|
48
|
+
if (opts.url !== void 0 && opts.url !== "") return {
|
|
49
|
+
...opts,
|
|
50
|
+
url: opts.url
|
|
51
|
+
};
|
|
52
|
+
const value = process.env[INGRESS_KEY_ENV];
|
|
53
|
+
if (value === void 0 || value === "") throw new Error(`clients.connect(): url is required — pass { url } (e.g. "http://localhost:8080") or set ${INGRESS_KEY_ENV} (create one at ${INGRESS_KEY_URL})`);
|
|
54
|
+
const { url, token } = ingressFromKey(value);
|
|
55
|
+
const headers = { ...opts.headers ?? {} };
|
|
56
|
+
if (!Object.keys(headers).some((name) => name.toLowerCase() === "authorization")) headers["Authorization"] = `Bearer ${token}`;
|
|
57
|
+
return {
|
|
58
|
+
...opts,
|
|
59
|
+
url,
|
|
60
|
+
headers
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.resolveConnectionOpts = resolveConnectionOpts;
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/env.ts
|
|
2
|
+
const INGRESS_KEY_ENV = "RESTATE_INGRESS_KEY";
|
|
3
|
+
/** Where to get an ingress key (Development → Configure Client), linked in every error. */
|
|
4
|
+
const INGRESS_KEY_URL = "https://cloud.restate.dev/to/developers/integration#configure-client";
|
|
5
|
+
/**
|
|
6
|
+
* The ingress URL and bearer an ingress key stands for:
|
|
7
|
+
* `restate://<api key>@<bare environment id>.env.<region domain>/`, parsed
|
|
8
|
+
* with `new URL()`. The host is the environment's own hostname, so the
|
|
9
|
+
* ingress is `https://<host>:8080`. Query parameters are ignored with one
|
|
10
|
+
* warning (none are defined for this key).
|
|
11
|
+
*/
|
|
12
|
+
function ingressFromKey(value, what = INGRESS_KEY_ENV) {
|
|
13
|
+
const fail = (reason) => {
|
|
14
|
+
throw new Error(`${what} is not a Restate Cloud key (${reason}); expected restate://<api key>@<environment id>.env.<region domain>/ — copy it again from ${INGRESS_KEY_URL}`);
|
|
15
|
+
};
|
|
16
|
+
let url;
|
|
17
|
+
try {
|
|
18
|
+
url = new URL(value.trim());
|
|
19
|
+
} catch {
|
|
20
|
+
return fail("not a URL");
|
|
21
|
+
}
|
|
22
|
+
if (url.protocol !== "restate:") return fail(`the scheme is ${JSON.stringify(url.protocol.replace(/:$/, ""))}, not restate`);
|
|
23
|
+
if (url.port !== "") return fail("the host must not carry a port");
|
|
24
|
+
if (url.pathname !== "" && url.pathname !== "/") return fail("the path must be empty");
|
|
25
|
+
if (url.hash !== "") return fail("a fragment is not allowed");
|
|
26
|
+
const host = url.hostname.toLowerCase();
|
|
27
|
+
const match = /^([a-z0-9_-]+)\.env\.[a-z0-9-]+(\.[a-z0-9-]+)*$/.exec(host);
|
|
28
|
+
if (match === null || match[1].startsWith("env_")) return fail("the host must be <environment id>.env.<region domain>");
|
|
29
|
+
if (url.username === "" && url.password === "") throw new Error(`${what} carries no API key (restate://<api key>@…); copy it again from ${INGRESS_KEY_URL}`);
|
|
30
|
+
const raw = url.password === "" ? url.username : `${url.username}:${url.password}`;
|
|
31
|
+
let token;
|
|
32
|
+
try {
|
|
33
|
+
token = decodeURIComponent(raw);
|
|
34
|
+
} catch {
|
|
35
|
+
return fail("the API key is not valid percent-encoding");
|
|
36
|
+
}
|
|
37
|
+
if (!/^[\x21-\x7e]+$/.test(token)) return fail("the API key contains characters that cannot travel in an HTTP header");
|
|
38
|
+
const params = [...url.searchParams.keys()];
|
|
39
|
+
if (params.length > 0) console.warn(`clients.connect(): ignoring unknown ${what} parameter(s) ${params.map((name) => JSON.stringify(name)).join(", ")}`);
|
|
40
|
+
return {
|
|
41
|
+
url: `https://${host}:8080`,
|
|
42
|
+
token
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Resolve the connection options: the `url` (and bearer) from `RESTATE_INGRESS_KEY` when not given. */
|
|
46
|
+
function resolveConnectionOpts(opts) {
|
|
47
|
+
if (opts.url !== void 0 && opts.url !== "") return {
|
|
48
|
+
...opts,
|
|
49
|
+
url: opts.url
|
|
50
|
+
};
|
|
51
|
+
const value = process.env[INGRESS_KEY_ENV];
|
|
52
|
+
if (value === void 0 || value === "") throw new Error(`clients.connect(): url is required — pass { url } (e.g. "http://localhost:8080") or set ${INGRESS_KEY_ENV} (create one at ${INGRESS_KEY_URL})`);
|
|
53
|
+
const { url, token } = ingressFromKey(value);
|
|
54
|
+
const headers = { ...opts.headers ?? {} };
|
|
55
|
+
if (!Object.keys(headers).some((name) => name.toLowerCase() === "authorization")) headers["Authorization"] = `Bearer ${token}`;
|
|
56
|
+
return {
|
|
57
|
+
...opts,
|
|
58
|
+
url,
|
|
59
|
+
headers
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { resolveConnectionOpts };
|
|
65
|
+
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","names":["url: URL","token: string"],"sources":["../src/env.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2026 - 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\n// Ingress connection from RESTATE_INGRESS_KEY.\n//\n// `connect()` without a `url` reads `RESTATE_INGRESS_KEY`, an ingress key from\n// the Cloud UI (Development → Configure Client):\n//\n// restate://<api key>@<bare environment id>.env.<region domain>/\n//\n// The ingress is `https://<host>:8080` and the API key is the bearer. Explicit\n// options always win; with neither a `url` nor the variable, `connect()`\n// fails fast, as it always required a `url`.\n\nimport type { ConnectionOpts } from \"./api.js\";\n\nexport const INGRESS_KEY_ENV = \"RESTATE_INGRESS_KEY\";\n/** Where to get an ingress key (Development → Configure Client), linked in every error. */\nconst INGRESS_KEY_URL =\n \"https://cloud.restate.dev/to/developers/integration#configure-client\";\n\n/**\n * The ingress URL and bearer an ingress key stands for:\n * `restate://<api key>@<bare environment id>.env.<region domain>/`, parsed\n * with `new URL()`. The host is the environment's own hostname, so the\n * ingress is `https://<host>:8080`. Query parameters are ignored with one\n * warning (none are defined for this key).\n */\nfunction ingressFromKey(\n value: string,\n what: string = INGRESS_KEY_ENV\n): { url: string; token: string } {\n // Reasons never echo parts of the value: a key pasted with a lost `@` or a\n // stray `/` would otherwise put the credential in the error message.\n const fail = (reason: string): never => {\n throw new Error(\n `${what} is not a Restate Cloud key (${reason}); expected restate://<api key>@<environment id>.env.<region domain>/ — copy it again from ${INGRESS_KEY_URL}`\n );\n };\n let url: URL;\n try {\n url = new URL(value.trim());\n } catch {\n return fail(\"not a URL\");\n }\n if (url.protocol !== \"restate:\") {\n return fail(\n `the scheme is ${JSON.stringify(url.protocol.replace(/:$/, \"\"))}, not restate`\n );\n }\n if (url.port !== \"\") return fail(\"the host must not carry a port\");\n if (url.pathname !== \"\" && url.pathname !== \"/\") {\n return fail(\"the path must be empty\");\n }\n if (url.hash !== \"\") return fail(\"a fragment is not allowed\");\n // Hosts are case-insensitive; a non-special scheme keeps the pasted case.\n const host = url.hostname.toLowerCase();\n const match = /^([a-z0-9_-]+)\\.env\\.[a-z0-9-]+(\\.[a-z0-9-]+)*$/.exec(host);\n if (match === null || match[1]!.startsWith(\"env_\")) {\n return fail(\"the host must be <environment id>.env.<region domain>\");\n }\n if (url.username === \"\" && url.password === \"\") {\n throw new Error(\n `${what} carries no API key (restate://<api key>@…); copy it again from ${INGRESS_KEY_URL}`\n );\n }\n // The userinfo slot, percent-decoded; a `:` splits it, so re-join.\n const raw =\n url.password === \"\" ? url.username : `${url.username}:${url.password}`;\n let token: string;\n try {\n token = decodeURIComponent(raw);\n } catch {\n return fail(\"the API key is not valid percent-encoding\");\n }\n if (!/^[\\x21-\\x7e]+$/.test(token)) {\n return fail(\n \"the API key contains characters that cannot travel in an HTTP header\"\n );\n }\n const params = [...url.searchParams.keys()];\n if (params.length > 0) {\n // eslint-disable-next-line no-console\n console.warn(\n `clients.connect(): ignoring unknown ${what} parameter(s) ${params.map((name) => JSON.stringify(name)).join(\", \")}`\n );\n }\n return { url: `https://${host}:8080`, token };\n}\n\n/** Connection options with the ingress URL settled. */\nexport type ResolvedConnectionOpts = ConnectionOpts & { url: string };\n\n/** Resolve the connection options: the `url` (and bearer) from `RESTATE_INGRESS_KEY` when not given. */\nexport function resolveConnectionOpts(\n opts: ConnectionOpts\n): ResolvedConnectionOpts {\n if (opts.url !== undefined && opts.url !== \"\") {\n return { ...opts, url: opts.url };\n }\n const value = process.env[INGRESS_KEY_ENV];\n if (value === undefined || value === \"\") {\n throw new Error(\n `clients.connect(): url is required — pass { url } (e.g. \"http://localhost:8080\") or set ${INGRESS_KEY_ENV} (create one at ${INGRESS_KEY_URL})`\n );\n }\n const { url, token } = ingressFromKey(value);\n const headers = { ...(opts.headers ?? {}) };\n const hasAuthorization = Object.keys(headers).some(\n (name) => name.toLowerCase() === \"authorization\"\n );\n if (!hasAuthorization) headers[\"Authorization\"] = `Bearer ${token}`;\n return { ...opts, url, headers };\n}\n"],"mappings":";AAwBA,MAAa,kBAAkB;;AAE/B,MAAM,kBACJ;;;;;;;;AASF,SAAS,eACP,OACA,OAAe,iBACiB;CAGhC,MAAM,QAAQ,WAA0B;AACtC,QAAM,IAAI,MACR,GAAG,KAAK,+BAA+B,OAAO,6FAA6F,kBA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M,QAAQ,QAAQ,IAAI;AAC1B,KAAI,UAAU,UAAa,UAAU,GACnC,OAAM,IAAI,MACR,2FAA2F,gBAAgB,kBAAkB,gBAAgB,GAC9I;CAEH,MAAM,EAAE,KAAK,UAAU,eAAe,MAAM;CAC5C,MAAM,UAAU,EAAE,GAAI,KAAK,WAAW,EAAE,EAAG;AAI3C,KAAI,CAHqB,OAAO,KAAK,QAAQ,CAAC,MAC3C,SAAS,KAAK,aAAa,KAAK,gBAClC,CACsB,SAAQ,mBAAmB,UAAU;AAC5D,QAAO;EAAE,GAAG;EAAM;EAAK;EAAS"}
|
package/dist/ingress.cjs
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_api = require('./api.cjs');
|
|
3
|
+
const require_env = require('./env.cjs');
|
|
3
4
|
const require_retry = require('./retry.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);
|
|
6
7
|
|
|
7
8
|
//#region src/ingress.ts
|
|
8
9
|
/**
|
|
9
|
-
* Connect to the
|
|
10
|
+
* Connect to the Restate ingress.
|
|
11
|
+
*
|
|
12
|
+
* With a `url`, exactly that. Without one, the ingress is taken from
|
|
13
|
+
* `RESTATE_INGRESS_KEY`, the ingress key from the Cloud UI (Development →
|
|
14
|
+
* Configure Client).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const rs = connect({ url: "http://localhost:8080" }); // a local Restate
|
|
19
|
+
* const cloud = connect(); // uses RESTATE_INGRESS_KEY
|
|
20
|
+
* ```
|
|
10
21
|
*
|
|
11
22
|
* @param opts connection options
|
|
12
|
-
* @returns a connection
|
|
23
|
+
* @returns a connection to the Restate ingress
|
|
13
24
|
*/
|
|
14
|
-
function connect(opts) {
|
|
15
|
-
return new HttpIngress(opts);
|
|
25
|
+
function connect(opts = {}) {
|
|
26
|
+
return new HttpIngress(require_env.resolveConnectionOpts(opts));
|
|
16
27
|
}
|
|
17
28
|
var HttpCallError = class extends Error {
|
|
18
29
|
constructor(status, responseText, message) {
|
package/dist/ingress.d.cts
CHANGED
|
@@ -3,12 +3,22 @@ import { ConnectionOpts, Ingress } from "./api.cjs";
|
|
|
3
3
|
//#region src/ingress.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Connect to the
|
|
6
|
+
* Connect to the Restate ingress.
|
|
7
|
+
*
|
|
8
|
+
* With a `url`, exactly that. Without one, the ingress is taken from
|
|
9
|
+
* `RESTATE_INGRESS_KEY`, the ingress key from the Cloud UI (Development →
|
|
10
|
+
* Configure Client).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const rs = connect({ url: "http://localhost:8080" }); // a local Restate
|
|
15
|
+
* const cloud = connect(); // uses RESTATE_INGRESS_KEY
|
|
16
|
+
* ```
|
|
7
17
|
*
|
|
8
18
|
* @param opts connection options
|
|
9
|
-
* @returns a connection
|
|
19
|
+
* @returns a connection to the Restate ingress
|
|
10
20
|
*/
|
|
11
|
-
declare function connect(opts
|
|
21
|
+
declare function connect(opts?: ConnectionOpts): Ingress;
|
|
12
22
|
declare class HttpCallError extends Error {
|
|
13
23
|
readonly status: number;
|
|
14
24
|
readonly responseText: string;
|
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":";;;;;;AAyDA;AAgBA;;;;;;;;;;;;;iBAhBgB,OAAA,QAAc,iBAAsB;cAgBvC,aAAA,SAAsB,KAAA"}
|
package/dist/ingress.d.ts
CHANGED
|
@@ -3,12 +3,22 @@ import { ConnectionOpts, Ingress } from "./api.js";
|
|
|
3
3
|
//#region src/ingress.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Connect to the
|
|
6
|
+
* Connect to the Restate ingress.
|
|
7
|
+
*
|
|
8
|
+
* With a `url`, exactly that. Without one, the ingress is taken from
|
|
9
|
+
* `RESTATE_INGRESS_KEY`, the ingress key from the Cloud UI (Development →
|
|
10
|
+
* Configure Client).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const rs = connect({ url: "http://localhost:8080" }); // a local Restate
|
|
15
|
+
* const cloud = connect(); // uses RESTATE_INGRESS_KEY
|
|
16
|
+
* ```
|
|
7
17
|
*
|
|
8
18
|
* @param opts connection options
|
|
9
|
-
* @returns a connection
|
|
19
|
+
* @returns a connection to the Restate ingress
|
|
10
20
|
*/
|
|
11
|
-
declare function connect(opts
|
|
21
|
+
declare function connect(opts?: ConnectionOpts): Ingress;
|
|
12
22
|
declare class HttpCallError extends Error {
|
|
13
23
|
readonly status: number;
|
|
14
24
|
readonly responseText: string;
|
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":";;;;;;AAyDA;AAgBA;;;;;;;;;;;;;iBAhBgB,OAAA,QAAc,iBAAsB;cAgBvC,aAAA,SAAsB,KAAA"}
|
package/dist/ingress.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { Opts, SendOpts } from "./api.js";
|
|
2
|
+
import { resolveConnectionOpts } from "./env.js";
|
|
2
3
|
import { abortableSleep, backoffDelay, defaultShouldRetry, parseRetryAfter, resolveRetryPolicy } from "./retry.js";
|
|
3
4
|
import { serde } from "@restatedev/restate-sdk-core";
|
|
4
5
|
|
|
5
6
|
//#region src/ingress.ts
|
|
6
7
|
/**
|
|
7
|
-
* Connect to the
|
|
8
|
+
* Connect to the Restate ingress.
|
|
9
|
+
*
|
|
10
|
+
* With a `url`, exactly that. Without one, the ingress is taken from
|
|
11
|
+
* `RESTATE_INGRESS_KEY`, the ingress key from the Cloud UI (Development →
|
|
12
|
+
* Configure Client).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const rs = connect({ url: "http://localhost:8080" }); // a local Restate
|
|
17
|
+
* const cloud = connect(); // uses RESTATE_INGRESS_KEY
|
|
18
|
+
* ```
|
|
8
19
|
*
|
|
9
20
|
* @param opts connection options
|
|
10
|
-
* @returns a connection
|
|
21
|
+
* @returns a connection to the Restate ingress
|
|
11
22
|
*/
|
|
12
|
-
function connect(opts) {
|
|
13
|
-
return new HttpIngress(opts);
|
|
23
|
+
function connect(opts = {}) {
|
|
24
|
+
return new HttpIngress(resolveConnectionOpts(opts));
|
|
14
25
|
}
|
|
15
26
|
var HttpCallError = class extends Error {
|
|
16
27
|
constructor(status, responseText, message) {
|