@restatedev/sessions 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +131 -73
  2. package/dist/addon.d.ts +9 -0
  3. package/dist/addon.d.ts.map +1 -0
  4. package/dist/addon.js +20 -0
  5. package/dist/addon.js.map +1 -0
  6. package/dist/database.d.ts +13 -0
  7. package/dist/database.d.ts.map +1 -1
  8. package/dist/database.js +44 -17
  9. package/dist/database.js.map +1 -1
  10. package/dist/driver.d.ts +186 -0
  11. package/dist/driver.d.ts.map +1 -0
  12. package/dist/driver.js +554 -0
  13. package/dist/driver.js.map +1 -0
  14. package/dist/endpoint.d.ts +13 -0
  15. package/dist/endpoint.d.ts.map +1 -0
  16. package/dist/endpoint.js +186 -0
  17. package/dist/endpoint.js.map +1 -0
  18. package/dist/handler.d.ts +35 -0
  19. package/dist/handler.d.ts.map +1 -0
  20. package/dist/handler.js +218 -0
  21. package/dist/handler.js.map +1 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/internal.d.ts +4 -2
  26. package/dist/internal.d.ts.map +1 -1
  27. package/dist/internal.js +7 -3
  28. package/dist/internal.js.map +1 -1
  29. package/dist/object.d.ts +15 -2
  30. package/dist/object.d.ts.map +1 -1
  31. package/dist/object.js +51 -12
  32. package/dist/object.js.map +1 -1
  33. package/dist/serve.d.ts.map +1 -1
  34. package/dist/serve.js +5 -0
  35. package/dist/serve.js.map +1 -1
  36. package/dist/session.d.ts +32 -2
  37. package/dist/session.d.ts.map +1 -1
  38. package/dist/session.js +59 -9
  39. package/dist/session.js.map +1 -1
  40. package/dist/vm.d.ts +151 -0
  41. package/dist/vm.d.ts.map +1 -0
  42. package/dist/vm.js +28 -0
  43. package/dist/vm.js.map +1 -0
  44. package/package.json +4 -4
  45. package/src/addon.ts +29 -0
  46. package/src/database.ts +48 -19
  47. package/src/driver.ts +657 -0
  48. package/src/endpoint.ts +220 -0
  49. package/src/handler.ts +272 -0
  50. package/src/index.ts +2 -1
  51. package/src/internal.ts +7 -4
  52. package/src/object.ts +75 -13
  53. package/src/serve.ts +5 -0
  54. package/src/session.ts +77 -8
  55. package/src/vm.ts +195 -0
  56. package/dist/selector.d.ts +0 -129
  57. package/dist/selector.d.ts.map +0 -1
  58. package/dist/selector.js +0 -251
  59. package/dist/selector.js.map +0 -1
  60. package/src/selector.ts +0 -323
