jsql-neo 5.5.0 → 6.0.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.
Files changed (81) hide show
  1. package/LICENSE +202 -202
  2. package/README.md +8155 -8097
  3. package/bin/jsql +320 -320
  4. package/bin/jsql-server +90 -90
  5. package/bin/jsql-server-control.js +177 -177
  6. package/index.d.ts +412 -385
  7. package/index.js +128 -124
  8. package/lib/ast.js +214 -214
  9. package/lib/btree.js +478 -413
  10. package/lib/cache.js +328 -328
  11. package/lib/client.js +125 -125
  12. package/lib/database.js +1741 -1744
  13. package/lib/date-types.js +182 -182
  14. package/lib/errors.js +89 -89
  15. package/lib/jsql_format.js +497 -497
  16. package/lib/migrate.js +254 -254
  17. package/lib/mod.js +292 -292
  18. package/lib/mongo_server.js +607 -607
  19. package/lib/multiserver.js +140 -140
  20. package/lib/mysql_compat.js +413 -413
  21. package/lib/mysql_server.js +1237 -1237
  22. package/lib/native_client.js +722 -732
  23. package/lib/nedb_compat.js +506 -506
  24. package/lib/pg_server.js +864 -864
  25. package/lib/plugin.js +259 -35
  26. package/lib/plugins/audit.js +37 -0
  27. package/lib/plugins/index.js +72 -0
  28. package/lib/plugins/logger.js +35 -0
  29. package/lib/plugins/metrics.js +38 -0
  30. package/lib/plugins/timestamps.js +57 -0
  31. package/lib/plugins/validation.js +128 -0
  32. package/lib/prepared.js +37 -0
  33. package/lib/query.js +834 -815
  34. package/lib/redis_server.js +571 -571
  35. package/lib/sql.js +4053 -3460
  36. package/lib/sqlite_compat.js +323 -323
  37. package/lib/sqlite_worker.js +264 -264
  38. package/lib/table.js +1351 -1304
  39. package/lib/tui.js +502 -502
  40. package/lib/wasm.js +1 -1
  41. package/lib/wasm_client.js +715 -718
  42. package/lib/web_ui.js +257 -257
  43. package/native/jsql-neo-native.node +0 -0
  44. package/nativesrc/jsql-neo-core/Cargo.lock +462 -455
  45. package/nativesrc/jsql-neo-core/Cargo.toml +26 -24
  46. package/nativesrc/jsql-neo-core/src/engine/hybrid.rs +492 -455
  47. package/nativesrc/jsql-neo-core/src/engine/memory.rs +191 -168
  48. package/nativesrc/jsql-neo-core/src/engine/mod.rs +74 -62
  49. package/nativesrc/jsql-neo-core/src/engine/table.rs +996 -700
  50. package/nativesrc/jsql-neo-core/src/lib.rs +2 -2
  51. package/nativesrc/jsql-neo-core/src/storage/mod.rs +2 -2
  52. package/nativesrc/jsql-neo-core/src/storage/persistent.rs +1 -1
  53. package/nativesrc/jsql-neo-core/src/storage/wal.rs +298 -85
  54. package/nativesrc/jsql-neo-core/src/types.rs +93 -93
  55. package/nativesrc/jsql-neo-native/Cargo.lock +613 -606
  56. package/nativesrc/jsql-neo-native/Cargo.toml +24 -16
  57. package/nativesrc/jsql-neo-native/build.rs +3 -3
  58. package/nativesrc/jsql-neo-native/package.json +7 -7
  59. package/nativesrc/jsql-neo-native/src/lib.rs +281 -269
  60. package/nativesrc/jsql-neo-wasm/Cargo.lock +472 -465
  61. package/nativesrc/jsql-neo-wasm/Cargo.toml +22 -15
  62. package/nativesrc/jsql-neo-wasm/src/lib.rs +463 -447
  63. package/package.json +87 -87
  64. package/postinstall.js +158 -158
  65. package/test/btree.test.js +144 -128
  66. package/test/coverage.js +187 -187
  67. package/test/join.test.js +110 -110
  68. package/test/native.test.js +158 -158
  69. package/test/query-opt.test.js +109 -0
  70. package/test/regress-5.1.0.js +271 -271
  71. package/test/smoke.js +58 -58
  72. package/test/sql-parser.test.js +450 -273
  73. package/test/wasm.test.js +110 -110
  74. package/wasm/browser.d.ts +89 -89
  75. package/wasm/browser.mjs +591 -569
  76. package/wasm/browser_bg.mjs +618 -597
  77. package/wasm/jsql_neo_wasm.d.ts +44 -38
  78. package/wasm/jsql_neo_wasm.js +641 -520
  79. package/wasm/jsql_neo_wasm_bg.wasm +0 -0
  80. package/wasm/jsql_neo_wasm_bg.wasm.d.ts +26 -26
  81. package/wasm/package.json +11 -11
