@resonatehq/sdk 0.8.2 → 0.8.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.
- package/dist/dev/network.d.ts +3 -3
- package/dist/dev/network.d.ts.map +1 -1
- package/dist/dev/network.js +3 -3
- package/dist/dev/network.js.map +1 -1
- package/dist/dev/server.d.ts +1 -0
- package/dist/dev/server.d.ts.map +1 -1
- package/dist/dev/server.js +26 -23
- package/dist/dev/server.js.map +1 -1
- package/dist/sim/example-1.js +3 -3
- package/dist/sim/example-1.js.map +1 -1
- package/dist/sim/example-2.js +3 -3
- package/dist/sim/example-2.js.map +1 -1
- package/dist/sim/example-3.js +3 -3
- package/dist/sim/example-3.js.map +1 -1
- package/dist/sim/src/server.d.ts.map +1 -1
- package/dist/sim/src/worker.d.ts.map +1 -1
- package/dist/sim/src/worker.js +3 -1
- package/dist/sim/src/worker.js.map +1 -1
- package/dist/src/computation.d.ts +2 -1
- package/dist/src/computation.d.ts.map +1 -1
- package/dist/src/computation.js +42 -17
- package/dist/src/computation.js.map +1 -1
- package/dist/src/context.d.ts +14 -3
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +20 -8
- package/dist/src/context.js.map +1 -1
- package/dist/src/core.d.ts +5 -5
- package/dist/src/core.d.ts.map +1 -1
- package/dist/src/core.js +11 -11
- package/dist/src/core.js.map +1 -1
- package/dist/src/coroutine.d.ts +3 -2
- package/dist/src/coroutine.d.ts.map +1 -1
- package/dist/src/coroutine.js +28 -18
- package/dist/src/coroutine.js.map +1 -1
- package/dist/src/decorator.d.ts.map +1 -1
- package/dist/src/exceptions.d.ts +35 -0
- package/dist/src/exceptions.d.ts.map +1 -0
- package/dist/src/exceptions.js +78 -0
- package/dist/src/exceptions.js.map +1 -0
- package/dist/src/handler.d.ts +11 -11
- package/dist/src/handler.d.ts.map +1 -1
- package/dist/src/handler.js +50 -50
- package/dist/src/handler.js.map +1 -1
- package/dist/src/index.d.ts +9 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +17 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/network/network.d.ts +17 -4
- package/dist/src/network/network.d.ts.map +1 -1
- package/dist/src/network/remote.d.ts +6 -3
- package/dist/src/network/remote.d.ts.map +1 -1
- package/dist/src/network/remote.js +48 -18
- package/dist/src/network/remote.js.map +1 -1
- package/dist/src/nursery.js +1 -1
- package/dist/src/nursery.js.map +1 -1
- package/dist/src/processor/processor.d.ts +2 -2
- package/dist/src/processor/processor.d.ts.map +1 -1
- package/dist/src/processor/processor.js +8 -6
- package/dist/src/processor/processor.js.map +1 -1
- package/dist/src/promises.d.ts +4 -0
- package/dist/src/promises.d.ts.map +1 -1
- package/dist/src/promises.js +28 -16
- package/dist/src/promises.js.map +1 -1
- package/dist/src/registry.d.ts +2 -2
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +25 -49
- package/dist/src/registry.js.map +1 -1
- package/dist/src/resonate-inner.d.ts +3 -1
- package/dist/src/resonate-inner.d.ts.map +1 -1
- package/dist/src/resonate-inner.js +4 -2
- package/dist/src/resonate-inner.js.map +1 -1
- package/dist/src/resonate.d.ts +217 -17
- package/dist/src/resonate.d.ts.map +1 -1
- package/dist/src/resonate.js +179 -52
- package/dist/src/resonate.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/src/registry.js
CHANGED
|
@@ -1,66 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.Registry = void 0;
|
|
7
|
+
const exceptions_1 = __importDefault(require("./exceptions"));
|
|
4
8
|
class Registry {
|
|
5
9
|
forward = new Map();
|
|
6
10
|
reverse = new Map();
|
|
7
|
-
add(func, name, version = 1) {
|
|
11
|
+
add(func, name = "", version = 1) {
|
|
12
|
+
// version must be greater than zero
|
|
8
13
|
if (!(version > 0)) {
|
|
9
|
-
throw
|
|
14
|
+
throw exceptions_1.default.REGISTRY_VERSION_INVALID(version);
|
|
10
15
|
}
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
// function must have a name
|
|
17
|
+
if (name === "" && func.name === "") {
|
|
18
|
+
throw exceptions_1.default.REGISTRY_NAME_REQUIRED();
|
|
13
19
|
}
|
|
14
|
-
const funcName = name
|
|
15
|
-
|
|
16
|
-
if ((
|
|
17
|
-
throw
|
|
20
|
+
const funcName = name || func.name;
|
|
21
|
+
// function must not already be registered
|
|
22
|
+
if (this.get(funcName, version)) {
|
|
23
|
+
throw exceptions_1.default.REGISTRY_FUNCTION_ALREADY_REGISTERED(funcName, version);
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.forward.set(funcName, {});
|
|
25
|
+
if (this.get(func, version)) {
|
|
26
|
+
throw exceptions_1.default.REGISTRY_FUNCTION_ALREADY_REGISTERED(func.name, version, this.get(func, version)?.name);
|
|
22
27
|
}
|
|
23
|
-
this.forward.get(funcName)
|
|
24
|
-
this.reverse.
|
|
28
|
+
const forward = this.forward.get(funcName) ?? {};
|
|
29
|
+
const reverse = this.reverse.get(func) ?? {};
|
|
30
|
+
forward[version] = reverse[version] = { name: funcName, func, version };
|
|
31
|
+
this.forward.set(funcName, forward);
|
|
32
|
+
this.reverse.set(func, reverse);
|
|
25
33
|
}
|
|
26
34
|
get(func, version = 0) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!versions) {
|
|
30
|
-
throw new Error(`function ${func} not found in registry`);
|
|
31
|
-
}
|
|
32
|
-
// pick latest if version = 0
|
|
33
|
-
const chosenVersion = version === 0 ? Math.max(...Object.keys(versions).map(Number)) : version;
|
|
34
|
-
if (!(chosenVersion in versions)) {
|
|
35
|
-
throw new Error(`function ${func} version ${version} not found in registry`);
|
|
36
|
-
}
|
|
37
|
-
return versions[chosenVersion];
|
|
38
|
-
}
|
|
39
|
-
const entry = this.reverse.get(func);
|
|
40
|
-
if (!entry) {
|
|
41
|
-
const fnName = func.name || "unknown";
|
|
42
|
-
throw new Error(`function ${fnName} not found in registry`);
|
|
43
|
-
}
|
|
44
|
-
if (version !== 0 && entry.version !== version) {
|
|
45
|
-
const fnName = func.name || "unknown";
|
|
46
|
-
throw new Error(`function ${fnName} version ${version} not found in registry`);
|
|
47
|
-
}
|
|
48
|
-
return entry;
|
|
35
|
+
const registry = typeof func === "string" ? this.forward.get(func) : this.reverse.get(func);
|
|
36
|
+
return registry?.[version > 0 ? version : this.latest(registry)];
|
|
49
37
|
}
|
|
50
|
-
latest(
|
|
51
|
-
|
|
52
|
-
const versions = this.forward.get(func);
|
|
53
|
-
if (!versions) {
|
|
54
|
-
return defaultVersion;
|
|
55
|
-
}
|
|
56
|
-
const versionNumbers = Object.keys(versions).map(Number);
|
|
57
|
-
return versionNumbers.length > 0 ? Math.max(...versionNumbers) : defaultVersion;
|
|
58
|
-
}
|
|
59
|
-
const entry = this.reverse.get(func);
|
|
60
|
-
if (!entry) {
|
|
61
|
-
return defaultVersion;
|
|
62
|
-
}
|
|
63
|
-
return entry.version;
|
|
38
|
+
latest(registry) {
|
|
39
|
+
return Math.max(...(Object.keys(registry ?? {}).map(Number) || [1]));
|
|
64
40
|
}
|
|
65
41
|
}
|
|
66
42
|
exports.Registry = Registry;
|
package/dist/src/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/registry.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAsC;AAStC,MAAa,QAAQ;IACX,OAAO,GAA8C,IAAI,GAAG,EAAE,CAAC;IAC/D,OAAO,GAA4C,IAAI,GAAG,EAAE,CAAC;IAErE,GAAG,CAAC,IAAU,E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AC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,GAAG,CAAC,IAAmB,EAAE,OAAO,GAAG,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5F,OAAO,QAAQ,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnE,CAAC;IAEO,MAAM,CAAC,QAAsC;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;CACF;AAzCD,4BAyCC"}
|
|
@@ -31,8 +31,9 @@ export declare class ResonateInner {
|
|
|
31
31
|
private registry;
|
|
32
32
|
private heartbeat;
|
|
33
33
|
private dependencies;
|
|
34
|
+
private verbose;
|
|
34
35
|
private computations;
|
|
35
|
-
constructor({ unicast, anycastPreference, anycastNoPreference, pid, ttl, clock, network, handler, registry, heartbeat, dependencies, messageSource, }: {
|
|
36
|
+
constructor({ unicast, anycastPreference, anycastNoPreference, pid, ttl, clock, network, handler, registry, heartbeat, dependencies, verbose, messageSource, }: {
|
|
36
37
|
unicast: string;
|
|
37
38
|
anycastPreference: string;
|
|
38
39
|
anycastNoPreference: string;
|
|
@@ -44,6 +45,7 @@ export declare class ResonateInner {
|
|
|
44
45
|
registry: Registry;
|
|
45
46
|
heartbeat: Heartbeat;
|
|
46
47
|
dependencies: Map<string, any>;
|
|
48
|
+
verbose: boolean;
|
|
47
49
|
messageSource?: MessageSource;
|
|
48
50
|
});
|
|
49
51
|
process(task: Task, done: Callback<Status>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resonate-inner.d.ts","sourceRoot":"","sources":["../../src/resonate-inner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAW,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,MAAM,cAAc,GAAG;IAC3B,gBAAgB,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,oBAAoB,KAAK,IAAI,KAAK,IAAI,CAAC;IACxG,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG,WAAW,GAAG,aAAa,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,mBAAmB,CA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YAAY,EACZ,OAAO,EACP,aAAyB,GAC1B,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,mBAAmB,EAAE,MAAM,CAAC;QAC5B,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,KAAK,CAAC;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,QAAQ,CAAC;QACnB,SAAS,EAAE,SAAS,CAAC;QACrB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,CAAC,EAAE,aAAa,CAAC;KAC/B;IAmBM,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;IAwBjD,OAAO,CAAC,SAAS;CAOlB"}
|
|
@@ -48,8 +48,9 @@ class ResonateInner {
|
|
|
48
48
|
registry;
|
|
49
49
|
heartbeat;
|
|
50
50
|
dependencies;
|
|
51
|
+
verbose;
|
|
51
52
|
computations = new Map();
|
|
52
|
-
constructor({ unicast, anycastPreference, anycastNoPreference, pid, ttl, clock, network, handler, registry, heartbeat, dependencies, messageSource = undefined, }) {
|
|
53
|
+
constructor({ unicast, anycastPreference, anycastNoPreference, pid, ttl, clock, network, handler, registry, heartbeat, dependencies, verbose, messageSource = undefined, }) {
|
|
53
54
|
this.unicast = unicast;
|
|
54
55
|
this.anycastPreference = anycastPreference;
|
|
55
56
|
this.anycastNoPreference = anycastNoPreference;
|
|
@@ -61,6 +62,7 @@ class ResonateInner {
|
|
|
61
62
|
this.registry = registry;
|
|
62
63
|
this.heartbeat = heartbeat;
|
|
63
64
|
this.dependencies = dependencies;
|
|
65
|
+
this.verbose = verbose;
|
|
64
66
|
// subscribe to invoke and resume
|
|
65
67
|
messageSource?.subscribe("invoke", this.onMessage.bind(this));
|
|
66
68
|
messageSource?.subscribe("resume", this.onMessage.bind(this));
|
|
@@ -68,7 +70,7 @@ class ResonateInner {
|
|
|
68
70
|
process(task, done) {
|
|
69
71
|
let computation = this.computations.get(task.task.rootPromiseId);
|
|
70
72
|
if (!computation) {
|
|
71
|
-
computation = new computation_1.Computation(task.task.rootPromiseId, this.unicast, this.anycastPreference, this.anycastNoPreference, this.pid, this.ttl, this.clock, this.network, this.handler, this.registry, this.heartbeat, this.dependencies);
|
|
73
|
+
computation = new computation_1.Computation(task.task.rootPromiseId, this.unicast, this.anycastPreference, this.anycastNoPreference, this.pid, this.ttl, this.clock, this.network, this.handler, this.registry, this.heartbeat, this.dependencies, this.verbose);
|
|
72
74
|
this.computations.set(task.task.rootPromiseId, computation);
|
|
73
75
|
}
|
|
74
76
|
computation.process(task, done);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resonate-inner.js","sourceRoot":"","sources":["../../src/resonate-inner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAyD;AAMzD,6CAA+B;AAoB/B,MAAa,aAAa;IAChB,OAAO,CAAS;IAChB,iBAAiB,CAAS;IAC1B,mBAAmB,CAAS;IAC5B,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,KAAK,CAAQ;IACb,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,QAAQ,CAAW;IACnB,SAAS,CAAY;IACrB,YAAY,CAAmB;IAC/B,YAAY,GAA6B,IAAI,GAAG,EAAE,CAAC;IAE3D,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,mBAAmB,EACnB,GAAG,EACH,GAAG,EACH,KAAK,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,aAAa,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"resonate-inner.js","sourceRoot":"","sources":["../../src/resonate-inner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;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 export declare class Resonate {
|
|
|
26
26
|
private inner;
|
|
27
27
|
private network;
|
|
28
28
|
private encoder;
|
|
29
|
+
private verbose;
|
|
29
30
|
private messageSource;
|
|
30
31
|
private handler;
|
|
31
32
|
private registry;
|
|
32
33
|
private heartbeat;
|
|
33
34
|
private dependencies;
|
|
34
35
|
private subscriptions;
|
|
36
|
+
private subscribeEvery;
|
|
37
|
+
private intervalId;
|
|
35
38
|
readonly promises: Promises;
|
|
36
39
|
readonly schedules: Schedules;
|
|
37
|
-
constructor({ url, group, pid, ttl, auth, }?: {
|
|
40
|
+
constructor({ url, group, pid, ttl, auth, verbose, }?: {
|
|
38
41
|
url?: string;
|
|
39
42
|
group?: string;
|
|
40
43
|
pid?: string;
|
|
@@ -43,15 +46,68 @@ export declare class Resonate {
|
|
|
43
46
|
username: string;
|
|
44
47
|
password: string;
|
|
45
48
|
};
|
|
49
|
+
verbose?: boolean;
|
|
46
50
|
});
|
|
47
51
|
/**
|
|
48
|
-
*
|
|
52
|
+
* Initializes a Resonate client instance for local development.
|
|
53
|
+
*
|
|
54
|
+
* Creates and returns a Resonate client configured for **local-only execution**
|
|
55
|
+
* with zero external dependencies. All state is stored in local memory — no
|
|
56
|
+
* network or external persistence is required. This mode is ideal for rapid
|
|
57
|
+
* testing, debugging, and experimentation before connecting to a Resonate server.
|
|
58
|
+
*
|
|
59
|
+
* The client runs with a `"default"` worker group, a `"default"` process ID,
|
|
60
|
+
* and an effectively infinite TTL (`Number.MAX_SAFE_INTEGER`) for tasks.
|
|
61
|
+
*
|
|
62
|
+
* @returns A {@link Resonate} client instance configured for local development.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const resonate = Resonate.local();
|
|
67
|
+
* resonate.register(foo);
|
|
68
|
+
* const result = await resonate.run("foo.1", foo, { data: "test" });
|
|
69
|
+
* console.log(result);
|
|
70
|
+
* ```
|
|
49
71
|
*/
|
|
50
|
-
static local(
|
|
72
|
+
static local({ verbose }?: {
|
|
73
|
+
verbose?: boolean;
|
|
74
|
+
}): Resonate;
|
|
51
75
|
/**
|
|
52
|
-
*
|
|
76
|
+
* Initializes a Resonate client instance with remote configuration.
|
|
77
|
+
*
|
|
78
|
+
* Creates and returns a Resonate client that connects to a **Resonate Server**
|
|
79
|
+
* and optional remote message sources. This configuration enables distributed,
|
|
80
|
+
* durable workers to cooperate and execute functions via **durable RPCs**.
|
|
81
|
+
*
|
|
82
|
+
* By default, the client connects to a Resonate Server running locally
|
|
83
|
+
* (`http://localhost:8001`) and joins the `"default"` worker group.
|
|
84
|
+
*
|
|
85
|
+
* The client is identified by a unique process ID (`pid`) and maintains
|
|
86
|
+
* claimed task leases for the duration specified by `ttl`.
|
|
87
|
+
*
|
|
88
|
+
* @param options - Configuration options for the remote client.
|
|
89
|
+
* @param options.url - The base URL of the remote Resonate Server. Defaults to `"http://localhost:8001"`.
|
|
90
|
+
* @param options.group - The worker group name. Defaults to `"default"`.
|
|
91
|
+
* @param options.pid - Optional process identifier for the client. Defaults to a randomly generated UUID.
|
|
92
|
+
* @param options.ttl - Time-to-live (in seconds) for claimed tasks. Defaults to `1 * util.MIN`.
|
|
93
|
+
* @param options.auth - Optional authentication credentials for connecting to the remote server.
|
|
94
|
+
*
|
|
95
|
+
* @returns A {@link Resonate} client instance configured for remote operation.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const resonate = Resonate.remote({
|
|
100
|
+
* url: "https://resonate.example.com",
|
|
101
|
+
* group: "analytics",
|
|
102
|
+
* ttl: 30,
|
|
103
|
+
* auth: { username: "user", password: "secret" },
|
|
104
|
+
* });
|
|
105
|
+
*
|
|
106
|
+
* const result = await resonate.run("task-42", "processData", { input: "dataset.csv" });
|
|
107
|
+
* console.log(result);
|
|
108
|
+
* ```
|
|
53
109
|
*/
|
|
54
|
-
static remote({ url, group, pid, ttl, auth, }?: {
|
|
110
|
+
static remote({ url, group, pid, ttl, auth, verbose, }?: {
|
|
55
111
|
url?: string;
|
|
56
112
|
group?: string;
|
|
57
113
|
pid?: string;
|
|
@@ -60,13 +116,41 @@ export declare class Resonate {
|
|
|
60
116
|
username: string;
|
|
61
117
|
password: string;
|
|
62
118
|
};
|
|
119
|
+
verbose?: boolean;
|
|
63
120
|
messageSourceAuth?: {
|
|
64
121
|
username: string;
|
|
65
122
|
password: string;
|
|
66
123
|
};
|
|
67
124
|
}): Resonate;
|
|
68
125
|
/**
|
|
69
|
-
*
|
|
126
|
+
* Registers a function with Resonate for execution and version control.
|
|
127
|
+
*
|
|
128
|
+
* This method makes a function available for distributed or top-level execution
|
|
129
|
+
* under a specific name and version.
|
|
130
|
+
*
|
|
131
|
+
* Providing explicit `name` or `version` options allows precise control over
|
|
132
|
+
* function identification and versioning, enabling repeatable, distributed
|
|
133
|
+
* invocation and backward-compatible deployments.
|
|
134
|
+
*
|
|
135
|
+
* @param nameOrFunc - Either the function name (string) or the function itself.
|
|
136
|
+
* When passing a name, provide the function and optional options as additional parameters.
|
|
137
|
+
* @param funcOrOptions - The function to register, or an optional configuration object
|
|
138
|
+
* with versioning information when the first argument is a name.
|
|
139
|
+
* @param maybeOptions - Optional configuration object when both name and function are provided.
|
|
140
|
+
* Supports a `version` field to specify the registered function version.
|
|
141
|
+
*
|
|
142
|
+
* @returns A {@link ResonateFunc} wrapper for the registered function.
|
|
143
|
+
* When used as a decorator, returns a decorator that registers the target function
|
|
144
|
+
* upon definition.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* function greet(ctx: Context, name: string): string {
|
|
149
|
+
* return `Hello, ${name}!`;
|
|
150
|
+
* }
|
|
151
|
+
*
|
|
152
|
+
* resonate.register("greet_user", greet, { version: 2 });
|
|
153
|
+
* ```
|
|
70
154
|
*/
|
|
71
155
|
register<F extends Func>(name: string, func: F, options?: {
|
|
72
156
|
version?: number;
|
|
@@ -75,25 +159,131 @@ export declare class Resonate {
|
|
|
75
159
|
version?: number;
|
|
76
160
|
}): ResonateFunc<F>;
|
|
77
161
|
/**
|
|
78
|
-
*
|
|
162
|
+
* Runs a registered function with Resonate and waits for the result.
|
|
163
|
+
*
|
|
164
|
+
* This method executes the specified function under a **durable promise**
|
|
165
|
+
* identified by the provided `id`. If a promise with the same `id` already exists,
|
|
166
|
+
* Resonate subscribes to its result or returns it immediately if it has already completed.
|
|
167
|
+
*
|
|
168
|
+
* Duplicate executions for the same `id` are automatically prevented, ensuring
|
|
169
|
+
* idempotent and consistent behavior across distributed runs.
|
|
170
|
+
*
|
|
171
|
+
* This is a **blocking operation** — execution will not continue until the
|
|
172
|
+
* function result is available.
|
|
173
|
+
*
|
|
174
|
+
* @param id - The unique identifier of the durable promise. Reusing an ID ensures
|
|
175
|
+
* idempotent execution.
|
|
176
|
+
* @param funcOrName - Either the registered function reference or its string name
|
|
177
|
+
* to execute.
|
|
178
|
+
* @param args - Positional arguments passed to the function.
|
|
179
|
+
*
|
|
180
|
+
* @returns A promise resolving to the final result returned from the function execution.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* const result = await client.run("job-123", "processData", { input: "records.csv" });
|
|
185
|
+
* console.log("Result:", result);
|
|
186
|
+
* ```
|
|
79
187
|
*/
|
|
80
188
|
run<F extends Func>(id: string, func: F, ...args: ParamsWithOptions<F>): Promise<Return<F>>;
|
|
81
189
|
run<T>(id: string, name: string, ...args: any[]): Promise<T>;
|
|
82
190
|
run<T>(id: string, funcOrName: Func | string, ...args: any[]): Promise<T>;
|
|
83
191
|
/**
|
|
84
|
-
*
|
|
192
|
+
* Runs a registered function asynchronously with Resonate.
|
|
193
|
+
*
|
|
194
|
+
* This method schedules the specified function for execution under a **durable promise**
|
|
195
|
+
* identified by the provided `id`. If a promise with the same `id` already exists,
|
|
196
|
+
* Resonate subscribes to its result or returns it immediately if it has already completed.
|
|
197
|
+
*
|
|
198
|
+
* Unlike {@link run}, this method is **non-blocking** and immediately returns a
|
|
199
|
+
* {@link ResonateHandle} that can be awaited or queried later to retrieve the final result
|
|
200
|
+
* once execution completes.
|
|
201
|
+
*
|
|
202
|
+
* Duplicate executions for the same `id` are automatically prevented, ensuring idempotent
|
|
203
|
+
* and consistent behavior across distributed runs.
|
|
204
|
+
*
|
|
205
|
+
* @param id - The unique identifier of the durable promise. Reusing an ID ensures
|
|
206
|
+
* idempotent execution.
|
|
207
|
+
* @param funcOrName - Either the registered function reference or its string name
|
|
208
|
+
* to execute.
|
|
209
|
+
* @param argsWithOpts - Positional arguments and optional configuration parameters
|
|
210
|
+
* passed to the function.
|
|
211
|
+
*
|
|
212
|
+
* @returns A {@link ResonateHandle} representing the asynchronous execution.
|
|
213
|
+
* The handle can be awaited or inspected for status and results.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* const handle = await client.beginRun("run-001", "generateReport", { period: "Q3" });
|
|
218
|
+
* const result = await handle.getResult();
|
|
219
|
+
* console.log(result);
|
|
220
|
+
* ```
|
|
85
221
|
*/
|
|
86
222
|
beginRun<F extends Func>(id: string, func: F, ...args: ParamsWithOptions<F>): Promise<ResonateHandle<Return<F>>>;
|
|
87
223
|
beginRun<T>(id: string, func: string, ...args: any[]): Promise<ResonateHandle<T>>;
|
|
88
224
|
beginRun(id: string, funcOrName: Func | string, ...args: any[]): Promise<ResonateHandle<any>>;
|
|
89
225
|
/**
|
|
90
|
-
*
|
|
226
|
+
* Executes a registered function remotely with Resonate and waits for the result.
|
|
227
|
+
*
|
|
228
|
+
* This method runs the specified function on a remote worker or process under a
|
|
229
|
+
* **durable promise** identified by the provided `id`. If a promise with the same
|
|
230
|
+
* `id` already exists, Resonate subscribes to its result or returns it immediately
|
|
231
|
+
* if it has already completed.
|
|
232
|
+
*
|
|
233
|
+
* Unlike {@link beginRpc}, this method is **blocking** — it waits for the remote
|
|
234
|
+
* function to complete and returns the final result before continuing execution.
|
|
235
|
+
*
|
|
236
|
+
* Duplicate executions for the same `id` are automatically prevented, ensuring
|
|
237
|
+
* idempotent and consistent behavior across distributed runs.
|
|
238
|
+
*
|
|
239
|
+
* @param id - The unique identifier of the durable promise. Reusing an ID ensures
|
|
240
|
+
* idempotent remote execution.
|
|
241
|
+
* @param funcOrName - Either the registered function reference or its string name
|
|
242
|
+
* to execute remotely.
|
|
243
|
+
* @param args - Positional arguments passed to the remote function.
|
|
244
|
+
*
|
|
245
|
+
* @returns A promise resolving to the final result returned from the remote
|
|
246
|
+
* function execution.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```ts
|
|
250
|
+
* const result = await client.rpc("job-42", "analyzeData", { file: "input.csv" });
|
|
251
|
+
* console.log("Remote result:", result);
|
|
252
|
+
* ```
|
|
91
253
|
*/
|
|
92
254
|
rpc<F extends Func>(id: string, func: F, ...args: ParamsWithOptions<F>): Promise<Return<F>>;
|
|
93
255
|
rpc<T>(id: string, name: string, ...args: any[]): Promise<T>;
|
|
94
256
|
rpc<T>(id: string, funcOrName: Func | string, ...args: any[]): Promise<T>;
|
|
95
257
|
/**
|
|
96
|
-
*
|
|
258
|
+
* Initiates a remote procedure call (RPC) with Resonate and returns a handle to the execution.
|
|
259
|
+
*
|
|
260
|
+
* This method schedules a registered function for **remote execution** under a durable promise
|
|
261
|
+
* identified by the provided `id`. The function runs on a remote worker or process as part of
|
|
262
|
+
* Resonate’s distributed execution environment.
|
|
263
|
+
*
|
|
264
|
+
* Unlike {@link rpc}, this method is **non-blocking** and immediately returns a
|
|
265
|
+
* {@link ResonateHandle} that can be awaited or queried later to retrieve the final result once
|
|
266
|
+
* remote execution completes.
|
|
267
|
+
*
|
|
268
|
+
* If a durable promise with the same `id` already exists, Resonate subscribes to its result or
|
|
269
|
+
* returns it immediately if it has already completed. Duplicate executions for the same `id`
|
|
270
|
+
* are automatically prevented, ensuring idempotent and consistent behavior.
|
|
271
|
+
*
|
|
272
|
+
* @param id - The unique identifier of the durable promise. Reusing an ID ensures
|
|
273
|
+
* idempotent remote execution.
|
|
274
|
+
* @param funcOrName - Either the registered function reference or its string name to execute remotely.
|
|
275
|
+
* @param argsWithOpts - Positional arguments and optional configuration parameters
|
|
276
|
+
* passed to the remote function.
|
|
277
|
+
*
|
|
278
|
+
* @returns A {@link ResonateHandle} representing the asynchronous remote execution.
|
|
279
|
+
* The handle can be awaited or inspected for completion and results.
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```ts
|
|
283
|
+
* const handle = await client.beginRpc("task-123", "processData", { input: "hello" });
|
|
284
|
+
* const result = await handle.getResult();
|
|
285
|
+
* console.log(result);
|
|
286
|
+
* ```
|
|
97
287
|
*/
|
|
98
288
|
beginRpc<F extends Func>(id: string, func: F, ...args: ParamsWithOptions<F>): Promise<ResonateHandle<Return<F>>>;
|
|
99
289
|
beginRpc<T>(id: string, func: string, ...args: any[]): Promise<ResonateHandle<T>>;
|
|
@@ -101,16 +291,26 @@ export declare class Resonate {
|
|
|
101
291
|
schedule<F extends Func>(name: string, cron: string, func: F, ...args: ParamsWithOptions<F>): Promise<ResonateSchedule>;
|
|
102
292
|
schedule(name: string, cron: string, func: string, ...args: any[]): Promise<ResonateSchedule>;
|
|
103
293
|
/**
|
|
104
|
-
*
|
|
294
|
+
* Retrieves or subscribes to an existing execution by its unique ID.
|
|
295
|
+
*
|
|
296
|
+
* This method attaches to an existing **durable promise** identified by `id`.
|
|
297
|
+
* If the associated execution is still in progress, it returns a {@link ResonateHandle}
|
|
298
|
+
* that can be awaited or observed until completion. If the execution has already
|
|
299
|
+
* finished, the handle is immediately resolved with the stored result.
|
|
300
|
+
*
|
|
301
|
+
* Notes:
|
|
302
|
+
* - A durable promise with the given `id` must already exist.
|
|
303
|
+
* - This operation is **non-blocking**; awaiting the returned handle will block
|
|
304
|
+
* only if the execution is still running.
|
|
305
|
+
*
|
|
306
|
+
* @param id - Unique identifier of the target execution or durable promise.
|
|
307
|
+
*
|
|
308
|
+
* @returns A {@link ResonateHandle} representing the existing execution.
|
|
309
|
+
* The handle can be awaited or queried to retrieve the final result.
|
|
105
310
|
*/
|
|
106
311
|
get<T = any>(id: string): Promise<ResonateHandle<T>>;
|
|
107
312
|
options(opts?: Partial<Options>): Options;
|
|
108
|
-
|
|
109
|
-
* The dependency is made available to all functions via
|
|
110
|
-
* their execution `Context`.
|
|
111
|
-
* Setting a dependency for a name that already exists will
|
|
112
|
-
* overwrite the previously set dependency.
|
|
113
|
-
*/
|
|
313
|
+
private getArgsAndOpts;
|
|
114
314
|
setDependency(name: string, obj: any): void;
|
|
115
315
|
stop(): void;
|
|
116
316
|
private createPromiseAndTask;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resonate.d.ts","sourceRoot":"","sources":["../../src/resonate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resonate.d.ts","sourceRoot":"","sources":["../../src/resonate.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAG/D,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,IAAI;IAC1C,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,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