@sqlanvil/cli 1.31.0 → 1.32.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/bundle.js CHANGED
@@ -49559,6 +49559,7 @@ var VerifyProtoErrorBehaviour;
49559
49559
  })(VerifyProtoErrorBehaviour || (VerifyProtoErrorBehaviour = {}));
49560
49560
  const Struct = google.protobuf.Struct;
49561
49561
  const originalVerify = Struct.verify;
49562
+ const originalFromObject = Struct.fromObject;
49562
49563
  Struct.verify = function (object) {
49563
49564
  if (object && typeof object === "object" && !("fields" in object)) {
49564
49565
  const fields = {};
@@ -49570,6 +49571,17 @@ Struct.verify = function (object) {
49570
49571
  }
49571
49572
  return originalVerify.call(this, object);
49572
49573
  };
49574
+ Struct.fromObject = function (object) {
49575
+ if (object && typeof object === "object" && !("fields" in object)) {
49576
+ const fields = {};
49577
+ for (const [k, v] of Object.entries(object)) {
49578
+ fields[k] = unknownToValueShallow(v);
49579
+ }
49580
+ Object.keys(object).forEach(key => delete object[key]);
49581
+ object.fields = fields;
49582
+ }
49583
+ return originalFromObject.call(this, object);
49584
+ };
49573
49585
  function verifyObjectMatchesProto(protoType, object, errorBehaviour = VerifyProtoErrorBehaviour.DEFAULT) {
49574
49586
  if (Array.isArray(object)) {
49575
49587
  throw ReferenceError(`Expected a top-level object, but found an array`);
@@ -49583,6 +49595,11 @@ function verifyObjectMatchesProto(protoType, object, errorBehaviour = VerifyProt
49583
49595
  throw ReferenceError(`Invalid property value: ${verificationError}.` +
49584
49596
  maybeGetDocsLinkPrefix(errorBehaviour, protoType));
49585
49597
  }
49598
+ try {
49599
+ protoType.fromObject(object);
49600
+ }
49601
+ catch (_a) {
49602
+ }
49586
49603
  const proto = protoType.create(object);
49587
49604
  const protoCastObject = protoType.toObject(proto);
49588
49605
  function checkFields(present, desired) {
@@ -51079,8 +51096,8 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
51079
51096
  .filter(validationQuery => !!validationQuery.query);
51080
51097
  }
51081
51098
 
51082
- const version = "1.31.0";
51083
- const dataformVersion = "3.0.65";
51099
+ const version = "1.32.0";
51100
+ const dataformVersion = "3.0.66";
51084
51101
 
51085
51102
  async function build(compiledGraph, runConfig, dbadapter) {
51086
51103
  const prunedGraph = prune(compiledGraph, runConfig);
@@ -57562,6 +57579,7 @@ function printExecutionGraph(executionGraph, asJson) {
57562
57579
  }
57563
57580
  }
57564
57581
  function printExecutedAction(executedAction, executionAction, dryRun) {
57582
+ var _a, _b;
57565
57583
  const jobIds = executedAction.tasks
57566
57584
  .filter(task => { var _a, _b; return (_b = (_a = task.metadata) === null || _a === void 0 ? void 0 : _a.bigquery) === null || _b === void 0 ? void 0 : _b.jobId; })
57567
57585
  .map(task => task.metadata.bigquery.jobId);
@@ -57609,17 +57627,19 @@ function printExecutedAction(executedAction, executionAction, dryRun) {
57609
57627
  return;
57610
57628
  }
57611
57629
  case sqlanvil.ActionResult.ExecutionStatus.SKIPPED: {
57630
+ const skipReason = (_b = (_a = executedAction.tasks) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.errorMessage;
57631
+ const skipSuffix = skipReason ? ` (${skipReason})` : "";
57612
57632
  switch (executionAction.type) {
57613
57633
  case "table": {
57614
- writeStdOut(`${warningOutput("Skipping dataset creation: ")} ${datasetString(executionAction.target, executionAction.tableType, executionAction.tasks.length === 0)}`);
57634
+ writeStdOut(`${warningOutput("Skipping dataset creation: ")} ${datasetString(executionAction.target, executionAction.tableType, executionAction.tasks.length === 0)}${skipSuffix}`);
57615
57635
  return;
57616
57636
  }
57617
57637
  case "assertion": {
57618
- writeStdOut(`${warningOutput("Skipping assertion execution: ")} ${assertionString(executionAction.target, executionAction.tasks.length === 0)}`);
57638
+ writeStdOut(`${warningOutput("Skipping assertion execution: ")} ${assertionString(executionAction.target, executionAction.tasks.length === 0)}${skipSuffix}`);
57619
57639
  return;
57620
57640
  }
57621
57641
  case "operation": {
57622
- writeStdOut(`${warningOutput("Skipping operation execution: ")} ${operationString(executionAction.target, executionAction.tasks.length === 0)}`);
57642
+ writeStdOut(`${warningOutput("Skipping operation execution: ")} ${operationString(executionAction.target, executionAction.tasks.length === 0)}${skipSuffix}`);
57623
57643
  return;
57624
57644
  }
57625
57645
  }
@@ -57701,7 +57721,7 @@ function dotRepresentation(graph, interactive) {
57701
57721
  (_c = graph.operations) === null || _c === void 0 ? void 0 : _c.forEach(operation => {
57702
57722
  var _a;
57703
57723
  const nodeName = `${formatTarget(operation.target)}`;
57704
- nodes.push(`"${nodeName}" [label="${formatTarget(operation.target)}"`);
57724
+ nodes.push(`"${nodeName}" [label="${formatTarget(operation.target)}"]`);
57705
57725
  (_a = operation.dependencyTargets) === null || _a === void 0 ? void 0 : _a.forEach(dependencyTarget => {
57706
57726
  edges.push(`"${formatTarget(dependencyTarget)}" -> "${nodeName}"`);
57707
57727
  });
@@ -59389,6 +59409,14 @@ const timeoutOption = option("timeout", {
59389
59409
  default: null,
59390
59410
  coerce: (rawTimeoutString) => rawTimeoutString ? parseDuration__default["default"](rawTimeoutString) : null
59391
59411
  });
59412
+ const executionTimeoutOption = option("execution-timeout", {
59413
+ describe: "Wall-clock deadline for the entire run (compile + all actions). When it fires, " +
59414
+ "in-flight actions are cancelled and pending actions are skipped. Off by default. " +
59415
+ "Examples: '10m', '2h'.",
59416
+ type: "string",
59417
+ default: null,
59418
+ coerce: (rawTimeoutString) => rawTimeoutString ? parseDuration__default["default"](rawTimeoutString) : null
59419
+ });
59392
59420
  const noArtifactsOption = option("no-artifacts", {
59393
59421
  describe: "Skip writing the queryable Parquet artifacts under target/ (catalog on compile; run history " +
59394
59422
  "on run).",
@@ -60025,6 +60053,7 @@ function runCli() {
60025
60053
  credentialsOption,
60026
60054
  jsonOutputOption,
60027
60055
  timeoutOption,
60056
+ executionTimeoutOption,
60028
60057
  tagsOption,
60029
60058
  bigqueryJobLabelsOption,
60030
60059
  noArtifactsOption,
@@ -60108,7 +60137,8 @@ function runCli() {
60108
60137
  actions: argv[actionsOption.name],
60109
60138
  includeDependencies: argv[includeDepsOption.name],
60110
60139
  includeDependents: argv[includeDependentsOption.name],
60111
- tags: argv[tagsOption.name]
60140
+ tags: argv[tagsOption.name],
60141
+ timeoutMillis: argv[executionTimeoutOption.name] || undefined
60112
60142
  }, dbadapter);
60113
60143
  if (argv[dryRunOptionName] && argv[jsonOutputOption.name]) {
60114
60144
  printExecutionGraph(executionGraph, argv[jsonOutputOption.name]);
@@ -60177,6 +60207,18 @@ function runCli() {
60177
60207
  runner.onChange(printExecutedGraph);
60178
60208
  const runResult = await runner.result();
60179
60209
  printExecutedGraph(runResult);
60210
+ if (!argv[jsonOutputOption.name]) {
60211
+ if (runResult.status === sqlanvil.RunResult.ExecutionStatus.TIMED_OUT) {
60212
+ const executionTimeoutMillis = argv[executionTimeoutOption.name];
60213
+ const suffix = executionTimeoutMillis
60214
+ ? ` after ${executionTimeoutMillis / 1000} seconds (--execution-timeout)`
60215
+ : "";
60216
+ printError(`Run timed out${suffix}.`);
60217
+ }
60218
+ else if (runResult.status === sqlanvil.RunResult.ExecutionStatus.CANCELLED) {
60219
+ printError("Run cancelled.");
60220
+ }
60221
+ }
60180
60222
  if (!argv[noArtifactsOption.name]) {
60181
60223
  await safeWriteArtifacts(compiledGraph, argv[projectDirOption.name], {
60182
60224
  runResult,
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  "tmp": "^0.2.7",
25
25
  "typeid-js": "0.3.0",
26
26
  "untildify": "^4.0.0",
27
- "vm2": "3.11.4",
27
+ "vm2": "3.11.6",
28
28
  "yargs": "^16.2.0"
29
29
  },
30
30
  "resolutions": {
@@ -73,7 +73,7 @@
73
73
  "bin": {
74
74
  "sqlanvil": "bundle.js"
75
75
  },
76
- "version": "1.31.0",
76
+ "version": "1.32.0",
77
77
  "name": "@sqlanvil/cli",
78
78
  "description": "sqlanvil command line interface.",
79
79
  "main": "bundle.js"
package/worker_bundle.js CHANGED
@@ -49495,6 +49495,7 @@ var VerifyProtoErrorBehaviour;
49495
49495
  })(VerifyProtoErrorBehaviour || (VerifyProtoErrorBehaviour = {}));
49496
49496
  const Struct = google.protobuf.Struct;
49497
49497
  const originalVerify = Struct.verify;
49498
+ const originalFromObject = Struct.fromObject;
49498
49499
  Struct.verify = function (object) {
49499
49500
  if (object && typeof object === "object" && !("fields" in object)) {
49500
49501
  const fields = {};
@@ -49506,6 +49507,17 @@ Struct.verify = function (object) {
49506
49507
  }
49507
49508
  return originalVerify.call(this, object);
49508
49509
  };
49510
+ Struct.fromObject = function (object) {
49511
+ if (object && typeof object === "object" && !("fields" in object)) {
49512
+ const fields = {};
49513
+ for (const [k, v] of Object.entries(object)) {
49514
+ fields[k] = unknownToValueShallow(v);
49515
+ }
49516
+ Object.keys(object).forEach(key => delete object[key]);
49517
+ object.fields = fields;
49518
+ }
49519
+ return originalFromObject.call(this, object);
49520
+ };
49509
49521
  function encode64(protoType, value = {}) {
49510
49522
  return toBase64(protoType.encode(protoType.create(value)).finish());
49511
49523
  }