@restatedev/restate-sdk-cloudflare-workers 0.0.0-SNAPSHOT-20241001101403

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.
Files changed (123) hide show
  1. package/dist/esm/src/common_api.d.ts +12 -0
  2. package/dist/esm/src/common_api.d.ts.map +1 -0
  3. package/dist/esm/src/common_api.js +16 -0
  4. package/dist/esm/src/common_api.js.map +1 -0
  5. package/dist/esm/src/context.d.ts +587 -0
  6. package/dist/esm/src/context.d.ts.map +1 -0
  7. package/dist/esm/src/context.js +75 -0
  8. package/dist/esm/src/context.js.map +1 -0
  9. package/dist/esm/src/context_impl.d.ts +96 -0
  10. package/dist/esm/src/context_impl.d.ts.map +1 -0
  11. package/dist/esm/src/context_impl.js +696 -0
  12. package/dist/esm/src/context_impl.js.map +1 -0
  13. package/dist/esm/src/endpoint/endpoint_builder.d.ts +28 -0
  14. package/dist/esm/src/endpoint/endpoint_builder.d.ts.map +1 -0
  15. package/dist/esm/src/endpoint/endpoint_builder.js +139 -0
  16. package/dist/esm/src/endpoint/endpoint_builder.js.map +1 -0
  17. package/dist/esm/src/endpoint/fetch_endpoint.d.ts +54 -0
  18. package/dist/esm/src/endpoint/fetch_endpoint.d.ts.map +1 -0
  19. package/dist/esm/src/endpoint/fetch_endpoint.js +57 -0
  20. package/dist/esm/src/endpoint/fetch_endpoint.js.map +1 -0
  21. package/dist/esm/src/endpoint/handlers/fetch.d.ts +6 -0
  22. package/dist/esm/src/endpoint/handlers/fetch.d.ts.map +1 -0
  23. package/dist/esm/src/endpoint/handlers/fetch.js +30 -0
  24. package/dist/esm/src/endpoint/handlers/fetch.js.map +1 -0
  25. package/dist/esm/src/endpoint/handlers/generic.d.ts +62 -0
  26. package/dist/esm/src/endpoint/handlers/generic.d.ts.map +1 -0
  27. package/dist/esm/src/endpoint/handlers/generic.js +289 -0
  28. package/dist/esm/src/endpoint/handlers/generic.js.map +1 -0
  29. package/dist/esm/src/endpoint/handlers/lambda.d.ts +8 -0
  30. package/dist/esm/src/endpoint/handlers/lambda.d.ts.map +1 -0
  31. package/dist/esm/src/endpoint/handlers/lambda.js +80 -0
  32. package/dist/esm/src/endpoint/handlers/lambda.js.map +1 -0
  33. package/dist/esm/src/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.d.ts +270 -0
  34. package/dist/esm/src/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.js +20 -0
  35. package/dist/esm/src/endpoint/handlers/vm/sdk_shared_core_wasm_bindings_bg.js +1392 -0
  36. package/dist/esm/src/endpoint/handlers/vm/sdk_shared_core_wasm_bindings_bg.wasm +0 -0
  37. package/dist/esm/src/endpoint/handlers/vm/sdk_shared_core_wasm_bindings_bg.wasm.d.ts +61 -0
  38. package/dist/esm/src/endpoint/lambda_endpoint.d.ts +34 -0
  39. package/dist/esm/src/endpoint/lambda_endpoint.d.ts.map +1 -0
  40. package/dist/esm/src/endpoint/lambda_endpoint.js +49 -0
  41. package/dist/esm/src/endpoint/lambda_endpoint.js.map +1 -0
  42. package/dist/esm/src/endpoint/node_endpoint.d.ts +21 -0
  43. package/dist/esm/src/endpoint/node_endpoint.d.ts.map +1 -0
  44. package/dist/esm/src/endpoint/node_endpoint.js +101 -0
  45. package/dist/esm/src/endpoint/node_endpoint.js.map +1 -0
  46. package/dist/esm/src/endpoint/request_signing/basex.d.ts +10 -0
  47. package/dist/esm/src/endpoint/request_signing/basex.d.ts.map +1 -0
  48. package/dist/esm/src/endpoint/request_signing/basex.js +136 -0
  49. package/dist/esm/src/endpoint/request_signing/basex.js.map +1 -0
  50. package/dist/esm/src/endpoint/request_signing/ed25519.d.ts +17 -0
  51. package/dist/esm/src/endpoint/request_signing/ed25519.d.ts.map +1 -0
  52. package/dist/esm/src/endpoint/request_signing/ed25519.js +52 -0
  53. package/dist/esm/src/endpoint/request_signing/ed25519.js.map +1 -0
  54. package/dist/esm/src/endpoint/request_signing/v1.d.ts +10 -0
  55. package/dist/esm/src/endpoint/request_signing/v1.d.ts.map +1 -0
  56. package/dist/esm/src/endpoint/request_signing/v1.js +143 -0
  57. package/dist/esm/src/endpoint/request_signing/v1.js.map +1 -0
  58. package/dist/esm/src/endpoint/request_signing/validate.d.ts +19 -0
  59. package/dist/esm/src/endpoint/request_signing/validate.d.ts.map +1 -0
  60. package/dist/esm/src/endpoint/request_signing/validate.js +40 -0
  61. package/dist/esm/src/endpoint/request_signing/validate.js.map +1 -0
  62. package/dist/esm/src/endpoint.d.ts +132 -0
  63. package/dist/esm/src/endpoint.d.ts.map +1 -0
  64. package/dist/esm/src/endpoint.js +12 -0
  65. package/dist/esm/src/endpoint.js.map +1 -0
  66. package/dist/esm/src/fetch.d.ts +8 -0
  67. package/dist/esm/src/fetch.d.ts.map +1 -0
  68. package/dist/esm/src/fetch.js +23 -0
  69. package/dist/esm/src/fetch.js.map +1 -0
  70. package/dist/esm/src/generated/version.d.ts +2 -0
  71. package/dist/esm/src/generated/version.d.ts.map +1 -0
  72. package/dist/esm/src/generated/version.js +2 -0
  73. package/dist/esm/src/generated/version.js.map +1 -0
  74. package/dist/esm/src/lambda.d.ts +7 -0
  75. package/dist/esm/src/lambda.d.ts.map +1 -0
  76. package/dist/esm/src/lambda.js +19 -0
  77. package/dist/esm/src/lambda.js.map +1 -0
  78. package/dist/esm/src/logger.d.ts +35 -0
  79. package/dist/esm/src/logger.d.ts.map +1 -0
  80. package/dist/esm/src/logger.js +144 -0
  81. package/dist/esm/src/logger.js.map +1 -0
  82. package/dist/esm/src/public_api.d.ts +7 -0
  83. package/dist/esm/src/public_api.d.ts.map +1 -0
  84. package/dist/esm/src/public_api.js +19 -0
  85. package/dist/esm/src/public_api.js.map +1 -0
  86. package/dist/esm/src/types/components.d.ts +85 -0
  87. package/dist/esm/src/types/components.d.ts.map +1 -0
  88. package/dist/esm/src/types/components.js +228 -0
  89. package/dist/esm/src/types/components.js.map +1 -0
  90. package/dist/esm/src/types/discovery.d.ts +43 -0
  91. package/dist/esm/src/types/discovery.d.ts.map +1 -0
  92. package/dist/esm/src/types/discovery.js +28 -0
  93. package/dist/esm/src/types/discovery.js.map +1 -0
  94. package/dist/esm/src/types/errors.d.ts +21 -0
  95. package/dist/esm/src/types/errors.d.ts.map +1 -0
  96. package/dist/esm/src/types/errors.js +47 -0
  97. package/dist/esm/src/types/errors.js.map +1 -0
  98. package/dist/esm/src/types/rpc.d.ts +417 -0
  99. package/dist/esm/src/types/rpc.d.ts.map +1 -0
  100. package/dist/esm/src/types/rpc.js +607 -0
  101. package/dist/esm/src/types/rpc.js.map +1 -0
  102. package/dist/esm/src/user_agent.d.ts +2 -0
  103. package/dist/esm/src/user_agent.d.ts.map +1 -0
  104. package/dist/esm/src/user_agent.js +13 -0
  105. package/dist/esm/src/user_agent.js.map +1 -0
  106. package/dist/esm/src/utils/buffer.d.ts +5 -0
  107. package/dist/esm/src/utils/buffer.d.ts.map +1 -0
  108. package/dist/esm/src/utils/buffer.js +53 -0
  109. package/dist/esm/src/utils/buffer.js.map +1 -0
  110. package/dist/esm/src/utils/completable_promise.d.ts +9 -0
  111. package/dist/esm/src/utils/completable_promise.d.ts.map +1 -0
  112. package/dist/esm/src/utils/completable_promise.js +30 -0
  113. package/dist/esm/src/utils/completable_promise.js.map +1 -0
  114. package/dist/esm/src/utils/rand.d.ts +13 -0
  115. package/dist/esm/src/utils/rand.d.ts.map +1 -0
  116. package/dist/esm/src/utils/rand.js +106 -0
  117. package/dist/esm/src/utils/rand.js.map +1 -0
  118. package/dist/esm/src/utils/streams.d.ts +4 -0
  119. package/dist/esm/src/utils/streams.d.ts.map +1 -0
  120. package/dist/esm/src/utils/streams.js +20 -0
  121. package/dist/esm/src/utils/streams.js.map +1 -0
  122. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  123. package/package.json +82 -0
