@lix-js/sdk 0.8.3 → 0.9.0

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.
Files changed (47) hide show
  1. package/README.md +82 -16
  2. package/dist/binding-types.d.ts +18 -2
  3. package/dist/binding.browser.d.ts +2 -2
  4. package/dist/binding.browser.js +3 -3
  5. package/dist/binding.node.d.ts +2 -2
  6. package/dist/binding.node.js +10 -4
  7. package/dist/bundled-plugins/plugin_csv_v2.lixplugin +0 -0
  8. package/dist/bundled-plugins/plugin_markdown_incremental_v2.lixplugin +0 -0
  9. package/dist/bundled-plugins.js +4 -4
  10. package/dist/client-state.d.ts +40 -0
  11. package/dist/client-state.js +178 -0
  12. package/dist/index.d.ts +2 -1
  13. package/dist/lix.d.ts +44 -0
  14. package/dist/lix.js +369 -0
  15. package/dist/local-storage-adapter.d.ts +26 -0
  16. package/dist/local-storage-adapter.js +117 -0
  17. package/dist/open-lix.d.ts +3 -34
  18. package/dist/open-lix.js +103 -170
  19. package/dist/remote/client.d.ts +8 -0
  20. package/dist/remote/client.js +1036 -0
  21. package/dist/remote/protocol.d.ts +166 -0
  22. package/dist/remote/protocol.js +362 -0
  23. package/dist/remote/sse.d.ts +12 -0
  24. package/dist/remote/sse.js +87 -0
  25. package/dist/snapshot-persistence.d.ts +7 -0
  26. package/dist/snapshot-persistence.js +26 -0
  27. package/dist/types.d.ts +58 -1
  28. package/dist/wasm/lix_js_sdk.d.ts +19 -4
  29. package/dist/wasm/lix_js_sdk.js +98 -17
  30. package/dist/wasm/lix_js_sdk_bg.wasm +0 -0
  31. package/dist/wasm/lix_js_sdk_bg.wasm.d.ts +9 -2
  32. package/dist/worker/client.d.ts +23 -4
  33. package/dist/worker/client.js +287 -10
  34. package/dist/worker/host.js +30 -2
  35. package/dist/worker/protocol.d.ts +26 -2
  36. package/dist/workerd.d.ts +10 -0
  37. package/dist/workerd.js +7 -4
  38. package/package.json +19 -16
  39. package/dist/bundled-plugins/plugin_csv.lixplugin +0 -0
  40. package/dist/bundled-plugins/plugin_md_v2.lixplugin +0 -0
  41. package/dist/jco/js-component-bindgen-component.core.wasm +0 -0
  42. package/dist/jco/js-component-bindgen-component.core2.wasm +0 -0
  43. package/dist/jco/js-component-bindgen-component.js +0 -13662
  44. package/dist/jco-transpile.browser.d.ts +0 -14
  45. package/dist/jco-transpile.browser.js +0 -22
  46. package/dist/plugin-runtime.d.ts +0 -45
  47. package/dist/plugin-runtime.js +0 -124
package/dist/types.d.ts CHANGED
@@ -6,8 +6,47 @@ export type LocalFilesystemOptions = {
6
6
  lixDir?: string;
7
7
  syncAllFiles: boolean;
8
8
  };
