jsql-neo 5.4.0 → 5.4.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/LICENSE +0 -0
- package/README.md +0 -0
- package/bin/jsql +0 -0
- package/bin/jsql-server +0 -0
- package/bin/jsql-server-control.js +0 -0
- package/index.d.ts +0 -0
- package/index.js +0 -0
- package/lib/btree.js +0 -0
- package/lib/cache.js +0 -0
- package/lib/client.js +0 -0
- package/lib/database.js +0 -0
- package/lib/date-types.js +0 -0
- package/lib/errors.js +0 -0
- package/lib/jsql_format.js +0 -0
- package/lib/migrate.js +0 -0
- package/lib/mod.js +0 -0
- package/lib/mongo_server.js +0 -0
- package/lib/multiserver.js +0 -0
- package/lib/mysql_compat.js +0 -0
- package/lib/mysql_server.js +0 -0
- package/lib/native_client.js +0 -0
- package/lib/nedb_compat.js +0 -0
- package/lib/pg_server.js +0 -0
- package/lib/plugin.js +0 -0
- package/lib/query.js +0 -0
- package/lib/redis_server.js +0 -0
- package/lib/sql.js +0 -0
- package/lib/sqlite_compat.js +0 -0
- package/lib/sqlite_worker.js +0 -0
- package/lib/table.js +0 -0
- package/lib/tui.js +0 -0
- package/lib/wasm.js +0 -0
- package/lib/wasm_client.js +0 -0
- package/lib/web_ui.js +0 -0
- package/nativesrc/jsql-neo-core/Cargo.lock +0 -0
- package/nativesrc/jsql-neo-core/Cargo.toml +0 -0
- package/nativesrc/jsql-neo-core/src/engine/hybrid.rs +0 -0
- package/nativesrc/jsql-neo-core/src/engine/memory.rs +0 -0
- package/nativesrc/jsql-neo-core/src/engine/mod.rs +0 -0
- package/nativesrc/jsql-neo-core/src/engine/table.rs +0 -0
- package/nativesrc/jsql-neo-core/src/lib.rs +0 -0
- package/nativesrc/jsql-neo-core/src/storage/mod.rs +0 -0
- package/nativesrc/jsql-neo-core/src/storage/persistent.rs +0 -0
- package/nativesrc/jsql-neo-core/src/storage/wal.rs +0 -0
- package/nativesrc/jsql-neo-core/src/types.rs +0 -0
- package/nativesrc/jsql-neo-native/Cargo.lock +0 -0
- package/nativesrc/jsql-neo-native/Cargo.toml +0 -0
- package/nativesrc/jsql-neo-native/build.rs +0 -0
- package/nativesrc/jsql-neo-native/jsql-neo-native.node +0 -0
- package/nativesrc/jsql-neo-native/package.json +0 -0
- package/nativesrc/jsql-neo-native/src/lib.rs +0 -0
- package/nativesrc/jsql-neo-wasm/Cargo.lock +0 -0
- package/nativesrc/jsql-neo-wasm/Cargo.toml +0 -0
- package/nativesrc/jsql-neo-wasm/src/lib.rs +0 -0
- package/package.json +1 -1
- package/postinstall.js +146 -25
- package/test/btree.test.js +0 -0
- package/test/coverage.js +0 -0
- package/test/join.test.js +0 -0
- package/test/native.test.js +0 -0
- package/test/regress-5.1.0.js +0 -0
- package/test/smoke.js +0 -0
- package/test/wasm.test.js +0 -0
- package/wasm/browser.d.ts +0 -0
- package/wasm/browser.mjs +0 -0
- package/wasm/browser_bg.mjs +0 -0
- package/wasm/jsql_neo_wasm.d.ts +0 -0
- package/wasm/jsql_neo_wasm.js +0 -0
- package/wasm/jsql_neo_wasm_bg.wasm +0 -0
- package/wasm/jsql_neo_wasm_bg.wasm.d.ts +0 -0
- package/wasm/package.json +0 -0
- package/bin/jsql-neo-server +0 -0
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/bin/jsql
CHANGED
|
File without changes
|
package/bin/jsql-server
CHANGED
|
File without changes
|
|
File without changes
|
package/index.d.ts
CHANGED
|
File without changes
|
package/index.js
CHANGED
|
File without changes
|
package/lib/btree.js
CHANGED
|
File without changes
|
package/lib/cache.js
CHANGED
|
File without changes
|
package/lib/client.js
CHANGED
|
File without changes
|
package/lib/database.js
CHANGED
|
File without changes
|
package/lib/date-types.js
CHANGED
|
File without changes
|
package/lib/errors.js
CHANGED
|
File without changes
|
package/lib/jsql_format.js
CHANGED
|
File without changes
|
package/lib/migrate.js
CHANGED
|
File without changes
|
package/lib/mod.js
CHANGED
|
File without changes
|
package/lib/mongo_server.js
CHANGED
|
File without changes
|
package/lib/multiserver.js
CHANGED
|
File without changes
|
package/lib/mysql_compat.js
CHANGED
|
File without changes
|
package/lib/mysql_server.js
CHANGED
|
File without changes
|
package/lib/native_client.js
CHANGED
|
File without changes
|
package/lib/nedb_compat.js
CHANGED
|
File without changes
|
package/lib/pg_server.js
CHANGED
|
File without changes
|
package/lib/plugin.js
CHANGED
|
File without changes
|
package/lib/query.js
CHANGED
|
File without changes
|
package/lib/redis_server.js
CHANGED
|
File without changes
|
package/lib/sql.js
CHANGED
|
File without changes
|
package/lib/sqlite_compat.js
CHANGED
|
File without changes
|
package/lib/sqlite_worker.js
CHANGED
|
File without changes
|
package/lib/table.js
CHANGED
|
File without changes
|
package/lib/tui.js
CHANGED
|
File without changes
|
package/lib/wasm.js
CHANGED
|
File without changes
|
package/lib/wasm_client.js
CHANGED
|
File without changes
|
package/lib/web_ui.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -1,38 +1,159 @@
|
|
|
1
1
|
const { execSync } = require('child_process');
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const http = require('http');
|
|
5
|
+
const https = require('https');
|
|
4
6
|
|
|
7
|
+
const ROOT = __dirname;
|
|
8
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
|
|
9
|
+
|
|
10
|
+
// Server CLI binary (bin/jsql-neo-server)
|
|
5
11
|
const BIN_NAME = process.platform === 'win32' ? 'jsql-neo-server.exe' : 'jsql-neo-server';
|
|
6
|
-
const BP = path.join(
|
|
12
|
+
const BP = path.join(ROOT, 'bin', BIN_NAME);
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
// Native N-API module (native/jsql-neo-native.node)
|
|
15
|
+
const NATIVE_PATH = path.join(ROOT, 'native', 'jsql-neo-native.node');
|
|
16
|
+
|
|
17
|
+
// GitHub 加速代理前缀;把原始 github 链接直接拼在后面即可
|
|
18
|
+
const GHPROXY = 'https://gh-proxy.com/';
|
|
19
|
+
const TAG = `v${pkg.version}`;
|
|
20
|
+
|
|
21
|
+
// 从 repository 字段提取 owner/repo,例如 vexify-org/JSQL-neo
|
|
22
|
+
const REPO = (pkg.repository && pkg.repository.url)
|
|
23
|
+
? pkg.repository.url.replace(/\.git$/, '').replace(/^.*github\.com\//i, '')
|
|
24
|
+
: 'vexify-org/JSQL-neo';
|
|
25
|
+
|
|
26
|
+
// 与 .github/workflows/build-native.yml 中发布的资产命名保持一致
|
|
27
|
+
function nativeTargetSuffix(platform = process.platform, arch = process.arch) {
|
|
28
|
+
const p = platform === 'win32' ? 'win32' : platform === 'darwin' ? 'darwin' : 'linux';
|
|
29
|
+
const a = arch === 'x64' ? 'x64' : arch === 'arm64' ? 'arm64' : arch;
|
|
30
|
+
if (p === 'linux') return `${p}-${a}-gnu`;
|
|
31
|
+
if (p === 'darwin') return `${p}-${a}`;
|
|
32
|
+
return `${p}-${a}-msvc`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function download(url, dest) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const mod = url.startsWith('https:') ? https : http;
|
|
38
|
+
const req = mod.get(url, (res) => {
|
|
39
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
40
|
+
res.resume();
|
|
41
|
+
download(res.headers.location, dest).then(resolve, reject);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (res.statusCode !== 200) {
|
|
45
|
+
res.resume();
|
|
46
|
+
reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
12
47
|
return;
|
|
48
|
+
}
|
|
49
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
50
|
+
const ws = fs.createWriteStream(dest);
|
|
51
|
+
ws.on('error', reject);
|
|
52
|
+
res.pipe(ws);
|
|
53
|
+
res.on('end', () => ws.end(() => resolve()));
|
|
54
|
+
});
|
|
55
|
+
req.on('error', reject);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function buildNativeFromSource() {
|
|
60
|
+
const crate = path.join(ROOT, 'nativesrc', 'jsql-neo-native');
|
|
61
|
+
if (!fs.existsSync(path.join(crate, 'Cargo.toml'))) return;
|
|
62
|
+
console.log('[jsql-neo] building native module from source...');
|
|
63
|
+
try {
|
|
64
|
+
execSync('cargo build --release', { cwd: crate, stdio: 'inherit' });
|
|
65
|
+
const rel = path.join(crate, 'target', 'release');
|
|
66
|
+
const src = process.platform === 'win32'
|
|
67
|
+
? path.join(rel, 'jsql_neo_native.dll')
|
|
68
|
+
: process.platform === 'darwin'
|
|
69
|
+
? path.join(rel, 'libjsql_neo_native.dylib')
|
|
70
|
+
: path.join(rel, 'libjsql_neo_native.so');
|
|
71
|
+
if (fs.existsSync(src)) {
|
|
72
|
+
fs.mkdirSync(path.dirname(NATIVE_PATH), { recursive: true });
|
|
73
|
+
fs.copyFileSync(src, NATIVE_PATH);
|
|
74
|
+
fs.chmodSync(NATIVE_PATH, 0o755);
|
|
75
|
+
console.log(`[jsql-neo] native module built: native/jsql-neo-native.node`);
|
|
13
76
|
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
console.warn('[jsql-neo] native build failed:', e.message);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
14
81
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
82
|
+
// 尝试加载 native 模块;能成功 require 才算「可用」,否则视为不可用
|
|
83
|
+
function tryLoadNative() {
|
|
84
|
+
if (!fs.existsSync(NATIVE_PATH)) return false;
|
|
85
|
+
try {
|
|
86
|
+
require(NATIVE_PATH);
|
|
87
|
+
fs.chmodSync(NATIVE_PATH, 0o755);
|
|
88
|
+
return true;
|
|
89
|
+
} catch (e) {
|
|
90
|
+
console.warn(`[jsql-neo] existing native module cannot be loaded (${e.code || e.message}), will re-acquire.`);
|
|
91
|
+
try { fs.unlinkSync(NATIVE_PATH); } catch (_) { /* ignore */ }
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function downloadAndVerify() {
|
|
97
|
+
const asset = `jsql-neo-native.${nativeTargetSuffix()}.node`;
|
|
98
|
+
const url = `${GHPROXY}https://github.com/${REPO}/releases/download/${TAG}/${asset}`;
|
|
99
|
+
console.log(`[jsql-neo] downloading native module: ${url}`);
|
|
100
|
+
try {
|
|
101
|
+
await download(url, NATIVE_PATH);
|
|
102
|
+
if (!tryLoadNative()) {
|
|
103
|
+
console.warn('[jsql-neo] downloaded module also invalid, removed.');
|
|
104
|
+
return false;
|
|
32
105
|
}
|
|
106
|
+
console.log('[jsql-neo] native module downloaded: native/jsql-neo-native.node');
|
|
107
|
+
return true;
|
|
108
|
+
} catch (e) {
|
|
109
|
+
console.warn('[jsql-neo] download failed, falling back to source build:', e.message);
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async function ensureNativeNode() {
|
|
115
|
+
// 已存在且能加载 → 直接用;否则删掉并从 gh-proxy.com 下载,找不到才回退源码编译
|
|
116
|
+
if (tryLoadNative()) {
|
|
117
|
+
console.log('[jsql-neo] native module ready: native/jsql-neo-native.node');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (await downloadAndVerify()) return;
|
|
121
|
+
buildNativeFromSource();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function ensureServerBinary() {
|
|
125
|
+
if (fs.existsSync(BP)) {
|
|
126
|
+
fs.chmodSync(BP, 0o755);
|
|
127
|
+
console.log(`[jsql-neo] binary ready: ${BP}`);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Build from source
|
|
132
|
+
const serverDir = path.join(ROOT, '..', 'jsql-neo-server');
|
|
133
|
+
if (fs.existsSync(path.join(serverDir, 'Cargo.toml'))) {
|
|
134
|
+
console.log('[jsql-neo] building Rust server from source...');
|
|
135
|
+
try {
|
|
136
|
+
execSync('cargo build --release', { cwd: serverDir, stdio: 'inherit' });
|
|
137
|
+
const src = path.join(serverDir, 'target', 'release', BIN_NAME);
|
|
138
|
+
if (fs.existsSync(src)) {
|
|
139
|
+
fs.mkdirSync(path.join(ROOT, 'bin'), { recursive: true });
|
|
140
|
+
fs.copyFileSync(src, BP);
|
|
141
|
+
fs.chmodSync(BP, 0o755);
|
|
142
|
+
console.log(`[jsql-neo] binary built: ${BP}`);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
} catch (e) {
|
|
146
|
+
console.warn('[jsql-neo] cargo build failed:', e.message);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
console.warn(`[jsql-neo] server binary not found at ${BP}`);
|
|
151
|
+
console.warn('[jsql-neo] install Rust from https://rustup.rs and run: npm run build');
|
|
152
|
+
}
|
|
33
153
|
|
|
34
|
-
|
|
35
|
-
|
|
154
|
+
async function main() {
|
|
155
|
+
await ensureNativeNode();
|
|
156
|
+
ensureServerBinary();
|
|
36
157
|
}
|
|
37
158
|
|
|
38
|
-
main();
|
|
159
|
+
main();
|
package/test/btree.test.js
CHANGED
|
File without changes
|
package/test/coverage.js
CHANGED
|
File without changes
|
package/test/join.test.js
CHANGED
|
File without changes
|
package/test/native.test.js
CHANGED
|
File without changes
|
package/test/regress-5.1.0.js
CHANGED
|
File without changes
|
package/test/smoke.js
CHANGED
|
File without changes
|
package/test/wasm.test.js
CHANGED
|
File without changes
|
package/wasm/browser.d.ts
CHANGED
|
File without changes
|
package/wasm/browser.mjs
CHANGED
|
File without changes
|
package/wasm/browser_bg.mjs
CHANGED
|
File without changes
|
package/wasm/jsql_neo_wasm.d.ts
CHANGED
|
File without changes
|
package/wasm/jsql_neo_wasm.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/wasm/package.json
CHANGED
|
File without changes
|
package/bin/jsql-neo-server
DELETED
|
Binary file
|