@restatedev/restate-sdk-gen 1.14.2 → 1.14.3

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/index.d.cts CHANGED
@@ -1,11 +1,13 @@
1
1
  import * as restate from "@restatedev/restate-sdk";
2
+ import { ContextDate, InvocationId, Opts, Rand, SendOpts, Target as Target$1 } from "@restatedev/restate-sdk";
2
3
 
4
+ //#region rolldown:runtime
5
+ //#endregion
3
6
  //#region src/operation.d.ts
4
7
  interface Operation<T> {
5
8
  [Symbol.iterator](): Iterator<unknown, T, unknown>;
6
9
  }
7
10
  declare function gen<T>(body: () => Generator<unknown, T, unknown>): Operation<T>;
8
- declare function spawn<T>(op: Operation<T>): Operation<Future<T>>;
9
11
  type SelectResult<B extends Record<string, Future<unknown>>> = { [K in keyof B]: {
10
12
  tag: K;
11
13
  future: B[K];
@@ -13,7 +15,10 @@ type SelectResult<B extends Record<string, Future<unknown>>> = { [K in keyof B]:
13
15
  declare function select<B extends Record<string, Future<unknown>>>(branches: B): Generator<unknown, SelectResult<B>, unknown>;
14
16
  //#endregion
15
17
  //#region src/future.d.ts
16
- interface Future<T> extends Operation<T> {}
18
+ declare const futureBrand: unique symbol;
19
+ interface Future<T> extends Operation<T> {
20
+ readonly [futureBrand]: unknown;
21
+ }
17
22
  /** Extract the value type from a `Future<U>`; `never` for non-Futures. */
18
23
  type FutureValue<F> = F extends Future<infer U> ? U : never;
19
24
  /**
@@ -47,23 +52,421 @@ interface Channel<T> {
47
52
  readonly receive: Future<T>;
48
53
  }
49
54
  //#endregion
50
- //#region src/clients.d.ts
55
+ //#region src/invocation-reference.d.ts
56
+ /** Synchronous handle for resolving or rejecting a signal on a target invocation */
57
+ interface SignalReference<T> {
58
+ resolve(payload?: T): void;
59
+ reject(reason: string | restate.TerminalError): void;
60
+ }
61
+ /**
62
+ * A typed reference to a running invocation. Returned by `sendClient()` methods
63
+ * (wrapped in `Future<InvocationReference<O>>`), or created via `invocation(id)`.
64
+ *
65
+ * - `attach()` returns a `Future<O>` with the serde from the original descriptor.
66
+ * - `signal()` sends a named signal to the target invocation.
67
+ * - `cancel()` cancels the target invocation.
68
+ */
69
+ interface InvocationReference<O$1 = unknown> {
70
+ readonly id: string;
71
+ attach(serde?: restate.Serde<O$1>): Future<O$1>;
72
+ signal<T = unknown>(name: string, serde?: restate.Serde<T>): SignalReference<T>;
73
+ cancel(): void;
74
+ }
75
+ //#endregion
76
+ //#region ../restate-sdk-core/src/core.d.ts
77
+ type ServiceDefinition<P$1 extends string, M> = {
78
+ name: P$1;
79
+ };
80
+ type Service<M> = M extends ServiceDefinition<string, infer S> ? S : M;
81
+ type ServiceDefinitionFrom<M> = M extends ServiceDefinition<string, unknown> ? M : ServiceDefinition<string, M>;
82
+ type VirtualObjectDefinition<P$1 extends string, M> = {
83
+ name: P$1;
84
+ };
85
+ type VirtualObject<M> = M extends VirtualObjectDefinition<string, infer O> ? O : M;
86
+ type VirtualObjectDefinitionFrom<M> = M extends VirtualObjectDefinition<string, unknown> ? M : VirtualObjectDefinition<string, M>;
87
+ type WorkflowDefinition<P$1 extends string, M> = {
88
+ name: P$1;
89
+ };
90
+ type Workflow<M> = M extends WorkflowDefinition<string, infer W> ? W : M;
91
+ type WorkflowDefinitionFrom<M> = M extends WorkflowDefinition<string, unknown> ? M : WorkflowDefinition<string, M>;
92
+ //#endregion
93
+ //#region ../restate-sdk-core/src/standard_schema.d.ts
51
94
  /**
52
- * Same shape as the SDK's `Client<M>` but each handler returns
53
- * `Future<O>` instead of `InvocationPromise<O>`. The mapped type
54
- * preserves the original argument list (including the trailing
55
- * `opts?: Opts<...>` parameter from the SDK).
95
+ * This file is copy pasted as is from https://standardschema.dev/
56
96
  */
57
- type FluentClient<C> = { [K in keyof C]: C[K] extends ((...args: infer A) => restate.InvocationPromise<infer R>) ? (...args: A) => Future<R> : C[K] };
97
+ /** The Standard Typed interface. This is a base type extended by other specs. */
98
+ interface StandardTypedV1<Input = unknown, Output$1 = Input> {
99
+ /** The Standard properties. */
100
+ readonly "~standard": StandardTypedV1.Props<Input, Output$1>;
101
+ }
102
+ declare namespace StandardTypedV1 {
103
+ /** The Standard Typed properties interface. */
104
+ interface Props<Input = unknown, Output$1 = Input> {
105
+ /** The version number of the standard. */
106
+ readonly version: 1;
107
+ /** The vendor name of the schema library. */
108
+ readonly vendor: string;
109
+ /** Inferred types associated with the schema. */
110
+ readonly types?: Types<Input, Output$1> | undefined;
111
+ }
112
+ /** The Standard Typed types interface. */
113
+ interface Types<Input = unknown, Output$1 = Input> {
114
+ /** The input type of the schema. */
115
+ readonly input: Input;
116
+ /** The output type of the schema. */
117
+ readonly output: Output$1;
118
+ }
119
+ /** Infers the input type of a Standard Typed. */
120
+ type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
121
+ /** Infers the output type of a Standard Typed. */
122
+ type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
123
+ }
124
+ /** The Standard Schema interface. */
125
+ interface StandardSchemaV1<Input = unknown, Output$1 = Input> {
126
+ /** The Standard Schema properties. */
127
+ readonly "~standard": StandardSchemaV1.Props<Input, Output$1>;
128
+ }
129
+ declare namespace StandardSchemaV1 {
130
+ /** The Standard Schema properties interface. */
131
+ interface Props<Input = unknown, Output$1 = Input> extends StandardTypedV1.Props<Input, Output$1> {
132
+ /** Validates unknown input values. */
133
+ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output$1> | Promise<Result<Output$1>>;
134
+ }
135
+ /** The result interface of the validate function. */
136
+ type Result<Output$1> = SuccessResult<Output$1> | FailureResult;
137
+ /** The result interface if validation succeeds. */
138
+ interface SuccessResult<Output$1> {
139
+ /** The typed output value. */
140
+ readonly value: Output$1;
141
+ /** A falsy value for `issues` indicates success. */
142
+ readonly issues?: undefined;
143
+ }
144
+ interface Options {
145
+ /** Explicit support for additional vendor-specific parameters, if needed. */
146
+ readonly libraryOptions?: Record<string, unknown> | undefined;
147
+ }
148
+ /** The result interface if validation fails. */
149
+ interface FailureResult {
150
+ /** The issues of failed validation. */
151
+ readonly issues: ReadonlyArray<Issue>;
152
+ }
153
+ /** The issue interface of the failure output. */
154
+ interface Issue {
155
+ /** The error message of the issue. */
156
+ readonly message: string;
157
+ /** The path of the issue, if any. */
158
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
159
+ }
160
+ /** The path segment interface of the issue. */
161
+ interface PathSegment {
162
+ /** The key representing a path segment. */
163
+ readonly key: PropertyKey;
164
+ }
165
+ /** The Standard types interface. */
166
+ interface Types<Input = unknown, Output$1 = Input> extends StandardTypedV1.Types<Input, Output$1> {}
167
+ /** Infers the input type of a Standard. */
168
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
169
+ /** Infers the output type of a Standard. */
170
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
171
+ }
172
+ //#endregion
173
+ //#region ../restate-sdk-core/src/serde_api.d.ts
58
174
  /**
59
- * Same shape as the SDK's `DurablePromise<T>` but each method returns
60
- * `Future<...>` instead of `Promise<...>`/`RestatePromise<...>`.
175
+ * Serializer/deserializer pair for any Restate-managed value of type `T`
176
+ * handler inputs and outputs, service state, side-effect results,
177
+ * awakeables, durable promises, and so on.
178
+ *
179
+ * A `Serde<T>` is responsible for two conversions:
180
+ *
181
+ * - **Wire format**: `serialize` / `deserialize` convert a value `T` to and
182
+ * from the raw bytes that flow over the network and get stored in the
183
+ * journal.
184
+ * - **JSON preview (optional)**: `preview.toJsonString` /
185
+ * `preview.fromJsonString` convert a value `T` to and from a JSON string,
186
+ * used by tooling to render and edit values that humans can read.
61
187
  *
62
- * Workflow promises are durable; reads are journaled (so `peek`/`get`
63
- * are journal-backed Futures), and writes (`resolve`/`reject`) record
64
- * a journal entry that the user yields on.
188
+ * It also advertises metadata (`contentType`, `jsonSchema`) that surfaces in
189
+ * service discovery.
190
+ */
191
+ interface Serde<T> {
192
+ /**
193
+ * MIME type of the bytes produced by `serialize` (and accepted by
194
+ * `deserialize`).
195
+ */
196
+ contentType?: string;
197
+ /**
198
+ * Optional JSON Schema describing the logical shape of `T`. Surfaced in
199
+ * discovery so that tooling can generate forms, auto-complete payloads,
200
+ * etc. Has no effect on serialization at runtime.
201
+ */
202
+ jsonSchema?: object;
203
+ /**
204
+ * Optional bridge between the serde's wire format and a JSON
205
+ * representation that humans (and tooling like the Restate UI) can read
206
+ * and edit.
207
+ *
208
+ * Only useful for serdes whose wire format isn't already plain JSON —
209
+ * protobuf, MessagePack, length-prefixed binary, JSON variants that need
210
+ * post-processing for bigints/dates, etc. Both methods may be async if the
211
+ * conversion needs I/O.
212
+ *
213
+ * ### Preview flow
214
+ *
215
+ * Together with `serialize` / `deserialize`, the four functions chain in
216
+ * both directions between a JSON string and on-the-wire bytes:
217
+ *
218
+ * ```text
219
+ * JSON string ──fromJsonString──► T ──serialize──► wire bytes
220
+ * wire bytes ──deserialize────► T ──toJsonString──► JSON string
221
+ * ```
222
+ *
223
+ * The split keeps `serialize` / `deserialize` responsible for the full
224
+ * on-the-wire format; `preview` only handles the JSON ↔ `T` bridge.
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * // Wire format is protobuf; the protobuf-es runtime already ships
229
+ * // `toJsonString` / `fromJsonString`, so preview is a direct pass-through.
230
+ * import {
231
+ * fromBinary,
232
+ * fromJsonString,
233
+ * toBinary,
234
+ * toJsonString,
235
+ * } from "@bufbuild/protobuf";
236
+ * import { PersonSchema, type Person } from "./person_pb.js";
237
+ *
238
+ * const personSerde: Serde<Person> = {
239
+ * contentType: "application/protobuf",
240
+ * serialize(message) { return toBinary(PersonSchema, message); },
241
+ * deserialize(bytes) { return fromBinary(PersonSchema, bytes); },
242
+ * preview: {
243
+ * toJsonString: (v) => toJsonString(PersonSchema, v),
244
+ * fromJsonString: (j) => fromJsonString(PersonSchema, j),
245
+ * },
246
+ * };
247
+ * ```
248
+ */
249
+ preview?: {
250
+ /**
251
+ * Convert a value into a JSON string for display or editing by humans.
252
+ * The returned string must round-trip through `fromJsonString` back to
253
+ * the same logical value.
254
+ */
255
+ toJsonString(value: T): Promise<string> | string;
256
+ /**
257
+ * Parse a human-supplied JSON string back into a value of type `T`.
258
+ * Should throw (or reject) if `json` is invalid for this serde.
259
+ */
260
+ fromJsonString(json: string): Promise<T> | T;
261
+ };
262
+ /**
263
+ * Convert a value of type `T` into its on-the-wire bytes. This is the
264
+ * format Restate sends between services and persists in the journal.
265
+ *
266
+ * Must be the inverse of `deserialize` — `deserialize(serialize(v))`
267
+ * should produce a value equivalent to `v`.
268
+ */
269
+ serialize(value: T): Uint8Array;
270
+ /**
271
+ * Convert on-the-wire bytes back into a value of type `T`. Must be the
272
+ * inverse of `serialize`.
273
+ *
274
+ * May throw if `data` doesn't conform to the expected wire format.
275
+ */
276
+ deserialize(data: Uint8Array): T;
277
+ }
278
+ declare namespace serde {
279
+ class JsonSerde<T> implements Serde<T | undefined> {
280
+ readonly jsonSchema?: object | undefined;
281
+ contentType: string;
282
+ constructor(jsonSchema?: object | undefined);
283
+ serialize(value: T): Uint8Array;
284
+ deserialize(data: Uint8Array): T | undefined;
285
+ schema<U$1>(schema: object): Serde<U$1>;
286
+ }
287
+ const json: JsonSerde<any>;
288
+ const binary: Serde<Uint8Array>;
289
+ const empty: Serde<void>;
290
+ /**
291
+ * A Standard Schema-based serde.
292
+ *
293
+ * @param schema the standard schema
294
+ * @param validateOptions options passed to `StandardSchemaV1.Options.libraryOptions` when validating
295
+ * @param jsonSchemaOptions options passed to `StandardJsonSchemaV1.Options.libraryOptions` for code generation
296
+ * @returns a serde that will validate the data with the standard schema
297
+ */
298
+ const schema: <T extends {
299
+ "~standard": StandardSchemaV1.Props;
300
+ }>(schema: T, validateOptions?: Record<string, unknown>, jsonSchemaOptions?: Record<string, unknown>) => Serde<StandardSchemaV1.InferOutput<T>>;
301
+ }
302
+ //#endregion
303
+ //#region ../restate-sdk-core/src/duration.d.ts
304
+ /**
305
+ * Duration type. Note that fields are additive.
65
306
  */
66
- type FluentDurablePromise<T> = {
307
+ type Duration = {
308
+ days?: number;
309
+ hours?: number;
310
+ minutes?: number;
311
+ seconds?: number;
312
+ milliseconds?: number;
313
+ };
314
+ //#endregion
315
+ //#region ../restate-sdk-core/src/entry_codec.d.ts
316
+ /**
317
+ * Journal values codec.
318
+ *
319
+ * This allows to transform journal values after being serialized, before writing them to the wire.
320
+ *
321
+ * Values that are passed through the codec:
322
+ *
323
+ * * Handlers input and success output
324
+ * * ctx.run success results
325
+ * * Awakeables/Promise success results
326
+ * * State values
327
+ *
328
+ * @experimental
329
+ */
330
+ type JournalValueCodec = {
331
+ /**
332
+ * Encodes the given buffer.
333
+ *
334
+ * This will be applied *after* serialization.
335
+ *
336
+ * @param buf The buffer to encode. Empty byte buffers should be appropriately handled as well.
337
+ * @returns The encoded buffer
338
+ */
339
+ encode(buf: Uint8Array): Uint8Array;
340
+ /**
341
+ * Decodes the given buffer.
342
+ *
343
+ * This will be applied *before* deserialization.
344
+ *
345
+ * @param buf The buffer to decode.
346
+ * @returns A promise that resolves to the decoded buffer.
347
+ */
348
+ decode(buf: Uint8Array): Promise<Uint8Array>;
349
+ };
350
+ //#endregion
351
+ //#region src/define.d.ts
352
+ /**
353
+ * Minimal descriptor stored in Descriptor._handlers per handler.
354
+ */
355
+ type HandlerDescriptor<I$1 = any, O$1 = any> = {
356
+ readonly _inputSerde?: restate.Serde<I$1>;
357
+ readonly _outputSerde?: restate.Serde<O$1>;
358
+ };
359
+ /**
360
+ * The single client-facing type for all definition styles.
361
+ * - Returned by service() / object() / workflow() (also bindable to serve())
362
+ * - Returned by restate.interface.service/object/workflow (pure, not bindable)
363
+ * - Returned by implement() (also bindable)
364
+ */
365
+ type Descriptor<P$1 extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>, Kind extends "service" | "object" | "workflow" = "service" | "object" | "workflow"> = {
366
+ readonly name: P$1;
367
+ readonly _kind: Kind;
368
+ readonly _handlers: H;
369
+ };
370
+ /** Kind-specific aliases for the common Descriptor type */
371
+ type ServiceDescriptor<P$1 extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P$1, H, "service">;
372
+ type ObjectDescriptor<P$1 extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P$1, H, "object">;
373
+ type WorkflowDescriptor<P$1 extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P$1, H, "workflow">;
374
+ /** Implemented definition — extends Descriptor and also bindable to serve() */
375
+ type ImplementedServiceDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>> = restate.ServiceDefinition<P$1, any> & ServiceDescriptor<P$1, H>;
376
+ type ImplementedObjectDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>> = restate.VirtualObjectDefinition<P$1, any> & ObjectDescriptor<P$1, H>;
377
+ type ImplementedWorkflowDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>> = restate.WorkflowDefinition<P$1, any> & WorkflowDescriptor<P$1, H>;
378
+ type ImplementedDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>, Kind extends "service" | "object" | "workflow"> = Kind extends "service" ? ImplementedServiceDefinition<P$1, H> : Kind extends "object" ? ImplementedObjectDefinition<P$1, H> : ImplementedWorkflowDefinition<P$1, H>;
379
+ /** @internal
380
+ * @internal - Wraps a generator function with optional serde. Produced by typed().
381
+ * Discriminated by _genFn for runtime detection (distinct from bare gen fns,
382
+ * which are plain functions rather than objects).
383
+ */
384
+ type HandlerDef<I$1 = any, O$1 = any> = {
385
+ readonly _genFn: (input: I$1) => Operation<O$1>;
386
+ } & HandlerDescriptor<I$1, O$1>;
387
+ /** @internal */
388
+ type EntryToDescriptor<E> = E extends HandlerDef<infer I, infer O> ? HandlerDescriptor<I, O> : E extends (() => Operation<infer O>) ? HandlerDescriptor<void, O> : E extends ((input: infer I) => Operation<infer O>) ? HandlerDescriptor<I, O> : HandlerDescriptor;
389
+ /** Map a full handler map type to the corresponding descriptor map type */
390
+ type HandlerDescriptors<H extends Record<string, HandlerOrHandlerDescriptor>> = { [K in keyof H]: EntryToDescriptor<H[K]> };
391
+ /** Options valid for all handler types (no serde — those live in typed()) */
392
+ type GenHandlerOpts = {
393
+ idempotencyRetention?: restate.Duration | number;
394
+ journalRetention?: restate.Duration | number;
395
+ inactivityTimeout?: restate.Duration | number;
396
+ abortTimeout?: restate.Duration | number;
397
+ retryPolicy?: restate.RetryPolicy;
398
+ description?: string;
399
+ metadata?: Record<string, string>;
400
+ ingressPrivate?: boolean;
401
+ explicitCancellation?: boolean;
402
+ };
403
+ /** Handler options for virtual object handlers */
404
+ type GenObjectHandlerOpts = GenHandlerOpts & {
405
+ shared?: boolean;
406
+ enableLazyState?: boolean;
407
+ };
408
+ /** Handler options for workflow handlers (shared is implicit from name) */
409
+ type GenWorkflowHandlerOpts = {
410
+ enableLazyState?: boolean;
411
+ };
412
+ /** @internal */
413
+ type AnyGenFn = (input: any) => Operation<any>;
414
+ /** A handler entry: either a bare generator fn or the result of typed() */
415
+ type HandlerOrHandlerDescriptor = AnyGenFn | HandlerDef<any, any>;
416
+ /** serdes(opts, fn) — explicit Serde per field */
417
+ declare function serdes<I$1, O$1>(opts: {
418
+ input: restate.Serde<I$1>;
419
+ output: restate.Serde<O$1>;
420
+ }, fn: (input: I$1) => Operation<O$1>): HandlerDef<I$1, O$1>;
421
+ /** schemas(opts, fn) — Standard Schema (Zod, TypeBox, Valibot, …) per field */
422
+ declare function schemas<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
423
+ input: SI;
424
+ output: SO;
425
+ }, fn: (input: StandardSchemaV1.InferOutput<SI>) => Operation<StandardSchemaV1.InferOutput<SO>>): HandlerDef<StandardSchemaV1.InferOutput<SI>, StandardSchemaV1.InferOutput<SO>>;
426
+ declare function service<P$1 extends string, H extends Record<string, HandlerOrHandlerDescriptor>>(config: {
427
+ name: P$1;
428
+ description?: string;
429
+ metadata?: Record<string, string>;
430
+ handlers: H;
431
+ options?: restate.ServiceOptions & {
432
+ handlers?: Partial<Record<keyof H, GenHandlerOpts>>;
433
+ };
434
+ }): ImplementedServiceDefinition<P$1, HandlerDescriptors<H>>;
435
+ declare function object<P$1 extends string, H extends Record<string, HandlerOrHandlerDescriptor>>(config: {
436
+ name: P$1;
437
+ description?: string;
438
+ metadata?: Record<string, string>;
439
+ handlers: H;
440
+ options?: restate.ObjectOptions & {
441
+ handlers?: Partial<Record<keyof H, GenObjectHandlerOpts>>;
442
+ };
443
+ }): ImplementedObjectDefinition<P$1, HandlerDescriptors<H>>;
444
+ declare function workflow<P$1 extends string, H extends Record<string, HandlerOrHandlerDescriptor>>(config: {
445
+ name: P$1;
446
+ description?: string;
447
+ metadata?: Record<string, string>;
448
+ handlers: H;
449
+ options?: restate.WorkflowOptions & {
450
+ handlers?: Partial<Record<keyof H, GenWorkflowHandlerOpts>>;
451
+ };
452
+ }): ImplementedWorkflowDefinition<P$1, HandlerDescriptors<H>>;
453
+ //#endregion
454
+ //#region src/clients.d.ts
455
+ /**
456
+ * A Future<O> that also carries an `invocation` field — a Future<InvocationReference<O>>
457
+ * for accessing the invocationId, attach, cancel, and signal of the underlying call.
458
+ */
459
+ type ClientFuture<O$1> = Future<O$1> & {
460
+ invocation: Future<InvocationReference<O$1>>;
461
+ };
462
+ /** Client type returned by client() — each method returns ClientFuture<O> */
463
+ type GenClient<H extends Record<string, HandlerDescriptor>> = { readonly [K in keyof H]: H[K] extends HandlerDescriptor<infer I, infer O> ? [I] extends [void] ? (opts?: Opts<I, O>) => ClientFuture<O> : (input: I, opts?: Opts<I, O>) => ClientFuture<O> : never };
464
+ /** Client type returned by sendClient() — each method returns Future<InvocationReference<O>> */
465
+ type GenSendClient<H extends Record<string, HandlerDescriptor>> = { readonly [K in keyof H]: H[K] extends HandlerDescriptor<infer I, infer O> ? [I] extends [void] ? (opts?: SendOpts<I>) => Future<InvocationReference<O>> : (input: I, opts?: SendOpts<I>) => Future<InvocationReference<O>> : never };
466
+ //#endregion
467
+ //#region src/durable-promise.d.ts
468
+ /** Same shape as the SDK's DurablePromise<T> but each method returns Future<...>. */
469
+ type GenDurablePromise<T> = {
67
470
  peek(): Future<T | undefined>;
68
471
  resolve(value?: T): Future<void>;
69
472
  reject(errorMsg: string): Future<void>;
@@ -109,6 +512,40 @@ interface State<TState extends TypedState = UntypedState> extends SharedState<TS
109
512
  }
110
513
  //#endregion
111
514
  //#region src/restate-operations.d.ts
515
+ type HandlerRequest = {
516
+ readonly target: Target$1;
517
+ /**
518
+ * The unique id that identifies the current function invocation. This id is guaranteed to be
519
+ * unique across invocations, but constant across reties and suspensions.
520
+ */
521
+ readonly id: InvocationId;
522
+ readonly key?: string;
523
+ /**
524
+ * Request headers - the following headers capture the original invocation headers, as provided to
525
+ * the ingress.
526
+ */
527
+ readonly headers: ReadonlyMap<string, string>;
528
+ /**
529
+ * Attempt headers - the following headers are sent by the restate runtime.
530
+ * These headers are attempt specific, generated by the restate runtime uniquely for each attempt.
531
+ * These headers might contain information such as the W3C trace context, and attempt specific information.
532
+ */
533
+ readonly attemptHeaders: ReadonlyMap<string, string | string[] | undefined>;
534
+ /**
535
+ * Raw unparsed request body
536
+ */
537
+ readonly body: Uint8Array;
538
+ /**
539
+ * Extra arguments provided to the request handler:
540
+ * Lambda: [Context]
541
+ * Cloudflare workers: [Env, ExecutionContext]
542
+ * Deno: [ConnInfo]
543
+ * Bun: [Server]
544
+ * These arguments can contain request-specific values that could change after a suspension.
545
+ * Care should be taken to use them deterministically.
546
+ */
547
+ readonly extraArgs: unknown[];
548
+ };
112
549
  /**
113
550
  * Retry policy for `run`. Mirrors the SDK's `RunOptions` retry knobs
114
551
  * but namespaced (no `Retry` prefix on each field) and grouped under
@@ -187,27 +624,25 @@ type RunAction<T> = (opts: RunActionOpts) => Promise<T>;
187
624
  */
188
625
  declare function wrapActionForCancellation<T>(signal: AbortSignal, action: RunAction<T>): () => Promise<T>;
189
626
  /**
190
- * Run a generator-based workflow against a Restate context.
191
- *
192
- * `op` is an `Operation<T>` typically the result of
193
- * `gen(function*() { ... })`. Inside the generator body, reach for the
194
- * free-standing API (`run`, `sleep`, `all`, `state`, …) imported
195
- * from `@restatedev/restate-sdk-gen`. They read the active scheduler from a
196
- * synchronous current-fiber slot installed by `Fiber.advance`.
197
- *
198
- * `gen()` already takes a factory, so the same `Operation` is re-
199
- * iterable across multiple `execute()` calls — no need for a builder
200
- * lambda at this boundary.
201
- *
202
- * @example
203
- * execute(ctx, gen(function* () {
204
- * const greeting = yield* run(async () => "hi", { name: "compose" });
205
- * return greeting;
206
- * }));
627
+ * Deterministic date methods that return journal-backed Futures.
628
+ * Wraps the SDK's `ContextDate` (which returns Promises via internal
629
+ * `ctx.run()` calls) so that gen-SDK user code can `yield*` them.
207
630
  */
208
- declare function execute<T>(context: restate.Context, op: Operation<T>): Promise<T>;
631
+ interface GenContextDate {
632
+ now(): Future<number>;
633
+ toJSON(): Future<string>;
634
+ }
209
635
  //#endregion
210
636
  //#region src/free.d.ts
637
+ declare const rand: () => restate.Rand;
638
+ declare const date: () => GenContextDate;
639
+ declare const logger: () => Console;
640
+ /**
641
+ * Returns the current invocation's request metadata plus the optional
642
+ * virtual-object / workflow key. The `key` field is only present when
643
+ * the handler belongs to an object or workflow.
644
+ */
645
+ declare const handlerRequest: () => HandlerRequest;
211
646
  /**
212
647
  * Run a side-effecting closure as a journal entry. See
213
648
  * `RestateOperations.run` for full semantics.
@@ -226,19 +661,24 @@ declare const resolveAwakeable: <T>(id: string, payload?: T, serde?: restate.Ser
226
661
  declare const rejectAwakeable: (id: string, reason: string | restate.TerminalError) => void;
227
662
  declare const signal: <T>(name: string, serde?: restate.Serde<T>) => Future<T>;
228
663
  declare const attach: <T>(invocationId: restate.InvocationId, serde?: restate.Serde<T>) => Future<T>;
229
- declare const serviceClient: <D>(api: restate.ServiceDefinitionFrom<D>) => FluentClient<restate.Client<restate.Service<D>>>;
230
- declare const objectClient: <D>(api: restate.VirtualObjectDefinitionFrom<D>, key: string) => FluentClient<restate.Client<restate.VirtualObject<D>>>;
231
- declare const workflowClient: <D>(api: restate.WorkflowDefinitionFrom<D>, key: string) => FluentClient<restate.Client<restate.Workflow<D>>>;
232
- declare const serviceSendClient: <D>(api: restate.ServiceDefinitionFrom<D>) => restate.SendClient<restate.Service<D>>;
233
- declare const objectSendClient: <D>(api: restate.VirtualObjectDefinitionFrom<D>, key: string) => restate.SendClient<restate.VirtualObject<D>>;
234
- declare const workflowSendClient: <D>(api: restate.WorkflowDefinitionFrom<D>, key: string) => restate.SendClient<restate.Workflow<D>>;
235
- declare const genericCall: <REQ = Uint8Array, RES = Uint8Array>(call: restate.GenericCall<REQ, RES>) => Future<RES>;
236
- declare const genericSend: <REQ = Uint8Array>(call: restate.GenericSend<REQ>) => restate.InvocationHandle;
664
+ declare function client<H extends Record<string, HandlerDescriptor>>(def: Descriptor<string, H, "service">): GenClient<H>;
665
+ declare function client<H extends Record<string, HandlerDescriptor>>(def: Descriptor<string, H, "object" | "workflow">, key: string): GenClient<H>;
666
+ declare function sendClient<H extends Record<string, HandlerDescriptor>>(def: Descriptor<string, H, "service">): GenSendClient<H>;
667
+ declare function sendClient<H extends Record<string, HandlerDescriptor>>(def: Descriptor<string, H, "object" | "workflow">, key: string): GenSendClient<H>;
668
+ declare const call: <REQ = Uint8Array, RES = Uint8Array>(c: restate.GenericCall<REQ, RES>) => ClientFuture<RES>;
669
+ declare const send: <REQ = Uint8Array, RES = unknown>(c: restate.GenericSend<REQ>, outputSerde?: restate.Serde<RES>) => Future<InvocationReference<RES>>;
670
+ /**
671
+ * Create an InvocationReference from a known invocation ID (e.g. retrieved from state).
672
+ * `attach()` and `cancel()` on the result use the current fiber slot like all free functions.
673
+ */
674
+ declare function invocation<O$1 = unknown>(id: string, opts?: {
675
+ outputSerde?: restate.Serde<O$1>;
676
+ }): InvocationReference<O$1>;
237
677
  declare const cancel: (invocationId: restate.InvocationId) => void;
238
678
  declare const channel: <T>() => Channel<T>;
239
679
  declare const state: <TState extends TypedState = UntypedState>() => State<TState>;
240
680
  declare const sharedState: <TState extends TypedState = UntypedState>() => SharedState<TState>;
241
- declare const workflowPromise: <T>(name: string, serde?: restate.Serde<T>) => FluentDurablePromise<T>;
681
+ declare const workflowPromise: <T>(name: string, serde?: restate.Serde<T>) => GenDurablePromise<T>;
242
682
  /**
243
683
  * Wait for every future to settle; return their values in input order.
244
684
  * Heterogeneous-tuple typing — `all([fA, fB])` where `fA: Future<A>`
@@ -264,6 +704,319 @@ declare const any: <const T extends readonly Future<unknown>[] | []>(futures: T)
264
704
  * Mirrors `Promise.allSettled`.
265
705
  */
266
706
  declare const allSettled: <const T extends readonly Future<unknown>[] | []>(futures: T) => Future<{ -readonly [P in keyof T]: FutureSettledResult<T[P] extends Future<infer U> ? U : never> }>;
707
+ /**
708
+ * Register `op` as a fresh routine and return a `Future<T>` for its
709
+ * eventual outcome. Eager — the child is already in flight by the time
710
+ * `spawn` returns. See `RestateOperations.spawn` for full semantics.
711
+ */
712
+ declare const spawn: <T>(op: Operation<T>) => Future<T>;
713
+ declare namespace interface_d_exports {
714
+ export { ImplementHandlers, InferInput, InferOutput, implement, json, object$1 as object, schemas$1 as schemas, serdes$1 as serdes, service$1 as service, workflow$1 as workflow };
715
+ }
716
+ /** json<I, O>() — type params, default JSON serde */
717
+ declare function json<I$1 = void, O$1 = void>(): HandlerDescriptor<I$1, O$1>;
718
+ /** serdes(opts) — explicit Serde per field */
719
+ declare function serdes$1<SI extends restate.Serde<any>, SO extends restate.Serde<any>>(opts: {
720
+ input?: SI;
721
+ output?: SO;
722
+ }): HandlerDescriptor<SI extends restate.Serde<infer I> ? I : never, SO extends restate.Serde<infer O> ? O : never>;
723
+ /** schemas(opts) — Standard Schema (Zod, TypeBox, Valibot, …) per field */
724
+ declare function schemas$1<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
725
+ input?: SI;
726
+ output?: SO;
727
+ }): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>>;
728
+ declare function service$1<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): ServiceDescriptor<P$1, H>;
729
+ declare function object$1<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): ObjectDescriptor<P$1, H>;
730
+ declare function workflow$1<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): WorkflowDescriptor<P$1, H>;
731
+ /** @internal */
732
+ type InferInput<D> = D extends HandlerDescriptor<infer I, any> ? I : any;
733
+ /** @internal */
734
+ type InferOutput<D> = D extends HandlerDescriptor<any, infer O> ? O : any;
735
+ /** @internal */
736
+ type ImplementHandlers<H extends Record<string, HandlerDescriptor>> = { [K in keyof H]: (input: InferInput<H[K]>) => Operation<InferOutput<H[K]>> };
737
+ declare function implement<P$1 extends string, H extends Record<string, HandlerDescriptor>>(iface: ServiceDescriptor<P$1, H>, config: {
738
+ handlers: ImplementHandlers<H>;
739
+ options?: restate.ServiceOptions & {
740
+ handlers?: Partial<Record<keyof H, GenHandlerOpts>>;
741
+ };
742
+ }): ImplementedServiceDefinition<P$1, H>;
743
+ declare function implement<P$1 extends string, H extends Record<string, HandlerDescriptor>>(iface: ObjectDescriptor<P$1, H>, config: {
744
+ handlers: ImplementHandlers<H>;
745
+ options?: restate.ObjectOptions & {
746
+ handlers?: Partial<Record<keyof H, GenObjectHandlerOpts>>;
747
+ };
748
+ }): ImplementedObjectDefinition<P$1, H>;
749
+ declare function implement<P$1 extends string, H extends Record<string, HandlerDescriptor>>(iface: WorkflowDescriptor<P$1, H>, config: {
750
+ handlers: ImplementHandlers<H>;
751
+ options?: restate.WorkflowOptions & {
752
+ handlers?: Partial<Record<keyof H, GenWorkflowHandlerOpts>>;
753
+ };
754
+ }): ImplementedWorkflowDefinition<P$1, H>;
755
+ //#endregion
756
+ //#region ../restate-sdk-clients/src/api.d.ts
757
+ /**
758
+ * A remote client for a Restate service.
759
+ *
760
+ * Use the following client to interact with services defined
761
+ * - `serviceClient` to create a client for a service.
762
+ * - `workflowClient` to create a client for a workflow.
763
+ * - `objectClient` to create a client for a virtual object.
764
+ *
765
+ */
766
+ interface Ingress {
767
+ /**
768
+ * Create a client from a {@link ServiceDefinition}.
769
+ */
770
+ serviceClient<D>(opts: ServiceDefinitionFrom<D>): IngressClient<Service<D>>;
771
+ /**
772
+ * Create a client from a {@link WorkflowDefinition}.
773
+ *
774
+ * @param key the key of the workflow.
775
+ */
776
+ workflowClient<D>(opts: WorkflowDefinitionFrom<D>, key: string): IngressWorkflowClient<Workflow<D>>;
777
+ /**
778
+ * Create a client from a {@link VirtualObjectDefinition}.
779
+ * @param key the key of the virtual object.
780
+ */
781
+ objectClient<D>(opts: VirtualObjectDefinitionFrom<D>, key: string): IngressClient<VirtualObject<D>>;
782
+ /**
783
+ * Create a client from a {@link ServiceDefinition}.
784
+ */
785
+ serviceSendClient<D>(opts: ServiceDefinitionFrom<D>): IngressSendClient<Service<D>>;
786
+ /**
787
+ * Create a client from a {@link VirtualObjectDefinition}.
788
+ */
789
+ objectSendClient<D>(opts: VirtualObjectDefinitionFrom<D>, key: string): IngressSendClient<VirtualObject<D>>;
790
+ /**
791
+ * Resolve an awakeable from the ingress client.
792
+ */
793
+ resolveAwakeable<T>(id: string, payload?: T, payloadSerde?: Serde<T>): Promise<void>;
794
+ /**
795
+ * Reject an awakeable from the ingress client.
796
+ */
797
+ rejectAwakeable(id: string, reason: string): Promise<void>;
798
+ /**
799
+ * Obtain the result of a service that was asynchronously submitted (via a sendClient).
800
+ *
801
+ * @param send either the send response or the workflow submission as obtained by the respective clients.
802
+ */
803
+ result<T>(send: Send<T> | WorkflowSubmission<T>, resultSerde?: Serde<T>): Promise<T>;
804
+ /** Generic request-response call. Routes directly by service name without a typed definition. */
805
+ call<I$1 = Uint8Array, O$1 = Uint8Array>(opts: {
806
+ service: string;
807
+ handler: string;
808
+ parameter: I$1;
809
+ key?: string;
810
+ opts?: Opts$1<I$1, O$1>;
811
+ }): Promise<O$1>;
812
+ /** Generic fire-and-forget send. Routes directly by service name without a typed definition. */
813
+ send<I$1 = Uint8Array>(opts: {
814
+ service: string;
815
+ handler: string;
816
+ parameter: I$1;
817
+ key?: string;
818
+ opts?: SendOpts$1<I$1>;
819
+ }): Promise<Send>;
820
+ }
821
+ interface IngressCallOptions<I$1 = unknown, O$1 = unknown> {
822
+ /**
823
+ * Key to use for idempotency key.
824
+ *
825
+ * See https://docs.restate.dev/operate/invocation#invoke-a-handler-idempotently for more details.
826
+ */
827
+ idempotencyKey?: string;
828
+ /**
829
+ * Headers to attach to the request.
830
+ */
831
+ headers?: Record<string, string>;
832
+ input?: Serde<I$1>;
833
+ output?: Serde<O$1>;
834
+ /**
835
+ * Timeout to be used when executing the request. In milliseconds.
836
+ *
837
+ * Same as {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal#aborting_a_fetch_with_timeout_or_explicit_abort | AbortSignal.timeout()}.
838
+ *
839
+ * This field is exclusive with `signal`, and using both of them will result in a runtime failure.
840
+ */
841
+ timeout?: number;
842
+ /**
843
+ * Signal to abort the underlying `fetch` operation. See {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}.
844
+ *
845
+ * This field is exclusive with `timeout`, and using both of them will result in a runtime failure.
846
+ */
847
+ signal?: AbortSignal;
848
+ }
849
+ interface IngressSendOptions<I$1> extends IngressCallOptions<I$1, void> {
850
+ /**
851
+ * If set, the invocation will be enqueued now to be executed after the provided delay. In milliseconds.
852
+ */
853
+ delay?: number | Duration;
854
+ }
855
+ declare class Opts$1<I$1, O$1> {
856
+ readonly opts: IngressCallOptions<I$1, O$1>;
857
+ /**
858
+ * Create a call configuration from the provided options.
859
+ *
860
+ * @param opts the call configuration
861
+ */
862
+ static from<I$1 = unknown, O$1 = unknown>(opts: IngressCallOptions<I$1, O$1>): Opts$1<I$1, O$1>;
863
+ constructor(opts: IngressCallOptions<I$1, O$1>);
864
+ }
865
+ declare class SendOpts$1<I$1 = unknown> {
866
+ readonly opts: IngressSendOptions<I$1>;
867
+ /**
868
+ * @param opts Create send options
869
+ */
870
+ static from<I$1 = unknown>(opts: IngressSendOptions<I$1>): SendOpts$1<I$1>;
871
+ delay(): number | undefined;
872
+ constructor(opts: IngressSendOptions<I$1>);
873
+ }
874
+ type InferArgType<P$1> = P$1 extends [infer A, ...any[]] ? A : unknown;
875
+ type IngressClient<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?: Opts$1<InferArgType<P>, O>]]) => PromiseLike<O> : never };
876
+ /**
877
+ * Represents the output of a workflow.
878
+ */
879
+ interface Output<O$1> {
880
+ /**
881
+ * Whether the output is ready.
882
+ */
883
+ ready: boolean;
884
+ /**
885
+ * The output of the workflow.
886
+ */
887
+ result: O$1;
888
+ }
889
+ /**
890
+ * Represents a successful workflow submission.
891
+ *
892
+ */
893
+ type WorkflowSubmission<T> = {
894
+ /**
895
+ * The invocation id of the workflow. You can use that id to
896
+ * with the introspection tools (restate cli, logging, metrics)
897
+ *
898
+ */
899
+ readonly invocationId: string;
900
+ readonly status: "Accepted" | "PreviouslyAccepted";
901
+ readonly attachable: true;
902
+ };
903
+ /**
904
+ * A client for a workflow.
905
+ *
906
+ * This client represents the workflow definition, with the following additional methods:
907
+ * - `workflowSubmit` to submit the workflow.
908
+ * - `workflowAttach` to attach to the workflow and wait for its completion
909
+ * - `workflowOutput` to check if the workflow's output is ready/available.
910
+ *
911
+ * Once a workflow is submitted, it can be attached to, and the output can be retrieved.
912
+ *
913
+ * @typeParam M the type of the workflow.
914
+ */
915
+ type IngressWorkflowClient<M> = Omit<{ [K in keyof M as M[K] extends never ? never : K]: M[K] extends ((arg: any, ...args: infer P) => PromiseLike<infer O>) ? (...args: [...P, ...[opts?: Opts$1<InferArgType<P>, O>]]) => PromiseLike<O> : never } & {
916
+ /**
917
+ * Submit this workflow.
918
+ *
919
+ * This instructs restate to execute the 'run' handler of the workflow, idempotently.
920
+ * The workflow will be executed asynchronously, and the promise will resolve when the workflow has been accepted.
921
+ * Please note that submitting a workflow does not wait for it to completion, and it is safe to retry the submission,
922
+ * in case of failure.
923
+ *
924
+ * @param argument the same argument type as defined by the 'run' handler.
925
+ */
926
+ workflowSubmit: M extends Record<string, unknown> ? M["run"] extends ((arg: any, ...args: infer I) => Promise<infer O>) ? (...args: [...I, ...[opts?: SendOpts$1<InferArgType<I>>]]) => Promise<WorkflowSubmission<O>> : never : never;
927
+ /**
928
+ * Attach to this workflow.
929
+ *
930
+ * This instructs restate to attach to the workflow and wait for it to complete.
931
+ * It is only possible to 'attach' to a workflow that has been previously submitted.
932
+ * The promise will resolve when the workflow has completed either successfully with a result,
933
+ * or be rejected with an error.
934
+ * This operation is safe to retry many times, and it will always return the same result.
935
+ *
936
+ * @returns a promise that resolves when the workflow has completed.
937
+ */
938
+ workflowAttach: M extends Record<string, unknown> ? M["run"] extends ((...args: any) => Promise<infer O>) ? (opts?: Opts$1<void, O>) => Promise<O> : never : never;
939
+ /**
940
+ * Try retrieving the output of this workflow.
941
+ *
942
+ * This instructs restate to check if the workflow's output is ready/available.
943
+ * The returned Output object will have a 'ready' field set to true if the output is ready.
944
+ * If the output is ready, the 'result' field will contain the output.
945
+ * note: that this operation will not wait for the workflow to complete, to do so use 'workflowAttach'.
946
+ *
947
+ * @returns a promise that resolves if the workflow's output is ready/available.
948
+ */
949
+ workflowOutput: M extends Record<string, unknown> ? M["run"] extends ((...args: any) => Promise<infer O>) ? (opts?: Opts$1<void, O>) => Promise<Output<O>> : never : never;
950
+ }, "run">;
951
+ /**
952
+ * A send response.
953
+ *
954
+ * @typeParam T the type of the response.
955
+ */
956
+ type Send<T = unknown> = {
957
+ /**
958
+ * The invocation id of the send.
959
+ */
960
+ invocationId: string;
961
+ /**
962
+ * The status of the send.
963
+ */
964
+ status: "Accepted" | "PreviouslyAccepted";
965
+ attachable: boolean;
966
+ };
967
+ 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$1<InferArgType<P>>]]) => Promise<Send<O>> : never };
968
+ type ConnectionOpts = {
969
+ /**
970
+ * Restate ingress URL.
971
+ * For example: http://localhost:8080
972
+ */
973
+ url: string;
974
+ /**
975
+ * Headers to attach on every request.
976
+ * Use this to attach authentication headers.
977
+ */
978
+ headers?: Record<string, string>;
979
+ /**
980
+ * Default serde to use for ingress payloads when no operation-specific serde
981
+ * is provided. Applies to handler calls, workflow attaches/output polling,
982
+ * awakeable resolution, and attached invocation results.
983
+ *
984
+ * Defaults to `restate.serde.json`.
985
+ */
986
+ serde?: Serde<any>;
987
+ /**
988
+ * Codec to use for input/outputs. Check {@link JournalValueCodec} for more details
989
+ *
990
+ * @experimental
991
+ */
992
+ journalValueCodec?: JournalValueCodec;
993
+ };
994
+ declare namespace ingress_d_exports {
995
+ export { ConnectionOpts, GenIngress, Ingress, IngressClient, IngressHandlerClient, IngressSendClient, IngressSendHandlerClient, IngressWorkflowClient, Opts$1 as Opts, Send, SendOpts$1 as SendOpts, client$1 as client, connect, sendClient$1 as sendClient };
996
+ }
997
+ /**
998
+ * Connect to the Restate Ingress.
999
+ *
1000
+ * @param opts connection options
1001
+ * @returns a connection the the restate ingress
1002
+ */
1003
+ declare function connect(opts: ConnectionOpts): GenIngress;
1004
+ /**
1005
+ * Minimal ingress interface required by the sdk-gen ingress helpers.
1006
+ * Structurally compatible with `Ingress` from `@restatedev/restate-sdk-clients`
1007
+ * — any object returned by `connect()` satisfies this.
1008
+ */
1009
+ type GenIngress = Omit<Ingress, "serviceClient" | "serviceSendClient" | "objectClient" | "objectSendClient" | "workflowClient">;
1010
+ type InferInput$1<D> = D extends HandlerDescriptor<infer I, any> ? I : unknown;
1011
+ type InferOutput$1<D> = D extends HandlerDescriptor<any, infer O> ? O : unknown;
1012
+ /** Typed ingress call client — each method returns Promise<O> */
1013
+ type IngressHandlerClient<H extends Record<string, HandlerDescriptor>> = { readonly [K in keyof H]: (input: InferInput$1<H[K]>, opts?: Opts$1<InferInput$1<H[K]>, InferOutput$1<H[K]>>) => Promise<InferOutput$1<H[K]>> };
1014
+ /** Typed ingress send client — each method returns Promise<Send> */
1015
+ type IngressSendHandlerClient<H extends Record<string, HandlerDescriptor>> = { readonly [K in keyof H]: [InferInput$1<H[K]>] extends [void] ? (opts?: SendOpts$1<void>) => Promise<Send> : (input: InferInput$1<H[K]>, opts?: SendOpts$1<InferInput$1<H[K]>>) => Promise<Send> };
1016
+ declare function client$1<H extends Record<string, HandlerDescriptor>>(ingress: GenIngress, def: Descriptor<string, H, "service">): IngressHandlerClient<H>;
1017
+ declare function client$1<H extends Record<string, HandlerDescriptor>>(ingress: GenIngress, def: Descriptor<string, H, "object" | "workflow">, key: string): IngressHandlerClient<H>;
1018
+ declare function sendClient$1<H extends Record<string, HandlerDescriptor>>(ingress: GenIngress, def: Descriptor<string, H, "service">): IngressSendHandlerClient<H>;
1019
+ declare function sendClient$1<H extends Record<string, HandlerDescriptor>>(ingress: GenIngress, def: Descriptor<string, H, "object" | "workflow">, key: string): IngressSendHandlerClient<H>;
267
1020
  //#endregion
