@openfn/cli 0.0.23 → 0.0.24
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/index.js +6 -4
- package/dist/process/runner.js +24 -6
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -8,8 +8,7 @@ import process2 from "node:process";
|
|
|
8
8
|
function spawn_default(basePath, opts2) {
|
|
9
9
|
const execArgv = [
|
|
10
10
|
"--no-warnings",
|
|
11
|
-
"--experimental-vm-modules"
|
|
12
|
-
"--experimental-specifier-resolution=node"
|
|
11
|
+
"--experimental-vm-modules"
|
|
13
12
|
];
|
|
14
13
|
const dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
15
14
|
const child = fork(`${dirname}/process/runner.js`, [], { execArgv });
|
|
@@ -106,6 +105,9 @@ var executeCommand = {
|
|
|
106
105
|
}).option("state-stdin", {
|
|
107
106
|
alias: "S",
|
|
108
107
|
description: "Read state from stdin (instead of a file)"
|
|
108
|
+
}).option("timeout", {
|
|
109
|
+
alias: "-t",
|
|
110
|
+
description: "Set the timeout duration in MS"
|
|
109
111
|
}).option("no-compile", {
|
|
110
112
|
boolean: true,
|
|
111
113
|
description: "Skip compilation"
|
|
@@ -179,7 +181,7 @@ var command_default3 = {
|
|
|
179
181
|
// src/docgen/command.ts
|
|
180
182
|
var docgenCommand = {
|
|
181
183
|
command: "docgen <specifier>",
|
|
182
|
-
desc:
|
|
184
|
+
desc: false,
|
|
183
185
|
handler: (argv) => {
|
|
184
186
|
argv.command = "docgen";
|
|
185
187
|
},
|
|
@@ -191,7 +193,7 @@ var command_default4 = docgenCommand;
|
|
|
191
193
|
|
|
192
194
|
// src/docs/command.ts
|
|
193
195
|
var command_default5 = {
|
|
194
|
-
command: "docs
|
|
196
|
+
command: "docs <adaptor> [operation]",
|
|
195
197
|
desc: "Print help for an adaptor function. You can use short-hand for adaptor names (ie, common instead of @openfn/language-common)",
|
|
196
198
|
handler: (argv) => {
|
|
197
199
|
argv.command = "docs";
|
package/dist/process/runner.js
CHANGED
|
@@ -86,6 +86,7 @@ function ensureOpts(basePath = ".", opts) {
|
|
|
86
86
|
operation: opts.operation,
|
|
87
87
|
packages: opts.packages,
|
|
88
88
|
stateStdin: opts.stateStdin,
|
|
89
|
+
timeout: opts.timeout,
|
|
89
90
|
specifier: opts.specifier,
|
|
90
91
|
strictOutput: opts.strictOutput ?? true,
|
|
91
92
|
immutable: opts.immutable || false
|
|
@@ -149,6 +150,7 @@ var load_state_default = async (opts, log) => {
|
|
|
149
150
|
import run, { getNameAndVersion } from "@openfn/runtime";
|
|
150
151
|
var execute_default = (code, state, opts) => {
|
|
151
152
|
return run(code, state, {
|
|
153
|
+
timeout: opts.timeout,
|
|
152
154
|
immutableState: opts.immutable,
|
|
153
155
|
logger: logger_default(RUNTIME, opts),
|
|
154
156
|
jobLogger: logger_default(JOB, opts),
|
|
@@ -532,13 +534,19 @@ var handler_default4 = docgenHandler;
|
|
|
532
534
|
// src/docs/handler.ts
|
|
533
535
|
import { readFile } from "node:fs/promises";
|
|
534
536
|
import { getNameAndVersion as getNameAndVersion3, getLatestVersion } from "@openfn/runtime";
|
|
535
|
-
var
|
|
537
|
+
var describeFn = (adaptorName, fn) => `## ${fn.name}(${fn.parameters.map(({ name }) => name).join(",")})
|
|
536
538
|
|
|
537
539
|
${fn.description}
|
|
538
540
|
|
|
539
541
|
### Usage Examples
|
|
540
542
|
|
|
541
|
-
${fn.examples.length ? fn.examples.map((
|
|
543
|
+
${fn.examples.length ? fn.examples.map(({ code, caption }) => {
|
|
544
|
+
if (caption) {
|
|
545
|
+
return `${caption}:
|
|
546
|
+
${code}`;
|
|
547
|
+
}
|
|
548
|
+
return code;
|
|
549
|
+
}).join("\n\n") : "None"}
|
|
542
550
|
|
|
543
551
|
### API Reference
|
|
544
552
|
|
|
@@ -547,6 +555,10 @@ https://docs.openfn.org/adaptors/packages/${adaptorName.replace(
|
|
|
547
555
|
""
|
|
548
556
|
)}-docs#${fn.name}
|
|
549
557
|
`;
|
|
558
|
+
var describeLib = (adaptorName, data) => `## ${adaptorName} ${data.version}
|
|
559
|
+
|
|
560
|
+
${data.functions.map((fn) => ` ${fn.name}(${fn.parameters.map((p) => p.name).join(", ")})`).sort().join("\n")}
|
|
561
|
+
`;
|
|
550
562
|
var docsHandler = async (options, logger) => {
|
|
551
563
|
const { adaptor, operation, repoDir } = options;
|
|
552
564
|
const [adaptorName] = expand_adaptors_default([adaptor], logger);
|
|
@@ -568,11 +580,17 @@ var docsHandler = async (options, logger) => {
|
|
|
568
580
|
if (path3) {
|
|
569
581
|
const source = await readFile(path3, "utf8");
|
|
570
582
|
const data = JSON.parse(source);
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
583
|
+
let desc;
|
|
584
|
+
if (operation) {
|
|
585
|
+
const fn = data.functions.find(({ name: name2 }) => name2 === operation);
|
|
586
|
+
logger.debug("Operation schema:", fn);
|
|
587
|
+
logger.success(`Documentation for ${name}.${operation} v${version}:
|
|
574
588
|
`);
|
|
575
|
-
|
|
589
|
+
desc = describeFn(name, fn);
|
|
590
|
+
} else {
|
|
591
|
+
logger.debug("No operation provided, listing available operations");
|
|
592
|
+
desc = describeLib(name, data);
|
|
593
|
+
}
|
|
576
594
|
logger.print(desc);
|
|
577
595
|
logger.success("Done!");
|
|
578
596
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "CLI devtools for the openfn toolchain.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"typescript": "^4.7.4"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@openfn/compiler": "0.0.
|
|
40
|
-
"@openfn/describe-package": "0.0.
|
|
39
|
+
"@openfn/compiler": "0.0.22",
|
|
40
|
+
"@openfn/describe-package": "0.0.14",
|
|
41
41
|
"@openfn/logger": "0.0.8",
|
|
42
|
-
"@openfn/runtime": "0.0.
|
|
42
|
+
"@openfn/runtime": "0.0.14",
|
|
43
43
|
"fast-safe-stringify": "^2.1.1",
|
|
44
44
|
"figures": "^5.0.0",
|
|
45
45
|
"rimraf": "^3.0.2",
|