@openfn/cli 1.26.0 → 1.28.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 +114 -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,35 @@ 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
|
+
localProject.credentials = localProject.buildCredentialMap();
|
|
2455
|
+
logger.success(`Loaded local project ${printProjectName(localProject)}`);
|
|
2456
|
+
const merged = options8.new ? localProject : await syncProjects(options8, config2, ws, localProject, logger);
|
|
2417
2457
|
const state = merged.serialize("state", {
|
|
2418
2458
|
format: "json"
|
|
2419
2459
|
});
|
|
2420
|
-
logger.debug("
|
|
2460
|
+
logger.debug("Provisioner state ready to upload:");
|
|
2421
2461
|
logger.debug(JSON.stringify(state, null, 2));
|
|
2462
|
+
logger.debug();
|
|
2422
2463
|
config2.endpoint ??= localProject.openfn?.endpoint;
|
|
2423
2464
|
if (options8.dryRun) {
|
|
2424
2465
|
logger.always("dryRun option set: skipping upload step");
|
|
@@ -2442,7 +2483,8 @@ Pass --force to override this error and deploy anyway.`);
|
|
|
2442
2483
|
"state",
|
|
2443
2484
|
result,
|
|
2444
2485
|
{
|
|
2445
|
-
endpoint: config2.endpoint
|
|
2486
|
+
endpoint: config2.endpoint,
|
|
2487
|
+
alias: alias2
|
|
2446
2488
|
},
|
|
2447
2489
|
merged.config
|
|
2448
2490
|
);
|
|
@@ -2646,7 +2688,7 @@ import c3 from "chalk";
|
|
|
2646
2688
|
import { getNameAndVersion as getNameAndVersion5, getLatestVersion } from "@openfn/runtime";
|
|
2647
2689
|
var describeFn = (adaptorName, fn) => [
|
|
2648
2690
|
c3.green(
|
|
2649
|
-
`## ${fn.name}(${fn.parameters.map(({ name }) =>
|
|
2691
|
+
`## ${fn.name}(${fn.parameters.map(({ name: name2 }) => name2).join(",")})`
|
|
2650
2692
|
),
|
|
2651
2693
|
`${fn.description}`,
|
|
2652
2694
|
c3.green("### Usage Examples"),
|
|
@@ -2674,17 +2716,17 @@ var docsHandler = async (options8, logger) => {
|
|
|
2674
2716
|
const { adaptor, operation, repoDir } = options8;
|
|
2675
2717
|
const adaptors = expand_adaptors_default([adaptor]);
|
|
2676
2718
|
const [adaptorName] = adaptors;
|
|
2677
|
-
let { name, version } = getNameAndVersion5(adaptorName);
|
|
2719
|
+
let { name: name2, version } = getNameAndVersion5(adaptorName);
|
|
2678
2720
|
if (!version) {
|
|
2679
2721
|
logger.info("No version number provided, looking for latest...");
|
|
2680
|
-
version = await getLatestVersion(
|
|
2722
|
+
version = await getLatestVersion(name2);
|
|
2681
2723
|
logger.info("Found ", version);
|
|
2682
2724
|
logger.success(`Showing docs for ${adaptorName} v${version}`);
|
|
2683
2725
|
}
|
|
2684
2726
|
logger.info("Generating/loading documentation...");
|
|
2685
2727
|
const path18 = await handler_default7(
|
|
2686
2728
|
{
|
|
2687
|
-
specifier: `${
|
|
2729
|
+
specifier: `${name2}@${version}`,
|
|
2688
2730
|
repoDir
|
|
2689
2731
|
},
|
|
2690
2732
|
// TODO I'm not sure how to handle logging here - we ought to feedback SOMETHING though
|
|
@@ -2696,24 +2738,24 @@ var docsHandler = async (options8, logger) => {
|
|
|
2696
2738
|
const data = JSON.parse(source);
|
|
2697
2739
|
let desc;
|
|
2698
2740
|
if (operation) {
|
|
2699
|
-
const fn = data.functions.find(({ name:
|
|
2741
|
+
const fn = data.functions.find(({ name: name3 }) => name3 === operation);
|
|
2700
2742
|
if (fn) {
|
|
2701
2743
|
logger.debug("Operation schema:", fn);
|
|
2702
2744
|
logger.break();
|
|
2703
|
-
desc = describeFn(
|
|
2745
|
+
desc = describeFn(name2, fn);
|
|
2704
2746
|
} else {
|
|
2705
|
-
logger.error(`Failed to find ${operation} in ${
|
|
2747
|
+
logger.error(`Failed to find ${operation} in ${name2}`);
|
|
2706
2748
|
}
|
|
2707
2749
|
} else {
|
|
2708
2750
|
logger.debug("No operation name provided");
|
|
2709
2751
|
logger.always("Available functions:\n");
|
|
2710
|
-
desc = describeLib(
|
|
2752
|
+
desc = describeLib(name2, data);
|
|
2711
2753
|
}
|
|
2712
2754
|
logger.print(desc);
|
|
2713
2755
|
if (!operation) {
|
|
2714
2756
|
logger.always(`For more details on a specfic functions, use:
|
|
2715
2757
|
|
|
2716
|
-
openfn docs ${
|
|
2758
|
+
openfn docs ${name2} <fn>
|
|
2717
2759
|
`);
|
|
2718
2760
|
}
|
|
2719
2761
|
if (didError) {
|
|
@@ -2803,14 +2845,14 @@ var compareVersions = (version1, version2) => {
|
|
|
2803
2845
|
return v1.patch - v2.patch;
|
|
2804
2846
|
};
|
|
2805
2847
|
var isAdaptorUnsupported = async (adaptorSpecifier, repoDir) => {
|
|
2806
|
-
const { name, version } = getNameAndVersion6(adaptorSpecifier);
|
|
2848
|
+
const { name: name2, version } = getNameAndVersion6(adaptorSpecifier);
|
|
2807
2849
|
if (!version)
|
|
2808
2850
|
return false;
|
|
2809
2851
|
const cache = await getUnsupportedCache(repoDir);
|
|
2810
|
-
if (!cache || !cache[
|
|
2852
|
+
if (!cache || !cache[name2]) {
|
|
2811
2853
|
return false;
|
|
2812
2854
|
}
|
|
2813
|
-
const cached = cache[
|
|
2855
|
+
const cached = cache[name2];
|
|
2814
2856
|
const currentParsed = parseVersion(version);
|
|
2815
2857
|
const cachedParsed = parseVersion(cached.lastCheckedVersion);
|
|
2816
2858
|
if (currentParsed.major > cachedParsed.major || currentParsed.major === cachedParsed.major && currentParsed.minor > cachedParsed.minor) {
|
|
@@ -2819,7 +2861,7 @@ var isAdaptorUnsupported = async (adaptorSpecifier, repoDir) => {
|
|
|
2819
2861
|
return true;
|
|
2820
2862
|
};
|
|
2821
2863
|
var markAdaptorAsUnsupported = async (adaptorSpecifier, repoDir) => {
|
|
2822
|
-
const { name, version } = getNameAndVersion6(adaptorSpecifier);
|
|
2864
|
+
const { name: name2, version } = getNameAndVersion6(adaptorSpecifier);
|
|
2823
2865
|
if (!version)
|
|
2824
2866
|
return;
|
|
2825
2867
|
const cachePath = getUnsupportedCachePath(repoDir);
|
|
@@ -2830,9 +2872,9 @@ var markAdaptorAsUnsupported = async (adaptorSpecifier, repoDir) => {
|
|
|
2830
2872
|
} catch (error) {
|
|
2831
2873
|
}
|
|
2832
2874
|
const parsed = parseVersion(version);
|
|
2833
|
-
const existing = cache[
|
|
2875
|
+
const existing = cache[name2];
|
|
2834
2876
|
if (!existing || compareVersions(version, existing.lastCheckedVersion) > 0) {
|
|
2835
|
-
cache[
|
|
2877
|
+
cache[name2] = {
|
|
2836
2878
|
lastCheckedVersion: version,
|
|
2837
2879
|
majorMinor: parsed.majorMinor,
|
|
2838
2880
|
timestamp: Date.now()
|
|
@@ -3674,8 +3716,8 @@ var printVersions = async (logger, options8 = {}, includeComponents = false) =>
|
|
|
3674
3716
|
adaptorName = getNameAndVersion7(adaptor).name;
|
|
3675
3717
|
adaptorVersion = "monorepo";
|
|
3676
3718
|
} else {
|
|
3677
|
-
const { name, version: version2 } = getNameAndVersion7(adaptor);
|
|
3678
|
-
adaptorName =
|
|
3719
|
+
const { name: name2, version: version2 } = getNameAndVersion7(adaptor);
|
|
3720
|
+
adaptorName = name2;
|
|
3679
3721
|
adaptorVersion = version2 || "latest";
|
|
3680
3722
|
}
|
|
3681
3723
|
adaptorList.push([adaptorName, adaptorVersion]);
|
|
@@ -3705,8 +3747,8 @@ var printVersions = async (logger, options8 = {}, includeComponents = false) =>
|
|
|
3705
3747
|
output.versions.compiler = compilerVersion;
|
|
3706
3748
|
}
|
|
3707
3749
|
if (adaptorList.length) {
|
|
3708
|
-
for (const [
|
|
3709
|
-
output.versions[
|
|
3750
|
+
for (const [name2, version2] of adaptorList) {
|
|
3751
|
+
output.versions[name2] = version2;
|
|
3710
3752
|
}
|
|
3711
3753
|
}
|
|
3712
3754
|
} else {
|
|
@@ -3719,9 +3761,9 @@ ${prefix(RUNTIME2)}${runtimeVersion}
|
|
|
3719
3761
|
${prefix(COMPILER2)}${compilerVersion}`;
|
|
3720
3762
|
}
|
|
3721
3763
|
if (adaptorList.length) {
|
|
3722
|
-
for (const [
|
|
3764
|
+
for (const [name2, version2] of adaptorList) {
|
|
3723
3765
|
output += `
|
|
3724
|
-
${prefix(
|
|
3766
|
+
${prefix(name2)}${version2}`;
|
|
3725
3767
|
}
|
|
3726
3768
|
}
|
|
3727
3769
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.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/
|
|
55
|
+
"@openfn/describe-package": "0.1.5",
|
|
56
56
|
"@openfn/lexicon": "^1.4.1",
|
|
57
|
-
"@openfn/
|
|
58
|
-
"@openfn/
|
|
59
|
-
"@openfn/
|
|
57
|
+
"@openfn/logger": "1.1.1",
|
|
58
|
+
"@openfn/project": "^0.14.0",
|
|
59
|
+
"@openfn/runtime": "1.8.4"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
62
|
"dist",
|