268
- export { type Channel, type FluentClient, type FluentDurablePromise, type Future, type FutureFulfilledResult, type FutureRejectedResult, type FutureSettledResult, type FutureValue, type FutureValues, type Operation, type RetryOptions, type RunAction, type RunActionOpts, type RunOpts, type SelectResult, type SharedState, type State, type TypedState, type UntypedState, all, allSettled, any, attach, awakeable, cancel, channel, execute, gen, genericCall, genericSend, objectClient, objectSendClient, race, rejectAwakeable, resolveAwakeable, run, select, serviceClient, serviceSendClient, sharedState, signal, sleep, spawn, state, workflowClient, workflowPromise, workflowSendClient, wrapActionForCancellation };
1021
+ export { type AnyGenFn, type Channel, type ClientFuture, type ContextDate, type Descriptor, type Duration, type EntryToDescriptor, type Future, type FutureFulfilledResult, type FutureRejectedResult, type FutureSettledResult, type FutureValue, type FutureValues, type GenClient, type GenContextDate, type GenDurablePromise, type GenHandlerOpts, type GenObjectHandlerOpts, type GenSendClient, type GenWorkflowHandlerOpts, type HandlerDef, type HandlerDescriptor, type HandlerDescriptors, type HandlerOrHandlerDescriptor, type HandlerRequest, type ImplementHandlers, type ImplementedDefinition, type ImplementedObjectDefinition, type ImplementedServiceDefinition, type ImplementedWorkflowDefinition, type InferInput, type InferOutput, type InvocationReference, type ObjectDescriptor, type Operation, type Rand, type RetryOptions, type RunAction, type RunActionOpts, type RunOpts, type SelectResult, type Serde, type Service, type ServiceDefinition, type ServiceDefinitionFrom, type ServiceDescriptor, type SharedState, type SignalReference, type StandardSchemaV1, type StandardTypedV1, type State, type TypedState, type UntypedState, type VirtualObject, type VirtualObjectDefinition, type VirtualObjectDefinitionFrom, type Workflow, type WorkflowDefinition, type WorkflowDefinitionFrom, type WorkflowDescriptor, all, allSettled, any, attach, awakeable, call, cancel, channel, client, ingress_d_exports as clients, date, gen, handlerRequest, interface_d_exports as iface, implement, invocation, logger, object, race, rand, rejectAwakeable, resolveAwakeable, run, schemas, select, send, sendClient, serde, serdes, service, sharedState, signal, sleep, spawn, state, workflow, workflowPromise, wrapActionForCancellation };
269
1022
  //# sourceMappingURL=index.d.cts.map