@resonatehq/sdk 0.3.3 → 0.3.4

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 (79) hide show
  1. package/dist/async.d.ts +135 -0
  2. package/dist/async.d.ts.map +1 -0
  3. package/dist/async.js +205 -0
  4. package/dist/core/encoder.d.ts +5 -0
  5. package/dist/core/encoder.d.ts.map +1 -0
  6. package/dist/core/encoder.js +1 -0
  7. package/dist/core/encoders/base64.d.ts +6 -0
  8. package/dist/core/encoders/base64.d.ts.map +1 -0
  9. package/dist/core/encoders/base64.js +8 -0
  10. package/dist/core/encoders/json.d.ts +6 -0
  11. package/dist/core/encoders/json.d.ts.map +1 -0
  12. package/dist/core/encoders/json.js +60 -0
  13. package/dist/core/errors.d.ts +21 -0
  14. package/dist/core/errors.d.ts.map +1 -0
  15. package/dist/core/errors.js +33 -0
  16. package/dist/core/execution.d.ts +44 -0
  17. package/dist/core/execution.d.ts.map +1 -0
  18. package/dist/core/execution.js +195 -0
  19. package/dist/core/future.d.ts +54 -0
  20. package/dist/core/future.d.ts.map +1 -0
  21. package/dist/core/future.js +95 -0
  22. package/dist/core/invocation.d.ts +43 -0
  23. package/dist/core/invocation.d.ts.map +1 -0
  24. package/dist/core/invocation.js +72 -0
  25. package/dist/core/logger.d.ts +10 -0
  26. package/dist/core/logger.d.ts.map +1 -0
  27. package/dist/core/logger.js +1 -0
  28. package/dist/core/loggers/logger.d.ts +13 -0
  29. package/dist/core/loggers/logger.d.ts.map +1 -0
  30. package/dist/core/loggers/logger.js +43 -0
  31. package/dist/core/options.d.ts +79 -0
  32. package/dist/core/options.d.ts.map +1 -0
  33. package/dist/core/options.js +3 -0
  34. package/dist/core/promises/promises.d.ts +47 -0
  35. package/dist/core/promises/promises.d.ts.map +1 -0
  36. package/dist/core/promises/promises.js +128 -0
  37. package/dist/core/promises/types.d.ts +99 -0
  38. package/dist/core/promises/types.d.ts.map +1 -0
  39. package/dist/core/promises/types.js +29 -0
  40. package/dist/core/retries/retry.d.ts +20 -0
  41. package/dist/core/retries/retry.d.ts.map +1 -0
  42. package/dist/core/retries/retry.js +36 -0
  43. package/dist/core/retry.d.ts +27 -0
  44. package/dist/core/retry.d.ts.map +1 -0
  45. package/dist/core/retry.js +17 -0
  46. package/dist/core/schedules/types.d.ts +19 -0
  47. package/dist/core/schedules/types.d.ts.map +1 -0
  48. package/dist/core/schedules/types.js +3 -0
  49. package/dist/core/storage.d.ts +6 -0
  50. package/dist/core/storage.d.ts.map +1 -0
  51. package/dist/core/storage.js +1 -0
  52. package/dist/core/storages/memory.d.ts +8 -0
  53. package/dist/core/storages/memory.d.ts.map +1 -0
  54. package/dist/core/storages/memory.js +22 -0
  55. package/dist/core/storages/withTimeout.d.ts +10 -0
  56. package/dist/core/storages/withTimeout.d.ts.map +1 -0
  57. package/dist/core/storages/withTimeout.js +38 -0
  58. package/dist/core/store.d.ts +139 -0
  59. package/dist/core/store.d.ts.map +1 -0
  60. package/dist/core/store.js +1 -0
  61. package/dist/core/stores/local.d.ts +54 -0
  62. package/dist/core/stores/local.d.ts.map +1 -0
  63. package/dist/core/stores/local.js +368 -0
  64. package/dist/core/stores/remote.d.ts +48 -0
  65. package/dist/core/stores/remote.d.ts.map +1 -0
  66. package/dist/core/stores/remote.js +399 -0
  67. package/dist/core/utils.d.ts +3 -0
  68. package/dist/core/utils.d.ts.map +1 -0
  69. package/dist/core/utils.js +13 -0
  70. package/dist/generator.d.ts +187 -0
  71. package/dist/generator.d.ts.map +1 -0
  72. package/dist/generator.js +396 -0
  73. package/dist/index.d.ts +4 -0
  74. package/dist/index.d.ts.map +1 -0
  75. package/dist/index.js +3 -0
  76. package/dist/resonate.d.ts +73 -0
  77. package/dist/resonate.d.ts.map +1 -0
  78. package/dist/resonate.js +142 -0
  79. package/package.json +1 -1
