@spooky-sync/ssp-wasm 0.0.1-alpha.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/AGENTS.md +38 -0
- package/package.json +30 -0
- package/pkg/package.json +17 -0
- package/pkg/ssp_wasm.d.ts +215 -0
- package/pkg/ssp_wasm.js +808 -0
- package/pkg/ssp_wasm_bg.wasm +0 -0
- package/pkg/ssp_wasm_bg.wasm.d.ts +30 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# `@spooky-sync/ssp-wasm` — agent guide
|
|
2
|
+
|
|
3
|
+
## What this package is
|
|
4
|
+
|
|
5
|
+
The browser-side stream processor: a Rust crate compiled to WebAssembly via `wasm-pack` that runs the same DBSP-style materialized-view circuit as the Rust `apps/ssp` server, but inside the user's tab. `@spooky-sync/core` instantiates it under the hood to power local reactive queries — you almost never touch this package directly.
|
|
6
|
+
|
|
7
|
+
## When you might touch it
|
|
8
|
+
|
|
9
|
+
- You're debugging why a local query doesn't update after a mutation. `ingest()` is where new records land.
|
|
10
|
+
- You're testing the surrealism (embedded WASM) generation mode of `spky generate` and need to inspect the bundled circuit.
|
|
11
|
+
- You're saving/restoring local state across page loads outside the built-in snapshot path (`save_store_state` / `load_store_state`, with `reconcile` for the delta since).
|
|
12
|
+
|
|
13
|
+
## Public API (`pkg/ssp_wasm.d.ts`)
|
|
14
|
+
|
|
15
|
+
- **`class Sp00kyProcessor`** (constructed once, stored on the client):
|
|
16
|
+
- `register_view(config: WasmViewConfig)` — register a materialized view by ID + SurQL + params.
|
|
17
|
+
- `unregister_view(id)` — remove a view.
|
|
18
|
+
- `ingest(table, op, id, record)` / `ingest_many(items)` — push row changes (`CREATE`/`UPDATE`/`MERGE`/`DELETE`); returns the affected views' deltas (`WasmViewUpdate[]`). Membership is presence-driven: the verb never double-counts or ghosts a row, and an unchanged write is a no-op.
|
|
19
|
+
- `save_store_state()` / `load_store_state(bytes)` — snapshot/restore the base rows as bytes, under the registered views; `reconcile(table, [id, rv][])` steps in the delta against the durable store.
|
|
20
|
+
- `set_projection(bool)` — keep only the fields registered plans evaluate per row; `register_view` reports `missing_fields` to widen with `MERGE`.
|
|
21
|
+
- `compact()` / `dead_bytes()` / `live_bytes()` / `size_report()` — row-arena hygiene and memory attribution.
|
|
22
|
+
- `save_state()` / `load_state(json)` — full circuit snapshot including views (server-shaped; the client uses the store-only pair).
|
|
23
|
+
- `free()` / `[Symbol.dispose]` — release WASM memory.
|
|
24
|
+
- **`init()`** — must be called once after the WASM module loads.
|
|
25
|
+
- Types: `WasmViewConfig`, `WasmViewUpdate`, `WasmIngestItem`.
|
|
26
|
+
|
|
27
|
+
## Build
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm --filter @spooky-sync/ssp-wasm build # wasm-pack build --target web --out-dir pkg
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Output is `pkg/`, which is the only directory shipped via `files`. The Rust source lives one level up in `packages/ssp/src/circuit/`.
|
|
34
|
+
|
|
35
|
+
## Pointers
|
|
36
|
+
|
|
37
|
+
- Server-side counterpart (same circuit, native build): `apps/ssp/`
|
|
38
|
+
- Sync engine that wires this in: `node_modules/@spooky-sync/core/AGENTS.md` → `src/modules/data/`
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spooky-sync/ssp-wasm",
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
|
+
"main": "pkg/ssp_wasm.js",
|
|
5
|
+
"types": "pkg/ssp_wasm.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"pkg",
|
|
8
|
+
"AGENTS.md"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/mono424/sp00ky.git",
|
|
13
|
+
"directory": "packages/ssp-wasm"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "wasm-pack build --target web --out-dir pkg",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"bench:save": "node bench/circuit-save.mjs",
|
|
23
|
+
"bench:ingest": "node bench/ingest-memory.mjs"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"typescript": "^5.0.0",
|
|
27
|
+
"vitest": "^3.0.0",
|
|
28
|
+
"wasm-pack": "^0.13.1"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/pkg/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ssp-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WASM bindings for ssp",
|
|
5
|
+
"version": "0.0.1-alpha.1",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"ssp_wasm_bg.wasm",
|
|
9
|
+
"ssp_wasm.js",
|
|
10
|
+
"ssp_wasm.d.ts"
|
|
11
|
+
],
|
|
12
|
+
"main": "ssp_wasm.js",
|
|
13
|
+
"types": "ssp_wasm.d.ts",
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"./snippets/*"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export interface WasmViewUpdate {
|
|
5
|
+
query_id: string;
|
|
6
|
+
result_hash: string;
|
|
7
|
+
result_data: [string, number][];
|
|
8
|
+
delta: {
|
|
9
|
+
additions: [string, number][];
|
|
10
|
+
removals: string[];
|
|
11
|
+
updates: [string, number][];
|
|
12
|
+
};
|
|
13
|
+
// Per-phase SSP processing time (ms). Ingest path: store_apply/circuit_step/
|
|
14
|
+
// transform. Register path: parse/plan/snapshot. Unused side is 0.
|
|
15
|
+
timing_store_apply_ms: number;
|
|
16
|
+
timing_circuit_step_ms: number;
|
|
17
|
+
timing_transform_ms: number;
|
|
18
|
+
timing_parse_ms: number;
|
|
19
|
+
timing_plan_ms: number;
|
|
20
|
+
timing_snapshot_ms: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface WasmViewConfig {
|
|
24
|
+
id: string;
|
|
25
|
+
surql: string;
|
|
26
|
+
params?: Record<string, any>;
|
|
27
|
+
clientId: string;
|
|
28
|
+
ttl: string;
|
|
29
|
+
lastActiveAt: string;
|
|
30
|
+
safe_params?: Record<string, any>;
|
|
31
|
+
format?: 'flat' | 'tree' | 'streaming';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface WasmIngestItem {
|
|
35
|
+
table: string;
|
|
36
|
+
op: string;
|
|
37
|
+
id: string;
|
|
38
|
+
record: any;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface WasmRegistration extends WasmViewUpdate {
|
|
42
|
+
/** Under projection: fields this plan evaluates that stored rows lack. */
|
|
43
|
+
missing_fields?: Record<string, string[]>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface WasmReconciled {
|
|
47
|
+
fetch: string[];
|
|
48
|
+
deleted: number;
|
|
49
|
+
updates: WasmViewUpdate[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export class Sp00kyProcessor {
|
|
55
|
+
free(): void;
|
|
56
|
+
[Symbol.dispose](): void;
|
|
57
|
+
/**
|
|
58
|
+
* Rebuild row storage without the bytes orphaned by updates and deletes.
|
|
59
|
+
* Returns how many bytes were dead. Costs a decode of every row, so call
|
|
60
|
+
* it from a checkpoint, never per ingest.
|
|
61
|
+
*/
|
|
62
|
+
compact(): number;
|
|
63
|
+
/**
|
|
64
|
+
* Bytes of row storage orphaned by updates and deletes.
|
|
65
|
+
*/
|
|
66
|
+
dead_bytes(): number;
|
|
67
|
+
/**
|
|
68
|
+
* Ingest a record into the stream processor
|
|
69
|
+
*/
|
|
70
|
+
ingest(table: string, op: string, id: string, record: any): any;
|
|
71
|
+
/**
|
|
72
|
+
* Ingest MANY record changes as ONE circuit step.
|
|
73
|
+
*
|
|
74
|
+
* `ingest` costs one full circuit step per record, and a step walks every
|
|
75
|
+
* registered view, so a cold sync that lands thousands of rows paid that
|
|
76
|
+
* fixed cost thousands of times (a ~3.9k-row registry took ~3.4s of circuit
|
|
77
|
+
* time on a laptop, ~0.85ms a row, nearly all of it per-step overhead).
|
|
78
|
+
* `ChangeSet` already carries many changes and `step_timed` applies them
|
|
79
|
+
* all to the store before stepping once, so a batch is a single step with
|
|
80
|
+
* one set of deltas.
|
|
81
|
+
*
|
|
82
|
+
* Same input shape as `ingest`, as an array: `WasmIngestItem[]`. Returns
|
|
83
|
+
* the coalesced `WasmViewUpdate[]` for the whole batch. Changes are applied
|
|
84
|
+
* in array order, so repeated ids inside one batch settle last-write-wins,
|
|
85
|
+
* exactly as sequential `ingest` calls would.
|
|
86
|
+
*/
|
|
87
|
+
ingest_many(items: any): any;
|
|
88
|
+
/**
|
|
89
|
+
* Bytes of row storage referenced by live rows.
|
|
90
|
+
*/
|
|
91
|
+
live_bytes(): number;
|
|
92
|
+
/**
|
|
93
|
+
* Load circuit state from a JSON string
|
|
94
|
+
*/
|
|
95
|
+
load_state(state: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* Install a snapshot written by `save_store_state` UNDER the views that
|
|
98
|
+
* are already registered, keeping permissions and projection. Every
|
|
99
|
+
* registered view is re-primed against the restored rows; the returned
|
|
100
|
+
* `WasmViewUpdate[]` carries their new full results, so a query that
|
|
101
|
+
* registered against the empty pre-snapshot store catches up.
|
|
102
|
+
*/
|
|
103
|
+
load_store_state(bytes: Uint8Array): any;
|
|
104
|
+
/**
|
|
105
|
+
* Highest `_00_rv` folded into each table, `{ [table]: rv }`.
|
|
106
|
+
*/
|
|
107
|
+
max_row_versions(): any;
|
|
108
|
+
constructor();
|
|
109
|
+
/**
|
|
110
|
+
* Compare one table against the caller's authoritative `[id, rv][]`.
|
|
111
|
+
* Rows the store holds but the list lacks are deleted (with view
|
|
112
|
+
* updates); ids the store lacks or holds at a lower `_00_rv` come back in
|
|
113
|
+
* `fetch` for the caller to ingest. See `Circuit::reconcile`.
|
|
114
|
+
*/
|
|
115
|
+
reconcile(table: string, entries: any): any;
|
|
116
|
+
/**
|
|
117
|
+
* Register a new materialized view
|
|
118
|
+
*/
|
|
119
|
+
register_view(config: any): any;
|
|
120
|
+
/**
|
|
121
|
+
* Save the current circuit state as a JSON string
|
|
122
|
+
*/
|
|
123
|
+
save_state(): string;
|
|
124
|
+
/**
|
|
125
|
+
* Snapshot the base collections only, as bytes (a `Uint8Array` in JS).
|
|
126
|
+
* Views are deliberately left out: the client re-registers every query
|
|
127
|
+
* under a fresh session id on boot, so persisted views would only be
|
|
128
|
+
* stepped and never read. Pair with `load_store_state`.
|
|
129
|
+
*/
|
|
130
|
+
save_store_state(): Uint8Array;
|
|
131
|
+
/**
|
|
132
|
+
* Seed per-table `select` permission predicates so `register_view` can
|
|
133
|
+
* inject them (and so non-`_00_` tables aren't default-denied).
|
|
134
|
+
*
|
|
135
|
+
* Expects a `{ [table]: whereText }` object, where `whereText` is the raw
|
|
136
|
+
* `WHERE` expression from the table's `PERMISSIONS FOR select` clause
|
|
137
|
+
* (e.g. `"true"`, or `"owner = $auth.id"`). Called once at boot after the
|
|
138
|
+
* schema is parsed — mirrors the native boot path that reads `INFO FOR DB`.
|
|
139
|
+
*/
|
|
140
|
+
set_permissions(permissions: any): void;
|
|
141
|
+
/**
|
|
142
|
+
* Keep only the fields registered plans evaluate (plus `id`/`_00_rv`)
|
|
143
|
+
* per stored row. Off by default. Must be set before the first ingest
|
|
144
|
+
* to take effect on those rows; `compact` re-projects existing ones.
|
|
145
|
+
*/
|
|
146
|
+
set_projection(enabled: boolean): void;
|
|
147
|
+
/**
|
|
148
|
+
* Per-table and per-view heap attribution, sorted heaviest first.
|
|
149
|
+
*/
|
|
150
|
+
size_report(): any;
|
|
151
|
+
/**
|
|
152
|
+
* Unregister a view by ID
|
|
153
|
+
*/
|
|
154
|
+
unregister_view(id: string): void;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Called when WASM module is loaded
|
|
159
|
+
*/
|
|
160
|
+
export function init(): void;
|
|
161
|
+
|
|
162
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
163
|
+
|
|
164
|
+
export interface InitOutput {
|
|
165
|
+
readonly memory: WebAssembly.Memory;
|
|
166
|
+
readonly __wbg_sp00kyprocessor_free: (a: number, b: number) => void;
|
|
167
|
+
readonly init: () => void;
|
|
168
|
+
readonly sp00kyprocessor_compact: (a: number) => number;
|
|
169
|
+
readonly sp00kyprocessor_dead_bytes: (a: number) => number;
|
|
170
|
+
readonly sp00kyprocessor_ingest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any) => [number, number, number];
|
|
171
|
+
readonly sp00kyprocessor_ingest_many: (a: number, b: any) => [number, number, number];
|
|
172
|
+
readonly sp00kyprocessor_live_bytes: (a: number) => number;
|
|
173
|
+
readonly sp00kyprocessor_load_state: (a: number, b: number, c: number) => [number, number];
|
|
174
|
+
readonly sp00kyprocessor_load_store_state: (a: number, b: number, c: number) => [number, number, number];
|
|
175
|
+
readonly sp00kyprocessor_max_row_versions: (a: number) => [number, number, number];
|
|
176
|
+
readonly sp00kyprocessor_new: () => number;
|
|
177
|
+
readonly sp00kyprocessor_reconcile: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
178
|
+
readonly sp00kyprocessor_register_view: (a: number, b: any) => [number, number, number];
|
|
179
|
+
readonly sp00kyprocessor_save_state: (a: number) => [number, number, number, number];
|
|
180
|
+
readonly sp00kyprocessor_save_store_state: (a: number) => [number, number, number, number];
|
|
181
|
+
readonly sp00kyprocessor_set_permissions: (a: number, b: any) => [number, number];
|
|
182
|
+
readonly sp00kyprocessor_set_projection: (a: number, b: number) => void;
|
|
183
|
+
readonly sp00kyprocessor_size_report: (a: number) => [number, number, number];
|
|
184
|
+
readonly sp00kyprocessor_unregister_view: (a: number, b: number, c: number) => void;
|
|
185
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
186
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
187
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
188
|
+
readonly __externref_table_alloc: () => number;
|
|
189
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
190
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
191
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
192
|
+
readonly __wbindgen_start: () => void;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
199
|
+
* a precompiled `WebAssembly.Module`.
|
|
200
|
+
*
|
|
201
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
202
|
+
*
|
|
203
|
+
* @returns {InitOutput}
|
|
204
|
+
*/
|
|
205
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
209
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
210
|
+
*
|
|
211
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
212
|
+
*
|
|
213
|
+
* @returns {Promise<InitOutput>}
|
|
214
|
+
*/
|
|
215
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/pkg/ssp_wasm.js
ADDED
|
@@ -0,0 +1,808 @@
|
|
|
1
|
+
/* @ts-self-types="./ssp_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class Sp00kyProcessor {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
Sp00kyProcessorFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_sp00kyprocessor_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Rebuild row storage without the bytes orphaned by updates and deletes.
|
|
16
|
+
* Returns how many bytes were dead. Costs a decode of every row, so call
|
|
17
|
+
* it from a checkpoint, never per ingest.
|
|
18
|
+
* @returns {number}
|
|
19
|
+
*/
|
|
20
|
+
compact() {
|
|
21
|
+
const ret = wasm.sp00kyprocessor_compact(this.__wbg_ptr);
|
|
22
|
+
return ret;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Bytes of row storage orphaned by updates and deletes.
|
|
26
|
+
* @returns {number}
|
|
27
|
+
*/
|
|
28
|
+
dead_bytes() {
|
|
29
|
+
const ret = wasm.sp00kyprocessor_dead_bytes(this.__wbg_ptr);
|
|
30
|
+
return ret;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Ingest a record into the stream processor
|
|
34
|
+
* @param {string} table
|
|
35
|
+
* @param {string} op
|
|
36
|
+
* @param {string} id
|
|
37
|
+
* @param {any} record
|
|
38
|
+
* @returns {any}
|
|
39
|
+
*/
|
|
40
|
+
ingest(table, op, id, record) {
|
|
41
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
42
|
+
const len0 = WASM_VECTOR_LEN;
|
|
43
|
+
const ptr1 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
44
|
+
const len1 = WASM_VECTOR_LEN;
|
|
45
|
+
const ptr2 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
46
|
+
const len2 = WASM_VECTOR_LEN;
|
|
47
|
+
const ret = wasm.sp00kyprocessor_ingest(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, record);
|
|
48
|
+
if (ret[2]) {
|
|
49
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
50
|
+
}
|
|
51
|
+
return takeFromExternrefTable0(ret[0]);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Ingest MANY record changes as ONE circuit step.
|
|
55
|
+
*
|
|
56
|
+
* `ingest` costs one full circuit step per record, and a step walks every
|
|
57
|
+
* registered view, so a cold sync that lands thousands of rows paid that
|
|
58
|
+
* fixed cost thousands of times (a ~3.9k-row registry took ~3.4s of circuit
|
|
59
|
+
* time on a laptop, ~0.85ms a row, nearly all of it per-step overhead).
|
|
60
|
+
* `ChangeSet` already carries many changes and `step_timed` applies them
|
|
61
|
+
* all to the store before stepping once, so a batch is a single step with
|
|
62
|
+
* one set of deltas.
|
|
63
|
+
*
|
|
64
|
+
* Same input shape as `ingest`, as an array: `WasmIngestItem[]`. Returns
|
|
65
|
+
* the coalesced `WasmViewUpdate[]` for the whole batch. Changes are applied
|
|
66
|
+
* in array order, so repeated ids inside one batch settle last-write-wins,
|
|
67
|
+
* exactly as sequential `ingest` calls would.
|
|
68
|
+
* @param {any} items
|
|
69
|
+
* @returns {any}
|
|
70
|
+
*/
|
|
71
|
+
ingest_many(items) {
|
|
72
|
+
const ret = wasm.sp00kyprocessor_ingest_many(this.__wbg_ptr, items);
|
|
73
|
+
if (ret[2]) {
|
|
74
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
75
|
+
}
|
|
76
|
+
return takeFromExternrefTable0(ret[0]);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Bytes of row storage referenced by live rows.
|
|
80
|
+
* @returns {number}
|
|
81
|
+
*/
|
|
82
|
+
live_bytes() {
|
|
83
|
+
const ret = wasm.sp00kyprocessor_live_bytes(this.__wbg_ptr);
|
|
84
|
+
return ret;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Load circuit state from a JSON string
|
|
88
|
+
* @param {string} state
|
|
89
|
+
*/
|
|
90
|
+
load_state(state) {
|
|
91
|
+
const ptr0 = passStringToWasm0(state, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
92
|
+
const len0 = WASM_VECTOR_LEN;
|
|
93
|
+
const ret = wasm.sp00kyprocessor_load_state(this.__wbg_ptr, ptr0, len0);
|
|
94
|
+
if (ret[1]) {
|
|
95
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Install a snapshot written by `save_store_state` UNDER the views that
|
|
100
|
+
* are already registered, keeping permissions and projection. Every
|
|
101
|
+
* registered view is re-primed against the restored rows; the returned
|
|
102
|
+
* `WasmViewUpdate[]` carries their new full results, so a query that
|
|
103
|
+
* registered against the empty pre-snapshot store catches up.
|
|
104
|
+
* @param {Uint8Array} bytes
|
|
105
|
+
* @returns {any}
|
|
106
|
+
*/
|
|
107
|
+
load_store_state(bytes) {
|
|
108
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
109
|
+
const len0 = WASM_VECTOR_LEN;
|
|
110
|
+
const ret = wasm.sp00kyprocessor_load_store_state(this.__wbg_ptr, ptr0, len0);
|
|
111
|
+
if (ret[2]) {
|
|
112
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
113
|
+
}
|
|
114
|
+
return takeFromExternrefTable0(ret[0]);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Highest `_00_rv` folded into each table, `{ [table]: rv }`.
|
|
118
|
+
* @returns {any}
|
|
119
|
+
*/
|
|
120
|
+
max_row_versions() {
|
|
121
|
+
const ret = wasm.sp00kyprocessor_max_row_versions(this.__wbg_ptr);
|
|
122
|
+
if (ret[2]) {
|
|
123
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
124
|
+
}
|
|
125
|
+
return takeFromExternrefTable0(ret[0]);
|
|
126
|
+
}
|
|
127
|
+
constructor() {
|
|
128
|
+
const ret = wasm.sp00kyprocessor_new();
|
|
129
|
+
this.__wbg_ptr = ret >>> 0;
|
|
130
|
+
Sp00kyProcessorFinalization.register(this, this.__wbg_ptr, this);
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Compare one table against the caller's authoritative `[id, rv][]`.
|
|
135
|
+
* Rows the store holds but the list lacks are deleted (with view
|
|
136
|
+
* updates); ids the store lacks or holds at a lower `_00_rv` come back in
|
|
137
|
+
* `fetch` for the caller to ingest. See `Circuit::reconcile`.
|
|
138
|
+
* @param {string} table
|
|
139
|
+
* @param {any} entries
|
|
140
|
+
* @returns {any}
|
|
141
|
+
*/
|
|
142
|
+
reconcile(table, entries) {
|
|
143
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
144
|
+
const len0 = WASM_VECTOR_LEN;
|
|
145
|
+
const ret = wasm.sp00kyprocessor_reconcile(this.__wbg_ptr, ptr0, len0, entries);
|
|
146
|
+
if (ret[2]) {
|
|
147
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
148
|
+
}
|
|
149
|
+
return takeFromExternrefTable0(ret[0]);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Register a new materialized view
|
|
153
|
+
* @param {any} config
|
|
154
|
+
* @returns {any}
|
|
155
|
+
*/
|
|
156
|
+
register_view(config) {
|
|
157
|
+
const ret = wasm.sp00kyprocessor_register_view(this.__wbg_ptr, config);
|
|
158
|
+
if (ret[2]) {
|
|
159
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
160
|
+
}
|
|
161
|
+
return takeFromExternrefTable0(ret[0]);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Save the current circuit state as a JSON string
|
|
165
|
+
* @returns {string}
|
|
166
|
+
*/
|
|
167
|
+
save_state() {
|
|
168
|
+
let deferred2_0;
|
|
169
|
+
let deferred2_1;
|
|
170
|
+
try {
|
|
171
|
+
const ret = wasm.sp00kyprocessor_save_state(this.__wbg_ptr);
|
|
172
|
+
var ptr1 = ret[0];
|
|
173
|
+
var len1 = ret[1];
|
|
174
|
+
if (ret[3]) {
|
|
175
|
+
ptr1 = 0; len1 = 0;
|
|
176
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
177
|
+
}
|
|
178
|
+
deferred2_0 = ptr1;
|
|
179
|
+
deferred2_1 = len1;
|
|
180
|
+
return getStringFromWasm0(ptr1, len1);
|
|
181
|
+
} finally {
|
|
182
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Snapshot the base collections only, as bytes (a `Uint8Array` in JS).
|
|
187
|
+
* Views are deliberately left out: the client re-registers every query
|
|
188
|
+
* under a fresh session id on boot, so persisted views would only be
|
|
189
|
+
* stepped and never read. Pair with `load_store_state`.
|
|
190
|
+
* @returns {Uint8Array}
|
|
191
|
+
*/
|
|
192
|
+
save_store_state() {
|
|
193
|
+
const ret = wasm.sp00kyprocessor_save_store_state(this.__wbg_ptr);
|
|
194
|
+
if (ret[3]) {
|
|
195
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
196
|
+
}
|
|
197
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
198
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
199
|
+
return v1;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Seed per-table `select` permission predicates so `register_view` can
|
|
203
|
+
* inject them (and so non-`_00_` tables aren't default-denied).
|
|
204
|
+
*
|
|
205
|
+
* Expects a `{ [table]: whereText }` object, where `whereText` is the raw
|
|
206
|
+
* `WHERE` expression from the table's `PERMISSIONS FOR select` clause
|
|
207
|
+
* (e.g. `"true"`, or `"owner = $auth.id"`). Called once at boot after the
|
|
208
|
+
* schema is parsed — mirrors the native boot path that reads `INFO FOR DB`.
|
|
209
|
+
* @param {any} permissions
|
|
210
|
+
*/
|
|
211
|
+
set_permissions(permissions) {
|
|
212
|
+
const ret = wasm.sp00kyprocessor_set_permissions(this.__wbg_ptr, permissions);
|
|
213
|
+
if (ret[1]) {
|
|
214
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Keep only the fields registered plans evaluate (plus `id`/`_00_rv`)
|
|
219
|
+
* per stored row. Off by default. Must be set before the first ingest
|
|
220
|
+
* to take effect on those rows; `compact` re-projects existing ones.
|
|
221
|
+
* @param {boolean} enabled
|
|
222
|
+
*/
|
|
223
|
+
set_projection(enabled) {
|
|
224
|
+
wasm.sp00kyprocessor_set_projection(this.__wbg_ptr, enabled);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Per-table and per-view heap attribution, sorted heaviest first.
|
|
228
|
+
* @returns {any}
|
|
229
|
+
*/
|
|
230
|
+
size_report() {
|
|
231
|
+
const ret = wasm.sp00kyprocessor_size_report(this.__wbg_ptr);
|
|
232
|
+
if (ret[2]) {
|
|
233
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
234
|
+
}
|
|
235
|
+
return takeFromExternrefTable0(ret[0]);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Unregister a view by ID
|
|
239
|
+
* @param {string} id
|
|
240
|
+
*/
|
|
241
|
+
unregister_view(id) {
|
|
242
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
243
|
+
const len0 = WASM_VECTOR_LEN;
|
|
244
|
+
wasm.sp00kyprocessor_unregister_view(this.__wbg_ptr, ptr0, len0);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (Symbol.dispose) Sp00kyProcessor.prototype[Symbol.dispose] = Sp00kyProcessor.prototype.free;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Called when WASM module is loaded
|
|
251
|
+
*/
|
|
252
|
+
export function init() {
|
|
253
|
+
wasm.init();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function __wbg_get_imports() {
|
|
257
|
+
const import0 = {
|
|
258
|
+
__proto__: null,
|
|
259
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
260
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
261
|
+
return ret;
|
|
262
|
+
},
|
|
263
|
+
__wbg_Number_04624de7d0e8332d: function(arg0) {
|
|
264
|
+
const ret = Number(arg0);
|
|
265
|
+
return ret;
|
|
266
|
+
},
|
|
267
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
268
|
+
const ret = String(arg1);
|
|
269
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
270
|
+
const len1 = WASM_VECTOR_LEN;
|
|
271
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
272
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
273
|
+
},
|
|
274
|
+
__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
|
|
275
|
+
const v = arg1;
|
|
276
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
277
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
278
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
279
|
+
},
|
|
280
|
+
__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
|
|
281
|
+
const v = arg0;
|
|
282
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
283
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
284
|
+
},
|
|
285
|
+
__wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
|
|
286
|
+
const ret = debugString(arg1);
|
|
287
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
288
|
+
const len1 = WASM_VECTOR_LEN;
|
|
289
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
290
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
291
|
+
},
|
|
292
|
+
__wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
|
|
293
|
+
const ret = arg0 in arg1;
|
|
294
|
+
return ret;
|
|
295
|
+
},
|
|
296
|
+
__wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {
|
|
297
|
+
const ret = typeof(arg0) === 'bigint';
|
|
298
|
+
return ret;
|
|
299
|
+
},
|
|
300
|
+
__wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
|
|
301
|
+
const ret = typeof(arg0) === 'function';
|
|
302
|
+
return ret;
|
|
303
|
+
},
|
|
304
|
+
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
|
|
305
|
+
const val = arg0;
|
|
306
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
307
|
+
return ret;
|
|
308
|
+
},
|
|
309
|
+
__wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
|
|
310
|
+
const ret = typeof(arg0) === 'string';
|
|
311
|
+
return ret;
|
|
312
|
+
},
|
|
313
|
+
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
314
|
+
const ret = arg0 === undefined;
|
|
315
|
+
return ret;
|
|
316
|
+
},
|
|
317
|
+
__wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
|
|
318
|
+
const ret = arg0 === arg1;
|
|
319
|
+
return ret;
|
|
320
|
+
},
|
|
321
|
+
__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
|
|
322
|
+
const ret = arg0 == arg1;
|
|
323
|
+
return ret;
|
|
324
|
+
},
|
|
325
|
+
__wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
|
|
326
|
+
const obj = arg1;
|
|
327
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
328
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
329
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
330
|
+
},
|
|
331
|
+
__wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
|
|
332
|
+
const obj = arg1;
|
|
333
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
334
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
335
|
+
var len1 = WASM_VECTOR_LEN;
|
|
336
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
337
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
338
|
+
},
|
|
339
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
340
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
341
|
+
},
|
|
342
|
+
__wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
|
|
343
|
+
const ret = arg0.call(arg1);
|
|
344
|
+
return ret;
|
|
345
|
+
}, arguments); },
|
|
346
|
+
__wbg_done_57b39ecd9addfe81: function(arg0) {
|
|
347
|
+
const ret = arg0.done;
|
|
348
|
+
return ret;
|
|
349
|
+
},
|
|
350
|
+
__wbg_entries_58c7934c745daac7: function(arg0) {
|
|
351
|
+
const ret = Object.entries(arg0);
|
|
352
|
+
return ret;
|
|
353
|
+
},
|
|
354
|
+
__wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
|
|
355
|
+
const ret = arg0[arg1 >>> 0];
|
|
356
|
+
return ret;
|
|
357
|
+
},
|
|
358
|
+
__wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
|
|
359
|
+
const ret = Reflect.get(arg0, arg1);
|
|
360
|
+
return ret;
|
|
361
|
+
}, arguments); },
|
|
362
|
+
__wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
|
|
363
|
+
const ret = arg0[arg1];
|
|
364
|
+
return ret;
|
|
365
|
+
},
|
|
366
|
+
__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
|
|
367
|
+
let result;
|
|
368
|
+
try {
|
|
369
|
+
result = arg0 instanceof ArrayBuffer;
|
|
370
|
+
} catch (_) {
|
|
371
|
+
result = false;
|
|
372
|
+
}
|
|
373
|
+
const ret = result;
|
|
374
|
+
return ret;
|
|
375
|
+
},
|
|
376
|
+
__wbg_instanceof_Map_53af74335dec57f4: function(arg0) {
|
|
377
|
+
let result;
|
|
378
|
+
try {
|
|
379
|
+
result = arg0 instanceof Map;
|
|
380
|
+
} catch (_) {
|
|
381
|
+
result = false;
|
|
382
|
+
}
|
|
383
|
+
const ret = result;
|
|
384
|
+
return ret;
|
|
385
|
+
},
|
|
386
|
+
__wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
|
|
387
|
+
let result;
|
|
388
|
+
try {
|
|
389
|
+
result = arg0 instanceof Uint8Array;
|
|
390
|
+
} catch (_) {
|
|
391
|
+
result = false;
|
|
392
|
+
}
|
|
393
|
+
const ret = result;
|
|
394
|
+
return ret;
|
|
395
|
+
},
|
|
396
|
+
__wbg_isArray_d314bb98fcf08331: function(arg0) {
|
|
397
|
+
const ret = Array.isArray(arg0);
|
|
398
|
+
return ret;
|
|
399
|
+
},
|
|
400
|
+
__wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
|
|
401
|
+
const ret = Number.isSafeInteger(arg0);
|
|
402
|
+
return ret;
|
|
403
|
+
},
|
|
404
|
+
__wbg_iterator_6ff6560ca1568e55: function() {
|
|
405
|
+
const ret = Symbol.iterator;
|
|
406
|
+
return ret;
|
|
407
|
+
},
|
|
408
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
409
|
+
const ret = arg0.length;
|
|
410
|
+
return ret;
|
|
411
|
+
},
|
|
412
|
+
__wbg_length_35a7bace40f36eac: function(arg0) {
|
|
413
|
+
const ret = arg0.length;
|
|
414
|
+
return ret;
|
|
415
|
+
},
|
|
416
|
+
__wbg_log_6b5ca2e6124b2808: function(arg0) {
|
|
417
|
+
console.log(arg0);
|
|
418
|
+
},
|
|
419
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
420
|
+
const ret = new Object();
|
|
421
|
+
return ret;
|
|
422
|
+
},
|
|
423
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
424
|
+
const ret = new Array();
|
|
425
|
+
return ret;
|
|
426
|
+
},
|
|
427
|
+
__wbg_new_dca287b076112a51: function() {
|
|
428
|
+
const ret = new Map();
|
|
429
|
+
return ret;
|
|
430
|
+
},
|
|
431
|
+
__wbg_new_dd2b680c8bf6ae29: function(arg0) {
|
|
432
|
+
const ret = new Uint8Array(arg0);
|
|
433
|
+
return ret;
|
|
434
|
+
},
|
|
435
|
+
__wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
|
|
436
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
437
|
+
return ret;
|
|
438
|
+
},
|
|
439
|
+
__wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
|
|
440
|
+
const ret = arg0.next();
|
|
441
|
+
return ret;
|
|
442
|
+
}, arguments); },
|
|
443
|
+
__wbg_next_418f80d8f5303233: function(arg0) {
|
|
444
|
+
const ret = arg0.next;
|
|
445
|
+
return ret;
|
|
446
|
+
},
|
|
447
|
+
__wbg_now_2c95c9de01293173: function(arg0) {
|
|
448
|
+
const ret = arg0.now();
|
|
449
|
+
return ret;
|
|
450
|
+
},
|
|
451
|
+
__wbg_performance_7a3ffd0b17f663ad: function(arg0) {
|
|
452
|
+
const ret = arg0.performance;
|
|
453
|
+
return ret;
|
|
454
|
+
},
|
|
455
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
456
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
457
|
+
},
|
|
458
|
+
__wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
|
|
459
|
+
const ret = arg0.set(arg1, arg2);
|
|
460
|
+
return ret;
|
|
461
|
+
},
|
|
462
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
463
|
+
arg0[arg1] = arg2;
|
|
464
|
+
},
|
|
465
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
466
|
+
arg0[arg1 >>> 0] = arg2;
|
|
467
|
+
},
|
|
468
|
+
__wbg_static_accessor_GLOBAL_12837167ad935116: function() {
|
|
469
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
470
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
471
|
+
},
|
|
472
|
+
__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
|
|
473
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
474
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
475
|
+
},
|
|
476
|
+
__wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
|
|
477
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
478
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
479
|
+
},
|
|
480
|
+
__wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
|
|
481
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
482
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
483
|
+
},
|
|
484
|
+
__wbg_value_0546255b415e96c1: function(arg0) {
|
|
485
|
+
const ret = arg0.value;
|
|
486
|
+
return ret;
|
|
487
|
+
},
|
|
488
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
489
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
490
|
+
const ret = arg0;
|
|
491
|
+
return ret;
|
|
492
|
+
},
|
|
493
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
494
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
495
|
+
const ret = arg0;
|
|
496
|
+
return ret;
|
|
497
|
+
},
|
|
498
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
499
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
500
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
501
|
+
return ret;
|
|
502
|
+
},
|
|
503
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
504
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
505
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
506
|
+
return ret;
|
|
507
|
+
},
|
|
508
|
+
__wbindgen_init_externref_table: function() {
|
|
509
|
+
const table = wasm.__wbindgen_externrefs;
|
|
510
|
+
const offset = table.grow(4);
|
|
511
|
+
table.set(0, undefined);
|
|
512
|
+
table.set(offset + 0, undefined);
|
|
513
|
+
table.set(offset + 1, null);
|
|
514
|
+
table.set(offset + 2, true);
|
|
515
|
+
table.set(offset + 3, false);
|
|
516
|
+
},
|
|
517
|
+
};
|
|
518
|
+
return {
|
|
519
|
+
__proto__: null,
|
|
520
|
+
"./ssp_wasm_bg.js": import0,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const Sp00kyProcessorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
525
|
+
? { register: () => {}, unregister: () => {} }
|
|
526
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_sp00kyprocessor_free(ptr >>> 0, 1));
|
|
527
|
+
|
|
528
|
+
function addToExternrefTable0(obj) {
|
|
529
|
+
const idx = wasm.__externref_table_alloc();
|
|
530
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
531
|
+
return idx;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function debugString(val) {
|
|
535
|
+
// primitive types
|
|
536
|
+
const type = typeof val;
|
|
537
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
538
|
+
return `${val}`;
|
|
539
|
+
}
|
|
540
|
+
if (type == 'string') {
|
|
541
|
+
return `"${val}"`;
|
|
542
|
+
}
|
|
543
|
+
if (type == 'symbol') {
|
|
544
|
+
const description = val.description;
|
|
545
|
+
if (description == null) {
|
|
546
|
+
return 'Symbol';
|
|
547
|
+
} else {
|
|
548
|
+
return `Symbol(${description})`;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (type == 'function') {
|
|
552
|
+
const name = val.name;
|
|
553
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
554
|
+
return `Function(${name})`;
|
|
555
|
+
} else {
|
|
556
|
+
return 'Function';
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
// objects
|
|
560
|
+
if (Array.isArray(val)) {
|
|
561
|
+
const length = val.length;
|
|
562
|
+
let debug = '[';
|
|
563
|
+
if (length > 0) {
|
|
564
|
+
debug += debugString(val[0]);
|
|
565
|
+
}
|
|
566
|
+
for(let i = 1; i < length; i++) {
|
|
567
|
+
debug += ', ' + debugString(val[i]);
|
|
568
|
+
}
|
|
569
|
+
debug += ']';
|
|
570
|
+
return debug;
|
|
571
|
+
}
|
|
572
|
+
// Test for built-in
|
|
573
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
574
|
+
let className;
|
|
575
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
576
|
+
className = builtInMatches[1];
|
|
577
|
+
} else {
|
|
578
|
+
// Failed to match the standard '[object ClassName]'
|
|
579
|
+
return toString.call(val);
|
|
580
|
+
}
|
|
581
|
+
if (className == 'Object') {
|
|
582
|
+
// we're a user defined class or Object
|
|
583
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
584
|
+
// easier than looping through ownProperties of `val`.
|
|
585
|
+
try {
|
|
586
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
587
|
+
} catch (_) {
|
|
588
|
+
return 'Object';
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
// errors
|
|
592
|
+
if (val instanceof Error) {
|
|
593
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
594
|
+
}
|
|
595
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
596
|
+
return className;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
600
|
+
ptr = ptr >>> 0;
|
|
601
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
let cachedDataViewMemory0 = null;
|
|
605
|
+
function getDataViewMemory0() {
|
|
606
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
607
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
608
|
+
}
|
|
609
|
+
return cachedDataViewMemory0;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
function getStringFromWasm0(ptr, len) {
|
|
613
|
+
ptr = ptr >>> 0;
|
|
614
|
+
return decodeText(ptr, len);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
let cachedUint8ArrayMemory0 = null;
|
|
618
|
+
function getUint8ArrayMemory0() {
|
|
619
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
620
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
621
|
+
}
|
|
622
|
+
return cachedUint8ArrayMemory0;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
function handleError(f, args) {
|
|
626
|
+
try {
|
|
627
|
+
return f.apply(this, args);
|
|
628
|
+
} catch (e) {
|
|
629
|
+
const idx = addToExternrefTable0(e);
|
|
630
|
+
wasm.__wbindgen_exn_store(idx);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function isLikeNone(x) {
|
|
635
|
+
return x === undefined || x === null;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
639
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
640
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
641
|
+
WASM_VECTOR_LEN = arg.length;
|
|
642
|
+
return ptr;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
646
|
+
if (realloc === undefined) {
|
|
647
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
648
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
649
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
650
|
+
WASM_VECTOR_LEN = buf.length;
|
|
651
|
+
return ptr;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
let len = arg.length;
|
|
655
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
656
|
+
|
|
657
|
+
const mem = getUint8ArrayMemory0();
|
|
658
|
+
|
|
659
|
+
let offset = 0;
|
|
660
|
+
|
|
661
|
+
for (; offset < len; offset++) {
|
|
662
|
+
const code = arg.charCodeAt(offset);
|
|
663
|
+
if (code > 0x7F) break;
|
|
664
|
+
mem[ptr + offset] = code;
|
|
665
|
+
}
|
|
666
|
+
if (offset !== len) {
|
|
667
|
+
if (offset !== 0) {
|
|
668
|
+
arg = arg.slice(offset);
|
|
669
|
+
}
|
|
670
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
671
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
672
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
673
|
+
|
|
674
|
+
offset += ret.written;
|
|
675
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
WASM_VECTOR_LEN = offset;
|
|
679
|
+
return ptr;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
function takeFromExternrefTable0(idx) {
|
|
683
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
684
|
+
wasm.__externref_table_dealloc(idx);
|
|
685
|
+
return value;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
689
|
+
cachedTextDecoder.decode();
|
|
690
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
691
|
+
let numBytesDecoded = 0;
|
|
692
|
+
function decodeText(ptr, len) {
|
|
693
|
+
numBytesDecoded += len;
|
|
694
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
695
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
696
|
+
cachedTextDecoder.decode();
|
|
697
|
+
numBytesDecoded = len;
|
|
698
|
+
}
|
|
699
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
const cachedTextEncoder = new TextEncoder();
|
|
703
|
+
|
|
704
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
705
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
706
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
707
|
+
view.set(buf);
|
|
708
|
+
return {
|
|
709
|
+
read: arg.length,
|
|
710
|
+
written: buf.length
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
let WASM_VECTOR_LEN = 0;
|
|
716
|
+
|
|
717
|
+
let wasmModule, wasm;
|
|
718
|
+
function __wbg_finalize_init(instance, module) {
|
|
719
|
+
wasm = instance.exports;
|
|
720
|
+
wasmModule = module;
|
|
721
|
+
cachedDataViewMemory0 = null;
|
|
722
|
+
cachedUint8ArrayMemory0 = null;
|
|
723
|
+
wasm.__wbindgen_start();
|
|
724
|
+
return wasm;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
async function __wbg_load(module, imports) {
|
|
728
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
729
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
730
|
+
try {
|
|
731
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
732
|
+
} catch (e) {
|
|
733
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
734
|
+
|
|
735
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
736
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
737
|
+
|
|
738
|
+
} else { throw e; }
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
const bytes = await module.arrayBuffer();
|
|
743
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
744
|
+
} else {
|
|
745
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
746
|
+
|
|
747
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
748
|
+
return { instance, module };
|
|
749
|
+
} else {
|
|
750
|
+
return instance;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function expectedResponseType(type) {
|
|
755
|
+
switch (type) {
|
|
756
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
757
|
+
}
|
|
758
|
+
return false;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function initSync(module) {
|
|
763
|
+
if (wasm !== undefined) return wasm;
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
if (module !== undefined) {
|
|
767
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
768
|
+
({module} = module)
|
|
769
|
+
} else {
|
|
770
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
const imports = __wbg_get_imports();
|
|
775
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
776
|
+
module = new WebAssembly.Module(module);
|
|
777
|
+
}
|
|
778
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
779
|
+
return __wbg_finalize_init(instance, module);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
async function __wbg_init(module_or_path) {
|
|
783
|
+
if (wasm !== undefined) return wasm;
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
if (module_or_path !== undefined) {
|
|
787
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
788
|
+
({module_or_path} = module_or_path)
|
|
789
|
+
} else {
|
|
790
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
if (module_or_path === undefined) {
|
|
795
|
+
module_or_path = new URL('ssp_wasm_bg.wasm', import.meta.url);
|
|
796
|
+
}
|
|
797
|
+
const imports = __wbg_get_imports();
|
|
798
|
+
|
|
799
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
800
|
+
module_or_path = fetch(module_or_path);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
804
|
+
|
|
805
|
+
return __wbg_finalize_init(instance, module);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_sp00kyprocessor_free: (a: number, b: number) => void;
|
|
5
|
+
export const init: () => void;
|
|
6
|
+
export const sp00kyprocessor_compact: (a: number) => number;
|
|
7
|
+
export const sp00kyprocessor_dead_bytes: (a: number) => number;
|
|
8
|
+
export const sp00kyprocessor_ingest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any) => [number, number, number];
|
|
9
|
+
export const sp00kyprocessor_ingest_many: (a: number, b: any) => [number, number, number];
|
|
10
|
+
export const sp00kyprocessor_live_bytes: (a: number) => number;
|
|
11
|
+
export const sp00kyprocessor_load_state: (a: number, b: number, c: number) => [number, number];
|
|
12
|
+
export const sp00kyprocessor_load_store_state: (a: number, b: number, c: number) => [number, number, number];
|
|
13
|
+
export const sp00kyprocessor_max_row_versions: (a: number) => [number, number, number];
|
|
14
|
+
export const sp00kyprocessor_new: () => number;
|
|
15
|
+
export const sp00kyprocessor_reconcile: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
16
|
+
export const sp00kyprocessor_register_view: (a: number, b: any) => [number, number, number];
|
|
17
|
+
export const sp00kyprocessor_save_state: (a: number) => [number, number, number, number];
|
|
18
|
+
export const sp00kyprocessor_save_store_state: (a: number) => [number, number, number, number];
|
|
19
|
+
export const sp00kyprocessor_set_permissions: (a: number, b: any) => [number, number];
|
|
20
|
+
export const sp00kyprocessor_set_projection: (a: number, b: number) => void;
|
|
21
|
+
export const sp00kyprocessor_size_report: (a: number) => [number, number, number];
|
|
22
|
+
export const sp00kyprocessor_unregister_view: (a: number, b: number, c: number) => void;
|
|
23
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
24
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
25
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
26
|
+
export const __externref_table_alloc: () => number;
|
|
27
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
28
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
29
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
30
|
+
export const __wbindgen_start: () => void;
|