@restatedev/sessions 0.8.0 → 0.10.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 (62) hide show
  1. package/README.md +64 -31
  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 +549 -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 +1 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +4 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/internal.d.ts +5 -3
  27. package/dist/internal.d.ts.map +1 -1
  28. package/dist/internal.js +8 -4
  29. package/dist/internal.js.map +1 -1
  30. package/dist/object.d.ts +15 -2
  31. package/dist/object.d.ts.map +1 -1
  32. package/dist/object.js +51 -12
  33. package/dist/object.js.map +1 -1
  34. package/dist/serve.d.ts +19 -26
  35. package/dist/serve.d.ts.map +1 -1
  36. package/dist/serve.js +21 -30
  37. package/dist/serve.js.map +1 -1
  38. package/dist/session.d.ts +32 -2
  39. package/dist/session.d.ts.map +1 -1
  40. package/dist/session.js +59 -9
  41. package/dist/session.js.map +1 -1
  42. package/dist/vm.d.ts +151 -0
  43. package/dist/vm.d.ts.map +1 -0
  44. package/dist/vm.js +28 -0
  45. package/dist/vm.js.map +1 -0
  46. package/package.json +4 -4
  47. package/src/addon.ts +29 -0
  48. package/src/database.ts +48 -19
  49. package/src/driver.ts +653 -0
  50. package/src/endpoint.ts +220 -0
  51. package/src/handler.ts +272 -0
  52. package/src/index.ts +4 -2
  53. package/src/internal.ts +8 -5
  54. package/src/object.ts +75 -13
  55. package/src/serve.ts +26 -39
  56. package/src/session.ts +77 -8
  57. package/src/vm.ts +195 -0
  58. package/dist/selector.d.ts +0 -129
  59. package/dist/selector.d.ts.map +0 -1
  60. package/dist/selector.js +0 -251
  61. package/dist/selector.js.map +0 -1
  62. package/src/selector.ts +0 -323