9
+ export type RemoteLixFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
10
+ export type RemoteLixServerOptions = {
11
+ mode: "remote";
12
+ url: string | URL;
13
+ headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
14
+ fetch?: RemoteLixFetch;
15
+ };
16
+ export type LixTelemetrySpan = {
17
+ schemaVersion: 1;
18
+ name: string;
19
+ startedAtUnixMs: number;
20
+ durationMs: number;
21
+ status: "ok" | "error";
22
+ attributes: Record<string, string | number | boolean>;
23
+ };
24
+ export type LixTelemetryOptions = {
25
+ onSpan(span: LixTelemetrySpan): void;
26
+ };
27
+ /**
28
+ * Persists opaque Lix snapshots under SDK-provided namespaces.
29
+ *
30
+ * Implementations must treat snapshots as bytes owned by Lix. The namespace
31
+ * selects one logical Lix and allows a single adapter to persist more than one
32
+ * instance without collisions.
33
+ */
34
+ export interface LixSnapshotStorage {
35
+ load(namespace: string): Promise<Uint8Array | undefined>;
36
+ save(namespace: string, snapshot: Uint8Array): Promise<void>;
37
+ }
9
38
  export type OpenLixOptions = {
10
- storage?: import("./open-lix.js").SQLite | import("./open-lix.js").LocalFilesystem;
39
+ storage?: import("./open-lix.js").SQLite | import("./open-lix.js").LocalFilesystem | LixSnapshotStorage;
40
+ server?: never;
41
+ telemetry?: LixTelemetryOptions;
42
+ } | {
43
+ /**
44
+ * Optional client-local storage. In remote mode workspace SQL remains on
45
+ * the server; only `lix.clientState` is stored here.
46
+ */
47
+ storage?: LixSnapshotStorage;
48
+ server: RemoteLixServerOptions;
49
+ telemetry?: never;
11
50
  };
