@rainlanguage/sqlite-web 0.0.1 → 0.0.3

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.1",
4
+ "version": "0.0.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/rainlanguage/sqlite-web"
package/sqlite_web.d.ts CHANGED
@@ -1,62 +1,78 @@
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>>;
12
+ private constructor();
13
+ free(): void;
14
+ [Symbol.dispose](): void;
15
+ /**
16
+ * Create a new database connection with fully embedded worker
17
+ */
18
+ static new(db_name: string): Promise<WasmEncodedResult<SQLiteWasmDatabase>>;
19
+ /**
20
+ * Execute a SQL query (optionally parameterized via JS Array)
21
+ *
22
+ * Passing `undefined`/`null` from JS maps to `None`.
23
+ */
24
+ query(sql: string, params?: Array<any> | null): Promise<WasmEncodedResult<string>>;
25
+ /**
26
+ * Execute a list of single SQL statements atomically as one worker job.
27
+ *
28
+ * Each item must be `{ sql: string, params?: Array }`. Do not include
29
+ * transaction-control statements; the worker owns the transaction.
30
+ */
31
+ transaction(statements: Array<any>): Promise<WasmEncodedResult<string>>;
32
+ wipeAndRecreate(): Promise<WasmEncodedResult<void>>;
23
33
  }
24
34
 
25
35
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
26
36
 
27
37
  export interface InitOutput {
28
- readonly memory: WebAssembly.Memory;
29
- readonly __wbg_sqlitewasmdatabase_free: (a: number, b: number) => void;
30
- readonly sqlitewasmdatabase_new: (a: number, b: number) => any;
31
- readonly sqlitewasmdatabase_query: (a: number, b: number, c: number, d: number) => any;
32
- readonly __wbindgen_malloc: (a: number, b: number) => number;
33
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
34
- readonly __wbindgen_exn_store: (a: number) => void;
35
- readonly __externref_table_alloc: () => number;
36
- readonly __wbindgen_export_4: WebAssembly.Table;
37
- readonly __wbindgen_export_5: WebAssembly.Table;
38
- readonly closure2_externref_shim: (a: number, b: number, c: any) => void;
39
- readonly closure25_externref_shim: (a: number, b: number, c: any, d: any) => void;
40
- readonly __wbindgen_start: () => void;
38
+ readonly memory: WebAssembly.Memory;
39
+ readonly __wbg_sqlitewasmdatabase_free: (a: number, b: number) => void;
40
+ readonly sqlitewasmdatabase_new: (a: number, b: number) => any;
41
+ readonly sqlitewasmdatabase_query: (a: number, b: number, c: number, d: number) => any;
42
+ readonly sqlitewasmdatabase_transaction: (a: number, b: any) => any;
43
+ readonly sqlitewasmdatabase_wipeAndRecreate: (a: number) => any;
44
+ readonly wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7: (a: number, b: number, c: any) => [number, number];
45
+ 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;
48
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
49
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
50
+ readonly __wbindgen_exn_store: (a: number) => void;
51
+ readonly __externref_table_alloc: () => number;
52
+ readonly __wbindgen_externrefs: WebAssembly.Table;
53
+ readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
54
+ readonly __externref_table_dealloc: (a: number) => void;
55
+ readonly __wbindgen_start: () => void;
41
56
  }
42
57
 
43
58
  export type SyncInitInput = BufferSource | WebAssembly.Module;
59
+
44
60
  /**
45
- * Instantiates the given `module`, which can either be bytes or
46
- * a precompiled `WebAssembly.Module`.
47
- *
48
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
49
- *
50
- * @returns {InitOutput}
51
- */
61
+ * Instantiates the given `module`, which can either be bytes or
62
+ * a precompiled `WebAssembly.Module`.
63
+ *
64
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
65
+ *
66
+ * @returns {InitOutput}
67
+ */
52
68
  export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
53
69
 
54
70
  /**
55
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
56
- * for everything else, calls `WebAssembly.instantiate` directly.
57
- *
58
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
59
- *
60
- * @returns {Promise<InitOutput>}
61
- */
71
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
72
+ * for everything else, calls `WebAssembly.instantiate` directly.
73
+ *
74
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
75
+ *
76
+ * @returns {Promise<InitOutput>}
77
+ */
62
78
  export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;