@rainlanguage/sqlite-web 0.0.3 → 0.0.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rainlanguage/sqlite-web",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/rainlanguage/sqlite-web"
package/sqlite_web.d.ts CHANGED
@@ -12,6 +12,27 @@ export class SQLiteWasmDatabase {
12
12
  private constructor();
13
13
  free(): void;
14
14
  [Symbol.dispose](): void;
15
+ /**
16
+ * Append up to 512 KiB of SQL text. Chunks may split a SQL statement,
17
+ * but must contain valid UTF-16 without splitting a surrogate pair.
18
+ * The dump's outer BEGIN/COMMIT statements are accepted but owned by the worker.
19
+ */
20
+ appendSqlDumpChunk(id: string, sql: any): Promise<WasmEncodedResult<string>>;
21
+ /**
22
+ * Begin an atomic SQL dump import. Append bounded text chunks, then finish
23
+ * to commit. SQL validation/execution failures and cancellation roll back.
24
+ * Worker loss during finish can leave the commit outcome unknown, including
25
+ * when the coordinator returns an error; check or reset before retrying.
26
+ */
27
+ beginSqlDumpImport(): Promise<WasmEncodedResult<string>>;
28
+ /**
29
+ * Roll back the active import.
30
+ */
31
+ cancelSqlDumpImport(id: string): Promise<WasmEncodedResult<string>>;
32
+ /**
33
+ * Commit all imported statements. A partial trailing statement rolls back.
34
+ */
35
+ finishSqlDumpImport(id: string): Promise<WasmEncodedResult<string>>;
15
36
  /**
16
37
  * Create a new database connection with fully embedded worker
17
38
  */
@@ -37,14 +58,18 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
37
58
  export interface InitOutput {
38
59
  readonly memory: WebAssembly.Memory;
39
60
  readonly __wbg_sqlitewasmdatabase_free: (a: number, b: number) => void;
61
+ readonly sqlitewasmdatabase_appendSqlDumpChunk: (a: number, b: number, c: number, d: any) => any;
62
+ readonly sqlitewasmdatabase_beginSqlDumpImport: (a: number) => any;
63
+ readonly sqlitewasmdatabase_cancelSqlDumpImport: (a: number, b: number, c: number) => any;
64
+ readonly sqlitewasmdatabase_finishSqlDumpImport: (a: number, b: number, c: number) => any;
40
65
  readonly sqlitewasmdatabase_new: (a: number, b: number) => any;
41
66
  readonly sqlitewasmdatabase_query: (a: number, b: number, c: number, d: number) => any;
42
67
  readonly sqlitewasmdatabase_transaction: (a: number, b: any) => any;
43
68
  readonly sqlitewasmdatabase_wipeAndRecreate: (a: number) => any;
44
69
  readonly wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7: (a: number, b: number, c: any) => [number, number];
45
70
  readonly wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309: (a: number, b: number, c: any, d: any) => void;
46
- readonly wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50: (a: number, b: number, c: any) => void;
47
- readonly wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364: (a: number, b: number) => void;
71
+ readonly wasm_bindgen__convert__closures_____invoke__hf0921f4d1b765e57: (a: number, b: number, c: any) => void;
72
+ readonly wasm_bindgen__convert__closures_____invoke__h9a3bde3c097f3317: (a: number, b: number) => void;
48
73
  readonly __wbindgen_malloc: (a: number, b: number) => number;
49
74
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
50
75
  readonly __wbindgen_exn_store: (a: number) => void;
package/sqlite_web.js CHANGED
@@ -17,6 +17,53 @@ export class SQLiteWasmDatabase {
17
17
  const ptr = this.__destroy_into_raw();
18
18
  wasm.__wbg_sqlitewasmdatabase_free(ptr, 0);
19
19
  }
20
+ /**
21
+ * Append up to 512 KiB of SQL text. Chunks may split a SQL statement,
22
+ * but must contain valid UTF-16 without splitting a surrogate pair.
23
+ * The dump's outer BEGIN/COMMIT statements are accepted but owned by the worker.
24
+ * @param {string} id
25
+ * @param {any} sql
26
+ * @returns {WasmEncodedResult<string>}
27
+ */
28
+ appendSqlDumpChunk(id, sql) {
29
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30
+ const len0 = WASM_VECTOR_LEN;
31
+ const ret = wasm.sqlitewasmdatabase_appendSqlDumpChunk(this.__wbg_ptr, ptr0, len0, sql);
32
+ return ret;
33
+ }
34
+ /**
35
+ * Begin an atomic SQL dump import. Append bounded text chunks, then finish
36
+ * to commit. SQL validation/execution failures and cancellation roll back.
37
+ * Worker loss during finish can leave the commit outcome unknown, including
38
+ * when the coordinator returns an error; check or reset before retrying.
39
+ * @returns {WasmEncodedResult<string>}
40
+ */
41
+ beginSqlDumpImport() {
42
+ const ret = wasm.sqlitewasmdatabase_beginSqlDumpImport(this.__wbg_ptr);
43
+ return ret;
44
+ }
45
+ /**
46
+ * Roll back the active import.
47
+ * @param {string} id
48
+ * @returns {WasmEncodedResult<string>}
49
+ */
50
+ cancelSqlDumpImport(id) {
51
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
52
+ const len0 = WASM_VECTOR_LEN;
53
+ const ret = wasm.sqlitewasmdatabase_cancelSqlDumpImport(this.__wbg_ptr, ptr0, len0);
54
+ return ret;
55
+ }
56
+ /**
57
+ * Commit all imported statements. A partial trailing statement rolls back.
58
+ * @param {string} id
59
+ * @returns {WasmEncodedResult<string>}
60
+ */
61
+ finishSqlDumpImport(id) {
62
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
63
+ const len0 = WASM_VECTOR_LEN;
64
+ const ret = wasm.sqlitewasmdatabase_finishSqlDumpImport(this.__wbg_ptr, ptr0, len0);
65
+ return ret;
66
+ }
20
67
  /**
21
68
  * Create a new database connection with fully embedded worker
22
69
  * @param {string} db_name
@@ -116,6 +163,10 @@ function __wbg_get_imports() {
116
163
  const ret = typeof(val) === 'object' && val !== null;
117
164
  return ret;
118
165
  },
166
+ __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
167
+ const ret = typeof(arg0) === 'string';
168
+ return ret;
169
+ },
119
170
  __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
120
171
  const ret = arg0 === undefined;
121
172
  return ret;
@@ -285,6 +336,10 @@ function __wbg_get_imports() {
285
336
  const ret = Symbol.iterator;
286
337
  return ret;
287
338
  },
339
+ __wbg_length_02c64e687322fa34: function(arg0) {
340
+ const ret = arg0.length;
341
+ return ret;
342
+ },
288
343
  __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
289
344
  const ret = arg0.length;
290
345
  return ret;
@@ -330,6 +385,10 @@ function __wbg_get_imports() {
330
385
  state0.a = 0;
331
386
  }
332
387
  },
388
+ __wbg_new_b421b227e094b902: function(arg0, arg1) {
389
+ const ret = new RegExp(getStringFromWasm0(arg0, arg1));
390
+ return ret;
391
+ },
333
392
  __wbg_new_cd45aabdf6073e84: function(arg0) {
334
393
  const ret = new Uint8Array(arg0);
335
394
  return ret;
@@ -446,6 +505,10 @@ function __wbg_get_imports() {
446
505
  __wbg_terminate_13d19661bbbf7d2b: function(arg0) {
447
506
  arg0.terminate();
448
507
  },
508
+ __wbg_test_a19ee35631e67ebc: function(arg0, arg1) {
509
+ const ret = arg0.test(arg1);
510
+ return ret;
511
+ },
449
512
  __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
450
513
  const ret = arg0.then(arg1, arg2);
451
514
  return ret;
@@ -468,13 +531,13 @@ function __wbg_get_imports() {
468
531
  return ret;
469
532
  },
470
533
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
471
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 63, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
472
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50);
534
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 55, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
535
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hf0921f4d1b765e57);
473
536
  return ret;
474
537
  },
475
538
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
476
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 61, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
477
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364);
539
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 53, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
540
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h9a3bde3c097f3317);
478
541
  return ret;
479
542
  },
480
543
  __wbindgen_cast_0000000000000004: function(arg0) {
@@ -513,12 +576,12 @@ function __wbg_get_imports() {
513
576
  };
514
577
  }
515
578
 
516
- function wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364(arg0, arg1) {
517
- wasm.wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364(arg0, arg1);
579
+ function wasm_bindgen__convert__closures_____invoke__h9a3bde3c097f3317(arg0, arg1) {
580
+ wasm.wasm_bindgen__convert__closures_____invoke__h9a3bde3c097f3317(arg0, arg1);
518
581
  }
519
582
 
520
- function wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50(arg0, arg1, arg2) {
521
- wasm.wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50(arg0, arg1, arg2);
583
+ function wasm_bindgen__convert__closures_____invoke__hf0921f4d1b765e57(arg0, arg1, arg2) {
584
+ wasm.wasm_bindgen__convert__closures_____invoke__hf0921f4d1b765e57(arg0, arg1, arg2);
522
585
  }
523
586
 
524
587
  function wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7(arg0, arg1, arg2) {
Binary file