@rainlanguage/sqlite-web 0.0.3 → 0.0.4

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.4",
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,6 +58,10 @@ 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;
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;
@@ -304,6 +359,10 @@ function __wbg_get_imports() {
304
359
  const ret = arg0.navigator;
305
360
  return ret;
306
361
  },
362
+ __wbg_new_2b7eedd63d35ebab: function(arg0, arg1) {
363
+ const ret = new RegExp(getStringFromWasm0(arg0, arg1));
364
+ return ret;
365
+ },
307
366
  __wbg_new_32b398fb48b6d94a: function() {
308
367
  const ret = new Array();
309
368
  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_60ff07719dbfcda2: 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,12 +531,12 @@ 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`.
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`.
472
535
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50);
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`.
539
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 53, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
477
540
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364);
478
541
  return ret;
479
542
  },
Binary file