@sqlanvil/cli 1.3.0 → 1.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.
Files changed (2) hide show
  1. package/bundle.js +241 -329
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -38653,7 +38653,7 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
38653
38653
  .filter(validationQuery => !!validationQuery.query);
38654
38654
  }
38655
38655
 
38656
- const version = "1.3.0";
38656
+ const version = "1.4.0";
38657
38657
  const dataformVersion = "3.0.59";
38658
38658
 
38659
38659
  async function build(compiledGraph, runConfig, dbadapter) {
@@ -41279,6 +41279,12 @@ function getBigQueryCredentials() {
41279
41279
  };
41280
41280
  }
41281
41281
 
41282
+ function option(name, opt, check) {
41283
+ return { name, option: opt, check };
41284
+ }
41285
+ function positionalOption(name, opt, check) {
41286
+ return { name, option: opt, check };
41287
+ }
41282
41288
  function createYargsCli(cli) {
41283
41289
  let yargsChain = yargs__default["default"](fixArgvForHelp());
41284
41290
  for (const command of cli.commands) {
@@ -41984,16 +41990,14 @@ function postProcessFormattedSqlx(formattedSql) {
41984
41990
 
41985
41991
  const RECOMPILE_DELAY = 500;
41986
41992
  process.on("unhandledRejection", async (reason) => {
41987
- printError(`Unhandled promise rejection: ${(reason === null || reason === void 0 ? void 0 : reason.stack) || reason}`);
41993
+ var _a;
41994
+ printError(`Unhandled promise rejection: ${((_a = reason) === null || _a === void 0 ? void 0 : _a.stack) || reason}`);
41995
+ });
41996
+ const projectDirOption = positionalOption("project-dir", {
41997
+ describe: "The sqlanvil project directory.",
41998
+ default: ".",
41999
+ coerce: actuallyResolve
41988
42000
  });
41989
- const projectDirOption = {
41990
- name: "project-dir",
41991
- option: {
41992
- describe: "The sqlanvil project directory.",
41993
- default: ".",
41994
- coerce: actuallyResolve
41995
- }
41996
- };
41997
42001
  const projectDirMustExistOption = Object.assign(Object.assign({}, projectDirOption), { check: (argv) => {
41998
42002
  assertPathExists(argv[projectDirOption.name]);
41999
42003
  const workflowSettingsYamlPath = path__namespace.resolve(argv[projectDirOption.name], "workflow_settings.yaml");
@@ -42001,144 +42005,104 @@ const projectDirMustExistOption = Object.assign(Object.assign({}, projectDirOpti
42001
42005
  throw new Error(`${argv[projectDirOption.name]} does not appear to be a sqlanvil directory (missing workflow_settings.yaml file).`);
42002
42006
  }
42003
42007
  } });
42004
- const fullRefreshOption = {
42005
- name: "full-refresh",
42006
- option: {
42007
- describe: "Forces incremental tables to be rebuilt from scratch.",
42008
- type: "boolean",
42009
- default: false
42010
- }
42011
- };
42012
- const actionsOption = {
42013
- name: "actions",
42014
- option: {
42015
- describe: "A list of action names or patterns to run. Can include '*' wildcards.",
42016
- type: "array",
42017
- coerce: (rawActions) => rawActions.map(actions => actions.split(",")).flat()
42018
- }
42019
- };
42020
- const tagsOption = {
42021
- name: "tags",
42022
- option: {
42023
- describe: "A list of tags to filter the actions to run.",
42024
- type: "array",
42025
- coerce: (rawTags) => rawTags.map(tags => tags.split(",")).flat()
42026
- }
42027
- };
42028
- const includeDepsOption = {
42029
- name: "include-deps",
42030
- option: {
42031
- describe: "If set, dependencies for selected actions will also be run.",
42032
- type: "boolean"
42033
- },
42034
- check: (argv) => {
42035
- if (argv[includeDepsOption.name] && !(argv[actionsOption.name] || argv[tagsOption.name])) {
42036
- throw new Error(`The --${includeDepsOption.name} flag should only be supplied along with --${actionsOption.name} or --${tagsOption.name}.`);
42037
- }
42038
- }
42039
- };
42040
- const includeDependentsOption = {
42041
- name: "include-dependents",
42042
- option: {
42043
- describe: "If set, dependents (downstream) for selected actions will also be run.",
42044
- type: "boolean"
42045
- },
42046
- check: (argv) => {
42047
- if (argv[includeDependentsOption.name] &&
42048
- !(argv[actionsOption.name] || argv[tagsOption.name])) {
42049
- throw new Error(`The --${includeDependentsOption.name} flag should only be supplied along with --${actionsOption.name} or --${tagsOption.name}.`);
42050
- }
42051
- }
42052
- };
42053
- const credentialsOption = {
42054
- name: "credentials",
42055
- option: {
42056
- describe: "The location of the credentials JSON file to use.",
42057
- default: CREDENTIALS_FILENAME
42058
- },
42059
- check: (argv) => getCredentialsPath(argv[projectDirOption.name], argv[credentialsOption.name])
42060
- };
42061
- const jsonOutputOption = {
42062
- name: "json",
42063
- option: {
42064
- describe: "Outputs a JSON representation of the compiled project or test results.",
42065
- type: "boolean",
42066
- default: false
42067
- }
42068
- };
42069
- const dotOutputOption = {
42070
- name: "dot",
42071
- option: {
42072
- describe: "Outputs a dot representation of the compiled project.",
42073
- type: "boolean",
42074
- default: false,
42075
- },
42076
- check: (argv) => {
42077
- if (argv.json && argv.dot) {
42078
- throw new Error("Arguments --json and --dot are mutually exclusive.");
42079
- }
42080
- }
42081
- };
42082
- const timeoutOption = {
42083
- name: "timeout",
42084
- option: {
42085
- describe: "Duration to allow project compilation to complete. Examples: '1s', '10m', etc.",
42086
- type: "string",
42087
- default: null,
42088
- coerce: (rawTimeoutString) => rawTimeoutString ? parseDuration__default["default"](rawTimeoutString) : null
42089
- }
42090
- };
42091
- const jobPrefixOption = {
42092
- name: "job-prefix",
42093
- option: {
42094
- describe: "Adds an additional prefix in the form of `sqlanvil-${jobPrefix}-`.",
42095
- type: "string",
42096
- default: null
42008
+ const fullRefreshOption = option("full-refresh", {
42009
+ describe: "Forces incremental tables to be rebuilt from scratch.",
42010
+ type: "boolean",
42011
+ default: false
42012
+ });
42013
+ const actionsOption = option("actions", {
42014
+ describe: "A list of action names or patterns to run. Can include '*' wildcards.",
42015
+ type: "array",
42016
+ coerce: (rawActions) => rawActions.map(actions => actions.split(",")).flat()
42017
+ });
42018
+ const tagsOption = option("tags", {
42019
+ describe: "A list of tags to filter the actions to run.",
42020
+ type: "array",
42021
+ coerce: (rawTags) => rawTags.map(tags => tags.split(",")).flat()
42022
+ });
42023
+ const includeDepsOption = option("include-deps", {
42024
+ describe: "If set, dependencies for selected actions will also be run.",
42025
+ type: "boolean"
42026
+ }, (argv) => {
42027
+ if (argv[includeDepsOption.name] && !(argv[actionsOption.name] || argv[tagsOption.name])) {
42028
+ throw new Error(`The --${includeDepsOption.name} flag should only be supplied along with --${actionsOption.name} or --${tagsOption.name}.`);
42097
42029
  }
42098
- };
42099
- const bigqueryJobLabelsOption = {
42100
- name: "job-labels",
42101
- option: {
42102
- describe: "Comma-separated list of labels to add to BigQuery jobs, e.g. 'key1=val1,key2=val2'.",
42103
- type: "string",
42104
- coerce: (raw) => {
42105
- const labels = {};
42106
- raw === null || raw === void 0 ? void 0 : raw.split(",").forEach(kv => {
42107
- if (!kv) {
42108
- return;
42109
- }
42110
- const [key, ...rest] = kv.split("=");
42111
- labels[key] = rest.join("=") || "";
42112
- });
42113
- return labels;
42114
- }
42030
+ });
42031
+ const includeDependentsOption = option("include-dependents", {
42032
+ describe: "If set, dependents (downstream) for selected actions will also be run.",
42033
+ type: "boolean"
42034
+ }, (argv) => {
42035
+ if (argv[includeDependentsOption.name] &&
42036
+ !(argv[actionsOption.name] || argv[tagsOption.name])) {
42037
+ throw new Error(`The --${includeDependentsOption.name} flag should only be supplied along with --${actionsOption.name} or --${tagsOption.name}.`);
42115
42038
  }
42116
- };
42117
- const quietCompileOption = {
42118
- name: "quiet",
42119
- option: {
42120
- describe: "Less verbose compilation output. Example usage: 'sqlanvil compile --quiet'",
42121
- type: "boolean",
42122
- default: false
42039
+ });
42040
+ const compileActionsOption = Object.assign(Object.assign({}, actionsOption), { option: Object.assign(Object.assign({}, actionsOption.option), { describe: "A list of action names or patterns to include in the output. Can include '*' wildcards." }) });
42041
+ const compileTagsOption = Object.assign(Object.assign({}, tagsOption), { option: Object.assign(Object.assign({}, tagsOption.option), { describe: "A list of tags to filter the output to." }) });
42042
+ const compileIncludeDepsOption = Object.assign(Object.assign({}, includeDepsOption), { option: Object.assign(Object.assign({}, includeDepsOption.option), { describe: "If set, dependencies of selected actions are also included in the output." }) });
42043
+ const compileIncludeDependentsOption = Object.assign(Object.assign({}, includeDependentsOption), { option: Object.assign(Object.assign({}, includeDependentsOption.option), { describe: "If set, dependents (downstream) of selected actions are also included in the output." }) });
42044
+ const credentialsOption = option("credentials", {
42045
+ describe: "The location of the credentials JSON file to use.",
42046
+ default: CREDENTIALS_FILENAME
42047
+ }, (argv) => {
42048
+ getCredentialsPath(argv[projectDirOption.name], argv.credentials);
42049
+ });
42050
+ const jsonOutputOption = option("json", {
42051
+ describe: "Outputs a JSON representation of the compiled project or test results.",
42052
+ type: "boolean",
42053
+ default: false
42054
+ });
42055
+ const dotOutputOption = option("dot", {
42056
+ describe: "Outputs a dot representation of the compiled project.",
42057
+ type: "boolean",
42058
+ default: false
42059
+ }, (argv) => {
42060
+ if (argv.json && argv.dot) {
42061
+ throw new Error("Arguments --json and --dot are mutually exclusive.");
42123
42062
  }
42124
- };
42125
- const icebergOption = {
42126
- name: "iceberg",
42127
- option: {
42128
- describe: "Initialize the project with workflow-level Iceberg tables configuration.",
42129
- type: "boolean",
42130
- default: false,
42131
- },
42132
- };
42133
- const warehouseOption = {
42134
- name: "warehouse",
42135
- option: {
42136
- describe: "Target warehouse for the new project.",
42137
- type: "string",
42138
- choices: ["bigquery", "postgres", "supabase"],
42139
- default: "supabase"
42063
+ });
42064
+ const timeoutOption = option("timeout", {
42065
+ describe: "Duration to allow project compilation to complete. Examples: '1s', '10m', etc.",
42066
+ type: "string",
42067
+ default: null,
42068
+ coerce: (rawTimeoutString) => rawTimeoutString ? parseDuration__default["default"](rawTimeoutString) : null
42069
+ });
42070
+ const jobPrefixOption = option("job-prefix", {
42071
+ describe: "Adds an additional prefix in the form of `sqlanvil-${jobPrefix}-`.",
42072
+ type: "string",
42073
+ default: null
42074
+ });
42075
+ const bigqueryJobLabelsOption = option("job-labels", {
42076
+ describe: "Comma-separated list of labels to add to BigQuery jobs, e.g. 'key1=val1,key2=val2'.",
42077
+ type: "string",
42078
+ coerce: (raw) => {
42079
+ const labels = {};
42080
+ raw === null || raw === void 0 ? void 0 : raw.split(",").forEach(kv => {
42081
+ if (!kv) {
42082
+ return;
42083
+ }
42084
+ const [key, ...rest] = kv.split("=");
42085
+ labels[key] = rest.join("=") || "";
42086
+ });
42087
+ return labels;
42140
42088
  }
42141
- };
42089
+ });
42090
+ const quietCompileOption = option("quiet", {
42091
+ describe: "Less verbose compilation output. Example usage: 'sqlanvil compile --quiet'",
42092
+ type: "boolean",
42093
+ default: false
42094
+ });
42095
+ const icebergOption = option("iceberg", {
42096
+ describe: "Initialize the project with workflow-level Iceberg tables configuration.",
42097
+ type: "boolean",
42098
+ default: false
42099
+ });
42100
+ const warehouseOption = option("warehouse", {
42101
+ describe: "Target warehouse for the new project.",
42102
+ type: "string",
42103
+ choices: ["bigquery", "postgres", "supabase"],
42104
+ default: "supabase"
42105
+ });
42142
42106
  const testConnectionOptionName = "test-connection";
42143
42107
  const watchOptionName = "watch";
42144
42108
  const verboseOptionName = "verbose";
@@ -42157,7 +42121,7 @@ function runCli() {
42157
42121
  description: "Show help. If [command] is specified, the help is for the given command.",
42158
42122
  positionalOptions: [],
42159
42123
  options: [],
42160
- processFn: async (argv) => {
42124
+ processFn: async () => {
42161
42125
  return 0;
42162
42126
  }
42163
42127
  },
@@ -42167,33 +42131,25 @@ function runCli() {
42167
42131
  description: "Create a new sqlanvil project (BigQuery, Postgres, or Supabase).",
42168
42132
  positionalOptions: [
42169
42133
  projectDirOption,
42170
- {
42171
- name: ProjectConfigOptions.defaultDatabase.name,
42172
- option: {
42173
- describe: "The default database to use, equivalent to Google Cloud Project ID."
42174
- },
42175
- check: (argv) => {
42176
- const warehouse = argv[warehouseOption.name] || "bigquery";
42177
- if (warehouse === "bigquery" && !argv[ProjectConfigOptions.defaultDatabase.name]) {
42178
- throw new Error(`The ${ProjectConfigOptions.defaultDatabase.name} positional argument is ` +
42179
- `required for BigQuery projects. Use "sqlanvil help init" for more info.`);
42180
- }
42134
+ positionalOption(ProjectConfigOptions.defaultDatabase.name, {
42135
+ describe: "The default database to use, equivalent to Google Cloud Project ID."
42136
+ }, (argv) => {
42137
+ const warehouse = argv[warehouseOption.name] || "bigquery";
42138
+ if (warehouse === "bigquery" && !argv[ProjectConfigOptions.defaultDatabase.name]) {
42139
+ throw new Error(`The ${ProjectConfigOptions.defaultDatabase.name} positional argument is ` +
42140
+ `required for BigQuery projects. Use "sqlanvil help init" for more info.`);
42181
42141
  }
42182
- },
42183
- {
42184
- name: ProjectConfigOptions.defaultLocation.name,
42185
- option: {
42186
- describe: "The default location to use. See " +
42187
- "https://cloud.google.com/bigquery/docs/locations for supported values."
42188
- },
42189
- check: (argv) => {
42190
- const warehouse = argv[warehouseOption.name] || "bigquery";
42191
- if (warehouse === "bigquery" && !argv[ProjectConfigOptions.defaultLocation.name]) {
42192
- throw new Error(`The ${ProjectConfigOptions.defaultLocation.name} positional argument is ` +
42193
- `required for BigQuery projects. Use "sqlanvil help init" for more info.`);
42194
- }
42142
+ }),
42143
+ positionalOption(ProjectConfigOptions.defaultLocation.name, {
42144
+ describe: "The default location to use. See " +
42145
+ "https://cloud.google.com/bigquery/docs/locations for supported values."
42146
+ }, (argv) => {
42147
+ const warehouse = argv[warehouseOption.name] || "bigquery";
42148
+ if (warehouse === "bigquery" && !argv[ProjectConfigOptions.defaultLocation.name]) {
42149
+ throw new Error(`The ${ProjectConfigOptions.defaultLocation.name} positional argument is ` +
42150
+ `required for BigQuery projects. Use "sqlanvil help init" for more info.`);
42195
42151
  }
42196
- }
42152
+ })
42197
42153
  ],
42198
42154
  options: [warehouseOption, icebergOption],
42199
42155
  processFn: async (argv) => {
@@ -42234,14 +42190,11 @@ function runCli() {
42234
42190
  `accessing BigQuery.`,
42235
42191
  positionalOptions: [projectDirMustExistOption],
42236
42192
  options: [
42237
- {
42238
- name: testConnectionOptionName,
42239
- option: {
42240
- describe: "If true, a test query will be run using your final credentials.",
42241
- type: "boolean",
42242
- default: true
42243
- }
42244
- }
42193
+ option(testConnectionOptionName, {
42194
+ describe: "If true, a test query will be run using your final credentials.",
42195
+ type: "boolean",
42196
+ default: true
42197
+ })
42245
42198
  ],
42246
42199
  processFn: async (argv) => {
42247
42200
  const finalCredentials = getBigQueryCredentials();
@@ -42277,36 +42230,34 @@ function runCli() {
42277
42230
  description: "Compile the sqlanvil project. Produces JSON output describing the non-executable graph.",
42278
42231
  positionalOptions: [projectDirMustExistOption],
42279
42232
  options: [
42280
- {
42281
- name: watchOptionName,
42282
- option: {
42283
- describe: "Whether to watch the changes in the project directory.",
42284
- type: "boolean",
42285
- default: false
42286
- }
42287
- },
42233
+ option(watchOptionName, {
42234
+ describe: "Whether to watch the changes in the project directory.",
42235
+ type: "boolean",
42236
+ default: false
42237
+ }),
42288
42238
  jsonOutputOption,
42289
42239
  dotOutputOption,
42290
42240
  timeoutOption,
42291
42241
  quietCompileOption,
42292
- {
42293
- name: verboseOptionName,
42294
- option: {
42295
- describe: "Enable verbose compilation output. Example usage: 'sqlanvil compile --verbose'",
42296
- type: "boolean",
42297
- default: false
42298
- },
42299
- check: (argv) => {
42300
- if (argv.quiet && argv.verbose) {
42301
- throw new Error("Arguments --verbose and --quiet are mutually exclusive.");
42302
- }
42242
+ compileActionsOption,
42243
+ compileTagsOption,
42244
+ compileIncludeDepsOption,
42245
+ compileIncludeDependentsOption,
42246
+ option(verboseOptionName, {
42247
+ describe: "Enable verbose compilation output. Example usage: 'sqlanvil compile --verbose'",
42248
+ type: "boolean",
42249
+ default: false
42250
+ }, (argv) => {
42251
+ if (argv.quiet && argv.verbose) {
42252
+ throw new Error("Arguments --verbose and --quiet are mutually exclusive.");
42303
42253
  }
42304
- },
42254
+ }),
42305
42255
  ...ProjectConfigOptions.allYargsOptions
42306
42256
  ],
42307
42257
  processFn: async (argv) => {
42308
42258
  const projectDir = argv[projectDirMustExistOption.name];
42309
42259
  async function compileAndPrint() {
42260
+ var _a, _b;
42310
42261
  let outputType = compiledGraphOutputType.Summary;
42311
42262
  if (argv[jsonOutputOption.name]) {
42312
42263
  outputType = compiledGraphOutputType.Json;
@@ -42323,7 +42274,16 @@ function runCli() {
42323
42274
  timeoutMillis: argv[timeoutOption.name] || undefined,
42324
42275
  verbose: argv[verboseOptionName] || false
42325
42276
  });
42326
- printCompiledGraph(compiledGraph, outputType, argv[quietCompileOption.name]);
42277
+ const hasSelector = ((_a = argv[actionsOption.name]) === null || _a === void 0 ? void 0 : _a.length) > 0 || ((_b = argv[tagsOption.name]) === null || _b === void 0 ? void 0 : _b.length) > 0;
42278
+ const outputGraph = hasSelector && !compiledGraphHasErrors(compiledGraph)
42279
+ ? prune(compiledGraph, {
42280
+ actions: argv[actionsOption.name],
42281
+ tags: argv[tagsOption.name],
42282
+ includeDependencies: argv[includeDepsOption.name],
42283
+ includeDependents: argv[includeDependentsOption.name]
42284
+ })
42285
+ : compiledGraph;
42286
+ printCompiledGraph(outputGraph, outputType, argv[quietCompileOption.name]);
42327
42287
  if (compiledGraphHasErrors(compiledGraph)) {
42328
42288
  print("");
42329
42289
  printCompiledGraphErrors(compiledGraph.graphErrors, argv[quietCompileOption.name]);
@@ -42435,28 +42395,19 @@ function runCli() {
42435
42395
  description: "Run the sqlanvil project.",
42436
42396
  positionalOptions: [projectDirMustExistOption],
42437
42397
  options: [
42438
- {
42439
- name: dryRunOptionName,
42440
- option: {
42441
- describe: "If set, BigQuery will validate the run SQL without applying changes to the warehouse.",
42442
- type: "boolean"
42443
- }
42444
- },
42445
- {
42446
- name: runTestsOptionName,
42447
- option: {
42448
- describe: "If set, the project's unit tests are required to pass before running the project.",
42449
- type: "boolean"
42450
- }
42451
- },
42452
- {
42453
- name: actionRetryLimitName,
42454
- option: {
42455
- describe: "If set, idempotent actions will be retried up to the limit.",
42456
- type: "number",
42457
- default: 0
42458
- }
42459
- },
42398
+ option(dryRunOptionName, {
42399
+ describe: "If set, BigQuery will validate the run SQL without applying changes to the warehouse.",
42400
+ type: "boolean"
42401
+ }),
42402
+ option(runTestsOptionName, {
42403
+ describe: "If set, the project's unit tests are required to pass before running the project.",
42404
+ type: "boolean"
42405
+ }),
42406
+ option(actionRetryLimitName, {
42407
+ describe: "If set, idempotent actions will be retried up to the limit.",
42408
+ type: "number",
42409
+ default: 0
42410
+ }),
42460
42411
  actionsOption,
42461
42412
  credentialsOption,
42462
42413
  fullRefreshOption,
@@ -42580,14 +42531,11 @@ function runCli() {
42580
42531
  positionalOptions: [projectDirMustExistOption],
42581
42532
  options: [
42582
42533
  actionsOption,
42583
- {
42584
- name: checkOptionName,
42585
- option: {
42586
- describe: "Check if files are formatted correctly without modifying them.",
42587
- type: "boolean",
42588
- default: false
42589
- }
42590
- }
42534
+ option(checkOptionName, {
42535
+ describe: "Check if files are formatted correctly without modifying them.",
42536
+ type: "boolean",
42537
+ default: false
42538
+ })
42591
42539
  ],
42592
42540
  processFn: async (argv) => {
42593
42541
  let actions = ["{definitions,includes}/**/*.{js,sqlx}"];
@@ -42648,24 +42596,19 @@ function runCli() {
42648
42596
  format: `introspect <connection> <tableRef> [${projectDirOption.name}]`,
42649
42597
  description: "Read a source table's schema from a connection and write a declaration .sqlx with columnTypes.",
42650
42598
  positionalOptions: [
42651
- {
42652
- name: "connection",
42653
- option: { describe: "Connection name (from workflow_settings.yaml connections)." }
42654
- },
42655
- {
42656
- name: "tableRef",
42657
- option: { describe: "Source table as schema.table (or just table)." }
42658
- },
42599
+ positionalOption("connection", {
42600
+ describe: "Connection name (from workflow_settings.yaml connections)."
42601
+ }),
42602
+ positionalOption("tableRef", {
42603
+ describe: "Source table as schema.table (or just table)."
42604
+ }),
42659
42605
  projectDirOption
42660
42606
  ],
42661
42607
  options: [
42662
- {
42663
- name: "output",
42664
- option: {
42665
- describe: "File to write the declaration .sqlx to. Prints to stdout if omitted.",
42666
- type: "string"
42667
- }
42668
- }
42608
+ option("output", {
42609
+ describe: "File to write the declaration .sqlx to. Prints to stdout if omitted.",
42610
+ type: "string"
42611
+ })
42669
42612
  ],
42670
42613
  processFn: async (argv) => {
42671
42614
  const projectDir = argv[projectDirOption.name];
@@ -42739,93 +42682,62 @@ class ProjectConfigOptions {
42739
42682
  return projectConfigOptions;
42740
42683
  }
42741
42684
  }
42742
- ProjectConfigOptions.defaultDatabase = {
42743
- name: "default-database",
42744
- option: {
42745
- describe: "The default database to use, equivalent to Google Cloud Project ID. If unset, " +
42746
- "the value from workflow_settings.yaml is used.",
42747
- type: "string"
42748
- }
42749
- };
42750
- ProjectConfigOptions.defaultSchema = {
42751
- name: "default-schema",
42752
- option: {
42753
- describe: "Override for the default schema name. If unset, the value from workflow_settings.yaml is used."
42754
- }
42755
- };
42756
- ProjectConfigOptions.defaultLocation = {
42757
- name: "default-location",
42758
- option: {
42759
- describe: "The default location to use. See " +
42760
- "https://cloud.google.com/bigquery/docs/locations for supported values. If unset, the " +
42761
- "value from workflow_settings.yaml is used."
42762
- }
42763
- };
42764
- ProjectConfigOptions.assertionSchema = {
42765
- name: "assertion-schema",
42766
- option: {
42767
- describe: "Default assertion schema. If unset, the value from workflow_settings.yaml is used."
42768
- }
42769
- };
42770
- ProjectConfigOptions.databaseSuffix = {
42771
- name: "database-suffix",
42772
- option: {
42773
- describe: "Default assertion schema. If unset, the value from workflow_settings.yaml is used."
42774
- }
42775
- };
42776
- ProjectConfigOptions.vars = {
42777
- name: "vars",
42778
- option: {
42779
- describe: "Override for variables to inject via '--vars=someKey=someValue,a=b', referenced by " +
42780
- "`sqlanvil.projectConfig.vars.someValue`. If unset, the value from workflow_settings.yaml is used.",
42781
- type: "string",
42782
- default: null,
42783
- coerce: (rawVarsString) => {
42784
- const variables = {};
42785
- rawVarsString === null || rawVarsString === void 0 ? void 0 : rawVarsString.split(",").forEach(keyValueStr => {
42786
- const [key, value] = keyValueStr.split("=");
42787
- variables[key] = value;
42788
- });
42789
- return variables;
42790
- }
42791
- }
42792
- };
42793
- ProjectConfigOptions.schemaSuffix = {
42794
- name: "schema-suffix",
42795
- option: {
42796
- describe: "A suffix to be appended to output schema names. If unset, the value from workflow_settings.yaml " +
42797
- "is used."
42798
- },
42799
- check: (argv) => {
42800
- if (argv[ProjectConfigOptions.schemaSuffix.name] &&
42801
- !/^[a-zA-Z_0-9]+$/.test(argv[ProjectConfigOptions.schemaSuffix.name])) {
42802
- throw new Error(`--${ProjectConfigOptions.schemaSuffix.name} should contain only ` +
42803
- `alphanumeric characters and/or underscores.`);
42804
- }
42805
- }
42806
- };
42807
- ProjectConfigOptions.tablePrefix = {
42808
- name: "table-prefix",
42809
- option: {
42810
- describe: "Adds a prefix for all table names. If unset, the value from workflow_settings.yaml is used."
42811
- }
42812
- };
42813
- ProjectConfigOptions.disableAssertions = {
42814
- name: "disable-assertions",
42815
- option: {
42816
- describe: "Disables all assertions including built-in assertions (uniqueKey, nonNull, rowConditions) and manual assertions (type: assertion).",
42817
- type: "boolean",
42818
- default: false
42685
+ ProjectConfigOptions.defaultDatabase = option("default-database", {
42686
+ describe: "The default database to use, equivalent to Google Cloud Project ID. If unset, " +
42687
+ "the value from workflow_settings.yaml is used.",
42688
+ type: "string"
42689
+ });
42690
+ ProjectConfigOptions.defaultSchema = option("default-schema", {
42691
+ describe: "Override for the default schema name. If unset, the value from workflow_settings.yaml is used."
42692
+ });
42693
+ ProjectConfigOptions.defaultLocation = option("default-location", {
42694
+ describe: "The default location to use. See " +
42695
+ "https://cloud.google.com/bigquery/docs/locations for supported values. If unset, the " +
42696
+ "value from workflow_settings.yaml is used."
42697
+ });
42698
+ ProjectConfigOptions.assertionSchema = option("assertion-schema", {
42699
+ describe: "Default assertion schema. If unset, the value from workflow_settings.yaml is used."
42700
+ });
42701
+ ProjectConfigOptions.databaseSuffix = option("database-suffix", {
42702
+ describe: "Default assertion schema. If unset, the value from workflow_settings.yaml is used."
42703
+ });
42704
+ ProjectConfigOptions.vars = option("vars", {
42705
+ describe: "Override for variables to inject via '--vars=someKey=someValue,a=b', referenced by " +
42706
+ "`sqlanvil.projectConfig.vars.someValue`. If unset, the value from workflow_settings.yaml is used.",
42707
+ type: "string",
42708
+ default: null,
42709
+ coerce: (rawVarsString) => {
42710
+ const variables = {};
42711
+ rawVarsString === null || rawVarsString === void 0 ? void 0 : rawVarsString.split(",").forEach(keyValueStr => {
42712
+ const [key, value] = keyValueStr.split("=");
42713
+ variables[key] = value;
42714
+ });
42715
+ return variables;
42819
42716
  }
42820
- };
42821
- ProjectConfigOptions.defaultReservation = {
42822
- name: "default-reservation",
42823
- option: {
42824
- describe: "The default BigQuery reservation to use for execution. If unset, the value from " +
42825
- "workflow_settings.yaml is used. If neither is set, default BigQuery behavior applies.",
42826
- type: "string"
42717
+ });
42718
+ ProjectConfigOptions.schemaSuffix = option("schema-suffix", {
42719
+ describe: "A suffix to be appended to output schema names. If unset, the value from workflow_settings.yaml " +
42720
+ "is used."
42721
+ }, (argv) => {
42722
+ if (argv[ProjectConfigOptions.schemaSuffix.name] &&
42723
+ !/^[a-zA-Z_0-9]+$/.test(argv[ProjectConfigOptions.schemaSuffix.name])) {
42724
+ throw new Error(`--${ProjectConfigOptions.schemaSuffix.name} should contain only ` +
42725
+ `alphanumeric characters and/or underscores.`);
42827
42726
  }
42828
- };
42727
+ });
42728
+ ProjectConfigOptions.tablePrefix = option("table-prefix", {
42729
+ describe: "Adds a prefix for all table names. If unset, the value from workflow_settings.yaml is used."
42730
+ });
42731
+ ProjectConfigOptions.disableAssertions = option("disable-assertions", {
42732
+ describe: "Disables all assertions including built-in assertions (uniqueKey, nonNull, rowConditions) and manual assertions (type: assertion).",
42733
+ type: "boolean",
42734
+ default: false
42735
+ });
42736
+ ProjectConfigOptions.defaultReservation = option("default-reservation", {
42737
+ describe: "The default BigQuery reservation to use for execution. If unset, the value from " +
42738
+ "workflow_settings.yaml is used. If neither is set, default BigQuery behavior applies.",
42739
+ type: "string"
42740
+ });
42829
42741
  ProjectConfigOptions.allYargsOptions = [
42830
42742
  ProjectConfigOptions.defaultDatabase,
42831
42743
  ProjectConfigOptions.defaultSchema,
package/package.json CHANGED
@@ -61,7 +61,7 @@
61
61
  "bin": {
62
62
  "sqlanvil": "bundle.js"
63
63
  },
64
- "version": "1.3.0",
64
+ "version": "1.4.0",
65
65
  "name": "@sqlanvil/cli",
66
66
  "description": "sqlanvil command line interface.",
67
67
  "main": "bundle.js"