@openfn/ws-worker 1.8.6 → 1.8.9
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/CHANGELOG.md +33 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +44 -119
- package/dist/start.js +166 -208
- package/package.json +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# ws-worker
|
|
2
2
|
|
|
3
|
+
## 1.8.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix version loading paths
|
|
8
|
+
|
|
9
|
+
## 1.8.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Fix version number readout
|
|
14
|
+
|
|
15
|
+
## 1.8.7
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Ensure support for node 18,20 and 22.
|
|
20
|
+
|
|
21
|
+
This update ensures compatibility with node 18 LTS, 20 LTS, and 22.12.
|
|
22
|
+
|
|
23
|
+
Most of the changes are in the build and test suites and have only minor impact on production code. No issues are anticipated as as result of this change.
|
|
24
|
+
|
|
25
|
+
Prior releases may fail on node version >=20.
|
|
26
|
+
|
|
27
|
+
Support for node 18 will be removed in late 2025.
|
|
28
|
+
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
- Updated dependencies [8904af2]
|
|
31
|
+
- @openfn/engine-multi@1.4.6
|
|
32
|
+
- @openfn/runtime@1.5.4
|
|
33
|
+
- @openfn/logger@1.0.3
|
|
34
|
+
- @openfn/lexicon@1.1.0
|
|
35
|
+
|
|
3
36
|
## 1.8.6
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { ExecutionPlan, Lazy, State } from '@openfn/lexicon';
|
|
|
8
8
|
import { Channel as Channel$1 } from 'phoenix';
|
|
9
9
|
import { Server } from 'http';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
type Workloop = {
|
|
12
12
|
stop: (reason?: string) => void;
|
|
13
13
|
isStopped: () => boolean;
|
|
14
14
|
};
|
|
@@ -46,12 +46,12 @@ interface Channel extends Channel$1 {
|
|
|
46
46
|
// join: () => ReceiveHook;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
type WorkerRunOptions = ExecuteOptions & {
|
|
50
50
|
outputDataclips?: boolean;
|
|
51
51
|
payloadLimitMb?: number;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
type Context = {
|
|
55
55
|
channel: Channel;
|
|
56
56
|
state: RunState;
|
|
57
57
|
logger: Logger;
|
|
@@ -60,7 +60,7 @@ declare type Context = {
|
|
|
60
60
|
onFinish: (result: any) => void;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
type ServerOptions = {
|
|
64
64
|
maxWorkflows?: number;
|
|
65
65
|
port?: number;
|
|
66
66
|
lightning?: string;
|
|
@@ -105,13 +105,13 @@ declare const RUN_LOG = "run:log";
|
|
|
105
105
|
declare const STEP_START = "step:start";
|
|
106
106
|
declare const STEP_COMPLETE = "step:complete";
|
|
107
107
|
declare const INTERNAL_RUN_COMPLETE = "server:run-complete";
|
|
108
|
-
|
|
108
|
+
type QueueEvents = {
|
|
109
109
|
[CLAIM]: l.ClaimPayload;
|
|
110
110
|
};
|
|
111
|
-
|
|
111
|
+
type QueueEventReplies = {
|
|
112
112
|
[CLAIM]: l.ClaimReply;
|
|
113
113
|
};
|
|
114
|
-
|
|
114
|
+
type RunEvents = {
|
|
115
115
|
[GET_PLAN]: l.GetPlanPayload;
|
|
116
116
|
[GET_CREDENTIAL]: l.GetCredentialPayload;
|
|
117
117
|
[GET_DATACLIP]: l.GetDataclipPayload;
|
|
@@ -121,7 +121,7 @@ declare type RunEvents = {
|
|
|
121
121
|
[STEP_START]: l.StepStartPayload;
|
|
122
122
|
[STEP_COMPLETE]: l.StepCompletePayload;
|
|
123
123
|
};
|
|
124
|
-
|
|
124
|
+
type RunReplies = {
|
|
125
125
|
[GET_PLAN]: l.GetPlanReply;
|
|
126
126
|
[GET_CREDENTIAL]: l.GetCredentialReply;
|
|
127
127
|
[GET_DATACLIP]: l.GetDataClipReply;
|
package/dist/index.js
CHANGED
|
@@ -1,110 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __esm = (fn, res) => function __init() {
|
|
4
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
-
};
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name2 in all)
|
|
8
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// package.json
|
|
12
|
-
var package_exports = {};
|
|
13
|
-
__export(package_exports, {
|
|
14
|
-
author: () => author,
|
|
15
|
-
bin: () => bin,
|
|
16
|
-
default: () => package_default,
|
|
17
|
-
dependencies: () => dependencies,
|
|
18
|
-
description: () => description,
|
|
19
|
-
devDependencies: () => devDependencies,
|
|
20
|
-
files: () => files,
|
|
21
|
-
license: () => license,
|
|
22
|
-
main: () => main,
|
|
23
|
-
name: () => name,
|
|
24
|
-
scripts: () => scripts,
|
|
25
|
-
type: () => type,
|
|
26
|
-
version: () => version
|
|
27
|
-
});
|
|
28
|
-
var name, version, description, main, type, scripts, bin, author, license, dependencies, devDependencies, files, package_default;
|
|
29
|
-
var init_package = __esm({
|
|
30
|
-
"package.json"() {
|
|
31
|
-
name = "@openfn/ws-worker";
|
|
32
|
-
version = "1.8.6";
|
|
33
|
-
description = "A Websocket Worker to connect Lightning to a Runtime Engine";
|
|
34
|
-
main = "dist/index.js";
|
|
35
|
-
type = "module";
|
|
36
|
-
scripts = {
|
|
37
|
-
test: "pnpm ava --serial",
|
|
38
|
-
"test:types": "pnpm tsc --noEmit --project tsconfig.json",
|
|
39
|
-
build: "tsup --config tsup.config.js",
|
|
40
|
-
"build:watch": "pnpm build --watch",
|
|
41
|
-
start: "ts-node-esm --transpile-only src/start.ts",
|
|
42
|
-
"start:prod": "node dist/start.js",
|
|
43
|
-
"start:watch": "nodemon -e ts,js --watch ../runtime-manager/dist --watch ./src --exec 'pnpm start'",
|
|
44
|
-
pack: "pnpm pack --pack-destination ../../dist"
|
|
45
|
-
};
|
|
46
|
-
bin = {
|
|
47
|
-
worker: "dist/start.js"
|
|
48
|
-
};
|
|
49
|
-
author = "Open Function Group <admin@openfn.org>";
|
|
50
|
-
license = "ISC";
|
|
51
|
-
dependencies = {
|
|
52
|
-
"@koa/router": "^12.0.0",
|
|
53
|
-
"@openfn/engine-multi": "workspace:*",
|
|
54
|
-
"@openfn/lexicon": "workspace:^",
|
|
55
|
-
"@openfn/logger": "workspace:*",
|
|
56
|
-
"@openfn/runtime": "workspace:*",
|
|
57
|
-
"@types/koa-logger": "^3.1.2",
|
|
58
|
-
"@types/ws": "^8.5.6",
|
|
59
|
-
"fast-safe-stringify": "^2.1.1",
|
|
60
|
-
figures: "^5.0.0",
|
|
61
|
-
"human-id": "^4.1.0",
|
|
62
|
-
jose: "^4.15.9",
|
|
63
|
-
koa: "^2.13.4",
|
|
64
|
-
"koa-bodyparser": "^4.4.0",
|
|
65
|
-
"koa-logger": "^3.2.1",
|
|
66
|
-
phoenix: "1.7.10",
|
|
67
|
-
ws: "^8.18.0"
|
|
68
|
-
};
|
|
69
|
-
devDependencies = {
|
|
70
|
-
"@openfn/lightning-mock": "workspace:*",
|
|
71
|
-
"@types/koa": "^2.13.5",
|
|
72
|
-
"@types/koa-bodyparser": "^4.3.10",
|
|
73
|
-
"@types/koa__router": "^12.0.1",
|
|
74
|
-
"@types/node": "^18.15.3",
|
|
75
|
-
"@types/nodemon": "1.19.3",
|
|
76
|
-
"@types/phoenix": "^1.6.2",
|
|
77
|
-
"@types/yargs": "^17.0.12",
|
|
78
|
-
ava: "5.1.0",
|
|
79
|
-
nodemon: "3.0.1",
|
|
80
|
-
"ts-node": "^10.9.1",
|
|
81
|
-
tslib: "^2.4.0",
|
|
82
|
-
tsup: "^6.2.3",
|
|
83
|
-
typescript: "^4.6.4",
|
|
84
|
-
yargs: "^17.6.2"
|
|
85
|
-
};
|
|
86
|
-
files = [
|
|
87
|
-
"dist",
|
|
88
|
-
"README.md",
|
|
89
|
-
"CHANGELOG.md"
|
|
90
|
-
];
|
|
91
|
-
package_default = {
|
|
92
|
-
name,
|
|
93
|
-
version,
|
|
94
|
-
description,
|
|
95
|
-
main,
|
|
96
|
-
type,
|
|
97
|
-
scripts,
|
|
98
|
-
bin,
|
|
99
|
-
author,
|
|
100
|
-
license,
|
|
101
|
-
dependencies,
|
|
102
|
-
devDependencies,
|
|
103
|
-
files
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
1
|
// src/server.ts
|
|
109
2
|
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
110
3
|
import { promisify } from "node:util";
|
|
@@ -344,12 +237,12 @@ var convert_lightning_plan_default = (run, options = {}) => {
|
|
|
344
237
|
const appendLocalVersions = (job) => {
|
|
345
238
|
if (monorepoPath && job.adaptors) {
|
|
346
239
|
for (const adaptor of job.adaptors) {
|
|
347
|
-
const { name
|
|
240
|
+
const { name, version: version2 } = getNameAndVersion(adaptor);
|
|
348
241
|
if (monorepoPath && version2 === "local") {
|
|
349
|
-
const shortName =
|
|
242
|
+
const shortName = name.replace("@openfn/language-", "");
|
|
350
243
|
const localPath = path.resolve(monorepoPath, "packages", shortName);
|
|
351
244
|
job.linker ??= {};
|
|
352
|
-
job.linker[
|
|
245
|
+
job.linker[name] = {
|
|
353
246
|
path: localPath,
|
|
354
247
|
version: "local"
|
|
355
248
|
};
|
|
@@ -548,10 +441,14 @@ var createThrottler = () => {
|
|
|
548
441
|
const q = [];
|
|
549
442
|
let activePromise;
|
|
550
443
|
const add = (fn) => {
|
|
551
|
-
return (...args) =>
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
444
|
+
return (...args) => (
|
|
445
|
+
// the wrapped function is a deferred promise
|
|
446
|
+
// that will reject or resolve as usual
|
|
447
|
+
new Promise((resolve, reject) => {
|
|
448
|
+
q.push({ fn, args, resolve, reject });
|
|
449
|
+
shift();
|
|
450
|
+
})
|
|
451
|
+
);
|
|
555
452
|
};
|
|
556
453
|
const shift = () => {
|
|
557
454
|
if (activePromise) {
|
|
@@ -598,8 +495,31 @@ ${prefix("worker")}${versions.worker || "unknown"}`;
|
|
|
598
495
|
return str;
|
|
599
496
|
};
|
|
600
497
|
|
|
498
|
+
// src/util/load-version.ts
|
|
499
|
+
import fs from "fs";
|
|
500
|
+
import path2 from "node:path";
|
|
501
|
+
import { fileURLToPath } from "node:url";
|
|
502
|
+
var version = "";
|
|
503
|
+
function getVersion() {
|
|
504
|
+
if (!version) {
|
|
505
|
+
let nextPath = path2.dirname(fileURLToPath(import.meta.url));
|
|
506
|
+
while (nextPath) {
|
|
507
|
+
const pkgPath = path2.resolve(nextPath, "package.json");
|
|
508
|
+
try {
|
|
509
|
+
fs.statSync(pkgPath);
|
|
510
|
+
nextPath = pkgPath;
|
|
511
|
+
break;
|
|
512
|
+
} catch (e) {
|
|
513
|
+
nextPath = path2.dirname(nextPath);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
const pkg = JSON.parse(fs.readFileSync(nextPath, "utf-8"));
|
|
517
|
+
version = pkg.version;
|
|
518
|
+
}
|
|
519
|
+
return version;
|
|
520
|
+
}
|
|
521
|
+
|
|
601
522
|
// src/events/run-start.ts
|
|
602
|
-
init_package();
|
|
603
523
|
async function onRunStart(context, event) {
|
|
604
524
|
const { channel, state, options = {} } = context;
|
|
605
525
|
const time = (timestamp() - BigInt(1e7)).toString();
|
|
@@ -611,15 +531,17 @@ async function onRunStart(context, event) {
|
|
|
611
531
|
}
|
|
612
532
|
};
|
|
613
533
|
const versions = {
|
|
614
|
-
worker:
|
|
534
|
+
worker: await getVersion(),
|
|
615
535
|
...event.versions
|
|
616
536
|
};
|
|
617
537
|
await sendEvent(channel, RUN_START, {
|
|
618
538
|
versions,
|
|
539
|
+
/// use the engine time in run start
|
|
619
540
|
timestamp: timeInMicroseconds(event.time)
|
|
620
541
|
});
|
|
621
542
|
if ("payloadLimitMb" in options) {
|
|
622
543
|
await onJobLog(versionLogContext, {
|
|
544
|
+
// use the fake time in the log
|
|
623
545
|
time,
|
|
624
546
|
message: [`Payload limit: ${options.payloadLimitMb}mb`],
|
|
625
547
|
level: "info",
|
|
@@ -862,12 +784,16 @@ function execute(channel, engine, logger, plan, input, options = {}, onFinish =
|
|
|
862
784
|
addEvent("job-complete", throttle(onStepComplete)),
|
|
863
785
|
addEvent("job-error", throttle(onJobError)),
|
|
864
786
|
addEvent("workflow-log", throttle(onJobLog)),
|
|
787
|
+
// This will also resolve the promise
|
|
865
788
|
addEvent("workflow-complete", throttle(onWorkflowComplete)),
|
|
866
789
|
addEvent("workflow-error", throttle(onRunError))
|
|
790
|
+
// TODO send autoinstall logs
|
|
867
791
|
);
|
|
868
792
|
engine.listen(plan.id, listeners);
|
|
869
793
|
const resolvers = {
|
|
870
794
|
credential: (id) => loadCredential(channel, id)
|
|
795
|
+
// TODO not supported right now
|
|
796
|
+
// dataclip: (id: string) => loadDataclip(channel, id),
|
|
871
797
|
};
|
|
872
798
|
setTimeout(async () => {
|
|
873
799
|
let loadedInput = input;
|
|
@@ -1017,11 +943,10 @@ var worker_token_default = generateWorkerToken;
|
|
|
1017
943
|
var connectToWorkerQueue = (endpoint, serverId, secret, timeout = 10, logger, SocketConstructor = PhxSocket) => {
|
|
1018
944
|
const events = new EventEmitter();
|
|
1019
945
|
worker_token_default(secret, serverId, logger).then(async (token) => {
|
|
1020
|
-
const pkg = await Promise.resolve().then(() => (init_package(), package_exports));
|
|
1021
946
|
const params = {
|
|
1022
947
|
token,
|
|
1023
948
|
api_version: API_VERSION,
|
|
1024
|
-
worker_version:
|
|
949
|
+
worker_version: await getVersion()
|
|
1025
950
|
};
|
|
1026
951
|
const socket = new SocketConstructor(endpoint, {
|
|
1027
952
|
params,
|
|
@@ -1119,7 +1044,7 @@ async function setupCollections(options, logger) {
|
|
|
1119
1044
|
"WARNING: no collections URL provided. Collections service will not be enabled."
|
|
1120
1045
|
);
|
|
1121
1046
|
logger.warn(
|
|
1122
|
-
"Pass --collections-
|
|
1047
|
+
"Pass --collections-url or set WORKER_COLLECTIONS_URL to set the url"
|
|
1123
1048
|
);
|
|
1124
1049
|
return;
|
|
1125
1050
|
}
|
package/dist/start.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
2
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
3
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
4
|
}) : x)(function(x) {
|
|
@@ -8,110 +6,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
8
6
|
return require.apply(this, arguments);
|
|
9
7
|
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
10
8
|
});
|
|
11
|
-
var __esm = (fn, res) => function __init() {
|
|
12
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
13
|
-
};
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name2 in all)
|
|
16
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// package.json
|
|
20
|
-
var package_exports = {};
|
|
21
|
-
__export(package_exports, {
|
|
22
|
-
author: () => author,
|
|
23
|
-
bin: () => bin,
|
|
24
|
-
default: () => package_default,
|
|
25
|
-
dependencies: () => dependencies,
|
|
26
|
-
description: () => description,
|
|
27
|
-
devDependencies: () => devDependencies,
|
|
28
|
-
files: () => files,
|
|
29
|
-
license: () => license,
|
|
30
|
-
main: () => main,
|
|
31
|
-
name: () => name,
|
|
32
|
-
scripts: () => scripts,
|
|
33
|
-
type: () => type,
|
|
34
|
-
version: () => version
|
|
35
|
-
});
|
|
36
|
-
var name, version, description, main, type, scripts, bin, author, license, dependencies, devDependencies, files, package_default;
|
|
37
|
-
var init_package = __esm({
|
|
38
|
-
"package.json"() {
|
|
39
|
-
name = "@openfn/ws-worker";
|
|
40
|
-
version = "1.8.6";
|
|
41
|
-
description = "A Websocket Worker to connect Lightning to a Runtime Engine";
|
|
42
|
-
main = "dist/index.js";
|
|
43
|
-
type = "module";
|
|
44
|
-
scripts = {
|
|
45
|
-
test: "pnpm ava --serial",
|
|
46
|
-
"test:types": "pnpm tsc --noEmit --project tsconfig.json",
|
|
47
|
-
build: "tsup --config tsup.config.js",
|
|
48
|
-
"build:watch": "pnpm build --watch",
|
|
49
|
-
start: "ts-node-esm --transpile-only src/start.ts",
|
|
50
|
-
"start:prod": "node dist/start.js",
|
|
51
|
-
"start:watch": "nodemon -e ts,js --watch ../runtime-manager/dist --watch ./src --exec 'pnpm start'",
|
|
52
|
-
pack: "pnpm pack --pack-destination ../../dist"
|
|
53
|
-
};
|
|
54
|
-
bin = {
|
|
55
|
-
worker: "dist/start.js"
|
|
56
|
-
};
|
|
57
|
-
author = "Open Function Group <admin@openfn.org>";
|
|
58
|
-
license = "ISC";
|
|
59
|
-
dependencies = {
|
|
60
|
-
"@koa/router": "^12.0.0",
|
|
61
|
-
"@openfn/engine-multi": "workspace:*",
|
|
62
|
-
"@openfn/lexicon": "workspace:^",
|
|
63
|
-
"@openfn/logger": "workspace:*",
|
|
64
|
-
"@openfn/runtime": "workspace:*",
|
|
65
|
-
"@types/koa-logger": "^3.1.2",
|
|
66
|
-
"@types/ws": "^8.5.6",
|
|
67
|
-
"fast-safe-stringify": "^2.1.1",
|
|
68
|
-
figures: "^5.0.0",
|
|
69
|
-
"human-id": "^4.1.0",
|
|
70
|
-
jose: "^4.15.9",
|
|
71
|
-
koa: "^2.13.4",
|
|
72
|
-
"koa-bodyparser": "^4.4.0",
|
|
73
|
-
"koa-logger": "^3.2.1",
|
|
74
|
-
phoenix: "1.7.10",
|
|
75
|
-
ws: "^8.18.0"
|
|
76
|
-
};
|
|
77
|
-
devDependencies = {
|
|
78
|
-
"@openfn/lightning-mock": "workspace:*",
|
|
79
|
-
"@types/koa": "^2.13.5",
|
|
80
|
-
"@types/koa-bodyparser": "^4.3.10",
|
|
81
|
-
"@types/koa__router": "^12.0.1",
|
|
82
|
-
"@types/node": "^18.15.3",
|
|
83
|
-
"@types/nodemon": "1.19.3",
|
|
84
|
-
"@types/phoenix": "^1.6.2",
|
|
85
|
-
"@types/yargs": "^17.0.12",
|
|
86
|
-
ava: "5.1.0",
|
|
87
|
-
nodemon: "3.0.1",
|
|
88
|
-
"ts-node": "^10.9.1",
|
|
89
|
-
tslib: "^2.4.0",
|
|
90
|
-
tsup: "^6.2.3",
|
|
91
|
-
typescript: "^4.6.4",
|
|
92
|
-
yargs: "^17.6.2"
|
|
93
|
-
};
|
|
94
|
-
files = [
|
|
95
|
-
"dist",
|
|
96
|
-
"README.md",
|
|
97
|
-
"CHANGELOG.md"
|
|
98
|
-
];
|
|
99
|
-
package_default = {
|
|
100
|
-
name,
|
|
101
|
-
version,
|
|
102
|
-
description,
|
|
103
|
-
main,
|
|
104
|
-
type,
|
|
105
|
-
scripts,
|
|
106
|
-
bin,
|
|
107
|
-
author,
|
|
108
|
-
license,
|
|
109
|
-
dependencies,
|
|
110
|
-
devDependencies,
|
|
111
|
-
files
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
9
|
|
|
116
10
|
// src/start.ts
|
|
117
11
|
import createLogger from "@openfn/logger";
|
|
@@ -153,11 +47,11 @@ async function createMock() {
|
|
|
153
47
|
const activeWorkflows = {};
|
|
154
48
|
const bus = new EventEmitter();
|
|
155
49
|
const listeners = {};
|
|
156
|
-
const dispatch = (
|
|
50
|
+
const dispatch = (type, args2) => {
|
|
157
51
|
if (args2.workflowId) {
|
|
158
|
-
listeners[args2.workflowId]?.[
|
|
52
|
+
listeners[args2.workflowId]?.[type]?.(args2);
|
|
159
53
|
}
|
|
160
|
-
bus.emit(
|
|
54
|
+
bus.emit(type, args2);
|
|
161
55
|
};
|
|
162
56
|
const on = (event, fn) => bus.on(event, fn);
|
|
163
57
|
const once = (event, fn) => bus.once(event, fn);
|
|
@@ -201,8 +95,8 @@ async function createMock() {
|
|
|
201
95
|
...options,
|
|
202
96
|
globals: helpers,
|
|
203
97
|
callbacks: {
|
|
204
|
-
notify: (
|
|
205
|
-
dispatch(
|
|
98
|
+
notify: (name, payload) => {
|
|
99
|
+
dispatch(name, {
|
|
206
100
|
workflowId: id,
|
|
207
101
|
threadId,
|
|
208
102
|
...payload
|
|
@@ -483,12 +377,12 @@ var convert_lightning_plan_default = (run2, options = {}) => {
|
|
|
483
377
|
const appendLocalVersions = (job) => {
|
|
484
378
|
if (monorepoPath && job.adaptors) {
|
|
485
379
|
for (const adaptor of job.adaptors) {
|
|
486
|
-
const { name
|
|
380
|
+
const { name, version: version2 } = getNameAndVersion(adaptor);
|
|
487
381
|
if (monorepoPath && version2 === "local") {
|
|
488
|
-
const shortName =
|
|
382
|
+
const shortName = name.replace("@openfn/language-", "");
|
|
489
383
|
const localPath = path.resolve(monorepoPath, "packages", shortName);
|
|
490
384
|
job.linker ??= {};
|
|
491
|
-
job.linker[
|
|
385
|
+
job.linker[name] = {
|
|
492
386
|
path: localPath,
|
|
493
387
|
version: "local"
|
|
494
388
|
};
|
|
@@ -687,10 +581,14 @@ var createThrottler = () => {
|
|
|
687
581
|
const q = [];
|
|
688
582
|
let activePromise;
|
|
689
583
|
const add = (fn) => {
|
|
690
|
-
return (...args2) =>
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
584
|
+
return (...args2) => (
|
|
585
|
+
// the wrapped function is a deferred promise
|
|
586
|
+
// that will reject or resolve as usual
|
|
587
|
+
new Promise((resolve5, reject) => {
|
|
588
|
+
q.push({ fn, args: args2, resolve: resolve5, reject });
|
|
589
|
+
shift();
|
|
590
|
+
})
|
|
591
|
+
);
|
|
694
592
|
};
|
|
695
593
|
const shift = () => {
|
|
696
594
|
if (activePromise) {
|
|
@@ -737,8 +635,31 @@ ${prefix("worker")}${versions.worker || "unknown"}`;
|
|
|
737
635
|
return str;
|
|
738
636
|
};
|
|
739
637
|
|
|
638
|
+
// src/util/load-version.ts
|
|
639
|
+
import fs from "fs";
|
|
640
|
+
import path2 from "node:path";
|
|
641
|
+
import { fileURLToPath } from "node:url";
|
|
642
|
+
var version = "";
|
|
643
|
+
function getVersion() {
|
|
644
|
+
if (!version) {
|
|
645
|
+
let nextPath = path2.dirname(fileURLToPath(import.meta.url));
|
|
646
|
+
while (nextPath) {
|
|
647
|
+
const pkgPath = path2.resolve(nextPath, "package.json");
|
|
648
|
+
try {
|
|
649
|
+
fs.statSync(pkgPath);
|
|
650
|
+
nextPath = pkgPath;
|
|
651
|
+
break;
|
|
652
|
+
} catch (e) {
|
|
653
|
+
nextPath = path2.dirname(nextPath);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
const pkg = JSON.parse(fs.readFileSync(nextPath, "utf-8"));
|
|
657
|
+
version = pkg.version;
|
|
658
|
+
}
|
|
659
|
+
return version;
|
|
660
|
+
}
|
|
661
|
+
|
|
740
662
|
// src/events/run-start.ts
|
|
741
|
-
init_package();
|
|
742
663
|
async function onRunStart(context, event) {
|
|
743
664
|
const { channel, state, options = {} } = context;
|
|
744
665
|
const time = (timestamp() - BigInt(1e7)).toString();
|
|
@@ -750,15 +671,17 @@ async function onRunStart(context, event) {
|
|
|
750
671
|
}
|
|
751
672
|
};
|
|
752
673
|
const versions = {
|
|
753
|
-
worker:
|
|
674
|
+
worker: await getVersion(),
|
|
754
675
|
...event.versions
|
|
755
676
|
};
|
|
756
677
|
await sendEvent(channel, RUN_START, {
|
|
757
678
|
versions,
|
|
679
|
+
/// use the engine time in run start
|
|
758
680
|
timestamp: timeInMicroseconds(event.time)
|
|
759
681
|
});
|
|
760
682
|
if ("payloadLimitMb" in options) {
|
|
761
683
|
await onJobLog(versionLogContext, {
|
|
684
|
+
// use the fake time in the log
|
|
762
685
|
time,
|
|
763
686
|
message: [`Payload limit: ${options.payloadLimitMb}mb`],
|
|
764
687
|
level: "info",
|
|
@@ -1001,12 +924,16 @@ function execute(channel, engine, logger2, plan, input, options = {}, onFinish =
|
|
|
1001
924
|
addEvent("job-complete", throttle(onStepComplete)),
|
|
1002
925
|
addEvent("job-error", throttle(onJobError)),
|
|
1003
926
|
addEvent("workflow-log", throttle(onJobLog)),
|
|
927
|
+
// This will also resolve the promise
|
|
1004
928
|
addEvent("workflow-complete", throttle(onWorkflowComplete)),
|
|
1005
929
|
addEvent("workflow-error", throttle(onRunError))
|
|
930
|
+
// TODO send autoinstall logs
|
|
1006
931
|
);
|
|
1007
932
|
engine.listen(plan.id, listeners);
|
|
1008
933
|
const resolvers = {
|
|
1009
934
|
credential: (id) => loadCredential(channel, id)
|
|
935
|
+
// TODO not supported right now
|
|
936
|
+
// dataclip: (id: string) => loadDataclip(channel, id),
|
|
1010
937
|
};
|
|
1011
938
|
setTimeout(async () => {
|
|
1012
939
|
let loadedInput = input;
|
|
@@ -1156,11 +1083,10 @@ var worker_token_default = generateWorkerToken;
|
|
|
1156
1083
|
var connectToWorkerQueue = (endpoint, serverId, secret, timeout = 10, logger2, SocketConstructor = PhxSocket) => {
|
|
1157
1084
|
const events = new EventEmitter2();
|
|
1158
1085
|
worker_token_default(secret, serverId, logger2).then(async (token) => {
|
|
1159
|
-
const pkg = await Promise.resolve().then(() => (init_package(), package_exports));
|
|
1160
1086
|
const params = {
|
|
1161
1087
|
token,
|
|
1162
1088
|
api_version: API_VERSION,
|
|
1163
|
-
worker_version:
|
|
1089
|
+
worker_version: await getVersion()
|
|
1164
1090
|
};
|
|
1165
1091
|
const socket = new SocketConstructor(endpoint, {
|
|
1166
1092
|
params,
|
|
@@ -1258,7 +1184,7 @@ async function setupCollections(options, logger2) {
|
|
|
1258
1184
|
"WARNING: no collections URL provided. Collections service will not be enabled."
|
|
1259
1185
|
);
|
|
1260
1186
|
logger2.warn(
|
|
1261
|
-
"Pass --collections-
|
|
1187
|
+
"Pass --collections-url or set WORKER_COLLECTIONS_URL to set the url"
|
|
1262
1188
|
);
|
|
1263
1189
|
return;
|
|
1264
1190
|
}
|
|
@@ -1526,6 +1452,8 @@ var UI = class {
|
|
|
1526
1452
|
});
|
|
1527
1453
|
return lines;
|
|
1528
1454
|
}
|
|
1455
|
+
// if the full 'source' can render in
|
|
1456
|
+
// the target line, do so.
|
|
1529
1457
|
renderInline(source, previousLine) {
|
|
1530
1458
|
const match = source.match(/^ */);
|
|
1531
1459
|
const leadingWhitespace = match ? match[0].length : 0;
|
|
@@ -1696,7 +1624,7 @@ function ui(opts) {
|
|
|
1696
1624
|
});
|
|
1697
1625
|
}
|
|
1698
1626
|
|
|
1699
|
-
// ../../node_modules/.pnpm/escalade@3.
|
|
1627
|
+
// ../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs
|
|
1700
1628
|
import { dirname, resolve } from "path";
|
|
1701
1629
|
import { readdirSync, statSync } from "fs";
|
|
1702
1630
|
function sync_default(start, callback) {
|
|
@@ -1718,7 +1646,7 @@ function sync_default(start, callback) {
|
|
|
1718
1646
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs
|
|
1719
1647
|
import { inspect } from "util";
|
|
1720
1648
|
import { readFileSync as readFileSync3 } from "fs";
|
|
1721
|
-
import { fileURLToPath } from "url";
|
|
1649
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1722
1650
|
|
|
1723
1651
|
// ../../node_modules/.pnpm/yargs-parser@21.1.1/node_modules/yargs-parser/build/lib/index.js
|
|
1724
1652
|
import { format } from "util";
|
|
@@ -2567,26 +2495,26 @@ var YargsParser = class {
|
|
|
2567
2495
|
return defaultForType(guessType2(key));
|
|
2568
2496
|
}
|
|
2569
2497
|
}
|
|
2570
|
-
function defaultForType(
|
|
2498
|
+
function defaultForType(type) {
|
|
2571
2499
|
const def = {
|
|
2572
2500
|
[DefaultValuesForTypeKey.BOOLEAN]: true,
|
|
2573
2501
|
[DefaultValuesForTypeKey.STRING]: "",
|
|
2574
2502
|
[DefaultValuesForTypeKey.NUMBER]: void 0,
|
|
2575
2503
|
[DefaultValuesForTypeKey.ARRAY]: []
|
|
2576
2504
|
};
|
|
2577
|
-
return def[
|
|
2505
|
+
return def[type];
|
|
2578
2506
|
}
|
|
2579
2507
|
function guessType2(key) {
|
|
2580
|
-
let
|
|
2508
|
+
let type = DefaultValuesForTypeKey.BOOLEAN;
|
|
2581
2509
|
if (checkAllAliases(key, flags.strings))
|
|
2582
|
-
|
|
2510
|
+
type = DefaultValuesForTypeKey.STRING;
|
|
2583
2511
|
else if (checkAllAliases(key, flags.numbers))
|
|
2584
|
-
|
|
2512
|
+
type = DefaultValuesForTypeKey.NUMBER;
|
|
2585
2513
|
else if (checkAllAliases(key, flags.bools))
|
|
2586
|
-
|
|
2514
|
+
type = DefaultValuesForTypeKey.BOOLEAN;
|
|
2587
2515
|
else if (checkAllAliases(key, flags.arrays))
|
|
2588
|
-
|
|
2589
|
-
return
|
|
2516
|
+
type = DefaultValuesForTypeKey.ARRAY;
|
|
2517
|
+
return type;
|
|
2590
2518
|
}
|
|
2591
2519
|
function isUndefined(num) {
|
|
2592
2520
|
return num === void 0;
|
|
@@ -2681,11 +2609,13 @@ var parser = new YargsParser({
|
|
|
2681
2609
|
format,
|
|
2682
2610
|
normalize,
|
|
2683
2611
|
resolve: resolve2,
|
|
2684
|
-
|
|
2612
|
+
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
2613
|
+
// we can exercise all the lines below:
|
|
2614
|
+
require: (path3) => {
|
|
2685
2615
|
if (typeof __require !== "undefined") {
|
|
2686
|
-
return __require(
|
|
2687
|
-
} else if (
|
|
2688
|
-
return JSON.parse(readFileSync(
|
|
2616
|
+
return __require(path3);
|
|
2617
|
+
} else if (path3.match(/\.json$/)) {
|
|
2618
|
+
return JSON.parse(readFileSync(path3, "utf8"));
|
|
2689
2619
|
} else {
|
|
2690
2620
|
throw Error("only .json config files are supported in ESM");
|
|
2691
2621
|
}
|
|
@@ -2928,7 +2858,7 @@ var REQUIRE_ERROR = "require is not supported by ESM";
|
|
|
2928
2858
|
var REQUIRE_DIRECTORY_ERROR = "loading a directory of commands is not supported yet for ESM";
|
|
2929
2859
|
var __dirname;
|
|
2930
2860
|
try {
|
|
2931
|
-
__dirname =
|
|
2861
|
+
__dirname = fileURLToPath2(import.meta.url);
|
|
2932
2862
|
} catch (e) {
|
|
2933
2863
|
__dirname = process.cwd();
|
|
2934
2864
|
}
|
|
@@ -2960,7 +2890,7 @@ var esm_default = {
|
|
|
2960
2890
|
process: {
|
|
2961
2891
|
argv: () => process.argv,
|
|
2962
2892
|
cwd: process.cwd,
|
|
2963
|
-
emitWarning: (warning,
|
|
2893
|
+
emitWarning: (warning, type) => process.emitWarning(warning, type),
|
|
2964
2894
|
execPath: () => process.execPath,
|
|
2965
2895
|
exit: process.exit,
|
|
2966
2896
|
nextTick: process.nextTick,
|
|
@@ -3058,7 +2988,7 @@ function argsert(arg1, arg2, arg3) {
|
|
|
3058
2988
|
parsed.demanded.forEach((demanded) => {
|
|
3059
2989
|
const arg = args2.shift();
|
|
3060
2990
|
const observedType = guessType(arg);
|
|
3061
|
-
const matchingTypes = demanded.cmd.filter((
|
|
2991
|
+
const matchingTypes = demanded.cmd.filter((type) => type === observedType || type === "*");
|
|
3062
2992
|
if (matchingTypes.length === 0)
|
|
3063
2993
|
argumentTypeError(observedType, demanded.cmd, position);
|
|
3064
2994
|
position += 1;
|
|
@@ -3068,7 +2998,7 @@ function argsert(arg1, arg2, arg3) {
|
|
|
3068
2998
|
return;
|
|
3069
2999
|
const arg = args2.shift();
|
|
3070
3000
|
const observedType = guessType(arg);
|
|
3071
|
-
const matchingTypes = optional.cmd.filter((
|
|
3001
|
+
const matchingTypes = optional.cmd.filter((type) => type === observedType || type === "*");
|
|
3072
3002
|
if (matchingTypes.length === 0)
|
|
3073
3003
|
argumentTypeError(observedType, optional.cmd, position);
|
|
3074
3004
|
position += 1;
|
|
@@ -3190,8 +3120,8 @@ function isFunction(arg) {
|
|
|
3190
3120
|
function whichModule(exported) {
|
|
3191
3121
|
if (typeof __require === "undefined")
|
|
3192
3122
|
return null;
|
|
3193
|
-
for (let i = 0,
|
|
3194
|
-
mod = __require.cache[
|
|
3123
|
+
for (let i = 0, files = Object.keys(__require.cache), mod; i < files.length; i++) {
|
|
3124
|
+
mod = __require.cache[files[i]];
|
|
3195
3125
|
if (mod.exports === exported)
|
|
3196
3126
|
return mod;
|
|
3197
3127
|
}
|
|
@@ -3231,7 +3161,7 @@ var CommandInstance = class {
|
|
|
3231
3161
|
};
|
|
3232
3162
|
this.shim.requireDirectory({ require: req, filename: callerFile }, dir, opts);
|
|
3233
3163
|
}
|
|
3234
|
-
addHandler(cmd,
|
|
3164
|
+
addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) {
|
|
3235
3165
|
let aliases = [];
|
|
3236
3166
|
const middlewares = commandMiddlewareFactory(commandMiddleware);
|
|
3237
3167
|
handler = handler || (() => {
|
|
@@ -3251,7 +3181,7 @@ var CommandInstance = class {
|
|
|
3251
3181
|
this.addHandler(command2, this.extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated);
|
|
3252
3182
|
return;
|
|
3253
3183
|
} else if (isCommandBuilderDefinition(builder)) {
|
|
3254
|
-
this.addHandler([cmd].concat(aliases),
|
|
3184
|
+
this.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated);
|
|
3255
3185
|
return;
|
|
3256
3186
|
}
|
|
3257
3187
|
if (typeof cmd === "string") {
|
|
@@ -3275,12 +3205,12 @@ var CommandInstance = class {
|
|
|
3275
3205
|
aliases.forEach((alias) => {
|
|
3276
3206
|
this.aliasMap[alias] = parsedCommand.cmd;
|
|
3277
3207
|
});
|
|
3278
|
-
if (
|
|
3279
|
-
this.usage.command(cmd,
|
|
3208
|
+
if (description !== false) {
|
|
3209
|
+
this.usage.command(cmd, description, isDefault, aliases, deprecated);
|
|
3280
3210
|
}
|
|
3281
3211
|
this.handlers[parsedCommand.cmd] = {
|
|
3282
3212
|
original: cmd,
|
|
3283
|
-
description
|
|
3213
|
+
description,
|
|
3284
3214
|
handler,
|
|
3285
3215
|
builder: builder || {},
|
|
3286
3216
|
middlewares,
|
|
@@ -3539,8 +3469,8 @@ var CommandInstance = class {
|
|
|
3539
3469
|
commandFromFilename(filename) {
|
|
3540
3470
|
return this.shim.path.basename(filename, this.shim.path.extname(filename));
|
|
3541
3471
|
}
|
|
3542
|
-
extractDesc({ describe, description
|
|
3543
|
-
for (const test of [describe,
|
|
3472
|
+
extractDesc({ describe, description, desc }) {
|
|
3473
|
+
for (const test of [describe, description, desc]) {
|
|
3544
3474
|
if (typeof test === "string" || test === false)
|
|
3545
3475
|
return test;
|
|
3546
3476
|
assertNotStrictEqual(test, true, this.shim);
|
|
@@ -3681,14 +3611,14 @@ function usage(yargs, shim3) {
|
|
|
3681
3611
|
};
|
|
3682
3612
|
let usages = [];
|
|
3683
3613
|
let usageDisabled = false;
|
|
3684
|
-
self.usage = (msg,
|
|
3614
|
+
self.usage = (msg, description) => {
|
|
3685
3615
|
if (msg === null) {
|
|
3686
3616
|
usageDisabled = true;
|
|
3687
3617
|
usages = [];
|
|
3688
3618
|
return self;
|
|
3689
3619
|
}
|
|
3690
3620
|
usageDisabled = false;
|
|
3691
|
-
usages.push([msg,
|
|
3621
|
+
usages.push([msg, description || ""]);
|
|
3692
3622
|
return self;
|
|
3693
3623
|
};
|
|
3694
3624
|
self.getUsage = () => {
|
|
@@ -3701,18 +3631,18 @@ function usage(yargs, shim3) {
|
|
|
3701
3631
|
return __("Positionals:");
|
|
3702
3632
|
};
|
|
3703
3633
|
let examples = [];
|
|
3704
|
-
self.example = (cmd,
|
|
3705
|
-
examples.push([cmd,
|
|
3634
|
+
self.example = (cmd, description) => {
|
|
3635
|
+
examples.push([cmd, description || ""]);
|
|
3706
3636
|
};
|
|
3707
3637
|
let commands = [];
|
|
3708
|
-
self.command = function command2(cmd,
|
|
3638
|
+
self.command = function command2(cmd, description, isDefault, aliases, deprecated = false) {
|
|
3709
3639
|
if (isDefault) {
|
|
3710
3640
|
commands = commands.map((cmdArray) => {
|
|
3711
3641
|
cmdArray[2] = false;
|
|
3712
3642
|
return cmdArray;
|
|
3713
3643
|
});
|
|
3714
3644
|
}
|
|
3715
|
-
commands.push([cmd,
|
|
3645
|
+
commands.push([cmd, description || "", isDefault, aliases, deprecated]);
|
|
3716
3646
|
};
|
|
3717
3647
|
self.getCommands = () => commands;
|
|
3718
3648
|
let descriptions = {};
|
|
@@ -3885,25 +3815,25 @@ function usage(yargs, shim3) {
|
|
|
3885
3815
|
normalizedKeys.forEach((key) => {
|
|
3886
3816
|
const kswitch = switches[key];
|
|
3887
3817
|
let desc = descriptions[key] || "";
|
|
3888
|
-
let
|
|
3818
|
+
let type = null;
|
|
3889
3819
|
if (desc.includes(deferY18nLookupPrefix))
|
|
3890
3820
|
desc = __(desc.substring(deferY18nLookupPrefix.length));
|
|
3891
3821
|
if (options.boolean.includes(key))
|
|
3892
|
-
|
|
3822
|
+
type = `[${__("boolean")}]`;
|
|
3893
3823
|
if (options.count.includes(key))
|
|
3894
|
-
|
|
3824
|
+
type = `[${__("count")}]`;
|
|
3895
3825
|
if (options.string.includes(key))
|
|
3896
|
-
|
|
3826
|
+
type = `[${__("string")}]`;
|
|
3897
3827
|
if (options.normalize.includes(key))
|
|
3898
|
-
|
|
3828
|
+
type = `[${__("string")}]`;
|
|
3899
3829
|
if (options.array.includes(key))
|
|
3900
|
-
|
|
3830
|
+
type = `[${__("array")}]`;
|
|
3901
3831
|
if (options.number.includes(key))
|
|
3902
|
-
|
|
3832
|
+
type = `[${__("number")}]`;
|
|
3903
3833
|
const deprecatedExtra = (deprecated) => typeof deprecated === "string" ? `[${__("deprecated: %s", deprecated)}]` : `[${__("deprecated")}]`;
|
|
3904
3834
|
const extra = [
|
|
3905
3835
|
key in deprecatedOptions ? deprecatedExtra(deprecatedOptions[key]) : null,
|
|
3906
|
-
|
|
3836
|
+
type,
|
|
3907
3837
|
key in demandedOptions ? `[${__("required")}]` : null,
|
|
3908
3838
|
options.choices && options.choices[key] ? `[${__("choices:")} ${self.stringifiedValues(options.choices[key])}]` : null,
|
|
3909
3839
|
defaultString(options.default[key], options.defaultDescription[key])
|
|
@@ -4022,8 +3952,8 @@ function usage(yargs, shim3) {
|
|
|
4022
3952
|
emit(self.help());
|
|
4023
3953
|
};
|
|
4024
3954
|
self.functionDescription = (fn) => {
|
|
4025
|
-
const
|
|
4026
|
-
return ["(",
|
|
3955
|
+
const description = fn.name ? shim3.Parser.decamelize(fn.name, "-") : __("generated-value");
|
|
3956
|
+
return ["(", description, ")"].join("");
|
|
4027
3957
|
};
|
|
4028
3958
|
self.stringifiedValues = function stringifiedValues(values, separator) {
|
|
4029
3959
|
let string = "";
|
|
@@ -4379,10 +4309,10 @@ var Completion = class {
|
|
|
4379
4309
|
}
|
|
4380
4310
|
generateCompletionScript($0, cmd) {
|
|
4381
4311
|
let script = this.zshShell ? completionZshTemplate : completionShTemplate;
|
|
4382
|
-
const
|
|
4312
|
+
const name = this.shim.path.basename($0);
|
|
4383
4313
|
if ($0.match(/\.js$/))
|
|
4384
4314
|
$0 = `./${$0}`;
|
|
4385
|
-
script = script.replace(/{{app_name}}/g,
|
|
4315
|
+
script = script.replace(/{{app_name}}/g, name);
|
|
4386
4316
|
script = script.replace(/{{completion_command}}/g, cmd);
|
|
4387
4317
|
return script.replace(/{{app_path}}/g, $0);
|
|
4388
4318
|
}
|
|
@@ -5063,13 +4993,13 @@ var YargsInstance = class {
|
|
|
5063
4993
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").registerFunction(fn);
|
|
5064
4994
|
return this;
|
|
5065
4995
|
}
|
|
5066
|
-
command(cmd,
|
|
5067
|
-
argsert("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]", [cmd,
|
|
5068
|
-
__classPrivateFieldGet(this, _YargsInstance_command, "f").addHandler(cmd,
|
|
4996
|
+
command(cmd, description, builder, handler, middlewares, deprecated) {
|
|
4997
|
+
argsert("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]", [cmd, description, builder, handler, middlewares, deprecated], arguments.length);
|
|
4998
|
+
__classPrivateFieldGet(this, _YargsInstance_command, "f").addHandler(cmd, description, builder, handler, middlewares, deprecated);
|
|
5069
4999
|
return this;
|
|
5070
5000
|
}
|
|
5071
|
-
commands(cmd,
|
|
5072
|
-
return this.command(cmd,
|
|
5001
|
+
commands(cmd, description, builder, handler, middlewares, deprecated) {
|
|
5002
|
+
return this.command(cmd, description, builder, handler, middlewares, deprecated);
|
|
5073
5003
|
}
|
|
5074
5004
|
commandDir(dir, opts) {
|
|
5075
5005
|
argsert("<string> [object]", [dir, opts], arguments.length);
|
|
@@ -5154,10 +5084,10 @@ var YargsInstance = class {
|
|
|
5154
5084
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").deprecatedOptions[option] = message;
|
|
5155
5085
|
return this;
|
|
5156
5086
|
}
|
|
5157
|
-
describe(keys,
|
|
5158
|
-
argsert("<object|string|array> [string]", [keys,
|
|
5087
|
+
describe(keys, description) {
|
|
5088
|
+
argsert("<object|string|array> [string]", [keys, description], arguments.length);
|
|
5159
5089
|
this[kSetKey](keys, true);
|
|
5160
|
-
__classPrivateFieldGet(this, _YargsInstance_usage, "f").describe(keys,
|
|
5090
|
+
__classPrivateFieldGet(this, _YargsInstance_usage, "f").describe(keys, description);
|
|
5161
5091
|
return this;
|
|
5162
5092
|
}
|
|
5163
5093
|
detectLocale(detect) {
|
|
@@ -5181,12 +5111,12 @@ var YargsInstance = class {
|
|
|
5181
5111
|
epilog(msg) {
|
|
5182
5112
|
return this.epilogue(msg);
|
|
5183
5113
|
}
|
|
5184
|
-
example(cmd,
|
|
5185
|
-
argsert("<string|array> [string]", [cmd,
|
|
5114
|
+
example(cmd, description) {
|
|
5115
|
+
argsert("<string|array> [string]", [cmd, description], arguments.length);
|
|
5186
5116
|
if (Array.isArray(cmd)) {
|
|
5187
5117
|
cmd.forEach((exampleParams) => this.example(...exampleParams));
|
|
5188
5118
|
} else {
|
|
5189
|
-
__classPrivateFieldGet(this, _YargsInstance_usage, "f").example(cmd,
|
|
5119
|
+
__classPrivateFieldGet(this, _YargsInstance_usage, "f").example(cmd, description);
|
|
5190
5120
|
}
|
|
5191
5121
|
return this;
|
|
5192
5122
|
}
|
|
@@ -5671,12 +5601,12 @@ var YargsInstance = class {
|
|
|
5671
5601
|
__classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.updateLocale(obj);
|
|
5672
5602
|
return this;
|
|
5673
5603
|
}
|
|
5674
|
-
usage(msg,
|
|
5675
|
-
argsert("<string|null|undefined> [string|boolean] [function|object] [function]", [msg,
|
|
5676
|
-
if (
|
|
5604
|
+
usage(msg, description, builder, handler) {
|
|
5605
|
+
argsert("<string|null|undefined> [string|boolean] [function|object] [function]", [msg, description, builder, handler], arguments.length);
|
|
5606
|
+
if (description !== void 0) {
|
|
5677
5607
|
assertNotStrictEqual(msg, null, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
|
|
5678
5608
|
if ((msg || "").match(/^\$0( |$)/)) {
|
|
5679
|
-
return this.command(msg,
|
|
5609
|
+
return this.command(msg, description, builder, handler);
|
|
5680
5610
|
} else {
|
|
5681
5611
|
throw new YError(".usage() description must start with $0 if being used as alias for .command()");
|
|
5682
5612
|
}
|
|
@@ -5767,9 +5697,9 @@ var YargsInstance = class {
|
|
|
5767
5697
|
});
|
|
5768
5698
|
delete __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions()[optionKey];
|
|
5769
5699
|
}
|
|
5770
|
-
[kEmitWarning](warning,
|
|
5700
|
+
[kEmitWarning](warning, type, deduplicationId) {
|
|
5771
5701
|
if (!__classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId]) {
|
|
5772
|
-
__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.emitWarning(warning,
|
|
5702
|
+
__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.emitWarning(warning, type);
|
|
5773
5703
|
__classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId] = true;
|
|
5774
5704
|
}
|
|
5775
5705
|
}
|
|
@@ -5861,24 +5791,24 @@ var YargsInstance = class {
|
|
|
5861
5791
|
__classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath] = obj || {};
|
|
5862
5792
|
return __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath];
|
|
5863
5793
|
}
|
|
5864
|
-
[kPopulateParserHintArray](
|
|
5794
|
+
[kPopulateParserHintArray](type, keys) {
|
|
5865
5795
|
keys = [].concat(keys);
|
|
5866
5796
|
keys.forEach((key) => {
|
|
5867
5797
|
key = this[kSanitizeKey](key);
|
|
5868
|
-
__classPrivateFieldGet(this, _YargsInstance_options, "f")[
|
|
5798
|
+
__classPrivateFieldGet(this, _YargsInstance_options, "f")[type].push(key);
|
|
5869
5799
|
});
|
|
5870
5800
|
}
|
|
5871
|
-
[kPopulateParserHintSingleValueDictionary](builder,
|
|
5872
|
-
this[kPopulateParserHintDictionary](builder,
|
|
5873
|
-
__classPrivateFieldGet(this, _YargsInstance_options, "f")[
|
|
5801
|
+
[kPopulateParserHintSingleValueDictionary](builder, type, key, value) {
|
|
5802
|
+
this[kPopulateParserHintDictionary](builder, type, key, value, (type2, key2, value2) => {
|
|
5803
|
+
__classPrivateFieldGet(this, _YargsInstance_options, "f")[type2][key2] = value2;
|
|
5874
5804
|
});
|
|
5875
5805
|
}
|
|
5876
|
-
[kPopulateParserHintArrayDictionary](builder,
|
|
5877
|
-
this[kPopulateParserHintDictionary](builder,
|
|
5878
|
-
__classPrivateFieldGet(this, _YargsInstance_options, "f")[
|
|
5806
|
+
[kPopulateParserHintArrayDictionary](builder, type, key, value) {
|
|
5807
|
+
this[kPopulateParserHintDictionary](builder, type, key, value, (type2, key2, value2) => {
|
|
5808
|
+
__classPrivateFieldGet(this, _YargsInstance_options, "f")[type2][key2] = (__classPrivateFieldGet(this, _YargsInstance_options, "f")[type2][key2] || []).concat(value2);
|
|
5879
5809
|
});
|
|
5880
5810
|
}
|
|
5881
|
-
[kPopulateParserHintDictionary](builder,
|
|
5811
|
+
[kPopulateParserHintDictionary](builder, type, key, value, singleKeyHandler) {
|
|
5882
5812
|
if (Array.isArray(key)) {
|
|
5883
5813
|
key.forEach((k) => {
|
|
5884
5814
|
builder(k, value);
|
|
@@ -5888,7 +5818,7 @@ var YargsInstance = class {
|
|
|
5888
5818
|
builder(k, key[k]);
|
|
5889
5819
|
}
|
|
5890
5820
|
} else {
|
|
5891
|
-
singleKeyHandler(
|
|
5821
|
+
singleKeyHandler(type, this[kSanitizeKey](key), value);
|
|
5892
5822
|
}
|
|
5893
5823
|
}
|
|
5894
5824
|
[kSanitizeKey](key) {
|
|
@@ -6412,6 +6342,7 @@ function engineReady(engine) {
|
|
|
6412
6342
|
logger,
|
|
6413
6343
|
secret: args.secret,
|
|
6414
6344
|
noLoop: !args.loop,
|
|
6345
|
+
// TODO need to feed this through properly
|
|
6415
6346
|
backoff: {
|
|
6416
6347
|
min: minBackoff,
|
|
6417
6348
|
max: maxBackoff
|
|
@@ -6461,16 +6392,43 @@ if (args.mock) {
|
|
|
6461
6392
|
engineReady(engine);
|
|
6462
6393
|
});
|
|
6463
6394
|
}
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6395
|
+
/*! Bundled license information:
|
|
6396
|
+
|
|
6397
|
+
yargs-parser/build/lib/string-utils.js:
|
|
6398
|
+
(**
|
|
6399
|
+
* @license
|
|
6400
|
+
* Copyright (c) 2016, Contributors
|
|
6401
|
+
* SPDX-License-Identifier: ISC
|
|
6402
|
+
*)
|
|
6403
|
+
|
|
6404
|
+
yargs-parser/build/lib/tokenize-arg-string.js:
|
|
6405
|
+
(**
|
|
6406
|
+
* @license
|
|
6407
|
+
* Copyright (c) 2016, Contributors
|
|
6408
|
+
* SPDX-License-Identifier: ISC
|
|
6409
|
+
*)
|
|
6410
|
+
|
|
6411
|
+
yargs-parser/build/lib/yargs-parser-types.js:
|
|
6412
|
+
(**
|
|
6413
|
+
* @license
|
|
6414
|
+
* Copyright (c) 2016, Contributors
|
|
6415
|
+
* SPDX-License-Identifier: ISC
|
|
6416
|
+
*)
|
|
6417
|
+
|
|
6418
|
+
yargs-parser/build/lib/yargs-parser.js:
|
|
6419
|
+
(**
|
|
6420
|
+
* @license
|
|
6421
|
+
* Copyright (c) 2016, Contributors
|
|
6422
|
+
* SPDX-License-Identifier: ISC
|
|
6423
|
+
*)
|
|
6424
|
+
|
|
6425
|
+
yargs-parser/build/lib/index.js:
|
|
6426
|
+
(**
|
|
6427
|
+
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
6428
|
+
* CJS and ESM environments.
|
|
6429
|
+
*
|
|
6430
|
+
* @license
|
|
6431
|
+
* Copyright (c) 2016, Contributors
|
|
6432
|
+
* SPDX-License-Identifier: ISC
|
|
6433
|
+
*)
|
|
6434
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/ws-worker",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.9",
|
|
4
4
|
"description": "A Websocket Worker to connect Lightning to a Runtime Engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"koa-logger": "^3.2.1",
|
|
23
23
|
"phoenix": "1.7.10",
|
|
24
24
|
"ws": "^8.18.0",
|
|
25
|
-
"@openfn/engine-multi": "1.4.
|
|
25
|
+
"@openfn/engine-multi": "1.4.6",
|
|
26
26
|
"@openfn/lexicon": "^1.1.0",
|
|
27
|
-
"@openfn/logger": "1.0.
|
|
28
|
-
"@openfn/runtime": "1.5.
|
|
27
|
+
"@openfn/logger": "1.0.3",
|
|
28
|
+
"@openfn/runtime": "1.5.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/koa": "^2.13.5",
|
|
@@ -37,12 +37,11 @@
|
|
|
37
37
|
"@types/yargs": "^17.0.12",
|
|
38
38
|
"ava": "5.1.0",
|
|
39
39
|
"nodemon": "3.0.1",
|
|
40
|
-
"ts-node": "^10.9.1",
|
|
41
40
|
"tslib": "^2.4.0",
|
|
42
41
|
"tsup": "^6.2.3",
|
|
43
42
|
"typescript": "^4.6.4",
|
|
44
43
|
"yargs": "^17.6.2",
|
|
45
|
-
"@openfn/lightning-mock": "2.0.
|
|
44
|
+
"@openfn/lightning-mock": "2.0.27"
|
|
46
45
|
},
|
|
47
46
|
"files": [
|
|
48
47
|
"dist",
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
"test:types": "pnpm tsc --noEmit --project tsconfig.json",
|
|
55
54
|
"build": "tsup --config tsup.config.js",
|
|
56
55
|
"build:watch": "pnpm build --watch",
|
|
57
|
-
"start": "
|
|
56
|
+
"start": "node --loader @swc-node/register/esm src/start.ts",
|
|
58
57
|
"start:prod": "node dist/start.js",
|
|
59
58
|
"start:watch": "nodemon -e ts,js --watch ../runtime-manager/dist --watch ./src --exec 'pnpm start'",
|
|
60
59
|
"pack": "pnpm pack --pack-destination ../../dist"
|