12
51
  export type LixValue = {
13
52
  kind: "null";
@@ -37,6 +76,21 @@ export type JsonValue = null | boolean | number | string | readonly JsonValue[]
37
76
  export type SqlParam = JsonValue | Uint8Array | import("./value.js").Value;
38
77
  export type ExecuteOptions = {
39
78
  originKey?: string;
79
+ /**
80
+ * Stable identity for one logical remote SQL mutation. Supply the same key
81
+ * when retrying after a lost response; remote Lix generates one per call
82
+ * when this is omitted. This is sent as `Idempotency-Key`, not SQL options.
83
+ */
84
+ idempotencyKey?: string;
85
+ };
86
+ export type LixBatchStatement = {
87
+ sql: string;
88
+ params?: readonly SqlParam[];
89
+ };
90
+ export type LixBatchOptions = {
91
+ originKey?: string;
92
+ /** See {@link ExecuteOptions.idempotencyKey}. */
93
+ idempotencyKey?: string;
40
94
  };
41
95
  export type ExecuteResult = {
42
96
  columns: string[];
@@ -75,6 +129,9 @@ export type CreateBranchReceipt = {
75
129
  hidden: boolean;
76
130
  commitId: string;
77
131
  };
132
+ export type CreateCheckpointReceipt = {
133
+ commitId: string;
134
+ };
78
135
  export type SwitchBranchOptions = {
79
136
  branchId: string;
80
137
  };
@@ -7,9 +7,15 @@ export class WasmLix {
7
7
  [Symbol.dispose](): void;
8
8
  activeBranchId(): Promise<string>;
9
9
  beginTransaction(): Promise<WasmLixTransaction>;
10
+ clientStateDelete(key: string): Promise<void>;
11
+ clientStateEntries(): Promise<any>;
12
+ clientStateGet(key: string): Promise<any>;
13
+ clientStateSet(key: string, value: any): Promise<void>;
10
14
  close(): Promise<void>;
11
15
  createBranch(options: any): Promise<any>;
16
+ createCheckpoint(): Promise<any>;
12
17
  execute(sql: string, params: any, options?: any | null): Promise<any>;
18
+ executeBatch(statements: any, options?: any | null): Promise<any>;
13
19
  exportSnapshot(): Promise<Uint8Array>;
14
20
  mergeBranch(options: any): Promise<any>;
15
21
  mergeBranchPreview(options: any): Promise<any>;
@@ -34,9 +40,11 @@ export class WasmObserveEvents {
34
40
  next(): Promise<any>;
35
41
  }
36
42
 
37
- export function openMemory(plugin_runtime_dispatch: Function): Promise<WasmLix>;
43
+ export function openMemory(telemetry_dispatch?: Function | null): Promise<WasmLix>;
38
44
 
39
- export function openMemoryFromSnapshot(plugin_runtime_dispatch: Function, snapshot?: Uint8Array | null): Promise<WasmLix>;
45
+ export function openMemoryFromSnapshot(telemetry_dispatch?: Function | null, snapshot?: Uint8Array | null): Promise<WasmLix>;
46
+
47
+ export function parseSqlScript(sql: string, provided_param_count: number): any;
40
48
 
41
49
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
42
50
 
@@ -47,11 +55,18 @@ export interface InitOutput {
47
55
  readonly __wbg_wasmobserveevents_free: (a: number, b: number) => void;
48
56
  readonly openMemory: (a: number) => number;
49
57
  readonly openMemoryFromSnapshot: (a: number, b: number, c: number) => number;
58
+ readonly parseSqlScript: (a: number, b: number, c: number, d: number) => void;
50
59
  readonly wasmlix_activeBranchId: (a: number) => number;
51
60
  readonly wasmlix_beginTransaction: (a: number) => number;
61
+ readonly wasmlix_clientStateDelete: (a: number, b: number, c: number) => number;
62
+ readonly wasmlix_clientStateEntries: (a: number) => number;
63
+ readonly wasmlix_clientStateGet: (a: number, b: number, c: number) => number;
64
+ readonly wasmlix_clientStateSet: (a: number, b: number, c: number, d: number) => number;
52
65
  readonly wasmlix_close: (a: number) => number;
53
66
  readonly wasmlix_createBranch: (a: number, b: number) => number;
67
+ readonly wasmlix_createCheckpoint: (a: number) => number;
54
68
  readonly wasmlix_execute: (a: number, b: number, c: number, d: number, e: number) => number;
69
+ readonly wasmlix_executeBatch: (a: number, b: number, c: number) => number;
55
70
  readonly wasmlix_exportSnapshot: (a: number) => number;
56
71
  readonly wasmlix_mergeBranch: (a: number, b: number) => number;
57
72
  readonly wasmlix_mergeBranchPreview: (a: number, b: number) => number;
@@ -62,8 +77,8 @@ export interface InitOutput {
62
77
  readonly wasmlixtransaction_rollback: (a: number) => number;
63
78
  readonly wasmobserveevents_close: (a: number) => void;
64
79
  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;
80
+ readonly __wasm_bindgen_func_elem_111270: (a: number, b: number, c: number, d: number) => void;
81
+ readonly __wasm_bindgen_func_elem_111272: (a: number, b: number, c: number, d: number) => void;
67
82
  readonly __wbindgen_export: (a: number, b: number) => number;
68
83
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
69
84
  readonly __wbindgen_export3: (a: number) => void;
@@ -31,6 +31,44 @@ export class WasmLix {
31
31
  const ret = wasm.wasmlix_beginTransaction(this.__wbg_ptr);
32
32
  return takeObject(ret);
33
33
  }
34
+ /**
35
+ * @param {string} key
36
+ * @returns {Promise<void>}
37
+ */
38
+ clientStateDelete(key) {
39
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
40
+ const len0 = WASM_VECTOR_LEN;
41
+ const ret = wasm.wasmlix_clientStateDelete(this.__wbg_ptr, ptr0, len0);
42
+ return takeObject(ret);
43
+ }
44
+ /**
45
+ * @returns {Promise<any>}
46
+ */
47
+ clientStateEntries() {
48
+ const ret = wasm.wasmlix_clientStateEntries(this.__wbg_ptr);
49
+ return takeObject(ret);
50
+ }
51
+ /**
52
+ * @param {string} key
53
+ * @returns {Promise<any>}
54
+ */
55
+ clientStateGet(key) {
56
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
57
+ const len0 = WASM_VECTOR_LEN;
58
+ const ret = wasm.wasmlix_clientStateGet(this.__wbg_ptr, ptr0, len0);
59
+ return takeObject(ret);
60
+ }
61
+ /**
62
+ * @param {string} key
63
+ * @param {any} value
64
+ * @returns {Promise<void>}
65
+ */
66
+ clientStateSet(key, value) {
67
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
68
+ const len0 = WASM_VECTOR_LEN;
69
+ const ret = wasm.wasmlix_clientStateSet(this.__wbg_ptr, ptr0, len0, addHeapObject(value));
70
+ return takeObject(ret);
71
+ }
34
72
  /**
35
73
  * @returns {Promise<void>}
36
74
  */
@@ -46,6 +84,13 @@ export class WasmLix {
46
84
  const ret = wasm.wasmlix_createBranch(this.__wbg_ptr, addHeapObject(options));
47
85
  return takeObject(ret);
48
86
  }
87
+ /**
88
+ * @returns {Promise<any>}
89
+ */
90
+ createCheckpoint() {
91
+ const ret = wasm.wasmlix_createCheckpoint(this.__wbg_ptr);
92
+ return takeObject(ret);
93
+ }
49
94
  /**
50
95
  * @param {string} sql
51
96
  * @param {any} params
@@ -58,6 +103,15 @@ export class WasmLix {
58
103
  const ret = wasm.wasmlix_execute(this.__wbg_ptr, ptr0, len0, addHeapObject(params), isLikeNone(options) ? 0 : addHeapObject(options));
59
104
  return takeObject(ret);
60
105
  }
106
+ /**
107
+ * @param {any} statements
108
+ * @param {any | null} [options]
109
+ * @returns {Promise<any>}
110
+ */
111
+ executeBatch(statements, options) {
112
+ const ret = wasm.wasmlix_executeBatch(this.__wbg_ptr, addHeapObject(statements), isLikeNone(options) ? 0 : addHeapObject(options));
113
+ return takeObject(ret);
114
+ }
61
115
  /**
62
116
  * @returns {Promise<Uint8Array>}
63
117
  */
@@ -180,25 +234,48 @@ export class WasmObserveEvents {
180
234
  if (Symbol.dispose) WasmObserveEvents.prototype[Symbol.dispose] = WasmObserveEvents.prototype.free;
181
235
 
182
236
  /**
183
- * @param {Function} plugin_runtime_dispatch
237
+ * @param {Function | null} [telemetry_dispatch]
184
238
  * @returns {Promise<WasmLix>}
185
239
  */
186
- export function openMemory(plugin_runtime_dispatch) {
187
- const ret = wasm.openMemory(addHeapObject(plugin_runtime_dispatch));
240
+ export function openMemory(telemetry_dispatch) {
241
+ const ret = wasm.openMemory(isLikeNone(telemetry_dispatch) ? 0 : addHeapObject(telemetry_dispatch));
188
242
  return takeObject(ret);
189
243
  }
190
244
 
191
245
  /**
192
- * @param {Function} plugin_runtime_dispatch
246
+ * @param {Function | null} [telemetry_dispatch]
193
247
  * @param {Uint8Array | null} [snapshot]
194
248
  * @returns {Promise<WasmLix>}
195
249
  */
196
- export function openMemoryFromSnapshot(plugin_runtime_dispatch, snapshot) {
250
+ export function openMemoryFromSnapshot(telemetry_dispatch, snapshot) {
197
251
  var ptr0 = isLikeNone(snapshot) ? 0 : passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
198
252
  var len0 = WASM_VECTOR_LEN;
199
- const ret = wasm.openMemoryFromSnapshot(addHeapObject(plugin_runtime_dispatch), ptr0, len0);
253
+ const ret = wasm.openMemoryFromSnapshot(isLikeNone(telemetry_dispatch) ? 0 : addHeapObject(telemetry_dispatch), ptr0, len0);
200
254
  return takeObject(ret);
201
255
  }
256
+
257
+ /**
258
+ * @param {string} sql
259
+ * @param {number} provided_param_count
260
+ * @returns {any}
261
+ */
262
+ export function parseSqlScript(sql, provided_param_count) {
263
+ try {
264
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
265
+ const ptr0 = passStringToWasm0(sql, wasm.__wbindgen_export, wasm.__wbindgen_export2);
266
+ const len0 = WASM_VECTOR_LEN;
267
+ wasm.parseSqlScript(retptr, ptr0, len0, provided_param_count);
268
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
269
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
270
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
271
+ if (r2) {
272
+ throw takeObject(r1);
273
+ }
274
+ return takeObject(r0);
275
+ } finally {
276
+ wasm.__wbindgen_add_to_stack_pointer(16);
277
+ }
278
+ }
202
279
  function __wbg_get_imports() {
203
280
  const import0 = {
204
281
  __proto__: null,
@@ -341,6 +418,10 @@ function __wbg_get_imports() {
341
418
  const ret = getObject(arg0)[arg1 >>> 0];
342
419
  return addHeapObject(ret);
343
420
  },
421
+ __wbg_get_de6a0f7d4d18a304: function() { return handleError(function (arg0, arg1) {
422
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
423
+ return addHeapObject(ret);
424
+ }, arguments); },
344
425
  __wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
345
426
  const ret = getObject(arg0)[arg1 >>> 0];
346
427
  return addHeapObject(ret);
@@ -434,7 +515,7 @@ function __wbg_get_imports() {
434
515
  const a = state0.a;
435
516
  state0.a = 0;
436
517
  try {
437
- return __wasm_bindgen_func_elem_101612(a, state0.b, arg0, arg1);
518
+ return __wasm_bindgen_func_elem_111272(a, state0.b, arg0, arg1);
438
519
  } finally {
439
520
  state0.a = a;
440
521
  }
@@ -457,6 +538,10 @@ function __wbg_get_imports() {
457
538
  const ret = Date.now();
458
539
  return ret;
459
540
  }, arguments); },
541
+ __wbg_now_190933fa139cc119: function() {
542
+ const ret = Date.now();
543
+ return ret;
544
+ },
460
545
  __wbg_now_e7c6795a7f81e10f: function(arg0) {
461
546
  const ret = getObject(arg0).now();
462
547
  return ret;
@@ -519,10 +604,6 @@ function __wbg_get_imports() {
519
604
  const ret = typeof window === 'undefined' ? null : window;
520
605
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
521
606
  },
522
- __wbg_then_18f476d590e58992: function(arg0, arg1, arg2) {
523
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
524
- return addHeapObject(ret);
525
- },
526
607
  __wbg_then_ac7b025999b52837: function(arg0, arg1) {
527
608
  const ret = getObject(arg0).then(getObject(arg1));
528
609
  return addHeapObject(ret);
@@ -544,8 +625,8 @@ function __wbg_get_imports() {
544
625
  return addHeapObject(ret);
545
626
  },
546
627
  __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);
628
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 29773, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
629
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_111270);
549
630
  return addHeapObject(ret);
550
631
  },
551
632
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -594,10 +675,10 @@ function __wbg_get_imports() {
594
675
  };
595
676
  }
596
677
 
597
- function __wasm_bindgen_func_elem_101610(arg0, arg1, arg2) {
678
+ function __wasm_bindgen_func_elem_111270(arg0, arg1, arg2) {
598
679
  try {
599
680
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
600
- wasm.__wasm_bindgen_func_elem_101610(retptr, arg0, arg1, addHeapObject(arg2));
681
+ wasm.__wasm_bindgen_func_elem_111270(retptr, arg0, arg1, addHeapObject(arg2));
601
682
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
602
683
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
603
684
  if (r1) {
@@ -608,8 +689,8 @@ function __wasm_bindgen_func_elem_101610(arg0, arg1, arg2) {
608
689
  }
609
690
  }
610
691
 
611
- function __wasm_bindgen_func_elem_101612(arg0, arg1, arg2, arg3) {
612
- wasm.__wasm_bindgen_func_elem_101612(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
692
+ function __wasm_bindgen_func_elem_111272(arg0, arg1, arg2, arg3) {
693
+ wasm.__wasm_bindgen_func_elem_111272(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
613
694
  }
614
695
 
615
696
  const WasmLixFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
@@ -6,11 +6,18 @@ 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;
12
+ export const wasmlix_clientStateDelete: (a: number, b: number, c: number) => number;
13
+ export const wasmlix_clientStateEntries: (a: number) => number;
14
+ export const wasmlix_clientStateGet: (a: number, b: number, c: number) => number;
15
+ export const wasmlix_clientStateSet: (a: number, b: number, c: number, d: number) => number;
11
16
  export const wasmlix_close: (a: number) => number;
12
17
  export const wasmlix_createBranch: (a: number, b: number) => number;
18
+ export const wasmlix_createCheckpoint: (a: number) => number;
13
19
  export const wasmlix_execute: (a: number, b: number, c: number, d: number, e: number) => number;
20
+ export const wasmlix_executeBatch: (a: number, b: number, c: number) => number;
14
21
  export const wasmlix_exportSnapshot: (a: number) => number;
15
22
  export const wasmlix_mergeBranch: (a: number, b: number) => number;
16
23
  export const wasmlix_mergeBranchPreview: (a: number, b: number) => number;
@@ -21,8 +28,8 @@ export const wasmlixtransaction_execute: (a: number, b: number, c: number, d: nu
21
28
  export const wasmlixtransaction_rollback: (a: number) => number;
22
29
  export const wasmobserveevents_close: (a: number) => void;
23
30
  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;
31
+ export const __wasm_bindgen_func_elem_111270: (a: number, b: number, c: number, d: number) => void;
32
+ export const __wasm_bindgen_func_elem_111272: (a: number, b: number, c: number, d: number) => void;
26
33
  export const __wbindgen_export: (a: number, b: number) => number;
27
34
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
28
35
  export const __wbindgen_export3: (a: number) => void;
@@ -1,13 +1,32 @@
1
- import type { LixStorageConfig } from "../binding-types.js";
1
+ import type { LixBinding, LixStorageConfig } from "../binding-types.js";
2
+ import type { LixSnapshotStorage, LixTelemetryOptions } from "../types.js";
2
3
  import { type WorkerConnection, type WorkerNotification, type WorkerOperation } from "./protocol.js";
3
- export declare function openLixWorker(storage: LixStorageConfig, onDisposed?: () => void): Promise<LixWorkerClient>;
4
+ export declare function openLixWorker(storage: LixStorageConfig, onDisposed?: () => void, telemetry?: LixTelemetryOptions): Promise<LixWorkerClient>;
5
+ /** Opens the local worker transport behind the semantic Lix binding. */
6
+ export declare function openLixWorkerBinding(storage: LixStorageConfig, onDisposed?: () => void, telemetry?: LixTelemetryOptions): Promise<LixBinding>;
7
+ export type OpenPersistentLixWorkerBindingOptions = {
8
+ storage: LixSnapshotStorage;
9
+ namespace: string;
10
+ telemetry?: LixTelemetryOptions;
11
+ };
12
+ /**
13
+ * Opens a browser memory binding from an opaque snapshot and persists a fresh
14
+ * snapshot after every successful mutation. This is an internal composition
15
+ * seam for public storage adapters; it does not route workspace operations.
16
+ */
17
+ export declare function openPersistentLixWorkerBinding(options: OpenPersistentLixWorkerBindingOptions): Promise<LixBinding>;
4
18
  export declare class LixWorkerClient {
5
- private readonly onDisposed?;
6
19
  private readonly connection;
7
20
  private nextRequestId;
8
21
  private readonly pending;
9
22
  private disposed;
10
- constructor(onDisposed?: (() => void) | undefined, connection?: WorkerConnection);
23
+ private leased;
24
+ private onDisposed?;
25
+ private telemetry?;
26
+ constructor(connection?: WorkerConnection);
27
+ get isDisposed(): boolean;
28
+ beginLease(onDisposed?: () => void, telemetry?: LixTelemetryOptions): void;
29
+ endLease(): void;
11
30
  request<T>(operation: WorkerOperation): Promise<T>;
12
31
  notify(notification: WorkerNotification): void;
13
32
  terminate(): Promise<void>;