@@ -0,0 +1,139 @@
1
+ import { DurablePromise, PendingPromise, ResolvedPromise, RejectedPromise, CanceledPromise, TimedoutPromise } from "./promises/types";
2
+ import { Schedule } from "./schedules/types";
3
+ /**
4
+ * Store Interface
5
+ */
6
+ export interface IStore {
7
+ readonly promises: IPromiseStore;
8
+ readonly schedules: IScheduleStore;
9
+ readonly locks: ILockStore;
10
+ }
11
+ /**
12
+ * Promise Store API
13
+ */
14
+ export interface IPromiseStore {
15
+ /**
16
+ * Creates a new durable promise
17
+ *
18
+ * @param id Unique identifier for the promise.
19
+ * @param ikey Idempotency key associated with the create operation.
20
+ * @param strict If true, deduplicates only if the promise is pending.
21
+ * @param headers Key value pairs associated with the data.
22
+ * @param data Encoded data of type string.
23
+ * @param timeout Time (in milliseconds) after which the promise is considered expired.
24
+ * @param tags Key value pairs associated with the promise.
25
+ * @returns A durable promise that is pending, canceled, resolved, or rejected.
26
+ */
27
+ create(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined, timeout: number, tags: Record<string, string> | undefined): Promise<PendingPromise | CanceledPromise | ResolvedPromise | RejectedPromise | TimedoutPromise>;
28
+ /**
29
+ * Cancels a new promise.
30
+ *
31
+ * @param id Unique identifier for the promise.
32
+ * @param ikey Idempotency key associated with the create operation.
33
+ * @param strict If true, deduplicates only if the promise is canceled.
34
+ * @param headers Key value pairs associated with the data.
35
+ * @param data Encoded data of type string.
36
+ * @returns A durable promise that is canceled, resolved, or rejected.
37
+ */
38
+ cancel(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<CanceledPromise | ResolvedPromise | RejectedPromise | TimedoutPromise>;
39
+ /**
40
+ * Resolves a promise.
41
+ *
42
+ * @param id Unique identifier for the promise to be resolved.
43
+ * @param ikey Idempotency key associated with the resolve promise.
44
+ * @param strict If true, deduplicates only if the promise is resolved.
45
+ * @param headers Key value pairs associated with the data.
46
+ * @param data Encoded data of type string.
47
+ * @returns A durable promise that is canceled, resolved, or rejected.
48
+ */
49
+ resolve(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<CanceledPromise | ResolvedPromise | RejectedPromise | TimedoutPromise>;
50
+ /**
51
+ * Rejects a promise
52
+ *
53
+ * @param id Unique identifier for the promise to be rejected.
54
+ * @param ikey Integration key associated with the promise.
55
+ * @param strict If true, deduplicates only if the promise is rejected.
56
+ * @param headers Key value pairs associated with the data.
57
+ * @param data Encoded data of type string.
58
+ * @returns A durable promise that is canceled, resolved, or rejected.
59
+ */
60
+ reject(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<CanceledPromise | ResolvedPromise | RejectedPromise | TimedoutPromise>;
61
+ /**
62
+ * Retrieves a promise based on its id.
63
+ *
64
+ * @param id Unique identifier for the promise to be retrieved.
65
+ * @returns A durable promise that is pending, canceled, resolved, or rejected.
66
+ */
67
+ get(id: string): Promise<DurablePromise>;
68
+ /**
69
+ * Search for promises.
70
+ *
71
+ * @param id Ids to match, can include wildcards.
72
+ * @param tags Tags to match.
73
+ * @returns A list of Durable Promises.
74
+ */
75
+ search(id: string, state: string | undefined, tags: Record<string, string> | undefined, limit?: number): AsyncGenerator<DurablePromise[], void>;
76
+ }
77
+ /**
78
+ * Schedule Store API
79
+ */
80
+ export interface IScheduleStore {
81
+ /**
82
+ * Creates a new schedule.
83
+ *
84
+ * @param id Unique identifier for the schedule.
85
+ * @param ikey Idempotency key associated with the create operation.
86
+ * @param description Description of the schedule.
87
+ * @param cron CRON expression defining the schedule's execution time.
88
+ * @param tags Key-value pairs associated with the schedule.
89
+ * @param promiseId Unique identifier for the associated promise.
90
+ * @param promiseTimeout Timeout for the associated promise in milliseconds.
91
+ * @param promiseHeaders Headers associated with the promise data.
92
+ * @param promiseData Encoded data for the promise of type string.
93
+ * @param promiseTags Key-value pairs associated with the promise.
94
+ * @returns A Promise resolving to the created schedule.
95
+ */
96
+ create(id: string, ikey: string | undefined, description: string | undefined, cron: string, tags: Record<string, string> | undefined, promiseId: string, promiseTimeout: number, promiseHeaders: Record<string, string> | undefined, promiseData: string | undefined, promiseTags: Record<string, string> | undefined): Promise<Schedule>;
97
+ /**
98
+ * Retrieves a schedule based on its id.
99
+ *
100
+ * @param id Unique identifier for the promise to be retrieved.
101
+ * @returns A promise schedule that is pending, canceled, resolved, or rejected.
102
+ */
103
+ get(id: string): Promise<Schedule>;
104
+ /**
105
+ * Deletes a schedule based on its id.
106
+ * @param id Unique identifier for the promise to be deleted.
107
+ * @returns A promise schedule that is pending, canceled, resolved, or rejected.
108
+ */
109
+ delete(id: string): Promise<void>;
110
+ /**
111
+ * Search for schedules.
112
+ *
113
+ * @param id Ids to match, can include wildcards.
114
+ * @param tags Tags to match.
115
+ * @returns A list of promise schedules.
116
+ */
117
+ search(id: string, tags: Record<string, string> | undefined, limit?: number): AsyncGenerator<Schedule[], void>;
118
+ }
119
+ /**
120
+ * Lock Store API
121
+ */
122
+ export interface ILockStore {
123
+ /**
124
+ * Try to acquire a lock.
125
+ *
126
+ * @param id Id of lock.
127
+ * @param eid Execution id of lock.
128
+ * @returns A boolean indicating whether or not the lock was acquired.
129
+ */
130
+ tryAcquire(id: string, eid: string): Promise<boolean>;
131
+ /**
132
+ * Release a lock.
133
+ *
134
+ * @param id Id of lock.
135
+ * @param eid Execution id of lock.
136
+ */
137
+ release(id: string, eid: string): Promise<void>;
138
+ }
139
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../lib/core/store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED;;GAE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AAG,cAAc,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;CAChH;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtD;;;;;OAKG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ import { ILogger } from "../logger";
2
+ import { DurablePromise, PendingPromise, ResolvedPromise, RejectedPromise, CanceledPromise, TimedoutPromise } from "../promises/types";
3
+ import { Schedule } from "../schedules/types";
4
+ import { IStorage } from "../storage";
5
+ import { IStore, IPromiseStore, IScheduleStore, ILockStore } from "../store";
6
+ export declare class LocalStore implements IStore {
7
+ private logger;
8
+ promises: LocalPromiseStore;
9
+ schedules: LocalScheduleStore;
10
+ locks: LocalLockStore;
11
+ private toSchedule;
12
+ private next;
13
+ constructor(logger?: ILogger, promiseStorage?: IStorage<DurablePromise>, scheduleStorage?: IStorage<Schedule>, lockStorage?: IStorage<{
14
+ id: string;
15
+ eid: string;
16
+ }>);
17
+ addSchedule(schedule: Schedule): void;
18
+ deleteSchedule(id: string): void;
19
+ private init;
20
+ private setSchedule;
21
+ private schedulePromise;
22
+ private generatePromiseId;
23
+ }
24
+ export declare class LocalPromiseStore implements IPromiseStore {
25
+ private storage;
26
+ constructor(storage?: IStorage<DurablePromise>);
27
+ create(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined, timeout: number, tags: Record<string, string> | undefined): Promise<PendingPromise | ResolvedPromise | RejectedPromise | CanceledPromise | TimedoutPromise>;
28
+ resolve(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<ResolvedPromise | RejectedPromise | CanceledPromise | TimedoutPromise>;
29
+ reject(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<ResolvedPromise | RejectedPromise | CanceledPromise | TimedoutPromise>;
30
+ cancel(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<ResolvedPromise | RejectedPromise | CanceledPromise | TimedoutPromise>;
31
+ get(id: string): Promise<DurablePromise>;
32
+ search(id: string, state?: string, tags?: Record<string, string>, limit?: number): AsyncGenerator<DurablePromise[], void>;
33
+ }
34
+ export declare class LocalScheduleStore implements IScheduleStore {
35
+ private storage;
36
+ private store;
37
+ constructor(storage?: IStorage<Schedule>, store?: LocalStore | undefined);
38
+ create(id: string, ikey: string | undefined, description: string | undefined, cron: string, tags: Record<string, string> | undefined, promiseId: string, promiseTimeout: number, promiseHeaders: Record<string, string>, promiseData: string | undefined, promiseTags: Record<string, string> | undefined): Promise<Schedule>;
39
+ update(id: string, lastRunTime: number): Promise<Schedule | undefined>;
40
+ delete(id: string): Promise<void>;
41
+ get(id: string): Promise<Schedule>;
42
+ search(id: string, tags?: Record<string, string>, limit?: number): AsyncGenerator<Schedule[], void>;
43
+ private nextRunTime;
44
+ }
45
+ export declare class LocalLockStore implements ILockStore {
46
+ private storage;
47
+ constructor(storage?: IStorage<{
48
+ id: string;
49
+ eid: string;
50
+ }>);
51
+ tryAcquire(id: string, eid: string): Promise<boolean>;
52
+ release(id: string, eid: string): Promise<void>;
53
+ }
54
+ //# sourceMappingURL=local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../lib/core/stores/local.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EAMhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBA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@
1
+ import * as cronParser from "cron-parser";
2
+ import { ErrorCodes, ResonateError } from "../errors";
3
+ import { Logger } from "../loggers/logger";
4
+ import { isPendingPromise, isResolvedPromise, isRejectedPromise, isCanceledPromise, isTimedoutPromise, } from "../promises/types";
5
+ import { MemoryStorage } from "../storages/memory";
6
+ import { WithTimeout } from "../storages/withTimeout";
7
+ export class LocalStore {
8
+ logger;
9
+ promises;
10
+ schedules;
11
+ locks;
12
+ toSchedule = [];
13
+ next = undefined;
14
+ constructor(logger = new Logger(), promiseStorage = new WithTimeout(new MemoryStorage()), scheduleStorage = new MemoryStorage(), lockStorage = new MemoryStorage()) {
15
+ this.logger = logger;
16
+ this.promises = new LocalPromiseStore(promiseStorage);
17
+ this.schedules = new LocalScheduleStore(scheduleStorage, this);
18
+ this.locks = new LocalLockStore(lockStorage);
19
+ this.init();
20
+ }
21
+ // handler the schedule store can call
22
+ addSchedule(schedule) {
23
+ this.toSchedule = this.toSchedule.filter((s) => s.id != schedule.id).concat(schedule);
24
+ this.setSchedule();
25
+ }
26
+ // handler the schedule store can call
27
+ deleteSchedule(id) {
28
+ this.toSchedule = this.toSchedule.filter((s) => s.id != id);
29
+ this.setSchedule();
30
+ }
31
+ async init() {
32
+ for await (const schedules of this.schedules.search("*", undefined, undefined)) {
33
+ this.toSchedule = this.toSchedule.concat(schedules);
34
+ }
35
+ this.setSchedule();
36
+ }
37
+ setSchedule() {
38
+ // clear timeout
39
+ if (this.next) {
40
+ clearTimeout(this.next);
41
+ }
42
+ // sort array in ascending order by nextRunTime
43
+ this.toSchedule.sort((a, b) => a.nextRunTime - b.nextRunTime);
44
+ if (this.toSchedule.length > 0) {
45
+ // set new timeout to schedule promise
46
+ // + converts to number
47
+ this.next = +setTimeout(() => this.schedulePromise(), this.toSchedule[0].nextRunTime - Date.now());
48
+ }
49
+ }
50
+ schedulePromise() {
51
+ this.next = undefined;
52
+ const schedule = this.toSchedule.shift();
53
+ if (schedule) {
54
+ const id = this.generatePromiseId(schedule);
55
+ // create promise
56
+ try {
57
+ this.promises.create(id, id, false, schedule.promiseParam?.headers, schedule.promiseParam?.data, Date.now() + schedule.promiseTimeout, { ...schedule.promiseTags, "resonate:schedule": schedule.id, "resonate:invocation": "true" });
58
+ }
59
+ catch (error) {
60
+ this.logger.warn("error creating scheduled promise", error);
61
+ }
62
+ // update schedule
63
+ try {
64
+ this.schedules.update(schedule.id, schedule.nextRunTime);
65
+ }
66
+ catch (error) {
67
+ this.logger.warn("error updating schedule", error);
68
+ }
69
+ }
70
+ }
71
+ generatePromiseId(schedule) {
72
+ return schedule.promiseId
73
+ .replace("{{.id}}", schedule.id)
74
+ .replace("{{.timestamp}}", schedule.nextRunTime.toString());
75
+ }
76
+ }
77
+ export class LocalPromiseStore {
78
+ storage;
79
+ constructor(storage = new MemoryStorage()) {
80
+ this.storage = storage;
81
+ }
82
+ async create(id, ikey, strict, headers, data, timeout, tags) {
83
+ return this.storage.rmw(id, (promise) => {
84
+ if (!promise) {
85
+ return {
86
+ state: "PENDING",
87
+ id: id,
88
+ timeout: timeout,
89
+ param: {
90
+ headers: headers,
91
+ data: data,
92
+ },
93
+ value: {
94
+ headers: undefined,
95
+ data: undefined,
96
+ },
97
+ createdOn: Date.now(),
98
+ completedOn: undefined,
99
+ idempotencyKeyForCreate: ikey,
100
+ idempotencyKeyForComplete: undefined,
101
+ tags: tags,
102
+ };
103
+ }
104
+ if (strict && !isPendingPromise(promise)) {
105
+ throw new ResonateError("Forbidden request", ErrorCodes.STORE_FORBIDDEN);
106
+ }
107
+ if (promise.idempotencyKeyForCreate === undefined || ikey !== promise.idempotencyKeyForCreate) {
108
+ throw new ResonateError("Forbidden request", ErrorCodes.STORE_FORBIDDEN);
109
+ }
110
+ return promise;
111
+ });
112
+ }
113
+ async resolve(id, ikey, strict, headers, data) {
114
+ return this.storage.rmw(id, (promise) => {
115
+ if (!promise) {
116
+ throw new ResonateError("Not found", ErrorCodes.STORE_NOT_FOUND);
117
+ }
118
+ if (isPendingPromise(promise)) {
119
+ return {
120
+ state: "RESOLVED",
121
+ id: promise.id,
122
+ timeout: promise.timeout,
123
+ param: promise.param,
124
+ value: {
125
+ headers: headers,
126
+ data: data,
127
+ },
128
+ createdOn: promise.createdOn,
129
+ completedOn: Date.now(),
130
+ idempotencyKeyForCreate: promise.idempotencyKeyForCreate,
131
+ idempotencyKeyForComplete: ikey,
132
+ tags: promise.tags,
133
+ };
134
+ }
135
+ if (strict && !isResolvedPromise(promise)) {
136
+ throw new ResonateError("Forbidden request", ErrorCodes.STORE_FORBIDDEN);
137
+ }
138
+ if (!isTimedoutPromise(promise) &&
139
+ (promise.idempotencyKeyForComplete === undefined || ikey !== promise.idempotencyKeyForComplete)) {
140
+ throw new ResonateError("Forbidden request", ErrorCodes.STORE_FORBIDDEN);
141
+ }
142
+ return promise;
143
+ });
144
+ }
145
+ async reject(id, ikey, strict, headers, data) {
146
+ return this.storage.rmw(id, (promise) => {
147
+ if (!promise) {
148
+ throw new ResonateError("Not found", ErrorCodes.STORE_NOT_FOUND);
149
+ }
150
+ if (isPendingPromise(promise)) {
151
+ return {
152
+ state: "REJECTED",
153
+ id: promise.id,
154
+ timeout: promise.timeout,
155
+ param: promise.param,
156
+ value: {
157
+ headers: headers,
158
+ data: data,
159
+ },
160
+ createdOn: promise.createdOn,
161
+ completedOn: Date.now(),
162
+ idempotencyKeyForCreate: promise.idempotencyKeyForCreate,
163
+ idempotencyKeyForComplete: ikey,
164
+ tags: promise.tags,
165
+ };
166
+ }
167
+ if (strict && !isRejectedPromise(promise)) {
168
+ throw new ResonateError("Forbidden request", ErrorCodes.STORE_FORBIDDEN);
169
+ }
170
+ if (!isTimedoutPromise(promise) &&
171
+ (promise.idempotencyKeyForComplete === undefined || ikey !== promise.idempotencyKeyForComplete)) {
172
+ throw new ResonateError("Forbidden request", ErrorCodes.STORE_FORBIDDEN);
173
+ }
174
+ return promise;
175
+ });
176
+ }
177
+ async cancel(id, ikey, strict, headers, data) {
178
+ return this.storage.rmw(id, (promise) => {
179
+ if (!promise) {
180
+ throw new ResonateError("Not found", ErrorCodes.STORE_NOT_FOUND);
181
+ }
182
+ if (isPendingPromise(promise)) {
183
+ return {
184
+ state: "REJECTED_CANCELED",
185
+ id: promise.id,
186
+ timeout: promise.timeout,
187
+ param: promise.param,
188
+ value: {
189
+ headers: headers,
190
+ data: data,
191
+ },
192
+ createdOn: promise.createdOn,
193
+ completedOn: Date.now(),
194
+ idempotencyKeyForCreate: promise.idempotencyKeyForCreate,
195
+ idempotencyKeyForComplete: ikey,
196
+ tags: promise.tags,
197
+ };
198
+ }
199
+ if (strict && !isCanceledPromise(promise)) {
200
+ throw new ResonateError("Forbidden request", ErrorCodes.STORE_FORBIDDEN);
201
+ }
202
+ if (!isTimedoutPromise(promise) &&
203
+ (promise.idempotencyKeyForComplete === undefined || ikey !== promise.idempotencyKeyForComplete)) {
204
+ throw new ResonateError("Forbidden request", ErrorCodes.STORE_FORBIDDEN);
205
+ }
206
+ return promise;
207
+ });
208
+ }
209
+ async get(id) {
210
+ const promise = await this.storage.rmw(id, (p) => p);
211
+ if (!promise) {
212
+ throw new ResonateError("Not found", ErrorCodes.STORE_NOT_FOUND);
213
+ }
214
+ return promise;
215
+ }
216
+ async *search(id, state, tags, limit) {
217
+ // filter the promises returned from all storage
218
+ const regex = new RegExp(id.replaceAll("*", ".*"));
219
+ const states = searchStates(state);
220
+ const tagEntries = Object.entries(tags ?? {});
221
+ for await (const promises of this.storage.all()) {
222
+ yield promises
223
+ .filter((p) => states.includes(p.state))
224
+ .filter((p) => regex.test(p.id))
225
+ .filter((p) => tagEntries.every(([k, v]) => p.tags?.[k] == v));
226
+ }
227
+ }
228
+ }
229
+ export class LocalScheduleStore {
230
+ storage;
231
+ store;
232
+ constructor(storage = new MemoryStorage(), store = undefined) {
233
+ this.storage = storage;
234
+ this.store = store;
235
+ }
236
+ async create(id, ikey, description, cron, tags, promiseId, promiseTimeout, promiseHeaders, promiseData, promiseTags) {
237
+ const schedule = await this.storage.rmw(id, (schedule) => {
238
+ if (schedule) {
239
+ if (schedule.idempotencyKey === undefined || ikey != schedule.idempotencyKey) {
240
+ throw new ResonateError("Already exists", ErrorCodes.STORE_ALREADY_EXISTS);
241
+ }
242
+ return schedule;
243
+ }
244
+ const createdOn = Date.now();
245
+ let nextRunTime;
246
+ try {
247
+ nextRunTime = this.nextRunTime(cron, createdOn);
248
+ }
249
+ catch (error) {
250
+ throw ResonateError.fromError(error);
251
+ }
252
+ return {
253
+ id,
254
+ description,
255
+ cron,
256
+ tags,
257
+ promiseId,
258
+ promiseTimeout,
259
+ promiseParam: {
260
+ headers: promiseHeaders,
261
+ data: promiseData,
262
+ },
263
+ promiseTags,
264
+ lastRunTime: undefined,
265
+ nextRunTime: nextRunTime,
266
+ idempotencyKey: ikey,
267
+ createdOn: createdOn,
268
+ };
269
+ });
270
+ if (this.store) {
271
+ this.store.addSchedule(schedule);
272
+ }
273
+ return schedule;
274
+ }
275
+ async update(id, lastRunTime) {
276
+ const schedule = await this.storage.rmw(id, (schedule) => {
277
+ if (!schedule) {
278
+ throw new ResonateError("Not found", ErrorCodes.STORE_NOT_FOUND);
279
+ }
280
+ // update iff not already updated
281
+ if (schedule.nextRunTime === lastRunTime) {
282
+ let nextRunTime;
283
+ try {
284
+ nextRunTime = this.nextRunTime(schedule.cron, lastRunTime);
285
+ }
286
+ catch (error) {
287
+ throw ResonateError.fromError(error);
288
+ }
289
+ schedule.lastRunTime = lastRunTime;
290
+ schedule.nextRunTime = nextRunTime;
291
+ }
292
+ return schedule;
293
+ });
294
+ if (this.store) {
295
+ this.store.addSchedule(schedule);
296
+ }
297
+ return schedule;
298
+ }
299
+ async delete(id) {
300
+ const result = await this.storage.rmd(id, () => true);
301
+ if (!result) {
302
+ throw new ResonateError("Not found", ErrorCodes.STORE_NOT_FOUND);
303
+ }
304
+ }
305
+ async get(id) {
306
+ const schedule = await this.storage.rmw(id, (s) => s);
307
+ if (!schedule) {
308
+ throw new ResonateError("Not found", ErrorCodes.STORE_NOT_FOUND);
309
+ }
310
+ return schedule;
311
+ }
312
+ async *search(id, tags, limit) {
313
+ // filter the schedules returned from storage
314
+ const regex = new RegExp(id.replaceAll("*", ".*"));
315
+ const tagEntries = Object.entries(tags ?? {});
316
+ for await (const schedules of this.storage.all()) {
317
+ yield schedules.filter((s) => regex.test(s.id)).filter((s) => tagEntries.every(([k, v]) => s.tags?.[k] == v));
318
+ }
319
+ }
320
+ nextRunTime(cron, lastRunTime) {
321
+ return cronParser
322
+ .parseExpression(cron, { currentDate: new Date(lastRunTime) })
323
+ .next()
324
+ .getTime();
325
+ }
326
+ }
327
+ export class LocalLockStore {
328
+ storage;
329
+ constructor(storage = new MemoryStorage()) {
330
+ this.storage = storage;
331
+ }
332
+ async tryAcquire(id, eid) {
333
+ const lock = await this.storage.rmw(id, (lock) => {
334
+ if (!lock || lock.eid === eid) {
335
+ return {
336
+ id,
337
+ eid,
338
+ };
339
+ }
340
+ return lock;
341
+ });
342
+ if (lock.eid !== eid) {
343
+ throw new ResonateError("Forbidden request", ErrorCodes.STORE_FORBIDDEN);
344
+ }
345
+ return lock.eid === eid;
346
+ }
347
+ async release(id, eid) {
348
+ const result = await this.storage.rmd(id, (lock) => lock.eid === eid);
349
+ if (!result) {
350
+ throw new ResonateError("Not found", ErrorCodes.STORE_NOT_FOUND);
351
+ }
352
+ }
353
+ }
354
+ // Utils
355
+ function searchStates(state) {
356
+ if (state?.toLowerCase() == "pending") {
357
+ return ["PENDING"];
358
+ }
359
+ else if (state?.toLowerCase() == "resolved") {
360
+ return ["RESOLVED"];
361
+ }
362
+ else if (state?.toLowerCase() == "rejected") {
363
+ return ["REJECTED", "REJECTED_CANCELED", "REJECTED_TIMEDOUT"];
364
+ }
365
+ else {
366
+ return ["PENDING", "RESOLVED", "REJECTED", "REJECTED_CANCELED", "REJECTED_TIMEDOUT"];
367
+ }
368
+ }
@@ -0,0 +1,48 @@
1
+ import { IEncoder } from "../encoder";
2
+ import { ILogger } from "../logger";
3
+ import { DurablePromise, PendingPromise, ResolvedPromise, RejectedPromise, CanceledPromise, TimedoutPromise } from "../promises/types";
4
+ import { Schedule } from "../schedules/types";
5
+ import { IStore, IPromiseStore, IScheduleStore, ILockStore } from "../store";
6
+ export declare class RemoteStore implements IStore {
7
+ promises: RemotePromiseStore;
8
+ schedules: RemoteScheduleStore;
9
+ locks: RemoteLockStore;
10
+ constructor(url: string, pid: string, logger?: ILogger, encoder?: IEncoder<string, string>);
11
+ }
12
+ export declare class RemotePromiseStore implements IPromiseStore {
13
+ private url;
14
+ private logger;
15
+ private encoder;
16
+ constructor(url: string, logger?: ILogger, encoder?: IEncoder<string, string>);
17
+ create(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined, timeout: number, tags: Record<string, string> | undefined): Promise<PendingPromise | CanceledPromise | ResolvedPromise | RejectedPromise | TimedoutPromise>;
18
+ cancel(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<ResolvedPromise | RejectedPromise | CanceledPromise | TimedoutPromise>;
19
+ resolve(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<ResolvedPromise | RejectedPromise | CanceledPromise | TimedoutPromise>;
20
+ reject(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<ResolvedPromise | RejectedPromise | CanceledPromise | TimedoutPromise>;
21
+ get(id: string): Promise<DurablePromise>;
22
+ search(id: string, state: string | undefined, tags: Record<string, string> | undefined, limit: number | undefined): AsyncGenerator<DurablePromise[], void>;
23
+ }
24
+ export declare class RemoteScheduleStore implements IScheduleStore {
25
+ private url;
26
+ private logger;
27
+ private encoder;
28
+ constructor(url: string, logger?: ILogger, encoder?: IEncoder<string, string>);
29
+ create(id: string, ikey: string | undefined, description: string | undefined, cron: string, tags: Record<string, string> | undefined, promiseId: string, promiseTimeout: number, promiseHeaders: Record<string, string> | undefined, promiseData: string | undefined, promiseTags: Record<string, string> | undefined): Promise<Schedule>;
30
+ get(id: string): Promise<Schedule>;
31
+ delete(id: string): Promise<void>;
32
+ search(id: string, tags: Record<string, string> | undefined, limit: number | undefined): AsyncGenerator<Schedule[], void>;
33
+ }
34
+ export declare class RemoteLockStore implements ILockStore {
35
+ private url;
36
+ private pid;
37
+ private logger;
38
+ private lockTimeout;
39
+ private heartbeatDelay;
40
+ private hearbeatInterval;
41
+ constructor(url: string, pid: string, logger?: ILogger, lockTimeout?: number);
42
+ tryAcquire(resourceId: string, executionId: string): Promise<boolean>;
43
+ release(resourceId: string, executionId: string): Promise<void>;
44
+ private startHeartbeat;
45
+ private stopHeartbeat;
46
+ private heartbeat;
47
+ }
48
+ //# sourceMappingURL=remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../lib/core/stores/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EAGhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAc,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE7E,qBAAa,WAAY,YAAW,MAAM;IACjC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,EAAE,eAAe,CAAC;gBAG5B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,OAAsB,EAC9B,OAAO,GAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAuB;CAM1D;AAED,qBAAa,kBAAmB,YAAW,aAAa;IAEpD,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,MAAM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