@sqlanvil/cli 1.33.0 → 1.34.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/._LICENSE +0 -0
- package/._NOTICE +0 -0
- package/._README.md +0 -0
- package/._bundle.js +0 -0
- package/._package.json +0 -0
- package/._worker_bundle.js +0 -0
- package/README.md +1 -1
- package/bundle.js +18 -16
- package/package.json +7 -6
- package/worker_bundle.js +18 -25
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/README.md
CHANGED
|
@@ -12,7 +12,7 @@ authority for the version you have installed: `sqlanvil help` lists the commands
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npm install -g @sqlanvil/cli
|
|
15
|
-
sqlanvil --version # sqlanvil 1.
|
|
15
|
+
sqlanvil --version # sqlanvil 1.34.0 (Dataform core 3.1.0)
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Requires Node.js 20.19+ or 22.12+. `--version` reports the sqlanvil release and the Dataform core
|
package/bundle.js
CHANGED
|
@@ -49759,13 +49759,6 @@ function unknownToValueShallow(raw) {
|
|
|
49759
49759
|
throw new Error(`Unsupported value: ${raw}`);
|
|
49760
49760
|
}
|
|
49761
49761
|
|
|
49762
|
-
(() => {
|
|
49763
|
-
if (typeof process !== "undefined") {
|
|
49764
|
-
return process.platform === "win32" ? "\\" : "/";
|
|
49765
|
-
}
|
|
49766
|
-
return "/";
|
|
49767
|
-
})();
|
|
49768
|
-
|
|
49769
49762
|
const nativeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
|
|
49770
49763
|
function globToRegExp(pattern) {
|
|
49771
49764
|
const escapeLiteral = (literal) => literal.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -51218,8 +51211,8 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
|
|
|
51218
51211
|
.filter((validationQuery) => !!validationQuery.query);
|
|
51219
51212
|
}
|
|
51220
51213
|
|
|
51221
|
-
const version = "1.
|
|
51222
|
-
const dataformVersion = "3.0
|
|
51214
|
+
const version = "1.34.0";
|
|
51215
|
+
const dataformVersion = "3.1.0";
|
|
51223
51216
|
|
|
51224
51217
|
async function build(compiledGraph, runConfig, dbadapter) {
|
|
51225
51218
|
const prunedGraph = prune(compiledGraph, runConfig);
|
|
@@ -51322,7 +51315,7 @@ class BaseWorker {
|
|
|
51322
51315
|
async runWorker(timeoutMillis, onBoot, onMessage) {
|
|
51323
51316
|
const forkScript = this.resolveScript();
|
|
51324
51317
|
const child = childProcess.fork(forkScript, [], {
|
|
51325
|
-
stdio: [0, 1, 2, "ipc"
|
|
51318
|
+
stdio: [0, 1, 2, "ipc"],
|
|
51326
51319
|
});
|
|
51327
51320
|
return new Promise((resolve, reject) => {
|
|
51328
51321
|
let completed = false;
|
|
@@ -51767,6 +51760,12 @@ function mysqlCredentialsTemplate() {
|
|
|
51767
51760
|
};
|
|
51768
51761
|
return `${JSON.stringify(template, null, 2)}\n`;
|
|
51769
51762
|
}
|
|
51763
|
+
function defaultSchemaFor(warehouse) {
|
|
51764
|
+
if (warehouse === "supabase") {
|
|
51765
|
+
return "analytics";
|
|
51766
|
+
}
|
|
51767
|
+
return warehouse === "postgres" ? "public" : "sqlanvil";
|
|
51768
|
+
}
|
|
51770
51769
|
async function init(projectDir, projectConfig, options = {}) {
|
|
51771
51770
|
var _a;
|
|
51772
51771
|
const workflowSettingsYamlPath = path__namespace.join(projectDir, "workflow_settings.yaml");
|
|
@@ -51794,8 +51793,7 @@ async function init(projectDir, projectConfig, options = {}) {
|
|
|
51794
51793
|
workflowSettings.defaultLocation = projectConfig.defaultLocation;
|
|
51795
51794
|
}
|
|
51796
51795
|
const isPostgresLike = warehouse === "postgres" || warehouse === "supabase";
|
|
51797
|
-
workflowSettings.defaultDataset =
|
|
51798
|
-
projectConfig.defaultSchema || (isPostgresLike ? "public" : "sqlanvil");
|
|
51796
|
+
workflowSettings.defaultDataset = projectConfig.defaultSchema || defaultSchemaFor(warehouse);
|
|
51799
51797
|
workflowSettings.defaultAssertionDataset = projectConfig.assertionSchema || "sqlanvil_assertions";
|
|
51800
51798
|
if (isBigQuery && projectConfig.defaultIcebergConfig) {
|
|
51801
51799
|
workflowSettings.defaultIcebergConfig = projectConfig.defaultIcebergConfig;
|
|
@@ -54232,7 +54230,7 @@ class Runner {
|
|
|
54232
54230
|
}
|
|
54233
54231
|
execute() {
|
|
54234
54232
|
var _a, _b, _c;
|
|
54235
|
-
if (
|
|
54233
|
+
if (this.executionTask !== undefined) {
|
|
54236
54234
|
throw new Error("Executor already started.");
|
|
54237
54235
|
}
|
|
54238
54236
|
this.executionTask = this.executeGraph();
|
|
@@ -56777,6 +56775,7 @@ function postProcessFormattedSqlx(formattedSql) {
|
|
|
56777
56775
|
return `${formattedSql.trim()}\n`;
|
|
56778
56776
|
}
|
|
56779
56777
|
|
|
56778
|
+
const normalizeLineEndings = (text) => text.replace(/\r\n/g, "\n");
|
|
56780
56779
|
const checkOptionName = "check";
|
|
56781
56780
|
const ignoreJsFilesOptionName = "ignore-js-files";
|
|
56782
56781
|
const formatCommand = {
|
|
@@ -56803,7 +56802,10 @@ const formatCommand = {
|
|
|
56803
56802
|
actions = argv[actionsOption.name];
|
|
56804
56803
|
}
|
|
56805
56804
|
const filenames = actions
|
|
56806
|
-
.map((action) => glob__namespace.sync(action, {
|
|
56805
|
+
.map((action) => glob__namespace.sync(action, {
|
|
56806
|
+
cwd: argv[projectDirMustExistOption.name],
|
|
56807
|
+
windowsPathsNoEscape: process.platform === "win32",
|
|
56808
|
+
}))
|
|
56807
56809
|
.flat();
|
|
56808
56810
|
const isCheckMode = argv[checkOptionName];
|
|
56809
56811
|
const results = await Promise.all(filenames.map(async (filename) => {
|
|
@@ -56816,7 +56818,7 @@ const formatCommand = {
|
|
|
56816
56818
|
});
|
|
56817
56819
|
return {
|
|
56818
56820
|
filename,
|
|
56819
|
-
needsFormatting: fileContent !== formattedContent,
|
|
56821
|
+
needsFormatting: normalizeLineEndings(fileContent) !== normalizeLineEndings(formattedContent),
|
|
56820
56822
|
};
|
|
56821
56823
|
}
|
|
56822
56824
|
else {
|
|
@@ -58998,7 +59000,7 @@ async function runFreshFlow(defaultProjectDir) {
|
|
|
58998
59000
|
projectConfig.defaultDatabase = askRequired(INIT_BQ_PROJECT_QUESTION);
|
|
58999
59001
|
projectConfig.defaultLocation = askRequired(INIT_BQ_LOCATION_QUESTION);
|
|
59000
59002
|
}
|
|
59001
|
-
projectConfig.defaultSchema = ask(INIT_DEFAULT_SCHEMA_QUESTION,
|
|
59003
|
+
projectConfig.defaultSchema = ask(INIT_DEFAULT_SCHEMA_QUESTION, defaultSchemaFor(warehouse));
|
|
59002
59004
|
const includeSample = askYesNo(INIT_INCLUDE_SAMPLE_QUESTION, true);
|
|
59003
59005
|
const includeBigQuerySource = includeSample && isPostgresLike ? askYesNo(INIT_INCLUDE_BQ_SOURCE_QUESTION, true) : undefined;
|
|
59004
59006
|
let credentialsJson;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@duckdb/node-api": "^1.5.4-r.1",
|
|
4
4
|
"@google-cloud/bigquery": "~8.3.0",
|
|
5
|
-
"chokidar": "^
|
|
5
|
+
"chokidar": "^4.0.3",
|
|
6
6
|
"deepmerge": "^4.2.2",
|
|
7
7
|
"fs-extra": "^9.0.0",
|
|
8
8
|
"glob": "13.0.6",
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
"tmp": "^0.2.7",
|
|
25
25
|
"typeid-js": "0.3.0",
|
|
26
26
|
"untildify": "^4.0.0",
|
|
27
|
-
"vm2": "3.
|
|
27
|
+
"vm2": "3.12.2",
|
|
28
28
|
"yargs": "^16.2.0"
|
|
29
29
|
},
|
|
30
30
|
"resolutions": {
|
|
31
31
|
"**/object-path": "^0.11.5",
|
|
32
32
|
"**/http-proxy": "^1.18.1",
|
|
33
|
-
"**/serialize-javascript": "^7.1.
|
|
33
|
+
"**/serialize-javascript": "^7.1.2",
|
|
34
34
|
"**/ssri": "^7.1.1",
|
|
35
35
|
"**/glob-parent": "^5.1.2",
|
|
36
36
|
"**/node-forge": "^1.0.0",
|
|
37
37
|
"**/json-bigint": "^1.0.0",
|
|
38
38
|
"**/y18n": "^5.0.5",
|
|
39
39
|
"**/underscore": "^1.12.1",
|
|
40
|
-
"**/protobufjs": "^7.
|
|
40
|
+
"**/protobufjs": "^7.6.5",
|
|
41
41
|
"**/ansi-regex": "^3.0.1",
|
|
42
42
|
"**/json-schema": "^0.4.0",
|
|
43
43
|
"**/nth-check": "^2.0.1",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"**/string-width": "4.1.0",
|
|
49
49
|
"**/@eslint-community/eslint-utils": "4.9.1",
|
|
50
50
|
"**/@ungap/structured-clone": "1.3.1",
|
|
51
|
-
"**/brace-expansion": "5.0.
|
|
51
|
+
"**/brace-expansion": "5.0.12",
|
|
52
|
+
"**/fast-uri": "^3.1.7",
|
|
52
53
|
"**/linkify-it": "^5.0.2",
|
|
53
54
|
"**/braces": "^3.0.3",
|
|
54
55
|
"**/@eslint/plugin-kit": "0.7.2",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"engines": {
|
|
83
84
|
"node": "^20.19.0 || >=22.12.0"
|
|
84
85
|
},
|
|
85
|
-
"version": "1.
|
|
86
|
+
"version": "1.34.0",
|
|
86
87
|
"name": "@sqlanvil/cli",
|
|
87
88
|
"description": "sqlanvil command line interface.",
|
|
88
89
|
"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
|
-
|
|
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
|
-
|
|
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
|
|
49723
|
-
|
|
49724
|
-
|
|
49725
|
-
|
|
49726
|
-
|
|
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 })));
|