@sqlanvil/cli 1.32.6 → 1.32.8

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/._LICENSE ADDED
Binary file
package/._NOTICE ADDED
Binary file
package/._README.md ADDED
Binary file
package/._bundle.js ADDED
Binary file
package/._package.json ADDED
Binary file
Binary file
package/bundle.js CHANGED
@@ -6974,6 +6974,7 @@ const sqlanvil = $root.sqlanvil = (() => {
6974
6974
  * @property {sqlanvil.IMysqlOptions|null} [mysql] IncrementalTableConfig mysql
6975
6975
  * @property {sqlanvil.ActionConfig.IncrementalStrategy|null} [incrementalStrategy] IncrementalTableConfig incrementalStrategy
6976
6976
  * @property {Array.<string>|null} [incrementalPredicates] IncrementalTableConfig incrementalPredicates
6977
+ * @property {boolean|null} [preserveGovernanceControls] IncrementalTableConfig preserveGovernanceControls
6977
6978
  */
6978
6979
 
6979
6980
  /**
@@ -7257,6 +7258,23 @@ const sqlanvil = $root.sqlanvil = (() => {
7257
7258
  */
7258
7259
  IncrementalTableConfig.prototype.incrementalPredicates = $util.emptyArray;
7259
7260
 
7261
+ /**
7262
+ * IncrementalTableConfig preserveGovernanceControls.
7263
+ * @member {boolean|null|undefined} preserveGovernanceControls
7264
+ * @memberof sqlanvil.ActionConfig.IncrementalTableConfig
7265
+ * @instance
7266
+ */
7267
+ IncrementalTableConfig.prototype.preserveGovernanceControls = null;
7268
+
7269
+ // OneOf field names bound to virtual getters and setters
7270
+ let $oneOfFields;
7271
+
7272
+ // Virtual OneOf for proto3 optional field
7273
+ Object.defineProperty(IncrementalTableConfig.prototype, "_preserveGovernanceControls", {
7274
+ get: $util.oneOfGetter($oneOfFields = ["preserveGovernanceControls"]),
7275
+ set: $util.oneOfSetter($oneOfFields)
7276
+ });
7277
+
7260
7278
  /**
7261
7279
  * Creates a new IncrementalTableConfig instance using the specified properties.
7262
7280
  * @function create
@@ -7359,6 +7377,8 @@ const sqlanvil = $root.sqlanvil = (() => {
7359
7377
  if (message.incrementalPredicates != null && message.incrementalPredicates.length)
7360
7378
  for (let i = 0; i < message.incrementalPredicates.length; ++i)
7361
7379
  writer.uint32(/* id 32, wireType 2 =*/258).string(message.incrementalPredicates[i]);
7380
+ if (message.preserveGovernanceControls != null && Object.hasOwnProperty.call(message, "preserveGovernanceControls"))
7381
+ writer.uint32(/* id 33, wireType 0 =*/264).bool(message.preserveGovernanceControls);
7362
7382
  return writer;
7363
7383
  };
7364
7384
 
