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