@restatedev/restate-sdk-gen 1.16.9 → 1.17.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/index.cjs +62 -182
- package/dist/index.d.cts +258 -175
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +258 -175
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -176
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -2,76 +2,7 @@ import * as restate from "@restatedev/restate-sdk";
|
|
|
2
2
|
import { ContextDate, Opts, Rand, SendOpts, ServiceHandlerOpts } from "@restatedev/restate-sdk";
|
|
3
3
|
|
|
4
4
|
//#region rolldown:runtime
|
|
5
|
-
|
|
6
|
-
//#region src/operation.d.ts
|
|
7
|
-
interface Operation<T> {
|
|
8
|
-
[Symbol.iterator](): Iterator<unknown, T, unknown>;
|
|
9
|
-
}
|
|
10
|
-
declare function gen<T>(body: () => Generator<unknown, T, unknown>): Operation<T>;
|
|
11
|
-
type SelectResult<B extends Record<string, Future<unknown>>> = { [K in keyof B]: {
|
|
12
|
-
tag: K;
|
|
13
|
-
future: B[K];
|
|
14
|
-
} }[keyof B];
|
|
15
|
-
declare function select<B extends Record<string, Future<unknown>>>(branches: B): Generator<unknown, SelectResult<B>, unknown>;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/future.d.ts
|
|
18
|
-
declare const futureBrand: unique symbol;
|
|
19
|
-
interface Future<T> extends Operation<T> {
|
|
20
|
-
readonly [futureBrand]: unknown;
|
|
21
|
-
}
|
|
22
|
-
/** Extract the value type from a `Future<U>`; `never` for non-Futures. */
|
|
23
|
-
type FutureValue<F> = F extends Future<infer U> ? U : never;
|
|
24
|
-
/**
|
|
25
|
-
* Map a tuple of Futures to the tuple of their value types.
|
|
26
|
-
* For `[Future<A>, Future<B>]` produces `[A, B]`.
|
|
27
|
-
* For an unbounded `Future<X>[]` produces `X[]`.
|
|
28
|
-
*/
|
|
29
|
-
type FutureValues<T extends readonly Future<unknown>[] | []> = { -readonly [P in keyof T]: T[P] extends Future<infer U> ? U : never };
|
|
30
|
-
interface FutureFulfilledResult<T> {
|
|
31
|
-
readonly status: "fulfilled";
|
|
32
|
-
readonly value: T;
|
|
33
|
-
}
|
|
34
|
-
interface FutureRejectedResult {
|
|
35
|
-
readonly status: "rejected";
|
|
36
|
-
readonly reason: unknown;
|
|
37
|
-
}
|
|
38
|
-
type FutureSettledResult<T> = FutureFulfilledResult<T> | FutureRejectedResult;
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/channel.d.ts
|
|
41
|
-
interface Channel<T> {
|
|
42
|
-
/**
|
|
43
|
-
* Yieldable. Use as `yield* ch.send(value)` from within a gen body.
|
|
44
|
-
* The first call settles the channel; subsequent calls are silently
|
|
45
|
-
* dropped (idempotent).
|
|
46
|
-
*
|
|
47
|
-
* Return value is `Operation<void>` rather than `void` so the only
|
|
48
|
-
* way to fire send is via `yield*` inside a fiber — which enforces
|
|
49
|
-
* the channel-is-intra-workflow contract at the type level.
|
|
50
|
-
*/
|
|
51
|
-
send(value: T): Operation<void>;
|
|
52
|
-
readonly receive: Future<T>;
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
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
|
-
}
|
|
5
|
+
|
|
75
6
|
//#endregion
|
|
76
7
|
//#region ../restate-sdk-core/src/core.d.ts
|
|
77
8
|
type ServiceDefinition<P$1 extends string, M> = {
|
|
@@ -188,7 +119,7 @@ declare namespace StandardSchemaV1 {
|
|
|
188
119
|
* It also advertises metadata (`contentType`, `jsonSchema`) that surfaces in
|
|
189
120
|
* service discovery.
|
|
190
121
|
*/
|
|
191
|
-
interface Serde<T> {
|
|
122
|
+
interface Serde<T$1> {
|
|
192
123
|
/**
|
|
193
124
|
* MIME type of the bytes produced by `serialize` (and accepted by
|
|
194
125
|
* `deserialize`).
|
|
@@ -252,12 +183,12 @@ interface Serde<T> {
|
|
|
252
183
|
* The returned string must round-trip through `fromJsonString` back to
|
|
253
184
|
* the same logical value.
|
|
254
185
|
*/
|
|
255
|
-
toJsonString(value: T): Promise<string> | string;
|
|
186
|
+
toJsonString(value: T$1): Promise<string> | string;
|
|
256
187
|
/**
|
|
257
188
|
* Parse a human-supplied JSON string back into a value of type `T`.
|
|
258
189
|
* Should throw (or reject) if `json` is invalid for this serde.
|
|
259
190
|
*/
|
|
260
|
-
fromJsonString(json: string): Promise<T> | T;
|
|
191
|
+
fromJsonString(json: string): Promise<T$1> | T$1;
|
|
261
192
|
};
|
|
262
193
|
/**
|
|
263
194
|
* Convert a value of type `T` into its on-the-wire bytes. This is the
|
|
@@ -266,22 +197,23 @@ interface Serde<T> {
|
|
|
266
197
|
* Must be the inverse of `deserialize` — `deserialize(serialize(v))`
|
|
267
198
|
* should produce a value equivalent to `v`.
|
|
268
199
|
*/
|
|
269
|
-
serialize(value: T): Uint8Array;
|
|
200
|
+
serialize(value: T$1): Uint8Array;
|
|
270
201
|
/**
|
|
271
202
|
* Convert on-the-wire bytes back into a value of type `T`. Must be the
|
|
272
203
|
* inverse of `serialize`.
|
|
273
204
|
*
|
|
274
205
|
* May throw if `data` doesn't conform to the expected wire format.
|
|
275
206
|
*/
|
|
276
|
-
deserialize(data: Uint8Array): T;
|
|
207
|
+
deserialize(data: Uint8Array): T$1;
|
|
277
208
|
}
|
|
278
209
|
declare namespace serde {
|
|
279
|
-
class JsonSerde<T> implements Serde<T
|
|
210
|
+
class JsonSerde<T$1> implements Serde<T$1> {
|
|
280
211
|
readonly jsonSchema?: object | undefined;
|
|
281
212
|
contentType: string;
|
|
282
213
|
constructor(jsonSchema?: object | undefined);
|
|
283
|
-
serialize(value: T): Uint8Array;
|
|
284
|
-
deserialize(data: Uint8Array): T
|
|
214
|
+
serialize(value: T$1): Uint8Array;
|
|
215
|
+
deserialize(data: Uint8Array): T$1;
|
|
216
|
+
/** @deprecated **/
|
|
285
217
|
schema<U$1>(schema: object): Serde<U$1>;
|
|
286
218
|
}
|
|
287
219
|
const json: JsonSerde<any>;
|
|
@@ -295,9 +227,9 @@ declare namespace serde {
|
|
|
295
227
|
* @param jsonSchemaOptions options passed to `StandardJsonSchemaV1.Options.libraryOptions` for code generation
|
|
296
228
|
* @returns a serde that will validate the data with the standard schema
|
|
297
229
|
*/
|
|
298
|
-
const schema: <T extends {
|
|
230
|
+
const schema: <T$1 extends {
|
|
299
231
|
"~standard": StandardSchemaV1.Props;
|
|
300
|
-
}>(schema: T, validateOptions?: Record<string, unknown>, jsonSchemaOptions?: Record<string, unknown>) => Serde<StandardSchemaV1.InferOutput<T>>;
|
|
232
|
+
}>(schema: T$1, validateOptions?: Record<string, unknown>, jsonSchemaOptions?: Record<string, unknown>) => Serde<StandardSchemaV1.InferOutput<T$1>>;
|
|
301
233
|
}
|
|
302
234
|
//#endregion
|
|
303
235
|
//#region ../restate-sdk-core/src/duration.d.ts
|
|
@@ -348,34 +280,137 @@ type JournalValueCodec = {
|
|
|
348
280
|
decode(buf: Uint8Array): Promise<Uint8Array>;
|
|
349
281
|
};
|
|
350
282
|
//#endregion
|
|
351
|
-
//#region src/
|
|
283
|
+
//#region ../restate-sdk-core/src/interface.d.ts
|
|
352
284
|
/**
|
|
353
|
-
* Minimal descriptor stored in Descriptor._handlers per handler.
|
|
285
|
+
* Minimal descriptor stored in {@link Descriptor}._handlers per handler.
|
|
354
286
|
*/
|
|
355
|
-
type HandlerDescriptor<I$1 = any, O$1 = any> = {
|
|
356
|
-
readonly _inputSerde?:
|
|
357
|
-
readonly _outputSerde?:
|
|
287
|
+
type HandlerDescriptor<I$1 = any, O$1 = any, Shared extends boolean = boolean> = {
|
|
288
|
+
readonly _inputSerde?: Serde<I$1>;
|
|
289
|
+
readonly _outputSerde?: Serde<O$1>;
|
|
290
|
+
/** @internal virtual-object handler shared/exclusive marker (phantom + runtime) */
|
|
291
|
+
readonly _shared?: Shared;
|
|
358
292
|
};
|
|
359
|
-
/**
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
293
|
+
/** Recover the input type declared by a {@link HandlerDescriptor}. */
|
|
294
|
+
type InferInput<D> = D extends HandlerDescriptor<infer I, any, any> ? I : any;
|
|
295
|
+
/** Recover the output type declared by a {@link HandlerDescriptor}. */
|
|
296
|
+
type InferOutput<D> = D extends HandlerDescriptor<any, infer O, any> ? O : any;
|
|
297
|
+
/** Recover the value type carried by a {@link Serde}. */
|
|
298
|
+
type SerdeType<S$1> = S$1 extends Serde<infer T> ? T : never;
|
|
365
299
|
type Descriptor<P$1 extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>, Kind extends "service" | "object" | "workflow" = "service" | "object" | "workflow"> = {
|
|
366
300
|
readonly name: P$1;
|
|
367
301
|
readonly _kind: Kind;
|
|
368
302
|
readonly _handlers: H;
|
|
369
303
|
};
|
|
370
|
-
/** Kind-specific aliases for the common Descriptor type */
|
|
371
304
|
type ServiceDescriptor<P$1 extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P$1, H, "service">;
|
|
372
305
|
type ObjectDescriptor<P$1 extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P$1, H, "object">;
|
|
373
306
|
type WorkflowDescriptor<P$1 extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P$1, H, "workflow">;
|
|
374
|
-
/** Implemented definition —
|
|
375
|
-
type ImplementedServiceDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>> =
|
|
376
|
-
type ImplementedObjectDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>> =
|
|
377
|
-
type ImplementedWorkflowDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>> =
|
|
307
|
+
/** Implemented definition — a Descriptor that is also bindable to an endpoint. */
|
|
308
|
+
type ImplementedServiceDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>> = ServiceDefinition<P$1, any> & ServiceDescriptor<P$1, H>;
|
|
309
|
+
type ImplementedObjectDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>> = VirtualObjectDefinition<P$1, any> & ObjectDescriptor<P$1, H>;
|
|
310
|
+
type ImplementedWorkflowDefinition<P$1 extends string, H extends Record<string, HandlerDescriptor>> = WorkflowDefinition<P$1, any> & WorkflowDescriptor<P$1, H>;
|
|
378
311
|
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>;
|
|
312
|
+
/** The shape of the {@link iface} service-interface declaration API. */
|
|
313
|
+
interface ServiceInterface {
|
|
314
|
+
service<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): ServiceDescriptor<P$1, H>;
|
|
315
|
+
object<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): ObjectDescriptor<P$1, H>;
|
|
316
|
+
workflow<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): WorkflowDescriptor<P$1, H>;
|
|
317
|
+
/** `json<I, O>()` — type params, default JSON serde. */
|
|
318
|
+
json<I$1 = void, O$1 = void>(): HandlerDescriptor<I$1, O$1, false>;
|
|
319
|
+
/** `serdes({ input, output })` — explicit Serde per direction. */
|
|
320
|
+
serdes<SI extends Serde<any>, SO extends Serde<any>>(opts: {
|
|
321
|
+
input?: SI;
|
|
322
|
+
output?: SO;
|
|
323
|
+
}): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, false>;
|
|
324
|
+
/** `schemas({ input, output })` — Standard Schema per direction. */
|
|
325
|
+
schemas<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
|
|
326
|
+
input?: SI;
|
|
327
|
+
output?: SO;
|
|
328
|
+
}): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, false>;
|
|
329
|
+
/** Shared (read-only) virtual-object / non-`run` workflow handler declarators. */
|
|
330
|
+
shared: {
|
|
331
|
+
json<I$1 = void, O$1 = void>(): HandlerDescriptor<I$1, O$1, true>;
|
|
332
|
+
serdes<SI extends Serde<any>, SO extends Serde<any>>(opts: {
|
|
333
|
+
input?: SI;
|
|
334
|
+
output?: SO;
|
|
335
|
+
}): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, true>;
|
|
336
|
+
schemas<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
|
|
337
|
+
input?: SI;
|
|
338
|
+
output?: SO;
|
|
339
|
+
}): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, true>;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/operation.d.ts
|
|
344
|
+
interface Operation<T$1> {
|
|
345
|
+
[Symbol.iterator](): Iterator<unknown, T$1, unknown>;
|
|
346
|
+
}
|
|
347
|
+
declare function gen<T$1>(body: () => Generator<unknown, T$1, unknown>): Operation<T$1>;
|
|
348
|
+
type SelectResult<B extends Record<string, Future<unknown>>> = { [K in keyof B]: {
|
|
349
|
+
tag: K;
|
|
350
|
+
future: B[K];
|
|
351
|
+
} }[keyof B];
|
|
352
|
+
declare function select<B extends Record<string, Future<unknown>>>(branches: B): Generator<unknown, SelectResult<B>, unknown>;
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/future.d.ts
|
|
355
|
+
declare const futureBrand: unique symbol;
|
|
356
|
+
interface Future<T$1> extends Operation<T$1> {
|
|
357
|
+
readonly [futureBrand]: unknown;
|
|
358
|
+
}
|
|
359
|
+
/** Extract the value type from a `Future<U>`; `never` for non-Futures. */
|
|
360
|
+
type FutureValue<F> = F extends Future<infer U> ? U : never;
|
|
361
|
+
/**
|
|
362
|
+
* Map a tuple of Futures to the tuple of their value types.
|
|
363
|
+
* For `[Future<A>, Future<B>]` produces `[A, B]`.
|
|
364
|
+
* For an unbounded `Future<X>[]` produces `X[]`.
|
|
365
|
+
*/
|
|
366
|
+
type FutureValues<T$1 extends readonly Future<unknown>[] | []> = { -readonly [P in keyof T$1]: T$1[P] extends Future<infer U> ? U : never };
|
|
367
|
+
interface FutureFulfilledResult<T$1> {
|
|
368
|
+
readonly status: "fulfilled";
|
|
369
|
+
readonly value: T$1;
|
|
370
|
+
}
|
|
371
|
+
interface FutureRejectedResult {
|
|
372
|
+
readonly status: "rejected";
|
|
373
|
+
readonly reason: unknown;
|
|
374
|
+
}
|
|
375
|
+
type FutureSettledResult<T$1> = FutureFulfilledResult<T$1> | FutureRejectedResult;
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/channel.d.ts
|
|
378
|
+
interface Channel<T$1> {
|
|
379
|
+
/**
|
|
380
|
+
* Yieldable. Use as `yield* ch.send(value)` from within a gen body.
|
|
381
|
+
* The first call settles the channel; subsequent calls are silently
|
|
382
|
+
* dropped (idempotent).
|
|
383
|
+
*
|
|
384
|
+
* Return value is `Operation<void>` rather than `void` so the only
|
|
385
|
+
* way to fire send is via `yield*` inside a fiber — which enforces
|
|
386
|
+
* the channel-is-intra-workflow contract at the type level.
|
|
387
|
+
*/
|
|
388
|
+
send(value: T$1): Operation<void>;
|
|
389
|
+
readonly receive: Future<T$1>;
|
|
390
|
+
}
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/invocation-reference.d.ts
|
|
393
|
+
/** Synchronous handle for resolving or rejecting a signal on a target invocation */
|
|
394
|
+
interface SignalReference<T$1> {
|
|
395
|
+
resolve(payload?: T$1): void;
|
|
396
|
+
reject(reason: string | restate.TerminalError): void;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* A typed reference to a running invocation. Returned by `sendClient()` methods
|
|
400
|
+
* (wrapped in `Future<InvocationReference<O>>`), or created via `invocation(id)`.
|
|
401
|
+
*
|
|
402
|
+
* - `attach()` returns a `Future<O>` with the serde from the original descriptor.
|
|
403
|
+
* - `signal()` sends a named signal to the target invocation.
|
|
404
|
+
* - `cancel()` cancels the target invocation.
|
|
405
|
+
*/
|
|
406
|
+
interface InvocationReference<O$1 = unknown> {
|
|
407
|
+
readonly id: string;
|
|
408
|
+
attach(serde?: restate.Serde<O$1>): Future<O$1>;
|
|
409
|
+
signal<T$1 = unknown>(name: string, serde?: restate.Serde<T$1>): SignalReference<T$1>;
|
|
410
|
+
cancel(): void;
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/define.d.ts
|
|
379
414
|
/** @internal
|
|
380
415
|
* @internal - Wraps a generator function with optional serde. Produced by typed().
|
|
381
416
|
* Discriminated by _genFn for runtime detection (distinct from bare gen fns,
|
|
@@ -472,18 +507,18 @@ type GenSendClient<H extends Record<string, HandlerDescriptor>> = { readonly [K
|
|
|
472
507
|
//#endregion
|
|
473
508
|
//#region src/durable-promise.d.ts
|
|
474
509
|
/** Same shape as the SDK's DurablePromise<T> but each method returns Future<...>. */
|
|
475
|
-
type GenDurablePromise<T> = {
|
|
476
|
-
peek(): Future<T | undefined>;
|
|
477
|
-
resolve(value?: T): Future<void>;
|
|
510
|
+
type GenDurablePromise<T$1> = {
|
|
511
|
+
peek(): Future<T$1 | undefined>;
|
|
512
|
+
resolve(value?: T$1): Future<void>;
|
|
478
513
|
reject(errorMsg: string): Future<void>;
|
|
479
|
-
get(): Future<T>;
|
|
514
|
+
get(): Future<T$1>;
|
|
480
515
|
};
|
|
481
516
|
//#endregion
|
|
482
517
|
//#region src/task.d.ts
|
|
483
518
|
/**
|
|
484
519
|
* A handle to a spawned routine: its `Future<T>` plus `interrupt`.
|
|
485
520
|
*/
|
|
486
|
-
interface Task<T> extends Future<T> {
|
|
521
|
+
interface Task<T$1> extends Future<T$1> {
|
|
487
522
|
/**
|
|
488
523
|
* Throw `err` into the spawned routine at its next yield point, and
|
|
489
524
|
* abort its in-flight `run` I/O. `err` is delivered verbatim — the
|
|
@@ -621,13 +656,13 @@ type RetryOptions = {
|
|
|
621
656
|
* for arrow functions assigned to a `const` since JS infers names from
|
|
622
657
|
* the binding site). If neither resolves, `run` throws.
|
|
623
658
|
*/
|
|
624
|
-
type RunOpts<T> = {
|
|
659
|
+
type RunOpts<T$1> = {
|
|
625
660
|
/** Journal entry name. Falls back to `action.name` if absent. */
|
|
626
661
|
name?: string;
|
|
627
662
|
/** Retry policy. Defaults to the SDK's defaults if absent. */
|
|
628
663
|
retry?: RetryOptions;
|
|
629
664
|
/** Custom serde for the journaled value. */
|
|
630
|
-
serde?: restate.Serde<T>;
|
|
665
|
+
serde?: restate.Serde<T$1>;
|
|
631
666
|
};
|
|
632
667
|
/**
|
|
633
668
|
* Options object passed to the closure of `run(...)`. Carries an
|
|
@@ -645,7 +680,7 @@ type RunActionOpts = {
|
|
|
645
680
|
* signal into AbortSignal-aware APIs (e.g. `fetch(url, { signal })`)
|
|
646
681
|
* to cancel in-flight syscalls promptly.
|
|
647
682
|
*/
|
|
648
|
-
type RunAction<T> = (opts: RunActionOpts) => Promise<T>;
|
|
683
|
+
type RunAction<T$1> = (opts: RunActionOpts) => Promise<T$1>;
|
|
649
684
|
/**
|
|
650
685
|
* Wrap a user-supplied `run` closure to surface the abort reason
|
|
651
686
|
* (typically a TerminalError(CANCELLED)) on throw paths if the signal
|
|
@@ -662,7 +697,7 @@ type RunAction<T> = (opts: RunActionOpts) => Promise<T>;
|
|
|
662
697
|
* Exposed for testing — the wrapper's behavior is the part that has
|
|
663
698
|
* semantic bite, separate from the ctx.run plumbing.
|
|
664
699
|
*/
|
|
665
|
-
declare function wrapActionForCancellation<T>(signal: AbortSignal, action: RunAction<T>): () => Promise<T>;
|
|
700
|
+
declare function wrapActionForCancellation<T$1>(signal: AbortSignal, action: RunAction<T$1>): () => Promise<T$1>;
|
|
666
701
|
/**
|
|
667
702
|
* Deterministic date methods that return journal-backed Futures.
|
|
668
703
|
* Wraps the SDK's `ContextDate` (which returns Promises via internal
|
|
@@ -714,7 +749,7 @@ type ExecuteOptions = SchedulerOptions;
|
|
|
714
749
|
* return greeting;
|
|
715
750
|
* }));
|
|
716
751
|
*/
|
|
717
|
-
declare function execute<T>(context: restate.Context, op: Operation<T>, options?: ExecuteOptions): Promise<T>;
|
|
752
|
+
declare function execute<T$1>(context: restate.Context, op: Operation<T$1>, options?: ExecuteOptions): Promise<T$1>;
|
|
718
753
|
//#endregion
|
|
719
754
|
//#region src/free.d.ts
|
|
720
755
|
declare const rand: () => restate.Rand;
|
|
@@ -734,16 +769,16 @@ declare const handlerRequest: () => HandlerRequest;
|
|
|
734
769
|
* arrow functions assigned to a `const`) or specified explicitly via
|
|
735
770
|
* `opts.name`. If neither resolves, throws.
|
|
736
771
|
*/
|
|
737
|
-
declare const run: <T>(action: RunAction<T>, opts?: RunOpts<T>) => Future<T>;
|
|
772
|
+
declare const run: <T$1>(action: RunAction<T$1>, opts?: RunOpts<T$1>) => Future<T$1>;
|
|
738
773
|
declare const sleep: (duration: restate.Duration | number, name?: string) => Future<void>;
|
|
739
|
-
declare const awakeable: <T>(serde?: restate.Serde<T>) => {
|
|
774
|
+
declare const awakeable: <T$1>(serde?: restate.Serde<T$1>) => {
|
|
740
775
|
id: string;
|
|
741
|
-
promise: Future<T>;
|
|
776
|
+
promise: Future<T$1>;
|
|
742
777
|
};
|
|
743
|
-
declare const resolveAwakeable: <T>(id: string, payload?: T, serde?: restate.Serde<T>) => void;
|
|
778
|
+
declare const resolveAwakeable: <T$1>(id: string, payload?: T$1, serde?: restate.Serde<T$1>) => void;
|
|
744
779
|
declare const rejectAwakeable: (id: string, reason: string | restate.TerminalError) => void;
|
|
745
|
-
declare const signal: <T>(name: string, serde?: restate.Serde<T>) => Future<T>;
|
|
746
|
-
declare const attach: <T>(invocationId: restate.InvocationId, serde?: restate.Serde<T>) => Future<T>;
|
|
780
|
+
declare const signal: <T$1>(name: string, serde?: restate.Serde<T$1>) => Future<T$1>;
|
|
781
|
+
declare const attach: <T$1>(invocationId: restate.InvocationId, serde?: restate.Serde<T$1>) => Future<T$1>;
|
|
747
782
|
declare function client<H extends Record<string, HandlerDescriptor>>(def: Descriptor<string, H, "service">): GenClient<H>;
|
|
748
783
|
declare function client<H extends Record<string, HandlerDescriptor>>(def: Descriptor<string, H, "object" | "workflow">, key: string): GenClient<H>;
|
|
749
784
|
declare function sendClient<H extends Record<string, HandlerDescriptor>>(def: Descriptor<string, H, "service">): GenSendClient<H>;
|
|
@@ -769,36 +804,36 @@ declare function invocation<O$1 = unknown>(id: string, opts?: {
|
|
|
769
804
|
outputSerde?: restate.Serde<O$1>;
|
|
770
805
|
}): InvocationReference<O$1>;
|
|
771
806
|
declare const cancel: (invocationId: restate.InvocationId) => void;
|
|
772
|
-
declare const channel: <T>() => Channel<T>;
|
|
807
|
+
declare const channel: <T$1>() => Channel<T$1>;
|
|
773
808
|
declare const state: <TState extends TypedState = UntypedState>() => State<TState>;
|
|
774
809
|
declare const sharedState: <TState extends TypedState = UntypedState>() => SharedState<TState>;
|
|
775
|
-
declare const workflowPromise: <T>(name: string, serde?: restate.Serde<T>) => GenDurablePromise<T>;
|
|
810
|
+
declare const workflowPromise: <T$1>(name: string, serde?: restate.Serde<T$1>) => GenDurablePromise<T$1>;
|
|
776
811
|
/**
|
|
777
812
|
* Wait for every future to settle; return their values in input order.
|
|
778
813
|
* Heterogeneous-tuple typing — `all([fA, fB])` where `fA: Future<A>`
|
|
779
814
|
* and `fB: Future<B>` yields `Future<[A, B]>`. Mirrors `Promise.all`.
|
|
780
815
|
*/
|
|
781
|
-
declare const all: <const T extends readonly Future<unknown>[] | []>(futures: T) => Future<FutureValues<T>>;
|
|
816
|
+
declare const all: <const T$1 extends readonly Future<unknown>[] | []>(futures: T$1) => Future<FutureValues<T$1>>;
|
|
782
817
|
/**
|
|
783
818
|
* Return the first future to settle; losers continue running (until
|
|
784
819
|
* the main operation settles — see `OnMainExit`) but their results are
|
|
785
820
|
* discarded. Heterogeneous-tuple typing — `race([fA, fB])` yields
|
|
786
821
|
* `Future<A | B>`. Mirrors `Promise.race`.
|
|
787
822
|
*/
|
|
788
|
-
declare const race: <const T extends readonly Future<unknown>[] | []>(futures: T) => Future<FutureValues<T>[number]>;
|
|
823
|
+
declare const race: <const T$1 extends readonly Future<unknown>[] | []>(futures: T$1) => Future<FutureValues<T$1>[number]>;
|
|
789
824
|
/**
|
|
790
825
|
* First-to-succeed wins (non-rejected). Rejects with `AggregateError(errors)`
|
|
791
826
|
* when every input rejects (including the empty input case). Tuple-aware —
|
|
792
827
|
* `any([fA, fB])` yields `Future<A | B>`. Mirrors `Promise.any`.
|
|
793
828
|
*/
|
|
794
|
-
declare const any: <const T extends readonly Future<unknown>[] | []>(futures: T) => Future<FutureValues<T>[number]>;
|
|
829
|
+
declare const any: <const T$1 extends readonly Future<unknown>[] | []>(futures: T$1) => Future<FutureValues<T$1>[number]>;
|
|
795
830
|
/**
|
|
796
831
|
* Wait for every future to settle; never rejects. Tuple-aware —
|
|
797
832
|
* `allSettled([fA, fB])` yields
|
|
798
833
|
* `Future<[FutureSettledResult<A>, FutureSettledResult<B>]>`.
|
|
799
834
|
* Mirrors `Promise.allSettled`.
|
|
800
835
|
*/
|
|
801
|
-
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> }>;
|
|
836
|
+
declare const allSettled: <const T$1 extends readonly Future<unknown>[] | []>(futures: T$1) => Future<{ -readonly [P in keyof T$1]: FutureSettledResult<T$1[P] extends Future<infer U> ? U : never> }>;
|
|
802
837
|
/**
|
|
803
838
|
* Register `op` as a fresh routine and return a `Task<T>` for its
|
|
804
839
|
* eventual outcome — a `Future<T>` plus `interrupt(err?)` to throw into
|
|
@@ -807,7 +842,7 @@ declare const allSettled: <const T extends readonly Future<unknown>[] | []>(futu
|
|
|
807
842
|
* when the main operation settles is abandoned by default (see
|
|
808
843
|
* `OnMainExit`). See `RestateOperations.spawn` for full semantics.
|
|
809
844
|
*/
|
|
810
|
-
declare const spawn: <T>(op: Operation<T>) => Task<T>;
|
|
845
|
+
declare const spawn: <T$1>(op: Operation<T$1>) => Task<T$1>;
|
|
811
846
|
//#endregion
|
|
812
847
|
//#region src/context.d.ts
|
|
813
848
|
/**
|
|
@@ -815,7 +850,7 @@ declare const spawn: <T>(op: Operation<T>) => Task<T>;
|
|
|
815
850
|
* {@link contextLocal} (at module scope is fine — minting touches no
|
|
816
851
|
* fiber), then `get`/`set` it from inside the workflow body.
|
|
817
852
|
*/
|
|
818
|
-
interface ContextLocal<T> {
|
|
853
|
+
interface ContextLocal<T$1> {
|
|
819
854
|
/**
|
|
820
855
|
* Read this slot's value for the current invocation. Returns the
|
|
821
856
|
* value previously {@link set} during this invocation, or the default
|
|
@@ -824,14 +859,14 @@ interface ContextLocal<T> {
|
|
|
824
859
|
* synchronous span (a `gen` body running under `execute`); calling it
|
|
825
860
|
* from an `ops.run` closure or other async callback throws.
|
|
826
861
|
*/
|
|
827
|
-
get: () => T;
|
|
862
|
+
get: () => T$1;
|
|
828
863
|
/**
|
|
829
864
|
* Set this slot's value for the rest of the current invocation,
|
|
830
865
|
* visible to every fiber under it. Must be called from generator code
|
|
831
866
|
* on the fiber's synchronous span; calling it from an `ops.run`
|
|
832
867
|
* closure or other async callback throws.
|
|
833
868
|
*/
|
|
834
|
-
set: (value: T) => void;
|
|
869
|
+
set: (value: T$1) => void;
|
|
835
870
|
}
|
|
836
871
|
/**
|
|
837
872
|
* Create a context-local storage slot.
|
|
@@ -855,30 +890,10 @@ interface ContextLocal<T> {
|
|
|
855
890
|
* const traceId = contextLocal<string>(); // ContextLocal<string | undefined>
|
|
856
891
|
* const t = traceId.get(); // string | undefined
|
|
857
892
|
*/
|
|
858
|
-
declare function contextLocal<T>(defaultValue: T): ContextLocal<T>;
|
|
859
|
-
declare function contextLocal<T>(): ContextLocal<T | undefined>;
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
}
|
|
863
|
-
/** json<I, O>() — type params, default JSON serde */
|
|
864
|
-
declare function json<I$1 = void, O$1 = void>(): HandlerDescriptor<I$1, O$1>;
|
|
865
|
-
/** serdes(opts) — explicit Serde per field */
|
|
866
|
-
declare function serdes$1<SI extends restate.Serde<any>, SO extends restate.Serde<any>>(opts: {
|
|
867
|
-
input?: SI;
|
|
868
|
-
output?: SO;
|
|
869
|
-
}): HandlerDescriptor<SI extends restate.Serde<infer I> ? I : never, SO extends restate.Serde<infer O> ? O : never>;
|
|
870
|
-
/** schemas(opts) — Standard Schema (Zod, TypeBox, Valibot, …) per field */
|
|
871
|
-
declare function schemas$1<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
|
|
872
|
-
input?: SI;
|
|
873
|
-
output?: SO;
|
|
874
|
-
}): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>>;
|
|
875
|
-
declare function service$1<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): ServiceDescriptor<P$1, H>;
|
|
876
|
-
declare function object$1<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): ObjectDescriptor<P$1, H>;
|
|
877
|
-
declare function workflow$1<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): WorkflowDescriptor<P$1, H>;
|
|
878
|
-
/** @internal */
|
|
879
|
-
type InferInput<D> = D extends HandlerDescriptor<infer I, any> ? I : any;
|
|
880
|
-
/** @internal */
|
|
881
|
-
type InferOutput<D> = D extends HandlerDescriptor<any, infer O> ? O : any;
|
|
893
|
+
declare function contextLocal<T$1>(defaultValue: T$1): ContextLocal<T$1>;
|
|
894
|
+
declare function contextLocal<T$1>(): ContextLocal<T$1 | undefined>;
|
|
895
|
+
//#endregion
|
|
896
|
+
//#region src/interface.d.ts
|
|
882
897
|
/** @internal */
|
|
883
898
|
type ImplementHandlers<H extends Record<string, HandlerDescriptor>> = { [K in keyof H]: (input: InferInput<H[K]>) => Operation<InferOutput<H[K]>> };
|
|
884
899
|
declare function implement<P$1 extends string, H extends Record<string, HandlerDescriptor>>(iface: ServiceDescriptor<P$1, H>, config: {
|
|
@@ -927,17 +942,39 @@ interface Ingress {
|
|
|
927
942
|
*/
|
|
928
943
|
objectClient<D>(opts: VirtualObjectDefinitionFrom<D>, key: string): IngressClient<VirtualObject<D>>;
|
|
929
944
|
/**
|
|
930
|
-
* Create a client from a {@link ServiceDefinition}.
|
|
945
|
+
* Create a send client from a {@link ServiceDefinition}.
|
|
931
946
|
*/
|
|
932
947
|
serviceSendClient<D>(opts: ServiceDefinitionFrom<D>): IngressSendClient<Service<D>>;
|
|
933
948
|
/**
|
|
934
|
-
* Create a client from a {@link VirtualObjectDefinition}.
|
|
949
|
+
* Create a send client from a {@link VirtualObjectDefinition}.
|
|
935
950
|
*/
|
|
936
951
|
objectSendClient<D>(opts: VirtualObjectDefinitionFrom<D>, key: string): IngressSendClient<VirtualObject<D>>;
|
|
952
|
+
/**
|
|
953
|
+
* Create a request/response client from a service interface / `Descriptor`.
|
|
954
|
+
*
|
|
955
|
+
* @example
|
|
956
|
+
* ```ts
|
|
957
|
+
* ingress.client(greeter).greet(req); // service
|
|
958
|
+
* ingress.client(counter, "k").add(1); // virtual object / workflow
|
|
959
|
+
* ```
|
|
960
|
+
*/
|
|
961
|
+
client<P$1 extends string, H extends Record<string, HandlerDescriptor>>(serviceInterface: ServiceDescriptor<P$1, H>): IngressClientFromDescriptors<H>;
|
|
962
|
+
client<P$1 extends string, H extends Record<string, HandlerDescriptor>>(objectOrWorkflowInterface: ObjectDescriptor<P$1, H> | WorkflowDescriptor<P$1, H>, key: string): IngressClientFromDescriptors<H>;
|
|
963
|
+
/**
|
|
964
|
+
* Send-client (one-way) counterpart of {@link Ingress.client}.
|
|
965
|
+
*
|
|
966
|
+
* @example
|
|
967
|
+
* ```ts
|
|
968
|
+
* ingress.sendClient(greeter).greet(req);
|
|
969
|
+
* ingress.sendClient(counter, "k").add(1);
|
|
970
|
+
* ```
|
|
971
|
+
*/
|
|
972
|
+
sendClient<P$1 extends string, H extends Record<string, HandlerDescriptor>>(serviceInterface: ServiceDescriptor<P$1, H>): IngressSendClientFromDescriptors<H>;
|
|
973
|
+
sendClient<P$1 extends string, H extends Record<string, HandlerDescriptor>>(objectOrWorkflowInterface: ObjectDescriptor<P$1, H> | WorkflowDescriptor<P$1, H>, key: string): IngressSendClientFromDescriptors<H>;
|
|
937
974
|
/**
|
|
938
975
|
* Resolve an awakeable from the ingress client.
|
|
939
976
|
*/
|
|
940
|
-
resolveAwakeable<T>(id: string, payload?: T, payloadSerde?: Serde<T>): Promise<void>;
|
|
977
|
+
resolveAwakeable<T$1>(id: string, payload?: T$1, payloadSerde?: Serde<T$1>): Promise<void>;
|
|
941
978
|
/**
|
|
942
979
|
* Reject an awakeable from the ingress client.
|
|
943
980
|
*/
|
|
@@ -947,7 +984,7 @@ interface Ingress {
|
|
|
947
984
|
*
|
|
948
985
|
* @param send either the send response or the workflow submission as obtained by the respective clients.
|
|
949
986
|
*/
|
|
950
|
-
result<T>(send: Send<T> | WorkflowSubmission<T>, resultSerde?: Serde<T>): Promise<T>;
|
|
987
|
+
result<T$1>(send: Send<T$1> | WorkflowSubmission<T$1>, resultSerde?: Serde<T$1>): Promise<T$1>;
|
|
951
988
|
/** Generic request-response call. Routes directly by service name without a typed definition. */
|
|
952
989
|
call<I$1 = Uint8Array, O$1 = Uint8Array>(opts: {
|
|
953
990
|
service: string;
|
|
@@ -1040,7 +1077,7 @@ interface Ingress {
|
|
|
1040
1077
|
* @experimental
|
|
1041
1078
|
* @interface
|
|
1042
1079
|
*/
|
|
1043
|
-
type ScopedIngress = Pick<Ingress, "serviceClient" | "serviceSendClient" | "objectClient" | "objectSendClient" | "workflowClient">;
|
|
1080
|
+
type ScopedIngress = Pick<Ingress, "serviceClient" | "serviceSendClient" | "objectClient" | "objectSendClient" | "workflowClient" | "client" | "sendClient">;
|
|
1044
1081
|
interface IngressCallOptions<I$1 = unknown, O$1 = unknown> {
|
|
1045
1082
|
/**
|
|
1046
1083
|
* Key to use for idempotency key.
|
|
@@ -1117,6 +1154,15 @@ declare class SendOpts$1<I$1 = unknown> {
|
|
|
1117
1154
|
}
|
|
1118
1155
|
type InferArgType<P$1> = P$1 extends [infer A, ...any[]] ? A : unknown;
|
|
1119
1156
|
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 };
|
|
1157
|
+
/**
|
|
1158
|
+
* Typed ingress request/response client derived from a service interface's
|
|
1159
|
+
* handler descriptor map `H` (see `iface` in `@restatedev/restate-sdk-core`).
|
|
1160
|
+
* Recovers the input/output types directly from the descriptors, so a code-free
|
|
1161
|
+
* interface value produces a fully typed client that reuses the declared serdes.
|
|
1162
|
+
*/
|
|
1163
|
+
type IngressClientFromDescriptors<H extends Record<string, HandlerDescriptor>> = { readonly [K in keyof H]: [InferInput<H[K]>] extends [void] ? (opts?: Opts$1<InferInput<H[K]>, InferOutput<H[K]>>) => Promise<InferOutput<H[K]>> : (input: InferInput<H[K]>, opts?: Opts$1<InferInput<H[K]>, InferOutput<H[K]>>) => Promise<InferOutput<H[K]>> };
|
|
1164
|
+
/** One-way (send) counterpart of {@link IngressClientFromDescriptors}. */
|
|
1165
|
+
type IngressSendClientFromDescriptors<H extends Record<string, HandlerDescriptor>> = { readonly [K in keyof H]: [InferInput<H[K]>] extends [void] ? (opts?: SendOpts$1<InferInput<H[K]>>) => Promise<Send<InferOutput<H[K]>>> : (input: InferInput<H[K]>, opts?: SendOpts$1<InferInput<H[K]>>) => Promise<Send<InferOutput<H[K]>>> };
|
|
1120
1166
|
/**
|
|
1121
1167
|
* Represents the output of a workflow.
|
|
1122
1168
|
*/
|
|
@@ -1134,7 +1180,7 @@ interface Output<O$1> {
|
|
|
1134
1180
|
* Represents a successful workflow submission.
|
|
1135
1181
|
*
|
|
1136
1182
|
*/
|
|
1137
|
-
type WorkflowSubmission<T> = {
|
|
1183
|
+
type WorkflowSubmission<T$1> = {
|
|
1138
1184
|
/**
|
|
1139
1185
|
* The invocation id of the workflow. You can use that id to
|
|
1140
1186
|
* with the introspection tools (restate cli, logging, metrics)
|
|
@@ -1210,7 +1256,7 @@ type IngressWorkflowClient<M> = Omit<{ [K in keyof M as M[K] extends never ? nev
|
|
|
1210
1256
|
*
|
|
1211
1257
|
* @typeParam T the type of the response.
|
|
1212
1258
|
*/
|
|
1213
|
-
type Send<T = unknown> = {
|
|
1259
|
+
type Send<T$1 = unknown> = {
|
|
1214
1260
|
/**
|
|
1215
1261
|
* The invocation id of the send.
|
|
1216
1262
|
*/
|
|
@@ -1404,32 +1450,46 @@ declare namespace ingress_d_exports {
|
|
|
1404
1450
|
export { ConnectionOpts, GenIngress, HttpCallError, Ingress, IngressClient, IngressHandlerClient, IngressSendClient, IngressSendHandlerClient, IngressWorkflowClient, Opts$1 as Opts, RetryFailure, RetryPolicy, ScopedGenIngress, Send, SendOpts$1 as SendOpts, client$1 as client, connect, defaultShouldRetry, scope$1 as scope, sendClient$1 as sendClient };
|
|
1405
1451
|
}
|
|
1406
1452
|
/**
|
|
1407
|
-
*
|
|
1408
|
-
*
|
|
1409
|
-
* @param opts connection options
|
|
1410
|
-
* @returns a connection the the restate ingress
|
|
1453
|
+
* @deprecated Use `connect` from `@restatedev/restate-sdk-clients` and its typed
|
|
1454
|
+
* client methods, e.g. `connect({ url }).serviceClient(def)`
|
|
1411
1455
|
*/
|
|
1412
1456
|
declare function connect(opts: ConnectionOpts): GenIngress;
|
|
1413
1457
|
/**
|
|
1414
|
-
*
|
|
1415
|
-
*
|
|
1416
|
-
* — any object returned by `connect()` satisfies this.
|
|
1458
|
+
* @deprecated Use `connect` from `@restatedev/restate-sdk-clients` and its typed
|
|
1459
|
+
* client methods, e.g. `connect({ url }).serviceClient(def)`
|
|
1417
1460
|
*/
|
|
1418
|
-
type GenIngress =
|
|
1461
|
+
type GenIngress = Ingress;
|
|
1419
1462
|
type InferInput$1<D> = D extends HandlerDescriptor<infer I, any> ? I : unknown;
|
|
1420
1463
|
type InferOutput$1<D> = D extends HandlerDescriptor<any, infer O> ? O : unknown;
|
|
1421
|
-
/**
|
|
1464
|
+
/**
|
|
1465
|
+
* Typed ingress call client — each method returns Promise<O>.
|
|
1466
|
+
*
|
|
1467
|
+
* @deprecated Use the client returned by `ingress.serviceClient(def)` /
|
|
1468
|
+
* `ingress.objectClient(def, key)` from `@restatedev/restate-sdk-clients`.
|
|
1469
|
+
*/
|
|
1422
1470
|
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]>> };
|
|
1423
|
-
/**
|
|
1471
|
+
/**
|
|
1472
|
+
* Typed ingress send client — each method returns Promise<Send>.
|
|
1473
|
+
*
|
|
1474
|
+
* @deprecated Use the client returned by `ingress.serviceSendClient(def)` /
|
|
1475
|
+
* `ingress.objectSendClient(def, key)` from `@restatedev/restate-sdk-clients`.
|
|
1476
|
+
*/
|
|
1424
1477
|
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> };
|
|
1478
|
+
/**
|
|
1479
|
+
* @deprecated Call the regular ingress client directly: `ingress.client(def)`
|
|
1480
|
+
* for a service, or `ingress.client(def, key)` for a virtual object / workflow.
|
|
1481
|
+
*/
|
|
1425
1482
|
declare function client$1<H extends Record<string, HandlerDescriptor>>(ingress: GenIngress, def: Descriptor<string, H, "service">): IngressHandlerClient<H>;
|
|
1426
1483
|
declare function client$1<H extends Record<string, HandlerDescriptor>>(ingress: GenIngress, def: Descriptor<string, H, "object" | "workflow">, key: string): IngressHandlerClient<H>;
|
|
1484
|
+
/**
|
|
1485
|
+
* @deprecated Call the regular ingress client directly: `ingress.sendClient(def)`
|
|
1486
|
+
* for a service, or `ingress.sendClient(def, key)` for a virtual object / workflow.
|
|
1487
|
+
*/
|
|
1427
1488
|
declare function sendClient$1<H extends Record<string, HandlerDescriptor>>(ingress: GenIngress, def: Descriptor<string, H, "service">): IngressSendHandlerClient<H>;
|
|
1428
1489
|
declare function sendClient$1<H extends Record<string, HandlerDescriptor>>(ingress: GenIngress, def: Descriptor<string, H, "object" | "workflow">, key: string): IngressSendHandlerClient<H>;
|
|
1429
1490
|
/**
|
|
1430
|
-
*
|
|
1431
|
-
*
|
|
1432
|
-
* overloads, but every call/send routes within the bound scope.
|
|
1491
|
+
* @deprecated Use `ingress.scope(scopeKey)` from
|
|
1492
|
+
* `@restatedev/restate-sdk-clients` and its `client`/`sendClient` methods.
|
|
1433
1493
|
*/
|
|
1434
1494
|
interface ScopedGenIngress {
|
|
1435
1495
|
client<H extends Record<string, HandlerDescriptor>>(def: Descriptor<string, H, "service">): IngressHandlerClient<H>;
|
|
@@ -1438,14 +1498,9 @@ interface ScopedGenIngress {
|
|
|
1438
1498
|
sendClient<H extends Record<string, HandlerDescriptor>>(def: Descriptor<string, H, "object" | "workflow">, key: string): IngressSendHandlerClient<H>;
|
|
1439
1499
|
}
|
|
1440
1500
|
/**
|
|
1441
|
-
*
|
|
1442
|
-
*
|
|
1443
|
-
*
|
|
1444
|
-
* read identically (modulo the explicit `ingress`).
|
|
1445
|
-
*
|
|
1446
|
-
* @example
|
|
1447
|
-
* await clients.scope(ingress, "tenant-123").client(Greeter).greet(name);
|
|
1448
|
-
* await clients.scope(ingress, "tenant-123").client(Cart, "cart-42").add(item);
|
|
1501
|
+
* @deprecated Use `ingress.scope(scopeKey)` from
|
|
1502
|
+
* `@restatedev/restate-sdk-clients`, then `.client(def)` / `.sendClient(def)`
|
|
1503
|
+
* on the returned scoped ingress.
|
|
1449
1504
|
*/
|
|
1450
1505
|
declare function scope$1(ingress: GenIngress, scopeKey: string): ScopedGenIngress;
|
|
1451
1506
|
declare namespace internal_operations_d_exports {
|
|
@@ -1469,5 +1524,33 @@ declare namespace internal_operations_d_exports {
|
|
|
1469
1524
|
*/
|
|
1470
1525
|
declare function isProcessing(): boolean | undefined;
|
|
1471
1526
|
//#endregion
|
|
1472
|
-
|
|
1527
|
+
//#region src/index.d.ts
|
|
1528
|
+
declare const iface: {
|
|
1529
|
+
implement: typeof implement;
|
|
1530
|
+
service<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): ServiceDescriptor<P$1, H>;
|
|
1531
|
+
object<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): ObjectDescriptor<P$1, H>;
|
|
1532
|
+
workflow<P$1 extends string, H extends Record<string, HandlerDescriptor>>(name: P$1, handlers: H): WorkflowDescriptor<P$1, H>;
|
|
1533
|
+
json<I$1 = void, O$1 = void>(): HandlerDescriptor<I$1, O$1, false>;
|
|
1534
|
+
serdes<SI extends Serde<any>, SO extends Serde<any>>(opts: {
|
|
1535
|
+
input?: SI;
|
|
1536
|
+
output?: SO;
|
|
1537
|
+
}): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, false>;
|
|
1538
|
+
schemas<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
|
|
1539
|
+
input?: SI;
|
|
1540
|
+
output?: SO;
|
|
1541
|
+
}): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, false>;
|
|
1542
|
+
shared: {
|
|
1543
|
+
json<I$1 = void, O$1 = void>(): HandlerDescriptor<I$1, O$1, true>;
|
|
1544
|
+
serdes<SI extends Serde<any>, SO extends Serde<any>>(opts: {
|
|
1545
|
+
input?: SI;
|
|
1546
|
+
output?: SO;
|
|
1547
|
+
}): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, true>;
|
|
1548
|
+
schemas<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
|
|
1549
|
+
input?: SI;
|
|
1550
|
+
output?: SO;
|
|
1551
|
+
}): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, true>;
|
|
1552
|
+
};
|
|
1553
|
+
};
|
|
1554
|
+
//#endregion
|
|
1555
|
+
export { type AnyGenFn, type Channel, type ClientFuture, type ContextDate, type ContextLocal, type Descriptor, type Duration, type EntryToDescriptor, type ExecuteOptions, 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, InterruptedError, type InvocationReference, type ObjectDescriptor, type OnMainExit, type Operation, type Rand, type RetryOptions, type RunAction, type RunActionOpts, type RunOpts, type SchedulerOptions, type ScopedOperations, type SelectResult, type Serde, type SerdeType, type Service, type ServiceDefinition, type ServiceDefinitionFrom, type ServiceDescriptor, type ServiceInterface, type SharedState, type SignalReference, type StandardSchemaV1, type StandardTypedV1, type State, type Task, 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, contextLocal, date, execute, gen, handlerRequest, iface, implement, internal_operations_d_exports as internal, invocation, logger, object, race, rand, rejectAwakeable, resolveAwakeable, run, schemas, scope, select, send, sendClient, serde, serdes, service, sharedState, signal, sleep, spawn, state, workflow, workflowPromise, wrapActionForCancellation };
|
|
1473
1556
|
//# sourceMappingURL=index.d.cts.map
|