@@ -0,0 +1,12 @@
1
+ export type { Context, ObjectContext, ObjectSharedContext, WorkflowContext, WorkflowSharedContext, Rand, GenericCall, GenericSend, } from "./context.js";
2
+ export { CombineablePromise } from "./context.js";
3
+ export type { Serde } from "@restatedev/restate-sdk-core";
4
+ export { serde } from "@restatedev/restate-sdk-core";
5
+ export type { Client, SendClient, ClientCallOptions, ClientSendOptions, } from "./types/rpc.js";
6
+ export { service, object, workflow, handlers, Opts, SendOpts, } from "./types/rpc.js";
7
+ export { rpc } from "./types/rpc.js";
8
+ export type { ServiceDefinition, VirtualObjectDefinition, WorkflowDefinition, } from "@restatedev/restate-sdk-core";
9
+ export type { ServiceBundle, RestateEndpoint } from "./endpoint.js";
10
+ export { RestateError, TerminalError, TimeoutError } from "./types/errors.js";
11
+ export type { Logger, LogParams, RestateLogLevel, LoggerContext, LogSource, } from "./logger.js";
12
+ //# sourceMappingURL=common_api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common_api.d.ts","sourceRoot":"","sources":["../../../src/common_api.ts"],"names":[],"mappings":"AAWA,YAAY,EACV,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,IAAI,EACJ,WAAW,EACX,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,YAAY,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD,YAAY,EACV,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,QAAQ,GACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9E,YAAY,EACV,MAAM,EACN,SAAS,EACT,eAAe,EACf,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAC"}
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH
3
+ *
4
+ * This file is part of the Restate SDK for Node.js/TypeScript,
5
+ * which is released under the MIT license.
6
+ *
7
+ * You can find a copy of the license in file LICENSE in the root
8
+ * directory of this repository or package, or at
9
+ * https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
10
+ */
11
+ export { CombineablePromise } from "./context.js";
12
+ export { serde } from "@restatedev/restate-sdk-core";
13
+ export { service, object, workflow, handlers, Opts, SendOpts, } from "./types/rpc.js";
14
+ export { rpc } from "./types/rpc.js";
15
+ export { RestateError, TerminalError, TimeoutError } from "./types/errors.js";
16
+ //# sourceMappingURL=common_api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common_api.js","sourceRoot":"","sources":["../../../src/common_api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAQrD,OAAO,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,QAAQ,GACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AASrC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,587 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import type { Client, SendClient } from "./types/rpc.js";
3
+ import type { RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Service, ServiceDefinitionFrom, VirtualObject, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinitionFrom, Serde } from "@restatedev/restate-sdk-core";
4
+ /**
5
+ * Represents the original request as sent to this handler.
6
+ *
7
+ * A request object includes the request headers, and the raw unparsed
8
+ * request body.
9
+ */
10
+ export interface Request {
11
+ /**
12
+ * The unique id that identifies the current function invocation. This id is guaranteed to be
13
+ * unique across invocations, but constant across reties and suspensions.
14
+ */
15
+ readonly id: string;
16
+ /**
17
+ * Request headers - the following headers capture the original invocation headers, as provided to
18
+ * the ingress.
19
+ */
20
+ readonly headers: ReadonlyMap<string, string>;
21
+ /**
22
+ * Attempt headers - the following headers are sent by the restate runtime.
23
+ * These headers are attempt specific, generated by the restate runtime uniquely for each attempt.
24
+ * These headers might contain information such as the W3C trace context, and attempt specific information.
25
+ */
26
+ readonly attemptHeaders: ReadonlyMap<string, string | string[] | undefined>;
27
+ /**
28
+ * Raw unparsed request body
29
+ */
30
+ readonly body: Uint8Array;
31
+ /**
32
+ * Extra arguments provided to the request handler:
33
+ * Lambda: [Context]
34
+ * Cloudflare workers: [Env, ExecutionContext]
35
+ * Deno: [ConnInfo]
36
+ * Bun: [Server]
37
+ * These arguments can contain request-specific values that could change after a suspension.
38
+ * Care should be taken to use them deterministically.
39
+ */
40
+ readonly extraArgs: unknown[];
41
+ }
42
+ export type TypedState = Record<string, any>;
43
+ export type UntypedState = {
44
+ _: never;
45
+ };
46
+ /**
47
+ * Key value store operations. Only keyed services have an attached key-value store.
48
+ */
49
+ export interface KeyValueStore<TState extends TypedState> {
50
+ /**
51
+ * Get/retrieve state from the Restate runtime.
52
+ * Note that state objects are serialized with `Buffer.from(JSON.stringify(theObject))`
53
+ * and deserialized with `JSON.parse(value.toString()) as T`.
54
+ *
55
+ * @param name key of the state to retrieve
56
+ * @returns a Promise that is resolved with the value of the state key
57
+ *
58
+ * @example
59
+ * const state = await ctx.get<string>("STATE");
60
+ */
61
+ get<TValue, TKey extends keyof TState = string>(name: TState extends UntypedState ? string : TKey, serde?: Serde<TState extends UntypedState ? TValue : TState[TKey]>): Promise<(TState extends UntypedState ? TValue : TState[TKey]) | null>;
62
+ stateKeys(): Promise<Array<string>>;
63
+ /**
64
+ * Set/store state in the Restate runtime.
65
+ * Note that state objects are serialized with `Buffer.from(JSON.stringify(theObject))`
66
+ * and deserialized with `JSON.parse(value.toString()) as T`.
67
+ *
68
+ * @param name key of the state to set
69
+ * @param value value to set
70
+ *
71
+ * @example
72
+ * ctx.set("STATE", "Hello");
73
+ */
74
+ set<TValue, TKey extends keyof TState = string>(name: TState extends UntypedState ? string : TKey, value: TState extends UntypedState ? TValue : TState[TKey], serde?: Serde<TState extends UntypedState ? TValue : TState[TKey]>): void;
75
+ /**
76
+ * Clear/delete state in the Restate runtime.
77
+ * @param name key of the state to delete
78
+ *
79
+ * @example
80
+ * ctx.clear("STATE");
81
+ */
82
+ clear<TKey extends keyof TState>(name: TState extends UntypedState ? string : TKey): void;
83
+ /**
84
+ * Clear/delete all the state entries in the Restate runtime.
85
+ *
86
+ * @example
87
+ * ctx.clearAll();
88
+ */
89
+ clearAll(): void;
90
+ }
91
+ export interface SendOptions {
92
+ /**
93
+ * Makes a type-safe one-way RPC to the specified target service, after a delay specified by the
94
+ * milliseconds' argument.
95
+ * This method is like setting up a fault-tolerant cron job that enqueues the message in a
96
+ * message queue.
97
+ * The handler calling this function does not have to stay active for the delay time.
98
+ *
99
+ * Both the delay timer and the message are durably stored in Restate and guaranteed to be reliably
100
+ * delivered. The delivery happens no earlier than specified through the delay, but may happen
101
+ * later, if the target service is down, or backpressuring the system.
102
+ *
103
+ * The delay message is journaled for durable execution and will thus not be duplicated when the
104
+ * handler is re-invoked for retries or after suspending.
105
+ *
106
+ * This call will return immediately; the message sending happens asynchronously in the background.
107
+ * Despite that, the message is guaranteed to be sent, because the completion of the invocation that
108
+ * triggers the send (calls this function) happens logically after the sending. That means that any
109
+ * failure where the message does not reach Restate also cannot complete this invocation, and will
110
+ * hence recover this handler and (through the durable execution) recover the message to be sent.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * ctx.serviceSendClient(Service, {delay: 60_000}).anotherAction(1337);
115
+ * ```
116
+ */
117
+ delay?: number;
118
+ }
119
+ export interface ContextDate {
120
+ /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
121
+ * This is equivalent to Date.now()
122
+ */
123
+ now(): Promise<number>;
124
+ /** Returns the JSON representation of the current date.
125
+ * This is equivalent to new Date().toJSON()
126
+ **/
127
+ toJSON(): Promise<string>;
128
+ }
129
+ /**
130
+ * A function that can be run and its result durably persisted by Restate.
131
+ */
132
+ export type RunAction<T> = (() => Promise<T>) | (() => T);
133
+ export type RunOptions<T> = {
134
+ serde?: Serde<T>;
135
+ };
136
+ /**
137
+ * Call a handler directly avoiding restate's type safety checks.
138
+ * This is a generic machnisim to invoke handlers directly by only knowing
139
+ * the service and handler name, (or key in the case of objects or workflows)
140
+ */
141
+ export type GenericCall<REQ, RES> = {
142
+ service: string;
143
+ method: string;
144
+ parameter: REQ;
145
+ key?: string;
146
+ inputSerde?: Serde<REQ>;
147
+ outputSerde?: Serde<RES>;
148
+ };
149
+ /**
150
+ * Send a message to an handler directly avoiding restate's type safety checks.
151
+ * This is a generic machnisim to invoke handlers directly by only knowing
152
+ * the service and handler name, (or key in the case of objects or workflows)
153
+ */
154
+ export type GenericSend<REQ> = {
155
+ service: string;
156
+ method: string;
157
+ parameter: REQ;
158
+ key?: string;
159
+ inputSerde?: Serde<REQ>;
160
+ delay?: number;
161
+ };
162
+ /**
163
+ * The context that gives access to all Restate-backed operations, for example
164
+ * - sending reliable messages / RPC through Restate
165
+ * - execute non-deterministic closures and memoize their result
166
+ * - sleeps and delayed calls
167
+ * - awakeables
168
+ * - ...
169
+ *
170
+ * Virtual objects can also access their key-value store using the {@link ObjectContext}.
171
+ *
172
+ */
173
+ export interface Context extends RestateContext {
174
+ /**
175
+ * Deterministic random methods; these are inherently predictable (seeded on the invocation ID, which is not secret)
176
+ * and so should not be used for any cryptographic purposes. They are useful for identifiers, idempotency keys,
177
+ * and for uniform sampling from a set of options. If a cryptographically secure value is needed, please generate that
178
+ * externally and capture the result with a side effect.
179
+ *
180
+ * Calls to these methods from inside `ctx.run` are disallowed and will fail - side effects must be idempotent, and
181
+ * these calls are not.
182
+ */
183
+ rand: Rand;
184
+ /**
185
+ * Console to use for logging. It attaches to each log message some contextual information,
186
+ * such as invoked service method and invocation id, and automatically excludes logs during replay.
187
+ */
188
+ console: Console;
189
+ /**
190
+ * Deterministic date.
191
+ */
192
+ date: ContextDate;
193
+ /**
194
+ * Run an operation and store the result in Restate. The operation will thus not
195
+ * be re-run during a later replay, but take the durable result from Restate.
196
+ *
197
+ * This let you capture potentially non-deterministic computation and interaction
198
+ * with external systems in a safe way.
199
+ *
200
+ * Failure semantics are:
201
+ * - If an operation has run and persisted before, the result (value or Error) will be
202
+ * taken from the Restate journal.
203
+ * - There is a small window where an action may be re-run, if a failure
204
+ * occurred between a successful run and persisting the result.
205
+ * - No second action will be run while a previous run's result is not
206
+ * yet durable. That way, effects that build on top of each other can assume
207
+ * deterministic results from previous runs, and at most one run will be
208
+ * re-executed on replay (the latest, if the failure happened in the small windows
209
+ * described above).
210
+ *
211
+ * @example
212
+ * ```ts
213
+ * const result = await ctx.run(someExternalAction)
214
+ *```
215
+
216
+ * @example
217
+ * ```ts
218
+ * await ctx.run("payment action", async () => {
219
+ * const result = await paymentProvider.charge(txId, paymentInfo);
220
+ * if (result.paymentRejected) {
221
+ * // this action will not be retried anymore
222
+ * throw new TerminalError("Payment failed");
223
+ * } else if (result.paymentGatewayBusy) {
224
+ * // restate will retry automatically
225
+ * throw new Exception("Payment gateway busy");
226
+ * } else {
227
+ * // success!
228
+ * }
229
+ * });
230
+ *
231
+ * ```
232
+ *
233
+ * @param action The function to run.
234
+ */
235
+ run<T>(action: RunAction<T>): Promise<T>;
236
+ /**
237
+ * Run an operation and store the result in Restate. The operation will thus not
238
+ * be re-run during a later replay, but take the durable result from Restate.
239
+ *
240
+ * @param name the action's name
241
+ * @param action the action to run.
242
+ */
243
+ run<T>(name: string, action: RunAction<T>): Promise<T>;
244
+ run<T>(name: string, action: RunAction<T>, options: RunOptions<T>): Promise<T>;
245
+ /**
246
+ * Register an awakeable and pause the processing until the awakeable ID (and optional payload) have been returned to the service
247
+ * (via ctx.completeAwakeable(...)). The SDK deserializes the payload with `JSON.parse(result.toString()) as T`.
248
+ * @returns
249
+ * - id: the string ID that has to be used to complete the awakaeble by some external service
250
+ * - promise: the Promise that needs to be awaited and that is resolved with the payload that was supplied by the service which completed the awakeable
251
+ *
252
+ * @example
253
+ * const awakeable = ctx.awakeable<string>();
254
+ *
255
+ * // send the awakeable ID to some external service that will wake this one back up
256
+ * // The ID can be retrieved by:
257
+ * const id = awakeable.id;
258
+ *
259
+ * // ... send to external service ...
260
+ *
261
+ * // Wait for the external service to wake this service back up
262
+ * const result = await awakeable.promise;
263
+ */
264
+ awakeable<T>(serde?: Serde<T>): {
265
+ id: string;
266
+ promise: CombineablePromise<T>;
267
+ };
268
+ /**
269
+ * Resolve an awakeable.
270
+ * @param id the string ID of the awakeable.
271
+ * This is supplied by the service that needs to be woken up.
272
+ * @param payload the payload to pass to the service that is woken up.
273
+ * The SDK serializes the payload with `Buffer.from(JSON.stringify(payload))`
274
+ * and deserializes it in the receiving service with `JSON.parse(result.toString()) as T`.
275
+ *
276
+ * @example
277
+ * // The sleeping service should have sent the awakeableIdentifier string to this service.
278
+ * ctx.resolveAwakeable(awakeableIdentifier, "hello");
279
+ */
280
+ resolveAwakeable<T>(id: string, payload?: T, serde?: Serde<T>): void;
281
+ /**
282
+ * Reject an awakeable. When rejecting, the service waiting on this awakeable will be woken up with a terminal error with the provided reason.
283
+ * @param id the string ID of the awakeable.
284
+ * This is supplied by the service that needs to be woken up.
285
+ * @param reason the reason of the rejection.
286
+ *
287
+ * @example
288
+ * // The sleeping service should have sent the awakeableIdentifier string to this service.
289
+ * ctx.rejectAwakeable(awakeableIdentifier, "super bad error");
290
+ */
291
+ rejectAwakeable(id: string, reason: string): void;
292
+ /**
293
+ * Sleep until a timeout has passed.
294
+ * @param millis duration of the sleep in millis.
295
+ * This is a lower-bound.
296
+ *
297
+ * @example
298
+ * await ctx.sleep(1000);
299
+ */
300
+ sleep(millis: number): CombineablePromise<void>;
301
+ /**
302
+ * Makes a type-safe request/response RPC to the specified target service.
303
+ *
304
+ * The RPC goes through Restate and is guaranteed to be reliably delivered. The RPC is also
305
+ * journaled for durable execution and will thus not be duplicated when the handler is re-invoked
306
+ * for retries or after suspending.
307
+ *
308
+ * This call will return the result produced by the target handler, or the Error, if the target
309
+ * handler finishes with a Terminal Error.
310
+ *
311
+ * This call is a suspension point: The handler might suspend while awaiting the response and
312
+ * resume once the response is available.
313
+ *
314
+ * @example
315
+ * *Service Side:*
316
+ * ```ts
317
+ * const service = restate.service(
318
+ * name: "myservice",
319
+ * handlers: {
320
+ * someAction: async(ctx: restate.Context, req: string) => { ... },
321
+ * anotherAction: async(ctx: restate.Context, count: number) => { ... }
322
+ * });
323
+ *
324
+ * // option 1: export only the type signature
325
+ * export type Service = typeof service;
326
+ *
327
+ *
328
+ * restate.endpoint().bind(service).listen(9080);
329
+ * ```
330
+ * **Client side:**
331
+ * ```ts
332
+ * // option 1: use only types and supply service name separately
333
+ * const result1 = await ctx.serviceClient<Service>({name: "myservice"}).someAction("hello!");
334
+ *
335
+ * // option 2: use full API spec
336
+ * type MyService: Service = { name: "myservice" };
337
+ * const result2 = await ctx.serviceClient(Service).anotherAction(1337);
338
+ * ```
339
+ */
340
+ serviceClient<D>(opts: ServiceDefinitionFrom<D>): Client<Service<D>>;
341
+ /**
342
+ * Same as {@link serviceClient} but for virtual objects.
343
+ *
344
+ * @param opts
345
+ * @param key the virtual object key
346
+ */
347
+ objectClient<D>(opts: VirtualObjectDefinitionFrom<D>, key: string): Client<VirtualObject<D>>;
348
+ /**
349
+ * Same as {@link serviceClient} but for workflows.
350
+ *
351
+ * @param opts
352
+ * @param key the workflow key
353
+ */
354
+ workflowClient<D>(opts: WorkflowDefinitionFrom<D>, key: string): Client<Workflow<D>>;
355
+ /**
356
+ * Same as {@link objectSendClient} but for workflows.
357
+ *
358
+ * @param opts
359
+ * @param key the workflow key
360
+ */
361
+ workflowSendClient<D>(opts: WorkflowDefinitionFrom<D>, key: string): SendClient<Workflow<D>>;
362
+ /**
363
+ * Makes a type-safe one-way RPC to the specified target service. This method effectively behaves
364
+ * like enqueuing the message in a message queue.
365
+ *
366
+ * The message goes through Restate and is guaranteed to be reliably delivered. The RPC is also
367
+ * journaled for durable execution and will thus not be duplicated when the handler is re-invoked
368
+ * for retries or after suspending.
369
+ *
370
+ * This call will return immediately; the message sending happens asynchronously in the background.
371
+ * Despite that, the message is guaranteed to be sent, because the completion of the invocation that
372
+ * triggers the send (calls this function) happens logically after the sending. That means that any
373
+ * failure where the message does not reach Restate also cannot complete this invocation, and will
374
+ * hence recover this handler and (through the durable execution) recover the message to be sent.
375
+ *
376
+ * @example
377
+ * *Service Side:*
378
+ * ```ts
379
+ * const service = restate.service(
380
+ * name: "myservice",
381
+ * handlers: {
382
+ * someAction: async(ctx: restate.Context, req: string) => { ... },
383
+ * anotherAction: async(ctx: restate.Context, count: number) => { ... }
384
+ * });
385
+ *
386
+ * // option 1: export only the type signature of the router
387
+ * export type MyApi = typeof service;
388
+ *
389
+ * // option 2: export the API definition with type and name (name)
390
+ * const MyService: MyApi = { name: "myservice" };
391
+ *
392
+ * restate.endpoint().bind(service).listen(9080);
393
+ * ```
394
+ * **Client side:**
395
+ * ```ts
396
+ * // option 1: use only types and supply service name separately
397
+ * ctx.serviceSendClient<MyApi>({name: "myservice"}).someAction("hello!");
398
+ *
399
+ * // option 2: use full API spec
400
+ * ctx.serviceSendClient(MyService).anotherAction(1337);
401
+ * ```
402
+ */
403
+ serviceSendClient<D>(service: ServiceDefinitionFrom<D>, opts?: SendOptions): SendClient<Service<D>>;
404
+ /**
405
+ * Same as {@link serviceSendClient} but for virtual objects.
406
+ *
407
+ * @param obj
408
+ * @param key the virtual object key
409
+ * @param opts Send options
410
+ */
411
+ objectSendClient<D>(obj: VirtualObjectDefinitionFrom<D>, key: string, opts?: SendOptions): SendClient<VirtualObject<D>>;
412
+ genericCall<REQ = Uint8Array, RES = Uint8Array>(call: GenericCall<REQ, RES>): Promise<RES>;
413
+ genericSend<REQ = Uint8Array>(call: GenericSend<REQ>): void;
414
+ /**
415
+ * Returns the raw request that triggered that handler.
416
+ * Use that object to inspect the original request headers
417
+ */
418
+ request(): Request;
419
+ }
420
+ /**
421
+ * The context that gives access to all Restate-backed operations, for example
422
+ * - sending reliable messages / RPC through Restate
423
+ * - access/update state
424
+ * - execute non-deterministic closures and memoize their result
425
+ * - sleeps and delayed calls
426
+ * - awakeables
427
+ * - ...
428
+ *
429
+ * This context can be used only within virtual objects.
430
+ *
431
+ */
432
+ export interface ObjectContext<TState extends TypedState = UntypedState> extends Context, KeyValueStore<TState>, RestateObjectContext {
433
+ key: string;
434
+ }
435
+ /**
436
+ * The context that gives access to all Restate-backed operations, for example
437
+ * - sending reliable messages / RPC through Restate
438
+ * - execute non-deterministic closures and memoize their result
439
+ * - sleeps and delayed calls
440
+ * - awakeables
441
+ * - ...
442
+ *
443
+ * This context can be used only within a shared virtual objects.
444
+ *
445
+ */
446
+ export interface ObjectSharedContext<TState extends TypedState = UntypedState> extends Context, RestateObjectSharedContext {
447
+ key: string;
448
+ /**
449
+ * Get/retrieve state from the Restate runtime.
450
+ * Note that state objects are serialized with `Buffer.from(JSON.stringify(theObject))`
451
+ * and deserialized with `JSON.parse(value.toString()) as T`.
452
+ *
453
+ * @param name key of the state to retrieve
454
+ * @returns a Promise that is resolved with the value of the state key
455
+ *
456
+ * @example
457
+ * const state = await ctx.get<string>("STATE");
458
+ */
459
+ get<TValue, TKey extends keyof TState = string>(name: TState extends UntypedState ? string : TKey, serde?: Serde<TState extends UntypedState ? TValue : TState[TKey]>): Promise<(TState extends UntypedState ? TValue : TState[TKey]) | null>;
460
+ /**
461
+ * Retrieve all the state keys for this object.
462
+ */
463
+ stateKeys(): Promise<Array<string>>;
464
+ }
465
+ export interface Rand {
466
+ /**
467
+ * Equivalent of JS `Math.random()` but deterministic; seeded by the invocation ID of the current invocation,
468
+ * each call will return a new pseudorandom float within the range [0,1)
469
+ */
470
+ random(): number;
471
+ /**
472
+ * Using the same random source and seed as random(), produce a UUID version 4 string. This is inherently predictable
473
+ * based on the invocation ID and should not be used in cryptographic contexts
474
+ */
475
+ uuidv4(): string;
476
+ }
477
+ /**
478
+ * A promise that can be combined using Promise combinators in RestateContext.
479
+ */
480
+ export type CombineablePromise<T> = Promise<T> & {
481
+ /**
482
+ * Creates a promise that awaits for the current promise up to the specified timeout duration.
483
+ * If the timeout is fired, this Promise will be rejected with a {@link TimeoutError}.
484
+ *
485
+ * @param millis duration of the sleep in millis.
486
+ * This is a lower-bound.
487
+ */
488
+ orTimeout(millis: number): Promise<T>;
489
+ };
490
+ export declare const CombineablePromise: {
491
+ /**
492
+ * Creates a Promise that is resolved with an array of results when all of the provided Promises
493
+ * resolve, or rejected when any Promise is rejected.
494
+ *
495
+ * See {@link Promise.all} for more details.
496
+ *
497
+ * @param values An iterable of Promises.
498
+ * @returns A new Promise.
499
+ */
500
+ all<T extends [] | readonly CombineablePromise<unknown>[]>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>;
501
+ /**
502
+ * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
503
+ * or rejected.
504
+ *
505
+ * See {@link Promise.race} for more details.
506
+ *
507
+ * @param values An iterable of Promises.
508
+ * @returns A new Promise.
509
+ */
510
+ race<T_1 extends [] | readonly CombineablePromise<unknown>[]>(values: T_1): Promise<Awaited<T_1[number]>>;
511
+ /**
512
+ * Creates a promise that fulfills when any of the input's promises fulfills, with this first fulfillment value.
513
+ * It rejects when all the input's promises reject (including when an empty iterable is passed),
514
+ * with an AggregateError containing an array of rejection reasons.
515
+ *
516
+ * See {@link Promise.any} for more details.
517
+ *
518
+ * @param values An iterable of Promises.
519
+ * @returns A new Promise.
520
+ */
521
+ any<T_2 extends [] | readonly CombineablePromise<unknown>[]>(values: T_2): Promise<Awaited<T_2[number]>>;
522
+ /**
523
+ * Creates a promise that fulfills when all the input's promises settle (including when an empty iterable is passed),
524
+ * with an array of objects that describe the outcome of each promise.
525
+ *
526
+ * See {@link Promise.allSettled} for more details.
527
+ *
528
+ * @param values An iterable of Promises.
529
+ * @returns A new Promise.
530
+ */
531
+ allSettled<T_3 extends [] | readonly CombineablePromise<unknown>[]>(values: T_3): Promise<{ -readonly [P_1 in keyof T_3]: PromiseSettledResult<Awaited<T_3[P_1]>>; }>;
532
+ };
533
+ /**
534
+ * Workflow bound durable promise
535
+ *
536
+ * See {@link WorkflowSharedContext} promise..
537
+ */
538
+ export type DurablePromise<T> = Promise<T> & {
539
+ /**
540
+ * Returns the value of the promise, if it has been resolved.
541
+ */
542
+ peek(): Promise<T | undefined>;
543
+ /**
544
+ * Resolve the promise with the given value.
545
+ * @param value the value to resolve the promise with
546
+ */
547
+ resolve(value?: T): Promise<void>;
548
+ /**
549
+ * Reject the promise with the given error message.
550
+ * @param errorMsg the error message to use for rejection.
551
+ */
552
+ reject(errorMsg: string): Promise<void>;
553
+ /**
554
+ * Obtain a {@link CombineablePromise} variant of this promise.
555
+ */
556
+ get(): CombineablePromise<T>;
557
+ };
558
+ export interface WorkflowSharedContext<TState extends TypedState = UntypedState> extends ObjectSharedContext<TState>, RestateWorkflowSharedContext {
559
+ /**
560
+ * Create a durable promise that can be resolved or rejected during the workflow execution.
561
+ * The promise is bound to the workflow and will be persisted across suspensions and retries.
562
+ *
563
+ * @example
564
+ * ```ts
565
+ * const wf = restate.workflow({
566
+ * name: "myWorkflow",
567
+ * handlers: {
568
+ * run: async (ctx: restate.WorkflowContext) => {
569
+ * // ... do some work ...
570
+ * const payment = await ctx.promise<Payment>("payment.succeeded");
571
+ * // ... do some more work ...
572
+ * },
573
+ *
574
+ * onPaymentSucceeded: async (ctx: restate.WorkflowContext, payment) => {
575
+ * // ... handle payment succeeded ...
576
+ * await ctx.promise("payment.succeeded").resolve(payment);
577
+ * }
578
+ * });
579
+ * ```
580
+ *
581
+ * @param name the name of the durable promise
582
+ */
583
+ promise<T>(name: string, serde?: Serde<T>): DurablePromise<T>;
584
+ }
585
+ export interface WorkflowContext<TState extends TypedState = UntypedState> extends WorkflowSharedContext<TState>, ObjectContext<TState>, RestateWorkflowContext {
586
+ }
587
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,sBAAsB,EACtB,4BAA4B,EAC5B,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,2BAA2B,EAC3B,QAAQ,EACR,sBAAsB,EACtB,KAAK,EACN,MAAM,8BAA8B,CAAC;AAGtC;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IAE5E;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAE1B;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;CAC/B;AAGD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC7C,MAAM,MAAM,YAAY,GAAG;IAAE,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAExC;;GAEG;AACH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