alasql 4.23.1 → 4.23.3

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.
@@ -25,6 +25,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/precompile/index.js
28
30
  var index_exports = {};
29
31
  __export(index_exports, {
30
32
  compileToJS: () => compileToJS
@@ -122,3 +124,7 @@ function compileToJS(sql, databaseid) {
122
124
  })`;
123
125
  return wrapper;
124
126
  }
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ compileToJS
130
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "alasql",
3
3
  "description": "Use SQL to select and filter javascript data - including relational joins and search in nested objects (JSON). Export to and import from Excel and CSV",
4
- "version": "4.23.1",
4
+ "version": "4.23.3",
5
5
  "author": "Andrey Gershun <agershun@gmail.com>",
6
6
  "contributors": [
7
7
  "Mathias Wulff <m@rawu.dk>"
@@ -22,13 +22,15 @@
22
22
  },
23
23
  "typings": "types/alasql.d.ts",
24
24
  "scripts": {
25
- "test": "yarn test-parser && sh build.sh && yarn test-only",
25
+ "test": "yarn test-parser && yarn build-only && yarn test-only",
26
26
  "test-ci": "(yarn test-format-all || 1) && yarn test-only && yarn install-g && alasql 'select 1 as Succes'",
27
27
  "test-only": "bun test --dots --preload ./test/bun-setup.js ./test/test[0-9]*.js ./test/test-*.js",
28
28
  "test-browser": "node test/browserTestRunner.js 7387",
29
+ "test-parity": "yarn build-only && bun test/parity/run.js record ref-044ab07a --ref 044ab07a --if-missing && bun test/parity/run.js record new --once && bun test/parity/run.js compare ref-044ab07a new",
30
+ "test-parity-smoke": "node test/parity/smoke.js --node=$(which node) --pack",
29
31
  "test-cover": "# istanbul cover -x 'lib/zt/zt.js' --dir test/coverage _mocha",
30
32
  "build": "yarn format && yarn build-only",
31
- "build-only": "sh build.sh",
33
+ "build-only": "bun build.js && rexreplace PACKAGE_VERSION $npm_package_version -Iq 'dist/**/*.js' && rexreplace BUILD_VERSION \"'$(git rev-parse --abbrev-ref HEAD)-$(git rev-parse --short HEAD)'.replace(/[^\\da-z-]+/gi, '.')\" -Iqj 'dist/**/*.js'",
32
34
  "test-perf": "bun test/performance/vs-npm.js",
33
35
  "test-perf-mini": "bun test/performance/vs-npm.js --scale=0.5 --runs=2 --runtime=node --fail-above=105",
34
36
  "install-g": "yarn build && npm uninstall alasql -g && npm install -g .",
@@ -39,22 +41,22 @@
39
41
  "format": "yarn pretty-since-dev --write",
40
42
  "format-all": "yarn pretty-all --write",
41
43
  "test-format": "yarn pretty-since-dev --list-different || (echo 'Please correct file formatting using `yarn format` and try again.' && exit 1)",
42
- "test-format-all": "prettier --list-different '{.,src,test}/*.{js,ts,json}' || (echo 'Please correct file formatting using `yarn format-all` and try again.' && exit 1)",
43
- "pretty-since-dev": "{ git diff --name-only --diff-filter=d origin/develop ; git diff --name-only --diff-filter=d --staged origin/develop ; } | sort | uniq | grep -vE '^dist/|^test/coverage|^lib/|.min.js$' | grep -E '\\.(scss|css|js|ts|vue|json)$' | xargs npx prettier",
44
+ "test-format-all": "prettier --list-different '{.,src,test}/**/*.{js,ts,json}' || (echo 'Please correct file formatting using `yarn format-all` and try again.' && exit 1)",
45
+ "pretty-since-dev": "{ git diff --name-only --diff-filter=d origin/main ; git diff --name-only --diff-filter=d --staged origin/main ; } | sort | uniq | grep -vE '^dist/|^test/coverage|^lib/|.min.js$' | grep -E '\\.(scss|css|js|ts|vue|json)$' | xargs npx prettier",
44
46
  "pretty-commit": "{ git diff --name-only --diff-filter=d ; git diff --name-only --diff-filter=d --staged ; } | sort | uniq | grep -vE '^dist/|^test/coverage|^lib/|.min.js$' | grep -E '\\.(scss|css|js|ts|vue|json)$' | xargs npx prettier",
45
47
  "pretty-all": "git ls-tree --full-tree --name-only -r HEAD | grep -vE '^dist/|^test/coverage|^lib/|.min.js$' | grep -E '\\.(scss|css|js|ts|vue|json)$' | xargs npx prettier",
46
48
  "push": "git push --force-with-lease && git push --no-verify --tags #",
47
49
  "repush": "yarn rebase && yarn push",
48
- "amend": "git reset --soft HEAD~1 && sleep 1 && git add --all && git commit --file .git/COMMIT_EDITMSG # This works with husky hooks",
50
+ "amend": "git reset --soft HEAD~1 && sleep 1 && git add --all && git commit --file .git/COMMIT_EDITMSG",
49
51
  "commit": "cmdmix 'git add --all && git commit -am \"%1\"'",
50
52
  "add": "git add --all",
51
53
  "goto": "git fetch && git checkout",
52
54
  "todo": "git ls-tree --full-tree --name-only -r head | xargs grep -inEro '\\Wtodo[ :].*' #",
53
55
  "fresh": "cmdmix 'yarn goto '%1' && yarn pull-hard'",
54
56
  "pre-pr": "cmdmix 'yarn fresh '%1' && yarn repush'",
55
- "prepare": "husky",
56
57
  "preversion": "yarn && yarn test && npm login",
57
- "prepublishOnly": "sh build.sh </dev/null",
58
+ "version": "rexreplace 'alasql@\\d+(\\.\\d+){2}' alasql@$npm_package_version -q README.md && git add README.md",
59
+ "prepublishOnly": "yarn build-only",
58
60
  "postversion": "npm publish && git push && git push origin v$npm_package_version && echo \"Successfully released version $npm_package_version\""
59
61
  },
60
62
  "dependencies": {
@@ -69,14 +71,9 @@
69
71
  "cmdmix": "2.2.2",
70
72
  "dom-storage": "2.1.0",
71
73
  "esbuild": "0.28.2",
72
- "git-branch-is": "5.0.0",
73
- "husky": "9.1.7",
74
74
  "jison": "^0.4.18",
75
- "open": "11.0.4",
76
75
  "prettier": "3.10.1",
77
- "rexreplace": "7.1.16",
78
- "strftime": "0.10.3",
79
- "uglify-js": "3.19.3"
76
+ "rexreplace": "7.1.16"
80
77
  },
81
78
  "resolutions": {
82
79
  "underscore": "1"
package/types/alasql.d.ts CHANGED
@@ -37,6 +37,12 @@ declare module 'alasql' {
37
37
  sqlite: boolean;
38
38
  orientdb: boolean;
39
39
  excel?: xlsx.WorkBook; // now typed
40
+ progress: false | ((a: number, b: number) => void); // called while an async batch runs, or false for none
41
+ joinstar: 'overwrite' | 'underscore' | 'json'; // how SELECT * names the columns of joined tables
42
+ loopbreak: number; // maximum steps of a SEARCH before it stops
43
+ maxCteIterations: number; // maximum iterations of a recursive CTE
44
+ dateAsString: boolean; // GETDATE() and NOW() return a string instead of a Date
45
+ csvStringToNumber: boolean; // convert numeric strings to numbers when reading CSV
40
46
  }
41
47
 
42
48
  // compiled Statement
package/build.sh DELETED
@@ -1,210 +0,0 @@
1
- rm -fr dist/
2
- mkdir dist/
3
-
4
- if ! command -v "rexreplace" > /dev/null 2>&1; then
5
- echo "\nSpeed up the process by having rexreplace installed globally"
6
- echo "> npm install -g rexreplace"
7
- fi
8
-
9
- if ! command -v "esbuild" > /dev/null 2>&1; then
10
- echo "\nSpeed up the process by having esbuild installed globally"
11
- echo "> npm install -g esbuild"
12
- fi
13
-
14
-
15
- # Run comands via x to avoid npx overhead if the command is installed globally (3.27x slower)
16
- x() {
17
- local cmd="$1"
18
- shift
19
- if command -v "$cmd" > /dev/null 2>&1; then
20
- "$cmd" "$@" # Run the command with all remaining arguments
21
- else
22
- npx "$cmd" "$@" # Use npx to run the command with all remaining arguments
23
- fi
24
- }
25
-
26
- branch=$(git rev-parse --abbrev-ref HEAD | rexreplace '[^0-9a-z-]' '.' | rexreplace '^[^0-9a-z]+|[^0-9a-z]+$' '')
27
- commit=$(git rev-parse --short HEAD)
28
-
29
-
30
- echo '\nPrepare types'
31
- cp 'types/alasql.d.ts' dist/
32
-
33
-
34
- echo '\nPrepare echo plugin'
35
- cp 'src/echo/alasql-echo.js' dist/
36
-
37
-
38
- echo '\nPrepare prolog'
39
- cp 'src/prolog/alasql-prolog.js' dist/
40
-
41
-
42
- echo '\nBuild alasql.js files'
43
- outfile="dist/alasql.js"
44
- outfile_min="dist/alasql.min.js"
45
- outfile_fs="dist/alasql.fs.js"
46
-
47
- echo '# Concat all parts'
48
- cat \
49
- src/05copyright.js \
50
- src/10start.js \
51
- src/alasqlparser.js \
52
- src/12pretty.js \
53
- src/15utility.js \
54
- src/16comments.js \
55
- src/17alasql.js \
56
- src/18promise.js \
57
- src/20database.js \
58
- src/21transaction.js \
59
- src/23table.js \
60
- src/24view.js \
61
- src/25queryclass.js \
62
- src/28yy.js \
63
- src/30statements.js \
64
- src/35search.js \
65
- src/38query.js \
66
- src/39dojoin.js \
67
- src/40select.js \
68
- src/41exists.js \
69
- src/420from.js \
70
- src/421join.js \
71
- src/422where.js \
72
- src/423groupby.js \
73
- src/424select.js \
74
- src/425having.js \
75
- src/426orderby.js \
76
- src/427pivot.js \
77
- src/43rollup.js \
78
- src/44defcols.js \
79
- src/45union.js \
80
- src/46apply.js \
81
- src/47over.js \
82
- src/50expression.js \
83
- src/52linq.js \
84
- src/55functions.js \
85
- src/57case.js \
86
- src/58json.js \
87
- src/59convert.js \
88
- src/60createtable.js \
89
- src/61date.js \
90
- src/62droptable.js \
91
- src/63createvertex.js \
92
- src/64altertable.js \
93
- src/65createindex.js \
94
- src/66dropindex.js \
95
- src/67withselect.js \
96
- src/68if.js \
97
- src/69while.js \
98
- src/70insert.js \
99
- src/71trigger.js \
100
- src/72delete.js \
101
- src/74update.js \
102
- src/75merge.js \
103
- src/76usedatabase.js \
104
- src/77declare.js \
105
- src/78show.js \
106
- src/79set.js \
107
- src/80console.js \
108
- src/81commit.js \
109
- src/821tsql.js \
110
- src/822mysql.js \
111
- src/823postgres.js \
112
- src/824oracle.js \
113
- src/825sqlite.js \
114
- src/830into.js \
115
- src/831xls.js \
116
- src/832xlsxml.js \
117
- src/833xlsx.js \
118
- src/84from.js \
119
- src/843xml.js \
120
- src/844gexf.js \
121
- src/86print.js \
122
- src/87source.js \
123
- src/88require.js \
124
- src/89assert.js \
125
- src/91indexeddb.js \
126
- src/92localstorage.js \
127
- src/93sqljs.js \
128
- src/94filestorage.js \
129
- src/97saveas.js \
130
- src/99worker.js \
131
- src/FileSaver.js \
132
- src/98finish.js \
133
- > $outfile_fs
134
-
135
- echo '# Remove multiline comments starting with "/*/*"'
136
- x rexreplace '/\*/\*[\S\s]+?\*/' '' -q $outfile_fs
137
-
138
- echo '# Remove single line comments where the // part is first thing'
139
- x rexreplace '^//[ \t]{2,}.*' '' -q $outfile_fs
140
-
141
- echo '# Remove single line comments "console.log(" is part of the line'
142
- x rexreplace '//.*?console\.log\(.*' '' -q $outfile_fs
143
-
144
- echo '# Collaps multilinebreak'
145
- x rexreplace '\n[\s]+\n' '\n\n' -q $outfile_fs
146
-
147
- echo '# Inject package version'
148
- x rexreplace 'PACKAGE_VERSION' 'r("package").version' -j -q $outfile_fs
149
-
150
- echo '# Inject build version'
151
- x rexreplace 'BUILD_VERSION' "['$branch','$commit'].filter(Boolean).join('-')" -j -q $outfile_fs
152
-
153
- echo '# Prepare browser version'
154
- cp $outfile_fs $outfile
155
-
156
- echo '# Remove things not for browser build'
157
- x rexreplace '//*not-for-browser/*' '/*not-for-browser/*' -L -q $outfile
158
-
159
- echo '# Reveal things only for browser build'
160
- x rexreplace '/*only-for-browser/*' '//*only-for-browser/*' -L -q $outfile
161
-
162
- echo '# Support "use strict in jison output" ' # https://github.com/zaach/jison/pull/373
163
- x rexreplace 'function locateNearestErrorRecoveryRule(state) {' 'var locateNearestErrorRecoveryRule = function (state) {' -L -q $outfile
164
-
165
- x esbuild --minify --outfile="$outfile_min" "$outfile" --allow-overwrite
166
-
167
- #first_line=$(head -n 1 $outfile)
168
- #x rexreplace '^' "c = 'first_line'; c.match(/^\/\//) ? c : ''" -j -M $outfile_min
169
-
170
-
171
-
172
-
173
-
174
-
175
- echo '\nBuild precompile files'
176
- mkdir -p dist/precompile
177
-
178
- echo '# Copy precompile module'
179
- x esbuild --outfile="dist/precompile/index.js" "src/precompile/index.js" --format=cjs
180
-
181
-
182
-
183
-
184
- echo '\nBuild worker files'
185
- outfile="dist/alasql-worker.js"
186
- outfile_min="dist/alasql-worker.js"
187
-
188
- echo '# Concat all parts'
189
- cat \
190
- src/05copyright.js \
191
- src/99worker-start.js \
192
- src/99worker.js \
193
- src/99worker-finish.js \
194
- > $outfile
195
-
196
- echo '# Inject package version'
197
- x rexreplace 'PACKAGE_VERSION' 'r("package").version' -j -q $outfile
198
-
199
- echo '# Inject build version'
200
- x rexreplace 'BUILD_VERSION' "['$branch','$commit'].filter(Boolean).join('-')" -j -q $outfile
201
-
202
- echo '# Prepare min version'
203
- x esbuild --minify --outfile="$outfile_min" "$outfile" --allow-overwrite
204
-
205
- #first_line=$(head -n 1 $outfile)
206
- #x rexreplace '^' "c = 'first_line'; c.match(/^\/\//) ? c : ''" -j -M $outfile_min
207
-
208
-
209
-
210
-