@restatedev/sessions 0.11.2 → 0.12.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.
Files changed (96) hide show
  1. package/README.md +330 -178
  2. package/dist/addon.d.ts +1 -0
  3. package/dist/addon.d.ts.map +1 -1
  4. package/dist/addon.js.map +1 -1
  5. package/dist/calls.d.ts +28 -28
  6. package/dist/calls.d.ts.map +1 -1
  7. package/dist/calls.js +25 -25
  8. package/dist/calls.js.map +1 -1
  9. package/dist/database.d.ts +90 -166
  10. package/dist/database.d.ts.map +1 -1
  11. package/dist/database.js +137 -249
  12. package/dist/database.js.map +1 -1
  13. package/dist/driver.d.ts +129 -126
  14. package/dist/driver.d.ts.map +1 -1
  15. package/dist/driver.js +337 -276
  16. package/dist/driver.js.map +1 -1
  17. package/dist/endpoint.d.ts +47 -5
  18. package/dist/endpoint.d.ts.map +1 -1
  19. package/dist/endpoint.js +175 -60
  20. package/dist/endpoint.js.map +1 -1
  21. package/dist/handler.d.ts +20 -17
  22. package/dist/handler.d.ts.map +1 -1
  23. package/dist/handler.js +161 -127
  24. package/dist/handler.js.map +1 -1
  25. package/dist/host.d.ts +29 -0
  26. package/dist/host.d.ts.map +1 -0
  27. package/dist/host.js +2 -0
  28. package/dist/host.js.map +1 -0
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +5 -26
  32. package/dist/index.js.map +1 -1
  33. package/dist/internal.d.ts +11 -11
  34. package/dist/internal.d.ts.map +1 -1
  35. package/dist/internal.js +20 -16
  36. package/dist/internal.js.map +1 -1
  37. package/dist/link.d.ts +1 -2
  38. package/dist/link.d.ts.map +1 -1
  39. package/dist/link.js +4 -5
  40. package/dist/link.js.map +1 -1
  41. package/dist/log.d.ts +14 -0
  42. package/dist/log.d.ts.map +1 -0
  43. package/dist/log.js +21 -0
  44. package/dist/log.js.map +1 -0
  45. package/dist/object.d.ts +217 -142
  46. package/dist/object.d.ts.map +1 -1
  47. package/dist/object.js +195 -241
  48. package/dist/object.js.map +1 -1
  49. package/dist/platform.d.ts +0 -1
  50. package/dist/platform.d.ts.map +1 -1
  51. package/dist/platform.js +4 -6
  52. package/dist/platform.js.map +1 -1
  53. package/dist/schema.d.ts +14 -22
  54. package/dist/schema.d.ts.map +1 -1
  55. package/dist/schema.js +31 -69
  56. package/dist/schema.js.map +1 -1
  57. package/dist/serve.d.ts +11 -17
  58. package/dist/serve.d.ts.map +1 -1
  59. package/dist/serve.js +21 -39
  60. package/dist/serve.js.map +1 -1
  61. package/dist/session.d.ts +58 -240
  62. package/dist/session.d.ts.map +1 -1
  63. package/dist/session.js +206 -532
  64. package/dist/session.js.map +1 -1
  65. package/dist/stop.d.ts +59 -0
  66. package/dist/stop.d.ts.map +1 -0
  67. package/dist/stop.js +220 -0
  68. package/dist/stop.js.map +1 -0
  69. package/dist/vm.d.ts +108 -29
  70. package/dist/vm.d.ts.map +1 -1
  71. package/dist/vm.js +43 -10
  72. package/dist/vm.js.map +1 -1
  73. package/package.json +4 -4
  74. package/src/addon.ts +1 -0
  75. package/src/calls.ts +51 -47
  76. package/src/database.ts +195 -339
  77. package/src/driver.ts +379 -315
  78. package/src/endpoint.ts +217 -62
  79. package/src/handler.ts +183 -164
  80. package/src/host.ts +28 -0
  81. package/src/index.ts +6 -26
  82. package/src/internal.ts +28 -39
  83. package/src/link.ts +4 -5
  84. package/src/log.ts +42 -0
  85. package/src/object.ts +379 -335
  86. package/src/platform.ts +4 -6
  87. package/src/schema.ts +37 -103
  88. package/src/serve.ts +20 -41
  89. package/src/session.ts +236 -629
  90. package/src/stop.ts +225 -0
  91. package/src/vm.ts +151 -55
  92. package/dist/scope.d.ts +0 -38
  93. package/dist/scope.d.ts.map +0 -1
  94. package/dist/scope.js +0 -55
  95. package/dist/scope.js.map +0 -1
  96. package/src/scope.ts +0 -78
