@sqlanvil/cli 1.33.0 → 1.33.1

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
@@ -51218,7 +51218,7 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
51218
51218
  .filter((validationQuery) => !!validationQuery.query);
51219
51219
  }
51220
51220
 
51221
- const version = "1.33.0";
51221
+ const version = "1.33.1";
51222
51222
  const dataformVersion = "3.0.71";
51223
51223
 
51224
51224
  async function build(compiledGraph, runConfig, dbadapter) {
@@ -51767,6 +51767,12 @@ function mysqlCredentialsTemplate() {
51767
51767
  };
51768
51768
  return `${JSON.stringify(template, null, 2)}\n`;
51769
51769
  }
51770
+ function defaultSchemaFor(warehouse) {
51771
+ if (warehouse === "supabase") {
51772
+ return "analytics";
51773
+ }
51774
+ return warehouse === "postgres" ? "public" : "sqlanvil";
51775
+ }
51770
51776
  async function init(projectDir, projectConfig, options = {}) {
51771
51777
  var _a;
51772
51778
  const workflowSettingsYamlPath = path__namespace.join(projectDir, "workflow_settings.yaml");
@@ -51794,8 +51800,7 @@ async function init(projectDir, projectConfig, options = {}) {
51794
51800
  workflowSettings.defaultLocation = projectConfig.defaultLocation;
51795
51801
  }
51796
51802
  const isPostgresLike = warehouse === "postgres" || warehouse === "supabase";
51797
- workflowSettings.defaultDataset =
51798
- projectConfig.defaultSchema || (isPostgresLike ? "public" : "sqlanvil");
51803
+ workflowSettings.defaultDataset = projectConfig.defaultSchema || defaultSchemaFor(warehouse);
51799
51804
  workflowSettings.defaultAssertionDataset = projectConfig.assertionSchema || "sqlanvil_assertions";
51800
51805
  if (isBigQuery && projectConfig.defaultIcebergConfig) {
51801
51806
  workflowSettings.defaultIcebergConfig = projectConfig.defaultIcebergConfig;
@@ -58998,7 +59003,7 @@ async function runFreshFlow(defaultProjectDir) {
58998
59003
  projectConfig.defaultDatabase = askRequired(INIT_BQ_PROJECT_QUESTION);
58999
59004
  projectConfig.defaultLocation = askRequired(INIT_BQ_LOCATION_QUESTION);
59000
59005
  }
59001
- projectConfig.defaultSchema = ask(INIT_DEFAULT_SCHEMA_QUESTION, isPostgresLike ? "public" : "sqlanvil");
59006
+ projectConfig.defaultSchema = ask(INIT_DEFAULT_SCHEMA_QUESTION, defaultSchemaFor(warehouse));
59002
59007
  const includeSample = askYesNo(INIT_INCLUDE_SAMPLE_QUESTION, true);
59003
59008
  const includeBigQuerySource = includeSample && isPostgresLike ? askYesNo(INIT_INCLUDE_BQ_SOURCE_QUESTION, true) : undefined;
59004
59009
  let credentialsJson;
package/package.json CHANGED
@@ -82,7 +82,7 @@
82
82
  "engines": {
83
83
  "node": "^20.19.0 || >=22.12.0"
84
84
  },
85
- "version": "1.33.0",
85
+ "version": "1.33.1",
86
86
  "name": "@sqlanvil/cli",
87
87
  "description": "sqlanvil command line interface.",
88
88
  "main": "bundle.js"
package/worker_bundle.js CHANGED
@@ -49622,21 +49622,7 @@ function compile(compileConfig) {
49622
49622
  });
49623
49623
  const compiler = indexGeneratorVm.run('return require("@sqlanvil/core").compiler', vmIndexFileName);
49624
49624
  const sqlanvilCoreVersion = indexGeneratorVm.run('return require("@sqlanvil/core").version || "0.0.0"', vmIndexFileName);
49625
- const coreDataformVersion = indexGeneratorVm.run('return require("@sqlanvil/core").dataformVersion || require("@sqlanvil/core").version || "0.0.0"', vmIndexFileName);
49626
- const cliVersion = readCliVersion();
49627
- const cliParsed = semver__namespace.parse(cliVersion);
49628
- if (cliParsed && cliVersion !== "0.0.0") {
49629
- const minCoreVersion = `${cliParsed.major}.${cliParsed.minor}.0`;
49630
- if (semver__namespace.major(sqlanvilCoreVersion) !== cliParsed.major ||
49631
- semver__namespace.lt(sqlanvilCoreVersion, minCoreVersion)) {
49632
- throw new Error(`@sqlanvil/core ${sqlanvilCoreVersion} is not compatible with @sqlanvil/cli ` +
49633
- `${cliVersion}. The CLI requires @sqlanvil/core >= ${minCoreVersion} ` +
49634
- `(matching major.minor). Set \`sqlanvilCoreVersion: ${cliVersion}\` in ` +
49635
- `workflow_settings.yaml (or pin @sqlanvil/core in package.json), then run ` +
49636
- `\`sqlanvil install\`.`);
49637
- }
49638
- }
49639
- const needsCallerFileShim = semver__namespace.lt(coreDataformVersion, "3.0.57");
49625
+ checkCoreCompatibility(sqlanvilCoreVersion, readCliVersion());
49640
49626
  const fileStack = [];
49641
49627
  const userCodeVm = new vm2.NodeVM({
49642
49628
  wrapper: "none",
@@ -49658,11 +49644,7 @@ function compile(compileConfig) {
49658
49644
  },
49659
49645
  sourceExtensions: ["js", "sql", "sqlx", "yaml", "yml"],
49660
49646
  compiler: (code, filePath) => {
49661
- let source = code;
49662
- if (needsCallerFileShim && filePath === coreBundlePath) {
49663
- source = patchOldCoreCallerFile(source);
49664
- }
49665
- const compiledCode = compiler(source, filePath);
49647
+ const compiledCode = compiler(code, filePath);
49666
49648
  return `
49667
49649
  __df_enter(${JSON.stringify(filePath)});
49668
49650
  try {
@@ -49719,11 +49701,22 @@ function readCliVersion() {
49719
49701
  return "0.0.0";
49720
49702
  }
49721
49703
  }
49722
- const OLD_CORE_THROW = 'if(!t)throw new Error("Unable to find valid caller file; please report this issue.")';
49723
- const OLD_CORE_WITH_FALLBACK = "if(!t){if(global.__sqlanvil_current_file){t=global.__sqlanvil_current_file}" +
49724
- 'else{throw new Error("Unable to find valid caller file; please report this issue.")}}';
49725
- function patchOldCoreCallerFile(source) {
49726
- return source.replace(OLD_CORE_THROW, OLD_CORE_WITH_FALLBACK);
49704
+ const MIN_SUPPORTED_CORE_VERSION = "1.0.0";
49705
+ function checkCoreCompatibility(coreVersion, cliVersion) {
49706
+ const cliParsed = semver__namespace.parse(cliVersion);
49707
+ if (!cliParsed || cliVersion === "0.0.0") {
49708
+ return;
49709
+ }
49710
+ const majorFloor = `${cliParsed.major}.0.0`;
49711
+ const minCoreVersion = semver__namespace.gt(MIN_SUPPORTED_CORE_VERSION, majorFloor)
49712
+ ? MIN_SUPPORTED_CORE_VERSION
49713
+ : majorFloor;
49714
+ if (semver__namespace.major(coreVersion) !== cliParsed.major || semver__namespace.lt(coreVersion, minCoreVersion)) {
49715
+ throw new Error(`@sqlanvil/core ${coreVersion} is not compatible with @sqlanvil/cli ${cliVersion}. ` +
49716
+ `The CLI requires @sqlanvil/core >=${minCoreVersion} <${cliParsed.major + 1}.0.0. ` +
49717
+ `Set \`sqlanvilCoreVersion: ${cliVersion}\` in workflow_settings.yaml, or pin ` +
49718
+ `@sqlanvil/core in package.json and run \`sqlanvil install\`.`);
49719
+ }
49727
49720
  }
49728
49721
  function createCoreExecutionRequest(compileConfig) {
49729
49722
  const filePaths = Array.from(new Set(glob__namespace.sync("!(node_modules)/**/*.*", { cwd: compileConfig.projectDir })));