@rainlanguage/sqlite-web 0.0.2 → 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.2",
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
@@ -1,64 +1,103 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export type WasmEncodedResult<T> = { value: T; error: undefined } | { value: undefined; error: WasmEncodedError };
4
-
5
3
  export interface WasmEncodedError {
6
4
  msg: string;
7
5
  readableMsg: string;
8
6
  }
9
7
 
8
+ export type WasmEncodedResult<T> = { value: T; error: undefined } | { value: undefined; error: WasmEncodedError };
9
+
10
+
10
11
  export class SQLiteWasmDatabase {
11
- private constructor();
12
- free(): void;
13
- /**
14
- * Create a new database connection with fully embedded worker
15
- */
16
- static new(db_name: string): Promise<WasmEncodedResult<SQLiteWasmDatabase>>;
17
- /**
18
- * Execute a SQL query (optionally parameterized via JS Array)
19
- *
20
- * Passing `undefined`/`null` from JS maps to `None`.
21
- */
22
- query(sql: string, params?: Array<any> | null): Promise<WasmEncodedResult<string>>;
23
- wipeAndRecreate(): Promise<WasmEncodedResult<void>>;
12
+ private constructor();
13
+ free(): void;
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>>;
36
+ /**
37
+ * Create a new database connection with fully embedded worker
38
+ */
39
+ static new(db_name: string): Promise<WasmEncodedResult<SQLiteWasmDatabase>>;
40
+ /**
41
+ * Execute a SQL query (optionally parameterized via JS Array)
42
+ *
43
+ * Passing `undefined`/`null` from JS maps to `None`.
44
+ */
45
+ query(sql: string, params?: Array<any> | null): Promise<WasmEncodedResult<string>>;
46
+ /**
47
+ * Execute a list of single SQL statements atomically as one worker job.
48
+ *
49
+ * Each item must be `{ sql: string, params?: Array }`. Do not include
50
+ * transaction-control statements; the worker owns the transaction.
51
+ */
52
+ transaction(statements: Array<any>): Promise<WasmEncodedResult<string>>;
53
+ wipeAndRecreate(): Promise<WasmEncodedResult<void>>;
24
54
  }
25
55
 
26
56
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
27
57
 
28
58
  export interface InitOutput {
29
- readonly memory: WebAssembly.Memory;
30
- readonly __wbg_sqlitewasmdatabase_free: (a: number, b: number) => void;
31
- readonly sqlitewasmdatabase_new: (a: number, b: number) => any;
32
- readonly sqlitewasmdatabase_query: (a: number, b: number, c: number, d: number) => any;
33
- readonly sqlitewasmdatabase_wipeAndRecreate: (a: number) => any;
34
- readonly __wbindgen_malloc: (a: number, b: number) => number;
35
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
36
- readonly __wbindgen_exn_store: (a: number) => void;
37
- readonly __externref_table_alloc: () => number;
38
- readonly __wbindgen_export_4: WebAssembly.Table;
39
- readonly __wbindgen_export_5: WebAssembly.Table;
40
- readonly closure37_externref_shim: (a: number, b: number, c: any) => void;
41
- readonly closure21_externref_shim: (a: number, b: number, c: any, d: any) => void;
42
- readonly __wbindgen_start: () => void;
59
+ readonly memory: WebAssembly.Memory;
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;
65
+ readonly sqlitewasmdatabase_new: (a: number, b: number) => any;
66
+ readonly sqlitewasmdatabase_query: (a: number, b: number, c: number, d: number) => any;
67
+ readonly sqlitewasmdatabase_transaction: (a: number, b: any) => any;
68
+ readonly sqlitewasmdatabase_wipeAndRecreate: (a: number) => any;
69
+ readonly wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7: (a: number, b: number, c: any) => [number, number];
70
+ readonly wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309: (a: number, b: number, c: any, d: any) => void;
71
+ readonly wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50: (a: number, b: number, c: any) => void;
72
+ readonly wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364: (a: number, b: number) => void;
73
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
74
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
75
+ readonly __wbindgen_exn_store: (a: number) => void;
76
+ readonly __externref_table_alloc: () => number;
77
+ readonly __wbindgen_externrefs: WebAssembly.Table;
78
+ readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
79
+ readonly __externref_table_dealloc: (a: number) => void;
80
+ readonly __wbindgen_start: () => void;
43
81
  }
44
82
 
45
83
  export type SyncInitInput = BufferSource | WebAssembly.Module;
84
+
46
85
  /**
47
- * Instantiates the given `module`, which can either be bytes or
48
- * a precompiled `WebAssembly.Module`.
49
- *
50
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
51
- *
52
- * @returns {InitOutput}
53
- */
86
+ * Instantiates the given `module`, which can either be bytes or
87
+ * a precompiled `WebAssembly.Module`.
88
+ *
89
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
90
+ *
91
+ * @returns {InitOutput}
92
+ */
54
93
  export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
55
94
 
56
95
  /**
57
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
58
- * for everything else, calls `WebAssembly.instantiate` directly.
59
- *
60
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
61
- *
62
- * @returns {Promise<InitOutput>}
63
- */
96
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
97
+ * for everything else, calls `WebAssembly.instantiate` directly.
98
+ *
99
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
100
+ *
101
+ * @returns {Promise<InitOutput>}
102
+ */
64
103
  export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;