package/dist/handler.js CHANGED
@@ -1,71 +1,98 @@
1
- // Serving one invocation of a session object's handler on the explicit
2
- // recovery VM (`driver.ts`), rather than through the SDK's journaled context,
3
- // which replays and would hold such a handler to one await at a time.
1
+ // Serving one attempt of a session object's handler on the explicit recovery
2
+ // protocol (`driver.ts`), rather than through the SDK's journaled context.
4
3
  //
5
4
  // The core takes a stream — the request's headers and body, and where to write
6
- // the response — so that a test can drive it with wire bytes and `serve.ts`
5
+ // the response — so that a test can drive it with wire bytes and `endpoint.ts`
7
6
  // can hand it an HTTP/2 one. It is reached only for a session object's
8
7
  // handler; everything else a deployment serves stays the SDK's.
9
8
  import * as restate from '@restatedev/restate-sdk';
10
9
  import { millisOrDurationToMillis } from '@restatedev/restate-sdk-core';
11
- import { AttemptDriver, AttemptFailed, AttemptShutDown } from './driver.js';
10
+ import { AttemptDriver, AttemptFailed, AttemptShutDown, quiet } from './driver.js';
11
+ import { silent } from './log.js';
12
12
  import { handlerEntry, invoke } from './object.js';
13
- import { Vm } from './vm.js';
14
- /** The lowest service protocol version the VM accepts; the SDK serves anything below. */
15
- export const MIN_PROTOCOL = 7;
13
+ import { refusedStatus, Vm } from './vm.js';
14
+ /** The content type of the explicit recovery protocol's invocations, version 1. */
15
+ export const CONTENT_TYPE = 'application/vnd.restate.invocation.explicitrecovery.v1';
16
16
  /**
17
- * Whether this package serves `headers`' invocation, or the SDK does. The VM
18
- * accepts the service protocol V7 and V8 only.
19
- *
20
- * A Restate that speaks less once reached the SDK's VM through the selector.
21
- * That is gone, and a session object cannot run on a VM that replays, so an
22
- * older server cannot serve one at all: `endpoint.ts` answers such an
23
- * invocation itself rather than handing it on. Everything that is not a
24
- * session object is still the SDK's at any version it supports.
17
+ * How long the response waits, after the attempt's last message, for Restate
18
+ * to close the request: Restate closes first, then the attempt (D35). One
19
+ * that never does is closed anyway.
25
20
  */
26
- export function servedHere(headers) {
27
- const type = headers['content-type'];
28
- const match = /application\/vnd\.restate\.invocation\.v(\d+)/.exec((Array.isArray(type) ? type[0] : type) ?? '');
29
- return match !== null && Number(match[1]) >= MIN_PROTOCOL;
30
- }
21
+ export const CLOSE_TIMEOUT_MS = 30_000;
31
22
  /** `headers` as the VM takes them. */
32
23
  function vmHeaders(headers) {
33
24
  return Object.entries(headers).flatMap(([key, value]) => value === undefined ? [] : [{ key, value: Array.isArray(value) ? (value[0] ?? '') : value }]);
34
25
  }