@@ -7585,6 +7605,10 @@ const sqlanvil = $root.sqlanvil = (() => {
7585
7605
  message.incrementalPredicates.push(reader.string());
7586
7606
  break;
7587
7607
  }
7608
+ case 33: {
7609
+ message.preserveGovernanceControls = reader.bool();
7610
+ break;
7611
+ }
7588
7612
  default:
7589
7613
  reader.skipType(tag & 7, long);
7590
7614
  break;
@@ -7791,6 +7815,10 @@ const sqlanvil = $root.sqlanvil = (() => {
7791
7815
  if (!$util.isString(message.incrementalPredicates[i]))
7792
7816
  return "incrementalPredicates: string[] expected";
7793
7817
  }
7818
+ if (message.preserveGovernanceControls != null && Object.hasOwnProperty.call(message, "preserveGovernanceControls")) {
7819
+ if (typeof message.preserveGovernanceControls !== "boolean")
7820
+ return "preserveGovernanceControls: boolean expected";
7821
+ }
7794
7822
  return null;
7795
7823
  };
7796
7824
 
@@ -7996,6 +8024,8 @@ const sqlanvil = $root.sqlanvil = (() => {
7996
8024
  for (let i = 0; i < object.incrementalPredicates.length; ++i)
7997
8025
  message.incrementalPredicates[i] = String(object.incrementalPredicates[i]);
7998
8026
  }
8027
+ if (object.preserveGovernanceControls != null)
8028
+ message.preserveGovernanceControls = Boolean(object.preserveGovernanceControls);
7999
8029
  return message;
8000
8030
  };
8001
8031
 
@@ -8155,6 +8185,11 @@ const sqlanvil = $root.sqlanvil = (() => {
8155
8185
  for (let j = 0; j < message.incrementalPredicates.length; ++j)
8156
8186
  object.incrementalPredicates[j] = message.incrementalPredicates[j];
8157
8187
  }
8188
+ if (message.preserveGovernanceControls != null && Object.hasOwnProperty.call(message, "preserveGovernanceControls")) {
8189
+ object.preserveGovernanceControls = message.preserveGovernanceControls;
8190
+ if (options.oneofs)
8191
+ object._preserveGovernanceControls = "preserveGovernanceControls";
8192
+ }
8158
8193
  return object;
8159
8194
  };
8160
8195
 
@@ -49551,6 +49586,26 @@ const google = $root.google = (() => {
49551
49586
 
49552
49587
  const CONFIGS_PROTO_DOCUMENTATION_URL = "https://github.com/sqlanvil/docs/blob/main/reference/configs.md";
49553
49588
  const REPORT_ISSUE_URL = "https://github.com/sqlanvil/sqlanvil/issues";
49589
+ function isForeignBuffer(candidate) {
49590
+ try {
49591
+ if (!(candidate === null || candidate === void 0 ? void 0 : candidate.prototype)) {
49592
+ return false;
49593
+ }
49594
+ return !(candidate.prototype instanceof Uint8Array);
49595
+ }
49596
+ catch (e) {
49597
+ return true;
49598
+ }
49599
+ }
49600
+ function avoidForeignBufferEncoding(bufferClass) {
49601
+ if (!isForeignBuffer(bufferClass)) {
49602
+ return false;
49603
+ }
49604
+ protobufjs.util.Buffer = null;
49605
+ protobufjs.configure();
49606
+ return true;
49607
+ }
49608
+ avoidForeignBufferEncoding(typeof global === "undefined" ? undefined : global.Buffer);
49554
49609
  var VerifyProtoErrorBehaviour;
49555
49610
  (function (VerifyProtoErrorBehaviour) {
49556
49611
  VerifyProtoErrorBehaviour[VerifyProtoErrorBehaviour["DEFAULT"] = 0] = "DEFAULT";
@@ -50243,14 +50298,21 @@ CREATE OR REPLACE TABLE ${emptyTempTableName} AS (
50243
50298
  SELECT * FROM (${query}) AS insertions LIMIT 0
50244
50299
  );`;
50245
50300
  }
50246
- compareSchemasSql(target, emptyTempTableTarget) {
50247
- return `
50248
- -- Compare schemas
50301
+ declareSchemaChangeVariablesSql(onSchemaChange) {
50302
+ let sql = `
50303
+ -- Declare variables for schema comparison and strategy execution.
50249
50304
  DECLARE sqlanvil_columns ARRAY<STRING>;
50250
50305
  DECLARE temp_table_columns ARRAY<STRUCT<column_name STRING, data_type STRING>>;
50251
50306
  DECLARE columns_added ARRAY<STRUCT<column_name STRING, data_type STRING>>;
50252
- DECLARE columns_removed ARRAY<STRING>;
50253
-
50307
+ DECLARE columns_removed ARRAY<STRING>;`;
50308
+ if (onSchemaChange === sqlanvil.OnSchemaChange.SYNCHRONIZE) {
50309
+ sql += `\nDECLARE invalid_removed_columns ARRAY<STRING>;`;
50310
+ }
50311
+ return sql;
50312
+ }
50313
+ compareSchemasSql(target, emptyTempTableTarget) {
50314
+ return `
50315
+ -- Compare schemas
50254
50316
  SET sqlanvil_columns = (
50255
50317
  SELECT IFNULL(ARRAY_AGG(DISTINCT column_name), [])
50256
50318
  FROM \`${target.database}.${target.schema}.INFORMATION_SCHEMA.COLUMNS\`
@@ -50305,7 +50367,6 @@ ${this.alterTableAddColumnsSql(qualifiedTargetTableName)}
50305
50367
  case sqlanvil.OnSchemaChange.SYNCHRONIZE:
50306
50368
  const uniqueKeys = table.uniqueKey || [];
50307
50369
  sql += `
50308
- DECLARE invalid_removed_columns ARRAY<STRING>;
50309
50370
  SET invalid_removed_columns = (
50310
50371
  SELECT IFNULL(ARRAY_AGG(col), []) FROM UNNEST(columns_removed) AS col WHERE col IN UNNEST(${JSON.stringify(uniqueKeys)})
50311
50372
  );
@@ -50353,7 +50414,9 @@ DROP TABLE IF EXISTS ${emptyTempTableName};
50353
50414
  incrementalSchemaChangeBody(table, qualifiedTargetTableName, emptyTempTableTarget) {
50354
50415
  const emptyTempTableName = this.resolveTarget(emptyTempTableTarget);
50355
50416
  const query = this.getIncrementalQuery(table);
50417
+ const onSchemaChange = table.onSchemaChange || sqlanvil.OnSchemaChange.IGNORE;
50356
50418
  const statements = [
50419
+ this.declareSchemaChangeVariablesSql(onSchemaChange),
50357
50420
  this.createEmptyTempTableSql(emptyTempTableName, query),
50358
50421
  this.compareSchemasSql(table.target, emptyTempTableTarget),
50359
50422
  this.applySchemaChangeStrategySql(table, qualifiedTargetTableName),
@@ -51096,8 +51159,8 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
51096
51159
  .filter(validationQuery => !!validationQuery.query);
51097
51160
  }
51098
51161
 
51099
- const version = "1.32.6";
51100
- const dataformVersion = "3.0.69";
51162
+ const version = "1.32.8";
51163
+ const dataformVersion = "3.0.70";
51101
51164
 
51102
51165
  async function build(compiledGraph, runConfig, dbadapter) {
51103
51166
  const prunedGraph = prune(compiledGraph, runConfig);
@@ -55178,7 +55241,7 @@ function formatStackTraceForQuietCompilation(compileError) {
55178
55241
  }
55179
55242
  return "";
55180
55243
  }
55181
- function printCompiledGraphErrors(graphErrors, quietCompilation) {
55244
+ function printCompiledGraphErrors(graphErrors, quietCompilation = false) {
55182
55245
  if (graphErrors.compilationErrors && graphErrors.compilationErrors.length > 0) {
55183
55246
  printError("Compilation errors:", 1);
55184
55247
  graphErrors.compilationErrors.forEach(compileError => {
@@ -55595,10 +55658,11 @@ const timeoutOption = option("timeout", {
55595
55658
  default: null,
55596
55659
  coerce: (rawTimeoutString) => rawTimeoutString ? parseDuration__default["default"](rawTimeoutString) : null
55597
55660
  });
55598
- const noArtifactsOption = option("no-artifacts", {
55599
- describe: "Skip writing the queryable Parquet artifacts under target/ (catalog on compile; run history " +
55600
- "on run).",
55601
- type: "boolean"
55661
+ const artifactsOption = option("artifacts", {
55662
+ describe: "Write the queryable Parquet artifacts under target/ (catalog on compile; run history on " +
55663
+ "run). Pass --no-artifacts to skip them.",
55664
+ type: "boolean",
55665
+ default: true
55602
55666
  });
55603
55667
  const quietCompileOption = option("quiet", {
55604
55668
  describe: "Less verbose compilation output. Example usage: 'sqlanvil compile --quiet'",
@@ -55658,7 +55722,7 @@ const compileCommand = {
55658
55722
  compileTagsOption,
55659
55723
  compileIncludeDepsOption,
55660
55724
  compileIncludeDependentsOption,
55661
- noArtifactsOption,
55725
+ artifactsOption,
55662
55726
  option(verboseOptionName, {
55663
55727
  describe: "Enable verbose compilation output. Example usage: 'sqlanvil compile --verbose'",
55664
55728
  type: "boolean",
@@ -55705,7 +55769,7 @@ const compileCommand = {
55705
55769
  printCompiledGraphErrors(compiledGraph.graphErrors, argv[quietCompileOption.name]);
55706
55770
  return true;
55707
55771
  }
55708
- if (!argv[noArtifactsOption.name]) {
55772
+ if (argv[artifactsOption.name] !== false) {
55709
55773
  await safeWriteArtifacts(compiledGraph, projectDir, { warn: print });
55710
55774
  }
55711
55775
  return false;
@@ -60170,7 +60234,7 @@ async function runValidate(argv) {
60170
60234
  timeoutMillis: argv[timeoutOption.name] || undefined
60171
60235
  });
60172
60236
  if (compiledGraphHasErrors(compiledGraph)) {
60173
- printCompiledGraphErrors(compiledGraph.graphErrors, argv[quietCompileOption.name]);
60237
+ printCompiledGraphErrors(compiledGraph.graphErrors);
60174
60238
  return 1;
60175
60239
  }
60176
60240
  if (!argv[jsonOutputOption.name]) {
@@ -60317,7 +60381,7 @@ const runCommand = {
60317
60381
  executionTimeoutOption,
60318
60382
  tagsOption,
60319
60383
  bigqueryJobLabelsOption,
60320
- noArtifactsOption,
60384
+ artifactsOption,
60321
60385
  ...ProjectConfigOptions.allYargsOptions
60322
60386
  ],
60323
60387
  processFn: async (argv) => {
@@ -60370,7 +60434,7 @@ const runCommand = {
60370
60434
  }
60371
60435
  }
60372
60436
  if (compiledGraphHasErrors(compiledGraph)) {
60373
- printCompiledGraphErrors(compiledGraph.graphErrors, argv[quietCompileOption.name]);
60437
+ printCompiledGraphErrors(compiledGraph.graphErrors);
60374
60438
  return 1;
60375
60439
  }
60376
60440
  const warehouse = compiledGraph.projectConfig.warehouse || "bigquery";
@@ -60483,7 +60547,7 @@ const runCommand = {
60483
60547
  printError("Run cancelled.");
60484
60548
  }
60485
60549
  }
60486
- if (!argv[noArtifactsOption.name]) {
60550
+ if (argv[artifactsOption.name] !== false) {
60487
60551
  await safeWriteArtifacts(compiledGraph, argv[projectDirOption.name], {
60488
60552
  runResult,
60489
60553
  runId: Date.now(),
@@ -60514,7 +60578,7 @@ const testCommand = {
60514
60578
  timeoutMillis: argv[timeoutOption.name] || undefined
60515
60579
  });
60516
60580
  if (compiledGraphHasErrors(compiledGraph)) {
60517
- printCompiledGraphErrors(compiledGraph.graphErrors, argv[quietCompileOption.name]);
60581
+ printCompiledGraphErrors(compiledGraph.graphErrors);
60518
60582
  return 1;
60519
60583
  }
60520
60584
  if (!argv[jsonOutputOption.name]) {
package/package.json CHANGED
@@ -46,7 +46,10 @@
46
46
  "**/wrap-ansi": "7.0.0",
47
47
  "**/string-width": "4.1.0",
48
48
  "**/@eslint-community/eslint-utils": "4.9.1",
49
- "**/@ungap/structured-clone": "1.3.1"
49
+ "**/@ungap/structured-clone": "1.3.1",
50
+ "**/brace-expansion": "5.0.9",
51
+ "**/linkify-it": "^5.0.2",
52
+ "**/braces": "^3.0.3"
50
53
  },
51
54
  "homepage": "https://sqlanvil.com",
52
55
  "repository": {
@@ -73,7 +76,7 @@
73
76
  "bin": {
74
77
  "sqlanvil": "bundle.js"
75
78
  },
76
- "version": "1.32.6",
79
+ "version": "1.32.8",
77
80
  "name": "@sqlanvil/cli",
78
81
  "description": "sqlanvil command line interface.",
79
82
  "main": "bundle.js"
package/worker_bundle.js CHANGED
@@ -6912,6 +6912,7 @@ const sqlanvil = $root.sqlanvil = (() => {
6912
6912
  * @property {sqlanvil.IMysqlOptions|null} [mysql] IncrementalTableConfig mysql
6913
6913
  * @property {sqlanvil.ActionConfig.IncrementalStrategy|null} [incrementalStrategy] IncrementalTableConfig incrementalStrategy
6914
6914
  * @property {Array.<string>|null} [incrementalPredicates] IncrementalTableConfig incrementalPredicates
6915
+ * @property {boolean|null} [preserveGovernanceControls] IncrementalTableConfig preserveGovernanceControls
6915
6916
  */
6916
6917
 
6917
6918
  /**
@@ -7195,6 +7196,23 @@ const sqlanvil = $root.sqlanvil = (() => {
7195
7196
  */
7196
7197
  IncrementalTableConfig.prototype.incrementalPredicates = $util.emptyArray;
7197
7198
 
7199
+ /**
7200
+ * IncrementalTableConfig preserveGovernanceControls.
7201
+ * @member {boolean|null|undefined} preserveGovernanceControls
7202
+ * @memberof sqlanvil.ActionConfig.IncrementalTableConfig
7203
+ * @instance
7204
+ */
7205
+ IncrementalTableConfig.prototype.preserveGovernanceControls = null;
7206
+
7207
+ // OneOf field names bound to virtual getters and setters
7208
+ let $oneOfFields;
7209
+
7210
+ // Virtual OneOf for proto3 optional field
7211
+ Object.defineProperty(IncrementalTableConfig.prototype, "_preserveGovernanceControls", {
7212
+ get: $util.oneOfGetter($oneOfFields = ["preserveGovernanceControls"]),
7213
+ set: $util.oneOfSetter($oneOfFields)
7214
+ });
7215
+
7198
7216
  /**
7199
7217
  * Creates a new IncrementalTableConfig instance using the specified properties.
7200
7218
  * @function create
@@ -7297,6 +7315,8 @@ const sqlanvil = $root.sqlanvil = (() => {
7297
7315
  if (message.incrementalPredicates != null && message.incrementalPredicates.length)
7298
7316
  for (let i = 0; i < message.incrementalPredicates.length; ++i)
7299
7317
  writer.uint32(/* id 32, wireType 2 =*/258).string(message.incrementalPredicates[i]);
7318
+ if (message.preserveGovernanceControls != null && Object.hasOwnProperty.call(message, "preserveGovernanceControls"))
7319
+ writer.uint32(/* id 33, wireType 0 =*/264).bool(message.preserveGovernanceControls);
7300
7320
  return writer;
7301
7321
  };
7302
7322
 
@@ -7523,6 +7543,10 @@ const sqlanvil = $root.sqlanvil = (() => {
7523
7543
  message.incrementalPredicates.push(reader.string());
7524
7544
  break;
7525
7545
  }
7546
+ case 33: {
7547
+ message.preserveGovernanceControls = reader.bool();
7548
+ break;
7549
+ }
7526
7550
  default:
7527
7551
  reader.skipType(tag & 7, long);
7528
7552
  break;
@@ -7729,6 +7753,10 @@ const sqlanvil = $root.sqlanvil = (() => {
7729
7753
  if (!$util.isString(message.incrementalPredicates[i]))
7730
7754
  return "incrementalPredicates: string[] expected";
7731
7755
  }
7756
+ if (message.preserveGovernanceControls != null && Object.hasOwnProperty.call(message, "preserveGovernanceControls")) {
7757
+ if (typeof message.preserveGovernanceControls !== "boolean")
7758
+ return "preserveGovernanceControls: boolean expected";
7759
+ }
7732
7760
  return null;
7733
7761
  };
7734
7762
 
@@ -7934,6 +7962,8 @@ const sqlanvil = $root.sqlanvil = (() => {
7934
7962
  for (let i = 0; i < object.incrementalPredicates.length; ++i)
7935
7963
  message.incrementalPredicates[i] = String(object.incrementalPredicates[i]);
7936
7964
  }
7965
+ if (object.preserveGovernanceControls != null)
7966
+ message.preserveGovernanceControls = Boolean(object.preserveGovernanceControls);
7937
7967
  return message;
7938
7968
  };
7939
7969
 
@@ -8093,6 +8123,11 @@ const sqlanvil = $root.sqlanvil = (() => {
8093
8123
  for (let j = 0; j < message.incrementalPredicates.length; ++j)
8094
8124
  object.incrementalPredicates[j] = message.incrementalPredicates[j];
8095
8125
  }
8126
+ if (message.preserveGovernanceControls != null && Object.hasOwnProperty.call(message, "preserveGovernanceControls")) {
8127
+ object.preserveGovernanceControls = message.preserveGovernanceControls;
8128
+ if (options.oneofs)
8129
+ object._preserveGovernanceControls = "preserveGovernanceControls";
8130
+ }
8096
8131
  return object;
8097
8132
  };
8098
8133
 
@@ -49487,6 +49522,26 @@ const google = $root.google = (() => {
49487
49522
  return google;
49488
49523
  })();
49489
49524
 
49525
+ function isForeignBuffer(candidate) {
49526
+ try {
49527
+ if (!(candidate === null || candidate === void 0 ? void 0 : candidate.prototype)) {
49528
+ return false;
49529
+ }
49530
+ return !(candidate.prototype instanceof Uint8Array);
49531
+ }
49532
+ catch (e) {
49533
+ return true;
49534
+ }
49535
+ }
49536
+ function avoidForeignBufferEncoding(bufferClass) {
49537
+ if (!isForeignBuffer(bufferClass)) {
49538
+ return false;
49539
+ }
49540
+ protobufjs.util.Buffer = null;
49541
+ protobufjs.configure();
49542
+ return true;
49543
+ }
49544
+ avoidForeignBufferEncoding(typeof global === "undefined" ? undefined : global.Buffer);
49490
49545
  var VerifyProtoErrorBehaviour;
49491
49546
  (function (VerifyProtoErrorBehaviour) {
49492
49547
  VerifyProtoErrorBehaviour[VerifyProtoErrorBehaviour["DEFAULT"] = 0] = "DEFAULT";