alasql 4.8.0 → 4.10.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/README.md +5 -1
- package/bin/alasql-cli.js +52 -24
- package/build.sh +9 -0
- package/dist/alasql-worker.js +4 -4
- package/dist/alasql.fs.js +1170 -859
- package/dist/alasql.js +1170 -859
- package/dist/alasql.min.js +143 -143
- package/dist/precompile/index.js +115 -0
- package/package.json +15 -6
package/README.md
CHANGED
|
@@ -515,6 +515,8 @@ Try AlaSQL JSON objects in Console [sample](http://alasql.org/console?drop table
|
|
|
515
515
|
|
|
516
516
|
_Useful stuff, but there might be dragons_
|
|
517
517
|
|
|
518
|
+
|
|
519
|
+
|
|
518
520
|
### Graphs
|
|
519
521
|
|
|
520
522
|
AlaSQL is a multi-paradigm database with support for graphs that can be searched or manipulated.
|
|
@@ -569,6 +571,8 @@ then open <http://127.0.0.1:1337/?SELECT%20VALUE%20(2*2)> in your browser
|
|
|
569
571
|
Warning: Alaserver is not multi-threaded, not concurrent, and not secured.
|
|
570
572
|
|
|
571
573
|
|
|
574
|
+
|
|
575
|
+
|
|
572
576
|
## Tests
|
|
573
577
|
|
|
574
578
|
### Regression tests
|
|
@@ -699,6 +703,6 @@ and other people for useful tools, which make our work much easier.
|
|
|
699
703
|
|
|
700
704
|
----
|
|
701
705
|
<a href="http://alasql.org"><img src="https://cloud.githubusercontent.com/assets/1063454/14003946/d6e5c076-f156-11e5-8238-e62d2a8d20dc.png" align="right" alt="AlaSQL logo"/></a>
|
|
702
|
-
© 2014-
|
|
706
|
+
© 2014-2025, Andrey Gershun (agershun@gmail.com) & Mathias Rangel Wulff (m@rawu.dk)
|
|
703
707
|
|
|
704
708
|
See [this article](https://console.substack.com/p/console-187) for a bit of information about the motivation and background.
|
package/bin/alasql-cli.js
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
let alasql = require('../dist/alasql.fs.js');
|
|
11
11
|
let path = require('path');
|
|
12
12
|
let fs = require('fs');
|
|
13
|
-
let stdin = process.openStdin();
|
|
14
13
|
let yargs = require('yargs')
|
|
15
14
|
.strict()
|
|
16
15
|
.usage(
|
|
@@ -58,44 +57,73 @@ let yargs = require('yargs')
|
|
|
58
57
|
.epilog('\nMore information about the library: www.alasql.org');
|
|
59
58
|
|
|
60
59
|
let argv = yargs.argv;
|
|
61
|
-
let sql = '';
|
|
62
|
-
let params = [];
|
|
63
|
-
let pipedData = '';
|
|
64
|
-
stdin.on('data', function (chunk) {
|
|
65
|
-
pipedData += chunk;
|
|
66
|
-
});
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
// Regex patterns for detecting functions
|
|
62
|
+
const re = {
|
|
63
|
+
txt: /txt\s*\(\s*\)/i,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Helper function to check if SQL contains txt() and stdin is piped
|
|
67
|
+
function isPipeData(sql) {
|
|
68
|
+
return sql && !process.stdin.isTTY && re.txt.test(sql);
|
|
71
69
|
}
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
// Helper function to setup stdin handling
|
|
72
|
+
function pipeIsSQL() {
|
|
73
|
+
const stdin = process.openStdin();
|
|
74
|
+
let pipedData = '';
|
|
75
|
+
stdin.on('data', function (chunk) {
|
|
76
|
+
pipedData += chunk;
|
|
77
|
+
});
|
|
78
|
+
stdin.on('end', function () {
|
|
79
|
+
execute(pipedData, argv._);
|
|
80
|
+
});
|
|
81
|
+
return stdin;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Helper function to load and validate SQL file
|
|
85
|
+
function loadSqlFile(filePath) {
|
|
86
|
+
if (!fs.existsSync(filePath)) {
|
|
75
87
|
console.error('Error: file not found');
|
|
76
88
|
process.exit(1);
|
|
77
89
|
}
|
|
78
|
-
|
|
79
|
-
if (isDirectory(argv.f)) {
|
|
90
|
+
if (isDirectory(filePath)) {
|
|
80
91
|
console.error('Error: file expected but directory found');
|
|
81
92
|
process.exit(1);
|
|
82
93
|
}
|
|
94
|
+
return fs.readFileSync(filePath, 'utf8').toString();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Main execution logic
|
|
98
|
+
function main() {
|
|
99
|
+
let sql = '';
|
|
100
|
+
let pipeIsData = false;
|
|
101
|
+
|
|
102
|
+
if (argv.f) {
|
|
103
|
+
sql = loadSqlFile(argv.f);
|
|
104
|
+
pipeIsData = isPipeData(sql);
|
|
105
|
+
} else {
|
|
106
|
+
sql = argv._.shift() || '';
|
|
107
|
+
pipeIsData = isPipeData(sql);
|
|
108
|
+
}
|
|
83
109
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
110
|
+
// Setup stdin handling only if not using txt() pipe
|
|
111
|
+
if (!pipeIsData) {
|
|
112
|
+
pipeIsSQL();
|
|
113
|
+
}
|
|
88
114
|
|
|
89
|
-
// if
|
|
90
|
-
if (
|
|
115
|
+
// Execute immediately if we have SQL or are using txt() pipe
|
|
116
|
+
if (sql || pipeIsData) {
|
|
91
117
|
execute(sql, argv._);
|
|
92
118
|
}
|
|
93
119
|
}
|
|
94
120
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
121
|
+
if (argv.v) {
|
|
122
|
+
console.log(alasql.version);
|
|
123
|
+
process.exit(0);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
main();
|
|
99
127
|
|
|
100
128
|
/**
|
|
101
129
|
* Execute SQL query
|
package/build.sh
CHANGED
|
@@ -172,6 +172,15 @@ x esbuild --minify --outfile="$outfile_min" "$outfile" --allow-overwrite
|
|
|
172
172
|
|
|
173
173
|
|
|
174
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
|
+
|
|
175
184
|
echo '\nBuild worker files'
|
|
176
185
|
outfile="dist/alasql-worker.js"
|
|
177
186
|
outfile_min="dist/alasql-worker.js"
|
package/dist/alasql-worker.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
//! AlaSQL v4.
|
|
1
|
+
//! AlaSQL v4.9.0 build: develop-bb2629fb | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.
|
|
4
|
+
@version 4.9.0
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
|
-
© 2014-
|
|
7
|
+
© 2014-2025 Andrey Gershun & Mathias Wulff
|
|
8
8
|
|
|
9
9
|
@license
|
|
10
10
|
The MIT License (MIT)
|
|
11
11
|
|
|
12
|
-
Copyright 2014-
|
|
12
|
+
Copyright 2014-2025 Andrey Gershun (agershun@gmail.com) & Mathias Wulff (m@rawu.dk)
|
|
13
13
|
|
|
14
14
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
15
|
of this software and associated documentation files (the "Software"), to deal
|