@openfn/cli 0.3.1 → 0.4.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 CHANGED
@@ -113,6 +113,9 @@ var ensureLogOpts = (opts2) => {
113
113
  } else {
114
114
  component = "default";
115
115
  level = l.toLowerCase();
116
+ if (level === "none" && !parts.find((p) => p.startsWith("job"))) {
117
+ components["job"] = "none";
118
+ }
116
119
  }
117
120
  if (!/^(cli|runtime|compiler|job|default)$/i.test(component)) {
118
121
  throw new Error(ERROR_MESSAGE_LOG_COMPONENT);
@@ -416,8 +419,26 @@ var useAdaptorsMonorepo = {
416
419
  }
417
420
  }
418
421
  };
422
+ var sanitize = {
423
+ name: "sanitize",
424
+ yargs: {
425
+ string: true,
426
+ alias: ["sanitise"],
427
+ description: "Sanitize logging of objects and arrays: none (default), remove, summarize, obfuscate.",
428
+ default: "none"
429
+ },
430
+ ensure: (opts2) => {
431
+ if (!opts2.sanitize || opts2.sanitize?.match(/^(none|summarize|remove|obfuscate)$/)) {
432
+ return;
433
+ }
434
+ const err = "Unknown sanitize value provided: " + opts2.sanitize;
435
+ console.error(err);
436
+ throw new Error(err);
437
+ }
438
+ };
419
439
 
420
440
  // src/util/command-builders.ts
441
+ import c from "chalk";
421
442
  var expandYargs = (y2) => {
422
443
  if (typeof y2 === "function") {
423
444
  return y2();
@@ -433,7 +454,18 @@ function build(opts2, yargs2) {
433
454
  var ensure = (command, opts2) => (yargs2) => {
434
455
  yargs2.command = command;
435
456
  opts2.filter((opt) => opt.ensure).forEach((opt) => {
436
- opt.ensure(yargs2);
457
+ try {
458
+ opt.ensure(yargs2);
459
+ } catch (e) {
460
+ console.error(
461
+ c.red(`
462
+ Error parsing command arguments: ${command}.${opt.name}
463
+ `)
464
+ );
465
+ console.error(c.red("Aborting"));
466
+ console.error();
467
+ process.exit(9);
468
+ }
437
469
  });
438
470
  };
439
471
  var override = (command, yargs2) => {
@@ -537,6 +569,7 @@ var options4 = [
537
569
  outputStdout,
538
570
  repoDir,
539
571
  skipAdaptorValidation,
572
+ sanitize,
540
573
  start,
541
574
  statePath,
542
575
  stateStdin,
@@ -24,6 +24,7 @@ var createLogger = (name = "", options) => {
24
24
  return actualCreateLogger(namespaces[name] || name, {
25
25
  level,
26
26
  json,
27
+ sanitize: options.sanitize || "none",
27
28
  ...logOptions
28
29
  });
29
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/cli",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "CLI devtools for the openfn toolchain.",
5
5
  "engines": {
6
6
  "node": ">=18",
@@ -39,15 +39,16 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@inquirer/prompts": "^1.1.4",
42
+ "chalk": "^5.1.2",
42
43
  "figures": "^5.0.0",
43
44
  "rimraf": "^3.0.2",
44
45
  "treeify": "^1.1.0",
45
46
  "yargs": "^17.7.2",
46
- "@openfn/compiler": "0.0.35",
47
- "@openfn/deploy": "0.2.5",
47
+ "@openfn/compiler": "0.0.36",
48
+ "@openfn/deploy": "0.2.6",
48
49
  "@openfn/describe-package": "0.0.18",
49
- "@openfn/logger": "0.0.16",
50
- "@openfn/runtime": "0.0.29"
50
+ "@openfn/logger": "0.0.17",
51
+ "@openfn/runtime": "0.0.30"
51
52
  },
52
53
  "files": [
53
54
  "dist",