@resonatehq/sdk 0.5.3 → 0.6.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 (80) hide show
  1. package/dist/core/encoders/json.d.ts.map +1 -1
  2. package/dist/core/encoders/json.js +12 -0
  3. package/dist/core/encoders/json.js.map +1 -1
  4. package/dist/core/errors.d.ts +4 -2
  5. package/dist/core/errors.d.ts.map +1 -1
  6. package/dist/core/errors.js +5 -2
  7. package/dist/core/errors.js.map +1 -1
  8. package/dist/core/options.d.ts +20 -11
  9. package/dist/core/options.d.ts.map +1 -1
  10. package/dist/core/options.js +11 -1
  11. package/dist/core/options.js.map +1 -1
  12. package/dist/core/promises/promises.d.ts +2 -2
  13. package/dist/core/promises/promises.d.ts.map +1 -1
  14. package/dist/core/promises/promises.js +2 -1
  15. package/dist/core/promises/promises.js.map +1 -1
  16. package/dist/core/promises/types.d.ts +10 -83
  17. package/dist/core/promises/types.d.ts.map +1 -1
  18. package/dist/core/promises/types.js +10 -10
  19. package/dist/core/promises/types.js.map +1 -1
  20. package/dist/core/retry.d.ts +36 -26
  21. package/dist/core/retry.d.ts.map +1 -1
  22. package/dist/core/retry.js +130 -14
  23. package/dist/core/retry.js.map +1 -1
  24. package/dist/core/schedules/schedules.d.ts +1 -1
  25. package/dist/core/schedules/schedules.d.ts.map +1 -1
  26. package/dist/core/schedules/schedules.js.map +1 -1
  27. package/dist/core/storages/memory.d.ts.map +1 -1
  28. package/dist/core/storages/memory.js +2 -0
  29. package/dist/core/storages/memory.js.map +1 -1
  30. package/dist/core/storages/withTimeout.d.ts +6 -6
  31. package/dist/core/storages/withTimeout.d.ts.map +1 -1
  32. package/dist/core/storages/withTimeout.js +2 -13
  33. package/dist/core/storages/withTimeout.js.map +1 -1
  34. package/dist/core/store.d.ts +7 -7
  35. package/dist/core/store.d.ts.map +1 -1
  36. package/dist/core/stores/local.d.ts +9 -9
  37. package/dist/core/stores/local.d.ts.map +1 -1
  38. package/dist/core/stores/local.js +2 -2
  39. package/dist/core/stores/local.js.map +1 -1
  40. package/dist/core/stores/remote.d.ts +7 -7
  41. package/dist/core/stores/remote.d.ts.map +1 -1
  42. package/dist/core/stores/remote.js +29 -7
  43. package/dist/core/stores/remote.js.map +1 -1
  44. package/dist/core/utils.d.ts +82 -0
  45. package/dist/core/utils.d.ts.map +1 -1
  46. package/dist/core/utils.js +103 -1
  47. package/dist/core/utils.js.map +1 -1
  48. package/dist/index.d.ts +1 -6
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +4 -11
  51. package/dist/index.js.map +1 -1
  52. package/dist/resonate.d.ts +163 -49
  53. package/dist/resonate.d.ts.map +1 -1
  54. package/dist/resonate.js +626 -146
  55. package/dist/resonate.js.map +1 -1
  56. package/package.json +1 -1
  57. package/dist/async.d.ts +0 -201
  58. package/dist/async.d.ts.map +0 -1
  59. package/dist/async.js +0 -331
  60. package/dist/async.js.map +0 -1
  61. package/dist/core/execution.d.ts +0 -47
  62. package/dist/core/execution.d.ts.map +0 -1
  63. package/dist/core/execution.js +0 -310
  64. package/dist/core/execution.js.map +0 -1
  65. package/dist/core/future.d.ts +0 -56
  66. package/dist/core/future.d.ts.map +0 -1
  67. package/dist/core/future.js +0 -107
  68. package/dist/core/future.js.map +0 -1
  69. package/dist/core/invocation.d.ts +0 -44
  70. package/dist/core/invocation.d.ts.map +0 -1
  71. package/dist/core/invocation.js +0 -103
  72. package/dist/core/invocation.js.map +0 -1
  73. package/dist/core/retries/retry.d.ts +0 -20
  74. package/dist/core/retries/retry.d.ts.map +0 -1
  75. package/dist/core/retries/retry.js +0 -41
  76. package/dist/core/retries/retry.js.map +0 -1
  77. package/dist/generator.d.ts +0 -208
  78. package/dist/generator.d.ts.map +0 -1
  79. package/dist/generator.js +0 -427
  80. package/dist/generator.js.map +0 -1