@@ -0,0 +1,186 @@
1
+ // Every invocation of a session object runs on the explicit recovery VM
2
+ // (`handler.ts`), whichever way its deployment is served.
3
+ //
4
+ // The SDK builds its own VM per invocation, and the dispatch that does it is
5
+ // module-private: there is no supported seam. What every transport does share
6
+ // is one class — `restate.endpoint()` returns a `NodeEndpoint`, and the tunnel
7
+ // behind `connect` builds `new NodeEndpoint()` of its own — and the request
8
+ // handler it hands out. So this wraps that class's four ways of producing one.
9
+ //
10
+ // It is a patch on another package's prototype, which is worth naming plainly.
11
+ // It touches four methods whose contract is "give me a request handler", and
12
+ // the handler it returns is the SDK's own for everything but a session
13
+ // object. The alternative it replaced was larger: reaching into five private
14
+ // fields of the SDK's promise executor to drive its VM by hand.
15
+ import * as http2 from 'node:http2';
16
+ import * as restate from '@restatedev/restate-sdk';
17
+ import { MIN_PROTOCOL, servedHere, serveSession } from './handler.js';
18
+ import { isSessionObject } from './object.js';
19
+ import { Identity } from './vm.js';
20
+ /** Marks the prototype this package has already wrapped. */
21
+ const PATCHED = Symbol.for('restate-sessions.endpoint-patched');
22
+ /** The session objects bound to `endpoint`, by name. */
23
+ function sessionsOf(endpoint) {
24
+ const bound = new Map();
25
+ for (const [name, definition] of endpoint.builder.serviceDefinitions) {
26
+ if (isSessionObject(definition))
27
+ bound.set(name, definition);
28
+ }
29
+ return bound;
30
+ }
31
+ /**
32
+ * What an endpoint with session objects cannot also have. Each would need a
33
+ * second way of running an attempt, and there is none any more.
34
+ */
35
+ function refuseWhatTheVmCannotServe(endpoint, sessions) {
36
+ if (sessions.size === 0)
37
+ return;
38
+ if (endpoint.builder.journalValueCodecProvider !== undefined) {
39
+ throw new Error('@restatedev/sessions: a journal value codec is not supported for session objects: ' +
40
+ 'their attempts are never replayed, and nothing of theirs is journaled to encode');
41
+ }
42
+ }
43
+ /** The request's headers, as the verifier takes them. */
44
+ function headersOf(headers) {
45
+ return Object.entries(headers).flatMap(([key, value]) => value === undefined ? [] : [{ key, value: Array.isArray(value) ? (value[0] ?? '') : value }]);
46
+ }
47
+ /** One invocation over HTTP/2, as {@link Stream}. */
48
+ function streamOf(request, response) {
49
+ return {
50
+ headers: request.headers,
51
+ body: request,
52
+ writeHead: (status, headers) => void response.writeHead(status, headers),
53
+ write: (chunk) => void response.write(chunk),
54
+ close: () => void response.end(),
55
+ };
56
+ }
57
+ /**
58
+ * The path of `url` and the route it names, as the SDK reads it: the last
59
+ * three fragments. Nothing if it names no invocation, or is no path at all —
60
+ * `//` is a URL with an empty host, which `URL` refuses. Restate sends none
61
+ * of those, but anything that reaches the port can, and this runs in the
62
+ * request listener, where a throw is an `uncaughtException`.
63
+ */
64
+ function parse(url) {
65
+ let path;
66
+ try {
67
+ path = new URL(url, 'http://invoke').pathname;
68
+ }
69
+ catch {
70
+ return undefined;
71
+ }
72
+ const parts = path.split('/');
73
+ if (parts.length < 3 || parts[parts.length - 3] !== 'invoke')
74
+ return undefined;
75
+ const service = parts[parts.length - 2];
76
+ const handler = parts[parts.length - 1];
77
+ return service === '' || handler === '' ? undefined : { path, service, handler };
78
+ }
79
+ /** The route of an invocation's path, as the SDK reads it. */
80
+ export function invokeRoute(url) {
81
+ const route = parse(url);
82
+ return route === undefined ? undefined : { service: route.service, handler: route.handler };
83
+ }
84
+ /**
85
+ * `sdk`, with a session object's invocations run on the VM instead. A request
86
+ * that is not one — discovery, the health check, a library's journaled objects
87
+ * — is the SDK's, unchanged.
88
+ */
89
+ function routing(endpoint, sdk, bidirectional) {
90
+ const sessions = sessionsOf(endpoint);
91
+ refuseWhatTheVmCannotServe(endpoint, sessions);
92
+ // The SDK verifies a request's signature in the handler this routes ahead
93
+ // of, so an invocation that goes to the VM is verified here instead. Every
94
+ // `connect` has keys: its key carries the signing key, and the SDK refuses
95
+ // one that does not.
96
+ const identity = endpoint.builder.keySet.length > 0 ? new Identity(endpoint.builder.keySet) : undefined;
97
+ return (request, response) => {
98
+ const route = sessions.size === 0 ? undefined : parse(request.url ?? '');
99
+ const definition = route === undefined ? undefined : sessions.get(route.service);
100
+ if (definition === undefined || route === undefined) {
101
+ sdk(request, response);
102
+ return;
103
+ }
104
+ const { path } = route;
105
+ // `null` is a verified request, as the addon answers `None` with: a
106
+ // deployment without keys verifies nothing, and stands for the same.
107
+ const unsigned = identity === undefined ? null : identity.verify(path, headersOf(request.headers));
108
+ if (unsigned !== null) {
109
+ // What the SDK answers, and the handler never runs.
110
+ response.writeHead(401, { 'content-type': 'text/plain' });
111
+ response.end('Unauthorized');
112
+ return;
113
+ }
114
+ // After the signature check, so that an unsigned request learns nothing
115
+ // about what is bound here: the SDK answers one 401 for anything.
116
+ if (!servedHere(request.headers)) {
117
+ // A session object on a Restate too old for the VM. Handing it to the
118
+ // SDK would run it on a VM that replays, which such a handler cannot
119
+ // use; it would be refused there for the wrong reason, naming endpoint
120
+ // types to someone whose endpoint is fine. Say which it is.
121
+ const type = request.headers['content-type'];
122
+ const spoken = /\.invocation\.(v\d+)/.exec((Array.isArray(type) ? type[0] : type) ?? '')?.[1] ?? 'none';
123
+ response.writeHead(415, { 'content-type': 'text/plain' });
124
+ response.end(`@restatedev/sessions: ${route.service}/${route.handler} is a session object, which runs on the ` +
125
+ `explicit recovery VM and needs Restate's service protocol v${MIN_PROTOCOL} or later; this ` +
126
+ `invocation negotiated ${spoken}. Upgrade the Restate server.`);
127
+ return;
128
+ }
129
+ serveSession(definition, route.handler, streamOf(request, response), {
130
+ bidirectional: bidirectional(request),
131
+ }).catch((error) => {
132
+ // The attempt could not be served at all: the VM wrote nothing.
133
+ if (!response.headersSent)
134
+ response.writeHead(500, { 'content-type': 'text/plain' });
135
+ response.end(error instanceof Error ? error.message : String(error));
136
+ });
137
+ };
138
+ }
139
+ /**
140
+ * Wrap the SDK's endpoint class, once per process, so that every request
141
+ * handler it hands out routes a session object's invocations to the VM.
142
+ * Called by {@link sessionObject}: the package declares `sideEffects: false`,
143
+ * so this cannot be the work of an import.
144
+ */
145
+ export function patchEndpoint() {
146
+ const prototype = Object.getPrototypeOf(restate.endpoint());
147
+ if (prototype[PATCHED] === true)
148
+ return;
149
+ const missing = ['handler', 'http2Handler', 'http1Handler', 'listen'].filter((method) => typeof prototype[method] !== 'function');
150
+ if (missing.length > 0) {
151
+ throw new Error(`@restatedev/sessions runs a session object's invocations by wrapping the SDK's endpoint, which this SDK ` +
152
+ `version does not have (${missing.join(', ')}): use the @restatedev/restate-sdk that @restatedev/sessions pins`);
153
+ }
154
+ // The SDK's own defaults: HTTP/2 is bidirectional unless told otherwise,
155
+ // HTTP/1.1 only when asked.
156
+ const wrap = (method, mode) => {
157
+ const original = prototype[method];
158
+ prototype[method] = function (options) {
159
+ const sdk = original.call(this, options);
160
+ return routing(this, sdk, (request) => mode(options?.bidirectional, request));
161
+ };
162
+ };
163
+ // `handler` dispatches per request, so the rule is the one for that
164
+ // request's protocol; a handler built for one protocol knows it already.
165
+ wrap('handler', (set, request) => ((request.httpVersionMajor ?? 2) >= 2 ? set !== false : set === true));
166
+ wrap('http2Handler', (set) => set !== false);
167
+ wrap('http1Handler', (set) => set === true);
168
+ // `listen` builds its server from the module's own handler, not from
169
+ // `http2Handler`, so wrapping it is building the server here.
170
+ prototype.listen = function (port) {
171
+ const chosen = port ?? Number(process.env.PORT ?? 9080);
172
+ const server = http2.createServer(this.http2Handler());
173
+ return new Promise((resolve, reject) => {
174
+ server.once('error', reject);
175
+ server.listen(chosen, () => {
176
+ const address = server.address();
177
+ if (address === null || typeof address === 'string')
178
+ reject(new TypeError('listen binds to a port'));
179
+ else
180
+ resolve(address.port);
181
+ });
182
+ });
183
+ };
184
+ prototype[PATCHED] = true;
185
+ }
186
+ //# sourceMappingURL=endpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0DAA0D;AAC1D,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,+EAA+E;AAC/E,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,gEAAgE;AAChE,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAGpC,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAiB,MAAM,SAAS,CAAC;AAElD,4DAA4D;AAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,mCAAmC,CAAsB,CAAC;AAerF,wDAAwD;AACxD,SAAS,UAAU,CAAC,QAAkB;IACpC,MAAM,KAAK,GAAG,IAAI,GAAG,EAA4B,CAAC;IAClD,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;QACrE,IAAI,eAAe,CAAC,UAAU,CAAC;YAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,UAA8B,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,SAAS,0BAA0B,CAAC,QAAkB,EAAE,QAA8B;IACpF,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO;IAChC,IAAI,QAAQ,CAAC,OAAO,CAAC,yBAAyB,KAAK,SAAS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AAC,IAAI,IAAI,IAAI,CAAC,CAAC;QACxD,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,EAAW,CAAC,CAAC;QAChE,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC7C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC7B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE;gBACzB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;oBAAE,MAAM,CAAC,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAC,CAAC;;oBAChG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** The lowest service protocol version the VM accepts; the SDK serves anything below. */
2
+ export declare const MIN_PROTOCOL = 7;
3
+ /** One invocation on the wire: what the core reads, and where it writes. */
4
+ export interface Stream {
5
+ readonly headers: Readonly<Record<string, string | string[] | undefined>>;
6
+ /** The request body, which only the input pump reads. */
7
+ readonly body: AsyncIterable<Uint8Array>;
8
+ writeHead(status: number, headers: Record<string, string>): void;
9
+ write(chunk: Uint8Array): void;
10
+ /** The response body ends. */
11
+ close(): void;
12
+ }
13
+ /**
14
+ * Whether this package serves `headers`' invocation, or the SDK does. The VM
15
+ * accepts the service protocol V7 and V8 only.
16
+ *
17
+ * A Restate that speaks less once reached the SDK's VM through the selector.
18
+ * That is gone, and a session object cannot run on a VM that replays, so an
19
+ * older server cannot serve one at all: `endpoint.ts` answers such an
20
+ * invocation itself rather than handing it on. Everything that is not a
21
+ * session object is still the SDK's at any version it supports.
22
+ */
23
+ export declare function servedHere(headers: Readonly<Record<string, string | string[] | undefined>>): boolean;
24
+ /**
25
+ * Run one attempt of `definition`'s handler `name` over `stream`, and end its
26
+ * response. `bidirectional` is false on a request/response transport, which
27
+ * cannot serve such a handler: the VM fails the invocation at once, pausing
28
+ * it, since no response could reach it.
29
+ */
30
+ export declare function serveSession(definition: {
31
+ name: string;
32
+ }, name: string, stream: Stream, { bidirectional }?: {
33
+ bidirectional?: boolean | undefined;
34
+ }): Promise<void>;
35
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAcA,yFAAyF;AACzF,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B,4EAA4E;AAC5E,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;IAC1E,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACjE,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,8BAA8B;IAC9B,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,GAAG,OAAO,CAIpG;AASD;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,EAAE,aAAoB,EAAE;;CAAK,GAC5B,OAAO,CAAC,IAAI,CAAC,CAmEf"}
@@ -0,0 +1,218 @@
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.
4
+ //
5
+ // 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`
7
+ // can hand it an HTTP/2 one. It is reached only for a session object's
8
+ // handler; everything else a deployment serves stays the SDK's.
9
+ import * as restate from '@restatedev/restate-sdk';
10
+ import { millisOrDurationToMillis } from '@restatedev/restate-sdk-core';
11
+ import { AttemptDriver, AttemptFailed, AttemptShutDown } from './driver.js';
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;
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.
25
+ */
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
+ }
31
+ /** `headers` as the VM takes them. */
32
+ function vmHeaders(headers) {
33
+ return Object.entries(headers).flatMap(([key, value]) => value === undefined ? [] : [{ key, value: Array.isArray(value) ? (value[0] ?? '') : value }]);
34
+ }
35
+ /**
36
+ * 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.
40
+ */
41
+ export async function serveSession(definition, name, stream, { bidirectional = true } = {}) {
42
+ const entry = handlerEntry(definition, name);
43
+ if (entry === undefined)
44
+ throw new Error(`${definition.name}/${name} is no handler or view of a session object`);
45
+ const vm = new Vm(vmHeaders(stream.headers), bidirectional);
46
+ const head = vm.getResponseHead();
47
+ stream.writeHead(head.statusCode, Object.fromEntries(head.headers.map(({ key, value }) => [key, value])));
48
+ const driver = new AttemptDriver(vm, (chunk) => stream.write(chunk), {
49
+ service: definition.name,
50
+ handler: name,
51
+ shared: entry.view,
52
+ explicitCancellation: entry.explicit,
53
+ });
54
+ // The database's store acts on the VM from the runtime's thread, in the
55
+ // addon; this is how it asks for the tick that writes what it sent.
56
+ vm.setScheduler(() => driver.scheduleTick());
57
+ // The input pump: the only reader of the request body. It runs until the
58
+ // body ends, beside the handler.
59
+ const ready = Promise.withResolvers();
60
+ ready.promise.catch(() => { });
61
+ const pump = (async () => {
62
+ try {
63
+ for await (const chunk of stream.body) {
64
+ driver.notifyInput(chunk);
65
+ if (driver.isReadyToExecute())
66
+ ready.resolve();
67
+ }
68
+ }
69
+ catch {
70
+ // The peer went away; the end of the body says the same.
71
+ }
72
+ finally {
73
+ driver.notifyInputClosed();
74
+ // Ready or not, nothing more is coming.
75
+ ready.resolve();
76
+ }
77
+ })();
78
+ try {
79
+ await ready.promise;
80
+ if (driver.over !== undefined || !driver.isReadyToExecute())
81
+ return;
82
+ driver.startHeartbeats();
83
+ // Input this handler cannot read will not read on the next attempt
84
+ // either: a terminal failure ends the invocation, where a retryable one
85
+ // would have Restate send the same bytes forever. The SDK's own handler
86
+ // does the same for input its journal codec cannot decode.
87
+ let input;
88
+ try {
89
+ input = entry.inputSerde.deserialize(driver.body);
90
+ }
91
+ catch (error) {
92
+ throw new restate.TerminalError(`failed to deserialize the input: ${error.message}`, {
93
+ errorCode: 400,
94
+ });
95
+ }
96
+ const output = await invoke(definition, name, contextOf(driver, stream.headers, vm), input);
97
+ // A cancellation that arrived while the handler ran is still cancelling
98
+ // its calls: they go out before the attempt ends, or not at all.
99
+ await driver.cancellingCalls;
100
+ driver.endSuccess(entry.outputSerde.serialize(output));
101
+ }
102
+ catch (error) {
103
+ await driver.cancellingCalls;
104
+ endWith(driver, error, entry.asTerminalError);
105
+ }
106
+ finally {
107
+ await pump;
108
+ // The attempt's last words are buffered: a turn lets the tick write them.
109
+ await new Promise((resolve) => setTimeout(resolve, 0));
110
+ stream.close();
111
+ }
112
+ }
113
+ /** End the attempt the way `error` says to. */
114
+ function endWith(driver, error, asTerminalError) {
115
+ if (error instanceof AttemptShutDown)
116
+ return; // the attempt is over; nothing more is sent
117
+ // The handler option of the same name: an error it names ends the
118
+ // invocation rather than being retried. The SDK applies it, so this does.
119
+ if (asTerminalError !== undefined && !(error instanceof restate.TerminalError)) {
120
+ const terminal = asTerminalError(error);
121
+ if (terminal !== undefined) {
122
+ driver.endFailure(terminal instanceof restate.TerminalError ? terminal : new restate.TerminalError(terminal.message));
123
+ return;
124
+ }
125
+ }
126
+ if (error instanceof restate.TerminalError) {
127
+ driver.endFailure(error);
128
+ return;
129
+ }
130
+ if (error instanceof AttemptFailed)
131
+ return; // the VM wrote why
132
+ const retryable = error;
133
+ const thrown = error instanceof Error ? error : new Error(String(error));
134
+ driver.fail(thrown.message, thrown.stack, retryable.retryAfter);
135
+ }
136
+ /**
137
+ * What `invoke` needs of a handler's context, over `driver`: the members of
138
+ * the SDK's that a session object's attempt uses, and no others.
139
+ */
140
+ function contextOf(driver, attemptHeaders, vm) {
141
+ const headers = new Map(Object.entries(attemptHeaders));
142
+ const request = driver.request(headers);
143
+ /** The attempt's end, as `invocationEndPromise` gives it: a promise that rejects. */
144
+ const ending = Promise.withResolvers();
145
+ ending.promise.catch(() => { });
146
+ driver.whenEnded(() => ending.reject(driver.over ?? new AttemptShutDown()));
147
+ const context = {
148
+ key: driver.key,
149
+ request: () => request,
150
+ // The object's state is the addon's: it reads and writes it as the VM's
151
+ // own commands, so nothing of it is implemented here. A session opened on
152
+ // a VM never asks (see `commitOnly` in `session.ts`); anything else that
153
+ // does is a mistake, and says so.
154
+ get: servedByVm('get'),
155
+ set: servedByVm('set'),
156
+ clear: servedByVm('clear'),
157
+ stateKeys: servedByVm('stateKeys'),
158
+ run: () => {
159
+ 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');
160
+ },
161
+ genericCall: (call) => {
162
+ const { result, invocationId } = driver.call({
163
+ service: call.service,
164
+ handler: call.method,
165
+ key: call.key,
166
+ input: (call.inputSerde ?? restate.serde.json).serialize(call.parameter),
167
+ idempotencyKey: call.idempotencyKey,
168
+ headers: Object.entries(call.headers ?? {}).map(([key, value]) => ({ key, value })),
169
+ });
170
+ // Marked handled: `start()` awaits only the invocation id, so nothing
171
+ // holds this, and it rejects when the callee fails, on a cancellation,
172
+ // and at the end of every attempt — including a successful one.
173
+ const answered = quiet(result.then((value) => (call.outputSerde ?? restate.serde.json).deserialize(value ?? new Uint8Array())));
174
+ return Object.assign(answered, { invocationId });
175
+ },
176
+ genericSend: (send) => void driver.send({
177
+ service: send.service,
178
+ handler: send.method,
179
+ key: send.key,
180
+ input: (send.inputSerde ?? restate.serde.json).serialize(send.parameter),
181
+ // `SendOptions.delay` is milliseconds or a `Duration`; the VM takes
182
+ // milliseconds.
183
+ delay: send.delay === undefined ? undefined : millisOrDurationToMillis(send.delay),
184
+ idempotencyKey: send.idempotencyKey,
185
+ headers: Object.entries(send.headers ?? {}).map(([key, value]) => ({ key, value })),
186
+ }),
187
+ invocation: (invocationId) => ({
188
+ cancel: () => driver.cancel(String(invocationId)),
189
+ attach: (serde) => quiet(driver
190
+ .attach(String(invocationId))
191
+ .then((value) => (serde ?? restate.serde.json).deserialize(value ?? new Uint8Array()))),
192
+ }),
193
+ cancellation: () => driver.cancellation(),
194
+ // A cancellation owed to the handler's next await, which a call of its
195
+ // database takes before it issues anything (`session.ts`).
196
+ takeCancellation: () => driver.takeCarriedCancellation(),
197
+ cancelPreviousCalls: () => driver.cancelPreviousCalls(),
198
+ invocationEndPromise: { promise: ending.promise },
199
+ defaultSerde: restate.serde.json,
200
+ // The addon reads and writes the object's state on this, rather than
201
+ // calling back into JavaScript for every page (see `openOnVm`).
202
+ vm,
203
+ };
204
+ return context;
205
+ }
206
+ /**
207
+ * Mark a promise handled, so that one the handler never awaits does not bring
208
+ * the process down when the attempt ends. The caller still sees the rejection.
209
+ */
210
+ function quiet(promise) {
211
+ promise.catch(() => { });
212
+ return promise;
213
+ }
214
+ /** What a state member of the context does if anything calls it. */
215
+ const servedByVm = (of) => () => {
216
+ throw new restate.TerminalError(`@restatedev/sessions: the VM serves the object's state in the addon; ctx.${of} is not called`);
217
+ };
218
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +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,EAAE,YAAY,EAAE,MAAM,EAAuB,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,EAAE,EAAiB,MAAM,SAAS,CAAC;AAE5C,yFAAyF;AACzF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAa9B;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgE;IACzF,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,+CAA+C,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC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,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;AAIpC,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":"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"}
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ export { sessionObject, } from './object.js';
27
27
  export { remote } from './calls.js';
