@lix-js/sdk 0.8.3 → 0.8.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.
@@ -38,6 +38,8 @@ export function openMemory(plugin_runtime_dispatch: Function): Promise<WasmLix>;
38
38
 
39
39
  export function openMemoryFromSnapshot(plugin_runtime_dispatch: Function, snapshot?: Uint8Array | null): Promise<WasmLix>;
40
40
 
41
+ export function parseSqlScript(sql: string, provided_param_count: number): any;
42
+
41
43
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
42
44
 
43
45
  export interface InitOutput {
@@ -47,6 +49,7 @@ export interface InitOutput {
47
49
  readonly __wbg_wasmobserveevents_free: (a: number, b: number) => void;
48
50
  readonly openMemory: (a: number) => number;
49
51
  readonly openMemoryFromSnapshot: (a: number, b: number, c: number) => number;
52
+ readonly parseSqlScript: (a: number, b: number, c: number, d: number) => void;
50
53
  readonly wasmlix_activeBranchId: (a: number) => number;
51
54
  readonly wasmlix_beginTransaction: (a: number) => number;
52
55
  readonly wasmlix_close: (a: number) => number;
@@ -62,8 +65,8 @@ export interface InitOutput {
62
65
  readonly wasmlixtransaction_rollback: (a: number) => number;
63
66
  readonly wasmobserveevents_close: (a: number) => void;
64
67
  readonly wasmobserveevents_next: (a: number) => number;
65
- readonly __wasm_bindgen_func_elem_101610: (a: number, b: number, c: number, d: number) => void;
66
- readonly __wasm_bindgen_func_elem_101612: (a: number, b: number, c: number, d: number) => void;
68
+ readonly __wasm_bindgen_func_elem_101667: (a: number, b: number, c: number, d: number) => void;
69
+ readonly __wasm_bindgen_func_elem_101669: (a: number, b: number, c: number, d: number) => void;
67
70
  readonly __wbindgen_export: (a: number, b: number) => number;
68
71
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
69
72
  readonly __wbindgen_export3: (a: number) => void;
@@ -199,6 +199,29 @@ export function openMemoryFromSnapshot(plugin_runtime_dispatch, snapshot) {
199
199
  const ret = wasm.openMemoryFromSnapshot(addHeapObject(plugin_runtime_dispatch), ptr0, len0);
200
200
  return takeObject(ret);
201
201
  }
202
+
203
+ /**
204
+ * @param {string} sql
205
+ * @param {number} provided_param_count
206
+ * @returns {any}
207
+ */
208
+ export function parseSqlScript(sql, provided_param_count) {
209
+ try {
210
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
211
+ const ptr0 = passStringToWasm0(sql, wasm.__wbindgen_export, wasm.__wbindgen_export2);
212
+ const len0 = WASM_VECTOR_LEN;
213
+ wasm.parseSqlScript(retptr, ptr0, len0, provided_param_count);
214
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
215
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
216
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
217
+ if (r2) {
218
+ throw takeObject(r1);
219
+ }
220
+ return takeObject(r0);
221
+ } finally {
222
+ wasm.__wbindgen_add_to_stack_pointer(16);
223
+ }
224
+ }
202
225
  function __wbg_get_imports() {
203
226
  const import0 = {
204
227
  __proto__: null,
@@ -434,7 +457,7 @@ function __wbg_get_imports() {
434
457
  const a = state0.a;
435
458
  state0.a = 0;
436
459
  try {
437
- return __wasm_bindgen_func_elem_101612(a, state0.b, arg0, arg1);
460
+ return __wasm_bindgen_func_elem_101669(a, state0.b, arg0, arg1);
438
461
  } finally {
439
462
  state0.a = a;
440
463
  }
@@ -544,8 +567,8 @@ function __wbg_get_imports() {
544
567
  return addHeapObject(ret);
545
568
  },
546
569
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
547
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 29086, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
548
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_101610);
570
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 29113, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
571
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_101667);
549
572
  return addHeapObject(ret);
550
573
  },
551
574
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -594,10 +617,10 @@ function __wbg_get_imports() {
594
617
  };
595
618
  }
596
619
 
597
- function __wasm_bindgen_func_elem_101610(arg0, arg1, arg2) {
620
+ function __wasm_bindgen_func_elem_101667(arg0, arg1, arg2) {
598
621
  try {
599
622
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
600
- wasm.__wasm_bindgen_func_elem_101610(retptr, arg0, arg1, addHeapObject(arg2));
623
+ wasm.__wasm_bindgen_func_elem_101667(retptr, arg0, arg1, addHeapObject(arg2));
601
624
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
602
625
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
603
626
  if (r1) {
@@ -608,8 +631,8 @@ function __wasm_bindgen_func_elem_101610(arg0, arg1, arg2) {
608
631
  }
609
632
  }
610
633
 
611
- function __wasm_bindgen_func_elem_101612(arg0, arg1, arg2, arg3) {
612
- wasm.__wasm_bindgen_func_elem_101612(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
634
+ function __wasm_bindgen_func_elem_101669(arg0, arg1, arg2, arg3) {
635
+ wasm.__wasm_bindgen_func_elem_101669(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
613
636
  }
614
637
 
615
638
  const WasmLixFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
@@ -6,6 +6,7 @@ export const __wbg_wasmlixtransaction_free: (a: number, b: number) => void;
6
6
  export const __wbg_wasmobserveevents_free: (a: number, b: number) => void;
7
7
  export const openMemory: (a: number) => number;
8
8
  export const openMemoryFromSnapshot: (a: number, b: number, c: number) => number;
9
+ export const parseSqlScript: (a: number, b: number, c: number, d: number) => void;
9
10
  export const wasmlix_activeBranchId: (a: number) => number;
10
11
  export const wasmlix_beginTransaction: (a: number) => number;
11
12
  export const wasmlix_close: (a: number) => number;
@@ -21,8 +22,8 @@ export const wasmlixtransaction_execute: (a: number, b: number, c: number, d: nu
21
22
  export const wasmlixtransaction_rollback: (a: number) => number;
22
23
  export const wasmobserveevents_close: (a: number) => void;
23
24
  export const wasmobserveevents_next: (a: number) => number;
24
- export const __wasm_bindgen_func_elem_101610: (a: number, b: number, c: number, d: number) => void;
25
- export const __wasm_bindgen_func_elem_101612: (a: number, b: number, c: number, d: number) => void;
25
+ export const __wasm_bindgen_func_elem_101667: (a: number, b: number, c: number, d: number) => void;
26
+ export const __wasm_bindgen_func_elem_101669: (a: number, b: number, c: number, d: number) => void;
26
27
  export const __wbindgen_export: (a: number, b: number) => number;
27
28
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
28
29
  export const __wbindgen_export3: (a: number) => void;
package/dist/workerd.d.ts CHANGED
@@ -1,10 +1,20 @@
1
1
  import type { LixBinding } from "./binding-types.js";
2
+ export type SqlScriptPlan = {
3
+ statements: SqlScriptStatement[];
4
+ };
5
+ export type SqlScriptStatement = {
6
+ sql: string;
7
+ paramStart: number;
8
+ paramEnd: number;
9
+ };
2
10
  export interface OpenMemoryLixOptions {
3
11
  snapshot?: Uint8Array;
4
12
  }
5
13
  export interface WorkerdLixBinding extends LixBinding {
6
14
  exportSnapshot(): Promise<Uint8Array>;
7
15
  }
16
+ /** Parses SQL using the same DataFusion dialect and transaction policy as Lix. */
17
+ export declare function parseSqlScript(sql: string, providedParamCount: number): SqlScriptPlan;
8
18
  /**
9
19
  * Opens an in-memory Lix binding directly in a Cloudflare Worker isolate.
10
20
  *
package/dist/workerd.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // @ts-expect-error Generated by build:wasm.
3
3
  import wasmModule from "./wasm/lix_js_sdk_bg.wasm";
4
4
  // @ts-expect-error Generated by build:wasm.
5
- import { initSync, openMemoryFromSnapshot } from "./wasm/lix_js_sdk.js";
5
+ import { initSync, openMemoryFromSnapshot, parseSqlScript as parseSqlScriptBinding } from "./wasm/lix_js_sdk.js";
6
6
  let initialized = false;
7
7
  function initializeWasm() {
8
8
  if (initialized)
@@ -10,6 +10,11 @@ function initializeWasm() {
10
10
  initSync({ module: wasmModule });
11
11
  initialized = true;
12
12
  }
13
+ /** Parses SQL using the same DataFusion dialect and transaction policy as Lix. */
14
+ export function parseSqlScript(sql, providedParamCount) {
15
+ initializeWasm();
16
+ return parseSqlScriptBinding(sql, providedParamCount);
17
+ }
13
18
  /**
14
19
  * Opens an in-memory Lix binding directly in a Cloudflare Worker isolate.
15
20
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lix-js/sdk",
3
3
  "type": "module",
4
- "version": "0.8.3",
4
+ "version": "0.8.4",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -53,10 +53,10 @@
53
53
  "typecheck": "tsc -p tsconfig.test.json --noEmit"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@lix-js/sdk-darwin-arm64": "0.8.3",
57
- "@lix-js/sdk-linux-arm64": "0.8.3",
58
- "@lix-js/sdk-linux-x64": "0.8.3",
59
- "@lix-js/sdk-win32-x64": "0.8.3"
56
+ "@lix-js/sdk-darwin-arm64": "0.8.4",
57
+ "@lix-js/sdk-linux-arm64": "0.8.4",
58
+ "@lix-js/sdk-linux-x64": "0.8.4",
59
+ "@lix-js/sdk-win32-x64": "0.8.4"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@vitest/browser-playwright": "4.0.18",