26
+ /** The attempts this process is serving, with what closes each one's response: a SIGTERM ends them (`goAway`). */
27
+ const live = new Map();
28
+ /**
29
+ * The process is going away: end every attempt it serves with an unasked
30
+ * `ShutdownMessage` and close its response at once; Restate starts each
31
+ * again, elsewhere. Returns how many there were.
32
+ */
33
+ export function goAway() {
34
+ const attempts = [...live];
35
+ for (const [driver, close] of attempts) {
36
+ driver.goAway();
37
+ close();
38
+ }
39
+ return attempts.length;
40
+ }
35
41
  /**
36
42
  * Run one attempt of `definition`'s handler `name` over `stream`, and end its
37
- * response. `bidirectional` is false on a request/response transport, which
38
- * cannot serve such a handler: the VM fails the invocation at once, pausing
39
- * it, since no response could reach it.
43
+ * response. A request of another protocol family or version is answered with
44
+ * the status the VM refuses it with (415), and nothing runs. `log` gets a
45
+ * line for that refusal, for an attempt that fails and is retried, and for
46
+ * one the VM failed (a protocol failure): the error's message, never the
47
+ * input or a header.
40
48
  */
41
- export async function serveSession(definition, name, stream, { bidirectional = true } = {}) {
42
- const entry = handlerEntry(definition, name);
49
+ export async function serveSession(definition, name, stream, defaults = {}, log = silent) {
50
+ const entry = handlerEntry(definition, name, defaults);
43
51
  if (entry === undefined)
44
52
  throw new Error(`${definition.name}/${name} is no handler or view of a session object`);
45
- const vm = new Vm(vmHeaders(stream.headers), bidirectional);
53
+ let vm;
54
+ try {
55
+ vm = new Vm(vmHeaders(stream.headers));
56
+ }
57
+ catch (error) {
58
+ const status = refusedStatus(error);
59
+ // Its text may quote a header: the caller logs what it throws.
60
+ if (status === undefined)
61
+ throw new Error('the VM could not start the invocation', { cause: error });
62
+ log('warn', `${definition.name}/${name}: answered ${status}: the request is not on the explicit recovery protocol, version 1`);
63
+ // Not a 500: Restate offers the next lower version of its range on a 415.
64
+ stream.writeHead(status, {});
65
+ stream.close();
66
+ return;
67
+ }
46
68
  const head = vm.getResponseHead();
47
69
  stream.writeHead(head.statusCode, Object.fromEntries(head.headers.map(({ key, value }) => [key, value])));
48
70
  const driver = new AttemptDriver(vm, (chunk) => stream.write(chunk), {
49
71
  service: definition.name,
50
72
  handler: name,
51
- shared: entry.view,
52
73
  explicitCancellation: entry.explicit,
74
+ inactivityTimeoutMs: entry.inactivityTimeoutMs,
53
75
  });
54
76
  // The database's store acts on the VM from the runtime's thread, in the
55
77
  // addon; this is how it asks for the tick that writes what it sent.
56
78
  vm.setScheduler(() => driver.scheduleTick());
57
- // The response ends with the attempt, once the tick wrote its last words:
58
- // not when the handler returns. Restate starts the next attempt only once
59
- // it has, and a handler that Restate shut down at work of its own (outside
60
- // `ctx.working`) runs on until that work is done, its actions throwing.
79
+ // The response closes once the attempt's last message is written and the
80
+ // runtime closed its side (it closes first), or when the process goes
81
+ // away: not when the handler returns. A handler that Restate shut down at
82
+ // work of its own (outside `ctx.working`) runs on until that work is done,
83
+ // its actions throwing.
61
84
  let closed = false;
85
+ const whenClosed = Promise.withResolvers();
62
86
  const close = () => {
63
87
  if (closed)
64
88
  return;
65
89
  closed = true;
90
+ live.delete(driver);
66
91
  stream.close();
92
+ whenClosed.resolve();
67
93
  };
68
- driver.whenEnded(() => setTimeout(close, 0));
94
+ live.set(driver, close);
95
+ driver.whenClosable(close);
69
96
  // The input pump: the only reader of the request body. It runs until the
70
97
  // body ends, beside the handler.
71
98
  const ready = Promise.withResolvers();
@@ -87,6 +114,7 @@ export async function serveSession(definition, name, stream, { bidirectional = t
87
114
  ready.resolve();
88
115
  }
89
116
  })();
117
+ let invocation;
90
118
  try {
91
119
  await ready.promise;
92
120
  if (driver.over !== undefined || !driver.isReadyToExecute())
@@ -95,81 +123,119 @@ export async function serveSession(definition, name, stream, { bidirectional = t
95
123
  // either: a terminal failure ends the invocation, where a retryable one
96
124
  // would have Restate send the same bytes forever. The SDK's own handler
97
125
  // does the same for input its journal codec cannot decode.
98
- let input;
99
- try {
100
- input = entry.inputSerde.deserialize(driver.body);
101
- }
102
- catch (error) {
103
- throw new restate.TerminalError(`failed to deserialize the input: ${error.message}`, {
104
- errorCode: 400,
105
- });
106
- }
107
- const output = await invoke(definition, name, contextOf(driver, stream.headers, vm), input);
126
+ const request = driver.request(new Map(Object.entries(stream.headers)));
127
+ invocation = { id: request.id, service: definition.name, handler: name };
128
+ let output;
129
+ // The hooks' handler interceptors wrap all of it, as the SDK's do.
130
+ await intercepted(entry.hooks, request)(async () => {
131
+ let input;
132
+ try {
133
+ input = entry.inputSerde.deserialize(driver.body);
134
+ }
135
+ catch (error) {
136
+ throw new restate.TerminalError(`failed to deserialize the input: ${error.message}`, {
137
+ errorCode: 400,
138
+ });
139
+ }
140
+ output = entry.outputSerde.serialize(await invoke(definition, name, hostOf(driver, request, vm), input, entry));
141
+ });
108
142
  // A cancellation that arrived while the handler ran is still cancelling
109
143
  // its calls: they go out before the attempt ends, or not at all.
110
144
  await driver.cancellingCalls;
111
- driver.endSuccess(entry.outputSerde.serialize(output));
145
+ driver.endSuccess(output);
112
146
  }
113
147
  catch (error) {
114
148
  await driver.cancellingCalls;
115
- endWith(driver, error, entry.asTerminalError);
149
+ endWith(driver, error, entry.asTerminalError, (message) => log('warn', message, invocation));
116
150
  }
117
151
  finally {
118
- await pump;
119
- // The attempt's last words are buffered: a turn lets the tick write them.
152
+ if (driver.over instanceof AttemptFailed)
153
+ log('warn', `the attempt failed: ${driver.over.message}`, invocation);
154
+ // The attempt's last words are buffered: a turn lets the tick write them,
155
+ // and the response closes once Restate closed the request too.
120
156
  await new Promise((resolve) => setTimeout(resolve, 0));
157
+ if (!closed) {
158
+ const timeout = setTimeout(close, CLOSE_TIMEOUT_MS);
159
+ timeout.unref?.();
160
+ await Promise.race([pump, whenClosed.promise]);
161
+ // The end of the input reached the VM: the tick that follows closes.
162
+ await new Promise((resolve) => setTimeout(resolve, 0));
163
+ driver.scheduleTick();
164
+ await new Promise((resolve) => setTimeout(resolve, 0));
165
+ // Restate closed the request, and the VM has no last message to write:
166
+ // it was shut down before it started, say. Nothing more will come.
167
+ if (!closed && driver.over !== undefined)
168
+ close();
169
+ clearTimeout(timeout);
170
+ }
121
171
  close();
122
172
  }
123
173
  }
124
- /** End the attempt the way `error` says to. */
125
- function endWith(driver, error, asTerminalError) {
174
+ /** What the SDK's hook context carries for its own instrumentation: whether the invocation is past replay. */
175
+ const IS_PROCESSING = Symbol.for('@restatedev/restate-sdk/hooks.isProcessing');
176
+ /**
177
+ * Run an attempt inside the `handler` interceptors of `hooks`, the first
178
+ * outermost, as the SDK does (`startUserHandler`, `composeInterceptors`):
179
+ * each provider is called once per attempt with the request. An interceptor
180
+ * and its `next()` reject with what ended the attempt once it ends (a
181
+ * shutdown, say), so that none waits on a function that may never return,
182
+ * as the SDK's `raceWithAttemptEnd` does. A session object's context has no
183
+ * `ctx.run`, so a `run` interceptor is never called, and an attempt is never
184
+ * a replay.
185
+ */
186
+ function intercepted(hooks, request) {
187
+ const interceptors = hooks.flatMap((provider) => {
188
+ const context = { request };
189
+ Object.defineProperty(context, IS_PROCESSING, { value: () => true, enumerable: false });
190
+ const handler = provider(context).interceptor?.handler;
191
+ return handler === undefined ? [] : [handler];
192
+ });
193
+ if (interceptors.length === 0)
194
+ return (run) => run();
195
+ const signal = request.attemptCompletedSignal;
196
+ const ended = new Promise((_, reject) => {
197
+ if (signal.aborted)
198
+ reject(signal.reason);
199
+ else
200
+ signal.addEventListener('abort', () => reject(signal.reason), { once: true });
201
+ });
202
+ ended.catch(() => { });
203
+ const racing = (promise) => Promise.race([promise, ended]);
204
+ return (run) => interceptors.reduceRight((next, interceptor) => () => racing(interceptor(() => racing(next()))), run)();
205
+ }
206
+ /**
207
+ * End the attempt the way `error` says to. The `asTerminalError` option
208
+ * applies as the SDK applies it (`ensureError`, `notifyError`): what it
209
+ * returns takes the error's place, and ends the invocation if it is a
210
+ * `TerminalError`; anything else fails the attempt, and Restate retries it.
211
+ */
212
+ function endWith(driver, error, asTerminalError, retried) {
126
213
  if (error instanceof AttemptShutDown)
127
214
  return; // the attempt is over; nothing more is sent
128
- // The handler option of the same name: an error it names ends the
129
- // invocation rather than being retried. The SDK applies it, so this does.
130
- if (asTerminalError !== undefined && !(error instanceof restate.TerminalError)) {
131
- const terminal = asTerminalError(error);
132
- if (terminal !== undefined) {
133
- driver.endFailure(terminal instanceof restate.TerminalError ? terminal : new restate.TerminalError(terminal.message));
134
- return;
135
- }
136
- }
137
- if (error instanceof restate.TerminalError) {
138
- driver.endFailure(error);
139
- return;
140
- }
141
215
  if (error instanceof AttemptFailed)
142
216
  return; // the VM wrote why
143
- const retryable = error;
144
- const thrown = error instanceof Error ? error : new Error(String(error));
145
- driver.fail(thrown.message, thrown.stack, retryable.retryAfter);
217
+ const mapped = error instanceof restate.TerminalError ? error : asTerminalError?.(error) || error;
218
+ if (mapped instanceof restate.TerminalError) {
219
+ driver.endFailure(mapped);
220
+ return;
221
+ }
222
+ const { retryAfter } = mapped;
223
+ const thrown = mapped instanceof Error ? mapped : new Error(String(mapped));
224
+ // The VM takes a whole number of milliseconds.
225
+ const delay = retryAfter === undefined ? undefined : Math.round(millisOrDurationToMillis(retryAfter));
226
+ retried(`the handler failed, and Restate retries it${delay === undefined ? '' : ` in ${delay} ms`}: ${thrown.name}: ${thrown.message}`);
227
+ driver.fail(thrown.message, thrown.stack, delay);
146
228
  }
147
- /**
148
- * What `invoke` needs of a handler's context, over `driver`: the members of
149
- * the SDK's that a session object's attempt uses, and no others.
150
- */
151
- function contextOf(driver, attemptHeaders, vm) {
152
- const headers = new Map(Object.entries(attemptHeaders));
153
- const request = driver.request(headers);
154
- /** The attempt's end, as `invocationEndPromise` gives it: a promise that rejects. */
155
- const ending = Promise.withResolvers();
156
- ending.promise.catch(() => { });
157
- driver.whenEnded(() => ending.reject(driver.over ?? new AttemptShutDown()));
158
- const context = {
229
+ /** The attempt over `driver`, as a session object handler sees it (object.ts). */
230
+ function hostOf(driver, request, vm) {
231
+ return {
159
232
  key: driver.key,
160
- request: () => request,
161
- // The object's state is the addon's: it reads and writes it as the VM's
162
- // own commands, so nothing of it is implemented here. A session opened on
163
- // a VM never asks (see `commitOnly` in `session.ts`); anything else that
164
- // does is a mistake, and says so.
165
- get: servedByVm('get'),
166
- set: servedByVm('set'),
167
- clear: servedByVm('clear'),
168
- stateKeys: servedByVm('stateKeys'),
169
- run: () => {
170
- throw new restate.TerminalError('a session object has no ctx.run: put journaled work in a restate.object, service or workflow, and call it with ctx.rpc');
171
- },
172
- genericCall: (call) => {
233
+ request,
234
+ stop: driver.stop,
235
+ // The addon reads and writes the object state on the VM (see `openOnVm`).
236
+ vm,
237
+ driver,
238
+ call: (call) => {
173
239
  const { result, invocationId } = driver.call({
174
240
  service: call.service,
175
241
  handler: call.method,
@@ -178,54 +244,22 @@ function contextOf(driver, attemptHeaders, vm) {
178
244
  idempotencyKey: call.idempotencyKey,
179
245
  headers: Object.entries(call.headers ?? {}).map(([key, value]) => ({ key, value })),
180
246
  });
181
- // Marked handled: `start()` awaits only the invocation id, so nothing
182
- // holds this, and it rejects when the callee fails, on a cancellation,
183
- // and at the end of every attempt — including a successful one.
247
+ // Marked handled: a handler need not await a call (a lost race), and it
248
+ // rejects at the end of every attempt, even a successful one.
184
249
  const answered = quiet(result.then((value) => (call.outputSerde ?? restate.serde.json).deserialize(value ?? new Uint8Array())));
185
250
  return Object.assign(answered, { invocationId });
186
251
  },
187
- genericSend: (send) => void driver.send({
252
+ send: (send) => driver.send({
188
253
  service: send.service,
189
254
  handler: send.method,
190
255
  key: send.key,
191
256
  input: (send.inputSerde ?? restate.serde.json).serialize(send.parameter),
192
- // `SendOptions.delay` is milliseconds or a `Duration`; the VM takes
193
- // milliseconds.
257
+ // The VM takes milliseconds.
194
258
  delay: send.delay === undefined ? undefined : millisOrDurationToMillis(send.delay),
195
259
  idempotencyKey: send.idempotencyKey,
196
260
  headers: Object.entries(send.headers ?? {}).map(([key, value]) => ({ key, value })),
197
261
  }),
198
- invocation: (invocationId) => ({
199
- cancel: () => driver.cancel(String(invocationId)),
200
- attach: (serde) => quiet(driver
201
- .attach(String(invocationId))
202
- .then((value) => (serde ?? restate.serde.json).deserialize(value ?? new Uint8Array()))),
203
- }),
204
- cancellation: () => driver.cancellation(),
205
- // A cancellation owed to the handler's next await, which a call of its
206
- // database takes before it issues anything (`session.ts`).
207
- takeCancellation: () => driver.takeCarriedCancellation(),
208
- cancelPreviousCalls: () => driver.cancelPreviousCalls(),
209
- // What `ctx.working` keeps alive, and the database's own calls too (`session.ts`).
210
- working: (fn) => driver.working(fn),
211
- invocationEndPromise: { promise: ending.promise },
212
- defaultSerde: restate.serde.json,
213
- // The addon reads and writes the object's state on this, rather than
214
- // calling back into JavaScript for every page (see `openOnVm`).
215
- vm,
262
+ cancel: (invocationId) => driver.cancel(invocationId),
216
263
  };
217
- return context;
218
- }
219
- /**
220
- * Mark a promise handled, so that one the handler never awaits does not bring
221
- * the process down when the attempt ends. The caller still sees the rejection.
222
- */
223
- function quiet(promise) {
224
- promise.catch(() => { });
225
- return promise;
226
264
  }
227
- /** What a state member of the context does if anything calls it. */
228
- const servedByVm = (of) => () => {
229
- throw new restate.TerminalError(`@restatedev/sessions: the VM serves the object's state in the addon; ctx.${of} is not called`);
230
- };
231
265
  //# sourceMappingURL=handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.js","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,8EAA8E;AAC9E,sEAAsE;AACtE,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,uEAAuE;AACvE,gEAAgE;AAChE,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAc,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,E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AAI,CAAC;YACV,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,CAAC,IAAI,CAAC,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;YACxE,6BAA6B;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC;YAClF,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;SACpF,CAAC;QACJ,MAAM,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;KACtD,CAAC;AACJ,CAAC"}
package/dist/host.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import type * as restate from '@restatedev/restate-sdk';
2
+ import type { Store } from './database.ts';
3
+ import type { AttemptDriver } from './driver.ts';
4
+ import type { SessionRequest } from './object.ts';
5
+ import type { Stop } from './stop.ts';
6
+ import type { Vm } from './vm.ts';
7
+ /** What one attempt runs on: the driver over its VM (handler.ts), or a test's fake (test/support.ts). */
8
+ export interface AttemptHost {
9
+ readonly key: string;
10
+ /** Its `attemptCompletedSignal` aborts, with the error that ended it, when the attempt ends. */
11
+ readonly request: SessionRequest;
12
+ /** See stop.ts. */
13
+ readonly stop: Stop;
14
+ /** The addon reads and writes the object state on it. A test gives `store` instead. */
15
+ readonly vm?: Vm;
16
+ /** The object's state in JavaScript, for an attempt without a VM (tests). */
17
+ readonly store?: Store;
18
+ /**
19
+ * The attempt's driver, on the VM: spans, and what the protocol adds beyond
20
+ * calls and sends (invocation state, signals, flush). A test's has none.
21
+ */
22
+ readonly driver?: AttemptDriver;
23
+ call(call: restate.GenericCall<unknown, unknown>): Promise<unknown> & {
24
+ invocationId: Promise<string>;
25
+ };
26
+ send(send: restate.GenericSend<unknown>): void;
27
+ cancel(invocationId: string): void;
28
+ }
29
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAElC,yGAAyG;AACzG,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gGAAgG;IAChG,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjB,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG;QAAE,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;IACxG,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/C,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC"}
package/dist/host.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from '@restatedev/restate-sdk';
2
2
  export type { Database, DatabaseReader, DatabaseWriter, Row, SqlParam, SqlValue, Transaction } from './session.ts';
3
3
  export type { Step } from './schema.ts';
4
- export { sessionObject, type Cancel, type Entry, type HandlerOptions, type SessionContext, type ViewContext, } from './object.ts';
4
+ export { sessionObject, type Cancel, type Entry, type HandlerOptions, type SessionContext, type SessionRequest, type ViewContext, } from './object.ts';
5
5
  export type { CallOptions, Client, Rpc, Send, SendClient, SendOptions, Target } from './calls.ts';
6
6
  export { remote } from './calls.ts';
7
7
  export { connect, serve, served } from './serve.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,cAAc,yBAAyB,CAAC;AACxC,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnH,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,aAAa,EACb,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAElG,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAKpC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,yBAAyB,CAAC;AACxC,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnH,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,aAAa,EACb,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,33 +1,12 @@
1
1
  // Session objects: Restate virtual objects whose state is a SQL database per
2
- // key. It is the Restate SDK, with `restate.sessionObject` beside its own
3
- // objects, services and workflows:
4
- //
5
- // import * as restate from '@restatedev/sessions';
6
- //
7
- // const notes = restate.sessionObject({
8
- // name: 'notes',
9
- // schema: ['CREATE TABLE notes (text TEXT NOT NULL)'],
10
- // handlers: {
11
- // add: async (ctx, text: string) => {
12
- // await ctx.db.execute('INSERT INTO notes (text) VALUES (?)', [text]);
13
- // },
14
- // },
15
- // views: {
16
- // list: async (ctx) => ctx.db.query<{ text: string }>('SELECT text FROM notes'),
17
- // },
18
- // });
19
- //
2
+ // key. This module is the Restate SDK (`import * as restate from
3
+ // '@restatedev/sessions'`) plus `restate.sessionObject` (example in object.ts).
20
4
  // See README.md.
21
- // The SDK, and what this module adds to it (or declares in its place: its
22
- // `Client`, `SendClient` and `Target` are a session object's, and `serve`
23
- // takes the services, with what they need beside them).
5
+ // The SDK, plus additions. `Client`, `SendClient`, `Target`, `serve` and
6
+ // `connect` replace the SDK exports of the same name.
24
7
  export * from '@restatedev/restate-sdk';
25
8
  export { sessionObject, } from './object.js';
26
- // A handle on what another deployment serves: named and typed, not implemented here.
27
9
  export { remote } from './calls.js';
28
- // In place of the SDK's: the services, on PORT, with what they need beside
29
- // them; `connect`, the same for Restate Cloud (the SDK's own leaves them out);
30
- // and `served`, the services with what they need, for an endpoint of your own
31
- // — which runs them on the VM too (`endpoint.ts`).
10
+ // See serve.ts.
32
11
  export { connect, serve, served } from './serve.js';
33
12
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,mCAAmC;AACnC,EAAE;AACF,qDAAqD;AACrD,EAAE;AACF,0CAA0C;AAC1C,qBAAqB;AACrB,2DAA2D;AAC3D,kBAAkB;AAClB,4CAA4C;AAC5C,+EAA+E;AAC/E,WAAW;AACX,SAAS;AACT,eAAe;AACf,uFAAuF;AACvF,SAAS;AACT,QAAQ;AACR,EAAE;AACF,iBAAiB;AAEjB,0EAA0E;AAC1E,0EAA0E;AAC1E,wDAAwD;AACxD,cAAc,yBAAyB,CAAC;AAGxC,OAAO,EACL,aAAa,GAMd,MAAM,aAAa,CAAC;AAErB,qFAAqF;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,2EAA2E;AAC3E,+EAA+E;AAC/E,8EAA8E;AAC9E,mDAAmD;AACnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,iEAAiE;AACjE,gFAAgF;AAChF,iBAAiB;AAEjB,yEAAyE;AACzE,sDAAsD;AACtD,cAAc,yBAAyB,CAAC;AAGxC,OAAO,EACL,aAAa,GAOd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,gBAAgB;AAChB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC"}
@@ -1,14 +1,14 @@
1
1
  export * as sdk from '@restatedev/restate-sdk';
2
2
  export { ensureSchemas, Schema } from './schema.ts';
3
- export { asDatabase, lazyDatabase, database, reset, deferSql, undeferSql, rideCommit, flushRiders, Attempt, withAttempt, } from './session.ts';
4
- export type { ObjectConfig, SqlHost } from './session.ts';
5
- export { Link } from './link.ts';
6
- export { ScopeKey } from './scope.ts';
7
- export { open, type Connection, type Store, type ConnectionTransaction, type Working } from './database.ts';
8
- export { AttemptDriver, AttemptFailed, AttemptShutDown } from './driver.ts';
9
- export { Vm, isShutDown } from './vm.ts';
10
- export { serveSession, servedHere, type Stream } from './handler.ts';
11
- export { needing, served } from './serve.ts';
12
- export { invokeRoute, patchEndpoint } from './endpoint.ts';
13
- export { attach, cancelCalls, cancelled, configOf, contextOf, definitionOf, HEAD_KEY, invoke, start, withStoreWrapper, type AttemptContext, } from './object.ts';
3
+ export { asDatabase, lazyDatabase, database, Attempt } from './session.ts';
4
+ export { open, type Connection, type Store, type ConnectionTransaction, type Stoppable, type Suspendable, type Working, } from './database.ts';
5
+ export { AttemptDriver, AttemptShutDown } from './driver.ts';
6
+ export type { AttemptHost } from './host.ts';
7
+ export { locateScopes, type Scope, Stop } from './stop.ts';
8
+ export { Vm } from './vm.ts';
9
+ export { served } from './serve.ts';
10
+ export { configOf, contextOf, HEAD_KEY, invoke, openScope, withAttempt } from './object.ts';
11
+ export { goAway, CONTENT_TYPE } from './handler.ts';
12
+ export { manifestV6 } from './endpoint.ts';
13
+ export { invocationState, readSignal, sendSignal, flush, type InvocationState } from './object.ts';
14
14
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,GAAG,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,OAAO,EACP,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,KAAK,qBAAqB,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAE5G,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EACL,MAAM,EACN,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,KAAK,EAC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