@openfn/cli 1.26.0 → 1.27.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/dist/index.js +24 -6
- package/dist/process/runner.js +113 -72
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -51,15 +51,15 @@ import nodePath from "node:path";
|
|
|
51
51
|
var DEFAULT_REPO_DIR = "/tmp/openfn/repo";
|
|
52
52
|
|
|
53
53
|
// src/util/expand-adaptors.ts
|
|
54
|
-
var expand2 = (
|
|
55
|
-
if (typeof
|
|
56
|
-
const [left] =
|
|
54
|
+
var expand2 = (name2) => {
|
|
55
|
+
if (typeof name2 === "string") {
|
|
56
|
+
const [left] = name2.split("=");
|
|
57
57
|
if (left.match("/") || left.endsWith(".js")) {
|
|
58
|
-
return
|
|
58
|
+
return name2;
|
|
59
59
|
}
|
|
60
|
-
return `@openfn/language-${
|
|
60
|
+
return `@openfn/language-${name2}`;
|
|
61
61
|
}
|
|
62
|
-
return
|
|
62
|
+
return name2;
|
|
63
63
|
};
|
|
64
64
|
var expand_adaptors_default = (input) => {
|
|
65
65
|
if (Array.isArray(input)) {
|
|
@@ -982,6 +982,21 @@ var workspace = {
|
|
|
982
982
|
}
|
|
983
983
|
}
|
|
984
984
|
};
|
|
985
|
+
var newProject = {
|
|
986
|
+
name: "new",
|
|
987
|
+
yargs: {
|
|
988
|
+
description: "Create a new project when deploying",
|
|
989
|
+
default: false,
|
|
990
|
+
boolean: true
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
var name = {
|
|
994
|
+
name: "name",
|
|
995
|
+
yargs: {
|
|
996
|
+
type: "string",
|
|
997
|
+
description: "When deploying a new project, set the name"
|
|
998
|
+
}
|
|
999
|
+
};
|
|
985
1000
|
|
|
986
1001
|
// src/deploy/command.ts
|
|
987
1002
|
var options3 = [
|
|
@@ -1364,6 +1379,9 @@ var options15 = [
|
|
|
1364
1379
|
env2,
|
|
1365
1380
|
workspace,
|
|
1366
1381
|
dryRun2,
|
|
1382
|
+
newProject,
|
|
1383
|
+
name,
|
|
1384
|
+
alias,
|
|
1367
1385
|
apiKey,
|
|
1368
1386
|
endpoint,
|
|
1369
1387
|
log,
|
package/dist/process/runner.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __export = (target, all) => {
|
|
3
|
-
for (var
|
|
4
|
-
__defProp(target,
|
|
3
|
+
for (var name2 in all)
|
|
4
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// src/apollo/handler.ts
|
|
@@ -169,14 +169,14 @@ var namespaces = {
|
|
|
169
169
|
[COMPILER]: "CMP",
|
|
170
170
|
[JOB]: "JOB"
|
|
171
171
|
};
|
|
172
|
-
var createLogger2 = (
|
|
172
|
+
var createLogger2 = (name2 = "", options8) => {
|
|
173
173
|
const logOptions = options8.log || {};
|
|
174
174
|
let json = false;
|
|
175
|
-
let level = logOptions[
|
|
175
|
+
let level = logOptions[name2] || logOptions.default || "default";
|
|
176
176
|
if (options8.logJson) {
|
|
177
177
|
json = true;
|
|
178
178
|
}
|
|
179
|
-
return actualCreateLogger(namespaces[
|
|
179
|
+
return actualCreateLogger(namespaces[name2] || name2, {
|
|
180
180
|
level,
|
|
181
181
|
json,
|
|
182
182
|
sanitize: options8.sanitize || "none",
|
|
@@ -277,9 +277,9 @@ var execute_default = async (plan, input, opts, logger) => {
|
|
|
277
277
|
function parseAdaptors(plan) {
|
|
278
278
|
const extractInfo = (specifier) => {
|
|
279
279
|
const [module, path18] = specifier.split("=");
|
|
280
|
-
const { name, version } = getNameAndVersion(module);
|
|
280
|
+
const { name: name2, version } = getNameAndVersion(module);
|
|
281
281
|
const info = {
|
|
282
|
-
name
|
|
282
|
+
name: name2
|
|
283
283
|
};
|
|
284
284
|
if (path18) {
|
|
285
285
|
info.path = path18;
|
|
@@ -293,8 +293,8 @@ function parseAdaptors(plan) {
|
|
|
293
293
|
Object.values(plan.workflow.steps).forEach((step) => {
|
|
294
294
|
const job = step;
|
|
295
295
|
job.adaptors?.forEach((adaptor) => {
|
|
296
|
-
const { name, ...maybeVersionAndPath } = extractInfo(adaptor);
|
|
297
|
-
adaptors[
|
|
296
|
+
const { name: name2, ...maybeVersionAndPath } = extractInfo(adaptor);
|
|
297
|
+
adaptors[name2] = maybeVersionAndPath;
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
300
|
return adaptors;
|
|
@@ -410,12 +410,12 @@ var install = async (opts, log2 = defaultLogger) => {
|
|
|
410
410
|
return [];
|
|
411
411
|
};
|
|
412
412
|
var removePackage = async (packageSpecifier, repoDir, logger) => {
|
|
413
|
-
const { name, version } = getNameAndVersion2(packageSpecifier);
|
|
413
|
+
const { name: name2, version } = getNameAndVersion2(packageSpecifier);
|
|
414
414
|
if (!version) {
|
|
415
415
|
logger.warn(`Cannot remove ${packageSpecifier}: no version specified`);
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
const aliasedName = `${
|
|
418
|
+
const aliasedName = `${name2}_${version}`;
|
|
419
419
|
logger.info(`Removing package ${aliasedName} from repo...`);
|
|
420
420
|
try {
|
|
421
421
|
await new Promise((resolve, reject) => {
|
|
@@ -461,11 +461,11 @@ var getDependencyList = async (options8, _logger) => {
|
|
|
461
461
|
const result = {};
|
|
462
462
|
if (pkg) {
|
|
463
463
|
Object.keys(pkg.dependencies).forEach((key) => {
|
|
464
|
-
const [
|
|
465
|
-
if (!result[
|
|
466
|
-
result[
|
|
464
|
+
const [name2, version] = key.split("_");
|
|
465
|
+
if (!result[name2]) {
|
|
466
|
+
result[name2] = [];
|
|
467
467
|
}
|
|
468
|
-
result[
|
|
468
|
+
result[name2].push(version);
|
|
469
469
|
});
|
|
470
470
|
}
|
|
471
471
|
return result;
|
|
@@ -765,15 +765,15 @@ import { isPath } from "@openfn/compiler";
|
|
|
765
765
|
import { Workspace, yamlToJson } from "@openfn/project";
|
|
766
766
|
|
|
767
767
|
// src/util/expand-adaptors.ts
|
|
768
|
-
var expand = (
|
|
769
|
-
if (typeof
|
|
770
|
-
const [left] =
|
|
768
|
+
var expand = (name2) => {
|
|
769
|
+
if (typeof name2 === "string") {
|
|
770
|
+
const [left] = name2.split("=");
|
|
771
771
|
if (left.match("/") || left.endsWith(".js")) {
|
|
772
|
-
return
|
|
772
|
+
return name2;
|
|
773
773
|
}
|
|
774
|
-
return `@openfn/language-${
|
|
774
|
+
return `@openfn/language-${name2}`;
|
|
775
775
|
}
|
|
776
|
-
return
|
|
776
|
+
return name2;
|
|
777
777
|
};
|
|
778
778
|
var expand_adaptors_default = (input) => {
|
|
779
779
|
if (Array.isArray(input)) {
|
|
@@ -808,16 +808,16 @@ var updatePath = (adaptor, repoPath, log2) => {
|
|
|
808
808
|
if (adaptor.match("=")) {
|
|
809
809
|
return adaptor;
|
|
810
810
|
}
|
|
811
|
-
const { name, version } = getNameAndVersion3(adaptor);
|
|
811
|
+
const { name: name2, version } = getNameAndVersion3(adaptor);
|
|
812
812
|
if (version) {
|
|
813
813
|
log2.warn(
|
|
814
814
|
`Warning: Ignoring version specifier on ${adaptor} as loading from the adaptors monorepo`
|
|
815
815
|
);
|
|
816
816
|
}
|
|
817
|
-
const shortName =
|
|
817
|
+
const shortName = name2.replace("@openfn/language-", "");
|
|
818
818
|
const abspath = path3.resolve(repoPath, "packages", shortName);
|
|
819
|
-
log2.info(`Mapped adaptor ${
|
|
820
|
-
return `${
|
|
819
|
+
log2.info(`Mapped adaptor ${name2} to monorepo: ${abspath}`);
|
|
820
|
+
return `${name2}=${abspath}`;
|
|
821
821
|
};
|
|
822
822
|
var mapAdaptorsToMonorepo = (monorepoPath = "", input = [], log2) => {
|
|
823
823
|
if (monorepoPath) {
|
|
@@ -858,10 +858,10 @@ var loadPlan = async (options8, logger) => {
|
|
|
858
858
|
);
|
|
859
859
|
const workspace2 = new Workspace(options8.workspace);
|
|
860
860
|
const proj = await workspace2.getCheckedOutProject();
|
|
861
|
-
const
|
|
862
|
-
const workflow2 = proj?.getWorkflow(
|
|
861
|
+
const name2 = workflowName || options8.workflow;
|
|
862
|
+
const workflow2 = proj?.getWorkflow(name2);
|
|
863
863
|
if (!workflow2) {
|
|
864
|
-
const e = new Error(`Could not find Workflow "${
|
|
864
|
+
const e = new Error(`Could not find Workflow "${name2}"`);
|
|
865
865
|
delete e.stack;
|
|
866
866
|
throw e;
|
|
867
867
|
}
|
|
@@ -870,7 +870,7 @@ var loadPlan = async (options8, logger) => {
|
|
|
870
870
|
};
|
|
871
871
|
options8.credentials ??= workspace2.getConfig().credentials;
|
|
872
872
|
options8.collectionsEndpoint ??= proj.openfn?.endpoint;
|
|
873
|
-
options8.cachePath ??= workspace2.workflowsPath + `/${
|
|
873
|
+
options8.cachePath ??= workspace2.workflowsPath + `/${name2}/${CACHE_DIR}`;
|
|
874
874
|
}
|
|
875
875
|
if (options8.path && /ya?ml$/.test(options8.path)) {
|
|
876
876
|
const content = await fs3.readFile(path4.resolve(options8.path), "utf-8");
|
|
@@ -945,7 +945,7 @@ var loadExpression = async (options8, logger) => {
|
|
|
945
945
|
logger.debug(`Loading expression from ${expressionPath}`);
|
|
946
946
|
try {
|
|
947
947
|
const expression = await fs3.readFile(expressionPath, "utf8");
|
|
948
|
-
const
|
|
948
|
+
const name2 = path4.parse(expressionPath).name;
|
|
949
949
|
const step = {
|
|
950
950
|
expression,
|
|
951
951
|
// The adaptor should have been expanded nicely already, so we don't need intervene here
|
|
@@ -955,7 +955,7 @@ var loadExpression = async (options8, logger) => {
|
|
|
955
955
|
maybeAssign(options8, wfOptions, ["timeout"]);
|
|
956
956
|
const plan = {
|
|
957
957
|
workflow: {
|
|
958
|
-
name,
|
|
958
|
+
name: name2,
|
|
959
959
|
steps: [step],
|
|
960
960
|
globals: options8.globals
|
|
961
961
|
},
|
|
@@ -990,7 +990,7 @@ var loadOldWorkflow = async (workflow2, options8, logger, defaultName = "") => {
|
|
|
990
990
|
return final;
|
|
991
991
|
};
|
|
992
992
|
var fetchFile = async (fileInfo, log2) => {
|
|
993
|
-
const { rootDir = "", filePath, name } = fileInfo;
|
|
993
|
+
const { rootDir = "", filePath, name: name2 } = fileInfo;
|
|
994
994
|
try {
|
|
995
995
|
const fullPath = resolve_path_default(filePath, rootDir);
|
|
996
996
|
const result = await fs3.readFile(fullPath, "utf8");
|
|
@@ -999,7 +999,7 @@ var fetchFile = async (fileInfo, log2) => {
|
|
|
999
999
|
} catch (e) {
|
|
1000
1000
|
abort_default(
|
|
1001
1001
|
log2,
|
|
1002
|
-
`File not found for ${
|
|
1002
|
+
`File not found for ${name2}: ${filePath}`,
|
|
1003
1003
|
void 0,
|
|
1004
1004
|
`This workflow references a file which cannot be found at ${filePath}
|
|
1005
1005
|
|
|
@@ -2038,6 +2038,21 @@ var workspace = {
|
|
|
2038
2038
|
}
|
|
2039
2039
|
}
|
|
2040
2040
|
};
|
|
2041
|
+
var newProject = {
|
|
2042
|
+
name: "new",
|
|
2043
|
+
yargs: {
|
|
2044
|
+
description: "Create a new project when deploying",
|
|
2045
|
+
default: false,
|
|
2046
|
+
boolean: true
|
|
2047
|
+
}
|
|
2048
|
+
};
|
|
2049
|
+
var name = {
|
|
2050
|
+
name: "name",
|
|
2051
|
+
yargs: {
|
|
2052
|
+
type: "string",
|
|
2053
|
+
description: "When deploying a new project, set the name"
|
|
2054
|
+
}
|
|
2055
|
+
};
|
|
2041
2056
|
|
|
2042
2057
|
// src/projects/util.ts
|
|
2043
2058
|
import path9 from "node:path";
|
|
@@ -2057,7 +2072,7 @@ var loadAppAuthConfig = (options8, logger) => {
|
|
|
2057
2072
|
const { OPENFN_API_KEY, OPENFN_ENDPOINT } = process.env;
|
|
2058
2073
|
const config2 = {
|
|
2059
2074
|
apiKey: options8.apiKey,
|
|
2060
|
-
endpoint: options8.endpoint
|
|
2075
|
+
endpoint: options8.endpoint ?? "https://app.openfn.org"
|
|
2061
2076
|
};
|
|
2062
2077
|
if (!options8.apiKey && OPENFN_API_KEY) {
|
|
2063
2078
|
logger.info("Using OPENFN_API_KEY environment variable");
|
|
@@ -2067,6 +2082,11 @@ var loadAppAuthConfig = (options8, logger) => {
|
|
|
2067
2082
|
logger.info("Using OPENFN_ENDPOINT environment variable");
|
|
2068
2083
|
config2.endpoint = OPENFN_ENDPOINT;
|
|
2069
2084
|
}
|
|
2085
|
+
if (!config2.apiKey) {
|
|
2086
|
+
throw new CLIError(
|
|
2087
|
+
"OPENFN_API_KEY is required. Set it in .env, pass --api-key, or set the environment variable."
|
|
2088
|
+
);
|
|
2089
|
+
}
|
|
2070
2090
|
return config2;
|
|
2071
2091
|
};
|
|
2072
2092
|
var ensureExt = (filePath, ext) => {
|
|
@@ -2101,6 +2121,11 @@ var serialize = async (project, outputPath2, formatOverride, dryRun2 = false) =>
|
|
|
2101
2121
|
return finalPath;
|
|
2102
2122
|
};
|
|
2103
2123
|
var getLightningUrl = (endpoint2, path18 = "", snapshots2) => {
|
|
2124
|
+
if (!endpoint2) {
|
|
2125
|
+
throw new CLIError(
|
|
2126
|
+
"OPENFN_ENDPOINT is required. Set it in .env, pass --endpoint, or set the environment variable.\nExample: OPENFN_ENDPOINT=https://app.openfn.org"
|
|
2127
|
+
);
|
|
2128
|
+
}
|
|
2104
2129
|
const params = new URLSearchParams();
|
|
2105
2130
|
snapshots2?.forEach((snapshot) => params.append("snapshots[]", snapshot));
|
|
2106
2131
|
return new URL(`/api/provision/${path18}?${params.toString()}`, endpoint2);
|
|
@@ -2283,6 +2308,9 @@ var options = [
|
|
|
2283
2308
|
env,
|
|
2284
2309
|
workspace,
|
|
2285
2310
|
dryRun,
|
|
2311
|
+
newProject,
|
|
2312
|
+
name,
|
|
2313
|
+
alias,
|
|
2286
2314
|
apiKey,
|
|
2287
2315
|
endpoint,
|
|
2288
2316
|
log,
|
|
@@ -2321,19 +2349,8 @@ var hasRemoteDiverged = (local, remote, workflows = []) => {
|
|
|
2321
2349
|
}
|
|
2322
2350
|
return diverged;
|
|
2323
2351
|
};
|
|
2324
|
-
async
|
|
2325
|
-
logger.warn(
|
|
2326
|
-
"WARNING: the project deploy command is in BETA and may not be stable. Use cautiously on production projects."
|
|
2327
|
-
);
|
|
2328
|
-
const config2 = loadAppAuthConfig(options8, logger);
|
|
2352
|
+
var syncProjects = async (options8, config2, ws, localProject, logger) => {
|
|
2329
2353
|
logger.info("Attempting to load checked-out project from workspace");
|
|
2330
|
-
const ws = new Workspace3(options8.workspace || ".");
|
|
2331
|
-
const { alias: alias2 } = ws.getActiveProject();
|
|
2332
|
-
const localProject = await Project.from("fs", {
|
|
2333
|
-
root: options8.workspace || ".",
|
|
2334
|
-
alias: alias2
|
|
2335
|
-
});
|
|
2336
|
-
logger.success(`Loaded local project ${printProjectName(localProject)}`);
|
|
2337
2354
|
let remoteProject;
|
|
2338
2355
|
try {
|
|
2339
2356
|
const { data } = await fetchProject(
|
|
@@ -2356,7 +2373,7 @@ async function handler(options8, logger) {
|
|
|
2356
2373
|
Your local project (${localProject.uuid}) has a different UUID to the remote project (${remoteProject.uuid}).
|
|
2357
2374
|
|
|
2358
2375
|
Pass --force to override this error and deploy anyway.`);
|
|
2359
|
-
|
|
2376
|
+
process.exit(1);
|
|
2360
2377
|
}
|
|
2361
2378
|
const locallyChangedWorkflows = await findLocallyChangedWorkflows(
|
|
2362
2379
|
ws,
|
|
@@ -2370,7 +2387,7 @@ Pass --force to override this error and deploy anyway.`);
|
|
|
2370
2387
|
);
|
|
2371
2388
|
if (!diffs.length) {
|
|
2372
2389
|
logger.success("Nothing to deploy");
|
|
2373
|
-
|
|
2390
|
+
process.exit(0);
|
|
2374
2391
|
}
|
|
2375
2392
|
const skipVersionTest = remoteProject.workflows.find(
|
|
2376
2393
|
(wf) => wf.history.length === 0
|
|
@@ -2396,7 +2413,7 @@ Pass --force to override this error and deploy anyway.`);
|
|
|
2396
2413
|
The remote project has been edited since the local project was branched. Changes may be lost.
|
|
2397
2414
|
|
|
2398
2415
|
Pass --force to override this error and deploy anyway.`);
|
|
2399
|
-
|
|
2416
|
+
process.exit(1);
|
|
2400
2417
|
} else {
|
|
2401
2418
|
logger.warn(
|
|
2402
2419
|
"Remote project has diverged from local project! Pushing anyway as -f passed"
|
|
@@ -2414,11 +2431,34 @@ Pass --force to override this error and deploy anyway.`);
|
|
|
2414
2431
|
force: true,
|
|
2415
2432
|
onlyUpdated: true
|
|
2416
2433
|
});
|
|
2434
|
+
return merged;
|
|
2435
|
+
};
|
|
2436
|
+
async function handler(options8, logger) {
|
|
2437
|
+
logger.warn(
|
|
2438
|
+
"WARNING: the project deploy command is in BETA and may not be stable. Use cautiously on production projects."
|
|
2439
|
+
);
|
|
2440
|
+
const config2 = loadAppAuthConfig(options8, logger);
|
|
2441
|
+
const ws = new Workspace3(options8.workspace || ".");
|
|
2442
|
+
const active = ws.getActiveProject();
|
|
2443
|
+
const alias2 = options8.alias ?? active?.alias;
|
|
2444
|
+
const localProject = await Project.from("fs", {
|
|
2445
|
+
root: options8.workspace || ".",
|
|
2446
|
+
alias: alias2,
|
|
2447
|
+
name: options8.name
|
|
2448
|
+
});
|
|
2449
|
+
if (options8.new) {
|
|
2450
|
+
localProject.openfn = {
|
|
2451
|
+
endpoint: config2.endpoint
|
|
2452
|
+
};
|
|
2453
|
+
}
|
|
2454
|
+
logger.success(`Loaded local project ${printProjectName(localProject)}`);
|
|
2455
|
+
const merged = options8.new ? localProject : await syncProjects(options8, config2, ws, localProject, logger);
|
|
2417
2456
|
const state = merged.serialize("state", {
|
|
2418
2457
|
format: "json"
|
|
2419
2458
|
});
|
|
2420
|
-
logger.debug("
|
|
2459
|
+
logger.debug("Provisioner state ready to upload:");
|
|
2421
2460
|
logger.debug(JSON.stringify(state, null, 2));
|
|
2461
|
+
logger.debug();
|
|
2422
2462
|
config2.endpoint ??= localProject.openfn?.endpoint;
|
|
2423
2463
|
if (options8.dryRun) {
|
|
2424
2464
|
logger.always("dryRun option set: skipping upload step");
|
|
@@ -2442,7 +2482,8 @@ Pass --force to override this error and deploy anyway.`);
|
|
|
2442
2482
|
"state",
|
|
2443
2483
|
result,
|
|
2444
2484
|
{
|
|
2445
|
-
endpoint: config2.endpoint
|
|
2485
|
+
endpoint: config2.endpoint,
|
|
2486
|
+
alias: alias2
|
|
2446
2487
|
},
|
|
2447
2488
|
merged.config
|
|
2448
2489
|
);
|
|
@@ -2646,7 +2687,7 @@ import c3 from "chalk";
|
|
|
2646
2687
|
import { getNameAndVersion as getNameAndVersion5, getLatestVersion } from "@openfn/runtime";
|
|
2647
2688
|
var describeFn = (adaptorName, fn) => [
|
|
2648
2689
|
c3.green(
|
|
2649
|
-
`## ${fn.name}(${fn.parameters.map(({ name }) =>
|
|
2690
|
+
`## ${fn.name}(${fn.parameters.map(({ name: name2 }) => name2).join(",")})`
|
|
2650
2691
|
),
|
|
2651
2692
|
`${fn.description}`,
|
|
2652
2693
|
c3.green("### Usage Examples"),
|
|
@@ -2674,17 +2715,17 @@ var docsHandler = async (options8, logger) => {
|
|
|
2674
2715
|
const { adaptor, operation, repoDir } = options8;
|
|
2675
2716
|
const adaptors = expand_adaptors_default([adaptor]);
|
|
2676
2717
|
const [adaptorName] = adaptors;
|
|
2677
|
-
let { name, version } = getNameAndVersion5(adaptorName);
|
|
2718
|
+
let { name: name2, version } = getNameAndVersion5(adaptorName);
|
|
2678
2719
|
if (!version) {
|
|
2679
2720
|
logger.info("No version number provided, looking for latest...");
|
|
2680
|
-
version = await getLatestVersion(
|
|
2721
|
+
version = await getLatestVersion(name2);
|
|
2681
2722
|
logger.info("Found ", version);
|
|
2682
2723
|
logger.success(`Showing docs for ${adaptorName} v${version}`);
|
|
2683
2724
|
}
|
|
2684
2725
|
logger.info("Generating/loading documentation...");
|
|
2685
2726
|
const path18 = await handler_default7(
|
|
2686
2727
|
{
|
|
2687
|
-
specifier: `${
|
|
2728
|
+
specifier: `${name2}@${version}`,
|
|
2688
2729
|
repoDir
|
|
2689
2730
|
},
|
|
2690
2731
|
// TODO I'm not sure how to handle logging here - we ought to feedback SOMETHING though
|
|
@@ -2696,24 +2737,24 @@ var docsHandler = async (options8, logger) => {
|
|
|
2696
2737
|
const data = JSON.parse(source);
|
|
2697
2738
|
let desc;
|
|
2698
2739
|
if (operation) {
|
|
2699
|
-
const fn = data.functions.find(({ name:
|
|
2740
|
+
const fn = data.functions.find(({ name: name3 }) => name3 === operation);
|
|
2700
2741
|
if (fn) {
|
|
2701
2742
|
logger.debug("Operation schema:", fn);
|
|
2702
2743
|
logger.break();
|
|
2703
|
-
desc = describeFn(
|
|
2744
|
+
desc = describeFn(name2, fn);
|
|
2704
2745
|
} else {
|
|
2705
|
-
logger.error(`Failed to find ${operation} in ${
|
|
2746
|
+
logger.error(`Failed to find ${operation} in ${name2}`);
|
|
2706
2747
|
}
|
|
2707
2748
|
} else {
|
|
2708
2749
|
logger.debug("No operation name provided");
|
|
2709
2750
|
logger.always("Available functions:\n");
|
|
2710
|
-
desc = describeLib(
|
|
2751
|
+
desc = describeLib(name2, data);
|
|
2711
2752
|
}
|
|
2712
2753
|
logger.print(desc);
|
|
2713
2754
|
if (!operation) {
|
|
2714
2755
|
logger.always(`For more details on a specfic functions, use:
|
|
2715
2756
|
|
|
2716
|
-
openfn docs ${
|
|
2757
|
+
openfn docs ${name2} <fn>
|
|
2717
2758
|
`);
|
|
2718
2759
|
}
|
|
2719
2760
|
if (didError) {
|
|
@@ -2803,14 +2844,14 @@ var compareVersions = (version1, version2) => {
|
|
|
2803
2844
|
return v1.patch - v2.patch;
|
|
2804
2845
|
};
|
|
2805
2846
|
var isAdaptorUnsupported = async (adaptorSpecifier, repoDir) => {
|
|
2806
|
-
const { name, version } = getNameAndVersion6(adaptorSpecifier);
|
|
2847
|
+
const { name: name2, version } = getNameAndVersion6(adaptorSpecifier);
|
|
2807
2848
|
if (!version)
|
|
2808
2849
|
return false;
|
|
2809
2850
|
const cache = await getUnsupportedCache(repoDir);
|
|
2810
|
-
if (!cache || !cache[
|
|
2851
|
+
if (!cache || !cache[name2]) {
|
|
2811
2852
|
return false;
|
|
2812
2853
|
}
|
|
2813
|
-
const cached = cache[
|
|
2854
|
+
const cached = cache[name2];
|
|
2814
2855
|
const currentParsed = parseVersion(version);
|
|
2815
2856
|
const cachedParsed = parseVersion(cached.lastCheckedVersion);
|
|
2816
2857
|
if (currentParsed.major > cachedParsed.major || currentParsed.major === cachedParsed.major && currentParsed.minor > cachedParsed.minor) {
|
|
@@ -2819,7 +2860,7 @@ var isAdaptorUnsupported = async (adaptorSpecifier, repoDir) => {
|
|
|
2819
2860
|
return true;
|
|
2820
2861
|
};
|
|
2821
2862
|
var markAdaptorAsUnsupported = async (adaptorSpecifier, repoDir) => {
|
|
2822
|
-
const { name, version } = getNameAndVersion6(adaptorSpecifier);
|
|
2863
|
+
const { name: name2, version } = getNameAndVersion6(adaptorSpecifier);
|
|
2823
2864
|
if (!version)
|
|
2824
2865
|
return;
|
|
2825
2866
|
const cachePath = getUnsupportedCachePath(repoDir);
|
|
@@ -2830,9 +2871,9 @@ var markAdaptorAsUnsupported = async (adaptorSpecifier, repoDir) => {
|
|
|
2830
2871
|
} catch (error) {
|
|
2831
2872
|
}
|
|
2832
2873
|
const parsed = parseVersion(version);
|
|
2833
|
-
const existing = cache[
|
|
2874
|
+
const existing = cache[name2];
|
|
2834
2875
|
if (!existing || compareVersions(version, existing.lastCheckedVersion) > 0) {
|
|
2835
|
-
cache[
|
|
2876
|
+
cache[name2] = {
|
|
2836
2877
|
lastCheckedVersion: version,
|
|
2837
2878
|
majorMinor: parsed.majorMinor,
|
|
2838
2879
|
timestamp: Date.now()
|
|
@@ -3674,8 +3715,8 @@ var printVersions = async (logger, options8 = {}, includeComponents = false) =>
|
|
|
3674
3715
|
adaptorName = getNameAndVersion7(adaptor).name;
|
|
3675
3716
|
adaptorVersion = "monorepo";
|
|
3676
3717
|
} else {
|
|
3677
|
-
const { name, version: version2 } = getNameAndVersion7(adaptor);
|
|
3678
|
-
adaptorName =
|
|
3718
|
+
const { name: name2, version: version2 } = getNameAndVersion7(adaptor);
|
|
3719
|
+
adaptorName = name2;
|
|
3679
3720
|
adaptorVersion = version2 || "latest";
|
|
3680
3721
|
}
|
|
3681
3722
|
adaptorList.push([adaptorName, adaptorVersion]);
|
|
@@ -3705,8 +3746,8 @@ var printVersions = async (logger, options8 = {}, includeComponents = false) =>
|
|
|
3705
3746
|
output.versions.compiler = compilerVersion;
|
|
3706
3747
|
}
|
|
3707
3748
|
if (adaptorList.length) {
|
|
3708
|
-
for (const [
|
|
3709
|
-
output.versions[
|
|
3749
|
+
for (const [name2, version2] of adaptorList) {
|
|
3750
|
+
output.versions[name2] = version2;
|
|
3710
3751
|
}
|
|
3711
3752
|
}
|
|
3712
3753
|
} else {
|
|
@@ -3719,9 +3760,9 @@ ${prefix(RUNTIME2)}${runtimeVersion}
|
|
|
3719
3760
|
${prefix(COMPILER2)}${compilerVersion}`;
|
|
3720
3761
|
}
|
|
3721
3762
|
if (adaptorList.length) {
|
|
3722
|
-
for (const [
|
|
3763
|
+
for (const [name2, version2] of adaptorList) {
|
|
3723
3764
|
output += `
|
|
3724
|
-
${prefix(
|
|
3765
|
+
${prefix(name2)}${version2}`;
|
|
3725
3766
|
}
|
|
3726
3767
|
}
|
|
3727
3768
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"description": "CLI devtools for the OpenFn toolchain",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"yargs": "^17.7.2",
|
|
53
53
|
"@openfn/compiler": "1.2.2",
|
|
54
54
|
"@openfn/deploy": "0.11.5",
|
|
55
|
-
"@openfn/logger": "1.1.1",
|
|
56
55
|
"@openfn/lexicon": "^1.4.1",
|
|
57
|
-
"@openfn/
|
|
58
|
-
"@openfn/
|
|
59
|
-
"@openfn/
|
|
56
|
+
"@openfn/describe-package": "0.1.5",
|
|
57
|
+
"@openfn/logger": "1.1.1",
|
|
58
|
+
"@openfn/project": "^0.13.1",
|
|
59
|
+
"@openfn/runtime": "1.8.4"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
62
|
"dist",
|