package/dist/driver.js ADDED
@@ -0,0 +1,549 @@
1
+ // One attempt of a session object's handler, on the explicit recovery VM
2
+ // (`vm.ts`, `native/src/vm.rs`).
3
+ //
4
+ // The VM never replays a journal: every attempt runs the handler from the
5
+ // start, and recovers from the state the earlier attempts stored. An action
6
+ // returns a handle, and its result comes back as a notification of that
7
+ // handle, which settles the action's promise here. Two things move the attempt
8
+ // along:
9
+ //
10
+ // - the input pump, the only reader of the request body: it hands the VM
11
+ // each chunk, and the end of the body;
12
+ // - the tick, scheduled after every call into the VM, at most one per turn
13
+ // of the event loop: it writes the VM's output, settles the promises of
14
+ // the actions that completed, and notices the end of the attempt.
15
+ //
16
+ // Scheduling a tick after every call batches the output of the actions issued
17
+ // in the same turn, and flushes it before the event loop can wait on anything.
18
+ //
19
+ // Restate shuts an attempt down by closing the request body, after its
20
+ // inactivity timeout. From then on the attempt is over: every action throws,
21
+ // the promises still pending reject, and a new attempt runs the handler from
22
+ // the start. See the heartbeats on what keeps an attempt at work alive.
23
+ import * as restate from '@restatedev/restate-sdk';
24
+ import { isShutDown } from './vm.js';
25
+ /**
26
+ * How often an attempt at work of its own tells Restate it makes progress, in
27
+ * milliseconds: RESTATE_SESSIONS_HEARTBEAT, or 20 seconds.
28
+ *
29
+ * Restate shuts down an attempt it has heard nothing from for its inactivity
30
+ * timeout, a minute by default, and 20 seconds is well inside that. A
31
+ * deployment that shortens the timeout
32
+ * (`RESTATE_WORKER__INVOKER__INACTIVITY_TIMEOUT`) must shorten this with it.
33
+ */
34
+ function heartbeatMs() {
35
+ const set = Number(process.env.RESTATE_SESSIONS_HEARTBEAT);
36
+ return Number.isFinite(set) && set > 0 ? set : 20_000;
37
+ }
38
+ /**
39
+ * Restate shut the attempt down: it is over, and a new attempt runs the
40
+ * handler from the start.
41
+ */
42
+ export class AttemptShutDown extends Error {
43
+ constructor() {
44
+ super('Restate shut the attempt down; a new attempt will run the handler from the start');
45
+ this.name = 'AttemptShutDown';
46
+ }
47
+ }
48
+ /** The attempt failed, and Restate retries it. */
49
+ export class AttemptFailed extends Error {
50
+ constructor(message) {
51
+ super(message);
52
+ this.name = 'AttemptFailed';
53
+ }
54
+ }
55
+ /** A failed action's terminal error, as the SDK's own, so that user code catches it. */
56
+ function terminal(failure) {
57
+ return new restate.TerminalError(failure.message, {
58
+ errorCode: failure.code,
59
+ metadata: Object.fromEntries(failure.metadata.map(({ key, value }) => [key, value])),
60
+ });
61
+ }
62
+ /**
63
+ * Keep an unawaited rejection from reaching the process: the attempt's end
64
+ * rejects every promise still waiting, and a handler that stopped awaiting one
65
+ * — a race it lost, say — would otherwise bring the process down. Attaching a
66
+ * handler marks the promise handled; the caller still sees the rejection.
67
+ */
68
+ function quiet(promise) {
69
+ promise.catch(() => { });
70
+ return promise;
71
+ }
72
+ /** What a notification settles its promise with. */
73
+ function settled(notification) {
74
+ switch (notification.kind) {
75
+ case 'void':
76
+ return { value: undefined };
77
+ case 'success':
78
+ return { value: notification.bytes };
79
+ case 'failure':
80
+ return { error: terminal(notification.failure) };
81
+ case 'stateKeys':
82
+ return { value: notification.keys };
83
+ case 'invocationId':
84
+ return { value: notification.id };
85
+ default:
86
+ // A kind this version does not know: no value, rather than an action
87
+ // whose promise stays pending forever.
88
+ return { value: undefined };
89
+ }
90
+ }
91
+ /**
92
+ * Drives one attempt over its VM: the input pump, the tick, and the promises
93
+ * of the actions it issued.
94
+ */
95
+ export class AttemptDriver {
96
+ vm;
97
+ write;
98
+ options;
99
+ /** Set once the attempt is over, to what ended it. */
100
+ ended;
101
+ waiting = new Map();
102
+ onEnd = new Set();
103
+ queued = false;
104
+ /** The calls this attempt made, by the handle of their result. */
105
+ calls = new Map();
106
+ /** Issuing the cancellations of the calls, which the handler's end waits for. */
107
+ cancelling;
108
+ cancelledResolve;
109
+ /**
110
+ * A cancellation that failed nothing the handler awaits, carried to the
111
+ * next thing it does await: a result of Restate's ({@link promise}), or a
112
+ * call of its database ({@link takeCarriedCancellation}). A retry of a
113
+ * cancelled invocation knows it was cancelled before the handler starts,
114
+ * and its first call has to fail all the same, rather than run to
115
+ * completion.
116
+ *
117
+ * There is one, and it is here. The addon once carried a second for the
118
+ * database's waits, and the two could not agree on who had delivered: a
119
+ * handler saw one cancellation twice.
120
+ */
121
+ carriedCancellation = false;
122
+ cancelledPromise;
123
+ heartbeats;
124
+ aborter = new AbortController();
125
+ /**
126
+ * The invocation's input. Taking it from the VM copies the body across the
127
+ * addon, and the key, the body and the request each want it.
128
+ */
129
+ theInput;
130
+ constructor(vm, write, options) {
131
+ this.vm = vm;
132
+ this.write = write;
133
+ this.options = options;
134
+ this.cancelledPromise = new Promise((resolve) => {
135
+ this.cancelledResolve = resolve;
136
+ });
137
+ }
138
+ // --- Input and output
139
+ /** A chunk of the request body. */
140
+ notifyInput(chunk) {
141
+ this.vm.notifyInput(chunk);
142
+ this.schedule();
143
+ }
144
+ /** The end of the request body: while the handler runs, Restate shut the attempt down. */
145
+ notifyInputClosed() {
146
+ this.vm.notifyInputClosed();
147
+ this.schedule();
148
+ }
149
+ isReadyToExecute() {
150
+ return this.vm.isReadyToExecute();
151
+ }
152
+ /**
153
+ * Schedule a tick from outside: what the VM calls after the database's store
154
+ * acts on it from the runtime's thread, so that what it wrote is written and
155
+ * what it waits for is routed to it.
156
+ */
157
+ scheduleTick() {
158
+ this.schedule();
159
+ }
160
+ /** Schedule a tick, once per turn of the event loop. */
161
+ schedule() {
162
+ if (this.queued)
163
+ return;
164
+ this.queued = true;
165
+ queueMicrotask(() => (this.ended === undefined ? this.tick() : this.flush()));
166
+ }
167
+ /** Write what the VM has buffered. A closed attempt still flushes its last words. */
168
+ flush() {
169
+ this.queued = false;
170
+ const output = this.vm.takeOutput();
171
+ if (output.length > 0)
172
+ this.write(output);
173
+ }
174
+ /**
175
+ * Write the VM's output, settle the promises of the actions that completed,
176
+ * and notice the end of the attempt.
177
+ */
178
+ tick() {
179
+ this.queued = false;
180
+ this.flush();
181
+ if (this.ended !== undefined)
182
+ return;
183
+ let notification;
184
+ try {
185
+ while ((notification = this.vm.takeNotification()) !== null) {
186
+ // A call is over once its result arrives, whatever it is.
187
+ const call = this.calls.get(notification.handle);
188
+ if (call !== undefined)
189
+ call.done = true;
190
+ const waiting = this.waiting.get(notification.handle);
191
+ // A handle this attempt did not issue, or settled already: nothing waits for it.
192
+ if (waiting === undefined)
193
+ continue;
194
+ this.waiting.delete(notification.handle);
195
+ const result = settled(notification);
196
+ if ('error' in result)
197
+ waiting.reject(result.error);
198
+ else
199
+ waiting.resolve(result.value);
200
+ }
201
+ }
202
+ catch (error) {
203
+ this.end(isShutDown(error) ? new AttemptShutDown() : new AttemptFailed(String(error)));
204
+ return;
205
+ }
206
+ // The VM says whether a cancellation arrived, in this attempt or an
207
+ // earlier one; it has no notification of its own.
208
+ if (this.vm.isCancelled())
209
+ this.cancelled();
210
+ if (this.vm.state() === 'closed')
211
+ this.end(new AttemptShutDown());
212
+ }
213
+ /** The attempt ended: fail what still waits, and tell the listeners. */
214
+ end(reason) {
215
+ if (this.ended !== undefined)
216
+ return;
217
+ this.ended = reason;
218
+ const waiting = [...this.waiting.values()];
219
+ this.waiting.clear();
220
+ for (const one of waiting)
221
+ one.reject(reason);
222
+ this.stopHeartbeats();
223
+ // Nothing will answer the database's outstanding reads now, and the
224
+ // scheduler holds this driver and the VM alive through the addon.
225
+ this.vm.endStateWaits();
226
+ this.vm.clearScheduler();
227
+ this.aborter.abort(reason);
228
+ const listeners = [...this.onEnd];
229
+ this.onEnd.clear();
230
+ for (const listener of listeners)
231
+ listener();
232
+ }
233
+ /** Whether the attempt is over, and with what. */
234
+ get over() {
235
+ return this.ended;
236
+ }
237
+ /** Call `listener` when the attempt ends; the returned function unregisters it. */
238
+ whenEnded(listener) {
239
+ if (this.ended !== undefined) {
240
+ listener();
241
+ return () => { };
242
+ }
243
+ this.onEnd.add(listener);
244
+ return () => this.onEnd.delete(listener);
245
+ }
246
+ // --- Cancellation
247
+ /**
248
+ * Restate cancelled the invocation. A handler with `explicitCancellation`
249
+ * stops its own work and nothing else happens; otherwise the calls in flight
250
+ * are cancelled and every await of Restate fails, as a cancelled
251
+ * invocation's do.
252
+ */
253
+ cancelled() {
254
+ const first = this.cancelledResolve !== undefined;
255
+ this.cancelledResolve?.();
256
+ this.cancelledResolve = undefined;
257
+ if (!first || this.options.explicitCancellation)
258
+ return;
259
+ // What the database waits for in the addon — a state read, the ack of a
260
+ // commit's head write — is left to finish. Restate answers those
261
+ // promptly, and failing the ack of a head that is already out would
262
+ // report a commit as cancelled that landed. A call of the database that
263
+ // is in flight completes, and the cancellation goes to what the handler
264
+ // awaits next.
265
+ // The calls in flight are cancelled, which waits for the ids that have not
266
+ // arrived yet: `serveSession` holds the handler's end for it.
267
+ this.cancelling = quiet(this.cancelPreviousCalls().then(() => undefined));
268
+ const failure = new restate.CancelledError();
269
+ // Deleting the entry the loop is on is defined, and a rejection runs its
270
+ // handlers in a later microtask, so nothing is added under the iteration.
271
+ let failedAResult = false;
272
+ for (const [handle, waiting] of this.waiting) {
273
+ // A call's invocation id still settles: cancelling the call needs it.
274
+ if (waiting.waits === 'callId')
275
+ continue;
276
+ if (waiting.waits === 'result')
277
+ failedAResult = true;
278
+ this.waiting.delete(handle);
279
+ waiting.reject(failure);
280
+ }
281
+ // Carried only if nothing the handler awaits was failed. A send's id is
282
+ // in `waiting` and is rejected here, but `genericSend` voided it, so the
283
+ // handler saw no cancellation and is still owed its one.
284
+ this.carriedCancellation = !failedAResult;
285
+ }
286
+ /**
287
+ * Whether a cancellation is owed to the handler's next await, which the
288
+ * caller then delivers: the handler's call of its database, before it
289
+ * issues anything, so that a call that fails with the cancellation did
290
+ * nothing.
291
+ */
292
+ takeCarriedCancellation() {
293
+ const carried = this.carriedCancellation;
294
+ this.carriedCancellation = false;
295
+ return carried;
296
+ }
297
+ /** Issuing the cancellations of the calls, if a cancellation started them. */
298
+ get cancellingCalls() {
299
+ return this.cancelling;
300
+ }
301
+ /** Resolves once a cancellation arrived, in this attempt or an earlier one. */
302
+ cancellation() {
303
+ if (this.vm.isCancelled())
304
+ this.cancelled();
305
+ return this.cancelledPromise;
306
+ }
307
+ isCancelled() {
308
+ return this.vm.isCancelled();
309
+ }
310
+ /**
311
+ * Cancel the calls this attempt made that have not answered; returns their
312
+ * ids. A call whose invocation id has not arrived yet is waited for: it was
313
+ * made, so Restate will answer with its id, and leaving it uncancelled would
314
+ * leave an invocation running that nothing waits for any more.
315
+ */
316
+ async cancelPreviousCalls() {
317
+ const cancelled = [];
318
+ // A snapshot: the loop awaits, and a call made meanwhile is the handler's
319
+ // own business, not one this cancellation set out to stop.
320
+ for (const call of Array.from(this.calls.values())) {
321
+ if (call.done || call.cancelled)
322
+ continue;
323
+ let id;
324
+ try {
325
+ id = await call.id;
326
+ }
327
+ catch {
328
+ continue; // its id never came: the attempt is over, or the call failed
329
+ }
330
+ if (call.done || call.cancelled)
331
+ continue;
332
+ call.cancelled = true;
333
+ this.cancel(id);
334
+ cancelled.push(id);
335
+ }
336
+ return cancelled;
337
+ }
338
+ // --- Actions
339
+ /** Call the VM with `act`, then schedule a tick. The attempt's end throws. */
340
+ act(act) {
341
+ if (this.ended !== undefined)
342
+ throw this.ended;
343
+ try {
344
+ return act(this.vm);
345
+ }
346
+ catch (error) {
347
+ if (isShutDown(error)) {
348
+ this.end(new AttemptShutDown());
349
+ throw this.ended;
350
+ }
351
+ throw error;
352
+ }
353
+ finally {
354
+ this.schedule();
355
+ }
356
+ }
357
+ /** The promise the notification of `handle` settles. */
358
+ promise(handle, waits = 'result') {
359
+ if (this.ended !== undefined)
360
+ return quiet(Promise.reject(this.ended));
361
+ // Only a result takes it: see {@link Waits}.
362
+ if (this.carriedCancellation && waits === 'result') {
363
+ this.carriedCancellation = false;
364
+ return quiet(Promise.reject(new restate.CancelledError()));
365
+ }
366
+ return quiet(new Promise((resolve, reject) => {
367
+ this.waiting.set(handle, { resolve, reject, waits });
368
+ }));
369
+ }
370
+ /**
371
+ * A fire-and-forget action, which an attempt that ended simply drops. The
372
+ * database's store calls these from the addon, where a throw would reach no
373
+ * `catch` of ours and bring the process down; and a write of an attempt that
374
+ * is over cannot be sent anyway, since a new attempt writes it again.
375
+ */
376
+ tell(act) {
377
+ if (this.ended !== undefined)
378
+ return;
379
+ try {
380
+ this.act(act);
381
+ }
382
+ catch {
383
+ // The attempt ended under us.
384
+ }
385
+ }
386
+ /** An action and the promise of its result, in one. */
387
+ issue(act) {
388
+ let handle;
389
+ try {
390
+ handle = this.act(act);
391
+ }
392
+ catch (error) {
393
+ return quiet(Promise.reject(error instanceof Error ? error : new Error(String(error))));
394
+ }
395
+ return this.promise(handle);
396
+ }
397
+ // --- Calls
398
+ /** A call: the promise of its result, and of its invocation id. */
399
+ call(target) {
400
+ let handles;
401
+ try {
402
+ handles = this.act((vm) => vm.call(target.service, target.handler, target.input, target.key, target.idempotencyKey, target.headers, target.name));
403
+ }
404
+ catch (error) {
405
+ const rejected = quiet(Promise.reject(error instanceof Error ? error : new Error(String(error))));
406
+ return { result: rejected, invocationId: rejected };
407
+ }
408
+ const invocationId = quiet(this.promise(handles.invocationId, 'callId').then((id) => String(id)));
409
+ const result = quiet(this.promise(handles.result).then((value) => (value === undefined ? null : value)));
410
+ // Keyed by the result's handle, which is what says the call is over.
411
+ this.calls.set(handles.result, { id: invocationId, done: false, cancelled: false });
412
+ return { result, invocationId };
413
+ }
414
+ /** A send: the promise of the invocation id it was given. */
415
+ send(target) {
416
+ if (this.ended !== undefined)
417
+ return quiet(Promise.reject(this.ended));
418
+ let handle;
419
+ try {
420
+ handle = this.act((vm) => vm.send(target.service, target.handler, target.input, target.key, target.delay, target.idempotencyKey, target.headers, target.name));
421
+ }
422
+ catch (error) {
423
+ // An attempt that ended drops it, as it drops a write: a new attempt
424
+ // sends it again. Anything else is the caller's — a delay that is not a
425
+ // number of milliseconds, say — and throws, as it does on the SDK's
426
+ // context, rather than vanishing into a promise nobody holds.
427
+ if (this.ended !== undefined)
428
+ return quiet(Promise.reject(this.ended));
429
+ throw error;
430
+ }
431
+ return quiet(this.promise(handle, 'sendId').then((id) => String(id)));
432
+ }
433
+ /** The result of an invocation, once it ends. */
434
+ attach(invocationId, name) {
435
+ return quiet(this.issue((vm) => vm.attachInvocation(invocationId, name)).then((value) => value === undefined ? null : value));
436
+ }
437
+ cancel(invocationId, name) {
438
+ this.tell((vm) => vm.cancelInvocation(invocationId, name, false));
439
+ }
440
+ // --- Traces, shown in Restate's UI as runs
441
+ startTrace(name, parent) {
442
+ return this.act((vm) => vm.startTrace(name, parent));
443
+ }
444
+ endTrace(trace, output) {
445
+ this.act((vm) => vm.endTraceSuccess(trace, output));
446
+ }
447
+ // --- Keeping an attempt at work alive
448
+ //
449
+ // Restate shuts an attempt down once its inactivity timeout passes with
450
+ // nothing heard. A heartbeat stops that while the handler works outside
451
+ // Restate, on this rule: only while nothing of this attempt waits on
452
+ // Restate. With something
453
+ // waiting, a shutdown is what should happen — Restate starts a new attempt
454
+ // when the answer comes, instead of holding a connection open meanwhile.
455
+ /** Start the heartbeats of a running handler. */
456
+ startHeartbeats(everyMs = heartbeatMs()) {
457
+ if (this.heartbeats !== undefined || this.ended !== undefined)
458
+ return;
459
+ this.heartbeats = setInterval(() => {
460
+ if (this.ended !== undefined || this.waiting.size > 0)
461
+ return;
462
+ try {
463
+ this.act((vm) => vm.heartbeat());
464
+ }
465
+ catch {
466
+ // The attempt ended: the tick notices.
467
+ }
468
+ }, everyMs);
469
+ this.heartbeats.unref?.();
470
+ }
471
+ stopHeartbeats() {
472
+ if (this.heartbeats === undefined)
473
+ return;
474
+ clearInterval(this.heartbeats);
475
+ this.heartbeats = undefined;
476
+ }
477
+ // --- The input, and the end
478
+ /** The invocation's input, read from the VM once. */
479
+ input() {
480
+ this.theInput ??= this.vm.input();
481
+ return this.theInput;
482
+ }
483
+ /** The invocation's key, once the VM is ready to execute. */
484
+ get key() {
485
+ return this.input().key;
486
+ }
487
+ /** The handler's input. */
488
+ get body() {
489
+ return this.input().input;
490
+ }
491
+ /** The invocation's request, as a handler's `ctx.request` has it. */
492
+ request(attemptHeaders = new Map()) {
493
+ const input = this.input();
494
+ const target = {
495
+ service: this.options.service,
496
+ handler: this.options.handler,
497
+ key: input.key || undefined,
498
+ toString() {
499
+ return this.key === undefined
500
+ ? `${this.service}/${this.handler}`
501
+ : `${this.service}/${this.key}/${this.handler}`;
502
+ },
503
+ };
504
+ return {
505
+ target,
506
+ id: input.invocationId,
507
+ headers: new Map(input.headers.map(({ key, value }) => [key, value])),
508
+ attemptHeaders,
509
+ body: input.input,
510
+ extraArgs: [],
511
+ idempotencyKey: input.idempotencyKey,
512
+ scope: input.scope,
513
+ limitKey: input.limitKey,
514
+ attemptCompletedSignal: this.aborter.signal,
515
+ };
516
+ }
517
+ /** The handler ended with its output. */
518
+ endSuccess(output) {
519
+ this.last((vm) => vm.endSuccess(output));
520
+ }
521
+ /** The handler ended with a terminal failure. */
522
+ endFailure(error) {
523
+ this.last((vm) => vm.endFailure({
524
+ code: error.code ?? 500,
525
+ message: error.message,
526
+ metadata: Object.entries(error.metadata ?? {}).map(([key, value]) => ({ key, value })),
527
+ }));
528
+ }
529
+ /** The attempt failed, and Restate retries it. */
530
+ fail(message, stacktrace, retryAfterMs) {
531
+ if (this.ended !== undefined)
532
+ return;
533
+ this.vm.notifyError(message, stacktrace, retryAfterMs);
534
+ this.schedule();
535
+ }
536
+ /** End the attempt with `act`, unless it ended already. */
537
+ last(act) {
538
+ if (this.ended !== undefined)
539
+ return;
540
+ try {
541
+ act(this.vm);
542
+ }
543
+ catch {
544
+ // The attempt ended under us: the VM wrote why.
545
+ }
546
+ this.schedule();
547
+ }
548
+ }
549
+ //# sourceMappingURL=driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.js","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,iCAAiC;AACjC,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,wEAAwE;AACxE,+EAA+E;AAC/E,SAAS;AACT,EAAE;AACF,2EAA2E;AAC3E,2CAA2C;AAC3C,6EAA6E;AAC7E,4EAA4E;AAC5E,sEAAsE;AACtE,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,6EAA6E;AAC7E,wEAAwE;AACxE,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,UAAU,EAA8D,MAAM,SAAS,CAAC;AAEjG;;;;;;;;GAQG;AACH,SAAS,WAAW;IAClB,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC;QACE,KAAK,CAAC,kFAAkF,CAAC,CAAC;QAC1F,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,kDAAkD;AAClD,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,wFAAwF;AACxF,SAA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gDAAgD;QAClD,CAAC;QACD,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ /** The route of an invocation's path, as the SDK reads it. */
2
+ export declare function invokeRoute(url: string): {
3
+ service: string;
4
+ handler: string;
5
+ } | undefined;
6
+ /**
7
+ * Wrap the SDK's endpoint class, once per process, so that every request
8
+ * handler it hands out routes a session object's invocations to the VM.
9
+ * Called by {@link sessionObject}: the package declares `sideEffects: false`,
10
+ * so this cannot be the work of an import.
11
+ */
12
+ export declare function patchEndpoint(): void;
13
+ //# sourceMappingURL=endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAoGA,8DAA8D;AAC9D,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAGzF;AA+DD;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,IAAI,CA8CpC"}