@resonatehq/sdk 0.6.3 → 0.7.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.
- package/README.md +24 -45
- package/dist/dev/network.d.ts +16 -0
- package/dist/dev/network.d.ts.map +1 -0
- package/dist/dev/network.js +89 -0
- package/dist/dev/network.js.map +1 -0
- package/dist/dev/server.d.ts +87 -0
- package/dist/dev/server.d.ts.map +1 -0
- package/dist/dev/server.js +891 -0
- package/dist/dev/server.js.map +1 -0
- package/dist/sim/example-1.d.ts +2 -0
- package/dist/sim/example-1.d.ts.map +1 -0
- package/dist/sim/example-1.js +94 -0
- package/dist/sim/example-1.js.map +1 -0
- package/dist/sim/example-2.d.ts +2 -0
- package/dist/sim/example-2.d.ts.map +1 -0
- package/dist/sim/example-2.js +95 -0
- package/dist/sim/example-2.js.map +1 -0
- package/dist/sim/example-3.d.ts +2 -0
- package/dist/sim/example-3.d.ts.map +1 -0
- package/dist/sim/example-3.js +95 -0
- package/dist/sim/example-3.js.map +1 -0
- package/dist/sim/main.d.ts +14 -0
- package/dist/sim/main.d.ts.map +1 -0
- package/dist/sim/main.js +206 -0
- package/dist/sim/main.js.map +1 -0
- package/dist/sim/src/server.d.ts +15 -0
- package/dist/sim/src/server.d.ts.map +1 -0
- package/dist/sim/src/server.js +85 -0
- package/dist/sim/src/server.js.map +1 -0
- package/dist/sim/src/simulator.d.ts +65 -0
- package/dist/sim/src/simulator.d.ts.map +1 -0
- package/dist/sim/src/simulator.js +235 -0
- package/dist/sim/src/simulator.js.map +1 -0
- package/dist/sim/src/worker.d.ts +22 -0
- package/dist/sim/src/worker.d.ts.map +1 -0
- package/dist/sim/src/worker.js +175 -0
- package/dist/sim/src/worker.js.map +1 -0
- package/dist/src/clock.d.ts +11 -0
- package/dist/src/clock.d.ts.map +1 -0
- package/dist/src/clock.js +17 -0
- package/dist/src/clock.js.map +1 -0
- package/dist/src/computation.d.ts +40 -0
- package/dist/src/computation.d.ts.map +1 -0
- package/dist/src/computation.js +225 -0
- package/dist/src/computation.js.map +1 -0
- package/dist/src/context.d.ts +120 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +288 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/coroutine.d.ts +35 -0
- package/dist/src/coroutine.d.ts.map +1 -0
- package/dist/src/coroutine.js +251 -0
- package/dist/src/coroutine.js.map +1 -0
- package/dist/src/decorator.d.ts +14 -0
- package/dist/src/decorator.d.ts.map +1 -0
- package/dist/src/decorator.js +208 -0
- package/dist/src/decorator.js.map +1 -0
- package/dist/src/handler.d.ts +40 -0
- package/dist/src/handler.d.ts.map +1 -0
- package/dist/src/handler.js +198 -0
- package/dist/src/handler.js.map +1 -0
- package/dist/src/heartbeat.d.ts +22 -0
- package/dist/src/heartbeat.d.ts.map +1 -0
- package/dist/src/heartbeat.js +87 -0
- package/dist/src/heartbeat.js.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +25 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/network/network.d.ts +216 -0
- package/dist/src/network/network.d.ts.map +1 -0
- package/dist/{core/logger.js → src/network/network.js} +2 -1
- package/dist/src/network/network.js.map +1 -0
- package/dist/src/network/remote.d.ts +67 -0
- package/dist/src/network/remote.d.ts.map +1 -0
- package/dist/src/network/remote.js +514 -0
- package/dist/src/network/remote.js.map +1 -0
- package/dist/src/nursery.d.ts +19 -0
- package/dist/src/nursery.d.ts.map +1 -0
- package/dist/src/nursery.js +102 -0
- package/dist/src/nursery.js.map +1 -0
- package/dist/src/processor/processor.d.ts +11 -0
- package/dist/src/processor/processor.d.ts.map +1 -0
- package/dist/src/processor/processor.js +24 -0
- package/dist/src/processor/processor.js.map +1 -0
- package/dist/src/promises.d.ts +23 -0
- package/dist/src/promises.d.ts.map +1 -0
- package/dist/src/promises.js +157 -0
- package/dist/src/promises.js.map +1 -0
- package/dist/src/registry.d.ts +15 -0
- package/dist/src/registry.d.ts.map +1 -0
- package/dist/src/registry.js +26 -0
- package/dist/src/registry.js.map +1 -0
- package/dist/src/resonate-inner.d.ts +45 -0
- package/dist/src/resonate-inner.d.ts.map +1 -0
- package/dist/src/resonate-inner.js +157 -0
- package/dist/src/resonate-inner.js.map +1 -0
- package/dist/src/resonate.d.ts +92 -0
- package/dist/src/resonate.d.ts.map +1 -0
- package/dist/src/resonate.js +240 -0
- package/dist/src/resonate.js.map +1 -0
- package/dist/src/schedules.d.ts +9 -0
- package/dist/src/schedules.d.ts.map +1 -0
- package/dist/src/schedules.js +65 -0
- package/dist/src/schedules.js.map +1 -0
- package/dist/src/tasks.d.ts +9 -0
- package/dist/src/tasks.d.ts.map +1 -0
- package/dist/src/tasks.js +61 -0
- package/dist/src/tasks.js.map +1 -0
- package/dist/src/types.d.ts +86 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +14 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/util.d.ts +14 -0
- package/dist/src/util.d.ts.map +1 -0
- package/dist/src/util.js +69 -0
- package/dist/src/util.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +51 -52
- package/dist/core/encoder.d.ts +0 -5
- package/dist/core/encoder.d.ts.map +0 -1
- package/dist/core/encoder.js +0 -3
- package/dist/core/encoder.js.map +0 -1
- package/dist/core/encoders/base64.d.ts +0 -6
- package/dist/core/encoders/base64.d.ts.map +0 -1
- package/dist/core/encoders/base64.js +0 -13
- package/dist/core/encoders/base64.js.map +0 -1
- package/dist/core/encoders/json.d.ts +0 -6
- package/dist/core/encoders/json.d.ts.map +0 -1
- package/dist/core/encoders/json.js +0 -77
- package/dist/core/encoders/json.js.map +0 -1
- package/dist/core/errors.d.ts +0 -24
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/errors.js +0 -42
- package/dist/core/errors.js.map +0 -1
- package/dist/core/logger.d.ts +0 -10
- package/dist/core/logger.d.ts.map +0 -1
- package/dist/core/logger.js.map +0 -1
- package/dist/core/loggers/logger.d.ts +0 -13
- package/dist/core/loggers/logger.d.ts.map +0 -1
- package/dist/core/loggers/logger.js +0 -48
- package/dist/core/loggers/logger.js.map +0 -1
- package/dist/core/options.d.ts +0 -160
- package/dist/core/options.d.ts.map +0 -1
- package/dist/core/options.js +0 -18
- package/dist/core/options.js.map +0 -1
- package/dist/core/promises/promises.d.ts +0 -210
- package/dist/core/promises/promises.d.ts.map +0 -1
- package/dist/core/promises/promises.js +0 -300
- package/dist/core/promises/promises.js.map +0 -1
- package/dist/core/promises/types.d.ts +0 -42
- package/dist/core/promises/types.d.ts.map +0 -1
- package/dist/core/promises/types.js +0 -70
- package/dist/core/promises/types.js.map +0 -1
- package/dist/core/retry.d.ts +0 -37
- package/dist/core/retry.d.ts.map +0 -1
- package/dist/core/retry.js +0 -141
- package/dist/core/retry.js.map +0 -1
- package/dist/core/schedules/schedules.d.ts +0 -22
- package/dist/core/schedules/schedules.d.ts.map +0 -1
- package/dist/core/schedules/schedules.js +0 -29
- package/dist/core/schedules/schedules.js.map +0 -1
- package/dist/core/schedules/types.d.ts +0 -19
- package/dist/core/schedules/types.d.ts.map +0 -1
- package/dist/core/schedules/types.js +0 -8
- package/dist/core/schedules/types.js.map +0 -1
- package/dist/core/storage.d.ts +0 -6
- package/dist/core/storage.d.ts.map +0 -1
- package/dist/core/storage.js +0 -3
- package/dist/core/storage.js.map +0 -1
- package/dist/core/storages/memory.d.ts +0 -8
- package/dist/core/storages/memory.d.ts.map +0 -1
- package/dist/core/storages/memory.js +0 -29
- package/dist/core/storages/memory.js.map +0 -1
- package/dist/core/storages/withTimeout.d.ts +0 -10
- package/dist/core/storages/withTimeout.d.ts.map +0 -1
- package/dist/core/storages/withTimeout.js +0 -44
- package/dist/core/storages/withTimeout.js.map +0 -1
- package/dist/core/store.d.ts +0 -142
- package/dist/core/store.d.ts.map +0 -1
- package/dist/core/store.js +0 -3
- package/dist/core/store.js.map +0 -1
- package/dist/core/stores/local.d.ts +0 -57
- package/dist/core/stores/local.d.ts.map +0 -1
- package/dist/core/stores/local.js +0 -405
- package/dist/core/stores/local.js.map +0 -1
- package/dist/core/stores/remote.d.ts +0 -51
- package/dist/core/stores/remote.d.ts.map +0 -1
- package/dist/core/stores/remote.js +0 -431
- package/dist/core/stores/remote.js.map +0 -1
- package/dist/core/utils.d.ts +0 -85
- package/dist/core/utils.d.ts.map +0 -1
- package/dist/core/utils.js +0 -121
- package/dist/core/utils.js.map +0 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -57
- package/dist/index.js.map +0 -1
- package/dist/resonate.d.ts +0 -337
- package/dist/resonate.d.ts.map +0 -1
- package/dist/resonate.js +0 -730
- package/dist/resonate.js.map +0 -1
package/dist/core/retry.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type RetryPolicy = Exponential | Linear | Never;
|
|
2
|
-
export type Exponential = {
|
|
3
|
-
kind: "exponential";
|
|
4
|
-
initialDelayMs: number;
|
|
5
|
-
backoffFactor: number;
|
|
6
|
-
maxAttempts: number;
|
|
7
|
-
maxDelayMs: number;
|
|
8
|
-
};
|
|
9
|
-
export type Linear = {
|
|
10
|
-
kind: "linear";
|
|
11
|
-
delayMs: number;
|
|
12
|
-
maxAttempts: number;
|
|
13
|
-
};
|
|
14
|
-
export type Never = {
|
|
15
|
-
kind: "never";
|
|
16
|
-
};
|
|
17
|
-
export declare function isRetryPolicy(value: unknown): value is RetryPolicy;
|
|
18
|
-
export declare function exponential(initialDelayMs?: number, backoffFactor?: number, maxAttempts?: number, maxDelayMs?: number): Exponential;
|
|
19
|
-
export declare function linear(delayMs?: number, maxAttempts?: number): Linear;
|
|
20
|
-
export declare function never(): Never;
|
|
21
|
-
/**
|
|
22
|
-
* Returns an iterable iterator that yields delay values for each retry attempt,
|
|
23
|
-
* based on the specified retry policy.
|
|
24
|
-
* The iterator stops yielding delay values when either the timeout is reached or the maximum
|
|
25
|
-
* number of attempts is exceeded.
|
|
26
|
-
*
|
|
27
|
-
* @param ctx - The context object containing the retry policy, attempt number, and timeout.
|
|
28
|
-
* @returns An iterable iterator that yields delay values for each retry attempt.
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
export declare function retryIterator<T extends {
|
|
32
|
-
retryPolicy: RetryPolicy;
|
|
33
|
-
attempt: number;
|
|
34
|
-
timeout: number;
|
|
35
|
-
}>(ctx: T): IterableIterator<number>;
|
|
36
|
-
export declare function runWithRetry<T>(func: () => Promise<T>, onRetry: () => Promise<void>, retryPolicy: RetryPolicy, timeout: number): Promise<T>;
|
|
37
|
-
//# sourceMappingURL=retry.d.ts.map
|
package/dist/core/retry.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../lib/core/retry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAqClE;AACD,wBAAgB,WAAW,CACzB,cAAc,GAAE,MAAY,EAC5B,aAAa,GAAE,MAAU,EACzB,WAAW,GAAE,MAAiB,EAC9B,UAAU,GAAE,MAAc,GACzB,WAAW,CAQb;AAED,wBAAgB,MAAM,CAAC,OAAO,GAAE,MAAa,EAAE,WAAW,GAAE,MAAiB,GAAG,MAAM,CAMrF;AAED,wBAAgB,KAAK,IAAI,KAAK,CAE7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACpG,GAAG,EAAE,CAAC,GACL,gBAAgB,CAAC,MAAM,CAAC,CA8B1B;AAED,wBAAsB,YAAY,CAAC,CAAC,EAClC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,cAwBhB"}
|
package/dist/core/retry.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runWithRetry = exports.retryIterator = exports.never = exports.linear = exports.exponential = exports.isRetryPolicy = void 0;
|
|
4
|
-
function isRetryPolicy(value) {
|
|
5
|
-
// Check if the value is an object
|
|
6
|
-
if (typeof value !== "object" || value === null) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
// Check if the object has a 'kind' property and if its value is a valid kind string
|
|
10
|
-
const kindValue = value.kind;
|
|
11
|
-
if (kindValue !== "exponential" && kindValue !== "linear" && kindValue !== "never") {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
// Check if the object matches the corresponding type based on the 'kind' value
|
|
15
|
-
switch (kindValue) {
|
|
16
|
-
case "exponential":
|
|
17
|
-
return ("initialDelayMs" in value &&
|
|
18
|
-
"backoffFactor" in value &&
|
|
19
|
-
"maxAttempts" in value &&
|
|
20
|
-
"maxDelayMs" in value &&
|
|
21
|
-
typeof value.initialDelayMs === "number" &&
|
|
22
|
-
typeof value.backoffFactor === "number" &&
|
|
23
|
-
typeof value.maxAttempts === "number" &&
|
|
24
|
-
typeof value.maxDelayMs === "number");
|
|
25
|
-
case "linear":
|
|
26
|
-
return ("delayMs" in value &&
|
|
27
|
-
"maxAttempts" in value &&
|
|
28
|
-
typeof value.delayMs === "number" &&
|
|
29
|
-
typeof value.maxAttempts === "number");
|
|
30
|
-
case "never":
|
|
31
|
-
return true; // No additional properties to check for 'never' type
|
|
32
|
-
default:
|
|
33
|
-
return false; // unreachable
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.isRetryPolicy = isRetryPolicy;
|
|
37
|
-
function exponential(initialDelayMs = 100, backoffFactor = 2, maxAttempts = Infinity, maxDelayMs = 60000) {
|
|
38
|
-
return {
|
|
39
|
-
kind: "exponential",
|
|
40
|
-
initialDelayMs,
|
|
41
|
-
backoffFactor,
|
|
42
|
-
maxAttempts,
|
|
43
|
-
maxDelayMs,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
exports.exponential = exponential;
|
|
47
|
-
function linear(delayMs = 1000, maxAttempts = Infinity) {
|
|
48
|
-
return {
|
|
49
|
-
kind: "linear",
|
|
50
|
-
delayMs,
|
|
51
|
-
maxAttempts,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
exports.linear = linear;
|
|
55
|
-
function never() {
|
|
56
|
-
return { kind: "never" };
|
|
57
|
-
}
|
|
58
|
-
exports.never = never;
|
|
59
|
-
/**
|
|
60
|
-
* Returns an iterable iterator that yields delay values for each retry attempt,
|
|
61
|
-
* based on the specified retry policy.
|
|
62
|
-
* The iterator stops yielding delay values when either the timeout is reached or the maximum
|
|
63
|
-
* number of attempts is exceeded.
|
|
64
|
-
*
|
|
65
|
-
* @param ctx - The context object containing the retry policy, attempt number, and timeout.
|
|
66
|
-
* @returns An iterable iterator that yields delay values for each retry attempt.
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
function retryIterator(ctx) {
|
|
70
|
-
const { initialDelay, backoffFactor, maxAttempts, maxDelay } = retryDefaults(ctx.retryPolicy);
|
|
71
|
-
const __next = (itCtx) => {
|
|
72
|
-
// attempt 0: 0ms delay
|
|
73
|
-
// attampt n: {initial * factor^(attempt-1)}ms delay (or max delay)
|
|
74
|
-
const delay = Math.min(Math.min(itCtx.attempt, 1) * initialDelay * Math.pow(backoffFactor, itCtx.attempt - 1), maxDelay);
|
|
75
|
-
if (Date.now() + delay >= itCtx.timeout || itCtx.attempt >= maxAttempts) {
|
|
76
|
-
return { done: true };
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
done: false,
|
|
80
|
-
delay: delay,
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
return {
|
|
84
|
-
next() {
|
|
85
|
-
const { done, delay } = __next(ctx);
|
|
86
|
-
return { done, value: delay || 0 };
|
|
87
|
-
},
|
|
88
|
-
[Symbol.iterator]() {
|
|
89
|
-
return this;
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
exports.retryIterator = retryIterator;
|
|
94
|
-
async function runWithRetry(func, onRetry, retryPolicy, timeout) {
|
|
95
|
-
let error;
|
|
96
|
-
const ctx = { attempt: 0, retryPolicy, timeout };
|
|
97
|
-
// invoke the function according to the retry policy
|
|
98
|
-
for (const delay of retryIterator(ctx)) {
|
|
99
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
100
|
-
if (ctx.attempt > 0) {
|
|
101
|
-
await onRetry();
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
return await func();
|
|
105
|
-
}
|
|
106
|
-
catch (e) {
|
|
107
|
-
error = e;
|
|
108
|
-
// bump the attempt count
|
|
109
|
-
ctx.attempt++;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// if all attempts fail throw the last error
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
115
|
-
exports.runWithRetry = runWithRetry;
|
|
116
|
-
function retryDefaults(retryPolicy) {
|
|
117
|
-
switch (retryPolicy.kind) {
|
|
118
|
-
case "exponential":
|
|
119
|
-
return {
|
|
120
|
-
initialDelay: retryPolicy.initialDelayMs,
|
|
121
|
-
backoffFactor: retryPolicy.backoffFactor,
|
|
122
|
-
maxAttempts: retryPolicy.maxAttempts,
|
|
123
|
-
maxDelay: retryPolicy.maxDelayMs,
|
|
124
|
-
};
|
|
125
|
-
case "linear":
|
|
126
|
-
return {
|
|
127
|
-
initialDelay: retryPolicy.delayMs,
|
|
128
|
-
backoffFactor: 1,
|
|
129
|
-
maxAttempts: retryPolicy.maxAttempts,
|
|
130
|
-
maxDelay: retryPolicy.delayMs,
|
|
131
|
-
};
|
|
132
|
-
case "never":
|
|
133
|
-
return {
|
|
134
|
-
initialDelay: 0,
|
|
135
|
-
backoffFactor: 0,
|
|
136
|
-
maxAttempts: 1,
|
|
137
|
-
maxDelay: 0,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
//# sourceMappingURL=retry.js.map
|
package/dist/core/retry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../lib/core/retry.ts"],"names":[],"mappings":";;;AAoBA,SAAgB,aAAa,CAAC,KAAc;IAC1C,kCAAkC;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oFAAoF;IACpF,MAAM,SAAS,GAAI,KAAqB,CAAC,IAAI,CAAC;IAC9C,IAAI,SAAS,KAAK,aAAa,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;QACnF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,+EAA+E;IAC/E,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,aAAa;YAChB,OAAO,CACL,gBAAgB,IAAI,KAAK;gBACzB,eAAe,IAAI,KAAK;gBACxB,aAAa,IAAI,KAAK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;YACpB,MAAM,OAAO,EAAE,CAAC;QAClB,CAAC;QAED,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,KAAK,GAAG,CAAC,CAAC;YACV,yBAAyB;YACzB,GAAG,CAAC,OAAO,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAED,4CAA4C;IAC5C,MAAM,KAAK,CAAC;AACd,CAAC;AA5BD,oCA4BC;AAED,SAAS,aAAa,CAAC,WAAwB;IAM7C,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC;QACzB,KAAK,aAAa;YAChB,OAAO;gBACL,YAAY,EAAE,WAAW,CAAC,cAAc;gBACxC,aAAa,EAAE,WAAW,CAAC,aAAa;gBACxC,WAAW,EAAE,WAAW,CAAC,WAAW;gBACpC,QAAQ,EAAE,WAAW,CAAC,UAAU;aACjC,CAAC;QACJ,KAAK,QAAQ;YACX,OAAO;gBACL,YAAY,EAAE,WAAW,CAAC,OAAO;gBACjC,aAAa,EAAE,CAAC;gBAChB,WAAW,EAAE,WAAW,CAAC,WAAW;gBACpC,QAAQ,EAAE,WAAW,CAAC,OAAO;aAC9B,CAAC;QACJ,KAAK,OAAO;YACV,OAAO;gBACL,YAAY,EAAE,CAAC;gBACf,aAAa,EAAE,CAAC;gBAChB,WAAW,EAAE,CAAC;gBACd,QAAQ,EAAE,CAAC;aACZ,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IEncoder } from "../encoder";
|
|
2
|
-
import { IScheduleStore } from "../store";
|
|
3
|
-
import { Schedule as ScheduleRecord } from "./types";
|
|
4
|
-
export type Options = {
|
|
5
|
-
description: string | undefined;
|
|
6
|
-
idempotencyKey: string | undefined;
|
|
7
|
-
tags: Record<string, string> | undefined;
|
|
8
|
-
promiseHeaders: Record<string, string>;
|
|
9
|
-
promiseParam: unknown;
|
|
10
|
-
promiseTags: Record<string, string> | undefined;
|
|
11
|
-
};
|
|
12
|
-
export declare class Schedule {
|
|
13
|
-
private store;
|
|
14
|
-
private encoder;
|
|
15
|
-
schedule: ScheduleRecord;
|
|
16
|
-
constructor(store: IScheduleStore, encoder: IEncoder<unknown, string | undefined>, schedule: ScheduleRecord);
|
|
17
|
-
static create(store: IScheduleStore, encoder: IEncoder<unknown, string | undefined>, id: string, cron: string, promiseId: string, promiseTimeout: number, opts?: Partial<Options>): Promise<Schedule>;
|
|
18
|
-
static get(store: IScheduleStore, encoder: IEncoder<unknown, string | undefined>, id: string): Promise<Schedule>;
|
|
19
|
-
static search(store: IScheduleStore, encoder: IEncoder<unknown, string | undefined>, id: string, tags?: Record<string, string>, limit?: number): AsyncGenerator<Schedule[], void>;
|
|
20
|
-
delete(): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=schedules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.d.ts","sourceRoot":"","sources":["../../../lib/core/schedules/schedules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG;IACpB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACzC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CACjD,CAAC;AAEF,qBAAa,QAAQ;IAEjB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IACR,QAAQ,EAAE,cAAc;gBAFvB,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC,EAC/C,QAAQ,EAAE,cAAc;WAGpB,MAAM,CACjB,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC,EAC9C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,IAAI,GAAE,OAAO,CAAC,OAAO,CAAM,GAC1B,OAAO,CAAC,QAAQ,CAAC;WAmBP,GAAG,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,EAAE,MAAM;WAIpF,MAAM,CAClB,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC,EAC9C,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,KAAK,CAAC,EAAE,MAAM,GACb,cAAc,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;IAM7B,MAAM;CAGb"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Schedule = void 0;
|
|
4
|
-
class Schedule {
|
|
5
|
-
store;
|
|
6
|
-
encoder;
|
|
7
|
-
schedule;
|
|
8
|
-
constructor(store, encoder, schedule) {
|
|
9
|
-
this.store = store;
|
|
10
|
-
this.encoder = encoder;
|
|
11
|
-
this.schedule = schedule;
|
|
12
|
-
}
|
|
13
|
-
static async create(store, encoder, id, cron, promiseId, promiseTimeout, opts = {}) {
|
|
14
|
-
return new Schedule(store, encoder, await store.create(id, opts.idempotencyKey, opts.description, cron, opts.tags, promiseId, promiseTimeout, opts.promiseHeaders, encoder.encode(opts.promiseParam), opts.promiseTags));
|
|
15
|
-
}
|
|
16
|
-
static async get(store, encoder, id) {
|
|
17
|
-
return new Schedule(store, encoder, await store.get(id));
|
|
18
|
-
}
|
|
19
|
-
static async *search(store, encoder, id, tags, limit) {
|
|
20
|
-
for await (const schedules of store.search(id, tags, limit)) {
|
|
21
|
-
yield schedules.map((s) => new Schedule(store, encoder, s));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
async delete() {
|
|
25
|
-
await this.store.delete(this.schedule.id);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.Schedule = Schedule;
|
|
29
|
-
//# sourceMappingURL=schedules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../../lib/core/schedules/schedules.ts"],"names":[],"mappings":";;;AAaA,MAAa,QAAQ;IAET;IACA;IACD;IAHT,YACU,KAAqB,EACrB,OAA8C,EAC/C,QAAwB;QAFvB,UAAK,GAAL,KAAK,CAAgB;QACrB,YAAO,GAAP,OAAO,CAAuC;QAC/C,aAAQ,GAAR,QAAQ,CAAgB;IAC9B,CAAC;IAEJ,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,KAAqB,EACrB,OAA8C,EAC9C,EAAU,EACV,IAAY,EACZ,SAAiB,EACjB,cAAsB,EACtB,OAAyB,EAAE;QAE3B,OAAO,IAAI,QAAQ,CACjB,KAAK,EACL,OAAO,EACP,MAAM,KAAK,CAAC,MAAM,CAChB,EAAE,EACF,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,WAAW,EAChB,IAAI,EACJ,IAAI,CAAC,IAAI,EACT,SAAS,EACT,cAAc,EACd,IAAI,CAAC,cAAc,EACnB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EACjC,IAAI,CAAC,WAAW,CACjB,CACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAqB,EAAE,OAA8C,EAAE,EAAU;QAChG,OAAO,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAClB,KAAqB,EACrB,OAA8C,EAC9C,EAAU,EACV,IAA6B,EAC7B,KAAc;QAEd,IAAI,KAAK,EAAE,MAAM,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;YAC5D,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AArDD,4BAqDC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type Schedule = {
|
|
2
|
-
id: string;
|
|
3
|
-
description: string | undefined;
|
|
4
|
-
cron: string;
|
|
5
|
-
tags: Record<string, string> | undefined;
|
|
6
|
-
promiseId: string;
|
|
7
|
-
promiseTimeout: number;
|
|
8
|
-
promiseParam: {
|
|
9
|
-
data: string | undefined;
|
|
10
|
-
headers: Record<string, string> | undefined;
|
|
11
|
-
};
|
|
12
|
-
promiseTags: Record<string, string> | undefined;
|
|
13
|
-
lastRunTime: number | undefined;
|
|
14
|
-
nextRunTime: number;
|
|
15
|
-
idempotencyKey: string | undefined;
|
|
16
|
-
createdOn: number;
|
|
17
|
-
};
|
|
18
|
-
export declare function isSchedule(s: unknown): s is Schedule;
|
|
19
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/core/schedules/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;QACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;KAC7C,CAAC;IACF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAChD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,QAAQ,CAEpD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSchedule = void 0;
|
|
4
|
-
function isSchedule(s) {
|
|
5
|
-
return s !== null && typeof s === "object" && "id" in s;
|
|
6
|
-
}
|
|
7
|
-
exports.isSchedule = isSchedule;
|
|
8
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/core/schedules/types.ts"],"names":[],"mappings":";;;AAkBA,SAAgB,UAAU,CAAC,CAAU;IACnC,OAAO,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,IAAI,IAAI,CAAC,CAAC;AAC1D,CAAC;AAFD,gCAEC"}
|
package/dist/core/storage.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../lib/core/storage.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACvF,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9D,GAAG,IAAI,cAAc,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;CAClC"}
|
package/dist/core/storage.js
DELETED
package/dist/core/storage.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../lib/core/storage.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IStorage } from "../storage";
|
|
2
|
-
export declare class MemoryStorage<T> implements IStorage<T> {
|
|
3
|
-
private items;
|
|
4
|
-
rmw<X extends T | undefined>(id: string, func: (item: T | undefined) => X): Promise<X>;
|
|
5
|
-
rmd(id: string, func: (item: T) => boolean): Promise<boolean>;
|
|
6
|
-
all(): AsyncGenerator<T[], void>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../lib/core/storages/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,aAAa,CAAC,CAAC,CAAE,YAAW,QAAQ,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,KAAK,CAAyB;IAGhC,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAUtF,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAW5D,GAAG,IAAI,cAAc,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC;CAGxC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemoryStorage = void 0;
|
|
4
|
-
class MemoryStorage {
|
|
5
|
-
items = {};
|
|
6
|
-
// read-modify-write
|
|
7
|
-
async rmw(id, func) {
|
|
8
|
-
const item = func(this.items[id]);
|
|
9
|
-
if (item) {
|
|
10
|
-
this.items[id] = item;
|
|
11
|
-
}
|
|
12
|
-
return item;
|
|
13
|
-
}
|
|
14
|
-
// read-modify-delete
|
|
15
|
-
async rmd(id, func) {
|
|
16
|
-
const item = this.items[id];
|
|
17
|
-
let result = false;
|
|
18
|
-
if (item && func(item)) {
|
|
19
|
-
delete this.items[id];
|
|
20
|
-
result = true;
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
async *all() {
|
|
25
|
-
yield Object.values(this.items);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.MemoryStorage = MemoryStorage;
|
|
29
|
-
//# sourceMappingURL=memory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../lib/core/storages/memory.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IAChB,KAAK,GAAsB,EAAE,CAAC;IAEtC,oBAAoB;IACpB,KAAK,CAAC,GAAG,CAA0B,EAAU,EAAE,IAAgC;QAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;QACxB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qBAAqB;IACrB,KAAK,CAAC,GAAG,CAAC,EAAU,EAAE,IAA0B;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5B,IAAI,MAAM,GAAG,KAAK,CAAC;QAEnB,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACtB,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,CAAC,GAAG;QACR,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF;AA5BD,sCA4BC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DurablePromiseRecord } from "../promises/types";
|
|
2
|
-
import { IStorage } from "../storage";
|
|
3
|
-
export declare class WithTimeout implements IStorage<DurablePromiseRecord> {
|
|
4
|
-
private storage;
|
|
5
|
-
constructor(storage?: IStorage<DurablePromiseRecord>);
|
|
6
|
-
rmw<T extends DurablePromiseRecord | undefined>(id: string, func: (item: DurablePromiseRecord | undefined) => T): Promise<T>;
|
|
7
|
-
rmd(id: string, func: (item: DurablePromiseRecord) => boolean): Promise<boolean>;
|
|
8
|
-
all(): AsyncGenerator<DurablePromiseRecord[], void>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=withTimeout.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withTimeout.d.ts","sourceRoot":"","sources":["../../../lib/core/storages/withTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,qBAAa,WAAY,YAAW,QAAQ,CAAC,oBAAoB,CAAC;IACpD,OAAO,CAAC,OAAO;gBAAP,OAAO,GAAE,QAAQ,CAAC,oBAAoB,CAA6C;IAEvG,GAAG,CAAC,CAAC,SAAS,oBAAoB,GAAG,SAAS,EAC5C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,CAAC,IAAI,EAAE,oBAAoB,GAAG,SAAS,KAAK,CAAC,GAClD,OAAO,CAAC,CAAC,CAAC;IAIb,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAIzE,GAAG,IAAI,cAAc,CAAC,oBAAoB,EAAE,EAAE,IAAI,CAAC;CAK3D"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WithTimeout = void 0;
|
|
4
|
-
const types_1 = require("../promises/types");
|
|
5
|
-
const memory_1 = require("./memory");
|
|
6
|
-
class WithTimeout {
|
|
7
|
-
storage;
|
|
8
|
-
constructor(storage = new memory_1.MemoryStorage()) {
|
|
9
|
-
this.storage = storage;
|
|
10
|
-
}
|
|
11
|
-
rmw(id, func) {
|
|
12
|
-
return this.storage.rmw(id, (p) => func(p ? timeout(p) : undefined));
|
|
13
|
-
}
|
|
14
|
-
rmd(id, func) {
|
|
15
|
-
return this.storage.rmd(id, (p) => func(timeout(p)));
|
|
16
|
-
}
|
|
17
|
-
async *all() {
|
|
18
|
-
for await (const promises of this.storage.all()) {
|
|
19
|
-
yield promises.map(timeout);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.WithTimeout = WithTimeout;
|
|
24
|
-
function timeout(promise) {
|
|
25
|
-
if ((0, types_1.isPendingPromise)(promise) && Date.now() >= promise.timeout) {
|
|
26
|
-
return {
|
|
27
|
-
state: promise.tags?.["resonate:timeout"] === "true" ? "RESOLVED" : "REJECTED_TIMEDOUT",
|
|
28
|
-
id: promise.id,
|
|
29
|
-
timeout: promise.timeout,
|
|
30
|
-
param: promise.param,
|
|
31
|
-
value: {
|
|
32
|
-
headers: undefined,
|
|
33
|
-
data: undefined,
|
|
34
|
-
},
|
|
35
|
-
createdOn: promise.createdOn,
|
|
36
|
-
completedOn: promise.timeout,
|
|
37
|
-
idempotencyKeyForCreate: promise.idempotencyKeyForCreate,
|
|
38
|
-
idempotencyKeyForComplete: undefined,
|
|
39
|
-
tags: promise.tags,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
return promise;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=withTimeout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withTimeout.js","sourceRoot":"","sources":["../../../lib/core/storages/withTimeout.ts"],"names":[],"mappings":";;;AAAA,6CAA2E;AAE3E,qCAAyC;AAEzC,MAAa,WAAW;IACF;IAApB,YAAoB,UAA0C,IAAI,sBAAa,EAAwB;QAAnF,YAAO,GAAP,OAAO,CAA4E;IAAG,CAAC;IAE3G,GAAG,CACD,EAAU,EACV,IAAmD;QAEnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC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./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<DurablePromiseRecord>;
|
|
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<DurablePromiseRecord>;
|
|
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<DurablePromiseRecord>;
|
|
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<DurablePromiseRecord>;
|
|
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<DurablePromiseRecord>;
|
|
68
|
-
/**
|
|
69
|
-
* Search for promises.
|
|
70
|
-
*
|
|
71
|
-
* @param id Ids to match, can include wildcards.
|
|
72
|
-
* @param state State to match.
|
|
73
|
-
* @param tags Tags to match.
|
|
74
|
-
* @param limit Maximum number of promises to return.
|
|
75
|
-
* @returns A list of Durable Promises.
|
|
76
|
-
*/
|
|
77
|
-
search(id: string, state: string | undefined, tags: Record<string, string> | undefined, limit?: number): AsyncGenerator<DurablePromiseRecord[], void>;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Schedule Store API
|
|
81
|
-
*/
|
|
82
|
-
export interface IScheduleStore {
|
|
83
|
-
/**
|
|
84
|
-
* Creates a new schedule.
|
|
85
|
-
*
|
|
86
|
-
* @param id Unique identifier for the schedule.
|
|
87
|
-
* @param ikey Idempotency key associated with the create operation.
|
|
88
|
-
* @param description Description of the schedule.
|
|
89
|
-
* @param cron CRON expression defining the schedule's execution time.
|
|
90
|
-
* @param tags Key-value pairs associated with the schedule.
|
|
91
|
-
* @param promiseId Unique identifier for the associated promise.
|
|
92
|
-
* @param promiseTimeout Timeout for the associated promise in milliseconds.
|
|
93
|
-
* @param promiseHeaders Headers associated with the promise data.
|
|
94
|
-
* @param promiseData Encoded data for the promise of type string.
|
|
95
|
-
* @param promiseTags Key-value pairs associated with the promise.
|
|
96
|
-
* @returns A Promise resolving to the created schedule.
|
|
97
|
-
*/
|
|
98
|
-
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>;
|
|
99
|
-
/**
|
|
100
|
-
* Retrieves a schedule based on its id.
|
|
101
|
-
*
|
|
102
|
-
* @param id Unique identifier for the promise to be retrieved.
|
|
103
|
-
* @returns A promise schedule that is pending, canceled, resolved, or rejected.
|
|
104
|
-
*/
|
|
105
|
-
get(id: string): Promise<Schedule>;
|
|
106
|
-
/**
|
|
107
|
-
* Deletes a schedule based on its id.
|
|
108
|
-
* @param id Unique identifier for the promise to be deleted.
|
|
109
|
-
* @returns A promise schedule that is pending, canceled, resolved, or rejected.
|
|
110
|
-
*/
|
|
111
|
-
delete(id: string): Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
* Search for schedules.
|
|
114
|
-
*
|
|
115
|
-
* @param id Ids to match, can include wildcards.
|
|
116
|
-
* @param tags Tags to match.
|
|
117
|
-
* @returns A list of promise schedules.
|
|
118
|
-
*/
|
|
119
|
-
search(id: string, tags: Record<string, string> | undefined, limit?: number): AsyncGenerator<Schedule[], void>;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Lock Store API
|
|
123
|
-
*/
|
|
124
|
-
export interface ILockStore {
|
|
125
|
-
/**
|
|
126
|
-
* Try to acquire a lock.
|
|
127
|
-
*
|
|
128
|
-
* @param id Id of lock.
|
|
129
|
-
* @param eid Execution id of lock.
|
|
130
|
-
* @param expiry Time in ms before lock will expire.
|
|
131
|
-
* @returns A boolean indicating whether or not the lock was acquired.
|
|
132
|
-
*/
|
|
133
|
-
tryAcquire(id: string, eid: string, expiry?: number): Promise<boolean>;
|
|
134
|
-
/**
|
|
135
|
-
* Release a lock.
|
|
136
|
-
*
|
|
137
|
-
* @param id Id of lock.
|
|
138
|
-
* @param eid Execution id of lock.
|
|
139
|
-
*/
|
|
140
|
-
release(id: string, eid: string): Promise<boolean>;
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=store.d.ts.map
|
package/dist/core/store.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../lib/core/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,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;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;OAWG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,IAAI,E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|
package/dist/core/store.js
DELETED
package/dist/core/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../lib/core/store.ts"],"names":[],"mappings":""}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { ILogger } from "../logger";
|
|
2
|
-
import { StoreOptions } from "../options";
|
|
3
|
-
import { DurablePromiseRecord } from "../promises/types";
|
|
4
|
-
import { Schedule } from "../schedules/types";
|
|
5
|
-
import { IStorage } from "../storage";
|
|
6
|
-
import { IStore, IPromiseStore, IScheduleStore, ILockStore } from "../store";
|
|
7
|
-
export declare class LocalStore implements IStore {
|
|
8
|
-
promises: LocalPromiseStore;
|
|
9
|
-
schedules: LocalScheduleStore;
|
|
10
|
-
locks: LocalLockStore;
|
|
11
|
-
readonly logger: ILogger;
|
|
12
|
-
private toSchedule;
|
|
13
|
-
private next;
|
|
14
|
-
constructor(opts?: Partial<StoreOptions>, promiseStorage?: IStorage<DurablePromiseRecord>, scheduleStorage?: IStorage<Schedule>, lockStorage?: IStorage<{
|
|
15
|
-
id: string;
|
|
16
|
-
eid: string;
|
|
17
|
-
}>);
|
|
18
|
-
addSchedule(schedule: Schedule): void;
|
|
19
|
-
deleteSchedule(id: string): void;
|
|
20
|
-
private init;
|
|
21
|
-
private setSchedule;
|
|
22
|
-
private schedulePromise;
|
|
23
|
-
private generatePromiseId;
|
|
24
|
-
}
|
|
25
|
-
export declare class LocalPromiseStore implements IPromiseStore {
|
|
26
|
-
private store;
|
|
27
|
-
private storage;
|
|
28
|
-
constructor(store: LocalStore, storage: IStorage<DurablePromiseRecord>);
|
|
29
|
-
create(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined, timeout: number, tags: Record<string, string> | undefined): Promise<DurablePromiseRecord>;
|
|
30
|
-
resolve(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<DurablePromiseRecord>;
|
|
31
|
-
reject(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<DurablePromiseRecord>;
|
|
32
|
-
cancel(id: string, ikey: string | undefined, strict: boolean, headers: Record<string, string> | undefined, data: string | undefined): Promise<DurablePromiseRecord>;
|
|
33
|
-
get(id: string): Promise<DurablePromiseRecord>;
|
|
34
|
-
search(id: string, state?: string, tags?: Record<string, string>, limit?: number): AsyncGenerator<DurablePromiseRecord[], void>;
|
|
35
|
-
}
|
|
36
|
-
export declare class LocalScheduleStore implements IScheduleStore {
|
|
37
|
-
private store;
|
|
38
|
-
private storage;
|
|
39
|
-
constructor(store: LocalStore, storage: IStorage<Schedule>);
|
|
40
|
-
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>;
|
|
41
|
-
update(id: string, lastRunTime: number): Promise<Schedule | undefined>;
|
|
42
|
-
delete(id: string): Promise<void>;
|
|
43
|
-
get(id: string): Promise<Schedule>;
|
|
44
|
-
search(id: string, tags?: Record<string, string>, limit?: number): AsyncGenerator<Schedule[], void>;
|
|
45
|
-
private nextRunTime;
|
|
46
|
-
}
|
|
47
|
-
export declare class LocalLockStore implements ILockStore {
|
|
48
|
-
private store;
|
|
49
|
-
private storage;
|
|
50
|
-
constructor(store: LocalStore, storage: IStorage<{
|
|
51
|
-
id: string;
|
|
52
|
-
eid: string;
|
|
53
|
-
}>);
|
|
54
|
-
tryAcquire(id: string, eid: string): Promise<boolean>;
|
|
55
|
-
release(id: string, eid: string): Promise<boolean>;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=local.d.ts.map
|