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