@lix-js/sdk 0.8.4 → 0.10.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 (49) hide show
  1. package/README.md +105 -22
  2. package/dist/binding-types.d.ts +21 -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 +18 -4
  7. package/dist/bundled-plugins/plugin_csv.lixplugin +0 -0
  8. package/dist/bundled-plugins/plugin_markdown.lixplugin +0 -0
  9. package/dist/bundled-plugins.js +2 -2
  10. package/dist/client-state.d.ts +53 -0
  11. package/dist/client-state.js +318 -0
  12. package/dist/index.d.ts +2 -1
  13. package/dist/lix.d.ts +47 -0
  14. package/dist/lix.js +378 -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 +99 -170
  19. package/dist/remote/client.d.ts +9 -0
  20. package/dist/remote/client.js +1150 -0
  21. package/dist/remote/protocol.d.ts +178 -0
  22. package/dist/remote/protocol.js +367 -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 +68 -1
  28. package/dist/wasm/lix_js_sdk.d.ts +22 -4
  29. package/dist/wasm/lix_js_sdk.js +96 -17
  30. package/dist/wasm/lix_js_sdk_bg.wasm +0 -0
  31. package/dist/wasm/lix_js_sdk_bg.wasm.d.ts +11 -2
  32. package/dist/worker/client.d.ts +23 -4
  33. package/dist/worker/client.js +329 -11
  34. package/dist/worker/factory.browser.d.ts +2 -0
  35. package/dist/worker/factory.browser.js +2 -0
  36. package/dist/worker/factory.node.d.ts +2 -0
  37. package/dist/worker/factory.node.js +5 -0
  38. package/dist/worker/host.js +36 -2
  39. package/dist/worker/protocol.d.ts +32 -2
  40. package/dist/workerd.js +1 -3
  41. package/package.json +19 -16
  42. package/dist/bundled-plugins/plugin_md_v2.lixplugin +0 -0
  43. package/dist/jco/js-component-bindgen-component.core.wasm +0 -0
  44. package/dist/jco/js-component-bindgen-component.core2.wasm +0 -0
  45. package/dist/jco/js-component-bindgen-component.js +0 -13662
  46. package/dist/jco-transpile.browser.d.ts +0 -14
  47. package/dist/jco-transpile.browser.js +0 -22
  48. package/dist/plugin-runtime.d.ts +0 -45
  49. 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,19 @@ export type CreateBranchReceipt = {
75
129
  hidden: boolean;
76
130
  commitId: string;
77
131
  };
132
+ export type CreateCheckpointReceipt = {
133
+ commitId: string;
134
+ };
135
+ export type UndoReceipt = {
136
+ branchId: string;
137
+ targetCommitId: string;
138
+ inverseCommitId: string;
139
+ };
140
+ export type RedoReceipt = {
141
+ branchId: string;
142
+ targetCommitId: string;
143
+ replayCommitId: string;
144
+ };
78
145
  export type SwitchBranchOptions = {
79
146
  branchId: string;
80
147
  };
@@ -5,16 +5,25 @@ export class WasmLix {
5
5
  private constructor();
6
6
  free(): void;
7
7
  [Symbol.dispose](): void;
8
+ activeAccountId(): Promise<string>;
8
9
  activeBranchId(): Promise<string>;
9
10
  beginTransaction(): Promise<WasmLixTransaction>;
11
+ clientStateDelete(key: string): Promise<void>;
12
+ clientStateEntries(): Promise<any>;
13
+ clientStateGet(key: string): Promise<any>;
14
+ clientStateSet(key: string, value: any): Promise<void>;
10
15
  close(): Promise<void>;
11
16
  createBranch(options: any): Promise<any>;
17
+ createCheckpoint(): Promise<any>;
12
18
  execute(sql: string, params: any, options?: any | null): Promise<any>;
19
+ executeBatch(statements: any, options?: any | null): Promise<any>;
13
20
  exportSnapshot(): Promise<Uint8Array>;
14
21
  mergeBranch(options: any): Promise<any>;
15
22
  mergeBranchPreview(options: any): Promise<any>;
16
23
  observe(sql: string, params: any): Promise<WasmObserveEvents>;
24
+ redo(): Promise<any>;
17
25
  switchBranch(options: any): Promise<any>;
26
+ undo(): Promise<any>;
18
27
  }