28
28
  // In place of the SDK's: the services, on PORT, with what they need beside
29
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.
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`).
31
32
  export { connect, serve, served } from './serve.js';
32
33
  //# 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,+EAA+E;AAC/E,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,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"}
@@ -5,8 +5,10 @@ export type { ObjectConfig, SqlHost } from './session.ts';
5
5
  export { Link } from './link.ts';
6
6
  export { ScopeKey } from './scope.ts';
7
7
  export { open, type Connection, type Store, type ConnectionTransaction } from './database.ts';
8
- export { failpoints, PromiseSelector, type Failpoint } from './selector.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';
9
11
  export { needing, served } from './serve.ts';
12
+ export { invokeRoute, patchEndpoint } from './endpoint.ts';
10
13
  export { attach, cancelCalls, cancelled, configOf, contextOf, definitionOf, HEAD_KEY, invoke, start, withStoreWrapper, type AttemptContext, } from './object.ts';
11
- export type { DoProgressResult, Selectable, UnresolvedFuture } from './selector.ts';
12
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,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/F,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAA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E,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,EACL,gBAAgB,EAChB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC"}
package/dist/internal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // For tests: an attempt's session over a context of their own, the store's
2
- // fault injection, a database over a store of their own, and the selector on
3
- // its own. For this repository's libraries: the schemas their tables are in,
2
+ // fault injection, and a database over a store of their own. For this
3
+ // repository's libraries: the schemas their tables are in,
4
4
  // databases of their own, and the Restate SDK as @restatedev/sessions runs it (its
5
5
  // own copy, so that a library's journaled handlers serve beside its objects).
6
6
  export * as sdk from '@restatedev/restate-sdk';
@@ -9,7 +9,11 @@ export { asDatabase, lazyDatabase, database, reset, Attempt, withAttempt } from
9
9
  export { Link } from './link.js';
10
10
  export { ScopeKey } from './scope.js';
11
11
  export { open } from './database.js';
12
- export { failpoints, PromiseSelector } from './selector.js';
12
+ // The attempt on the explicit recovery VM, for the tests that drive one.
13
+ export { AttemptDriver, AttemptFailed, AttemptShutDown } from './driver.js';
14
+ export { Vm, isShutDown } from './vm.js';
15
+ export { serveSession, servedHere } from './handler.js';
13
16
  export { needing, served } from './serve.js';
17
+ export { invokeRoute, patchEndpoint } from './endpoint.js';
14
18
  export { attach, cancelCalls, cancelled, configOf, contextOf, definitionOf, HEAD_KEY, invoke, start, withStoreWrapper, } from './object.js';
15
19
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,6EAA6E;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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,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,EACL,gBAAgB,GAEjB,MAAM,aAAa,CAAC"}
package/dist/object.d.ts CHANGED
@@ -101,6 +101,19 @@ type Runtime = {
101
101
  export type AttemptContext = Pick<restate.ObjectContext, 'key' | 'request' | 'get' | 'set' | 'clear' | 'stateKeys' | 'run' | 'genericSend' | 'genericCall' | 'invocation'> & Runtime;
102
102
  /** What an attempt's session needs of the SDK's context `ctx`. */
103
103
  export declare function host(ctx: restate.ObjectContext | restate.ObjectSharedContext | AttemptContext, shared: boolean): SqlHost;
104
+ /**
105
+ * The handler or view `name` of `definition`, if it is a session object's:
106
+ * what {@link serveSession} needs to run an attempt of it on the VM.
107
+ */
108
+ export declare function handlerEntry(definition: object, name: string): {
109
+ view: boolean;
110
+ explicit: boolean;
111
+ inputSerde: Serde<unknown>;
112
+ outputSerde: Serde<unknown>;
113
+ asTerminalError?: (error: unknown) => Error | undefined;
114
+ } | undefined;
115
+ /** Whether `definition` is a session object: it has handlers this package runs. */
116
+ export declare const isSessionObject: (definition: object) => boolean;
104
117
  /**
105
118
  * The definition (`sessionObject`'s) of the object whose handler or view
106
119
  * `ctx` is the context of: what a library keeps per object lives on it.
@@ -187,8 +200,8 @@ export declare function attach<O = unknown>(ctx: SessionContext, invocationId: s
187
200
  *
188
201
  * It watches for the cancellation, and holds nothing: awaited alone, it does
189
202
  * not suspend the invocation, and Restate is not told that the handler waits
190
- * (see selector.ts: the attempt's journal has a run named `work` instead,
191
- * for the handler's own work). The cancel signal comes while Restate keeps
203
+ * (a heartbeat tells Restate the attempt makes progress instead, see
204
+ * `driver.ts`). The cancel signal comes while Restate keeps
192
205
  * the invocation's input open. Once Restate closed it (the handler sent and
193
206
  * got nothing for the inactivity timeout), a cancellation resolves this at
194
207
  * the handler's next await of Restate's, which suspends the invocation and
@@ -1 +1 @@
1
- {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAAS,KAAK,IAAI,EAAU,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAA8B,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAIpE,OAAO,EAAE,KAAK,QAAQ,EAAW,KAAK,YAAY,EAAE,KAAK,OAAO,EAAe,MAAM,cAAc,CAAC;AAEpG;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,yBAAyB;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,kGAAkG;IAClG,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,WA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