@@ -1,597 +1,618 @@
1
- /* @ts-self-types="./jsql_neo_wasm.d.ts" */
2
-
3
- /**
4
- * @returns {string}
5
- */
6
- export function jsql_begin_tx() {
7
- let deferred1_0;
8
- let deferred1_1;
9
- try {
10
- const ret = wasm.jsql_begin_tx();
11
- deferred1_0 = ret[0];
12
- deferred1_1 = ret[1];
13
- return getStringFromWasm0(ret[0], ret[1]);
14
- } finally {
15
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
16
- }
17
- }
18
-
19
- /**
20
- * @param {string} tx_id
21
- * @returns {string}
22
- */
23
- export function jsql_commit_tx(tx_id) {
24
- let deferred2_0;
25
- let deferred2_1;
26
- try {
27
- const ptr0 = passStringToWasm0(tx_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28
- const len0 = WASM_VECTOR_LEN;
29
- const ret = wasm.jsql_commit_tx(ptr0, len0);
30
- deferred2_0 = ret[0];
31
- deferred2_1 = ret[1];
32
- return getStringFromWasm0(ret[0], ret[1]);
33
- } finally {
34
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
35
- }
36
- }
37
-
38
- /**
39
- * @param {string} table
40
- * @returns {string}
41
- */
42
- export function jsql_count(table) {
43
- let deferred2_0;
44
- let deferred2_1;
45
- try {
46
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47
- const len0 = WASM_VECTOR_LEN;
48
- const ret = wasm.jsql_count(ptr0, len0);
49
- deferred2_0 = ret[0];
50
- deferred2_1 = ret[1];
51
- return getStringFromWasm0(ret[0], ret[1]);
52
- } finally {
53
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
54
- }
55
- }
56
-
57
- /**
58
- * @param {string} name
59
- * @param {string} schema_json
60
- * @returns {string}
61
- */
62
- export function jsql_create_table(name, schema_json) {
63
- let deferred3_0;
64
- let deferred3_1;
65
- try {
66
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
67
- const len0 = WASM_VECTOR_LEN;
68
- const ptr1 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
69
- const len1 = WASM_VECTOR_LEN;
70
- const ret = wasm.jsql_create_table(ptr0, len0, ptr1, len1);
71
- deferred3_0 = ret[0];
72
- deferred3_1 = ret[1];
73
- return getStringFromWasm0(ret[0], ret[1]);
74
- } finally {
75
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
76
- }
77
- }
78
-
79
- /**
80
- * @param {string} name
81
- * @returns {string}
82
- */
83
- export function jsql_drop_table(name) {
84
- let deferred2_0;
85
- let deferred2_1;
86
- try {
87
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
88
- const len0 = WASM_VECTOR_LEN;
89
- const ret = wasm.jsql_drop_table(ptr0, len0);
90
- deferred2_0 = ret[0];
91
- deferred2_1 = ret[1];
92
- return getStringFromWasm0(ret[0], ret[1]);
93
- } finally {
94
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
95
- }
96
- }
97
-
98
- /**
99
- * @param {string} table
100
- * @param {string} filter_json
101
- * @param {number} limit
102
- * @param {number} offset
103
- * @returns {string}
104
- */
105
- export function jsql_find(table, filter_json, limit, offset) {
106
- let deferred3_0;
107
- let deferred3_1;
108
- try {
109
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
110
- const len0 = WASM_VECTOR_LEN;
111
- const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
112
- const len1 = WASM_VECTOR_LEN;
113
- const ret = wasm.jsql_find(ptr0, len0, ptr1, len1, limit, offset);
114
- deferred3_0 = ret[0];
115
- deferred3_1 = ret[1];
116
- return getStringFromWasm0(ret[0], ret[1]);
117
- } finally {
118
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
119
- }
120
- }
121
-
122
- /**
123
- * @param {string} table
124
- * @param {bigint} id
125
- * @returns {string}
126
- */
127
- export function jsql_find_by_id(table, id) {
128
- let deferred2_0;
129
- let deferred2_1;
130
- try {
131
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
132
- const len0 = WASM_VECTOR_LEN;
133
- const ret = wasm.jsql_find_by_id(ptr0, len0, id);
134
- deferred2_0 = ret[0];
135
- deferred2_1 = ret[1];
136
- return getStringFromWasm0(ret[0], ret[1]);
137
- } finally {
138
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
139
- }
140
- }
141
-
142
- /**
143
- * @param {string} table
144
- * @param {string} ids_json
145
- * @returns {string}
146
- */
147
- export function jsql_find_by_ids(table, ids_json) {
148
- let deferred3_0;
149
- let deferred3_1;
150
- try {
151
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
152
- const len0 = WASM_VECTOR_LEN;
153
- const ptr1 = passStringToWasm0(ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
154
- const len1 = WASM_VECTOR_LEN;
155
- const ret = wasm.jsql_find_by_ids(ptr0, len0, ptr1, len1);
156
- deferred3_0 = ret[0];
157
- deferred3_1 = ret[1];
158
- return getStringFromWasm0(ret[0], ret[1]);
159
- } finally {
160
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
161
- }
162
- }
163
-
164
- /**
165
- * @param {string} table
166
- * @param {string} data_json
167
- * @returns {string}
168
- */
169
- export function jsql_insert(table, data_json) {
170
- let deferred3_0;
171
- let deferred3_1;
172
- try {
173
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
174
- const len0 = WASM_VECTOR_LEN;
175
- const ptr1 = passStringToWasm0(data_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
176
- const len1 = WASM_VECTOR_LEN;
177
- const ret = wasm.jsql_insert(ptr0, len0, ptr1, len1);
178
- deferred3_0 = ret[0];
179
- deferred3_1 = ret[1];
180
- return getStringFromWasm0(ret[0], ret[1]);
181
- } finally {
182
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
183
- }
184
- }
185
-
186
- /**
187
- * @param {string} table
188
- * @param {Uint8Array} data
189
- * @returns {string}
190
- */
191
- export function jsql_insert_buf(table, data) {
192
- let deferred3_0;
193
- let deferred3_1;
194
- try {
195
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
196
- const len0 = WASM_VECTOR_LEN;
197
- const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
198
- const len1 = WASM_VECTOR_LEN;
199
- const ret = wasm.jsql_insert_buf(ptr0, len0, ptr1, len1);
200
- deferred3_0 = ret[0];
201
- deferred3_1 = ret[1];
202
- return getStringFromWasm0(ret[0], ret[1]);
203
- } finally {
204
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
205
- }
206
- }
207
-
208
- /**
209
- * @param {string} table
210
- * @param {Uint8Array} data
211
- * @returns {string}
212
- */
213
- export function jsql_insert_buf_count(table, data) {
214
- let deferred3_0;
215
- let deferred3_1;
216
- try {
217
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
218
- const len0 = WASM_VECTOR_LEN;
219
- const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
220
- const len1 = WASM_VECTOR_LEN;
221
- const ret = wasm.jsql_insert_buf_count(ptr0, len0, ptr1, len1);
222
- deferred3_0 = ret[0];
223
- deferred3_1 = ret[1];
224
- return getStringFromWasm0(ret[0], ret[1]);
225
- } finally {
226
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
227
- }
228
- }
229
-
230
- /**
231
- * @param {string} table
232
- * @param {string} json
233
- * @returns {string}
234
- */
235
- export function jsql_insert_json(table, json) {
236
- let deferred3_0;
237
- let deferred3_1;
238
- try {
239
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
- const len0 = WASM_VECTOR_LEN;
241
- const ptr1 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
242
- const len1 = WASM_VECTOR_LEN;
243
- const ret = wasm.jsql_insert_json(ptr0, len0, ptr1, len1);
244
- deferred3_0 = ret[0];
245
- deferred3_1 = ret[1];
246
- return getStringFromWasm0(ret[0], ret[1]);
247
- } finally {
248
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
249
- }
250
- }
251
-
252
- /**
253
- * @param {string} table
254
- * @param {bigint} id
255
- * @returns {string}
256
- */
257
- export function jsql_remove_by_id(table, id) {
258
- let deferred2_0;
259
- let deferred2_1;
260
- try {
261
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
262
- const len0 = WASM_VECTOR_LEN;
263
- const ret = wasm.jsql_remove_by_id(ptr0, len0, id);
264
- deferred2_0 = ret[0];
265
- deferred2_1 = ret[1];
266
- return getStringFromWasm0(ret[0], ret[1]);
267
- } finally {
268
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
269
- }
270
- }
271
-
272
- /**
273
- * @param {string} table
274
- * @param {string} ids_json
275
- * @returns {string}
276
- */
277
- export function jsql_remove_by_ids(table, ids_json) {
278
- let deferred3_0;
279
- let deferred3_1;
280
- try {
281
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
282
- const len0 = WASM_VECTOR_LEN;
283
- const ptr1 = passStringToWasm0(ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
284
- const len1 = WASM_VECTOR_LEN;
285
- const ret = wasm.jsql_remove_by_ids(ptr0, len0, ptr1, len1);
286
- deferred3_0 = ret[0];
287
- deferred3_1 = ret[1];
288
- return getStringFromWasm0(ret[0], ret[1]);
289
- } finally {
290
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
291
- }
292
- }
293
-
294
- export function jsql_reset() {
295
- wasm.jsql_reset();
296
- }
297
-
298
- /**
299
- * @param {string} tx_id
300
- * @returns {string}
301
- */
302
- export function jsql_rollback_tx(tx_id) {
303
- let deferred2_0;
304
- let deferred2_1;
305
- try {
306
- const ptr0 = passStringToWasm0(tx_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
307
- const len0 = WASM_VECTOR_LEN;
308
- const ret = wasm.jsql_rollback_tx(ptr0, len0);
309
- deferred2_0 = ret[0];
310
- deferred2_1 = ret[1];
311
- return getStringFromWasm0(ret[0], ret[1]);
312
- } finally {
313
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
314
- }
315
- }
316
-
317
- /**
318
- * @param {string} table
319
- * @param {bigint} id
320
- * @param {string} data_json
321
- * @returns {string}
322
- */
323
- export function jsql_update_by_id(table, id, data_json) {
324
- let deferred3_0;
325
- let deferred3_1;
326
- try {
327
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
328
- const len0 = WASM_VECTOR_LEN;
329
- const ptr1 = passStringToWasm0(data_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
330
- const len1 = WASM_VECTOR_LEN;
331
- const ret = wasm.jsql_update_by_id(ptr0, len0, id, ptr1, len1);
332
- deferred3_0 = ret[0];
333
- deferred3_1 = ret[1];
334
- return getStringFromWasm0(ret[0], ret[1]);
335
- } finally {
336
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
337
- }
338
- }
339
-
340
- /**
341
- * @param {string} table
342
- * @param {string} batch_json
343
- * @returns {string}
344
- */
345
- export function jsql_update_by_ids(table, batch_json) {
346
- let deferred3_0;
347
- let deferred3_1;
348
- try {
349
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
350
- const len0 = WASM_VECTOR_LEN;
351
- const ptr1 = passStringToWasm0(batch_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
352
- const len1 = WASM_VECTOR_LEN;
353
- const ret = wasm.jsql_update_by_ids(ptr0, len0, ptr1, len1);
354
- deferred3_0 = ret[0];
355
- deferred3_1 = ret[1];
356
- return getStringFromWasm0(ret[0], ret[1]);
357
- } finally {
358
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
359
- }
360
- }
361
- function __wbg_get_imports() {
362
- const import0 = {
363
- __proto__: null,
364
- __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
365
- const obj = arg1;
366
- const ret = typeof(obj) === 'string' ? obj : undefined;
367
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
368
- var len1 = WASM_VECTOR_LEN;
369
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
370
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
371
- },
372
- __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
373
- throw new Error(getStringFromWasm0(arg0, arg1));
374
- },
375
- __wbg_new_cc984128914cfc6f: function(arg0) {
376
- const ret = new Date(arg0);
377
- return ret;
378
- },
379
- __wbg_now_86c0d4ba3fa605b8: function() {
380
- const ret = Date.now();
381
- return ret;
382
- },
383
- __wbg_toISOString_706fbe321055ee58: function(arg0) {
384
- const ret = arg0.toISOString();
385
- return ret;
386
- },
387
- __wbindgen_cast_0000000000000001: function(arg0) {
388
- // Cast intrinsic for `F64 -> Externref`.
389
- const ret = arg0;
390
- return ret;
391
- },
392
- __wbindgen_init_externref_table: function() {
393
- const table = wasm.__wbindgen_externrefs;
394
- const offset = table.grow(4);
395
- table.set(0, undefined);
396
- table.set(offset + 0, undefined);
397
- table.set(offset + 1, null);
398
- table.set(offset + 2, true);
399
- table.set(offset + 3, false);
400
- },
401
- };
402
- return {
403
- __proto__: null,
404
- "./jsql_neo_wasm_bg.js": import0,
405
- };
406
- }
407
-
408
- let cachedDataViewMemory0 = null;
409
- function getDataViewMemory0() {
410
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
411
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
412
- }
413
- return cachedDataViewMemory0;
414
- }
415
-
416
- function getStringFromWasm0(ptr, len) {
417
- return decodeText(ptr >>> 0, len);
418
- }
419
-
420
- let cachedUint8ArrayMemory0 = null;
421
- function getUint8ArrayMemory0() {
422
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
423
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
424
- }
425
- return cachedUint8ArrayMemory0;
426
- }
427
-
428
- function isLikeNone(x) {
429
- return x === undefined || x === null;
430
- }
431
-
432
- function passArray8ToWasm0(arg, malloc) {
433
- const ptr = malloc(arg.length * 1, 1) >>> 0;
434
- getUint8ArrayMemory0().set(arg, ptr / 1);
435
- WASM_VECTOR_LEN = arg.length;
436
- return ptr;
437
- }
438
-
439
- function passStringToWasm0(arg, malloc, realloc) {
440
- if (realloc === undefined) {
441
- const buf = cachedTextEncoder.encode(arg);
442
- const ptr = malloc(buf.length, 1) >>> 0;
443
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
444
- WASM_VECTOR_LEN = buf.length;
445
- return ptr;
446
- }
447
-
448
- let len = arg.length;
449
- let ptr = malloc(len, 1) >>> 0;
450
-
451
- const mem = getUint8ArrayMemory0();
452
-
453
- let offset = 0;
454
-
455
- for (; offset < len; offset++) {
456
- const code = arg.charCodeAt(offset);
457
- if (code > 0x7F) break;
458
- mem[ptr + offset] = code;
459
- }
460
- if (offset !== len) {
461
- if (offset !== 0) {
462
- arg = arg.slice(offset);
463
- }
464
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
465
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
466
- const ret = cachedTextEncoder.encodeInto(arg, view);
467
-
468
- offset += ret.written;
469
- ptr = realloc(ptr, len, offset, 1) >>> 0;
470
- }
471
-
472
- WASM_VECTOR_LEN = offset;
473
- return ptr;
474
- }
475
-
476
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
477
- cachedTextDecoder.decode();
478
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
479
- let numBytesDecoded = 0;
480
- function decodeText(ptr, len) {
481
- numBytesDecoded += len;
482
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
483
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
484
- cachedTextDecoder.decode();
485
- numBytesDecoded = len;
486
- }
487
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
488
- }
489
-
490
- const cachedTextEncoder = new TextEncoder();
491
-
492
- if (!('encodeInto' in cachedTextEncoder)) {
493
- cachedTextEncoder.encodeInto = function (arg, view) {
494
- const buf = cachedTextEncoder.encode(arg);
495
- view.set(buf);
496
- return {
497
- read: arg.length,
498
- written: buf.length
499
- };
500
- };
501
- }
502
-
503
- let WASM_VECTOR_LEN = 0;
504
-
505
- let wasmModule, wasmInstance, wasm;
506
- function __wbg_finalize_init(instance, module) {
507
- wasmInstance = instance;
508
- wasm = instance.exports;
509
- wasmModule = module;
510
- cachedDataViewMemory0 = null;
511
- cachedUint8ArrayMemory0 = null;
512
- wasm.__wbindgen_start();
513
- return wasm;
514
- }
515
-
516
- async function __wbg_load(module, imports) {
517
- if (typeof Response === 'function' && module instanceof Response) {
518
- if (typeof WebAssembly.instantiateStreaming === 'function') {
519
- try {
520
- return await WebAssembly.instantiateStreaming(module, imports);
521
- } catch (e) {
522
- const validResponse = module.ok && expectedResponseType(module.type);
523
-
524
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
525
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
526
-
527
- } else { throw e; }
528
- }
529
- }
530
-
531
- const bytes = await module.arrayBuffer();
532
- return await WebAssembly.instantiate(bytes, imports);
533
- } else {
534
- const instance = await WebAssembly.instantiate(module, imports);
535
-
536
- if (instance instanceof WebAssembly.Instance) {
537
- return { instance, module };
538
- } else {
539
- return instance;
540
- }
541
- }
542
-
543
- function expectedResponseType(type) {
544
- switch (type) {
545
- case 'basic': case 'cors': case 'default': return true;
546
- }
547
- return false;
548
- }
549
- }
550
-
551
- function initSync(module) {
552
- if (wasm !== undefined) return wasm;
553
-
554
-
555
- if (module !== undefined) {
556
- if (Object.getPrototypeOf(module) === Object.prototype) {
557
- ({module} = module)
558
- } else {
559
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
560
- }
561
- }
562
-
563
- const imports = __wbg_get_imports();
564
- if (!(module instanceof WebAssembly.Module)) {
565
- module = new WebAssembly.Module(module);
566
- }
567
- const instance = new WebAssembly.Instance(module, imports);
568
- return __wbg_finalize_init(instance, module);
569
- }
570
-
571
- async function __wbg_init(module_or_path) {
572
- if (wasm !== undefined) return wasm;
573
-
574
-
575
- if (module_or_path !== undefined) {
576
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
577
- ({module_or_path} = module_or_path)
578
- } else {
579
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
580
- }
581
- }
582
-
583
- if (module_or_path === undefined) {
584
- module_or_path = new URL('jsql_neo_wasm_bg.wasm', import.meta.url);
585
- }
586
- const imports = __wbg_get_imports();
587
-
588
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
589
- module_or_path = fetch(module_or_path);
590
- }
591
-
592
- const { instance, module } = await __wbg_load(await module_or_path, imports);
593
-
594
- return __wbg_finalize_init(instance, module);
595
- }
596
-
597
- export { initSync, __wbg_init as default };
1
+ /**
2
+ * 运行期加列:扩展表结构并为已有行回填默认值。
3
+ * fs_json 为单个 FieldSchema 的 JSON,例如 {"type":"integer","nullable":true,"default":0}
4
+ * @param {string} table
5
+ * @param {string} name
6
+ * @param {string} fs_json
7
+ * @returns {string}
8
+ */
9
+ export function jsql_add_column(table, name, fs_json) {
10
+ let deferred4_0;
11
+ let deferred4_1;
12
+ try {
13
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
14
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
15
+ const len0 = WASM_VECTOR_LEN;
16
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
17
+ const len1 = WASM_VECTOR_LEN;
18
+ const ptr2 = passStringToWasm0(fs_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
19
+ const len2 = WASM_VECTOR_LEN;
20
+ wasm.jsql_add_column(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
21
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
22
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
23
+ deferred4_0 = r0;
24
+ deferred4_1 = r1;
25
+ return getStringFromWasm0(r0, r1);
26
+ } finally {
27
+ wasm.__wbindgen_add_to_stack_pointer(16);
28
+ wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
29
+ }
30
+ }
31
+
32
+ /**
33
+ * @returns {string}
34
+ */
35
+ export function jsql_begin_tx() {
36
+ let deferred1_0;
37
+ let deferred1_1;
38
+ try {
39
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
40
+ wasm.jsql_begin_tx(retptr);
41
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
42
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
43
+ deferred1_0 = r0;
44
+ deferred1_1 = r1;
45
+ return getStringFromWasm0(r0, r1);
46
+ } finally {
47
+ wasm.__wbindgen_add_to_stack_pointer(16);
48
+ wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * @param {string} tx_id
54
+ * @returns {string}
55
+ */
56
+ export function jsql_commit_tx(tx_id) {
57
+ let deferred2_0;
58
+ let deferred2_1;
59
+ try {
60
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
61
+ const ptr0 = passStringToWasm0(tx_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
62
+ const len0 = WASM_VECTOR_LEN;
63
+ wasm.jsql_commit_tx(retptr, ptr0, len0);
64
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
65
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
66
+ deferred2_0 = r0;
67
+ deferred2_1 = r1;
68
+ return getStringFromWasm0(r0, r1);
69
+ } finally {
70
+ wasm.__wbindgen_add_to_stack_pointer(16);
71
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
72
+ }
73
+ }
74
+
75
+ /**
76
+ * @param {string} table
77
+ * @returns {string}
78
+ */
79
+ export function jsql_count(table) {
80
+ let deferred2_0;
81
+ let deferred2_1;
82
+ try {
83
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
84
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
85
+ const len0 = WASM_VECTOR_LEN;
86
+ wasm.jsql_count(retptr, ptr0, len0);
87
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
88
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
89
+ deferred2_0 = r0;
90
+ deferred2_1 = r1;
91
+ return getStringFromWasm0(r0, r1);
92
+ } finally {
93
+ wasm.__wbindgen_add_to_stack_pointer(16);
94
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
95
+ }
96
+ }
97
+
98
+ /**
99
+ * @param {string} name
100
+ * @param {string} schema_json
101
+ * @returns {string}
102
+ */
103
+ export function jsql_create_table(name, schema_json) {
104
+ let deferred3_0;
105
+ let deferred3_1;
106
+ try {
107
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
108
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
109
+ const len0 = WASM_VECTOR_LEN;
110
+ const ptr1 = passStringToWasm0(schema_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
111
+ const len1 = WASM_VECTOR_LEN;
112
+ wasm.jsql_create_table(retptr, ptr0, len0, ptr1, len1);
113
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
114
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
115
+ deferred3_0 = r0;
116
+ deferred3_1 = r1;
117
+ return getStringFromWasm0(r0, r1);
118
+ } finally {
119
+ wasm.__wbindgen_add_to_stack_pointer(16);
120
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
121
+ }
122
+ }
123
+
124
+ /**
125
+ * @param {string} name
126
+ * @returns {string}
127
+ */
128
+ export function jsql_drop_table(name) {
129
+ let deferred2_0;
130
+ let deferred2_1;
131
+ try {
132
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
133
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
134
+ const len0 = WASM_VECTOR_LEN;
135
+ wasm.jsql_drop_table(retptr, ptr0, len0);
136
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
137
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
138
+ deferred2_0 = r0;
139
+ deferred2_1 = r1;
140
+ return getStringFromWasm0(r0, r1);
141
+ } finally {
142
+ wasm.__wbindgen_add_to_stack_pointer(16);
143
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
144
+ }
145
+ }
146
+
147
+ /**
148
+ * @param {string} table
149
+ * @param {string} filter_json
150
+ * @param {number} limit
151
+ * @param {number} offset
152
+ * @returns {string}
153
+ */
154
+ export function jsql_find(table, filter_json, limit, offset) {
155
+ let deferred3_0;
156
+ let deferred3_1;
157
+ try {
158
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
159
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
160
+ const len0 = WASM_VECTOR_LEN;
161
+ const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
162
+ const len1 = WASM_VECTOR_LEN;
163
+ wasm.jsql_find(retptr, ptr0, len0, ptr1, len1, limit, offset);
164
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
165
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
166
+ deferred3_0 = r0;
167
+ deferred3_1 = r1;
168
+ return getStringFromWasm0(r0, r1);
169
+ } finally {
170
+ wasm.__wbindgen_add_to_stack_pointer(16);
171
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
172
+ }
173
+ }
174
+
175
+ /**
176
+ * @param {string} table
177
+ * @param {bigint} id
178
+ * @returns {string}
179
+ */
180
+ export function jsql_find_by_id(table, id) {
181
+ let deferred2_0;
182
+ let deferred2_1;
183
+ try {
184
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
185
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
186
+ const len0 = WASM_VECTOR_LEN;
187
+ wasm.jsql_find_by_id(retptr, ptr0, len0, id);
188
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
189
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
190
+ deferred2_0 = r0;
191
+ deferred2_1 = r1;
192
+ return getStringFromWasm0(r0, r1);
193
+ } finally {
194
+ wasm.__wbindgen_add_to_stack_pointer(16);
195
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
196
+ }
197
+ }
198
+
199
+ /**
200
+ * @param {string} table
201
+ * @param {string} ids_json
202
+ * @returns {string}
203
+ */
204
+ export function jsql_find_by_ids(table, ids_json) {
205
+ let deferred3_0;
206
+ let deferred3_1;
207
+ try {
208
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
209
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
210
+ const len0 = WASM_VECTOR_LEN;
211
+ const ptr1 = passStringToWasm0(ids_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
212
+ const len1 = WASM_VECTOR_LEN;
213
+ wasm.jsql_find_by_ids(retptr, ptr0, len0, ptr1, len1);
214
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
215
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
216
+ deferred3_0 = r0;
217
+ deferred3_1 = r1;
218
+ return getStringFromWasm0(r0, r1);
219
+ } finally {
220
+ wasm.__wbindgen_add_to_stack_pointer(16);
221
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
222
+ }
223
+ }
224
+
225
+ /**
226
+ * @param {string} table
227
+ * @param {string} data_json
228
+ * @returns {string}
229
+ */
230
+ export function jsql_insert(table, data_json) {
231
+ let deferred3_0;
232
+ let deferred3_1;
233
+ try {
234
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
235
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
236
+ const len0 = WASM_VECTOR_LEN;
237
+ const ptr1 = passStringToWasm0(data_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
238
+ const len1 = WASM_VECTOR_LEN;
239
+ wasm.jsql_insert(retptr, ptr0, len0, ptr1, len1);
240
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
241
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
242
+ deferred3_0 = r0;
243
+ deferred3_1 = r1;
244
+ return getStringFromWasm0(r0, r1);
245
+ } finally {
246
+ wasm.__wbindgen_add_to_stack_pointer(16);
247
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
248
+ }
249
+ }
250
+
251
+ /**
252
+ * @param {string} table
253
+ * @param {Uint8Array} data
254
+ * @returns {string}
255
+ */
256
+ export function jsql_insert_buf(table, data) {
257
+ let deferred3_0;
258
+ let deferred3_1;
259
+ try {
260
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
261
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
262
+ const len0 = WASM_VECTOR_LEN;
263
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);
264
+ const len1 = WASM_VECTOR_LEN;
265
+ wasm.jsql_insert_buf(retptr, ptr0, len0, ptr1, len1);
266
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
267
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
268
+ deferred3_0 = r0;
269
+ deferred3_1 = r1;
270
+ return getStringFromWasm0(r0, r1);
271
+ } finally {
272
+ wasm.__wbindgen_add_to_stack_pointer(16);
273
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
274
+ }
275
+ }
276
+
277
+ /**
278
+ * @param {string} table
279
+ * @param {Uint8Array} data
280
+ * @returns {string}
281
+ */
282
+ export function jsql_insert_buf_count(table, data) {
283
+ let deferred3_0;
284
+ let deferred3_1;
285
+ try {
286
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
287
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
288
+ const len0 = WASM_VECTOR_LEN;
289
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);
290
+ const len1 = WASM_VECTOR_LEN;
291
+ wasm.jsql_insert_buf_count(retptr, ptr0, len0, ptr1, len1);
292
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
293
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
294
+ deferred3_0 = r0;
295
+ deferred3_1 = r1;
296
+ return getStringFromWasm0(r0, r1);
297
+ } finally {
298
+ wasm.__wbindgen_add_to_stack_pointer(16);
299
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
300
+ }
301
+ }
302
+
303
+ /**
304
+ * @param {string} table
305
+ * @param {string} json
306
+ * @returns {string}
307
+ */
308
+ export function jsql_insert_json(table, json) {
309
+ let deferred3_0;
310
+ let deferred3_1;
311
+ try {
312
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
313
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
314
+ const len0 = WASM_VECTOR_LEN;
315
+ const ptr1 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
316
+ const len1 = WASM_VECTOR_LEN;
317
+ wasm.jsql_insert_json(retptr, ptr0, len0, ptr1, len1);
318
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
319
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
320
+ deferred3_0 = r0;
321
+ deferred3_1 = r1;
322
+ return getStringFromWasm0(r0, r1);
323
+ } finally {
324
+ wasm.__wbindgen_add_to_stack_pointer(16);
325
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
326
+ }
327
+ }
328
+
329
+ /**
330
+ * @param {string} table
331
+ * @param {bigint} id
332
+ * @returns {string}
333
+ */
334
+ export function jsql_remove_by_id(table, id) {
335
+ let deferred2_0;
336
+ let deferred2_1;
337
+ try {
338
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
339
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
340
+ const len0 = WASM_VECTOR_LEN;
341
+ wasm.jsql_remove_by_id(retptr, ptr0, len0, id);
342
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
343
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
344
+ deferred2_0 = r0;
345
+ deferred2_1 = r1;
346
+ return getStringFromWasm0(r0, r1);
347
+ } finally {
348
+ wasm.__wbindgen_add_to_stack_pointer(16);
349
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
350
+ }
351
+ }
352
+
353
+ /**
354
+ * @param {string} table
355
+ * @param {string} ids_json
356
+ * @returns {string}
357
+ */
358
+ export function jsql_remove_by_ids(table, ids_json) {
359
+ let deferred3_0;
360
+ let deferred3_1;
361
+ try {
362
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
363
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
364
+ const len0 = WASM_VECTOR_LEN;
365
+ const ptr1 = passStringToWasm0(ids_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
366
+ const len1 = WASM_VECTOR_LEN;
367
+ wasm.jsql_remove_by_ids(retptr, ptr0, len0, ptr1, len1);
368
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
369
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
370
+ deferred3_0 = r0;
371
+ deferred3_1 = r1;
372
+ return getStringFromWasm0(r0, r1);
373
+ } finally {
374
+ wasm.__wbindgen_add_to_stack_pointer(16);
375
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
376
+ }
377
+ }
378
+
379
+ export function jsql_reset() {
380
+ wasm.jsql_reset();
381
+ }
382
+
383
+ /**
384
+ * @param {string} tx_id
385
+ * @returns {string}
386
+ */
387
+ export function jsql_rollback_tx(tx_id) {
388
+ let deferred2_0;
389
+ let deferred2_1;
390
+ try {
391
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
392
+ const ptr0 = passStringToWasm0(tx_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
393
+ const len0 = WASM_VECTOR_LEN;
394
+ wasm.jsql_rollback_tx(retptr, ptr0, len0);
395
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
396
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
397
+ deferred2_0 = r0;
398
+ deferred2_1 = r1;
399
+ return getStringFromWasm0(r0, r1);
400
+ } finally {
401
+ wasm.__wbindgen_add_to_stack_pointer(16);
402
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
403
+ }
404
+ }
405
+
406
+ /**
407
+ * @param {string} table
408
+ * @param {bigint} id
409
+ * @param {string} data_json
410
+ * @returns {string}
411
+ */
412
+ export function jsql_update_by_id(table, id, data_json) {
413
+ let deferred3_0;
414
+ let deferred3_1;
415
+ try {
416
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
417
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
418
+ const len0 = WASM_VECTOR_LEN;
419
+ const ptr1 = passStringToWasm0(data_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
420
+ const len1 = WASM_VECTOR_LEN;
421
+ wasm.jsql_update_by_id(retptr, ptr0, len0, id, ptr1, len1);
422
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
423
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
424
+ deferred3_0 = r0;
425
+ deferred3_1 = r1;
426
+ return getStringFromWasm0(r0, r1);
427
+ } finally {
428
+ wasm.__wbindgen_add_to_stack_pointer(16);
429
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
430
+ }
431
+ }
432
+
433
+ /**
434
+ * @param {string} table
435
+ * @param {string} batch_json
436
+ * @returns {string}
437
+ */
438
+ export function jsql_update_by_ids(table, batch_json) {
439
+ let deferred3_0;
440
+ let deferred3_1;
441
+ try {
442
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
443
+ const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export, wasm.__wbindgen_export2);
444
+ const len0 = WASM_VECTOR_LEN;
445
+ const ptr1 = passStringToWasm0(batch_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
446
+ const len1 = WASM_VECTOR_LEN;
447
+ wasm.jsql_update_by_ids(retptr, ptr0, len0, ptr1, len1);
448
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
449
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
450
+ deferred3_0 = r0;
451
+ deferred3_1 = r1;
452
+ return getStringFromWasm0(r0, r1);
453
+ } finally {
454
+ wasm.__wbindgen_add_to_stack_pointer(16);
455
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
456
+ }
457
+ }
458
+ export function __wbg___wbindgen_string_get_b0ca35b86a603356(arg0, arg1) {
459
+ const obj = getObject(arg1);
460
+ const ret = typeof(obj) === 'string' ? obj : undefined;
461
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
462
+ var len1 = WASM_VECTOR_LEN;
463
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
464
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
465
+ }
466
+ export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
467
+ throw new Error(getStringFromWasm0(arg0, arg1));
468
+ }
469
+ export function __wbg_new_cc984128914cfc6f(arg0) {
470
+ const ret = new Date(getObject(arg0));
471
+ return addHeapObject(ret);
472
+ }
473
+ export function __wbg_now_86c0d4ba3fa605b8() {
474
+ const ret = Date.now();
475
+ return ret;
476
+ }
477
+ export function __wbg_toISOString_706fbe321055ee58(arg0) {
478
+ const ret = getObject(arg0).toISOString();
479
+ return addHeapObject(ret);
480
+ }
481
+ export function __wbindgen_cast_0000000000000001(arg0) {
482
+ // Cast intrinsic for `F64 -> Externref`.
483
+ const ret = arg0;
484
+ return addHeapObject(ret);
485
+ }
486
+ export function __wbindgen_object_drop_ref(arg0) {
487
+ takeObject(arg0);
488
+ }
489
+ function addHeapObject(obj) {
490
+ if (heap_next === heap.length) heap.push(heap.length + 1);
491
+ const idx = heap_next;
492
+ heap_next = heap[idx];
493
+
494
+ heap[idx] = obj;
495
+ return idx;
496
+ }
497
+
498
+ function dropObject(idx) {
499
+ if (idx < 1028) return;
500
+ heap[idx] = heap_next;
501
+ heap_next = idx;
502
+ }
503
+
504
+ let cachedDataViewMemory0 = null;
505
+ function getDataViewMemory0() {
506
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
507
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
508
+ }
509
+ return cachedDataViewMemory0;
510
+ }
511
+
512
+ function getStringFromWasm0(ptr, len) {
513
+ return decodeText(ptr >>> 0, len);
514
+ }
515
+
516
+ let cachedUint8ArrayMemory0 = null;
517
+ function getUint8ArrayMemory0() {
518
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
519
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
520
+ }
521
+ return cachedUint8ArrayMemory0;
522
+ }
523
+
524
+ function getObject(idx) { return heap[idx]; }
525
+
526
+ let heap = new Array(1024).fill(undefined);
527
+ heap.push(undefined, null, true, false);
528
+
529
+ let heap_next = heap.length;
530
+
531
+ function isLikeNone(x) {
532
+ return x === undefined || x === null;
533
+ }
534
+
535
+ function passArray8ToWasm0(arg, malloc) {
536
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
537
+ getUint8ArrayMemory0().set(arg, ptr / 1);
538
+ WASM_VECTOR_LEN = arg.length;
539
+ return ptr;
540
+ }
541
+
542
+ function passStringToWasm0(arg, malloc, realloc) {
543
+ if (realloc === undefined) {
544
+ const buf = cachedTextEncoder.encode(arg);
545
+ const ptr = malloc(buf.length, 1) >>> 0;
546
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
547
+ WASM_VECTOR_LEN = buf.length;
548
+ return ptr;
549
+ }
550
+
551
+ let len = arg.length;
552
+ let ptr = malloc(len, 1) >>> 0;
553
+
554
+ const mem = getUint8ArrayMemory0();
555
+
556
+ let offset = 0;
557
+
558
+ for (; offset < len; offset++) {
559
+ const code = arg.charCodeAt(offset);
560
+ if (code > 0x7F) break;
561
+ mem[ptr + offset] = code;
562
+ }
563
+ if (offset !== len) {
564
+ if (offset !== 0) {
565
+ arg = arg.slice(offset);
566
+ }
567
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
568
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
569
+ const ret = cachedTextEncoder.encodeInto(arg, view);
570
+
571
+ offset += ret.written;
572
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
573
+ }
574
+
575
+ WASM_VECTOR_LEN = offset;
576
+ return ptr;
577
+ }
578
+
579
+ function takeObject(idx) {
580
+ const ret = getObject(idx);
581
+ dropObject(idx);
582
+ return ret;
583
+ }
584
+
585
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
586
+ cachedTextDecoder.decode();
587
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
588
+ let numBytesDecoded = 0;
589
+ function decodeText(ptr, len) {
590
+ numBytesDecoded += len;
591
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
592
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
593
+ cachedTextDecoder.decode();
594
+ numBytesDecoded = len;
595
+ }
596
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
597
+ }
598
+
599
+ const cachedTextEncoder = new TextEncoder();
600
+
601
+ if (!('encodeInto' in cachedTextEncoder)) {
602
+ cachedTextEncoder.encodeInto = function (arg, view) {
603
+ const buf = cachedTextEncoder.encode(arg);
604
+ view.set(buf);
605
+ return {
606
+ read: arg.length,
607
+ written: buf.length
608
+ };
609
+ };
610
+ }
611
+
612
+ let WASM_VECTOR_LEN = 0;
613
+
614
+
615
+ let wasm;
616
+ export function __wbg_set_wasm(val) {
617
+ wasm = val;
618
+ }