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