@lix-js/sdk 0.8.0 → 0.8.1
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/dist/bundled-plugins/plugin_csv.lixplugin +0 -0
- package/dist/bundled-plugins/plugin_md_v2.lixplugin +0 -0
- package/dist/wasm/lix_js_sdk.d.ts +7 -2
- package/dist/wasm/lix_js_sdk.js +40 -7
- package/dist/wasm/lix_js_sdk_bg.wasm +0 -0
- package/dist/wasm/lix_js_sdk_bg.wasm.d.ts +4 -2
- package/dist/workerd.d.ts +15 -0
- package/dist/workerd.js +32 -0
- package/package.json +10 -5
|
Binary file
|
|
Binary file
|
|
@@ -10,6 +10,7 @@ export class WasmLix {
|
|
|
10
10
|
close(): Promise<void>;
|
|
11
11
|
createBranch(options: any): Promise<any>;
|
|
12
12
|
execute(sql: string, params: any, options?: any | null): Promise<any>;
|
|
13
|
+
exportSnapshot(): Promise<Uint8Array>;
|
|
13
14
|
mergeBranch(options: any): Promise<any>;
|
|
14
15
|
mergeBranchPreview(options: any): Promise<any>;
|
|
15
16
|
observe(sql: string, params: any): Promise<WasmObserveEvents>;
|
|
@@ -35,6 +36,8 @@ export class WasmObserveEvents {
|
|
|
35
36
|
|
|
36
37
|
export function openMemory(plugin_runtime_dispatch: Function): Promise<WasmLix>;
|
|
37
38
|
|
|
39
|
+
export function openMemoryFromSnapshot(plugin_runtime_dispatch: Function, snapshot?: Uint8Array | null): Promise<WasmLix>;
|
|
40
|
+
|
|
38
41
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
39
42
|
|
|
40
43
|
export interface InitOutput {
|
|
@@ -43,11 +46,13 @@ export interface InitOutput {
|
|
|
43
46
|
readonly __wbg_wasmlixtransaction_free: (a: number, b: number) => void;
|
|
44
47
|
readonly __wbg_wasmobserveevents_free: (a: number, b: number) => void;
|
|
45
48
|
readonly openMemory: (a: number) => number;
|
|
49
|
+
readonly openMemoryFromSnapshot: (a: number, b: number, c: number) => number;
|
|
46
50
|
readonly wasmlix_activeBranchId: (a: number) => number;
|
|
47
51
|
readonly wasmlix_beginTransaction: (a: number) => number;
|
|
48
52
|
readonly wasmlix_close: (a: number) => number;
|
|
49
53
|
readonly wasmlix_createBranch: (a: number, b: number) => number;
|
|
50
54
|
readonly wasmlix_execute: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
55
|
+
readonly wasmlix_exportSnapshot: (a: number) => number;
|
|
51
56
|
readonly wasmlix_mergeBranch: (a: number, b: number) => number;
|
|
52
57
|
readonly wasmlix_mergeBranchPreview: (a: number, b: number) => number;
|
|
53
58
|
readonly wasmlix_observe: (a: number, b: number, c: number, d: number) => number;
|
|
@@ -57,8 +62,8 @@ export interface InitOutput {
|
|
|
57
62
|
readonly wasmlixtransaction_rollback: (a: number) => number;
|
|
58
63
|
readonly wasmobserveevents_close: (a: number) => void;
|
|
59
64
|
readonly wasmobserveevents_next: (a: number) => number;
|
|
60
|
-
readonly
|
|
61
|
-
readonly
|
|
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;
|
|
62
67
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
63
68
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
64
69
|
readonly __wbindgen_export3: (a: number) => void;
|
package/dist/wasm/lix_js_sdk.js
CHANGED
|
@@ -58,6 +58,13 @@ export class WasmLix {
|
|
|
58
58
|
const ret = wasm.wasmlix_execute(this.__wbg_ptr, ptr0, len0, addHeapObject(params), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
59
59
|
return takeObject(ret);
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* @returns {Promise<Uint8Array>}
|
|
63
|
+
*/
|
|
64
|
+
exportSnapshot() {
|
|
65
|
+
const ret = wasm.wasmlix_exportSnapshot(this.__wbg_ptr);
|
|
66
|
+
return takeObject(ret);
|
|
67
|
+
}
|
|
61
68
|
/**
|
|
62
69
|
* @param {any} options
|
|
63
70
|
* @returns {Promise<any>}
|
|
@@ -180,6 +187,18 @@ export function openMemory(plugin_runtime_dispatch) {
|
|
|
180
187
|
const ret = wasm.openMemory(addHeapObject(plugin_runtime_dispatch));
|
|
181
188
|
return takeObject(ret);
|
|
182
189
|
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @param {Function} plugin_runtime_dispatch
|
|
193
|
+
* @param {Uint8Array | null} [snapshot]
|
|
194
|
+
* @returns {Promise<WasmLix>}
|
|
195
|
+
*/
|
|
196
|
+
export function openMemoryFromSnapshot(plugin_runtime_dispatch, snapshot) {
|
|
197
|
+
var ptr0 = isLikeNone(snapshot) ? 0 : passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
|
|
198
|
+
var len0 = WASM_VECTOR_LEN;
|
|
199
|
+
const ret = wasm.openMemoryFromSnapshot(addHeapObject(plugin_runtime_dispatch), ptr0, len0);
|
|
200
|
+
return takeObject(ret);
|
|
201
|
+
}
|
|
183
202
|
function __wbg_get_imports() {
|
|
184
203
|
const import0 = {
|
|
185
204
|
__proto__: null,
|
|
@@ -415,7 +434,7 @@ function __wbg_get_imports() {
|
|
|
415
434
|
const a = state0.a;
|
|
416
435
|
state0.a = 0;
|
|
417
436
|
try {
|
|
418
|
-
return
|
|
437
|
+
return __wasm_bindgen_func_elem_101612(a, state0.b, arg0, arg1);
|
|
419
438
|
} finally {
|
|
420
439
|
state0.a = a;
|
|
421
440
|
}
|
|
@@ -525,8 +544,8 @@ function __wbg_get_imports() {
|
|
|
525
544
|
return addHeapObject(ret);
|
|
526
545
|
},
|
|
527
546
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
528
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
529
|
-
const ret = makeMutClosure(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);
|
|
530
549
|
return addHeapObject(ret);
|
|
531
550
|
},
|
|
532
551
|
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
@@ -554,6 +573,13 @@ function __wbg_get_imports() {
|
|
|
554
573
|
const ret = BigInt.asUintN(64, arg0);
|
|
555
574
|
return addHeapObject(ret);
|
|
556
575
|
},
|
|
576
|
+
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
577
|
+
var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
|
|
578
|
+
wasm.__wbindgen_export4(arg0, arg1 * 1, 1);
|
|
579
|
+
// Cast intrinsic for `Vector(U8) -> Externref`.
|
|
580
|
+
const ret = v0;
|
|
581
|
+
return addHeapObject(ret);
|
|
582
|
+
},
|
|
557
583
|
__wbindgen_object_clone_ref: function(arg0) {
|
|
558
584
|
const ret = getObject(arg0);
|
|
559
585
|
return addHeapObject(ret);
|
|
@@ -568,10 +594,10 @@ function __wbg_get_imports() {
|
|
|
568
594
|
};
|
|
569
595
|
}
|
|
570
596
|
|
|
571
|
-
function
|
|
597
|
+
function __wasm_bindgen_func_elem_101610(arg0, arg1, arg2) {
|
|
572
598
|
try {
|
|
573
599
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
574
|
-
wasm.
|
|
600
|
+
wasm.__wasm_bindgen_func_elem_101610(retptr, arg0, arg1, addHeapObject(arg2));
|
|
575
601
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
576
602
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
577
603
|
if (r1) {
|
|
@@ -582,8 +608,8 @@ function __wasm_bindgen_func_elem_100752(arg0, arg1, arg2) {
|
|
|
582
608
|
}
|
|
583
609
|
}
|
|
584
610
|
|
|
585
|
-
function
|
|
586
|
-
wasm.
|
|
611
|
+
function __wasm_bindgen_func_elem_101612(arg0, arg1, arg2, arg3) {
|
|
612
|
+
wasm.__wasm_bindgen_func_elem_101612(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
587
613
|
}
|
|
588
614
|
|
|
589
615
|
const WasmLixFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -752,6 +778,13 @@ function makeMutClosure(arg0, arg1, f) {
|
|
|
752
778
|
return real;
|
|
753
779
|
}
|
|
754
780
|
|
|
781
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
782
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
783
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
784
|
+
WASM_VECTOR_LEN = arg.length;
|
|
785
|
+
return ptr;
|
|
786
|
+
}
|
|
787
|
+
|
|
755
788
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
756
789
|
if (realloc === undefined) {
|
|
757
790
|
const buf = cachedTextEncoder.encode(arg);
|
|
Binary file
|
|
@@ -5,11 +5,13 @@ export const __wbg_wasmlix_free: (a: number, b: number) => void;
|
|
|
5
5
|
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
|
+
export const openMemoryFromSnapshot: (a: number, b: number, c: number) => number;
|
|
8
9
|
export const wasmlix_activeBranchId: (a: number) => number;
|
|
9
10
|
export const wasmlix_beginTransaction: (a: number) => number;
|
|
10
11
|
export const wasmlix_close: (a: number) => number;
|
|
11
12
|
export const wasmlix_createBranch: (a: number, b: number) => number;
|
|
12
13
|
export const wasmlix_execute: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
14
|
+
export const wasmlix_exportSnapshot: (a: number) => number;
|
|
13
15
|
export const wasmlix_mergeBranch: (a: number, b: number) => number;
|
|
14
16
|
export const wasmlix_mergeBranchPreview: (a: number, b: number) => number;
|
|
15
17
|
export const wasmlix_observe: (a: number, b: number, c: number, d: number) => number;
|
|
@@ -19,8 +21,8 @@ export const wasmlixtransaction_execute: (a: number, b: number, c: number, d: nu
|
|
|
19
21
|
export const wasmlixtransaction_rollback: (a: number) => number;
|
|
20
22
|
export const wasmobserveevents_close: (a: number) => void;
|
|
21
23
|
export const wasmobserveevents_next: (a: number) => number;
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
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;
|
|
24
26
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
25
27
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
26
28
|
export const __wbindgen_export3: (a: number) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LixBinding } from "./binding-types.js";
|
|
2
|
+
export interface OpenMemoryLixOptions {
|
|
3
|
+
snapshot?: Uint8Array;
|
|
4
|
+
}
|
|
5
|
+
export interface WorkerdLixBinding extends LixBinding {
|
|
6
|
+
exportSnapshot(): Promise<Uint8Array>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Opens an in-memory Lix binding directly in a Cloudflare Worker isolate.
|
|
10
|
+
*
|
|
11
|
+
* The browser SDK intentionally uses Web Workers. Workerd does not implement
|
|
12
|
+
* that API, so this entry point initializes the precompiled module directly.
|
|
13
|
+
* Plugin execution is deliberately unavailable in this environment.
|
|
14
|
+
*/
|
|
15
|
+
export declare function openMemoryLix(options?: OpenMemoryLixOptions): Promise<WorkerdLixBinding>;
|
package/dist/workerd.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Generated before TypeScript compilation and emitted beside this module.
|
|
2
|
+
// @ts-expect-error Generated by build:wasm.
|
|
3
|
+
import wasmModule from "./wasm/lix_js_sdk_bg.wasm";
|
|
4
|
+
// @ts-expect-error Generated by build:wasm.
|
|
5
|
+
import { initSync, openMemoryFromSnapshot } from "./wasm/lix_js_sdk.js";
|
|
6
|
+
let initialized = false;
|
|
7
|
+
function initializeWasm() {
|
|
8
|
+
if (initialized)
|
|
9
|
+
return;
|
|
10
|
+
initSync({ module: wasmModule });
|
|
11
|
+
initialized = true;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Opens an in-memory Lix binding directly in a Cloudflare Worker isolate.
|
|
15
|
+
*
|
|
16
|
+
* The browser SDK intentionally uses Web Workers. Workerd does not implement
|
|
17
|
+
* that API, so this entry point initializes the precompiled module directly.
|
|
18
|
+
* Plugin execution is deliberately unavailable in this environment.
|
|
19
|
+
*/
|
|
20
|
+
export async function openMemoryLix(options = {}) {
|
|
21
|
+
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
|
22
|
+
throw new TypeError("openMemoryLix() options must be an object");
|
|
23
|
+
}
|
|
24
|
+
if (options.snapshot !== undefined &&
|
|
25
|
+
!(options.snapshot instanceof Uint8Array)) {
|
|
26
|
+
throw new TypeError("openMemoryLix() snapshot must be a Uint8Array");
|
|
27
|
+
}
|
|
28
|
+
initializeWasm();
|
|
29
|
+
return openMemoryFromSnapshot(async () => {
|
|
30
|
+
throw new Error("Lix plugin execution is unavailable in Workerd");
|
|
31
|
+
}, options.snapshot);
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lix-js/sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./workerd": {
|
|
16
|
+
"types": "./dist/workerd.d.ts",
|
|
17
|
+
"workerd": "./dist/workerd.js",
|
|
18
|
+
"default": "./dist/workerd.js"
|
|
14
19
|
}
|
|
15
20
|
},
|
|
16
21
|
"imports": {
|
|
@@ -48,10 +53,10 @@
|
|
|
48
53
|
"typecheck": "tsc -p tsconfig.test.json --noEmit"
|
|
49
54
|
},
|
|
50
55
|
"optionalDependencies": {
|
|
51
|
-
"@lix-js/sdk-darwin-arm64": "0.8.
|
|
52
|
-
"@lix-js/sdk-linux-arm64": "0.8.
|
|
53
|
-
"@lix-js/sdk-linux-x64": "0.8.
|
|
54
|
-
"@lix-js/sdk-win32-x64": "0.8.
|
|
56
|
+
"@lix-js/sdk-darwin-arm64": "0.8.1",
|
|
57
|
+
"@lix-js/sdk-linux-arm64": "0.8.1",
|
|
58
|
+
"@lix-js/sdk-linux-x64": "0.8.1",
|
|
59
|
+
"@lix-js/sdk-win32-x64": "0.8.1"
|
|
55
60
|
},
|
|
56
61
|
"devDependencies": {
|
|
57
62
|
"@vitest/browser-playwright": "4.0.18",
|