@perspective-dev/client 4.0.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.
- package/LICENSE.md +193 -0
- package/README.md +3 -0
- package/dist/cdn/perspective-server.worker.js +2 -0
- package/dist/cdn/perspective-server.worker.js.map +7 -0
- package/dist/cdn/perspective.js +3 -0
- package/dist/cdn/perspective.js.map +7 -0
- package/dist/esm/perspective-server.worker.d.ts +1 -0
- package/dist/esm/perspective.browser.d.ts +14 -0
- package/dist/esm/perspective.inline.js +3 -0
- package/dist/esm/perspective.inline.js.map +7 -0
- package/dist/esm/perspective.js +3 -0
- package/dist/esm/perspective.js.map +7 -0
- package/dist/esm/perspective.node.d.ts +60 -0
- package/dist/esm/perspective.node.js +2431 -0
- package/dist/esm/perspective.node.js.map +7 -0
- package/dist/esm/ts-rs/Aggregate.d.ts +1 -0
- package/dist/esm/ts-rs/ColumnWindow.d.ts +4 -0
- package/dist/esm/ts-rs/DeleteOptions.d.ts +6 -0
- package/dist/esm/ts-rs/Expressions.d.ts +3 -0
- package/dist/esm/ts-rs/Filter.d.ts +2 -0
- package/dist/esm/ts-rs/FilterReducer.d.ts +1 -0
- package/dist/esm/ts-rs/FilterTerm.d.ts +2 -0
- package/dist/esm/ts-rs/OnUpdateMode.d.ts +9 -0
- package/dist/esm/ts-rs/OnUpdateOptions.d.ts +7 -0
- package/dist/esm/ts-rs/Scalar.d.ts +5 -0
- package/dist/esm/ts-rs/Sort.d.ts +2 -0
- package/dist/esm/ts-rs/SortDir.d.ts +1 -0
- package/dist/esm/ts-rs/SystemInfo.d.ts +40 -0
- package/dist/esm/ts-rs/TableInitOptions.d.ts +22 -0
- package/dist/esm/ts-rs/TableReadFormat.d.ts +7 -0
- package/dist/esm/ts-rs/UpdateOptions.d.ts +8 -0
- package/dist/esm/ts-rs/ViewConfigUpdate.d.ts +90 -0
- package/dist/esm/ts-rs/ViewOnUpdateResp.d.ts +4 -0
- package/dist/esm/ts-rs/ViewWindow.d.ts +23 -0
- package/dist/esm/wasm/browser.d.ts +21 -0
- package/dist/esm/wasm/decompress.d.ts +1 -0
- package/dist/esm/wasm/emscripten_api.d.ts +5 -0
- package/dist/esm/wasm/engine.d.ts +40 -0
- package/dist/esm/wasm/perspective-server.poly.d.ts +1 -0
- package/dist/esm/websocket.d.ts +4 -0
- package/dist/wasm/perspective-js.d.ts +712 -0
- package/dist/wasm/perspective-js.js +1934 -0
- package/dist/wasm/perspective-js.wasm +0 -0
- package/dist/wasm/perspective-js.wasm.d.ts +75 -0
- package/package.json +68 -0
- package/src/rust/client.rs +483 -0
- package/src/rust/lib.rs +70 -0
- package/src/rust/table.rs +364 -0
- package/src/rust/table_data.rs +159 -0
- package/src/rust/utils/browser.rs +39 -0
- package/src/rust/utils/console_logger.rs +236 -0
- package/src/rust/utils/errors.rs +288 -0
- package/src/rust/utils/futures.rs +174 -0
- package/src/rust/utils/json.rs +252 -0
- package/src/rust/utils/local_poll_loop.rs +63 -0
- package/src/rust/utils/mod.rs +32 -0
- package/src/rust/utils/serde.rs +46 -0
- package/src/rust/utils/trace_allocator.rs +98 -0
- package/src/rust/view.rs +355 -0
- package/src/ts/perspective-server.worker.ts +54 -0
- package/src/ts/perspective.browser.ts +132 -0
- package/src/ts/perspective.cdn.ts +22 -0
- package/src/ts/perspective.inline.ts +27 -0
- package/src/ts/perspective.node.ts +315 -0
- package/src/ts/ts-rs/Aggregate.ts +3 -0
- package/src/ts/ts-rs/ColumnWindow.ts +3 -0
- package/src/ts/ts-rs/DeleteOptions.ts +6 -0
- package/src/ts/ts-rs/Expressions.ts +3 -0
- package/src/ts/ts-rs/Filter.ts +4 -0
- package/src/ts/ts-rs/FilterReducer.ts +3 -0
- package/src/ts/ts-rs/FilterTerm.ts +4 -0
- package/src/ts/ts-rs/OnUpdateData.ts +8 -0
- package/src/ts/ts-rs/OnUpdateMode.ts +11 -0
- package/src/ts/ts-rs/OnUpdateOptions.ts +7 -0
- package/src/ts/ts-rs/Scalar.ts +7 -0
- package/src/ts/ts-rs/Sort.ts +4 -0
- package/src/ts/ts-rs/SortDir.ts +3 -0
- package/src/ts/ts-rs/SystemInfo.ts +41 -0
- package/src/ts/ts-rs/TableInitOptions.ts +21 -0
- package/src/ts/ts-rs/TableReadFormat.ts +9 -0
- package/src/ts/ts-rs/UpdateOptions.ts +7 -0
- package/src/ts/ts-rs/ViewConfigUpdate.ts +87 -0
- package/src/ts/ts-rs/ViewOnUpdateResp.ts +3 -0
- package/src/ts/ts-rs/ViewWindow.ts +17 -0
- package/src/ts/wasm/browser.ts +123 -0
- package/src/ts/wasm/decompress.ts +64 -0
- package/src/ts/wasm/emscripten_api.ts +63 -0
- package/src/ts/wasm/engine.ts +271 -0
- package/src/ts/wasm/perspective-server.poly.ts +244 -0
- package/src/ts/websocket.ts +95 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,1934 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
const heap = new Array(128).fill(undefined);
|
|
4
|
+
|
|
5
|
+
heap.push(undefined, null, true, false);
|
|
6
|
+
|
|
7
|
+
function getObject(idx) { return heap[idx]; }
|
|
8
|
+
|
|
9
|
+
let WASM_VECTOR_LEN = 0;
|
|
10
|
+
|
|
11
|
+
let cachedUint8ArrayMemory0 = null;
|
|
12
|
+
|
|
13
|
+
function getUint8ArrayMemory0() {
|
|
14
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
15
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
16
|
+
}
|
|
17
|
+
return cachedUint8ArrayMemory0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
21
|
+
|
|
22
|
+
const encodeString = function (arg, view) {
|
|
23
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
27
|
+
|
|
28
|
+
if (realloc === undefined) {
|
|
29
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
30
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
31
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
32
|
+
WASM_VECTOR_LEN = buf.length;
|
|
33
|
+
return ptr;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let len = arg.length;
|
|
37
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
38
|
+
|
|
39
|
+
const mem = getUint8ArrayMemory0();
|
|
40
|
+
|
|
41
|
+
let offset = 0;
|
|
42
|
+
|
|
43
|
+
for (; offset < len; offset++) {
|
|
44
|
+
const code = arg.charCodeAt(offset);
|
|
45
|
+
if (code > 0x7F) break;
|
|
46
|
+
mem[ptr + offset] = code;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (offset !== len) {
|
|
50
|
+
if (offset !== 0) {
|
|
51
|
+
arg = arg.slice(offset);
|
|
52
|
+
}
|
|
53
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
54
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
55
|
+
const ret = encodeString(arg, view);
|
|
56
|
+
|
|
57
|
+
offset += ret.written;
|
|
58
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
WASM_VECTOR_LEN = offset;
|
|
62
|
+
return ptr;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let cachedDataViewMemory0 = null;
|
|
66
|
+
|
|
67
|
+
function getDataViewMemory0() {
|
|
68
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
69
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
70
|
+
}
|
|
71
|
+
return cachedDataViewMemory0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let heap_next = heap.length;
|
|
75
|
+
|
|
76
|
+
function addHeapObject(obj) {
|
|
77
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
78
|
+
const idx = heap_next;
|
|
79
|
+
heap_next = heap[idx];
|
|
80
|
+
|
|
81
|
+
heap[idx] = obj;
|
|
82
|
+
return idx;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function handleError(f, args) {
|
|
86
|
+
try {
|
|
87
|
+
return f.apply(this, args);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
wasm.__wbindgen_export_2(addHeapObject(e));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
94
|
+
|
|
95
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
96
|
+
|
|
97
|
+
function getStringFromWasm0(ptr, len) {
|
|
98
|
+
ptr = ptr >>> 0;
|
|
99
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
103
|
+
ptr = ptr >>> 0;
|
|
104
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function isLikeNone(x) {
|
|
108
|
+
return x === undefined || x === null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function dropObject(idx) {
|
|
112
|
+
if (idx < 132) return;
|
|
113
|
+
heap[idx] = heap_next;
|
|
114
|
+
heap_next = idx;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function takeObject(idx) {
|
|
118
|
+
const ret = getObject(idx);
|
|
119
|
+
dropObject(idx);
|
|
120
|
+
return ret;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
124
|
+
? { register: () => {}, unregister: () => {} }
|
|
125
|
+
: new FinalizationRegistry(state => {
|
|
126
|
+
wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b)
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
130
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
131
|
+
const real = (...args) => {
|
|
132
|
+
// First up with a closure we increment the internal reference
|
|
133
|
+
// count. This ensures that the Rust closure environment won't
|
|
134
|
+
// be deallocated while we're invoking it.
|
|
135
|
+
state.cnt++;
|
|
136
|
+
const a = state.a;
|
|
137
|
+
state.a = 0;
|
|
138
|
+
try {
|
|
139
|
+
return f(a, state.b, ...args);
|
|
140
|
+
} finally {
|
|
141
|
+
if (--state.cnt === 0) {
|
|
142
|
+
wasm.__wbindgen_export_4.get(state.dtor)(a, state.b);
|
|
143
|
+
CLOSURE_DTORS.unregister(state);
|
|
144
|
+
} else {
|
|
145
|
+
state.a = a;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
real.original = state;
|
|
150
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
151
|
+
return real;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function makeClosure(arg0, arg1, dtor, f) {
|
|
155
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
156
|
+
const real = (...args) => {
|
|
157
|
+
// First up with a closure we increment the internal reference
|
|
158
|
+
// count. This ensures that the Rust closure environment won't
|
|
159
|
+
// be deallocated while we're invoking it.
|
|
160
|
+
state.cnt++;
|
|
161
|
+
try {
|
|
162
|
+
return f(state.a, state.b, ...args);
|
|
163
|
+
} finally {
|
|
164
|
+
if (--state.cnt === 0) {
|
|
165
|
+
wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b);
|
|
166
|
+
state.a = 0;
|
|
167
|
+
CLOSURE_DTORS.unregister(state);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
real.original = state;
|
|
172
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
173
|
+
return real;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function debugString(val) {
|
|
177
|
+
// primitive types
|
|
178
|
+
const type = typeof val;
|
|
179
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
180
|
+
return `${val}`;
|
|
181
|
+
}
|
|
182
|
+
if (type == 'string') {
|
|
183
|
+
return `"${val}"`;
|
|
184
|
+
}
|
|
185
|
+
if (type == 'symbol') {
|
|
186
|
+
const description = val.description;
|
|
187
|
+
if (description == null) {
|
|
188
|
+
return 'Symbol';
|
|
189
|
+
} else {
|
|
190
|
+
return `Symbol(${description})`;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (type == 'function') {
|
|
194
|
+
const name = val.name;
|
|
195
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
196
|
+
return `Function(${name})`;
|
|
197
|
+
} else {
|
|
198
|
+
return 'Function';
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// objects
|
|
202
|
+
if (Array.isArray(val)) {
|
|
203
|
+
const length = val.length;
|
|
204
|
+
let debug = '[';
|
|
205
|
+
if (length > 0) {
|
|
206
|
+
debug += debugString(val[0]);
|
|
207
|
+
}
|
|
208
|
+
for(let i = 1; i < length; i++) {
|
|
209
|
+
debug += ', ' + debugString(val[i]);
|
|
210
|
+
}
|
|
211
|
+
debug += ']';
|
|
212
|
+
return debug;
|
|
213
|
+
}
|
|
214
|
+
// Test for built-in
|
|
215
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
216
|
+
let className;
|
|
217
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
218
|
+
className = builtInMatches[1];
|
|
219
|
+
} else {
|
|
220
|
+
// Failed to match the standard '[object ClassName]'
|
|
221
|
+
return toString.call(val);
|
|
222
|
+
}
|
|
223
|
+
if (className == 'Object') {
|
|
224
|
+
// we're a user defined class or Object
|
|
225
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
226
|
+
// easier than looping through ownProperties of `val`.
|
|
227
|
+
try {
|
|
228
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
229
|
+
} catch (_) {
|
|
230
|
+
return 'Object';
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// errors
|
|
234
|
+
if (val instanceof Error) {
|
|
235
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
236
|
+
}
|
|
237
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
238
|
+
return className;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function _assertClass(instance, klass) {
|
|
242
|
+
if (!(instance instanceof klass)) {
|
|
243
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let stack_pointer = 128;
|
|
248
|
+
|
|
249
|
+
function addBorrowedObject(obj) {
|
|
250
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
251
|
+
heap[--stack_pointer] = obj;
|
|
252
|
+
return stack_pointer;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function init() {
|
|
256
|
+
wasm.init();
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function __wbg_adapter_50(arg0, arg1) {
|
|
260
|
+
const ret = wasm.__wbindgen_export_5(arg0, arg1);
|
|
261
|
+
return takeObject(ret);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function __wbg_adapter_53(arg0, arg1, arg2) {
|
|
265
|
+
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function __wbg_adapter_251(arg0, arg1, arg2, arg3) {
|
|
269
|
+
wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
273
|
+
? { register: () => {}, unregister: () => {} }
|
|
274
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
|
|
275
|
+
/**
|
|
276
|
+
* An instance of a [`Client`] is a connection to a single
|
|
277
|
+
* `perspective_server::Server`, whether locally in-memory or remote over some
|
|
278
|
+
* transport like a WebSocket.
|
|
279
|
+
*
|
|
280
|
+
* The browser and node.js libraries both support the `websocket(url)`
|
|
281
|
+
* constructor, which connects to a remote `perspective_server::Server`
|
|
282
|
+
* instance over a WebSocket transport.
|
|
283
|
+
*
|
|
284
|
+
* In the browser, the `worker()` constructor creates a new Web Worker
|
|
285
|
+
* `perspective_server::Server` and returns a [`Client`] connected to it.
|
|
286
|
+
*
|
|
287
|
+
* In node.js, a pre-instantied [`Client`] connected synhronously to a global
|
|
288
|
+
* singleton `perspective_server::Server` is the default module export.
|
|
289
|
+
*
|
|
290
|
+
* # JavaScript Examples
|
|
291
|
+
*
|
|
292
|
+
* Create a Web Worker `perspective_server::Server` in the browser and return a
|
|
293
|
+
* [`Client`] instance connected for it:
|
|
294
|
+
*
|
|
295
|
+
* ```javascript
|
|
296
|
+
* import perspective from "@perspective-dev/client";
|
|
297
|
+
* const client = await perspective.worker();
|
|
298
|
+
* ```
|
|
299
|
+
*
|
|
300
|
+
* Create a WebSocket connection to a remote `perspective_server::Server`:
|
|
301
|
+
*
|
|
302
|
+
* ```javascript
|
|
303
|
+
* import perspective from "@perspective-dev/client";
|
|
304
|
+
* const client = await perspective.websocket("ws://locahost:8080/ws");
|
|
305
|
+
* ```
|
|
306
|
+
*
|
|
307
|
+
* Access the synchronous client in node.js:
|
|
308
|
+
*
|
|
309
|
+
* ```javascript
|
|
310
|
+
* import { default as client } from "@perspective-dev/client";
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
export class Client {
|
|
314
|
+
|
|
315
|
+
static __wrap(ptr) {
|
|
316
|
+
ptr = ptr >>> 0;
|
|
317
|
+
const obj = Object.create(Client.prototype);
|
|
318
|
+
obj.__wbg_ptr = ptr;
|
|
319
|
+
ClientFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
320
|
+
return obj;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
__destroy_into_raw() {
|
|
324
|
+
const ptr = this.__wbg_ptr;
|
|
325
|
+
this.__wbg_ptr = 0;
|
|
326
|
+
ClientFinalization.unregister(this);
|
|
327
|
+
return ptr;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
free() {
|
|
331
|
+
const ptr = this.__destroy_into_raw();
|
|
332
|
+
wasm.__wbg_client_free(ptr, 0);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* @returns {string}
|
|
336
|
+
*/
|
|
337
|
+
__getClassname() {
|
|
338
|
+
let deferred1_0;
|
|
339
|
+
let deferred1_1;
|
|
340
|
+
try {
|
|
341
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
342
|
+
wasm.client___getClassname(retptr, this.__wbg_ptr);
|
|
343
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
344
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
345
|
+
deferred1_0 = r0;
|
|
346
|
+
deferred1_1 = r1;
|
|
347
|
+
return getStringFromWasm0(r0, r1);
|
|
348
|
+
} finally {
|
|
349
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
350
|
+
wasm.__wbindgen_export_3(deferred1_0, deferred1_1, 1);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* @param {Function} send_request
|
|
355
|
+
* @param {Function | null} [close]
|
|
356
|
+
*/
|
|
357
|
+
constructor(send_request, close) {
|
|
358
|
+
try {
|
|
359
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
360
|
+
wasm.client_new(retptr, addHeapObject(send_request), isLikeNone(close) ? 0 : addHeapObject(close));
|
|
361
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
362
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
363
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
364
|
+
if (r2) {
|
|
365
|
+
throw takeObject(r1);
|
|
366
|
+
}
|
|
367
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
368
|
+
ClientFinalization.register(this, this.__wbg_ptr, this);
|
|
369
|
+
return this;
|
|
370
|
+
} finally {
|
|
371
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* @param {Function} on_response
|
|
376
|
+
* @returns {ProxySession}
|
|
377
|
+
*/
|
|
378
|
+
new_proxy_session(on_response) {
|
|
379
|
+
try {
|
|
380
|
+
const ret = wasm.client_new_proxy_session(this.__wbg_ptr, addBorrowedObject(on_response));
|
|
381
|
+
return ProxySession.__wrap(ret);
|
|
382
|
+
} finally {
|
|
383
|
+
heap[stack_pointer++] = undefined;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @param {any} value
|
|
388
|
+
* @returns {Promise<void>}
|
|
389
|
+
*/
|
|
390
|
+
handle_response(value) {
|
|
391
|
+
const ret = wasm.client_handle_response(this.__wbg_ptr, addHeapObject(value));
|
|
392
|
+
return takeObject(ret);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* @param {string} error
|
|
396
|
+
* @param {Function | null} [reconnect]
|
|
397
|
+
* @returns {Promise<void>}
|
|
398
|
+
*/
|
|
399
|
+
handle_error(error, reconnect) {
|
|
400
|
+
const ptr0 = passStringToWasm0(error, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
401
|
+
const len0 = WASM_VECTOR_LEN;
|
|
402
|
+
const ret = wasm.client_handle_error(this.__wbg_ptr, ptr0, len0, isLikeNone(reconnect) ? 0 : addHeapObject(reconnect));
|
|
403
|
+
return takeObject(ret);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* @param {Function} callback
|
|
407
|
+
* @returns {Promise<number>}
|
|
408
|
+
*/
|
|
409
|
+
on_error(callback) {
|
|
410
|
+
const ret = wasm.client_on_error(this.__wbg_ptr, addHeapObject(callback));
|
|
411
|
+
return takeObject(ret);
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Creates a new [`Table`] from either a _schema_ or _data_.
|
|
415
|
+
*
|
|
416
|
+
* The [`Client::table`] factory function can be initialized with either a
|
|
417
|
+
* _schema_ (see [`Table::schema`]), or data in one of these formats:
|
|
418
|
+
*
|
|
419
|
+
* - Apache Arrow
|
|
420
|
+
* - CSV
|
|
421
|
+
* - JSON row-oriented
|
|
422
|
+
* - JSON column-oriented
|
|
423
|
+
* - NDJSON
|
|
424
|
+
*
|
|
425
|
+
* When instantiated with _data_, the schema is inferred from this data.
|
|
426
|
+
* While this is convenient, inferrence is sometimes imperfect e.g.
|
|
427
|
+
* when the input is empty, null or ambiguous. For these cases,
|
|
428
|
+
* [`Client::table`] can first be instantiated with a explicit schema.
|
|
429
|
+
*
|
|
430
|
+
* When instantiated with a _schema_, the resulting [`Table`] is empty but
|
|
431
|
+
* with known column names and column types. When subsqeuently
|
|
432
|
+
* populated with [`Table::update`], these columns will be _coerced_ to
|
|
433
|
+
* the schema's type. This behavior can be useful when
|
|
434
|
+
* [`Client::table`]'s column type inferences doesn't work.
|
|
435
|
+
*
|
|
436
|
+
* The resulting [`Table`] is _virtual_, and invoking its methods
|
|
437
|
+
* dispatches events to the `perspective_server::Server` this
|
|
438
|
+
* [`Client`] connects to, where the data is stored and all calculation
|
|
439
|
+
* occurs.
|
|
440
|
+
*
|
|
441
|
+
* # Arguments
|
|
442
|
+
*
|
|
443
|
+
* - `arg` - Either _schema_ or initialization _data_.
|
|
444
|
+
* - `options` - Optional configuration which provides one of:
|
|
445
|
+
* - `limit` - The max number of rows the resulting [`Table`] can
|
|
446
|
+
* store.
|
|
447
|
+
* - `index` - The column name to use as an _index_ column. If this
|
|
448
|
+
* `Table` is being instantiated by _data_, this column name must be
|
|
449
|
+
* present in the data.
|
|
450
|
+
* - `name` - The name of the table. This will be generated if it is
|
|
451
|
+
* not provided.
|
|
452
|
+
* - `format` - The explicit format of the input data, can be one of
|
|
453
|
+
* `"json"`, `"columns"`, `"csv"` or `"arrow"`. This overrides
|
|
454
|
+
* language-specific type dispatch behavior, which allows stringified
|
|
455
|
+
* and byte array alternative inputs.
|
|
456
|
+
*
|
|
457
|
+
* # JavaScript Examples
|
|
458
|
+
*
|
|
459
|
+
* Load a CSV from a `string`:
|
|
460
|
+
*
|
|
461
|
+
* ```javascript
|
|
462
|
+
* const table = await client.table("x,y\n1,2\n3,4");
|
|
463
|
+
* ```
|
|
464
|
+
*
|
|
465
|
+
* Load an Arrow from an `ArrayBuffer`:
|
|
466
|
+
*
|
|
467
|
+
* ```javascript
|
|
468
|
+
* import * as fs from "node:fs/promises";
|
|
469
|
+
* const table2 = await client.table(await fs.readFile("superstore.arrow"));
|
|
470
|
+
* ```
|
|
471
|
+
*
|
|
472
|
+
* Load a CSV from a `UInt8Array` (the default for this type is Arrow)
|
|
473
|
+
* using a format override:
|
|
474
|
+
*
|
|
475
|
+
* ```javascript
|
|
476
|
+
* const enc = new TextEncoder();
|
|
477
|
+
* const table = await client.table(enc.encode("x,y\n1,2\n3,4"), {
|
|
478
|
+
* format: "csv",
|
|
479
|
+
* });
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* Create a table with an `index`:
|
|
483
|
+
*
|
|
484
|
+
* ```javascript
|
|
485
|
+
* const table = await client.table(data, { index: "Row ID" });
|
|
486
|
+
* ```
|
|
487
|
+
* @param {string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[]} value
|
|
488
|
+
* @param {TableInitOptions | null} [options]
|
|
489
|
+
* @returns {Promise<Table>}
|
|
490
|
+
*/
|
|
491
|
+
table(value, options) {
|
|
492
|
+
const ret = wasm.client_table(this.__wbg_ptr, addHeapObject(value), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
493
|
+
return takeObject(ret);
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Terminates this [`Client`], cleaning up any [`crate::View`] handles the
|
|
497
|
+
* [`Client`] has open as well as its callbacks.
|
|
498
|
+
* @returns {any}
|
|
499
|
+
*/
|
|
500
|
+
terminate() {
|
|
501
|
+
try {
|
|
502
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
503
|
+
wasm.client_terminate(retptr, this.__wbg_ptr);
|
|
504
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
505
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
506
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
507
|
+
if (r2) {
|
|
508
|
+
throw takeObject(r1);
|
|
509
|
+
}
|
|
510
|
+
return takeObject(r0);
|
|
511
|
+
} finally {
|
|
512
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Opens a [`Table`] that is hosted on the `perspective_server::Server`
|
|
517
|
+
* that is connected to this [`Client`].
|
|
518
|
+
*
|
|
519
|
+
* The `name` property of [`TableInitOptions`] is used to identify each
|
|
520
|
+
* [`Table`]. [`Table`] `name`s can be looked up for each [`Client`]
|
|
521
|
+
* via [`Client::get_hosted_table_names`].
|
|
522
|
+
*
|
|
523
|
+
* # JavaScript Examples
|
|
524
|
+
*
|
|
525
|
+
* Get a virtual [`Table`] named "table_one" from this [`Client`]
|
|
526
|
+
*
|
|
527
|
+
* ```javascript
|
|
528
|
+
* const tables = await client.open_table("table_one");
|
|
529
|
+
* ```
|
|
530
|
+
* @param {string} entity_id
|
|
531
|
+
* @returns {Promise<Table>}
|
|
532
|
+
*/
|
|
533
|
+
open_table(entity_id) {
|
|
534
|
+
const ptr0 = passStringToWasm0(entity_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
535
|
+
const len0 = WASM_VECTOR_LEN;
|
|
536
|
+
const ret = wasm.client_open_table(this.__wbg_ptr, ptr0, len0);
|
|
537
|
+
return takeObject(ret);
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Retrieves the names of all tables that this client has access to.
|
|
541
|
+
*
|
|
542
|
+
* `name` is a string identifier unique to the [`Table`] (per [`Client`]),
|
|
543
|
+
* which can be used in conjunction with [`Client::open_table`] to get
|
|
544
|
+
* a [`Table`] instance without the use of [`Client::table`]
|
|
545
|
+
* constructor directly (e.g., one created by another [`Client`]).
|
|
546
|
+
*
|
|
547
|
+
* # JavaScript Examples
|
|
548
|
+
*
|
|
549
|
+
* ```javascript
|
|
550
|
+
* const tables = await client.get_hosted_table_names();
|
|
551
|
+
* ```
|
|
552
|
+
* @returns {Promise<any>}
|
|
553
|
+
*/
|
|
554
|
+
get_hosted_table_names() {
|
|
555
|
+
const ret = wasm.client_get_hosted_table_names(this.__wbg_ptr);
|
|
556
|
+
return takeObject(ret);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Register a callback which is invoked whenever [`Client::table`] (on this
|
|
560
|
+
* [`Client`]) or [`Table::delete`] (on a [`Table`] belinging to this
|
|
561
|
+
* [`Client`]) are called.
|
|
562
|
+
* @param {Function} on_update_js
|
|
563
|
+
* @returns {Promise<number>}
|
|
564
|
+
*/
|
|
565
|
+
on_hosted_tables_update(on_update_js) {
|
|
566
|
+
const ret = wasm.client_on_hosted_tables_update(this.__wbg_ptr, addHeapObject(on_update_js));
|
|
567
|
+
return takeObject(ret);
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Remove a callback previously registered via
|
|
571
|
+
* `Client::on_hosted_tables_update`.
|
|
572
|
+
* @param {number} update_id
|
|
573
|
+
* @returns {Promise<void>}
|
|
574
|
+
*/
|
|
575
|
+
remove_hosted_tables_update(update_id) {
|
|
576
|
+
const ret = wasm.client_remove_hosted_tables_update(this.__wbg_ptr, update_id);
|
|
577
|
+
return takeObject(ret);
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Provides the [`SystemInfo`] struct, implementation-specific metadata
|
|
581
|
+
* about the [`perspective_server::Server`] runtime such as Memory and
|
|
582
|
+
* CPU usage.
|
|
583
|
+
*
|
|
584
|
+
* For WebAssembly servers, this method includes the WebAssembly heap size.
|
|
585
|
+
*
|
|
586
|
+
* # JavaScript Examples
|
|
587
|
+
*
|
|
588
|
+
* ```javascript
|
|
589
|
+
* const info = await client.system_info();
|
|
590
|
+
* ```
|
|
591
|
+
* @returns {Promise<SystemInfo>}
|
|
592
|
+
*/
|
|
593
|
+
system_info() {
|
|
594
|
+
const ret = wasm.client_system_info(this.__wbg_ptr);
|
|
595
|
+
return takeObject(ret);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const ProxySessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
600
|
+
? { register: () => {}, unregister: () => {} }
|
|
601
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_proxysession_free(ptr >>> 0, 1));
|
|
602
|
+
|
|
603
|
+
export class ProxySession {
|
|
604
|
+
|
|
605
|
+
static __wrap(ptr) {
|
|
606
|
+
ptr = ptr >>> 0;
|
|
607
|
+
const obj = Object.create(ProxySession.prototype);
|
|
608
|
+
obj.__wbg_ptr = ptr;
|
|
609
|
+
ProxySessionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
610
|
+
return obj;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
__destroy_into_raw() {
|
|
614
|
+
const ptr = this.__wbg_ptr;
|
|
615
|
+
this.__wbg_ptr = 0;
|
|
616
|
+
ProxySessionFinalization.unregister(this);
|
|
617
|
+
return ptr;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
free() {
|
|
621
|
+
const ptr = this.__destroy_into_raw();
|
|
622
|
+
wasm.__wbg_proxysession_free(ptr, 0);
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* @param {Client} client
|
|
626
|
+
* @param {Function} on_response
|
|
627
|
+
*/
|
|
628
|
+
constructor(client, on_response) {
|
|
629
|
+
try {
|
|
630
|
+
_assertClass(client, Client);
|
|
631
|
+
const ret = wasm.client_new_proxy_session(client.__wbg_ptr, addBorrowedObject(on_response));
|
|
632
|
+
this.__wbg_ptr = ret >>> 0;
|
|
633
|
+
ProxySessionFinalization.register(this, this.__wbg_ptr, this);
|
|
634
|
+
return this;
|
|
635
|
+
} finally {
|
|
636
|
+
heap[stack_pointer++] = undefined;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* @param {any} value
|
|
641
|
+
* @returns {Promise<void>}
|
|
642
|
+
*/
|
|
643
|
+
handle_request(value) {
|
|
644
|
+
const ret = wasm.proxysession_handle_request(this.__wbg_ptr, addHeapObject(value));
|
|
645
|
+
return takeObject(ret);
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* @returns {Promise<void>}
|
|
649
|
+
*/
|
|
650
|
+
close() {
|
|
651
|
+
const ptr = this.__destroy_into_raw();
|
|
652
|
+
const ret = wasm.proxysession_close(ptr);
|
|
653
|
+
return takeObject(ret);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
const TableFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
658
|
+
? { register: () => {}, unregister: () => {} }
|
|
659
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_table_free(ptr >>> 0, 1));
|
|
660
|
+
|
|
661
|
+
export class Table {
|
|
662
|
+
|
|
663
|
+
static __wrap(ptr) {
|
|
664
|
+
ptr = ptr >>> 0;
|
|
665
|
+
const obj = Object.create(Table.prototype);
|
|
666
|
+
obj.__wbg_ptr = ptr;
|
|
667
|
+
TableFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
668
|
+
return obj;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
__destroy_into_raw() {
|
|
672
|
+
const ptr = this.__wbg_ptr;
|
|
673
|
+
this.__wbg_ptr = 0;
|
|
674
|
+
TableFinalization.unregister(this);
|
|
675
|
+
return ptr;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
free() {
|
|
679
|
+
const ptr = this.__destroy_into_raw();
|
|
680
|
+
wasm.__wbg_table_free(ptr, 0);
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* @returns {string}
|
|
684
|
+
*/
|
|
685
|
+
__getClassname() {
|
|
686
|
+
let deferred1_0;
|
|
687
|
+
let deferred1_1;
|
|
688
|
+
try {
|
|
689
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
690
|
+
wasm.table___getClassname(retptr, this.__wbg_ptr);
|
|
691
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
692
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
693
|
+
deferred1_0 = r0;
|
|
694
|
+
deferred1_1 = r1;
|
|
695
|
+
return getStringFromWasm0(r0, r1);
|
|
696
|
+
} finally {
|
|
697
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
698
|
+
wasm.__wbindgen_export_3(deferred1_0, deferred1_1, 1);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Returns the name of the index column for the table.
|
|
703
|
+
*
|
|
704
|
+
* # JavaScript Examples
|
|
705
|
+
*
|
|
706
|
+
* ```javascript
|
|
707
|
+
* const table = await client.table("x,y\n1,2\n3,4", { index: "x" });
|
|
708
|
+
* const index = table.get_index(); // "x"
|
|
709
|
+
* ```
|
|
710
|
+
* @returns {Promise<string | undefined>}
|
|
711
|
+
*/
|
|
712
|
+
get_index() {
|
|
713
|
+
const ret = wasm.table_get_index(this.__wbg_ptr);
|
|
714
|
+
return takeObject(ret);
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Get a copy of the [`Client`] this [`Table`] came from.
|
|
718
|
+
* @returns {Promise<Client>}
|
|
719
|
+
*/
|
|
720
|
+
get_client() {
|
|
721
|
+
const ret = wasm.table_get_client(this.__wbg_ptr);
|
|
722
|
+
return takeObject(ret);
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Returns the user-specified name for this table, or the auto-generated
|
|
726
|
+
* name if a name was not specified when the table was created.
|
|
727
|
+
* @returns {Promise<string>}
|
|
728
|
+
*/
|
|
729
|
+
get_name() {
|
|
730
|
+
const ret = wasm.table_get_name(this.__wbg_ptr);
|
|
731
|
+
return takeObject(ret);
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Returns the user-specified row limit for this table.
|
|
735
|
+
* @returns {Promise<number | undefined>}
|
|
736
|
+
*/
|
|
737
|
+
get_limit() {
|
|
738
|
+
const ret = wasm.table_get_limit(this.__wbg_ptr);
|
|
739
|
+
return takeObject(ret);
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Removes all the rows in the [`Table`], but preserves everything else
|
|
743
|
+
* including the schema, index, and any callbacks or registered
|
|
744
|
+
* [`View`] instances.
|
|
745
|
+
*
|
|
746
|
+
* Calling [`Table::clear`], like [`Table::update`] and [`Table::remove`],
|
|
747
|
+
* will trigger an update event to any registered listeners via
|
|
748
|
+
* [`View::on_update`].
|
|
749
|
+
* @returns {Promise<void>}
|
|
750
|
+
*/
|
|
751
|
+
clear() {
|
|
752
|
+
const ret = wasm.table_clear(this.__wbg_ptr);
|
|
753
|
+
return takeObject(ret);
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Delete this [`Table`] and cleans up associated resources.
|
|
757
|
+
*
|
|
758
|
+
* [`Table`]s do not stop consuming resources or processing updates when
|
|
759
|
+
* they are garbage collected in their host language - you must call
|
|
760
|
+
* this method to reclaim these.
|
|
761
|
+
*
|
|
762
|
+
* # Arguments
|
|
763
|
+
*
|
|
764
|
+
* - `options` An options dictionary.
|
|
765
|
+
* - `lazy` Whether to delete this [`Table`] _lazily_. When false (the
|
|
766
|
+
* default), the delete will occur immediately, assuming it has no
|
|
767
|
+
* [`View`] instances registered to it (which must be deleted first,
|
|
768
|
+
* otherwise this method will throw an error). When true, the
|
|
769
|
+
* [`Table`] will only be marked for deltion once its [`View`]
|
|
770
|
+
* dependency count reaches 0.
|
|
771
|
+
*
|
|
772
|
+
* # JavaScript Examples
|
|
773
|
+
*
|
|
774
|
+
* ```javascript
|
|
775
|
+
* const table = await client.table("x,y\n1,2\n3,4");
|
|
776
|
+
*
|
|
777
|
+
* // ...
|
|
778
|
+
*
|
|
779
|
+
* await table.delete({ lazy: true });
|
|
780
|
+
* ```
|
|
781
|
+
* @param {DeleteOptions | null} [options]
|
|
782
|
+
* @returns {Promise<void>}
|
|
783
|
+
*/
|
|
784
|
+
delete(options) {
|
|
785
|
+
const ptr = this.__destroy_into_raw();
|
|
786
|
+
const ret = wasm.table_delete(ptr, isLikeNone(options) ? 0 : addHeapObject(options));
|
|
787
|
+
return takeObject(ret);
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Returns the number of rows in a [`Table`].
|
|
791
|
+
* @returns {Promise<number>}
|
|
792
|
+
*/
|
|
793
|
+
size() {
|
|
794
|
+
const ret = wasm.table_size(this.__wbg_ptr);
|
|
795
|
+
return takeObject(ret);
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Returns a table's [`Schema`], a mapping of column names to column types.
|
|
799
|
+
*
|
|
800
|
+
* The mapping of a [`Table`]'s column names to data types is referred to
|
|
801
|
+
* as a [`Schema`]. Each column has a unique name and a data type, one
|
|
802
|
+
* of:
|
|
803
|
+
*
|
|
804
|
+
* - `"boolean"` - A boolean type
|
|
805
|
+
* - `"date"` - A timesonze-agnostic date type (month/day/year)
|
|
806
|
+
* - `"datetime"` - A millisecond-precision datetime type in the UTC
|
|
807
|
+
* timezone
|
|
808
|
+
* - `"float"` - A 64 bit float
|
|
809
|
+
* - `"integer"` - A signed 32 bit integer (the integer type supported by
|
|
810
|
+
* JavaScript)
|
|
811
|
+
* - `"string"` - A [`String`] data type (encoded internally as a
|
|
812
|
+
* _dictionary_)
|
|
813
|
+
*
|
|
814
|
+
* Note that all [`Table`] columns are _nullable_, regardless of the data
|
|
815
|
+
* type.
|
|
816
|
+
* @returns {Promise<any>}
|
|
817
|
+
*/
|
|
818
|
+
schema() {
|
|
819
|
+
const ret = wasm.table_schema(this.__wbg_ptr);
|
|
820
|
+
return takeObject(ret);
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Returns the column names of this [`Table`] in "natural" order (the
|
|
824
|
+
* ordering implied by the input format).
|
|
825
|
+
*
|
|
826
|
+
* # JavaScript Examples
|
|
827
|
+
*
|
|
828
|
+
* ```javascript
|
|
829
|
+
* const columns = await table.columns();
|
|
830
|
+
* ```
|
|
831
|
+
* @returns {Promise<any>}
|
|
832
|
+
*/
|
|
833
|
+
columns() {
|
|
834
|
+
const ret = wasm.table_columns(this.__wbg_ptr);
|
|
835
|
+
return takeObject(ret);
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Create a unique channel ID on this [`Table`], which allows
|
|
839
|
+
* `View::on_update` callback calls to be associated with the
|
|
840
|
+
* `Table::update` which caused them.
|
|
841
|
+
* @returns {Promise<number>}
|
|
842
|
+
*/
|
|
843
|
+
make_port() {
|
|
844
|
+
const ret = wasm.table_make_port(this.__wbg_ptr);
|
|
845
|
+
return takeObject(ret);
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Register a callback which is called exactly once, when this [`Table`] is
|
|
849
|
+
* deleted with the [`Table::delete`] method.
|
|
850
|
+
*
|
|
851
|
+
* [`Table::on_delete`] resolves when the subscription message is sent, not
|
|
852
|
+
* when the _delete_ event occurs.
|
|
853
|
+
* @param {Function} on_delete
|
|
854
|
+
* @returns {Promise<any>}
|
|
855
|
+
*/
|
|
856
|
+
on_delete(on_delete) {
|
|
857
|
+
const ret = wasm.table_on_delete(this.__wbg_ptr, addHeapObject(on_delete));
|
|
858
|
+
return takeObject(ret);
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Removes a listener with a given ID, as returned by a previous call to
|
|
862
|
+
* [`Table::on_delete`].
|
|
863
|
+
* @param {number} callback_id
|
|
864
|
+
* @returns {Promise<any>}
|
|
865
|
+
*/
|
|
866
|
+
remove_delete(callback_id) {
|
|
867
|
+
const ret = wasm.table_remove_delete(this.__wbg_ptr, callback_id);
|
|
868
|
+
return takeObject(ret);
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Removes rows from this [`Table`] with the `index` column values
|
|
872
|
+
* supplied.
|
|
873
|
+
*
|
|
874
|
+
* # Arguments
|
|
875
|
+
*
|
|
876
|
+
* - `indices` - A list of `index` column values for rows that should be
|
|
877
|
+
* removed.
|
|
878
|
+
*
|
|
879
|
+
* # JavaScript Examples
|
|
880
|
+
*
|
|
881
|
+
* ```javascript
|
|
882
|
+
* await table.remove([1, 2, 3]);
|
|
883
|
+
* ```
|
|
884
|
+
* @param {any} value
|
|
885
|
+
* @param {UpdateOptions | null} [options]
|
|
886
|
+
* @returns {Promise<void>}
|
|
887
|
+
*/
|
|
888
|
+
remove(value, options) {
|
|
889
|
+
const ret = wasm.table_remove(this.__wbg_ptr, addHeapObject(value), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
890
|
+
return takeObject(ret);
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Replace all rows in this [`Table`] with the input data, coerced to this
|
|
894
|
+
* [`Table`]'s existing [`perspective_client::Schema`], notifying any
|
|
895
|
+
* derived [`View`] and [`View::on_update`] callbacks.
|
|
896
|
+
*
|
|
897
|
+
* Calling [`Table::replace`] is an easy way to replace _all_ the data in a
|
|
898
|
+
* [`Table`] without losing any derived [`View`] instances or
|
|
899
|
+
* [`View::on_update`] callbacks. [`Table::replace`] does _not_ infer
|
|
900
|
+
* data types like [`Client::table`] does, rather it _coerces_ input
|
|
901
|
+
* data to the `Schema` like [`Table::update`]. If you need a [`Table`]
|
|
902
|
+
* with a different `Schema`, you must create a new one.
|
|
903
|
+
*
|
|
904
|
+
* # JavaScript Examples
|
|
905
|
+
*
|
|
906
|
+
* ```javascript
|
|
907
|
+
* await table.replace("x,y\n1,2");
|
|
908
|
+
* ```
|
|
909
|
+
* @param {any} input
|
|
910
|
+
* @param {UpdateOptions | null} [options]
|
|
911
|
+
* @returns {Promise<void>}
|
|
912
|
+
*/
|
|
913
|
+
replace(input, options) {
|
|
914
|
+
const ret = wasm.table_replace(this.__wbg_ptr, addHeapObject(input), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
915
|
+
return takeObject(ret);
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Updates the rows of this table and any derived [`View`] instances.
|
|
919
|
+
*
|
|
920
|
+
* Calling [`Table::update`] will trigger the [`View::on_update`] callbacks
|
|
921
|
+
* register to derived [`View`], and the call itself will not resolve until
|
|
922
|
+
* _all_ derived [`View`]'s are notified.
|
|
923
|
+
*
|
|
924
|
+
* When updating a [`Table`] with an `index`, [`Table::update`] supports
|
|
925
|
+
* partial updates, by omitting columns from the update data.
|
|
926
|
+
*
|
|
927
|
+
* # Arguments
|
|
928
|
+
*
|
|
929
|
+
* - `input` - The input data for this [`Table`]. The schema of a [`Table`]
|
|
930
|
+
* is immutable after creation, so this method cannot be called with a
|
|
931
|
+
* schema.
|
|
932
|
+
* - `options` - Options for this update step - see [`UpdateOptions`].
|
|
933
|
+
*
|
|
934
|
+
* # JavaScript Examples
|
|
935
|
+
*
|
|
936
|
+
* ```javascript
|
|
937
|
+
* await table.update("x,y\n1,2");
|
|
938
|
+
* ```
|
|
939
|
+
* @param {string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[]} input
|
|
940
|
+
* @param {UpdateOptions | null} [options]
|
|
941
|
+
* @returns {Promise<any>}
|
|
942
|
+
*/
|
|
943
|
+
update(input, options) {
|
|
944
|
+
const ret = wasm.table_update(this.__wbg_ptr, addHeapObject(input), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
945
|
+
return takeObject(ret);
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Create a new [`View`] from this table with a specified
|
|
949
|
+
* [`ViewConfigUpdate`].
|
|
950
|
+
*
|
|
951
|
+
* See [`View`] struct.
|
|
952
|
+
*
|
|
953
|
+
* # JavaScript Examples
|
|
954
|
+
*
|
|
955
|
+
* ```javascript
|
|
956
|
+
* const view = await table.view({
|
|
957
|
+
* columns: ["Sales"],
|
|
958
|
+
* aggregates: { Sales: "sum" },
|
|
959
|
+
* group_by: ["Region", "Country"],
|
|
960
|
+
* filter: [["Category", "in", ["Furniture", "Technology"]]],
|
|
961
|
+
* });
|
|
962
|
+
* ```
|
|
963
|
+
* @param {ViewConfigUpdate | null} [config]
|
|
964
|
+
* @returns {Promise<View>}
|
|
965
|
+
*/
|
|
966
|
+
view(config) {
|
|
967
|
+
const ret = wasm.table_view(this.__wbg_ptr, isLikeNone(config) ? 0 : addHeapObject(config));
|
|
968
|
+
return takeObject(ret);
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Validates the given expressions.
|
|
972
|
+
* @param {any} exprs
|
|
973
|
+
* @returns {Promise<any>}
|
|
974
|
+
*/
|
|
975
|
+
validate_expressions(exprs) {
|
|
976
|
+
const ret = wasm.table_validate_expressions(this.__wbg_ptr, addHeapObject(exprs));
|
|
977
|
+
return takeObject(ret);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const ViewFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
982
|
+
? { register: () => {}, unregister: () => {} }
|
|
983
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_view_free(ptr >>> 0, 1));
|
|
984
|
+
/**
|
|
985
|
+
* The [`View`] struct is Perspective's query and serialization interface. It
|
|
986
|
+
* represents a query on the `Table`'s dataset and is always created from an
|
|
987
|
+
* existing `Table` instance via the [`Table::view`] method.
|
|
988
|
+
*
|
|
989
|
+
* [`View`]s are immutable with respect to the arguments provided to the
|
|
990
|
+
* [`Table::view`] method; to change these parameters, you must create a new
|
|
991
|
+
* [`View`] on the same [`Table`]. However, each [`View`] is _live_ with
|
|
992
|
+
* respect to the [`Table`]'s data, and will (within a conflation window)
|
|
993
|
+
* update with the latest state as its parent [`Table`] updates, including
|
|
994
|
+
* incrementally recalculating all aggregates, pivots, filters, etc. [`View`]
|
|
995
|
+
* query parameters are composable, in that each parameter works independently
|
|
996
|
+
* _and_ in conjunction with each other, and there is no limit to the number of
|
|
997
|
+
* pivots, filters, etc. which can be applied.
|
|
998
|
+
*/
|
|
999
|
+
export class View {
|
|
1000
|
+
|
|
1001
|
+
static __wrap(ptr) {
|
|
1002
|
+
ptr = ptr >>> 0;
|
|
1003
|
+
const obj = Object.create(View.prototype);
|
|
1004
|
+
obj.__wbg_ptr = ptr;
|
|
1005
|
+
ViewFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1006
|
+
return obj;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
static __unwrap(jsValue) {
|
|
1010
|
+
if (!(jsValue instanceof View)) {
|
|
1011
|
+
return 0;
|
|
1012
|
+
}
|
|
1013
|
+
return jsValue.__destroy_into_raw();
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
__destroy_into_raw() {
|
|
1017
|
+
const ptr = this.__wbg_ptr;
|
|
1018
|
+
this.__wbg_ptr = 0;
|
|
1019
|
+
ViewFinalization.unregister(this);
|
|
1020
|
+
return ptr;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
free() {
|
|
1024
|
+
const ptr = this.__destroy_into_raw();
|
|
1025
|
+
wasm.__wbg_view_free(ptr, 0);
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* @returns {View}
|
|
1029
|
+
*/
|
|
1030
|
+
__get_model() {
|
|
1031
|
+
const ret = wasm.view___get_model(this.__wbg_ptr);
|
|
1032
|
+
return View.__wrap(ret);
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Returns an array of strings containing the column paths of the [`View`]
|
|
1036
|
+
* without any of the source columns.
|
|
1037
|
+
*
|
|
1038
|
+
* A column path shows the columns that a given cell belongs to after
|
|
1039
|
+
* pivots are applied.
|
|
1040
|
+
* @param {ColumnWindow | null} [window]
|
|
1041
|
+
* @returns {Promise<any>}
|
|
1042
|
+
*/
|
|
1043
|
+
column_paths(window) {
|
|
1044
|
+
const ret = wasm.view_column_paths(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
|
|
1045
|
+
return takeObject(ret);
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Delete this [`View`] and clean up all resources associated with it.
|
|
1049
|
+
* [`View`] objects do not stop consuming resources or processing
|
|
1050
|
+
* updates when they are garbage collected - you must call this method
|
|
1051
|
+
* to reclaim these.
|
|
1052
|
+
* @returns {Promise<void>}
|
|
1053
|
+
*/
|
|
1054
|
+
delete() {
|
|
1055
|
+
const ptr = this.__destroy_into_raw();
|
|
1056
|
+
const ret = wasm.view_delete(ptr);
|
|
1057
|
+
return takeObject(ret);
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Returns this [`View`]'s _dimensions_, row and column count, as well as
|
|
1061
|
+
* those of the [`crate::Table`] from which it was derived.
|
|
1062
|
+
*
|
|
1063
|
+
* - `num_table_rows` - The number of rows in the underlying
|
|
1064
|
+
* [`crate::Table`].
|
|
1065
|
+
* - `num_table_columns` - The number of columns in the underlying
|
|
1066
|
+
* [`crate::Table`] (including the `index` column if this
|
|
1067
|
+
* [`crate::Table`] was constructed with one).
|
|
1068
|
+
* - `num_view_rows` - The number of rows in this [`View`]. If this
|
|
1069
|
+
* [`View`] has a `group_by` clause, `num_view_rows` will also include
|
|
1070
|
+
* aggregated rows.
|
|
1071
|
+
* - `num_view_columns` - The number of columns in this [`View`]. If this
|
|
1072
|
+
* [`View`] has a `split_by` clause, `num_view_columns` will include all
|
|
1073
|
+
* _column paths_, e.g. the number of `columns` clause times the number
|
|
1074
|
+
* of `split_by` groups.
|
|
1075
|
+
* @returns {Promise<any>}
|
|
1076
|
+
*/
|
|
1077
|
+
dimensions() {
|
|
1078
|
+
const ret = wasm.view_dimensions(this.__wbg_ptr);
|
|
1079
|
+
return takeObject(ret);
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* The expression schema of this [`View`], which contains only the
|
|
1083
|
+
* expressions created on this [`View`]. See [`View::schema`] for
|
|
1084
|
+
* details.
|
|
1085
|
+
* @returns {Promise<any>}
|
|
1086
|
+
*/
|
|
1087
|
+
expression_schema() {
|
|
1088
|
+
const ret = wasm.view_expression_schema(this.__wbg_ptr);
|
|
1089
|
+
return takeObject(ret);
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* A copy of the config object passed to the [`Table::view`] method which
|
|
1093
|
+
* created this [`View`].
|
|
1094
|
+
* @returns {Promise<any>}
|
|
1095
|
+
*/
|
|
1096
|
+
get_config() {
|
|
1097
|
+
const ret = wasm.view_get_config(this.__wbg_ptr);
|
|
1098
|
+
return takeObject(ret);
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Calculates the [min, max] of the leaf nodes of a column `column_name`.
|
|
1102
|
+
*
|
|
1103
|
+
* # Returns
|
|
1104
|
+
*
|
|
1105
|
+
* A tuple of [min, max], whose types are column and aggregate dependent.
|
|
1106
|
+
* @param {string} name
|
|
1107
|
+
* @returns {Promise<Array<any>>}
|
|
1108
|
+
*/
|
|
1109
|
+
get_min_max(name) {
|
|
1110
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1111
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1112
|
+
const ret = wasm.view_get_min_max(this.__wbg_ptr, ptr0, len0);
|
|
1113
|
+
return takeObject(ret);
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* The number of aggregated rows in this [`View`]. This is affected by the
|
|
1117
|
+
* "group_by" configuration parameter supplied to this view's contructor.
|
|
1118
|
+
*
|
|
1119
|
+
* # Returns
|
|
1120
|
+
*
|
|
1121
|
+
* The number of aggregated rows.
|
|
1122
|
+
* @returns {Promise<number>}
|
|
1123
|
+
*/
|
|
1124
|
+
num_rows() {
|
|
1125
|
+
const ret = wasm.view_num_rows(this.__wbg_ptr);
|
|
1126
|
+
return takeObject(ret);
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* The schema of this [`View`].
|
|
1130
|
+
*
|
|
1131
|
+
* The [`View`] schema differs from the `schema` returned by
|
|
1132
|
+
* [`Table::schema`]; it may have different column names due to
|
|
1133
|
+
* `expressions` or `columns` configs, or it maye have _different
|
|
1134
|
+
* column types_ due to the application og `group_by` and `aggregates`
|
|
1135
|
+
* config. You can think of [`Table::schema`] as the _input_ schema and
|
|
1136
|
+
* [`View::schema`] as the _output_ schema of a Perspective pipeline.
|
|
1137
|
+
* @returns {Promise<any>}
|
|
1138
|
+
*/
|
|
1139
|
+
schema() {
|
|
1140
|
+
const ret = wasm.view_schema(this.__wbg_ptr);
|
|
1141
|
+
return takeObject(ret);
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Serializes a [`View`] to the Apache Arrow data format.
|
|
1145
|
+
* @param {ViewWindow | null} [window]
|
|
1146
|
+
* @returns {Promise<ArrayBuffer>}
|
|
1147
|
+
*/
|
|
1148
|
+
to_arrow(window) {
|
|
1149
|
+
const ret = wasm.view_to_arrow(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
|
|
1150
|
+
return takeObject(ret);
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Serializes this [`View`] to a string of JSON data. Useful if you want to
|
|
1154
|
+
* save additional round trip serialize/deserialize cycles.
|
|
1155
|
+
* @param {ViewWindow | null} [window]
|
|
1156
|
+
* @returns {Promise<string>}
|
|
1157
|
+
*/
|
|
1158
|
+
to_columns_string(window) {
|
|
1159
|
+
const ret = wasm.view_to_columns_string(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
|
|
1160
|
+
return takeObject(ret);
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Serializes this [`View`] to JavaScript objects in a column-oriented
|
|
1164
|
+
* format.
|
|
1165
|
+
* @param {ViewWindow | null} [window]
|
|
1166
|
+
* @returns {Promise<object>}
|
|
1167
|
+
*/
|
|
1168
|
+
to_columns(window) {
|
|
1169
|
+
const ret = wasm.view_to_columns(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
|
|
1170
|
+
return takeObject(ret);
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Render this `View` as a JSON string.
|
|
1174
|
+
* @param {ViewWindow | null} [window]
|
|
1175
|
+
* @returns {Promise<string>}
|
|
1176
|
+
*/
|
|
1177
|
+
to_json_string(window) {
|
|
1178
|
+
const ret = wasm.view_to_json_string(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
|
|
1179
|
+
return takeObject(ret);
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Serializes this [`View`] to JavaScript objects in a row-oriented
|
|
1183
|
+
* format.
|
|
1184
|
+
* @param {ViewWindow | null} [window]
|
|
1185
|
+
* @returns {Promise<Array<any>>}
|
|
1186
|
+
*/
|
|
1187
|
+
to_json(window) {
|
|
1188
|
+
const ret = wasm.view_to_json(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
|
|
1189
|
+
return takeObject(ret);
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Renders this [`View`] as an [NDJSON](https://github.com/ndjson/ndjson-spec)
|
|
1193
|
+
* formatted [`String`].
|
|
1194
|
+
* @param {ViewWindow | null} [window]
|
|
1195
|
+
* @returns {Promise<string>}
|
|
1196
|
+
*/
|
|
1197
|
+
to_ndjson(window) {
|
|
1198
|
+
const ret = wasm.view_to_ndjson(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
|
|
1199
|
+
return takeObject(ret);
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Serializes this [`View`] to CSV data in a standard format.
|
|
1203
|
+
* @param {ViewWindow | null} [window]
|
|
1204
|
+
* @returns {Promise<string>}
|
|
1205
|
+
*/
|
|
1206
|
+
to_csv(window) {
|
|
1207
|
+
const ret = wasm.view_to_csv(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
|
|
1208
|
+
return takeObject(ret);
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Register a callback with this [`View`]. Whenever the view's underlying
|
|
1212
|
+
* table emits an update, this callback will be invoked with an object
|
|
1213
|
+
* containing `port_id`, indicating which port the update fired on, and
|
|
1214
|
+
* optionally `delta`, which is the new data that was updated for each
|
|
1215
|
+
* cell or each row.
|
|
1216
|
+
*
|
|
1217
|
+
* # Arguments
|
|
1218
|
+
*
|
|
1219
|
+
* - `on_update` - A callback function invoked on update, which receives an
|
|
1220
|
+
* object with two keys: `port_id`, indicating which port the update was
|
|
1221
|
+
* triggered on, and `delta`, whose value is dependent on the mode
|
|
1222
|
+
* parameter.
|
|
1223
|
+
* - `options` - If this is provided as `OnUpdateOptions { mode:
|
|
1224
|
+
* Some(OnUpdateMode::Row) }`, then `delta` is an Arrow of the updated
|
|
1225
|
+
* rows. Otherwise `delta` will be [`Option::None`].
|
|
1226
|
+
*
|
|
1227
|
+
* # JavaScript Examples
|
|
1228
|
+
*
|
|
1229
|
+
* ```javascript
|
|
1230
|
+
* // Attach an `on_update` callback
|
|
1231
|
+
* view.on_update((updated) => console.log(updated.port_id));
|
|
1232
|
+
* ```
|
|
1233
|
+
*
|
|
1234
|
+
* ```javascript
|
|
1235
|
+
* // `on_update` with row deltas
|
|
1236
|
+
* view.on_update((updated) => console.log(updated.delta), { mode: "row" });
|
|
1237
|
+
* ```
|
|
1238
|
+
* @param {Function} on_update_js
|
|
1239
|
+
* @param {OnUpdateOptions | null} [options]
|
|
1240
|
+
* @returns {Promise<any>}
|
|
1241
|
+
*/
|
|
1242
|
+
on_update(on_update_js, options) {
|
|
1243
|
+
const ret = wasm.view_on_update(this.__wbg_ptr, addHeapObject(on_update_js), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
1244
|
+
return takeObject(ret);
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Unregister a previously registered update callback with this [`View`].
|
|
1248
|
+
*
|
|
1249
|
+
* # Arguments
|
|
1250
|
+
*
|
|
1251
|
+
* - `id` - A callback `id` as returned by a recipricol call to
|
|
1252
|
+
* [`View::on_update`].
|
|
1253
|
+
* @param {number} callback_id
|
|
1254
|
+
* @returns {Promise<void>}
|
|
1255
|
+
*/
|
|
1256
|
+
remove_update(callback_id) {
|
|
1257
|
+
const ret = wasm.view_remove_update(this.__wbg_ptr, callback_id);
|
|
1258
|
+
return takeObject(ret);
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Register a callback with this [`View`]. Whenever the [`View`] is
|
|
1262
|
+
* deleted, this callback will be invoked.
|
|
1263
|
+
* @param {Function} on_delete
|
|
1264
|
+
* @returns {Promise<any>}
|
|
1265
|
+
*/
|
|
1266
|
+
on_delete(on_delete) {
|
|
1267
|
+
const ret = wasm.view_on_delete(this.__wbg_ptr, addHeapObject(on_delete));
|
|
1268
|
+
return takeObject(ret);
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* The number of aggregated columns in this [`View`]. This is affected by
|
|
1272
|
+
* the "split_by" configuration parameter supplied to this view's
|
|
1273
|
+
* contructor.
|
|
1274
|
+
*
|
|
1275
|
+
* # Returns
|
|
1276
|
+
*
|
|
1277
|
+
* The number of aggregated columns.
|
|
1278
|
+
* @returns {Promise<number>}
|
|
1279
|
+
*/
|
|
1280
|
+
num_columns() {
|
|
1281
|
+
const ret = wasm.view_num_columns(this.__wbg_ptr);
|
|
1282
|
+
return takeObject(ret);
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Unregister a previously registered [`View::on_delete`] callback.
|
|
1286
|
+
* @param {number} callback_id
|
|
1287
|
+
* @returns {Promise<any>}
|
|
1288
|
+
*/
|
|
1289
|
+
remove_delete(callback_id) {
|
|
1290
|
+
const ret = wasm.view_remove_delete(this.__wbg_ptr, callback_id);
|
|
1291
|
+
return takeObject(ret);
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Collapses the `group_by` row at `row_index`.
|
|
1295
|
+
* @param {number} row_index
|
|
1296
|
+
* @returns {Promise<number>}
|
|
1297
|
+
*/
|
|
1298
|
+
collapse(row_index) {
|
|
1299
|
+
const ret = wasm.view_collapse(this.__wbg_ptr, row_index);
|
|
1300
|
+
return takeObject(ret);
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Expand the `group_by` row at `row_index`.
|
|
1304
|
+
* @param {number} row_index
|
|
1305
|
+
* @returns {Promise<number>}
|
|
1306
|
+
*/
|
|
1307
|
+
expand(row_index) {
|
|
1308
|
+
const ret = wasm.view_expand(this.__wbg_ptr, row_index);
|
|
1309
|
+
return takeObject(ret);
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Set expansion `depth` of the `group_by` tree.
|
|
1313
|
+
* @param {number} depth
|
|
1314
|
+
* @returns {Promise<void>}
|
|
1315
|
+
*/
|
|
1316
|
+
set_depth(depth) {
|
|
1317
|
+
const ret = wasm.view_set_depth(this.__wbg_ptr, depth);
|
|
1318
|
+
return takeObject(ret);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
async function __wbg_load(module, imports) {
|
|
1323
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1324
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1325
|
+
try {
|
|
1326
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1327
|
+
|
|
1328
|
+
} catch (e) {
|
|
1329
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
1330
|
+
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);
|
|
1331
|
+
|
|
1332
|
+
} else {
|
|
1333
|
+
throw e;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
const bytes = await module.arrayBuffer();
|
|
1339
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1340
|
+
|
|
1341
|
+
} else {
|
|
1342
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1343
|
+
|
|
1344
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1345
|
+
return { instance, module };
|
|
1346
|
+
|
|
1347
|
+
} else {
|
|
1348
|
+
return instance;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
function __wbg_get_imports() {
|
|
1354
|
+
const imports = {};
|
|
1355
|
+
imports.wbg = {};
|
|
1356
|
+
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
1357
|
+
const ret = String(getObject(arg1));
|
|
1358
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1359
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1360
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1361
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1362
|
+
};
|
|
1363
|
+
imports.wbg.__wbg_at_7d852dd9f194d43e = function(arg0, arg1) {
|
|
1364
|
+
const ret = getObject(arg0).at(arg1);
|
|
1365
|
+
return addHeapObject(ret);
|
|
1366
|
+
};
|
|
1367
|
+
imports.wbg.__wbg_buffer_09165b52af8c5237 = function(arg0) {
|
|
1368
|
+
const ret = getObject(arg0).buffer;
|
|
1369
|
+
return addHeapObject(ret);
|
|
1370
|
+
};
|
|
1371
|
+
imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
|
|
1372
|
+
const ret = getObject(arg0).buffer;
|
|
1373
|
+
return addHeapObject(ret);
|
|
1374
|
+
};
|
|
1375
|
+
imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
1376
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
1377
|
+
return addHeapObject(ret);
|
|
1378
|
+
}, arguments) };
|
|
1379
|
+
imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
1380
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
1381
|
+
return addHeapObject(ret);
|
|
1382
|
+
}, arguments) };
|
|
1383
|
+
imports.wbg.__wbg_call_833bed5770ea2041 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1384
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
|
1385
|
+
return addHeapObject(ret);
|
|
1386
|
+
}, arguments) };
|
|
1387
|
+
imports.wbg.__wbg_client_new = function(arg0) {
|
|
1388
|
+
const ret = Client.__wrap(arg0);
|
|
1389
|
+
return addHeapObject(ret);
|
|
1390
|
+
};
|
|
1391
|
+
imports.wbg.__wbg_debug_3cb59063b29f58c1 = function(arg0) {
|
|
1392
|
+
console.debug(getObject(arg0));
|
|
1393
|
+
};
|
|
1394
|
+
imports.wbg.__wbg_debug_e17b51583ca6a632 = function(arg0, arg1, arg2, arg3) {
|
|
1395
|
+
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
1396
|
+
};
|
|
1397
|
+
imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
|
|
1398
|
+
const ret = getObject(arg0).done;
|
|
1399
|
+
return ret;
|
|
1400
|
+
};
|
|
1401
|
+
imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
|
|
1402
|
+
const ret = Object.entries(getObject(arg0));
|
|
1403
|
+
return addHeapObject(ret);
|
|
1404
|
+
};
|
|
1405
|
+
imports.wbg.__wbg_error_1004b8c64097413f = function(arg0, arg1) {
|
|
1406
|
+
console.error(getObject(arg0), getObject(arg1));
|
|
1407
|
+
};
|
|
1408
|
+
imports.wbg.__wbg_error_524f506f44df1645 = function(arg0) {
|
|
1409
|
+
console.error(getObject(arg0));
|
|
1410
|
+
};
|
|
1411
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
1412
|
+
let deferred0_0;
|
|
1413
|
+
let deferred0_1;
|
|
1414
|
+
try {
|
|
1415
|
+
deferred0_0 = arg0;
|
|
1416
|
+
deferred0_1 = arg1;
|
|
1417
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
1418
|
+
} finally {
|
|
1419
|
+
wasm.__wbindgen_export_3(deferred0_0, deferred0_1, 1);
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
imports.wbg.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
|
|
1423
|
+
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
1424
|
+
};
|
|
1425
|
+
imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
|
|
1426
|
+
const ret = Array.from(getObject(arg0));
|
|
1427
|
+
return addHeapObject(ret);
|
|
1428
|
+
};
|
|
1429
|
+
imports.wbg.__wbg_getEntriesByName_2a5a14d4b09f36a4 = function(arg0, arg1, arg2, arg3, arg4) {
|
|
1430
|
+
const ret = getObject(arg0).getEntriesByName(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
1431
|
+
return addHeapObject(ret);
|
|
1432
|
+
};
|
|
1433
|
+
imports.wbg.__wbg_getRandomValues_21a0191e74d0e1d3 = function() { return handleError(function (arg0, arg1) {
|
|
1434
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
1435
|
+
}, arguments) };
|
|
1436
|
+
imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
|
|
1437
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
1438
|
+
return addHeapObject(ret);
|
|
1439
|
+
}, arguments) };
|
|
1440
|
+
imports.wbg.__wbg_get_74b8744f6a23f4fa = function(arg0, arg1, arg2) {
|
|
1441
|
+
const ret = getObject(arg0)[getStringFromWasm0(arg1, arg2)];
|
|
1442
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1443
|
+
};
|
|
1444
|
+
imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
|
|
1445
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
1446
|
+
return addHeapObject(ret);
|
|
1447
|
+
};
|
|
1448
|
+
imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
|
|
1449
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
1450
|
+
return addHeapObject(ret);
|
|
1451
|
+
};
|
|
1452
|
+
imports.wbg.__wbg_has_a5ea9117f258a0ec = function() { return handleError(function (arg0, arg1) {
|
|
1453
|
+
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
1454
|
+
return ret;
|
|
1455
|
+
}, arguments) };
|
|
1456
|
+
imports.wbg.__wbg_info_033d8b8a0838f1d3 = function(arg0, arg1, arg2, arg3) {
|
|
1457
|
+
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
1458
|
+
};
|
|
1459
|
+
imports.wbg.__wbg_info_3daf2e093e091b66 = function(arg0) {
|
|
1460
|
+
console.info(getObject(arg0));
|
|
1461
|
+
};
|
|
1462
|
+
imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
|
|
1463
|
+
let result;
|
|
1464
|
+
try {
|
|
1465
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
1466
|
+
} catch (_) {
|
|
1467
|
+
result = false;
|
|
1468
|
+
}
|
|
1469
|
+
const ret = result;
|
|
1470
|
+
return ret;
|
|
1471
|
+
};
|
|
1472
|
+
imports.wbg.__wbg_instanceof_Array_6ac07133d621675a = function(arg0) {
|
|
1473
|
+
let result;
|
|
1474
|
+
try {
|
|
1475
|
+
result = getObject(arg0) instanceof Array;
|
|
1476
|
+
} catch (_) {
|
|
1477
|
+
result = false;
|
|
1478
|
+
}
|
|
1479
|
+
const ret = result;
|
|
1480
|
+
return ret;
|
|
1481
|
+
};
|
|
1482
|
+
imports.wbg.__wbg_instanceof_Error_4d54113b22d20306 = function(arg0) {
|
|
1483
|
+
let result;
|
|
1484
|
+
try {
|
|
1485
|
+
result = getObject(arg0) instanceof Error;
|
|
1486
|
+
} catch (_) {
|
|
1487
|
+
result = false;
|
|
1488
|
+
}
|
|
1489
|
+
const ret = result;
|
|
1490
|
+
return ret;
|
|
1491
|
+
};
|
|
1492
|
+
imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
|
|
1493
|
+
let result;
|
|
1494
|
+
try {
|
|
1495
|
+
result = getObject(arg0) instanceof Map;
|
|
1496
|
+
} catch (_) {
|
|
1497
|
+
result = false;
|
|
1498
|
+
}
|
|
1499
|
+
const ret = result;
|
|
1500
|
+
return ret;
|
|
1501
|
+
};
|
|
1502
|
+
imports.wbg.__wbg_instanceof_Object_7f2dcef8f78644a4 = function(arg0) {
|
|
1503
|
+
let result;
|
|
1504
|
+
try {
|
|
1505
|
+
result = getObject(arg0) instanceof Object;
|
|
1506
|
+
} catch (_) {
|
|
1507
|
+
result = false;
|
|
1508
|
+
}
|
|
1509
|
+
const ret = result;
|
|
1510
|
+
return ret;
|
|
1511
|
+
};
|
|
1512
|
+
imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
|
|
1513
|
+
let result;
|
|
1514
|
+
try {
|
|
1515
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
1516
|
+
} catch (_) {
|
|
1517
|
+
result = false;
|
|
1518
|
+
}
|
|
1519
|
+
const ret = result;
|
|
1520
|
+
return ret;
|
|
1521
|
+
};
|
|
1522
|
+
imports.wbg.__wbg_instanceof_Window_def73ea0955fc569 = function(arg0) {
|
|
1523
|
+
let result;
|
|
1524
|
+
try {
|
|
1525
|
+
result = getObject(arg0) instanceof Window;
|
|
1526
|
+
} catch (_) {
|
|
1527
|
+
result = false;
|
|
1528
|
+
}
|
|
1529
|
+
const ret = result;
|
|
1530
|
+
return ret;
|
|
1531
|
+
};
|
|
1532
|
+
imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
|
|
1533
|
+
const ret = Array.isArray(getObject(arg0));
|
|
1534
|
+
return ret;
|
|
1535
|
+
};
|
|
1536
|
+
imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
|
|
1537
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
1538
|
+
return ret;
|
|
1539
|
+
};
|
|
1540
|
+
imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
|
|
1541
|
+
const ret = Symbol.iterator;
|
|
1542
|
+
return addHeapObject(ret);
|
|
1543
|
+
};
|
|
1544
|
+
imports.wbg.__wbg_keys_5c77a08ddc2fb8a6 = function(arg0) {
|
|
1545
|
+
const ret = Object.keys(getObject(arg0));
|
|
1546
|
+
return addHeapObject(ret);
|
|
1547
|
+
};
|
|
1548
|
+
imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
|
|
1549
|
+
const ret = getObject(arg0).length;
|
|
1550
|
+
return ret;
|
|
1551
|
+
};
|
|
1552
|
+
imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
|
|
1553
|
+
const ret = getObject(arg0).length;
|
|
1554
|
+
return ret;
|
|
1555
|
+
};
|
|
1556
|
+
imports.wbg.__wbg_mark_001da84b098c950f = function() { return handleError(function (arg0, arg1, arg2) {
|
|
1557
|
+
getObject(arg0).mark(getStringFromWasm0(arg1, arg2));
|
|
1558
|
+
}, arguments) };
|
|
1559
|
+
imports.wbg.__wbg_measure_65e49f8bc0e203a8 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1560
|
+
getObject(arg0).measure(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
1561
|
+
}, arguments) };
|
|
1562
|
+
imports.wbg.__wbg_message_97a2af9b89d693a3 = function(arg0) {
|
|
1563
|
+
const ret = getObject(arg0).message;
|
|
1564
|
+
return addHeapObject(ret);
|
|
1565
|
+
};
|
|
1566
|
+
imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
1567
|
+
try {
|
|
1568
|
+
var state0 = {a: arg0, b: arg1};
|
|
1569
|
+
var cb0 = (arg0, arg1) => {
|
|
1570
|
+
const a = state0.a;
|
|
1571
|
+
state0.a = 0;
|
|
1572
|
+
try {
|
|
1573
|
+
return __wbg_adapter_251(a, state0.b, arg0, arg1);
|
|
1574
|
+
} finally {
|
|
1575
|
+
state0.a = a;
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1578
|
+
const ret = new Promise(cb0);
|
|
1579
|
+
return addHeapObject(ret);
|
|
1580
|
+
} finally {
|
|
1581
|
+
state0.a = state0.b = 0;
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
imports.wbg.__wbg_new_405e22f390576ce2 = function() {
|
|
1585
|
+
const ret = new Object();
|
|
1586
|
+
return addHeapObject(ret);
|
|
1587
|
+
};
|
|
1588
|
+
imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
|
|
1589
|
+
const ret = new Map();
|
|
1590
|
+
return addHeapObject(ret);
|
|
1591
|
+
};
|
|
1592
|
+
imports.wbg.__wbg_new_78feb108b6472713 = function() {
|
|
1593
|
+
const ret = new Array();
|
|
1594
|
+
return addHeapObject(ret);
|
|
1595
|
+
};
|
|
1596
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
1597
|
+
const ret = new Error();
|
|
1598
|
+
return addHeapObject(ret);
|
|
1599
|
+
};
|
|
1600
|
+
imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
|
|
1601
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
1602
|
+
return addHeapObject(ret);
|
|
1603
|
+
};
|
|
1604
|
+
imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
1605
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
1606
|
+
return addHeapObject(ret);
|
|
1607
|
+
};
|
|
1608
|
+
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
1609
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
1610
|
+
return addHeapObject(ret);
|
|
1611
|
+
};
|
|
1612
|
+
imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
|
|
1613
|
+
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
1614
|
+
return addHeapObject(ret);
|
|
1615
|
+
};
|
|
1616
|
+
imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
|
|
1617
|
+
const ret = getObject(arg0).next;
|
|
1618
|
+
return addHeapObject(ret);
|
|
1619
|
+
};
|
|
1620
|
+
imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
|
|
1621
|
+
const ret = getObject(arg0).next();
|
|
1622
|
+
return addHeapObject(ret);
|
|
1623
|
+
}, arguments) };
|
|
1624
|
+
imports.wbg.__wbg_now_d18023d54d4e5500 = function(arg0) {
|
|
1625
|
+
const ret = getObject(arg0).now();
|
|
1626
|
+
return ret;
|
|
1627
|
+
};
|
|
1628
|
+
imports.wbg.__wbg_parse_def2e24ef1252aff = function() { return handleError(function (arg0, arg1) {
|
|
1629
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
1630
|
+
return addHeapObject(ret);
|
|
1631
|
+
}, arguments) };
|
|
1632
|
+
imports.wbg.__wbg_performance_c185c0cdc2766575 = function(arg0) {
|
|
1633
|
+
const ret = getObject(arg0).performance;
|
|
1634
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1635
|
+
};
|
|
1636
|
+
imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
|
|
1637
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
1638
|
+
return ret;
|
|
1639
|
+
};
|
|
1640
|
+
imports.wbg.__wbg_queueMicrotask_6808622725a52272 = function(arg0) {
|
|
1641
|
+
const ret = getObject(arg0).queueMicrotask;
|
|
1642
|
+
return addHeapObject(ret);
|
|
1643
|
+
};
|
|
1644
|
+
imports.wbg.__wbg_queueMicrotask_ef0e86b0263a71ee = function(arg0) {
|
|
1645
|
+
queueMicrotask(getObject(arg0));
|
|
1646
|
+
};
|
|
1647
|
+
imports.wbg.__wbg_reject_b3fcf99063186ff7 = function(arg0) {
|
|
1648
|
+
const ret = Promise.reject(getObject(arg0));
|
|
1649
|
+
return addHeapObject(ret);
|
|
1650
|
+
};
|
|
1651
|
+
imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
|
|
1652
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
1653
|
+
return addHeapObject(ret);
|
|
1654
|
+
};
|
|
1655
|
+
imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
|
|
1656
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
1657
|
+
};
|
|
1658
|
+
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
1659
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
1660
|
+
};
|
|
1661
|
+
imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
|
|
1662
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
1663
|
+
};
|
|
1664
|
+
imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
|
|
1665
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
1666
|
+
return addHeapObject(ret);
|
|
1667
|
+
};
|
|
1668
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
1669
|
+
const ret = getObject(arg1).stack;
|
|
1670
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1671
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1672
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1673
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1674
|
+
};
|
|
1675
|
+
imports.wbg.__wbg_startTime_c051731d0a31602f = function(arg0) {
|
|
1676
|
+
const ret = getObject(arg0).startTime;
|
|
1677
|
+
return ret;
|
|
1678
|
+
};
|
|
1679
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
|
|
1680
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1681
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1682
|
+
};
|
|
1683
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
|
|
1684
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1685
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1686
|
+
};
|
|
1687
|
+
imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
|
|
1688
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1689
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1690
|
+
};
|
|
1691
|
+
imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
|
|
1692
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1693
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1694
|
+
};
|
|
1695
|
+
imports.wbg.__wbg_stringify_f7ed6987935b4a24 = function() { return handleError(function (arg0) {
|
|
1696
|
+
const ret = JSON.stringify(getObject(arg0));
|
|
1697
|
+
return addHeapObject(ret);
|
|
1698
|
+
}, arguments) };
|
|
1699
|
+
imports.wbg.__wbg_table_new = function(arg0) {
|
|
1700
|
+
const ret = Table.__wrap(arg0);
|
|
1701
|
+
return addHeapObject(ret);
|
|
1702
|
+
};
|
|
1703
|
+
imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
|
|
1704
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
1705
|
+
return addHeapObject(ret);
|
|
1706
|
+
};
|
|
1707
|
+
imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
|
|
1708
|
+
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
|
1709
|
+
return addHeapObject(ret);
|
|
1710
|
+
};
|
|
1711
|
+
imports.wbg.__wbg_toString_5285597960676b7b = function(arg0) {
|
|
1712
|
+
const ret = getObject(arg0).toString();
|
|
1713
|
+
return addHeapObject(ret);
|
|
1714
|
+
};
|
|
1715
|
+
imports.wbg.__wbg_trace_d12a9ac890a2cbb8 = function(arg0, arg1, arg2, arg3) {
|
|
1716
|
+
console.trace(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
1717
|
+
};
|
|
1718
|
+
imports.wbg.__wbg_trace_e758b839df8d34f1 = function(arg0) {
|
|
1719
|
+
console.trace(getObject(arg0));
|
|
1720
|
+
};
|
|
1721
|
+
imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
|
|
1722
|
+
const ret = getObject(arg0).value;
|
|
1723
|
+
return addHeapObject(ret);
|
|
1724
|
+
};
|
|
1725
|
+
imports.wbg.__wbg_values_fcb8ba8c0aad8b58 = function(arg0) {
|
|
1726
|
+
const ret = Object.values(getObject(arg0));
|
|
1727
|
+
return addHeapObject(ret);
|
|
1728
|
+
};
|
|
1729
|
+
imports.wbg.__wbg_view_new = function(arg0) {
|
|
1730
|
+
const ret = View.__wrap(arg0);
|
|
1731
|
+
return addHeapObject(ret);
|
|
1732
|
+
};
|
|
1733
|
+
imports.wbg.__wbg_view_unwrap = function(arg0) {
|
|
1734
|
+
const ret = View.__unwrap(takeObject(arg0));
|
|
1735
|
+
return ret;
|
|
1736
|
+
};
|
|
1737
|
+
imports.wbg.__wbg_warn_4ca3906c248c47c4 = function(arg0) {
|
|
1738
|
+
console.warn(getObject(arg0));
|
|
1739
|
+
};
|
|
1740
|
+
imports.wbg.__wbg_warn_aaf1f4664a035bd6 = function(arg0, arg1, arg2, arg3) {
|
|
1741
|
+
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
1742
|
+
};
|
|
1743
|
+
imports.wbg.__wbindgen_as_number = function(arg0) {
|
|
1744
|
+
const ret = +getObject(arg0);
|
|
1745
|
+
return ret;
|
|
1746
|
+
};
|
|
1747
|
+
imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
|
|
1748
|
+
const ret = arg0;
|
|
1749
|
+
return addHeapObject(ret);
|
|
1750
|
+
};
|
|
1751
|
+
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
|
1752
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1753
|
+
return addHeapObject(ret);
|
|
1754
|
+
};
|
|
1755
|
+
imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
|
|
1756
|
+
const v = getObject(arg1);
|
|
1757
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1758
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1759
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1760
|
+
};
|
|
1761
|
+
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
|
1762
|
+
const v = getObject(arg0);
|
|
1763
|
+
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
1764
|
+
return ret;
|
|
1765
|
+
};
|
|
1766
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
1767
|
+
const obj = takeObject(arg0).original;
|
|
1768
|
+
if (obj.cnt-- == 1) {
|
|
1769
|
+
obj.a = 0;
|
|
1770
|
+
return true;
|
|
1771
|
+
}
|
|
1772
|
+
const ret = false;
|
|
1773
|
+
return ret;
|
|
1774
|
+
};
|
|
1775
|
+
imports.wbg.__wbindgen_closure_wrapper3224 = function(arg0, arg1, arg2) {
|
|
1776
|
+
const ret = makeMutClosure(arg0, arg1, 468, __wbg_adapter_53);
|
|
1777
|
+
return addHeapObject(ret);
|
|
1778
|
+
};
|
|
1779
|
+
imports.wbg.__wbindgen_closure_wrapper367 = function(arg0, arg1, arg2) {
|
|
1780
|
+
const ret = makeClosure(arg0, arg1, 7, __wbg_adapter_50);
|
|
1781
|
+
return addHeapObject(ret);
|
|
1782
|
+
};
|
|
1783
|
+
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
1784
|
+
const ret = debugString(getObject(arg1));
|
|
1785
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1786
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1787
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1788
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1789
|
+
};
|
|
1790
|
+
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
1791
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
1792
|
+
return addHeapObject(ret);
|
|
1793
|
+
};
|
|
1794
|
+
imports.wbg.__wbindgen_in = function(arg0, arg1) {
|
|
1795
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
1796
|
+
return ret;
|
|
1797
|
+
};
|
|
1798
|
+
imports.wbg.__wbindgen_is_bigint = function(arg0) {
|
|
1799
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
1800
|
+
return ret;
|
|
1801
|
+
};
|
|
1802
|
+
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
1803
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
1804
|
+
return ret;
|
|
1805
|
+
};
|
|
1806
|
+
imports.wbg.__wbindgen_is_object = function(arg0) {
|
|
1807
|
+
const val = getObject(arg0);
|
|
1808
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1809
|
+
return ret;
|
|
1810
|
+
};
|
|
1811
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
1812
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
1813
|
+
return ret;
|
|
1814
|
+
};
|
|
1815
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
1816
|
+
const ret = getObject(arg0) === undefined;
|
|
1817
|
+
return ret;
|
|
1818
|
+
};
|
|
1819
|
+
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
|
|
1820
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
1821
|
+
return ret;
|
|
1822
|
+
};
|
|
1823
|
+
imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
|
|
1824
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
1825
|
+
return ret;
|
|
1826
|
+
};
|
|
1827
|
+
imports.wbg.__wbindgen_memory = function() {
|
|
1828
|
+
const ret = wasm.memory;
|
|
1829
|
+
return addHeapObject(ret);
|
|
1830
|
+
};
|
|
1831
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
1832
|
+
const obj = getObject(arg1);
|
|
1833
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1834
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1835
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1836
|
+
};
|
|
1837
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
1838
|
+
const ret = arg0;
|
|
1839
|
+
return addHeapObject(ret);
|
|
1840
|
+
};
|
|
1841
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
1842
|
+
const ret = getObject(arg0);
|
|
1843
|
+
return addHeapObject(ret);
|
|
1844
|
+
};
|
|
1845
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
1846
|
+
takeObject(arg0);
|
|
1847
|
+
};
|
|
1848
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
1849
|
+
const obj = getObject(arg1);
|
|
1850
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1851
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1852
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1853
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1854
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1855
|
+
};
|
|
1856
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
1857
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1858
|
+
return addHeapObject(ret);
|
|
1859
|
+
};
|
|
1860
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
1861
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1862
|
+
};
|
|
1863
|
+
|
|
1864
|
+
return imports;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
function __wbg_init_memory(imports, memory) {
|
|
1868
|
+
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
function __wbg_finalize_init(instance, module) {
|
|
1872
|
+
wasm = instance.exports;
|
|
1873
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
1874
|
+
cachedDataViewMemory0 = null;
|
|
1875
|
+
cachedUint8ArrayMemory0 = null;
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
|
|
1879
|
+
return wasm;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
function initSync(module) {
|
|
1883
|
+
if (wasm !== undefined) return wasm;
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
if (typeof module !== 'undefined') {
|
|
1887
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1888
|
+
({module} = module)
|
|
1889
|
+
} else {
|
|
1890
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
const imports = __wbg_get_imports();
|
|
1895
|
+
|
|
1896
|
+
__wbg_init_memory(imports);
|
|
1897
|
+
|
|
1898
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1899
|
+
module = new WebAssembly.Module(module);
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1903
|
+
|
|
1904
|
+
return __wbg_finalize_init(instance, module);
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
async function __wbg_init(module_or_path) {
|
|
1908
|
+
if (wasm !== undefined) return wasm;
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
if (typeof module_or_path !== 'undefined') {
|
|
1912
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1913
|
+
({module_or_path} = module_or_path)
|
|
1914
|
+
} else {
|
|
1915
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
const imports = __wbg_get_imports();
|
|
1921
|
+
|
|
1922
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1923
|
+
module_or_path = fetch(module_or_path);
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
__wbg_init_memory(imports);
|
|
1927
|
+
|
|
1928
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1929
|
+
|
|
1930
|
+
return __wbg_finalize_init(instance, module);
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
export { initSync };
|
|
1934
|
+
export default __wbg_init;
|