19
28
 
20
29
  export class WasmLixTransaction {
@@ -34,9 +43,9 @@ export class WasmObserveEvents {
34
43
  next(): Promise<any>;
35
44
  }
36
45
 
37
- export function openMemory(plugin_runtime_dispatch: Function): Promise<WasmLix>;
46
+ export function openMemory(telemetry_dispatch?: Function | null): Promise<WasmLix>;
38
47
 
39
- export function openMemoryFromSnapshot(plugin_runtime_dispatch: Function, snapshot?: Uint8Array | null): Promise<WasmLix>;
48
+ export function openMemoryFromSnapshot(telemetry_dispatch?: Function | null, snapshot?: Uint8Array | null): Promise<WasmLix>;
40
49
 
41
50
  export function parseSqlScript(sql: string, provided_param_count: number): any;
42
51
 
@@ -50,23 +59,32 @@ export interface InitOutput {
50
59
  readonly openMemory: (a: number) => number;
51
60
  readonly openMemoryFromSnapshot: (a: number, b: number, c: number) => number;
52
61
  readonly parseSqlScript: (a: number, b: number, c: number, d: number) => void;
62
+ readonly wasmlix_activeAccountId: (a: number) => number;
53
63
  readonly wasmlix_activeBranchId: (a: number) => number;
54
64
  readonly wasmlix_beginTransaction: (a: number) => number;
65
+ readonly wasmlix_clientStateDelete: (a: number, b: number, c: number) => number;
66
+ readonly wasmlix_clientStateEntries: (a: number) => number;
67
+ readonly wasmlix_clientStateGet: (a: number, b: number, c: number) => number;
68
+ readonly wasmlix_clientStateSet: (a: number, b: number, c: number, d: number) => number;
55
69
  readonly wasmlix_close: (a: number) => number;
56
70
  readonly wasmlix_createBranch: (a: number, b: number) => number;
71
+ readonly wasmlix_createCheckpoint: (a: number) => number;
57
72
  readonly wasmlix_execute: (a: number, b: number, c: number, d: number, e: number) => number;
73
+ readonly wasmlix_executeBatch: (a: number, b: number, c: number) => number;
58
74
  readonly wasmlix_exportSnapshot: (a: number) => number;
59
75
  readonly wasmlix_mergeBranch: (a: number, b: number) => number;
60
76
  readonly wasmlix_mergeBranchPreview: (a: number, b: number) => number;
61
77
  readonly wasmlix_observe: (a: number, b: number, c: number, d: number) => number;
78
+ readonly wasmlix_redo: (a: number) => number;
62
79
  readonly wasmlix_switchBranch: (a: number, b: number) => number;
80
+ readonly wasmlix_undo: (a: number) => number;
63
81
  readonly wasmlixtransaction_commit: (a: number) => number;
64
82
  readonly wasmlixtransaction_execute: (a: number, b: number, c: number, d: number, e: number) => number;
65
83
  readonly wasmlixtransaction_rollback: (a: number) => number;
66
84
  readonly wasmobserveevents_close: (a: number) => void;
67
85
  readonly wasmobserveevents_next: (a: number) => number;
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;
86
+ readonly __wasm_bindgen_func_elem_120695: (a: number, b: number, c: number, d: number) => void;
87
+ readonly __wasm_bindgen_func_elem_120697: (a: number, b: number, c: number, d: number) => void;
70
88
  readonly __wbindgen_export: (a: number, b: number) => number;
71
89
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
72
90
  readonly __wbindgen_export3: (a: number) => void;
@@ -17,6 +17,13 @@ export class WasmLix {
17
17
  const ptr = this.__destroy_into_raw();
18
18
  wasm.__wbg_wasmlix_free(ptr, 0);
19
19
  }
20
+ /**
21
+ * @returns {Promise<string>}
22
+ */
23
+ activeAccountId() {
24
+ const ret = wasm.wasmlix_activeAccountId(this.__wbg_ptr);
25
+ return takeObject(ret);
26
+ }
20
27
  /**
21
28
  * @returns {Promise<string>}
22
29
  */
@@ -31,6 +38,44 @@ export class WasmLix {
31
38
  const ret = wasm.wasmlix_beginTransaction(this.__wbg_ptr);
32
39
  return takeObject(ret);
33
40
  }
41
+ /**
42
+ * @param {string} key
43
+ * @returns {Promise<void>}
44
+ */
45
+ clientStateDelete(key) {
46
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
47
+ const len0 = WASM_VECTOR_LEN;
48
+ const ret = wasm.wasmlix_clientStateDelete(this.__wbg_ptr, ptr0, len0);
49
+ return takeObject(ret);
50
+ }
51
+ /**
52
+ * @returns {Promise<any>}
53
+ */
54
+ clientStateEntries() {
55
+ const ret = wasm.wasmlix_clientStateEntries(this.__wbg_ptr);
56
+ return takeObject(ret);
57
+ }
58
+ /**
59
+ * @param {string} key
60
+ * @returns {Promise<any>}
61
+ */
62
+ clientStateGet(key) {
63
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
64
+ const len0 = WASM_VECTOR_LEN;
65
+ const ret = wasm.wasmlix_clientStateGet(this.__wbg_ptr, ptr0, len0);
66
+ return takeObject(ret);
67
+ }
68
+ /**
69
+ * @param {string} key
70
+ * @param {any} value
71
+ * @returns {Promise<void>}
72
+ */
73
+ clientStateSet(key, value) {
74
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
75
+ const len0 = WASM_VECTOR_LEN;
76
+ const ret = wasm.wasmlix_clientStateSet(this.__wbg_ptr, ptr0, len0, addHeapObject(value));
77
+ return takeObject(ret);
78
+ }
34
79
  /**
35
80
  * @returns {Promise<void>}
36
81
  */
@@ -46,6 +91,13 @@ export class WasmLix {
46
91
  const ret = wasm.wasmlix_createBranch(this.__wbg_ptr, addHeapObject(options));
47
92
  return takeObject(ret);
48
93
  }
94
+ /**
95
+ * @returns {Promise<any>}
96
+ */
97
+ createCheckpoint() {
98
+ const ret = wasm.wasmlix_createCheckpoint(this.__wbg_ptr);
99
+ return takeObject(ret);
100
+ }
49
101
  /**
50
102
  * @param {string} sql
51
103
  * @param {any} params
@@ -58,6 +110,15 @@ export class WasmLix {
58
110
  const ret = wasm.wasmlix_execute(this.__wbg_ptr, ptr0, len0, addHeapObject(params), isLikeNone(options) ? 0 : addHeapObject(options));
59
111
  return takeObject(ret);
60
112
  }
113
+ /**
114
+ * @param {any} statements
115
+ * @param {any | null} [options]
116
+ * @returns {Promise<any>}
117
+ */
118
+ executeBatch(statements, options) {
119
+ const ret = wasm.wasmlix_executeBatch(this.__wbg_ptr, addHeapObject(statements), isLikeNone(options) ? 0 : addHeapObject(options));
120
+ return takeObject(ret);
121
+ }
61
122
  /**
62
123
  * @returns {Promise<Uint8Array>}
63
124
  */
@@ -92,6 +153,13 @@ export class WasmLix {
92
153
  const ret = wasm.wasmlix_observe(this.__wbg_ptr, ptr0, len0, addHeapObject(params));
93
154
  return takeObject(ret);
94
155
  }
156
+ /**
157
+ * @returns {Promise<any>}
158
+ */
159
+ redo() {
160
+ const ret = wasm.wasmlix_redo(this.__wbg_ptr);
161
+ return takeObject(ret);
162
+ }
95
163
  /**
96
164
  * @param {any} options
97
165
  * @returns {Promise<any>}
@@ -100,6 +168,13 @@ export class WasmLix {
100
168
  const ret = wasm.wasmlix_switchBranch(this.__wbg_ptr, addHeapObject(options));
101
169
  return takeObject(ret);
102
170
  }
171
+ /**
172
+ * @returns {Promise<any>}
173
+ */
174
+ undo() {
175
+ const ret = wasm.wasmlix_undo(this.__wbg_ptr);
176
+ return takeObject(ret);
177
+ }
103
178
  }
104
179
  if (Symbol.dispose) WasmLix.prototype[Symbol.dispose] = WasmLix.prototype.free;
105
180
 
@@ -180,23 +255,23 @@ export class WasmObserveEvents {
180
255
  if (Symbol.dispose) WasmObserveEvents.prototype[Symbol.dispose] = WasmObserveEvents.prototype.free;
181
256
 
182
257
  /**
183
- * @param {Function} plugin_runtime_dispatch
258
+ * @param {Function | null} [telemetry_dispatch]
184
259
  * @returns {Promise<WasmLix>}
185
260
  */
186
- export function openMemory(plugin_runtime_dispatch) {
187
- const ret = wasm.openMemory(addHeapObject(plugin_runtime_dispatch));
261
+ export function openMemory(telemetry_dispatch) {
262
+ const ret = wasm.openMemory(isLikeNone(telemetry_dispatch) ? 0 : addHeapObject(telemetry_dispatch));
188
263
  return takeObject(ret);
189
264
  }
190
265
 
191
266
  /**
192
- * @param {Function} plugin_runtime_dispatch
267
+ * @param {Function | null} [telemetry_dispatch]
193
268
  * @param {Uint8Array | null} [snapshot]
194
269
  * @returns {Promise<WasmLix>}
195
270
  */
196
- export function openMemoryFromSnapshot(plugin_runtime_dispatch, snapshot) {
271
+ export function openMemoryFromSnapshot(telemetry_dispatch, snapshot) {
197
272
  var ptr0 = isLikeNone(snapshot) ? 0 : passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
198
273
  var len0 = WASM_VECTOR_LEN;
199
- const ret = wasm.openMemoryFromSnapshot(addHeapObject(plugin_runtime_dispatch), ptr0, len0);
274
+ const ret = wasm.openMemoryFromSnapshot(isLikeNone(telemetry_dispatch) ? 0 : addHeapObject(telemetry_dispatch), ptr0, len0);
200
275
  return takeObject(ret);
201
276
  }
202
277
 
@@ -364,6 +439,10 @@ function __wbg_get_imports() {
364
439
  const ret = getObject(arg0)[arg1 >>> 0];
365
440
  return addHeapObject(ret);
366
441
  },
442
+ __wbg_get_de6a0f7d4d18a304: function() { return handleError(function (arg0, arg1) {
443
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
444
+ return addHeapObject(ret);
445
+ }, arguments); },
367
446
  __wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
368
447
  const ret = getObject(arg0)[arg1 >>> 0];
369
448
  return addHeapObject(ret);
@@ -457,7 +536,7 @@ function __wbg_get_imports() {
457
536
  const a = state0.a;
458
537
  state0.a = 0;
459
538
  try {
460
- return __wasm_bindgen_func_elem_101669(a, state0.b, arg0, arg1);
539
+ return __wasm_bindgen_func_elem_120697(a, state0.b, arg0, arg1);
461
540
  } finally {
462
541
  state0.a = a;
463
542
  }
@@ -480,6 +559,10 @@ function __wbg_get_imports() {
480
559
  const ret = Date.now();
481
560
  return ret;
482
561
  }, arguments); },
562
+ __wbg_now_190933fa139cc119: function() {
563
+ const ret = Date.now();
564
+ return ret;
565
+ },
483
566
  __wbg_now_e7c6795a7f81e10f: function(arg0) {
484
567
  const ret = getObject(arg0).now();
485
568
  return ret;
@@ -542,10 +625,6 @@ function __wbg_get_imports() {
542
625
  const ret = typeof window === 'undefined' ? null : window;
543
626
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
544
627
  },
545
- __wbg_then_18f476d590e58992: function(arg0, arg1, arg2) {
546
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
547
- return addHeapObject(ret);
548
- },
549
628
  __wbg_then_ac7b025999b52837: function(arg0, arg1) {
550
629
  const ret = getObject(arg0).then(getObject(arg1));
551
630
  return addHeapObject(ret);
@@ -567,8 +646,8 @@ function __wbg_get_imports() {
567
646
  return addHeapObject(ret);
568
647
  },
569
648
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
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);
649
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 30501, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
650
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_120695);
572
651
  return addHeapObject(ret);
573
652
  },
574
653
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -617,10 +696,10 @@ function __wbg_get_imports() {
617
696
  };
618
697
  }
619
698
 
620
- function __wasm_bindgen_func_elem_101667(arg0, arg1, arg2) {
699
+ function __wasm_bindgen_func_elem_120695(arg0, arg1, arg2) {
621
700
  try {
622
701
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
623
- wasm.__wasm_bindgen_func_elem_101667(retptr, arg0, arg1, addHeapObject(arg2));
702
+ wasm.__wasm_bindgen_func_elem_120695(retptr, arg0, arg1, addHeapObject(arg2));
624
703
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
625
704
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
626
705
  if (r1) {
@@ -631,8 +710,8 @@ function __wasm_bindgen_func_elem_101667(arg0, arg1, arg2) {
631
710
  }
632
711
  }
633
712
 
634
- function __wasm_bindgen_func_elem_101669(arg0, arg1, arg2, arg3) {
635
- wasm.__wasm_bindgen_func_elem_101669(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
713
+ function __wasm_bindgen_func_elem_120697(arg0, arg1, arg2, arg3) {
714
+ wasm.__wasm_bindgen_func_elem_120697(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
636
715
  }
637
716
 
638
717
  const WasmLixFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
@@ -7,23 +7,32 @@ 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
9
  export const parseSqlScript: (a: number, b: number, c: number, d: number) => void;
10
+ export const wasmlix_activeAccountId: (a: number) => number;
10
11
  export const wasmlix_activeBranchId: (a: number) => number;
11
12
  export const wasmlix_beginTransaction: (a: number) => number;
13
+ export const wasmlix_clientStateDelete: (a: number, b: number, c: number) => number;
14
+ export const wasmlix_clientStateEntries: (a: number) => number;
15
+ export const wasmlix_clientStateGet: (a: number, b: number, c: number) => number;
16
+ export const wasmlix_clientStateSet: (a: number, b: number, c: number, d: number) => number;
12
17
  export const wasmlix_close: (a: number) => number;
13
18
  export const wasmlix_createBranch: (a: number, b: number) => number;
19
+ export const wasmlix_createCheckpoint: (a: number) => number;
14
20
  export const wasmlix_execute: (a: number, b: number, c: number, d: number, e: number) => number;
21
+ export const wasmlix_executeBatch: (a: number, b: number, c: number) => number;
15
22
  export const wasmlix_exportSnapshot: (a: number) => number;
16
23
  export const wasmlix_mergeBranch: (a: number, b: number) => number;
17
24
  export const wasmlix_mergeBranchPreview: (a: number, b: number) => number;
18
25
  export const wasmlix_observe: (a: number, b: number, c: number, d: number) => number;
26
+ export const wasmlix_redo: (a: number) => number;
19
27
  export const wasmlix_switchBranch: (a: number, b: number) => number;
28
+ export const wasmlix_undo: (a: number) => number;
20
29
  export const wasmlixtransaction_commit: (a: number) => number;
21
30
  export const wasmlixtransaction_execute: (a: number, b: number, c: number, d: number, e: number) => number;
22
31
  export const wasmlixtransaction_rollback: (a: number) => number;
23
32
  export const wasmobserveevents_close: (a: number) => void;
24
33
  export const wasmobserveevents_next: (a: number) => number;
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;
34
+ export const __wasm_bindgen_func_elem_120695: (a: number, b: number, c: number, d: number) => void;
35
+ export const __wasm_bindgen_func_elem_120697: (a: number, b: number, c: number, d: number) => void;
27
36
  export const __wbindgen_export: (a: number, b: number) => number;
28
37
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
29
38
  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>;