@openfn/cli 0.2.1 → 0.2.3

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 CHANGED
@@ -11,9 +11,7 @@ import { fork } from "node:child_process";
11
11
  import process2 from "node:process";
12
12
  function spawn_default(basePath, opts2) {
13
13
  const execArgv = [
14
- // Suppress experimental argument warnings
15
14
  "--no-warnings",
16
- // Allows us to load an ESM module from a text string
17
15
  "--experimental-vm-modules"
18
16
  ];
19
17
  const dirname = path.dirname(url.fileURLToPath(import.meta.url));
@@ -388,9 +386,7 @@ var command_default2 = deployCommand;
388
386
  // src/docgen/command.ts
389
387
  var docgenCommand = {
390
388
  command: "docgen <specifier>",
391
- // Hide this command as it's not really for public usage
392
389
  desc: false,
393
- // 'Generate documentation into the repo. Specifier must include a version number.'
394
390
  handler: (argv) => {
395
391
  argv.command = "docgen";
396
392
  },
@@ -1,2 +1 @@
1
1
 
2
- export { }
@@ -39,8 +39,8 @@ var createNullLogger = () => createLogger(void 0, { log: { default: "none" } });
39
39
  var AbortError = class extends Error {
40
40
  constructor(reason) {
41
41
  super(reason);
42
+ this.handled = true;
42
43
  }
43
- handled = true;
44
44
  };
45
45
  var abort_default = (logger, reason, error, help) => {
46
46
  const e = new AbortError(reason);
@@ -65,9 +65,7 @@ var execute_default = async (input, state, opts, logger) => {
65
65
  timeout: opts.timeout,
66
66
  immutableState: opts.immutable,
67
67
  logger: logger_default(RUNTIME, opts),
68
- // TODO log types are flaky right now
69
68
  jobLogger: logger_default(JOB, opts),
70
- // ditto
71
69
  linker: {
72
70
  repo: opts.repoDir,
73
71
  modules: parseAdaptors(opts)
@@ -568,7 +566,7 @@ var map_adaptors_to_monorepo_default = mapAdaptorsToMonorepo;
568
566
 
569
567
  // src/execute/handler.ts
570
568
  var executeHandler = async (options, logger) => {
571
- const start = (/* @__PURE__ */ new Date()).getTime();
569
+ const start = new Date().getTime();
572
570
  await validate_adaptors_default(options, logger);
573
571
  let input = await load_input_default(options, logger);
574
572
  if (options.workflow) {
@@ -599,7 +597,7 @@ var executeHandler = async (options, logger) => {
599
597
  try {
600
598
  const result = await execute_default(input, state, options, logger);
601
599
  await serialize_output_default(options, result, logger);
602
- const duration = printDuration((/* @__PURE__ */ new Date()).getTime() - start);
600
+ const duration = printDuration(new Date().getTime() - start);
603
601
  if (result.errors) {
604
602
  logger.warn(
605
603
  `Errors reported in ${Object.keys(result.errors).length} jobs`
@@ -612,7 +610,7 @@ var executeHandler = async (options, logger) => {
612
610
  logger.error("Unexpected error in execution");
613
611
  logger.error(err);
614
612
  }
615
- const duration = printDuration((/* @__PURE__ */ new Date()).getTime() - start);
613
+ const duration = printDuration(new Date().getTime() - start);
616
614
  logger.always(`Workflow failed in ${duration}.`);
617
615
  process.exitCode = 1;
618
616
  }
@@ -885,7 +883,6 @@ var docsHandler = async (options, logger) => {
885
883
  specifier: `${name}@${version}`,
886
884
  repoDir
887
885
  },
888
- // TODO I'm not sure how to handle logging here - we ought to feedback SOMETHING though
889
886
  createNullLogger()
890
887
  );
891
888
  let didError = false;
@@ -961,7 +958,7 @@ var cache_default = { get, set, generateKey, getPath, sortKeys };
961
958
  // src/metadata/handler.ts
962
959
  import { getModuleEntryPoint } from "@openfn/runtime";
963
960
  var decorateMetadata = (metadata) => {
964
- metadata.created = (/* @__PURE__ */ new Date()).toISOString();
961
+ metadata.created = new Date().toISOString();
965
962
  };
966
963
  var getAdaptorPath = async (adaptor, logger, repoDir) => {
967
964
  let adaptorPath;
@@ -1079,7 +1076,6 @@ var handler_default8 = pullHandler;
1079
1076
  import path6 from "node:path";
1080
1077
  var defaultLoggerOptions = {
1081
1078
  default: "default",
1082
- // TODO fix to lower case
1083
1079
  job: "debug"
1084
1080
  };
1085
1081
  var ERROR_MESSAGE_LOG_LEVEL = "Unknown log level. Valid levels are none, debug, info and default.";
@@ -1129,7 +1125,6 @@ var ensureLogOpts = (opts) => {
1129
1125
  function ensureOpts(basePath = ".", opts) {
1130
1126
  const newOpts = {
1131
1127
  adaptor: opts.adaptor,
1132
- // only applies to install (a bit messy) (now applies to docs too)
1133
1128
  adaptors: opts.adaptors || [],
1134
1129
  autoinstall: opts.autoinstall,
1135
1130
  command: opts.command,
@@ -1137,7 +1132,6 @@ function ensureOpts(basePath = ".", opts) {
1137
1132
  force: opts.force || false,
1138
1133
  immutable: opts.immutable || false,
1139
1134
  log: opts.log,
1140
- // TMP this will be overwritten later
1141
1135
  logJson: typeof opts.logJson == "boolean" ? opts.logJson : Boolean(process.env.OPENFN_LOG_JSON),
1142
1136
  compile: Boolean(opts.compile),
1143
1137
  operation: opts.operation,
@@ -1218,7 +1212,7 @@ var printVersions = async (logger, options = {}) => {
1218
1212
  adaptorName
1219
1213
  ].map((s) => s.length));
1220
1214
  const prefix = (str) => ` ${t} ${str.padEnd(longest + 4, " ")}`;
1221
- const pkg = await import("../package-JMR2GBIW.js");
1215
+ const pkg = await import("../../package.json", { assert: { type: "json" } });
1222
1216
  const { version, dependencies } = pkg.default;
1223
1217
  const compilerVersion = dependencies["@openfn/compiler"];
1224
1218
  const runtimeVersion = dependencies["@openfn/runtime"];
@@ -1264,13 +1258,7 @@ var handlers = {
1264
1258
  ["repo-list"]: list,
1265
1259
  version: async (opts, logger) => print_versions_default(logger, opts)
1266
1260
  };
1267
- var maybeEnsureOpts = (basePath, options) => (
1268
- // If the command is compile or execute, just return the opts (yargs will do all the validation)
1269
- /(^(deploy|execute|compile|test)$)|(repo-)/.test(options.command) ? ensureLogOpts(options) : (
1270
- // Otherwise older commands still need to go through ensure opts
1271
- ensureOpts(basePath, options)
1272
- )
1273
- );
1261
+ var maybeEnsureOpts = (basePath, options) => /(^(deploy|execute|compile|test)$)|(repo-)/.test(options.command) ? ensureLogOpts(options) : ensureOpts(basePath, options);
1274
1262
  var parse = async (basePath, options, log) => {
1275
1263
  const opts = maybeEnsureOpts(basePath, options);
1276
1264
  const logger = log || logger_default(CLI, opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "CLI devtools for the openfn toolchain.",
5
5
  "engines": {
6
6
  "node": ">=18",
@@ -32,7 +32,7 @@
32
32
  "mock-fs": "^5.1.4",
33
33
  "ts-node": "^10.9.1",
34
34
  "tslib": "^2.4.0",
35
- "tsup": "^7.1.0",
35
+ "tsup": "^6.2.3",
36
36
  "typescript": "^4.7.4"
37
37
  },
38
38
  "dependencies": {
@@ -40,11 +40,11 @@
40
40
  "rimraf": "^3.0.2",
41
41
  "treeify": "^1.1.0",
42
42
  "yargs": "^17.7.2",
43
- "@openfn/deploy": "0.2.1",
44
- "@openfn/describe-package": "0.0.17",
45
- "@openfn/logger": "0.0.14",
46
- "@openfn/runtime": "0.0.27",
47
- "@openfn/compiler": "0.0.33"
43
+ "@openfn/compiler": "0.0.34",
44
+ "@openfn/deploy": "0.2.2",
45
+ "@openfn/describe-package": "0.0.18",
46
+ "@openfn/logger": "0.0.15",
47
+ "@openfn/runtime": "0.0.28"
48
48
  },
49
49
  "files": [
50
50
  "dist",
@@ -1,98 +0,0 @@
1
- // package.json
2
- var name = "@openfn/cli";
3
- var version = "0.2.1";
4
- var description = "CLI devtools for the openfn toolchain.";
5
- var engines = {
6
- node: ">=18",
7
- pnpm: ">=7"
8
- };
9
- var scripts = {
10
- test: "pnpm ava",
11
- "test:watch": "pnpm ava -w",
12
- "test:types": "pnpm tsc --noEmit --project tsconfig.json",
13
- build: "tsup --config ./tsup.config.js",
14
- "build:watch": "pnpm build --watch",
15
- openfn: "node --no-warnings dist/index.js",
16
- pack: "pnpm pack --pack-destination ../../dist"
17
- };
18
- var exports = {
19
- ".": {
20
- import: {
21
- types: "./dist/index.d.ts",
22
- default: "./dist/index.js"
23
- }
24
- }
25
- };
26
- var type = "module";
27
- var bin = {
28
- openfn: "dist/index.js"
29
- };
30
- var module = "dist/index.js";
31
- var types = "dist/index.d.ts";
32
- var keywords = [];
33
- var author = "Open Function Group <admin@openfn.org>";
34
- var license = "ISC";
35
- var devDependencies = {
36
- "@openfn/language-common": "2.0.0-rc3",
37
- "@types/mock-fs": "^4.13.1",
38
- "@types/node": "^17.0.45",
39
- "@types/yargs": "^17.0.24",
40
- ava: "5.1.0",
41
- "mock-fs": "^5.1.4",
42
- "ts-node": "^10.9.1",
43
- tslib: "^2.4.0",
44
- tsup: "^7.1.0",
45
- typescript: "^4.7.4"
46
- };
47
- var dependencies = {
48
- "@openfn/compiler": "workspace:*",
49
- "@openfn/deploy": "workspace:*",
50
- "@openfn/describe-package": "workspace:*",
51
- "@openfn/logger": "workspace:*",
52
- "@openfn/runtime": "workspace:*",
53
- figures: "^5.0.0",
54
- rimraf: "^3.0.2",
55
- treeify: "^1.1.0",
56
- yargs: "^17.7.2"
57
- };
58
- var files = [
59
- "dist",
60
- "README.md"
61
- ];
62
- var package_default = {
63
- name,
64
- version,
65
- description,
66
- engines,
67
- scripts,
68
- exports,
69
- type,
70
- bin,
71
- module,
72
- types,
73
- keywords,
74
- author,
75
- license,
76
- devDependencies,
77
- dependencies,
78
- files
79
- };
80
- export {
81
- author,
82
- bin,
83
- package_default as default,
84
- dependencies,
85
- description,
86
- devDependencies,
87
- engines,
88
- exports,
89
- files,
90
- keywords,
91
- license,
92
- module,
93
- name,
94
- scripts,
95
- type,
96
- types,
97
- version
98
- };