package/dist/generator.js DELETED
@@ -1,427 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Context = exports.Info = exports.Resonate = void 0;
4
- const execution_1 = require("./core/execution");
5
- const future_1 = require("./core/future");
6
- const invocation_1 = require("./core/invocation");
7
- const resonate_1 = require("./resonate");
8
- /////////////////////////////////////////////////////////////////////
9
- // Resonate
10
- /////////////////////////////////////////////////////////////////////
11
- class Resonate extends resonate_1.ResonateBase {
12
- scheduler;
13
- /**
14
- * Creates a Resonate instance. This is the starting point for using Resonate.
15
- *
16
- * @constructor
17
- * @param opts - A partial {@link ResonateOptions} object.
18
- */
19
- constructor(opts = {}) {
20
- super(opts);
21
- this.scheduler = new Scheduler(this);
22
- }
23
- execute(name, id, func, args, opts, defaults, durablePromise) {
24
- return this.scheduler.add(name, id, func, args, opts, defaults, durablePromise);
25
- }
26
- /**
27
- * Register a function with Resonate. Registered functions can be invoked by calling {@link run}, or by the returned function.
28
- *
29
- * @template F The type of the generator function.
30
- * @param name A unique name to identify the function.
31
- * @param func The generator function to register with Resonate.
32
- * @param opts Resonate options, can be constructed by calling {@link options}.
33
- * @returns Resonate function
34
- */
35
- register(name, func, opts) {
36
- return super.register(name, func, opts);
37
- }
38
- /**
39
- * Register a module with Resonate. Registered functions can be invoked by calling {@link run}.
40
- *
41
- * @template F The type of the generator function.
42
- * @param module The module to register with Resonate.
43
- * @param opts Resonate options, can be constructed by calling {@link options}.
44
- * @returns Resonate function
45
- */
46
- registerModule(module, opts = {}) {
47
- super.registerModule(module, opts);
48
- }
49
- schedule(name, cron, func, ...args) {
50
- return super.schedule(name, cron, func, ...args);
51
- }
52
- }
53
- exports.Resonate = Resonate;
54
- /////////////////////////////////////////////////////////////////////
55
- // Context
56
- /////////////////////////////////////////////////////////////////////
57
- class Info {
58
- invocation;
59
- constructor(invocation) {
60
- this.invocation = invocation;
61
- }
62
- /**
63
- * The running count of function execution attempts.
64
- */
65
- get attempt() {
66
- return this.invocation.attempt;
67
- }
68
- /**
69
- * Uniquely identifies the function invocation.
70
- */
71
- get id() {
72
- return this.invocation.id;
73
- }
74
- /**
75
- * Deduplicates function invocations with the same id.
76
- */
77
- get idempotencyKey() {
78
- return this.invocation.idempotencyKey;
79
- }
80
- /**
81
- * All configured options for this info.
82
- */
83
- get opts() {
84
- return this.invocation.opts;
85
- }
86
- /**
87
- * The timestamp in ms, once this time elapses the function invocation will timeout.
88
- */
89
- get timeout() {
90
- return this.invocation.timeout;
91
- }
92
- /**
93
- * The resonate function version.
94
- */
95
- get version() {
96
- return this.invocation.root.opts.version;
97
- }
98
- }
99
- exports.Info = Info;
100
- class Context {
101
- invocation;
102
- constructor(invocation) {
103
- this.invocation = invocation;
104
- }
105
- /**
106
- * The running count of child function invocations.
107
- */
108
- get counter() {
109
- return this.invocation.counter;
110
- }
111
- /**
112
- * The time the invocation was created. Will use the durable promise creation time if available.
113
- */
114
- get createdOn() {
115
- return this.invocation.createdOn;
116
- }
117
- /**
118
- * Uniquely identifies the function invocation.
119
- */
120
- get id() {
121
- return this.invocation.id;
122
- }
123
- /**
124
- * Deduplicates function invocations with the same id.
125
- */
126
- get idempotencyKey() {
127
- return this.invocation.idempotencyKey;
128
- }
129
- /**
130
- * All configured options for this context.
131
- */
132
- get opts() {
133
- return this.invocation.opts;
134
- }
135
- /**
136
- * The timestamp in ms, once this time elapses the function invocation will timeout.
137
- */
138
- get timeout() {
139
- return this.invocation.timeout;
140
- }
141
- /**
142
- * The resonate function version.
143
- */
144
- get version() {
145
- return this.invocation.root.opts.version;
146
- }
147
- run(func, ...args) {
148
- return this._call(func, args, false);
149
- }
150
- call(func, ...args) {
151
- return this._call(func, args, true);
152
- }
153
- _call(func, argsWithOpts, yieldFuture) {
154
- const { args, opts } = this.invocation.split(argsWithOpts);
155
- if (typeof func === "string") {
156
- return { kind: "call", value: { kind: "deferred", func, args, opts }, yieldFuture };
157
- }
158
- else if (func.constructor.name === "GeneratorFunction") {
159
- return { kind: "call", value: { kind: "resonate", func, args, opts }, yieldFuture };
160
- }
161
- else {
162
- return { kind: "call", value: { kind: "ordinary", func, args, opts }, yieldFuture };
163
- }
164
- }
165
- /**
166
- * Construct options.
167
- *
168
- * @param opts A partial {@link Options} object.
169
- * @returns Options with the __resonate flag set.
170
- */
171
- options(opts = {}) {
172
- return { ...opts, __resonate: true };
173
- }
174
- }
175
- exports.Context = Context;
176
- /////////////////////////////////////////////////////////////////////
177
- // Scheduler
178
- /////////////////////////////////////////////////////////////////////
179
- class Scheduler {
180
- resonate;
181
- // tick is mutually exclusive
182
- running = false;
183
- // all top level executions
184
- cache = {};
185
- // executions ready to be run
186
- runnable = [];
187
- // executions that are awaiting another execution
188
- awaiting = [];
189
- // all executions
190
- executions = [];
191
- // executions that have been killed
192
- killed = [];
193
- constructor(resonate) {
194
- this.resonate = resonate;
195
- }
196
- add(name, id, func, args, opts, defaults, durablePromise) {
197
- // if the execution is already running, and not killed,
198
- // return the promise
199
- if (opts.durable && this.cache[id] && !this.cache[id].killed) {
200
- return this.cache[id].execute();
201
- }
202
- // params, used for recovery
203
- const param = {
204
- func: name,
205
- version: opts.version,
206
- args,
207
- };
208
- // create a new invocation
209
- const invocation = new invocation_1.Invocation(name, id, undefined, param, opts, defaults);
210
- // create a new execution
211
- const generator = func(new Context(invocation), ...args);
212
- const execution = new execution_1.GeneratorExecution(this.resonate, invocation, generator, durablePromise);
213
- // once the durable promise has been created,
214
- // add the execution to runnable if the future is pending
215
- execution.create().then(() => {
216
- if (invocation.future.pending) {
217
- this.runnable.push({ execution, next: { kind: "init" } });
218
- this.tick();
219
- }
220
- });
221
- // store the invocation and execution,
222
- // will be used if run is called again with the same id
223
- this.cache[id] = execution;
224
- this.executions.push(execution);
225
- return execution.execute();
226
- }
227
- async tick() {
228
- // need to ensure that tick is mutually exclusive,
229
- // if tick is already running all continuations will be picked up in the while loop
230
- if (this.running)
231
- return;
232
- this.running = true;
233
- while (this.runnable.length > 0) {
234
- // grab the next continuation
235
- const continuation = this.runnable.shift();
236
- // step through the generator if in debug mode
237
- if (this.resonate.logger.level === "debug" && (await this.keypress()) === "\u001b") {
238
- // kill when escape key is pressed
239
- continuation?.execution.kill("manual kill");
240
- }
241
- if (continuation && !continuation.execution.killed) {
242
- try {
243
- // apply the next value to the generator
244
- const result = this.next(continuation);
245
- // if done, we can resolve the execution
246
- if (result.done) {
247
- // need to handle the special case where a generator returns a future
248
- if (result.value instanceof future_1.Future) {
249
- result.value.promise.then((v) => continuation.execution.resolve(v), (e) => continuation.execution.reject(e));
250
- }
251
- else {
252
- // resolve the durable promise
253
- await continuation.execution.resolve(result.value);
254
- }
255
- }
256
- else {
257
- // apply the yielded value to the generator
258
- await this.apply(continuation, result.value);
259
- }
260
- }
261
- catch (error) {
262
- // if anything goes wrong, reject the durable promise
263
- await continuation.execution.reject(error);
264
- }
265
- // housekeeping
266
- if (continuation.execution.killed) {
267
- this.kill(continuation.execution);
268
- }
269
- }
270
- // print all invocations if in debug mode
271
- this.print();
272
- }
273
- // TODO: suspend
274
- // set running back to false
275
- this.running = false;
276
- }
277
- next({ execution, next }) {
278
- // apply the next value to the generator
279
- switch (next.kind) {
280
- case "init":
281
- return execution.generator.next();
282
- case "value":
283
- return execution.generator.next(next.value);
284
- case "error":
285
- return execution.generator.throw(next.error);
286
- default:
287
- this.yeet(`permitted continuation values are (init, value, error), received ${next}`);
288
- }
289
- }
290
- async apply(continuation, yielded) {
291
- // apply the yielded value to the generator
292
- switch (yielded.kind) {
293
- case "call":
294
- await this.applyCall(continuation, yielded);
295
- break;
296
- case "future":
297
- this.applyFuture(continuation, yielded);
298
- break;
299
- default:
300
- this.yeet(`permitted yielded values are (call, future), received ${yielded}`);
301
- }
302
- }
303
- async applyCall(continuation, { value, yieldFuture }) {
304
- // the parent is the current invocation
305
- const parent = continuation.execution.invocation;
306
- // the id is either:
307
- // 1. a provided string in the case of a deferred execution
308
- // 2. a generated string in the case of an ordinary execution
309
- const id = value.kind === "deferred" ? value.func : `${parent.id}.${parent.counter}`;
310
- // human readable name of the function
311
- const name = value.kind === "deferred" ? value.func : value.func.name;
312
- // default opts never change
313
- const defaults = parent.defaults;
314
- // param is only required for deferred executions
315
- const param = value.kind === "deferred" ? value.args[0] : undefined;
316
- // create a new invocation
317
- const invocation = new invocation_1.Invocation(name, id, undefined, param, value.opts, defaults, parent);
318
- // add child and increment counter
319
- parent.addChild(invocation);
320
- parent.counter++;
321
- let execution;
322
- if (value.kind === "resonate") {
323
- // create a generator execution
324
- const ctx = new Context(invocation);
325
- execution = new execution_1.GeneratorExecution(this.resonate, invocation, value.func(ctx, ...value.args));
326
- await execution.create();
327
- // if the future is pending, add to runnable
328
- if (invocation.future.pending) {
329
- this.runnable.push({ execution, next: { kind: "init" } });
330
- }
331
- }
332
- else if (value.kind === "ordinary") {
333
- // create an ordinary execution
334
- const info = new Info(invocation);
335
- execution = new execution_1.OrdinaryExecution(this.resonate, invocation, () => value.func(info, ...value.args));
336
- execution.execute().catch(() => { });
337
- }
338
- else if (value.kind === "deferred") {
339
- // create a deferred execution
340
- execution = new execution_1.DeferredExecution(this.resonate, invocation);
341
- execution.execute().catch(() => { });
342
- }
343
- else {
344
- this.yeet(`permitted call values are (resonate, ordinary, deferred), received ${value}`);
345
- }
346
- // add to all executions
347
- this.executions.push(execution);
348
- if (yieldFuture) {
349
- // if the call is expected to yield a future, add the future to runnable
350
- this.runnable.push({
351
- execution: continuation.execution,
352
- next: { kind: "value", value: invocation.future },
353
- });
354
- }
355
- else {
356
- // otherwise, skip ahead to apply future
357
- this.applyFuture(continuation, invocation.future);
358
- }
359
- }
360
- applyFuture({ execution }, future) {
361
- if (execution.invocation.future.root !== future.root) {
362
- this.yeet(`yielded future originates from ${future.root.id}, but this execution originates from ${execution.invocation.future.root.id}`);
363
- }
364
- // add to awaiting
365
- this.awaiting.push(execution);
366
- execution.invocation.await(future);
367
- execution.invocation.block(future);
368
- const apply = (next) => {
369
- // unblock
370
- execution.invocation.unblock();
371
- // remove from awaiting
372
- this.awaiting = this.awaiting.filter((e) => e !== execution);
373
- // add to runnable
374
- this.runnable.push({ execution, next });
375
- // tick again
376
- this.tick();
377
- };
378
- // add the next value to runnable when the future fulfills
379
- future.promise.then((value) => apply({ kind: "value", value }), (error) => apply({ kind: "error", error }));
380
- }
381
- kill(execution) {
382
- // add to killed
383
- const killed = this.executions.filter((e) => e.invocation.root === execution.invocation.root);
384
- this.killed = this.killed.concat(killed);
385
- // remove from awaiting and runnable
386
- this.runnable = this.runnable.filter((c) => c.execution.invocation.root !== execution.invocation.root);
387
- this.awaiting = this.awaiting.filter((e) => e.invocation.root !== execution.invocation.root);
388
- }
389
- async keypress() {
390
- this.resonate.logger.debug("Press any key to continue...");
391
- return new Promise((resolve) => {
392
- const onData = (data) => {
393
- process.stdin.removeListener("data", onData);
394
- process.stdin.setRawMode(false);
395
- process.stdin.pause();
396
- const c = data.toString();
397
- if (c === "\u0003") {
398
- this.resonate.logger.debug("^C");
399
- process.exit(1);
400
- }
401
- resolve(c);
402
- };
403
- process.stdin.resume();
404
- process.stdin.setRawMode(true);
405
- process.stdin.once("data", onData);
406
- });
407
- }
408
- print() {
409
- this.resonate.logger.debug("Executions");
410
- this.resonate.logger.table(this.executions.map((e) => ({
411
- name: e.invocation.name,
412
- id: e.invocation.id,
413
- idempotencyKey: e.invocation.idempotencyKey,
414
- parent: e.invocation.parent ? e.invocation.parent.id : undefined,
415
- killed: e.killed,
416
- pending: e.invocation.future.value.kind === "pending",
417
- awaited: e.invocation.awaited.map((f) => f.id).join(","),
418
- blocked: e.invocation.blocked?.id,
419
- })));
420
- }
421
- yeet(msg) {
422
- // an unrecoverable error has occurred, log and exit
423
- this.resonate.logger.error(msg);
424
- process.exit(1);
425
- }
426
- }
427
- //# sourceMappingURL=generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../lib/generator.ts"],"names":[],"mappings":";;;AAAA,gDAAuG;AACvG,0CAAwD;AACxD,kDAA+C;AAI/C,yCAA0C;AAkD1C,qEAAqE;AACrE,WAAW;AACX,qEAAqE;AAErE,MAAa,QAAS,SAAQ,uBAAY;IAChC,SAAS,CAAY;IAE7B;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