@resonatehq/sdk 0.3.7 → 0.5.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 -123
- package/dist/async.d.ts +95 -49
- package/dist/async.d.ts.map +1 -1
- package/dist/async.js +167 -100
- package/dist/async.js.map +1 -1
- package/dist/core/execution.d.ts +12 -10
- package/dist/core/execution.d.ts.map +1 -1
- package/dist/core/execution.js +124 -65
- package/dist/core/execution.js.map +1 -1
- package/dist/core/future.d.ts +3 -1
- package/dist/core/future.d.ts.map +1 -1
- package/dist/core/future.js +6 -0
- package/dist/core/future.js.map +1 -1
- package/dist/core/invocation.d.ts +5 -4
- package/dist/core/invocation.d.ts.map +1 -1
- package/dist/core/invocation.js +39 -13
- package/dist/core/invocation.js.map +1 -1
- package/dist/core/options.d.ts +32 -11
- package/dist/core/options.d.ts.map +1 -1
- package/dist/core/options.js +3 -3
- package/dist/core/options.js.map +1 -1
- package/dist/core/promises/promises.d.ts +3 -2
- package/dist/core/promises/promises.d.ts.map +1 -1
- package/dist/core/promises/promises.js +4 -1
- package/dist/core/promises/promises.js.map +1 -1
- package/dist/core/promises/types.d.ts.map +1 -1
- package/dist/core/promises/types.js +2 -5
- package/dist/core/promises/types.js.map +1 -1
- package/dist/core/schedules/schedules.d.ts +22 -0
- package/dist/core/schedules/schedules.d.ts.map +1 -0
- package/dist/core/schedules/schedules.js +29 -0
- package/dist/core/schedules/schedules.js.map +1 -0
- package/dist/core/store.d.ts +5 -2
- package/dist/core/store.d.ts.map +1 -1
- package/dist/core/stores/local.d.ts +1 -1
- package/dist/core/stores/local.d.ts.map +1 -1
- package/dist/core/stores/local.js +7 -5
- package/dist/core/stores/local.js.map +1 -1
- package/dist/core/stores/remote.d.ts +7 -7
- package/dist/core/stores/remote.d.ts.map +1 -1
- package/dist/core/stores/remote.js +30 -23
- package/dist/core/stores/remote.js.map +1 -1
- package/dist/generator.d.ts +36 -18
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +66 -73
- package/dist/generator.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -26
- package/dist/index.js.map +1 -1
- package/dist/resonate.d.ts +108 -31
- package/dist/resonate.d.ts.map +1 -1
- package/dist/resonate.js +144 -60
- package/dist/resonate.js.map +1 -1
- package/package.json +1 -1
package/dist/resonate.d.ts
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import { IEncoder } from "./core/encoder";
|
|
2
2
|
import { ResonatePromise } from "./core/future";
|
|
3
3
|
import { ILogger } from "./core/logger";
|
|
4
|
-
import { ResonateOptions, Options } from "./core/options";
|
|
5
|
-
import
|
|
4
|
+
import { ResonateOptions, Options, PartialOptions } from "./core/options";
|
|
5
|
+
import * as promises from "./core/promises/promises";
|
|
6
6
|
import { IRetry } from "./core/retry";
|
|
7
|
+
import * as schedules from "./core/schedules/schedules";
|
|
7
8
|
import { IStore } from "./core/store";
|
|
8
9
|
type Func = (...args: any[]) => any;
|
|
9
10
|
export declare abstract class ResonateBase {
|
|
10
11
|
private readonly functions;
|
|
12
|
+
readonly promises: ResonatePromises;
|
|
13
|
+
readonly schedules: ResonateSchedules;
|
|
11
14
|
readonly pid: string;
|
|
15
|
+
readonly poll: number;
|
|
12
16
|
readonly timeout: number;
|
|
13
17
|
readonly tags: Record<string, string>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
readonly encoder: IEncoder<unknown, string | undefined>;
|
|
19
|
+
readonly logger: ILogger;
|
|
20
|
+
readonly retry: IRetry;
|
|
21
|
+
readonly store: IStore;
|
|
18
22
|
private interval;
|
|
19
|
-
constructor({ encoder, logger, pid,
|
|
23
|
+
constructor({ encoder, logger, pid, poll, // 5s
|
|
24
|
+
retry, store, tags, timeout, // 10s
|
|
20
25
|
url, }?: Partial<ResonateOptions>);
|
|
21
|
-
|
|
26
|
+
protected abstract execute(name: string, id: string, func: Func, args: any[], opts: Options, defaults: Options, durablePromise?: promises.DurablePromise<any>): ResonatePromise<any>;
|
|
27
|
+
register(name: string, func: Func, opts?: Partial<Options>): (id: string, ...args: any) => ResonatePromise<any>;
|
|
22
28
|
registerModule(module: Record<string, Func>, opts?: Partial<Options>): void;
|
|
23
29
|
/**
|
|
24
30
|
* Run a Resonate function. Functions must first be registered with {@link register}.
|
|
@@ -29,19 +35,15 @@ export declare abstract class ResonateBase {
|
|
|
29
35
|
* @param args The function arguments.
|
|
30
36
|
* @returns A promise that resolve to the function return value.
|
|
31
37
|
*/
|
|
32
|
-
run<T>(name: string, id: string, ...
|
|
38
|
+
run<T>(name: string, id: string, ...argsWithOpts: [...any, PartialOptions?]): ResonatePromise<T>;
|
|
39
|
+
schedule(name: string, cron: string, func: Func | string, ...argsWithOpts: [...any, PartialOptions?]): Promise<schedules.Schedule>;
|
|
33
40
|
/**
|
|
34
|
-
*
|
|
41
|
+
* Construct options.
|
|
35
42
|
*
|
|
36
|
-
* @
|
|
37
|
-
* @
|
|
38
|
-
* @param version The function version.
|
|
39
|
-
* @param id A unique id for the function invocation.
|
|
40
|
-
* @param args The function arguments.
|
|
41
|
-
* @returns A promise that resolve to the function return value.
|
|
43
|
+
* @param opts A partial {@link Options} object.
|
|
44
|
+
* @returns PartialOptions.
|
|
42
45
|
*/
|
|
43
|
-
|
|
44
|
-
protected abstract execute(name: string, version: number, id: string, func: Func, args: any[], opts: Options): ResonatePromise<any>;
|
|
46
|
+
options(opts?: Partial<Options>): PartialOptions;
|
|
45
47
|
/**
|
|
46
48
|
* Start the resonate service.
|
|
47
49
|
*
|
|
@@ -52,23 +54,98 @@ export declare abstract class ResonateBase {
|
|
|
52
54
|
* Stop the resonate service.
|
|
53
55
|
*/
|
|
54
56
|
stop(): void;
|
|
57
|
+
private defaults;
|
|
55
58
|
private _start;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
reject: <T_2>(id: string, error: any, opts?: Partial<CompleteOptions>) => Promise<DurablePromise<T_2>>;
|
|
60
|
-
cancel: <T_3>(id: string, error: any, opts?: Partial<CompleteOptions>) => Promise<DurablePromise<T_3>>;
|
|
61
|
-
get: <T_4>(id: string) => Promise<DurablePromise<T_4>>;
|
|
62
|
-
search: (id: string, state?: string, tags?: Record<string, string>, limit?: number) => AsyncGenerator<DurablePromise<any>[], void, unknown>;
|
|
63
|
-
};
|
|
59
|
+
private split;
|
|
60
|
+
}
|
|
61
|
+
export interface ResonatePromises {
|
|
64
62
|
/**
|
|
65
|
-
*
|
|
63
|
+
* Create a durable promise.
|
|
66
64
|
*
|
|
67
|
-
* @
|
|
68
|
-
* @
|
|
65
|
+
* @template T The type of the promise.
|
|
66
|
+
* @param id Unique identifier for the promise.
|
|
67
|
+
* @param timeout Time (in milliseconds) after which the promise is considered expired.
|
|
68
|
+
* @param opts Additional options.
|
|
69
|
+
* @returns A durable promise.
|
|
70
|
+
*/
|
|
71
|
+
create<T>(id: string, timeout: number, opts?: Partial<promises.CreateOptions>): Promise<promises.DurablePromise<T>>;
|
|
72
|
+
/**
|
|
73
|
+
* Resolve a durable promise.
|
|
74
|
+
*
|
|
75
|
+
* @template T The type of the promise.
|
|
76
|
+
* @param id Unique identifier for the promise.
|
|
77
|
+
* @param value The resolved value.
|
|
78
|
+
* @param opts Additional options.
|
|
79
|
+
* @returns A durable promise.
|
|
80
|
+
*/
|
|
81
|
+
resolve<T>(id: string, value: T, opts?: Partial<promises.CompleteOptions>): Promise<promises.DurablePromise<T>>;
|
|
82
|
+
/**
|
|
83
|
+
* Reject a durable promise.
|
|
84
|
+
*
|
|
85
|
+
* @template T The type of the promise.
|
|
86
|
+
* @param id Unique identifier for the promise.
|
|
87
|
+
* @param error The reject value.
|
|
88
|
+
* @param opts Additional options.
|
|
89
|
+
* @returns A durable promise.
|
|
90
|
+
*/
|
|
91
|
+
reject<T>(id: string, error: any, opts?: Partial<promises.CompleteOptions>): Promise<promises.DurablePromise<T>>;
|
|
92
|
+
/**
|
|
93
|
+
* Cancel a durable promise.
|
|
94
|
+
*
|
|
95
|
+
* @template T The type of the promise.
|
|
96
|
+
* @param id Unique identifier for the promise.
|
|
97
|
+
* @param error The cancel value.
|
|
98
|
+
* @param opts Additional options.
|
|
99
|
+
* @returns A durable promise.
|
|
100
|
+
*/
|
|
101
|
+
cancel<T>(id: string, error: any, opts?: Partial<promises.CompleteOptions>): Promise<promises.DurablePromise<T>>;
|
|
102
|
+
/**
|
|
103
|
+
* Get a durable promise.
|
|
104
|
+
*
|
|
105
|
+
* @template T The type of the promise.
|
|
106
|
+
* @param id Id of the promise.
|
|
107
|
+
* @returns A durable promise.
|
|
108
|
+
*/
|
|
109
|
+
get<T>(id: string): Promise<promises.DurablePromise<T>>;
|
|
110
|
+
/**
|
|
111
|
+
* Search durable promises.
|
|
112
|
+
*
|
|
113
|
+
* @param id Ids to match, can include wildcards.
|
|
114
|
+
* @param state State to match.
|
|
115
|
+
* @param tags Tags to match.
|
|
116
|
+
* @param limit Maximum number of promises to return.
|
|
117
|
+
* @returns A generator that yields durable promises.
|
|
118
|
+
*/
|
|
119
|
+
search(id: string, state?: string, tags?: Record<string, string>, limit?: number): AsyncGenerator<promises.DurablePromise<any>[]>;
|
|
120
|
+
}
|
|
121
|
+
export interface ResonateSchedules {
|
|
122
|
+
/**
|
|
123
|
+
* Create a new schedule.
|
|
124
|
+
*
|
|
125
|
+
* @param id Unique identifier for the schedule.
|
|
126
|
+
* @param cron CRON expression defining the schedule's execution time.
|
|
127
|
+
* @param promiseId Unique identifier for the associated promise.
|
|
128
|
+
* @param promiseTimeout Timeout for the associated promise in milliseconds.
|
|
129
|
+
* @param opts Additional options.
|
|
130
|
+
* @returns A schedule.
|
|
131
|
+
*/
|
|
132
|
+
create(id: string, cron: string, promiseId: string, promiseTimeout: number, opts?: Partial<schedules.Options>): Promise<schedules.Schedule>;
|
|
133
|
+
/**
|
|
134
|
+
* Get a schedule.
|
|
135
|
+
*
|
|
136
|
+
* @param id Id of the schedule.
|
|
137
|
+
* @returns A schedule.
|
|
138
|
+
*/
|
|
139
|
+
get(id: string): Promise<schedules.Schedule>;
|
|
140
|
+
/**
|
|
141
|
+
* Search for schedules.
|
|
142
|
+
*
|
|
143
|
+
* @param id Ids to match, can include wildcards.
|
|
144
|
+
* @param tags Tags to match.
|
|
145
|
+
* @param limit Maximum number of schedules to return.
|
|
146
|
+
* @returns A generator that yields schedules.
|
|
69
147
|
*/
|
|
70
|
-
|
|
71
|
-
retry, store, tags, timeout, }: Partial<Options>): Options;
|
|
148
|
+
search(id: string, tags: Record<string, string> | undefined, limit?: number): AsyncGenerator<schedules.Schedule[], void>;
|
|
72
149
|
}
|
|
73
150
|
export {};
|
|
74
151
|
//# sourceMappingURL=resonate.d.ts.map
|
package/dist/resonate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resonate.d.ts","sourceRoot":"","sources":["../lib/resonate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"resonate.d.ts","sourceRoot":"","sources":["../lib/resonate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AACrF,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,SAAS,MAAM,4BAA4B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E,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAE7C;;;;;;;OAOG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACxC,KAAK,CAAC,EAAE,MAAM,GACb,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;CAC/C"}
|
package/dist/resonate.js
CHANGED
|
@@ -26,8 +26,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.ResonateBase = void 0;
|
|
27
27
|
const json_1 = require("./core/encoders/json");
|
|
28
28
|
const logger_1 = require("./core/loggers/logger");
|
|
29
|
-
const
|
|
29
|
+
const options_1 = require("./core/options");
|
|
30
|
+
const promises = __importStar(require("./core/promises/promises"));
|
|
30
31
|
const retry_1 = require("./core/retries/retry");
|
|
32
|
+
const schedules = __importStar(require("./core/schedules/schedules"));
|
|
31
33
|
const local_1 = require("./core/stores/local");
|
|
32
34
|
const remote_1 = require("./core/stores/remote");
|
|
33
35
|
const utils = __importStar(require("./core/utils"));
|
|
@@ -36,7 +38,10 @@ const utils = __importStar(require("./core/utils"));
|
|
|
36
38
|
/////////////////////////////////////////////////////////////////////
|
|
37
39
|
class ResonateBase {
|
|
38
40
|
functions = {};
|
|
41
|
+
promises;
|
|
42
|
+
schedules;
|
|
39
43
|
pid;
|
|
44
|
+
poll;
|
|
40
45
|
timeout;
|
|
41
46
|
tags;
|
|
42
47
|
encoder;
|
|
@@ -44,11 +49,13 @@ class ResonateBase {
|
|
|
44
49
|
retry;
|
|
45
50
|
store;
|
|
46
51
|
interval;
|
|
47
|
-
constructor({ encoder = new json_1.JSONEncoder(), logger = new logger_1.Logger(), pid = utils.randomId(),
|
|
52
|
+
constructor({ encoder = new json_1.JSONEncoder(), logger = new logger_1.Logger(), pid = utils.randomId(), poll = 5000, // 5s
|
|
53
|
+
retry = retry_1.Retry.exponential(), store = undefined, tags = {}, timeout = 10000, // 10s
|
|
48
54
|
url = undefined, } = {}) {
|
|
49
55
|
this.encoder = encoder;
|
|
50
56
|
this.logger = logger;
|
|
51
57
|
this.pid = pid;
|
|
58
|
+
this.poll = poll;
|
|
52
59
|
this.retry = retry;
|
|
53
60
|
this.tags = tags;
|
|
54
61
|
this.timeout = timeout;
|
|
@@ -61,44 +68,125 @@ class ResonateBase {
|
|
|
61
68
|
else {
|
|
62
69
|
this.store = new local_1.LocalStore(this.logger);
|
|
63
70
|
}
|
|
71
|
+
// promises
|
|
72
|
+
this.promises = {
|
|
73
|
+
create: (id, timeout, opts = {}) => promises.DurablePromise.create(this.store.promises, this.encoder, id, timeout, opts),
|
|
74
|
+
resolve: (id, value, opts = {}) => promises.DurablePromise.resolve(this.store.promises, this.encoder, id, value, opts),
|
|
75
|
+
reject: (id, error, opts = {}) => promises.DurablePromise.reject(this.store.promises, this.encoder, id, error, opts),
|
|
76
|
+
cancel: (id, error, opts = {}) => promises.DurablePromise.cancel(this.store.promises, this.encoder, id, error, opts),
|
|
77
|
+
get: (id) => promises.DurablePromise.get(this.store.promises, this.encoder, id),
|
|
78
|
+
search: (id, state, tags, limit) => promises.DurablePromise.search(this.store.promises, this.encoder, id, state, tags, limit),
|
|
79
|
+
};
|
|
80
|
+
// schedules
|
|
81
|
+
this.schedules = {
|
|
82
|
+
create: (id, cron, promiseId, promiseTimeout, opts = {}) => schedules.Schedule.create(this.store.schedules, this.encoder, id, cron, promiseId, promiseTimeout, opts),
|
|
83
|
+
get: (id) => schedules.Schedule.get(this.store.schedules, this.encoder, id),
|
|
84
|
+
search: (id, tags, limit) => schedules.Schedule.search(this.store.schedules, this.encoder, id, tags, limit),
|
|
85
|
+
};
|
|
64
86
|
}
|
|
65
|
-
register(name,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
if (version <= 0) {
|
|
87
|
+
register(name, func, opts = {}) {
|
|
88
|
+
// set default version
|
|
89
|
+
opts.version = opts.version ?? 1;
|
|
90
|
+
// set default options
|
|
91
|
+
const options = this.defaults(opts);
|
|
92
|
+
if (options.version <= 0) {
|
|
73
93
|
throw new Error("Version must be greater than 0");
|
|
74
94
|
}
|
|
75
95
|
if (!this.functions[name]) {
|
|
76
96
|
this.functions[name] = {};
|
|
77
97
|
}
|
|
78
|
-
if (this.functions[name][version]) {
|
|
79
|
-
throw new Error(`Function ${name} version ${version} already registered`);
|
|
98
|
+
if (this.functions[name][options.version]) {
|
|
99
|
+
throw new Error(`Function ${name} version ${options.version} already registered`);
|
|
80
100
|
}
|
|
81
101
|
// register as latest (0) if version is greatest so far
|
|
82
|
-
if (version > Math.max(...Object.values(this.functions[name]).map((f) => f.version))) {
|
|
83
|
-
this.functions[name][0] = {
|
|
102
|
+
if (options.version > Math.max(...Object.values(this.functions[name]).map((f) => f.opts.version))) {
|
|
103
|
+
this.functions[name][0] = { func, opts: options };
|
|
84
104
|
}
|
|
85
105
|
// register specific version
|
|
86
|
-
this.functions[name][version] = {
|
|
87
|
-
return (id, ...args) => this.run(name,
|
|
106
|
+
this.functions[name][options.version] = { func, opts: options };
|
|
107
|
+
return (id, ...args) => this.run(name, id, ...args, options);
|
|
88
108
|
}
|
|
89
109
|
registerModule(module, opts = {}) {
|
|
90
110
|
for (const key in module) {
|
|
91
111
|
this.register(key, module[key], opts);
|
|
92
112
|
}
|
|
93
113
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Run a Resonate function. Functions must first be registered with {@link register}.
|
|
116
|
+
*
|
|
117
|
+
* @template T The return type of the function.
|
|
118
|
+
* @param id A unique id for the function invocation.
|
|
119
|
+
* @param name The function name.
|
|
120
|
+
* @param args The function arguments.
|
|
121
|
+
* @returns A promise that resolve to the function return value.
|
|
122
|
+
*/
|
|
123
|
+
run(name, id, ...argsWithOpts) {
|
|
124
|
+
const { args, opts: { version }, part: { durable, idempotencyKey, tags, timeout }, } = this.split(argsWithOpts);
|
|
125
|
+
if (!this.functions[name] || !this.functions[name][version]) {
|
|
126
|
+
throw new Error(`Function ${name} version ${version} not registered`);
|
|
127
|
+
}
|
|
128
|
+
// the options registered with the function are the defaults
|
|
129
|
+
const { func, opts: defaults } = this.functions[name][version];
|
|
130
|
+
// only the following options can be overridden, this information is persisted
|
|
131
|
+
// in the durable promise and therefore not required on the recovery path
|
|
132
|
+
const override = {};
|
|
133
|
+
if (durable !== undefined) {
|
|
134
|
+
override.durable = durable;
|
|
135
|
+
}
|
|
136
|
+
if (idempotencyKey !== undefined) {
|
|
137
|
+
override.idempotencyKey = idempotencyKey;
|
|
138
|
+
}
|
|
139
|
+
if (tags !== undefined) {
|
|
140
|
+
override.tags = { ...defaults.tags, ...tags, "resonate:invocation": "true" };
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
override.tags = { ...defaults.tags, "resonate:invocation": "true" };
|
|
144
|
+
}
|
|
145
|
+
if (timeout !== undefined) {
|
|
146
|
+
override.timeout = timeout;
|
|
147
|
+
}
|
|
148
|
+
// merge defaults with override to get opts
|
|
149
|
+
const opts = {
|
|
150
|
+
...defaults,
|
|
151
|
+
...override,
|
|
152
|
+
};
|
|
153
|
+
// lock on top level is true by default
|
|
154
|
+
opts.lock = opts.lock ?? true;
|
|
155
|
+
return this.execute(name, id, func, args, opts, defaults);
|
|
156
|
+
}
|
|
157
|
+
schedule(name, cron, func, ...argsWithOpts) {
|
|
158
|
+
const { args, opts } = this.split(argsWithOpts);
|
|
159
|
+
if (typeof func === "function") {
|
|
160
|
+
// if function is provided, the default version is 1
|
|
161
|
+
// as opposed to 0 (alias for latest version)
|
|
162
|
+
opts.version = opts.version || 1;
|
|
163
|
+
this.register(name, func, opts);
|
|
164
|
+
}
|
|
165
|
+
const funcName = typeof func === "string" ? func : name;
|
|
166
|
+
if (!this.functions[funcName] || !this.functions[funcName][opts.version]) {
|
|
167
|
+
throw new Error(`Function ${funcName} version ${opts.version} not registered`);
|
|
168
|
+
}
|
|
169
|
+
const { opts: { version, timeout, tags: promiseTags }, } = this.functions[funcName][opts.version];
|
|
170
|
+
const idempotencyKey = typeof opts.idempotencyKey === "function" ? opts.idempotencyKey(funcName) : opts.idempotencyKey;
|
|
171
|
+
const promiseParam = {
|
|
172
|
+
func: funcName,
|
|
173
|
+
version,
|
|
174
|
+
args,
|
|
175
|
+
};
|
|
176
|
+
return this.schedules.create(name, cron, "{{.id}}.{{.timestamp}}", timeout, {
|
|
177
|
+
idempotencyKey,
|
|
178
|
+
promiseParam,
|
|
179
|
+
promiseTags,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Construct options.
|
|
184
|
+
*
|
|
185
|
+
* @param opts A partial {@link Options} object.
|
|
186
|
+
* @returns PartialOptions.
|
|
187
|
+
*/
|
|
188
|
+
options(opts = {}) {
|
|
189
|
+
return { ...opts, __resonate: true };
|
|
102
190
|
}
|
|
103
191
|
/**
|
|
104
192
|
* Start the resonate service.
|
|
@@ -115,10 +203,27 @@ class ResonateBase {
|
|
|
115
203
|
stop() {
|
|
116
204
|
clearInterval(this.interval);
|
|
117
205
|
}
|
|
206
|
+
defaults({ durable = true, eid = utils.randomId, encoder = this.encoder, idempotencyKey = utils.hash, lock = undefined, poll = this.poll, retry = this.retry, tags = {}, timeout = this.timeout, version = 0, } = {}) {
|
|
207
|
+
// merge tags
|
|
208
|
+
tags = { ...this.tags, ...tags };
|
|
209
|
+
return {
|
|
210
|
+
__resonate: true,
|
|
211
|
+
eid,
|
|
212
|
+
durable,
|
|
213
|
+
encoder,
|
|
214
|
+
idempotencyKey,
|
|
215
|
+
lock,
|
|
216
|
+
poll,
|
|
217
|
+
retry,
|
|
218
|
+
tags,
|
|
219
|
+
timeout,
|
|
220
|
+
version,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
118
223
|
async _start() {
|
|
119
|
-
|
|
120
|
-
for (const
|
|
121
|
-
|
|
224
|
+
try {
|
|
225
|
+
for await (const promises of this.promises.search("*", "pending", { "resonate:invocation": "true" })) {
|
|
226
|
+
for (const promise of promises) {
|
|
122
227
|
const param = promise.param();
|
|
123
228
|
if (param &&
|
|
124
229
|
typeof param === "object" &&
|
|
@@ -128,44 +233,23 @@ class ResonateBase {
|
|
|
128
233
|
typeof param.version === "number" &&
|
|
129
234
|
"args" in param &&
|
|
130
235
|
Array.isArray(param.args)) {
|
|
131
|
-
this.
|
|
236
|
+
const { func, opts } = this.functions[param.func][param.version];
|
|
237
|
+
this.execute(param.func, promise.id, func, param.args, opts, opts, promise);
|
|
132
238
|
}
|
|
133
239
|
}
|
|
134
|
-
catch (e) {
|
|
135
|
-
this.logger.warn(e);
|
|
136
|
-
}
|
|
137
240
|
}
|
|
138
241
|
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
// squash all errors and log,
|
|
244
|
+
// transient errors will be ironed out in the next interval
|
|
245
|
+
this.logger.error(e);
|
|
246
|
+
}
|
|
139
247
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
cancel: (id, error, opts = {}) => promises_1.DurablePromise.cancel(this.store.promises, this.encoder, id, error, opts),
|
|
146
|
-
get: (id) => promises_1.DurablePromise.get(this.store.promises, this.encoder, id),
|
|
147
|
-
search: (id, state, tags, limit) => promises_1.DurablePromise.search(this.store.promises, this.encoder, id, state, tags, limit),
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Construct options.
|
|
152
|
-
*
|
|
153
|
-
* @param opts A partial {@link Options} object.
|
|
154
|
-
* @returns Options with the __resonate flag set.
|
|
155
|
-
*/
|
|
156
|
-
options({ encoder = this.encoder, poll = 5000, // every 5s
|
|
157
|
-
retry = this.retry, store = this.store, tags = {}, timeout = this.timeout, }) {
|
|
158
|
-
// merge tags
|
|
159
|
-
tags = { ...this.tags, ...tags };
|
|
160
|
-
return {
|
|
161
|
-
__resonate: true,
|
|
162
|
-
encoder,
|
|
163
|
-
poll,
|
|
164
|
-
retry,
|
|
165
|
-
store,
|
|
166
|
-
tags,
|
|
167
|
-
timeout,
|
|
168
|
-
};
|
|
248
|
+
split(args) {
|
|
249
|
+
const part = args[args.length - 1];
|
|
250
|
+
return (0, options_1.isOptions)(part)
|
|
251
|
+
? { args: args.slice(0, -1), opts: this.defaults(part), part }
|
|
252
|
+
: { args, opts: this.defaults(), part: {} };
|
|
169
253
|
}
|
|
170
254
|
}
|
|
171
255
|
exports.ResonateBase = ResonateBase;
|
package/dist/resonate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resonate.js","sourceRoot":"","sources":["../lib/resonate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAmD;AAGnD,kDAA+C;
|
|
1
|
+
{"version":3,"file":"resonate.js","sourceRoot":"","sources":["../lib/resonate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAmD;AAGnD,kDAA+C;AAC/C,4CAAqF;AACrF,mEAAqD;AACrD,gDAA6C;AAE7C,sEAAwD;AAExD,+CAAiD;AACjD,iDAAmD;AACnD,oDAAsC;AAQtC,qEAAqE;AACrE,WAAW;AACX,qEAAqE;AAErE,MAAsB,YAAY;IACf,SAAS,GAAkE,EAAE,CAAC;IAE/E,QAAQ,CAAmB;IAC3B,SAAS,CAAoB;IAE7B,GAAG,CAAS;IACZ,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,IAAI,CAAyB;IAE7B,OAAO,CAAwC;IAC/C,MAAM,CAAU;IAChB,KAAK,CAAS;IACd,KAAK,CAAS;IAEtB,QAAQ,CAA6B;IAE7C,YAAY,EACV,OAAO,GAAG,IAAI,kBAAW,EAAE,EAC3B,MAAM,GAAG,IAAI,eAAM,EAAE,EACrB,GAAG,GAAG,KAA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