@perspective-dev/client 4.1.1 → 4.2.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.
@@ -1,372 +1,692 @@
1
- let wasm;
1
+ /* @ts-self-types="./perspective-js.wasm.d.ts" */
2
2
 
3
- let 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 cachedUint8ArrayMemory0 = null;
10
-
11
- function getUint8ArrayMemory0() {
12
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
13
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
14
- }
15
- return cachedUint8ArrayMemory0;
16
- }
17
-
18
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
19
-
20
- cachedTextDecoder.decode();
21
-
22
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
23
- let numBytesDecoded = 0;
24
- function decodeText(ptr, len) {
25
- numBytesDecoded += len;
26
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
27
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
28
- cachedTextDecoder.decode();
29
- numBytesDecoded = len;
30
- }
31
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
32
- }
33
-
34
- function getStringFromWasm0(ptr, len) {
35
- ptr = ptr >>> 0;
36
- return decodeText(ptr, len);
37
- }
38
-
39
- function getCachedStringFromWasm0(ptr, len) {
40
- if (ptr === 0) {
41
- return getObject(len);
42
- } else {
43
- return getStringFromWasm0(ptr, len);
3
+ /**
4
+ * An instance of a [`Client`] is a connection to a single
5
+ * `perspective_server::Server`, whether locally in-memory or remote over some
6
+ * transport like a WebSocket.
7
+ *
8
+ * The browser and node.js libraries both support the `websocket(url)`
9
+ * constructor, which connects to a remote `perspective_server::Server`
10
+ * instance over a WebSocket transport.
11
+ *
12
+ * In the browser, the `worker()` constructor creates a new Web Worker
13
+ * `perspective_server::Server` and returns a [`Client`] connected to it.
14
+ *
15
+ * In node.js, a pre-instantied [`Client`] connected synhronously to a global
16
+ * singleton `perspective_server::Server` is the default module export.
17
+ *
18
+ * # JavaScript Examples
19
+ *
20
+ * Create a Web Worker `perspective_server::Server` in the browser and return a
21
+ * [`Client`] instance connected for it:
22
+ *
23
+ * ```javascript
24
+ * import perspective from "@perspective-dev/client";
25
+ * const client = await perspective.worker();
26
+ * ```
27
+ *
28
+ * Create a WebSocket connection to a remote `perspective_server::Server`:
29
+ *
30
+ * ```javascript
31
+ * import perspective from "@perspective-dev/client";
32
+ * const client = await perspective.websocket("ws://locahost:8080/ws");
33
+ * ```
34
+ *
35
+ * Access the synchronous client in node.js:
36
+ *
37
+ * ```javascript
38
+ * import { default as client } from "@perspective-dev/client";
39
+ * ```
40
+ */
41
+ export class Client {
42
+ static __wrap(ptr) {
43
+ ptr = ptr >>> 0;
44
+ const obj = Object.create(Client.prototype);
45
+ obj.__wbg_ptr = ptr;
46
+ ClientFinalization.register(obj, obj.__wbg_ptr, obj);
47
+ return obj;
44
48
  }
45
- }
46
-
47
- let heap_next = heap.length;
48
-
49
- function addHeapObject(obj) {
50
- if (heap_next === heap.length) heap.push(heap.length + 1);
51
- const idx = heap_next;
52
- heap_next = heap[idx];
53
-
54
- heap[idx] = obj;
55
- return idx;
56
- }
57
-
58
- let WASM_VECTOR_LEN = 0;
59
-
60
- const cachedTextEncoder = new TextEncoder();
61
-
62
- function passStringToWasm0(arg, malloc, realloc) {
63
-
64
- if (realloc === undefined) {
65
- const buf = cachedTextEncoder.encode(arg);
66
- const ptr = malloc(buf.length, 1) >>> 0;
67
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
68
- WASM_VECTOR_LEN = buf.length;
49
+ __destroy_into_raw() {
50
+ const ptr = this.__wbg_ptr;
51
+ this.__wbg_ptr = 0;
52
+ ClientFinalization.unregister(this);
69
53
  return ptr;
70
54
  }
71
-
72
- let len = arg.length;
73
- let ptr = malloc(len, 1) >>> 0;
74
-
75
- const mem = getUint8ArrayMemory0();
76
-
77
- let offset = 0;
78
-
79
- for (; offset < len; offset++) {
80
- const code = arg.charCodeAt(offset);
81
- if (code > 0x7F) break;
82
- mem[ptr + offset] = code;
55
+ free() {
56
+ const ptr = this.__destroy_into_raw();
57
+ wasm.__wbg_client_free(ptr, 0);
83
58
  }
84
-
85
- if (offset !== len) {
86
- if (offset !== 0) {
87
- arg = arg.slice(offset);
59
+ /**
60
+ * @returns {string}
61
+ */
62
+ __getClassname() {
63
+ try {
64
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
65
+ wasm.client___getClassname(retptr, this.__wbg_ptr);
66
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
67
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
68
+ var v1 = getCachedStringFromWasm0(r0, r1);
69
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
70
+ return v1;
71
+ } finally {
72
+ wasm.__wbindgen_add_to_stack_pointer(16);
88
73
  }
89
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
90
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
91
- const ret = cachedTextEncoder.encodeInto(arg, view);
92
-
93
- offset += ret.written;
94
- ptr = realloc(ptr, len, offset, 1) >>> 0;
95
74
  }
96
-
97
- WASM_VECTOR_LEN = offset;
98
- return ptr;
99
- }
100
-
101
- let cachedDataViewMemory0 = null;
102
-
103
- function getDataViewMemory0() {
104
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
105
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
75
+ /**
76
+ * Retrieves the names of all tables that this client has access to.
77
+ *
78
+ * `name` is a string identifier unique to the [`Table`] (per [`Client`]),
79
+ * which can be used in conjunction with [`Client::open_table`] to get
80
+ * a [`Table`] instance without the use of [`Client::table`]
81
+ * constructor directly (e.g., one created by another [`Client`]).
82
+ *
83
+ * # JavaScript Examples
84
+ *
85
+ * ```javascript
86
+ * const tables = await client.get_hosted_table_names();
87
+ * ```
88
+ * @returns {Promise<string[]>}
89
+ */
90
+ get_hosted_table_names() {
91
+ const ret = wasm.client_get_hosted_table_names(this.__wbg_ptr);
92
+ return takeObject(ret);
106
93
  }
107
- return cachedDataViewMemory0;
108
- }
109
-
110
- function isLikeNone(x) {
111
- return x === undefined || x === null;
112
- }
113
-
114
- function debugString(val) {
115
- // primitive types
116
- const type = typeof val;
117
- if (type == 'number' || type == 'boolean' || val == null) {
118
- return `${val}`;
94
+ /**
95
+ * @param {string} error
96
+ * @param {Function | null} [reconnect]
97
+ * @returns {Promise<void>}
98
+ */
99
+ handle_error(error, reconnect) {
100
+ const ptr0 = passStringToWasm0(error, wasm.__wbindgen_export, wasm.__wbindgen_export2);
101
+ const len0 = WASM_VECTOR_LEN;
102
+ const ret = wasm.client_handle_error(this.__wbg_ptr, ptr0, len0, isLikeNone(reconnect) ? 0 : addHeapObject(reconnect));
103
+ return takeObject(ret);
119
104
  }
120
- if (type == 'string') {
121
- return `"${val}"`;
105
+ /**
106
+ * @param {any} value
107
+ * @returns {Promise<void>}
108
+ */
109
+ handle_response(value) {
110
+ const ret = wasm.client_handle_response(this.__wbg_ptr, addHeapObject(value));
111
+ return takeObject(ret);
122
112
  }
123
- if (type == 'symbol') {
124
- const description = val.description;
125
- if (description == null) {
126
- return 'Symbol';
127
- } else {
128
- return `Symbol(${description})`;
113
+ /**
114
+ * @param {Function} send_request
115
+ * @param {Function | null} [close]
116
+ */
117
+ constructor(send_request, close) {
118
+ try {
119
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
120
+ wasm.client_new(retptr, addHeapObject(send_request), isLikeNone(close) ? 0 : addHeapObject(close));
121
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
122
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
123
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
124
+ if (r2) {
125
+ throw takeObject(r1);
126
+ }
127
+ this.__wbg_ptr = r0 >>> 0;
128
+ ClientFinalization.register(this, this.__wbg_ptr, this);
129
+ return this;
130
+ } finally {
131
+ wasm.__wbindgen_add_to_stack_pointer(16);
129
132
  }
130
133
  }
131
- if (type == 'function') {
132
- const name = val.name;
133
- if (typeof name == 'string' && name.length > 0) {
134
- return `Function(${name})`;
135
- } else {
136
- return 'Function';
134
+ /**
135
+ * @param {Function} on_response
136
+ * @returns {ProxySession}
137
+ */
138
+ new_proxy_session(on_response) {
139
+ try {
140
+ const ret = wasm.client_new_proxy_session(this.__wbg_ptr, addBorrowedObject(on_response));
141
+ return ProxySession.__wrap(ret);
142
+ } finally {
143
+ heap[stack_pointer++] = undefined;
137
144
  }
138
145
  }
139
- // objects
140
- if (Array.isArray(val)) {
141
- const length = val.length;
142
- let debug = '[';
143
- if (length > 0) {
144
- debug += debugString(val[0]);
146
+ /**
147
+ * @param {Function} callback
148
+ * @returns {Promise<number>}
149
+ */
150
+ on_error(callback) {
151
+ const ret = wasm.client_on_error(this.__wbg_ptr, addHeapObject(callback));
152
+ return takeObject(ret);
153
+ }
154
+ /**
155
+ * Register a callback which is invoked whenever [`Client::table`] (on this
156
+ * [`Client`]) or [`Table::delete`] (on a [`Table`] belinging to this
157
+ * [`Client`]) are called.
158
+ * @param {Function} on_update_js
159
+ * @returns {Promise<number>}
160
+ */
161
+ on_hosted_tables_update(on_update_js) {
162
+ const ret = wasm.client_on_hosted_tables_update(this.__wbg_ptr, addHeapObject(on_update_js));
163
+ return takeObject(ret);
164
+ }
165
+ /**
166
+ * Opens a [`Table`] that is hosted on the `perspective_server::Server`
167
+ * that is connected to this [`Client`].
168
+ *
169
+ * The `name` property of [`TableInitOptions`] is used to identify each
170
+ * [`Table`]. [`Table`] `name`s can be looked up for each [`Client`]
171
+ * via [`Client::get_hosted_table_names`].
172
+ *
173
+ * # JavaScript Examples
174
+ *
175
+ * Get a virtual [`Table`] named "table_one" from this [`Client`]
176
+ *
177
+ * ```javascript
178
+ * const tables = await client.open_table("table_one");
179
+ * ```
180
+ * @param {string} entity_id
181
+ * @returns {Promise<Table>}
182
+ */
183
+ open_table(entity_id) {
184
+ const ptr0 = passStringToWasm0(entity_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
185
+ const len0 = WASM_VECTOR_LEN;
186
+ const ret = wasm.client_open_table(this.__wbg_ptr, ptr0, len0);
187
+ return takeObject(ret);
188
+ }
189
+ /**
190
+ * Remove a callback previously registered via
191
+ * `Client::on_hosted_tables_update`.
192
+ * @param {number} update_id
193
+ * @returns {Promise<void>}
194
+ */
195
+ remove_hosted_tables_update(update_id) {
196
+ const ret = wasm.client_remove_hosted_tables_update(this.__wbg_ptr, update_id);
197
+ return takeObject(ret);
198
+ }
199
+ /**
200
+ * Provides the [`SystemInfo`] struct, implementation-specific metadata
201
+ * about the [`perspective_server::Server`] runtime such as Memory and
202
+ * CPU usage.
203
+ *
204
+ * For WebAssembly servers, this method includes the WebAssembly heap size.
205
+ *
206
+ * # JavaScript Examples
207
+ *
208
+ * ```javascript
209
+ * const info = await client.system_info();
210
+ * ```
211
+ * @returns {Promise<SystemInfo>}
212
+ */
213
+ system_info() {
214
+ const ret = wasm.client_system_info(this.__wbg_ptr);
215
+ return takeObject(ret);
216
+ }
217
+ /**
218
+ * Creates a new [`Table`] from either a _schema_ or _data_.
219
+ *
220
+ * The [`Client::table`] factory function can be initialized with either a
221
+ * _schema_ (see [`Table::schema`]), or data in one of these formats:
222
+ *
223
+ * - Apache Arrow
224
+ * - CSV
225
+ * - JSON row-oriented
226
+ * - JSON column-oriented
227
+ * - NDJSON
228
+ *
229
+ * When instantiated with _data_, the schema is inferred from this data.
230
+ * While this is convenient, inferrence is sometimes imperfect e.g.
231
+ * when the input is empty, null or ambiguous. For these cases,
232
+ * [`Client::table`] can first be instantiated with a explicit schema.
233
+ *
234
+ * When instantiated with a _schema_, the resulting [`Table`] is empty but
235
+ * with known column names and column types. When subsqeuently
236
+ * populated with [`Table::update`], these columns will be _coerced_ to
237
+ * the schema's type. This behavior can be useful when
238
+ * [`Client::table`]'s column type inferences doesn't work.
239
+ *
240
+ * The resulting [`Table`] is _virtual_, and invoking its methods
241
+ * dispatches events to the `perspective_server::Server` this
242
+ * [`Client`] connects to, where the data is stored and all calculation
243
+ * occurs.
244
+ *
245
+ * # Arguments
246
+ *
247
+ * - `arg` - Either _schema_ or initialization _data_.
248
+ * - `options` - Optional configuration which provides one of:
249
+ * - `limit` - The max number of rows the resulting [`Table`] can
250
+ * store.
251
+ * - `index` - The column name to use as an _index_ column. If this
252
+ * `Table` is being instantiated by _data_, this column name must be
253
+ * present in the data.
254
+ * - `name` - The name of the table. This will be generated if it is
255
+ * not provided.
256
+ * - `format` - The explicit format of the input data, can be one of
257
+ * `"json"`, `"columns"`, `"csv"` or `"arrow"`. This overrides
258
+ * language-specific type dispatch behavior, which allows stringified
259
+ * and byte array alternative inputs.
260
+ *
261
+ * # JavaScript Examples
262
+ *
263
+ * Load a CSV from a `string`:
264
+ *
265
+ * ```javascript
266
+ * const table = await client.table("x,y\n1,2\n3,4");
267
+ * ```
268
+ *
269
+ * Load an Arrow from an `ArrayBuffer`:
270
+ *
271
+ * ```javascript
272
+ * import * as fs from "node:fs/promises";
273
+ * const table2 = await client.table(await fs.readFile("superstore.arrow"));
274
+ * ```
275
+ *
276
+ * Load a CSV from a `UInt8Array` (the default for this type is Arrow)
277
+ * using a format override:
278
+ *
279
+ * ```javascript
280
+ * const enc = new TextEncoder();
281
+ * const table = await client.table(enc.encode("x,y\n1,2\n3,4"), {
282
+ * format: "csv",
283
+ * });
284
+ * ```
285
+ *
286
+ * Create a table with an `index`:
287
+ *
288
+ * ```javascript
289
+ * const table = await client.table(data, { index: "Row ID" });
290
+ * ```
291
+ * @param {string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>} value
292
+ * @param {TableInitOptions | null} [options]
293
+ * @returns {Promise<Table>}
294
+ */
295
+ table(value, options) {
296
+ const ret = wasm.client_table(this.__wbg_ptr, addHeapObject(value), isLikeNone(options) ? 0 : addHeapObject(options));
297
+ return takeObject(ret);
298
+ }
299
+ /**
300
+ * Terminates this [`Client`], cleaning up any [`crate::View`] handles the
301
+ * [`Client`] has open as well as its callbacks.
302
+ * @returns {any}
303
+ */
304
+ terminate() {
305
+ try {
306
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
307
+ wasm.client_terminate(retptr, this.__wbg_ptr);
308
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
309
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
310
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
311
+ if (r2) {
312
+ throw takeObject(r1);
313
+ }
314
+ return takeObject(r0);
315
+ } finally {
316
+ wasm.__wbindgen_add_to_stack_pointer(16);
145
317
  }
146
- for(let i = 1; i < length; i++) {
147
- debug += ', ' + debugString(val[i]);
318
+ }
319
+ }
320
+ if (Symbol.dispose) Client.prototype[Symbol.dispose] = Client.prototype.free;
321
+
322
+ /**
323
+ * JavaScript-facing DuckDB SQL query builder.
324
+ *
325
+ * This struct wraps the Rust `DuckDBSqlBuilder` and exposes it to JavaScript
326
+ * via wasm_bindgen.
327
+ */
328
+ export class GenericSQLVirtualServerModel {
329
+ __destroy_into_raw() {
330
+ const ptr = this.__wbg_ptr;
331
+ this.__wbg_ptr = 0;
332
+ GenericSQLVirtualServerModelFinalization.unregister(this);
333
+ return ptr;
334
+ }
335
+ free() {
336
+ const ptr = this.__destroy_into_raw();
337
+ wasm.__wbg_genericsqlvirtualservermodel_free(ptr, 0);
338
+ }
339
+ /**
340
+ * Returns the SQL query to list all hosted tables.
341
+ * @returns {string}
342
+ */
343
+ getHostedTables() {
344
+ try {
345
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
346
+ wasm.genericsqlvirtualservermodel_getHostedTables(retptr, this.__wbg_ptr);
347
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
348
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
349
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
350
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
351
+ if (r3) {
352
+ throw takeObject(r2);
353
+ }
354
+ var v1 = getCachedStringFromWasm0(r0, r1);
355
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
356
+ return v1;
357
+ } finally {
358
+ wasm.__wbindgen_add_to_stack_pointer(16);
148
359
  }
149
- debug += ']';
150
- return debug;
151
360
  }
152
- // Test for built-in
153
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
154
- let className;
155
- if (builtInMatches && builtInMatches.length > 1) {
156
- className = builtInMatches[1];
157
- } else {
158
- // Failed to match the standard '[object ClassName]'
159
- return toString.call(val);
361
+ /**
362
+ * Creates a new `JsDuckDBSqlBuilder` instance.
363
+ * @param {any | null} [args]
364
+ */
365
+ constructor(args) {
366
+ try {
367
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
368
+ wasm.genericsqlvirtualservermodel_new(retptr, isLikeNone(args) ? 0 : addHeapObject(args));
369
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
370
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
371
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
372
+ if (r2) {
373
+ throw takeObject(r1);
374
+ }
375
+ this.__wbg_ptr = r0 >>> 0;
376
+ GenericSQLVirtualServerModelFinalization.register(this, this.__wbg_ptr, this);
377
+ return this;
378
+ } finally {
379
+ wasm.__wbindgen_add_to_stack_pointer(16);
380
+ }
160
381
  }
161
- if (className == 'Object') {
162
- // we're a user defined class or Object
163
- // JSON.stringify avoids problems with cycles, and is generally much
164
- // easier than looping through ownProperties of `val`.
382
+ /**
383
+ * Returns the SQL query to create a view from a table with the given
384
+ * configuration.
385
+ * @param {string} table_id
386
+ * @param {string} view_id
387
+ * @param {any} config
388
+ * @returns {string}
389
+ */
390
+ tableMakeView(table_id, view_id, config) {
165
391
  try {
166
- return 'Object(' + JSON.stringify(val) + ')';
167
- } catch (_) {
168
- return 'Object';
392
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
393
+ const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
394
+ const len0 = WASM_VECTOR_LEN;
395
+ const ptr1 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
396
+ const len1 = WASM_VECTOR_LEN;
397
+ wasm.genericsqlvirtualservermodel_tableMakeView(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(config));
398
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
399
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
400
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
401
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
402
+ if (r3) {
403
+ throw takeObject(r2);
404
+ }
405
+ var v3 = getCachedStringFromWasm0(r0, r1);
406
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
407
+ return v3;
408
+ } finally {
409
+ wasm.__wbindgen_add_to_stack_pointer(16);
410
+ }
411
+ }
412
+ /**
413
+ * Returns the SQL query to describe a table's schema.
414
+ * @param {string} table_id
415
+ * @returns {string}
416
+ */
417
+ tableSchema(table_id) {
418
+ try {
419
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
420
+ const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ wasm.genericsqlvirtualservermodel_tableSchema(retptr, this.__wbg_ptr, ptr0, len0);
423
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
424
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
425
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
426
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
427
+ if (r3) {
428
+ throw takeObject(r2);
429
+ }
430
+ var v2 = getCachedStringFromWasm0(r0, r1);
431
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
432
+ return v2;
433
+ } finally {
434
+ wasm.__wbindgen_add_to_stack_pointer(16);
435
+ }
436
+ }
437
+ /**
438
+ * Returns the SQL query to get the row count of a table.
439
+ * @param {string} table_id
440
+ * @returns {string}
441
+ */
442
+ tableSize(table_id) {
443
+ try {
444
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
445
+ const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
446
+ const len0 = WASM_VECTOR_LEN;
447
+ wasm.genericsqlvirtualservermodel_tableSize(retptr, this.__wbg_ptr, ptr0, len0);
448
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
449
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
450
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
451
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
452
+ if (r3) {
453
+ throw takeObject(r2);
454
+ }
455
+ var v2 = getCachedStringFromWasm0(r0, r1);
456
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
457
+ return v2;
458
+ } finally {
459
+ wasm.__wbindgen_add_to_stack_pointer(16);
460
+ }
461
+ }
462
+ /**
463
+ * Returns the SQL query to validate an expression against a table.
464
+ * @param {string} table_id
465
+ * @param {string} expression
466
+ * @returns {string}
467
+ */
468
+ tableValidateExpression(table_id, expression) {
469
+ try {
470
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
471
+ const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
472
+ const len0 = WASM_VECTOR_LEN;
473
+ const ptr1 = passStringToWasm0(expression, wasm.__wbindgen_export, wasm.__wbindgen_export2);
474
+ const len1 = WASM_VECTOR_LEN;
475
+ wasm.genericsqlvirtualservermodel_tableValidateExpression(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
476
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
477
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
478
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
479
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
480
+ if (r3) {
481
+ throw takeObject(r2);
482
+ }
483
+ var v3 = getCachedStringFromWasm0(r0, r1);
484
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
485
+ return v3;
486
+ } finally {
487
+ wasm.__wbindgen_add_to_stack_pointer(16);
169
488
  }
170
489
  }
171
- // errors
172
- if (val instanceof Error) {
173
- return `${val.name}: ${val.message}\n${val.stack}`;
174
- }
175
- // TODO we could test for more things here, like `Set`s and `Map`s.
176
- return className;
177
- }
178
-
179
- function handleError(f, args) {
180
- try {
181
- return f.apply(this, args);
182
- } catch (e) {
183
- wasm.__wbindgen_export3(addHeapObject(e));
184
- }
185
- }
186
-
187
- function getArrayU8FromWasm0(ptr, len) {
188
- ptr = ptr >>> 0;
189
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
190
- }
191
-
192
- function dropObject(idx) {
193
- if (idx < 132) return;
194
- heap[idx] = heap_next;
195
- heap_next = idx;
196
- }
197
-
198
- function takeObject(idx) {
199
- const ret = getObject(idx);
200
- dropObject(idx);
201
- return ret;
202
- }
203
-
204
- function getArrayJsValueFromWasm0(ptr, len) {
205
- ptr = ptr >>> 0;
206
- const mem = getDataViewMemory0();
207
- const result = [];
208
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
209
- result.push(takeObject(mem.getUint32(i, true)));
490
+ /**
491
+ * Returns the SQL query to get the column count of a view.
492
+ * @param {string} view_id
493
+ * @returns {string}
494
+ */
495
+ viewColumnSize(view_id) {
496
+ try {
497
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
498
+ const ptr0 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
499
+ const len0 = WASM_VECTOR_LEN;
500
+ wasm.genericsqlvirtualservermodel_viewColumnSize(retptr, this.__wbg_ptr, ptr0, len0);
501
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
502
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
503
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
504
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
505
+ if (r3) {
506
+ throw takeObject(r2);
507
+ }
508
+ var v2 = getCachedStringFromWasm0(r0, r1);
509
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
510
+ return v2;
511
+ } finally {
512
+ wasm.__wbindgen_add_to_stack_pointer(16);
513
+ }
210
514
  }
211
- return result;
212
- }
213
-
214
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
215
- ? { register: () => {}, unregister: () => {} }
216
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
217
-
218
- function makeMutClosure(arg0, arg1, dtor, f) {
219
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
220
- const real = (...args) => {
221
-
222
- // First up with a closure we increment the internal reference
223
- // count. This ensures that the Rust closure environment won't
224
- // be deallocated while we're invoking it.
225
- state.cnt++;
226
- const a = state.a;
227
- state.a = 0;
515
+ /**
516
+ * Returns the SQL query to delete a view.
517
+ * @param {string} view_id
518
+ * @returns {string}
519
+ */
520
+ viewDelete(view_id) {
228
521
  try {
229
- return f(a, state.b, ...args);
522
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
523
+ const ptr0 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
524
+ const len0 = WASM_VECTOR_LEN;
525
+ wasm.genericsqlvirtualservermodel_viewDelete(retptr, this.__wbg_ptr, ptr0, len0);
526
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
527
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
528
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
529
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
530
+ if (r3) {
531
+ throw takeObject(r2);
532
+ }
533
+ var v2 = getCachedStringFromWasm0(r0, r1);
534
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
535
+ return v2;
230
536
  } finally {
231
- state.a = a;
232
- real._wbg_cb_unref();
537
+ wasm.__wbindgen_add_to_stack_pointer(16);
233
538
  }
234
- };
235
- real._wbg_cb_unref = () => {
236
- if (--state.cnt === 0) {
237
- state.dtor(state.a, state.b);
238
- state.a = 0;
239
- CLOSURE_DTORS.unregister(state);
539
+ }
540
+ /**
541
+ * Returns the SQL query to fetch data from a view with the given viewport.
542
+ * @param {string} view_id
543
+ * @param {any} config
544
+ * @param {any} viewport
545
+ * @param {any} schema
546
+ * @returns {string}
547
+ */
548
+ viewGetData(view_id, config, viewport, schema) {
549
+ try {
550
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
551
+ const ptr0 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
552
+ const len0 = WASM_VECTOR_LEN;
553
+ wasm.genericsqlvirtualservermodel_viewGetData(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(config), addHeapObject(viewport), addHeapObject(schema));
554
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
555
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
556
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
557
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
558
+ if (r3) {
559
+ throw takeObject(r2);
560
+ }
561
+ var v2 = getCachedStringFromWasm0(r0, r1);
562
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
563
+ return v2;
564
+ } finally {
565
+ wasm.__wbindgen_add_to_stack_pointer(16);
240
566
  }
241
- };
242
- CLOSURE_DTORS.register(real, state, state);
243
- return real;
244
- }
245
-
246
- function makeClosure(arg0, arg1, dtor, f) {
247
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
248
- const real = (...args) => {
249
-
250
- // First up with a closure we increment the internal reference
251
- // count. This ensures that the Rust closure environment won't
252
- // be deallocated while we're invoking it.
253
- state.cnt++;
567
+ }
568
+ /**
569
+ * Returns the SQL query to describe a view's schema.
570
+ * @param {string} view_id
571
+ * @returns {string}
572
+ */
573
+ viewSchema(view_id) {
254
574
  try {
255
- return f(state.a, state.b, ...args);
575
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
576
+ const ptr0 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
577
+ const len0 = WASM_VECTOR_LEN;
578
+ wasm.genericsqlvirtualservermodel_viewSchema(retptr, this.__wbg_ptr, ptr0, len0);
579
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
580
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
581
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
582
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
583
+ if (r3) {
584
+ throw takeObject(r2);
585
+ }
586
+ var v2 = getCachedStringFromWasm0(r0, r1);
587
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
588
+ return v2;
256
589
  } finally {
257
- real._wbg_cb_unref();
590
+ wasm.__wbindgen_add_to_stack_pointer(16);
258
591
  }
259
- };
260
- real._wbg_cb_unref = () => {
261
- if (--state.cnt === 0) {
262
- state.dtor(state.a, state.b);
263
- state.a = 0;
264
- CLOSURE_DTORS.unregister(state);
592
+ }
593
+ /**
594
+ * Returns the SQL query to get the row count of a view.
595
+ * @param {string} view_id
596
+ * @returns {string}
597
+ */
598
+ viewSize(view_id) {
599
+ try {
600
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
601
+ const ptr0 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
602
+ const len0 = WASM_VECTOR_LEN;
603
+ wasm.genericsqlvirtualservermodel_viewSize(retptr, this.__wbg_ptr, ptr0, len0);
604
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
605
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
606
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
607
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
608
+ if (r3) {
609
+ throw takeObject(r2);
610
+ }
611
+ var v2 = getCachedStringFromWasm0(r0, r1);
612
+ if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
613
+ return v2;
614
+ } finally {
615
+ wasm.__wbindgen_add_to_stack_pointer(16);
265
616
  }
266
- };
267
- CLOSURE_DTORS.register(real, state, state);
268
- return real;
269
- }
270
-
271
- function _assertClass(instance, klass) {
272
- if (!(instance instanceof klass)) {
273
- throw new Error(`expected instance of ${klass.name}`);
274
617
  }
275
618
  }
619
+ if (Symbol.dispose) GenericSQLVirtualServerModel.prototype[Symbol.dispose] = GenericSQLVirtualServerModel.prototype.free;
276
620
 
277
- let stack_pointer = 128;
278
-
279
- function addBorrowedObject(obj) {
280
- if (stack_pointer == 1) throw new Error('out of js stack');
281
- heap[--stack_pointer] = obj;
282
- return stack_pointer;
283
- }
284
-
285
- function passArray8ToWasm0(arg, malloc) {
286
- const ptr = malloc(arg.length * 1, 1) >>> 0;
287
- getUint8ArrayMemory0().set(arg, ptr / 1);
288
- WASM_VECTOR_LEN = arg.length;
289
- return ptr;
290
- }
291
-
292
- export function init() {
293
- wasm.init();
294
- }
295
-
296
- function __wasm_bindgen_func_elem_553(arg0, arg1) {
297
- const ret = wasm.__wasm_bindgen_func_elem_553(arg0, arg1);
298
- return takeObject(ret);
299
- }
300
-
301
- function __wasm_bindgen_func_elem_3515(arg0, arg1, arg2) {
302
- wasm.__wasm_bindgen_func_elem_3515(arg0, arg1, addHeapObject(arg2));
303
- }
304
-
305
- function __wasm_bindgen_func_elem_5070(arg0, arg1, arg2, arg3) {
306
- wasm.__wasm_bindgen_func_elem_5070(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
307
- }
308
-
309
- const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
310
- ? { register: () => {}, unregister: () => {} }
311
- : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
312
- /**
313
- * An instance of a [`Client`] is a connection to a single
314
- * `perspective_server::Server`, whether locally in-memory or remote over some
315
- * transport like a WebSocket.
316
- *
317
- * The browser and node.js libraries both support the `websocket(url)`
318
- * constructor, which connects to a remote `perspective_server::Server`
319
- * instance over a WebSocket transport.
320
- *
321
- * In the browser, the `worker()` constructor creates a new Web Worker
322
- * `perspective_server::Server` and returns a [`Client`] connected to it.
323
- *
324
- * In node.js, a pre-instantied [`Client`] connected synhronously to a global
325
- * singleton `perspective_server::Server` is the default module export.
326
- *
327
- * # JavaScript Examples
328
- *
329
- * Create a Web Worker `perspective_server::Server` in the browser and return a
330
- * [`Client`] instance connected for it:
331
- *
332
- * ```javascript
333
- * import perspective from "@perspective-dev/client";
334
- * const client = await perspective.worker();
335
- * ```
336
- *
337
- * Create a WebSocket connection to a remote `perspective_server::Server`:
338
- *
339
- * ```javascript
340
- * import perspective from "@perspective-dev/client";
341
- * const client = await perspective.websocket("ws://locahost:8080/ws");
342
- * ```
343
- *
344
- * Access the synchronous client in node.js:
345
- *
346
- * ```javascript
347
- * import { default as client } from "@perspective-dev/client";
348
- * ```
349
- */
350
- export class Client {
621
+ export class ProxySession {
622
+ static __wrap(ptr) {
623
+ ptr = ptr >>> 0;
624
+ const obj = Object.create(ProxySession.prototype);
625
+ obj.__wbg_ptr = ptr;
626
+ ProxySessionFinalization.register(obj, obj.__wbg_ptr, obj);
627
+ return obj;
628
+ }
629
+ __destroy_into_raw() {
630
+ const ptr = this.__wbg_ptr;
631
+ this.__wbg_ptr = 0;
632
+ ProxySessionFinalization.unregister(this);
633
+ return ptr;
634
+ }
635
+ free() {
636
+ const ptr = this.__destroy_into_raw();
637
+ wasm.__wbg_proxysession_free(ptr, 0);
638
+ }
639
+ /**
640
+ * @returns {Promise<void>}
641
+ */
642
+ close() {
643
+ const ptr = this.__destroy_into_raw();
644
+ const ret = wasm.proxysession_close(ptr);
645
+ return takeObject(ret);
646
+ }
647
+ /**
648
+ * @param {any} value
649
+ * @returns {Promise<void>}
650
+ */
651
+ handle_request(value) {
652
+ const ret = wasm.proxysession_handle_request(this.__wbg_ptr, addHeapObject(value));
653
+ return takeObject(ret);
654
+ }
655
+ /**
656
+ * @param {Client} client
657
+ * @param {Function} on_response
658
+ */
659
+ constructor(client, on_response) {
660
+ try {
661
+ _assertClass(client, Client);
662
+ const ret = wasm.proxysession_new(client.__wbg_ptr, addBorrowedObject(on_response));
663
+ this.__wbg_ptr = ret >>> 0;
664
+ ProxySessionFinalization.register(this, this.__wbg_ptr, this);
665
+ return this;
666
+ } finally {
667
+ heap[stack_pointer++] = undefined;
668
+ }
669
+ }
670
+ }
671
+ if (Symbol.dispose) ProxySession.prototype[Symbol.dispose] = ProxySession.prototype.free;
351
672
 
673
+ export class Table {
352
674
  static __wrap(ptr) {
353
675
  ptr = ptr >>> 0;
354
- const obj = Object.create(Client.prototype);
676
+ const obj = Object.create(Table.prototype);
355
677
  obj.__wbg_ptr = ptr;
356
- ClientFinalization.register(obj, obj.__wbg_ptr, obj);
678
+ TableFinalization.register(obj, obj.__wbg_ptr, obj);
357
679
  return obj;
358
680
  }
359
-
360
681
  __destroy_into_raw() {
361
682
  const ptr = this.__wbg_ptr;
362
683
  this.__wbg_ptr = 0;
363
- ClientFinalization.unregister(this);
684
+ TableFinalization.unregister(this);
364
685
  return ptr;
365
686
  }
366
-
367
687
  free() {
368
688
  const ptr = this.__destroy_into_raw();
369
- wasm.__wbg_client_free(ptr, 0);
689
+ wasm.__wbg_table_free(ptr, 0);
370
690
  }
371
691
  /**
372
692
  * @returns {string}
@@ -374,7 +694,7 @@ export class Client {
374
694
  __getClassname() {
375
695
  try {
376
696
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
377
- wasm.client___getClassname(retptr, this.__wbg_ptr);
697
+ wasm.table___getClassname(retptr, this.__wbg_ptr);
378
698
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
379
699
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
380
700
  var v1 = getCachedStringFromWasm0(r0, r1);
@@ -385,1790 +705,1748 @@ export class Client {
385
705
  }
386
706
  }
387
707
  /**
388
- * @param {Function} send_request
389
- * @param {Function | null} [close]
390
- */
391
- constructor(send_request, close) {
392
- try {
393
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
394
- wasm.client_new(retptr, addHeapObject(send_request), isLikeNone(close) ? 0 : addHeapObject(close));
395
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
396
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
397
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
398
- if (r2) {
399
- throw takeObject(r1);
400
- }
401
- this.__wbg_ptr = r0 >>> 0;
402
- ClientFinalization.register(this, this.__wbg_ptr, this);
403
- return this;
404
- } finally {
405
- wasm.__wbindgen_add_to_stack_pointer(16);
406
- }
407
- }
408
- /**
409
- * @param {Function} on_response
410
- * @returns {ProxySession}
411
- */
412
- new_proxy_session(on_response) {
413
- try {
414
- const ret = wasm.client_new_proxy_session(this.__wbg_ptr, addBorrowedObject(on_response));
415
- return ProxySession.__wrap(ret);
416
- } finally {
417
- heap[stack_pointer++] = undefined;
418
- }
419
- }
420
- /**
421
- * @param {any} value
422
- * @returns {Promise<void>}
423
- */
424
- handle_response(value) {
425
- const ret = wasm.client_handle_response(this.__wbg_ptr, addHeapObject(value));
426
- return takeObject(ret);
427
- }
428
- /**
429
- * @param {string} error
430
- * @param {Function | null} [reconnect]
708
+ * Removes all the rows in the [`Table`], but preserves everything else
709
+ * including the schema, index, and any callbacks or registered
710
+ * [`View`] instances.
711
+ *
712
+ * Calling [`Table::clear`], like [`Table::update`] and [`Table::remove`],
713
+ * will trigger an update event to any registered listeners via
714
+ * [`View::on_update`].
431
715
  * @returns {Promise<void>}
432
716
  */
433
- handle_error(error, reconnect) {
434
- const ptr0 = passStringToWasm0(error, wasm.__wbindgen_export, wasm.__wbindgen_export2);
435
- const len0 = WASM_VECTOR_LEN;
436
- const ret = wasm.client_handle_error(this.__wbg_ptr, ptr0, len0, isLikeNone(reconnect) ? 0 : addHeapObject(reconnect));
717
+ clear() {
718
+ const ret = wasm.table_clear(this.__wbg_ptr);
437
719
  return takeObject(ret);
438
720
  }
439
721
  /**
440
- * @param {Function} callback
441
- * @returns {Promise<number>}
722
+ * Returns the column names of this [`Table`] in "natural" order (the
723
+ * ordering implied by the input format).
724
+ *
725
+ * # JavaScript Examples
726
+ *
727
+ * ```javascript
728
+ * const columns = await table.columns();
729
+ * ```
730
+ * @returns {Promise<any>}
442
731
  */
443
- on_error(callback) {
444
- const ret = wasm.client_on_error(this.__wbg_ptr, addHeapObject(callback));
732
+ columns() {
733
+ const ret = wasm.table_columns(this.__wbg_ptr);
445
734
  return takeObject(ret);
446
735
  }
447
736
  /**
448
- * Creates a new [`Table`] from either a _schema_ or _data_.
449
- *
450
- * The [`Client::table`] factory function can be initialized with either a
451
- * _schema_ (see [`Table::schema`]), or data in one of these formats:
452
- *
453
- * - Apache Arrow
454
- * - CSV
455
- * - JSON row-oriented
456
- * - JSON column-oriented
457
- * - NDJSON
458
- *
459
- * When instantiated with _data_, the schema is inferred from this data.
460
- * While this is convenient, inferrence is sometimes imperfect e.g.
461
- * when the input is empty, null or ambiguous. For these cases,
462
- * [`Client::table`] can first be instantiated with a explicit schema.
463
- *
464
- * When instantiated with a _schema_, the resulting [`Table`] is empty but
465
- * with known column names and column types. When subsqeuently
466
- * populated with [`Table::update`], these columns will be _coerced_ to
467
- * the schema's type. This behavior can be useful when
468
- * [`Client::table`]'s column type inferences doesn't work.
737
+ * Delete this [`Table`] and cleans up associated resources.
469
738
  *
470
- * The resulting [`Table`] is _virtual_, and invoking its methods
471
- * dispatches events to the `perspective_server::Server` this
472
- * [`Client`] connects to, where the data is stored and all calculation
473
- * occurs.
739
+ * [`Table`]s do not stop consuming resources or processing updates when
740
+ * they are garbage collected in their host language - you must call
741
+ * this method to reclaim these.
474
742
  *
475
743
  * # Arguments
476
744
  *
477
- * - `arg` - Either _schema_ or initialization _data_.
478
- * - `options` - Optional configuration which provides one of:
479
- * - `limit` - The max number of rows the resulting [`Table`] can
480
- * store.
481
- * - `index` - The column name to use as an _index_ column. If this
482
- * `Table` is being instantiated by _data_, this column name must be
483
- * present in the data.
484
- * - `name` - The name of the table. This will be generated if it is
485
- * not provided.
486
- * - `format` - The explicit format of the input data, can be one of
487
- * `"json"`, `"columns"`, `"csv"` or `"arrow"`. This overrides
488
- * language-specific type dispatch behavior, which allows stringified
489
- * and byte array alternative inputs.
745
+ * - `options` An options dictionary.
746
+ * - `lazy` Whether to delete this [`Table`] _lazily_. When false (the
747
+ * default), the delete will occur immediately, assuming it has no
748
+ * [`View`] instances registered to it (which must be deleted first,
749
+ * otherwise this method will throw an error). When true, the
750
+ * [`Table`] will only be marked for deltion once its [`View`]
751
+ * dependency count reaches 0.
490
752
  *
491
753
  * # JavaScript Examples
492
754
  *
493
- * Load a CSV from a `string`:
494
- *
495
755
  * ```javascript
496
756
  * const table = await client.table("x,y\n1,2\n3,4");
497
- * ```
498
- *
499
- * Load an Arrow from an `ArrayBuffer`:
500
- *
501
- * ```javascript
502
- * import * as fs from "node:fs/promises";
503
- * const table2 = await client.table(await fs.readFile("superstore.arrow"));
504
- * ```
505
- *
506
- * Load a CSV from a `UInt8Array` (the default for this type is Arrow)
507
- * using a format override:
508
- *
509
- * ```javascript
510
- * const enc = new TextEncoder();
511
- * const table = await client.table(enc.encode("x,y\n1,2\n3,4"), {
512
- * format: "csv",
513
- * });
514
- * ```
515
- *
516
- * Create a table with an `index`:
517
- *
518
- * ```javascript
519
- * const table = await client.table(data, { index: "Row ID" });
520
- * ```
521
- * @param {string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>} value
522
- * @param {TableInitOptions | null} [options]
523
- * @returns {Promise<Table>}
524
- */
525
- table(value, options) {
526
- const ret = wasm.client_table(this.__wbg_ptr, addHeapObject(value), isLikeNone(options) ? 0 : addHeapObject(options));
527
- return takeObject(ret);
528
- }
529
- /**
530
- * Terminates this [`Client`], cleaning up any [`crate::View`] handles the
531
- * [`Client`] has open as well as its callbacks.
532
- * @returns {any}
533
- */
534
- terminate() {
535
- try {
536
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
537
- wasm.client_terminate(retptr, this.__wbg_ptr);
538
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
539
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
540
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
541
- if (r2) {
542
- throw takeObject(r1);
543
- }
544
- return takeObject(r0);
545
- } finally {
546
- wasm.__wbindgen_add_to_stack_pointer(16);
547
- }
548
- }
549
- /**
550
- * Opens a [`Table`] that is hosted on the `perspective_server::Server`
551
- * that is connected to this [`Client`].
552
- *
553
- * The `name` property of [`TableInitOptions`] is used to identify each
554
- * [`Table`]. [`Table`] `name`s can be looked up for each [`Client`]
555
- * via [`Client::get_hosted_table_names`].
556
- *
557
- * # JavaScript Examples
558
- *
559
- * Get a virtual [`Table`] named "table_one" from this [`Client`]
560
- *
561
- * ```javascript
562
- * const tables = await client.open_table("table_one");
563
- * ```
564
- * @param {string} entity_id
565
- * @returns {Promise<Table>}
566
- */
567
- open_table(entity_id) {
568
- const ptr0 = passStringToWasm0(entity_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
569
- const len0 = WASM_VECTOR_LEN;
570
- const ret = wasm.client_open_table(this.__wbg_ptr, ptr0, len0);
571
- return takeObject(ret);
572
- }
573
- /**
574
- * Retrieves the names of all tables that this client has access to.
575
- *
576
- * `name` is a string identifier unique to the [`Table`] (per [`Client`]),
577
- * which can be used in conjunction with [`Client::open_table`] to get
578
- * a [`Table`] instance without the use of [`Client::table`]
579
- * constructor directly (e.g., one created by another [`Client`]).
580
757
  *
581
- * # JavaScript Examples
758
+ * // ...
582
759
  *
583
- * ```javascript
584
- * const tables = await client.get_hosted_table_names();
760
+ * await table.delete({ lazy: true });
585
761
  * ```
586
- * @returns {Promise<string[]>}
587
- */
588
- get_hosted_table_names() {
589
- const ret = wasm.client_get_hosted_table_names(this.__wbg_ptr);
590
- return takeObject(ret);
591
- }
592
- /**
593
- * Register a callback which is invoked whenever [`Client::table`] (on this
594
- * [`Client`]) or [`Table::delete`] (on a [`Table`] belinging to this
595
- * [`Client`]) are called.
596
- * @param {Function} on_update_js
597
- * @returns {Promise<number>}
762
+ * @param {DeleteOptions | null} [options]
763
+ * @returns {Promise<void>}
598
764
  */
599
- on_hosted_tables_update(on_update_js) {
600
- const ret = wasm.client_on_hosted_tables_update(this.__wbg_ptr, addHeapObject(on_update_js));
765
+ delete(options) {
766
+ const ptr = this.__destroy_into_raw();
767
+ const ret = wasm.table_delete(ptr, isLikeNone(options) ? 0 : addHeapObject(options));
601
768
  return takeObject(ret);
602
769
  }
603
770
  /**
604
- * Remove a callback previously registered via
605
- * `Client::on_hosted_tables_update`.
606
- * @param {number} update_id
607
- * @returns {Promise<void>}
771
+ * Get a copy of the [`Client`] this [`Table`] came from.
772
+ * @returns {Promise<Client>}
608
773
  */
609
- remove_hosted_tables_update(update_id) {
610
- const ret = wasm.client_remove_hosted_tables_update(this.__wbg_ptr, update_id);
774
+ get_client() {
775
+ const ret = wasm.table_get_client(this.__wbg_ptr);
611
776
  return takeObject(ret);
612
777
  }
613
778
  /**
614
- * Provides the [`SystemInfo`] struct, implementation-specific metadata
615
- * about the [`perspective_server::Server`] runtime such as Memory and
616
- * CPU usage.
617
- *
618
- * For WebAssembly servers, this method includes the WebAssembly heap size.
779
+ * Returns the name of the index column for the table.
619
780
  *
620
781
  * # JavaScript Examples
621
782
  *
622
783
  * ```javascript
623
- * const info = await client.system_info();
784
+ * const table = await client.table("x,y\n1,2\n3,4", { index: "x" });
785
+ * const index = table.get_index(); // "x"
624
786
  * ```
625
- * @returns {Promise<SystemInfo>}
787
+ * @returns {Promise<string>}
626
788
  */
627
- system_info() {
628
- const ret = wasm.client_system_info(this.__wbg_ptr);
789
+ get_index() {
790
+ const ret = wasm.table_get_index(this.__wbg_ptr);
629
791
  return takeObject(ret);
630
792
  }
631
- }
632
- if (Symbol.dispose) Client.prototype[Symbol.dispose] = Client.prototype.free;
633
-
634
- const JsVirtualDataSliceFinalization = (typeof FinalizationRegistry === 'undefined')
635
- ? { register: () => {}, unregister: () => {} }
636
- : new FinalizationRegistry(ptr => wasm.__wbg_jsvirtualdataslice_free(ptr >>> 0, 1));
637
-
638
- export class JsVirtualDataSlice {
639
-
640
- static __wrap(ptr) {
641
- ptr = ptr >>> 0;
642
- const obj = Object.create(JsVirtualDataSlice.prototype);
643
- obj.__wbg_ptr = ptr;
644
- JsVirtualDataSliceFinalization.register(obj, obj.__wbg_ptr, obj);
645
- return obj;
646
- }
647
-
648
- __destroy_into_raw() {
649
- const ptr = this.__wbg_ptr;
650
- this.__wbg_ptr = 0;
651
- JsVirtualDataSliceFinalization.unregister(this);
652
- return ptr;
653
- }
654
-
655
- free() {
656
- const ptr = this.__destroy_into_raw();
657
- wasm.__wbg_jsvirtualdataslice_free(ptr, 0);
658
- }
659
- constructor() {
660
- const ret = wasm.jsvirtualdataslice_new();
661
- this.__wbg_ptr = ret >>> 0;
662
- JsVirtualDataSliceFinalization.register(this, this.__wbg_ptr, this);
663
- return this;
793
+ /**
794
+ * Returns the user-specified row limit for this table.
795
+ * @returns {Promise<number | undefined>}
796
+ */
797
+ get_limit() {
798
+ const ret = wasm.table_get_limit(this.__wbg_ptr);
799
+ return takeObject(ret);
664
800
  }
665
801
  /**
666
- * @param {string} dtype
667
- * @param {string} name
668
- * @param {number} index
669
- * @param {any} val
670
- * @param {number | null} [group_by_index]
802
+ * Returns the user-specified name for this table, or the auto-generated
803
+ * name if a name was not specified when the table was created.
804
+ * @returns {Promise<string>}
671
805
  */
672
- setCol(dtype, name, index, val, group_by_index) {
673
- try {
674
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
675
- const ptr0 = passStringToWasm0(dtype, wasm.__wbindgen_export, wasm.__wbindgen_export2);
676
- const len0 = WASM_VECTOR_LEN;
677
- const ptr1 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
678
- const len1 = WASM_VECTOR_LEN;
679
- wasm.jsvirtualdataslice_setCol(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
680
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
681
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
682
- if (r1) {
683
- throw takeObject(r0);
684
- }
685
- } finally {
686
- wasm.__wbindgen_add_to_stack_pointer(16);
687
- }
806
+ get_name() {
807
+ const ret = wasm.table_get_name(this.__wbg_ptr);
808
+ return takeObject(ret);
688
809
  }
689
810
  /**
690
- * @param {string} name
691
- * @param {number} index
692
- * @param {any} val
693
- * @param {number | null} [group_by_index]
811
+ * Create a unique channel ID on this [`Table`], which allows
812
+ * `View::on_update` callback calls to be associated with the
813
+ * `Table::update` which caused them.
814
+ * @returns {Promise<number>}
694
815
  */
695
- setStringCol(name, index, val, group_by_index) {
696
- try {
697
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
698
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
699
- const len0 = WASM_VECTOR_LEN;
700
- wasm.jsvirtualdataslice_setStringCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
701
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
702
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
703
- if (r1) {
704
- throw takeObject(r0);
705
- }
706
- } finally {
707
- wasm.__wbindgen_add_to_stack_pointer(16);
708
- }
816
+ make_port() {
817
+ const ret = wasm.table_make_port(this.__wbg_ptr);
818
+ return takeObject(ret);
709
819
  }
710
820
  /**
711
- * @param {string} name
712
- * @param {number} index
713
- * @param {any} val
714
- * @param {number | null} [group_by_index]
821
+ * Register a callback which is called exactly once, when this [`Table`] is
822
+ * deleted with the [`Table::delete`] method.
823
+ *
824
+ * [`Table::on_delete`] resolves when the subscription message is sent, not
825
+ * when the _delete_ event occurs.
826
+ * @param {Function} on_delete
827
+ * @returns {Promise<any>}
715
828
  */
716
- setIntegerCol(name, index, val, group_by_index) {
717
- try {
718
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
719
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
720
- const len0 = WASM_VECTOR_LEN;
721
- wasm.jsvirtualdataslice_setIntegerCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
722
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
723
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
724
- if (r1) {
725
- throw takeObject(r0);
726
- }
727
- } finally {
728
- wasm.__wbindgen_add_to_stack_pointer(16);
729
- }
829
+ on_delete(on_delete) {
830
+ const ret = wasm.table_on_delete(this.__wbg_ptr, addHeapObject(on_delete));
831
+ return takeObject(ret);
730
832
  }
731
833
  /**
732
- * @param {string} name
733
- * @param {number} index
734
- * @param {any} val
735
- * @param {number | null} [group_by_index]
834
+ * Removes rows from this [`Table`] with the `index` column values
835
+ * supplied.
836
+ *
837
+ * # Arguments
838
+ *
839
+ * - `indices` - A list of `index` column values for rows that should be
840
+ * removed.
841
+ *
842
+ * # JavaScript Examples
843
+ *
844
+ * ```javascript
845
+ * await table.remove([1, 2, 3]);
846
+ * ```
847
+ * @param {any} value
848
+ * @param {UpdateOptions | null} [options]
849
+ * @returns {Promise<void>}
736
850
  */
737
- setFloatCol(name, index, val, group_by_index) {
738
- try {
739
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
740
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
741
- const len0 = WASM_VECTOR_LEN;
742
- wasm.jsvirtualdataslice_setFloatCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
743
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
744
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
745
- if (r1) {
746
- throw takeObject(r0);
747
- }
748
- } finally {
749
- wasm.__wbindgen_add_to_stack_pointer(16);
750
- }
851
+ remove(value, options) {
852
+ const ret = wasm.table_remove(this.__wbg_ptr, addHeapObject(value), isLikeNone(options) ? 0 : addHeapObject(options));
853
+ return takeObject(ret);
751
854
  }
752
855
  /**
753
- * @param {string} name
754
- * @param {number} index
755
- * @param {any} val
756
- * @param {number | null} [group_by_index]
856
+ * Removes a listener with a given ID, as returned by a previous call to
857
+ * [`Table::on_delete`].
858
+ * @param {number} callback_id
859
+ * @returns {Promise<any>}
757
860
  */
758
- setBooleanCol(name, index, val, group_by_index) {
759
- try {
760
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
761
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
762
- const len0 = WASM_VECTOR_LEN;
763
- wasm.jsvirtualdataslice_setBooleanCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
764
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
765
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
766
- if (r1) {
767
- throw takeObject(r0);
768
- }
769
- } finally {
770
- wasm.__wbindgen_add_to_stack_pointer(16);
771
- }
861
+ remove_delete(callback_id) {
862
+ const ret = wasm.table_remove_delete(this.__wbg_ptr, callback_id);
863
+ return takeObject(ret);
772
864
  }
773
865
  /**
774
- * @param {string} name
775
- * @param {number} index
776
- * @param {any} val
777
- * @param {number | null} [group_by_index]
866
+ * Replace all rows in this [`Table`] with the input data, coerced to this
867
+ * [`Table`]'s existing [`perspective_client::Schema`], notifying any
868
+ * derived [`View`] and [`View::on_update`] callbacks.
869
+ *
870
+ * Calling [`Table::replace`] is an easy way to replace _all_ the data in a
871
+ * [`Table`] without losing any derived [`View`] instances or
872
+ * [`View::on_update`] callbacks. [`Table::replace`] does _not_ infer
873
+ * data types like [`Client::table`] does, rather it _coerces_ input
874
+ * data to the `Schema` like [`Table::update`]. If you need a [`Table`]
875
+ * with a different `Schema`, you must create a new one.
876
+ *
877
+ * # JavaScript Examples
878
+ *
879
+ * ```javascript
880
+ * await table.replace("x,y\n1,2");
881
+ * ```
882
+ * @param {any} input
883
+ * @param {UpdateOptions | null} [options]
884
+ * @returns {Promise<void>}
778
885
  */
779
- setDatetimeCol(name, index, val, group_by_index) {
780
- try {
781
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
782
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
783
- const len0 = WASM_VECTOR_LEN;
784
- wasm.jsvirtualdataslice_setDatetimeCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
785
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
786
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
787
- if (r1) {
788
- throw takeObject(r0);
789
- }
790
- } finally {
791
- wasm.__wbindgen_add_to_stack_pointer(16);
792
- }
886
+ replace(input, options) {
887
+ const ret = wasm.table_replace(this.__wbg_ptr, addHeapObject(input), isLikeNone(options) ? 0 : addHeapObject(options));
888
+ return takeObject(ret);
793
889
  }
794
- }
795
- if (Symbol.dispose) JsVirtualDataSlice.prototype[Symbol.dispose] = JsVirtualDataSlice.prototype.free;
796
-
797
- const JsVirtualServerFinalization = (typeof FinalizationRegistry === 'undefined')
798
- ? { register: () => {}, unregister: () => {} }
799
- : new FinalizationRegistry(ptr => wasm.__wbg_jsvirtualserver_free(ptr >>> 0, 1));
800
-
801
- export class JsVirtualServer {
802
-
803
- __destroy_into_raw() {
804
- const ptr = this.__wbg_ptr;
805
- this.__wbg_ptr = 0;
806
- JsVirtualServerFinalization.unregister(this);
807
- return ptr;
890
+ /**
891
+ * Returns a table's [`Schema`], a mapping of column names to column types.
892
+ *
893
+ * The mapping of a [`Table`]'s column names to data types is referred to
894
+ * as a [`Schema`]. Each column has a unique name and a data type, one
895
+ * of:
896
+ *
897
+ * - `"boolean"` - A boolean type
898
+ * - `"date"` - A timesonze-agnostic date type (month/day/year)
899
+ * - `"datetime"` - A millisecond-precision datetime type in the UTC
900
+ * timezone
901
+ * - `"float"` - A 64 bit float
902
+ * - `"integer"` - A signed 32 bit integer (the integer type supported by
903
+ * JavaScript)
904
+ * - `"string"` - A [`String`] data type (encoded internally as a
905
+ * _dictionary_)
906
+ *
907
+ * Note that all [`Table`] columns are _nullable_, regardless of the data
908
+ * type.
909
+ * @returns {Record<string, ColumnType>}
910
+ */
911
+ schema() {
912
+ const ret = wasm.table_schema(this.__wbg_ptr);
913
+ return takeObject(ret);
808
914
  }
809
-
810
- free() {
811
- const ptr = this.__destroy_into_raw();
812
- wasm.__wbg_jsvirtualserver_free(ptr, 0);
915
+ /**
916
+ * Returns the number of rows in a [`Table`].
917
+ * @returns {Promise<number>}
918
+ */
919
+ size() {
920
+ const ret = wasm.table_size(this.__wbg_ptr);
921
+ return takeObject(ret);
813
922
  }
814
923
  /**
815
- * @param {object} handler
924
+ * Updates the rows of this table and any derived [`View`] instances.
925
+ *
926
+ * Calling [`Table::update`] will trigger the [`View::on_update`] callbacks
927
+ * register to derived [`View`], and the call itself will not resolve until
928
+ * _all_ derived [`View`]'s are notified.
929
+ *
930
+ * When updating a [`Table`] with an `index`, [`Table::update`] supports
931
+ * partial updates, by omitting columns from the update data.
932
+ *
933
+ * # Arguments
934
+ *
935
+ * - `input` - The input data for this [`Table`]. The schema of a [`Table`]
936
+ * is immutable after creation, so this method cannot be called with a
937
+ * schema.
938
+ * - `options` - Options for this update step - see [`UpdateOptions`].
939
+ *
940
+ * # JavaScript Examples
941
+ *
942
+ * ```javascript
943
+ * await table.update("x,y\n1,2");
944
+ * ```
945
+ * @param {string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>} input
946
+ * @param {UpdateOptions | null} [options]
947
+ * @returns {Promise<any>}
816
948
  */
817
- constructor(handler) {
818
- try {
819
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
820
- wasm.jsvirtualserver_new(retptr, addHeapObject(handler));
821
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
822
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
823
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
824
- if (r2) {
825
- throw takeObject(r1);
826
- }
827
- this.__wbg_ptr = r0 >>> 0;
828
- JsVirtualServerFinalization.register(this, this.__wbg_ptr, this);
829
- return this;
830
- } finally {
831
- wasm.__wbindgen_add_to_stack_pointer(16);
832
- }
949
+ update(input, options) {
950
+ const ret = wasm.table_update(this.__wbg_ptr, addHeapObject(input), isLikeNone(options) ? 0 : addHeapObject(options));
951
+ return takeObject(ret);
833
952
  }
834
953
  /**
835
- * @param {Uint8Array} bytes
954
+ * Validates the given expressions.
955
+ * @param {any} exprs
836
956
  * @returns {Promise<any>}
837
957
  */
838
- handleRequest(bytes) {
839
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
840
- const len0 = WASM_VECTOR_LEN;
841
- const ret = wasm.jsvirtualserver_handleRequest(this.__wbg_ptr, ptr0, len0);
958
+ validate_expressions(exprs) {
959
+ const ret = wasm.table_validate_expressions(this.__wbg_ptr, addHeapObject(exprs));
960
+ return takeObject(ret);
961
+ }
962
+ /**
963
+ * Create a new [`View`] from this table with a specified
964
+ * [`ViewConfigUpdate`].
965
+ *
966
+ * See [`View`] struct.
967
+ *
968
+ * # JavaScript Examples
969
+ *
970
+ * ```javascript
971
+ * const view = await table.view({
972
+ * columns: ["Sales"],
973
+ * aggregates: { Sales: "sum" },
974
+ * group_by: ["Region", "Country"],
975
+ * filter: [["Category", "in", ["Furniture", "Technology"]]],
976
+ * });
977
+ * ```
978
+ * @param {ViewConfigUpdate | null} [config]
979
+ * @returns {Promise<View>}
980
+ */
981
+ view(config) {
982
+ const ret = wasm.table_view(this.__wbg_ptr, isLikeNone(config) ? 0 : addHeapObject(config));
842
983
  return takeObject(ret);
843
984
  }
844
985
  }
845
- if (Symbol.dispose) JsVirtualServer.prototype[Symbol.dispose] = JsVirtualServer.prototype.free;
846
-
847
- const ProxySessionFinalization = (typeof FinalizationRegistry === 'undefined')
848
- ? { register: () => {}, unregister: () => {} }
849
- : new FinalizationRegistry(ptr => wasm.__wbg_proxysession_free(ptr >>> 0, 1));
850
-
851
- export class ProxySession {
986
+ if (Symbol.dispose) Table.prototype[Symbol.dispose] = Table.prototype.free;
852
987
 
988
+ /**
989
+ * The [`View`] struct is Perspective's query and serialization interface. It
990
+ * represents a query on the `Table`'s dataset and is always created from an
991
+ * existing `Table` instance via the [`Table::view`] method.
992
+ *
993
+ * [`View`]s are immutable with respect to the arguments provided to the
994
+ * [`Table::view`] method; to change these parameters, you must create a new
995
+ * [`View`] on the same [`Table`]. However, each [`View`] is _live_ with
996
+ * respect to the [`Table`]'s data, and will (within a conflation window)
997
+ * update with the latest state as its parent [`Table`] updates, including
998
+ * incrementally recalculating all aggregates, pivots, filters, etc. [`View`]
999
+ * query parameters are composable, in that each parameter works independently
1000
+ * _and_ in conjunction with each other, and there is no limit to the number of
1001
+ * pivots, filters, etc. which can be applied.
1002
+ */
1003
+ export class View {
853
1004
  static __wrap(ptr) {
854
1005
  ptr = ptr >>> 0;
855
- const obj = Object.create(ProxySession.prototype);
1006
+ const obj = Object.create(View.prototype);
856
1007
  obj.__wbg_ptr = ptr;
857
- ProxySessionFinalization.register(obj, obj.__wbg_ptr, obj);
1008
+ ViewFinalization.register(obj, obj.__wbg_ptr, obj);
858
1009
  return obj;
859
1010
  }
860
-
1011
+ static __unwrap(jsValue) {
1012
+ if (!(jsValue instanceof View)) {
1013
+ return 0;
1014
+ }
1015
+ return jsValue.__destroy_into_raw();
1016
+ }
861
1017
  __destroy_into_raw() {
862
1018
  const ptr = this.__wbg_ptr;
863
1019
  this.__wbg_ptr = 0;
864
- ProxySessionFinalization.unregister(this);
1020
+ ViewFinalization.unregister(this);
865
1021
  return ptr;
866
1022
  }
867
-
868
1023
  free() {
869
1024
  const ptr = this.__destroy_into_raw();
870
- wasm.__wbg_proxysession_free(ptr, 0);
1025
+ wasm.__wbg_view_free(ptr, 0);
871
1026
  }
872
1027
  /**
873
- * @param {Client} client
874
- * @param {Function} on_response
1028
+ * @returns {View}
875
1029
  */
876
- constructor(client, on_response) {
877
- try {
878
- _assertClass(client, Client);
879
- const ret = wasm.client_new_proxy_session(client.__wbg_ptr, addBorrowedObject(on_response));
880
- this.__wbg_ptr = ret >>> 0;
881
- ProxySessionFinalization.register(this, this.__wbg_ptr, this);
882
- return this;
883
- } finally {
884
- heap[stack_pointer++] = undefined;
885
- }
1030
+ __get_model() {
1031
+ const ret = wasm.view___get_model(this.__wbg_ptr);
1032
+ return View.__wrap(ret);
886
1033
  }
887
1034
  /**
888
- * @param {any} value
889
- * @returns {Promise<void>}
1035
+ * Collapses the `group_by` row at `row_index`.
1036
+ * @param {number} row_index
1037
+ * @returns {Promise<number>}
890
1038
  */
891
- handle_request(value) {
892
- const ret = wasm.proxysession_handle_request(this.__wbg_ptr, addHeapObject(value));
1039
+ collapse(row_index) {
1040
+ const ret = wasm.view_collapse(this.__wbg_ptr, row_index);
1041
+ return takeObject(ret);
1042
+ }
1043
+ /**
1044
+ * Returns an array of strings containing the column paths of the [`View`]
1045
+ * without any of the source columns.
1046
+ *
1047
+ * A column path shows the columns that a given cell belongs to after
1048
+ * pivots are applied.
1049
+ * @param {ColumnWindow | null} [window]
1050
+ * @returns {Promise<any>}
1051
+ */
1052
+ column_paths(window) {
1053
+ const ret = wasm.view_column_paths(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
893
1054
  return takeObject(ret);
894
1055
  }
895
1056
  /**
1057
+ * Delete this [`View`] and clean up all resources associated with it.
1058
+ * [`View`] objects do not stop consuming resources or processing
1059
+ * updates when they are garbage collected - you must call this method
1060
+ * to reclaim these.
896
1061
  * @returns {Promise<void>}
897
1062
  */
898
- close() {
1063
+ delete() {
899
1064
  const ptr = this.__destroy_into_raw();
900
- const ret = wasm.proxysession_close(ptr);
1065
+ const ret = wasm.view_delete(ptr);
901
1066
  return takeObject(ret);
902
1067
  }
903
- }
904
- if (Symbol.dispose) ProxySession.prototype[Symbol.dispose] = ProxySession.prototype.free;
905
-
906
- const TableFinalization = (typeof FinalizationRegistry === 'undefined')
907
- ? { register: () => {}, unregister: () => {} }
908
- : new FinalizationRegistry(ptr => wasm.__wbg_table_free(ptr >>> 0, 1));
909
-
910
- export class Table {
911
-
912
- static __wrap(ptr) {
913
- ptr = ptr >>> 0;
914
- const obj = Object.create(Table.prototype);
915
- obj.__wbg_ptr = ptr;
916
- TableFinalization.register(obj, obj.__wbg_ptr, obj);
917
- return obj;
918
- }
919
-
920
- __destroy_into_raw() {
921
- const ptr = this.__wbg_ptr;
922
- this.__wbg_ptr = 0;
923
- TableFinalization.unregister(this);
924
- return ptr;
1068
+ /**
1069
+ * Returns this [`View`]'s _dimensions_, row and column count, as well as
1070
+ * those of the [`crate::Table`] from which it was derived.
1071
+ *
1072
+ * - `num_table_rows` - The number of rows in the underlying
1073
+ * [`crate::Table`].
1074
+ * - `num_table_columns` - The number of columns in the underlying
1075
+ * [`crate::Table`] (including the `index` column if this
1076
+ * [`crate::Table`] was constructed with one).
1077
+ * - `num_view_rows` - The number of rows in this [`View`]. If this
1078
+ * [`View`] has a `group_by` clause, `num_view_rows` will also include
1079
+ * aggregated rows.
1080
+ * - `num_view_columns` - The number of columns in this [`View`]. If this
1081
+ * [`View`] has a `split_by` clause, `num_view_columns` will include all
1082
+ * _column paths_, e.g. the number of `columns` clause times the number
1083
+ * of `split_by` groups.
1084
+ * @returns {Promise<any>}
1085
+ */
1086
+ dimensions() {
1087
+ const ret = wasm.view_dimensions(this.__wbg_ptr);
1088
+ return takeObject(ret);
925
1089
  }
926
-
927
- free() {
928
- const ptr = this.__destroy_into_raw();
929
- wasm.__wbg_table_free(ptr, 0);
1090
+ /**
1091
+ * Expand the `group_by` row at `row_index`.
1092
+ * @param {number} row_index
1093
+ * @returns {Promise<number>}
1094
+ */
1095
+ expand(row_index) {
1096
+ const ret = wasm.view_expand(this.__wbg_ptr, row_index);
1097
+ return takeObject(ret);
930
1098
  }
931
1099
  /**
932
- * @returns {string}
1100
+ * The expression schema of this [`View`], which contains only the
1101
+ * expressions created on this [`View`]. See [`View::schema`] for
1102
+ * details.
1103
+ * @returns {Promise<any>}
933
1104
  */
934
- __getClassname() {
935
- try {
936
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
937
- wasm.table___getClassname(retptr, this.__wbg_ptr);
938
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
939
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
940
- var v1 = getCachedStringFromWasm0(r0, r1);
941
- if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
942
- return v1;
943
- } finally {
944
- wasm.__wbindgen_add_to_stack_pointer(16);
945
- }
1105
+ expression_schema() {
1106
+ const ret = wasm.view_expression_schema(this.__wbg_ptr);
1107
+ return takeObject(ret);
946
1108
  }
947
1109
  /**
948
- * Returns the name of the index column for the table.
949
- *
950
- * # JavaScript Examples
951
- *
952
- * ```javascript
953
- * const table = await client.table("x,y\n1,2\n3,4", { index: "x" });
954
- * const index = table.get_index(); // "x"
955
- * ```
956
- * @returns {Promise<string>}
1110
+ * A copy of the config object passed to the [`Table::view`] method which
1111
+ * created this [`View`].
1112
+ * @returns {Promise<any>}
957
1113
  */
958
- get_index() {
959
- const ret = wasm.table_get_index(this.__wbg_ptr);
1114
+ get_config() {
1115
+ const ret = wasm.view_get_config(this.__wbg_ptr);
960
1116
  return takeObject(ret);
961
1117
  }
962
1118
  /**
963
- * Get a copy of the [`Client`] this [`Table`] came from.
964
- * @returns {Promise<Client>}
1119
+ * Calculates the [min, max] of the leaf nodes of a column `column_name`.
1120
+ *
1121
+ * # Returns
1122
+ *
1123
+ * A tuple of [min, max], whose types are column and aggregate dependent.
1124
+ * @param {string} name
1125
+ * @returns {Promise<Array<any>>}
965
1126
  */
966
- get_client() {
967
- const ret = wasm.table_get_client(this.__wbg_ptr);
1127
+ get_min_max(name) {
1128
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1129
+ const len0 = WASM_VECTOR_LEN;
1130
+ const ret = wasm.view_get_min_max(this.__wbg_ptr, ptr0, len0);
968
1131
  return takeObject(ret);
969
1132
  }
970
1133
  /**
971
- * Returns the user-specified name for this table, or the auto-generated
972
- * name if a name was not specified when the table was created.
973
- * @returns {Promise<string>}
1134
+ * The number of aggregated columns in this [`View`]. This is affected by
1135
+ * the "split_by" configuration parameter supplied to this view's
1136
+ * contructor.
1137
+ *
1138
+ * # Returns
1139
+ *
1140
+ * The number of aggregated columns.
1141
+ * @returns {Promise<number>}
974
1142
  */
975
- get_name() {
976
- const ret = wasm.table_get_name(this.__wbg_ptr);
1143
+ num_columns() {
1144
+ const ret = wasm.view_num_columns(this.__wbg_ptr);
977
1145
  return takeObject(ret);
978
1146
  }
979
1147
  /**
980
- * Returns the user-specified row limit for this table.
981
- * @returns {Promise<number | undefined>}
1148
+ * The number of aggregated rows in this [`View`]. This is affected by the
1149
+ * "group_by" configuration parameter supplied to this view's contructor.
1150
+ *
1151
+ * # Returns
1152
+ *
1153
+ * The number of aggregated rows.
1154
+ * @returns {Promise<number>}
982
1155
  */
983
- get_limit() {
984
- const ret = wasm.table_get_limit(this.__wbg_ptr);
1156
+ num_rows() {
1157
+ const ret = wasm.view_num_rows(this.__wbg_ptr);
985
1158
  return takeObject(ret);
986
1159
  }
987
1160
  /**
988
- * Removes all the rows in the [`Table`], but preserves everything else
989
- * including the schema, index, and any callbacks or registered
990
- * [`View`] instances.
991
- *
992
- * Calling [`Table::clear`], like [`Table::update`] and [`Table::remove`],
993
- * will trigger an update event to any registered listeners via
994
- * [`View::on_update`].
995
- * @returns {Promise<void>}
1161
+ * Register a callback with this [`View`]. Whenever the [`View`] is
1162
+ * deleted, this callback will be invoked.
1163
+ * @param {Function} on_delete
1164
+ * @returns {Promise<any>}
996
1165
  */
997
- clear() {
998
- const ret = wasm.table_clear(this.__wbg_ptr);
1166
+ on_delete(on_delete) {
1167
+ const ret = wasm.view_on_delete(this.__wbg_ptr, addHeapObject(on_delete));
999
1168
  return takeObject(ret);
1000
1169
  }
1001
1170
  /**
1002
- * Delete this [`Table`] and cleans up associated resources.
1003
- *
1004
- * [`Table`]s do not stop consuming resources or processing updates when
1005
- * they are garbage collected in their host language - you must call
1006
- * this method to reclaim these.
1171
+ * Register a callback with this [`View`]. Whenever the view's underlying
1172
+ * table emits an update, this callback will be invoked with an object
1173
+ * containing `port_id`, indicating which port the update fired on, and
1174
+ * optionally `delta`, which is the new data that was updated for each
1175
+ * cell or each row.
1007
1176
  *
1008
1177
  * # Arguments
1009
1178
  *
1010
- * - `options` An options dictionary.
1011
- * - `lazy` Whether to delete this [`Table`] _lazily_. When false (the
1012
- * default), the delete will occur immediately, assuming it has no
1013
- * [`View`] instances registered to it (which must be deleted first,
1014
- * otherwise this method will throw an error). When true, the
1015
- * [`Table`] will only be marked for deltion once its [`View`]
1016
- * dependency count reaches 0.
1179
+ * - `on_update` - A callback function invoked on update, which receives an
1180
+ * object with two keys: `port_id`, indicating which port the update was
1181
+ * triggered on, and `delta`, whose value is dependent on the mode
1182
+ * parameter.
1183
+ * - `options` - If this is provided as `OnUpdateOptions { mode:
1184
+ * Some(OnUpdateMode::Row) }`, then `delta` is an Arrow of the updated
1185
+ * rows. Otherwise `delta` will be [`Option::None`].
1017
1186
  *
1018
1187
  * # JavaScript Examples
1019
1188
  *
1020
1189
  * ```javascript
1021
- * const table = await client.table("x,y\n1,2\n3,4");
1022
- *
1023
- * // ...
1190
+ * // Attach an `on_update` callback
1191
+ * view.on_update((updated) => console.log(updated.port_id));
1192
+ * ```
1024
1193
  *
1025
- * await table.delete({ lazy: true });
1194
+ * ```javascript
1195
+ * // `on_update` with row deltas
1196
+ * view.on_update((updated) => console.log(updated.delta), { mode: "row" });
1026
1197
  * ```
1027
- * @param {DeleteOptions | null} [options]
1028
- * @returns {Promise<void>}
1198
+ * @param {Function} on_update_js
1199
+ * @param {OnUpdateOptions | null} [options]
1200
+ * @returns {Promise<any>}
1029
1201
  */
1030
- delete(options) {
1031
- const ptr = this.__destroy_into_raw();
1032
- const ret = wasm.table_delete(ptr, isLikeNone(options) ? 0 : addHeapObject(options));
1202
+ on_update(on_update_js, options) {
1203
+ const ret = wasm.view_on_update(this.__wbg_ptr, addHeapObject(on_update_js), isLikeNone(options) ? 0 : addHeapObject(options));
1033
1204
  return takeObject(ret);
1034
1205
  }
1035
1206
  /**
1036
- * Returns the number of rows in a [`Table`].
1037
- * @returns {Promise<number>}
1207
+ * Unregister a previously registered [`View::on_delete`] callback.
1208
+ * @param {number} callback_id
1209
+ * @returns {Promise<any>}
1038
1210
  */
1039
- size() {
1040
- const ret = wasm.table_size(this.__wbg_ptr);
1211
+ remove_delete(callback_id) {
1212
+ const ret = wasm.view_remove_delete(this.__wbg_ptr, callback_id);
1041
1213
  return takeObject(ret);
1042
1214
  }
1043
1215
  /**
1044
- * Returns a table's [`Schema`], a mapping of column names to column types.
1045
- *
1046
- * The mapping of a [`Table`]'s column names to data types is referred to
1047
- * as a [`Schema`]. Each column has a unique name and a data type, one
1048
- * of:
1216
+ * Unregister a previously registered update callback with this [`View`].
1049
1217
  *
1050
- * - `"boolean"` - A boolean type
1051
- * - `"date"` - A timesonze-agnostic date type (month/day/year)
1052
- * - `"datetime"` - A millisecond-precision datetime type in the UTC
1053
- * timezone
1054
- * - `"float"` - A 64 bit float
1055
- * - `"integer"` - A signed 32 bit integer (the integer type supported by
1056
- * JavaScript)
1057
- * - `"string"` - A [`String`] data type (encoded internally as a
1058
- * _dictionary_)
1218
+ * # Arguments
1059
1219
  *
1060
- * Note that all [`Table`] columns are _nullable_, regardless of the data
1061
- * type.
1062
- * @returns {Record<string, ColumnType>}
1220
+ * - `id` - A callback `id` as returned by a recipricol call to
1221
+ * [`View::on_update`].
1222
+ * @param {number} callback_id
1223
+ * @returns {Promise<void>}
1063
1224
  */
1064
- schema() {
1065
- const ret = wasm.table_schema(this.__wbg_ptr);
1225
+ remove_update(callback_id) {
1226
+ const ret = wasm.view_remove_update(this.__wbg_ptr, callback_id);
1066
1227
  return takeObject(ret);
1067
1228
  }
1068
1229
  /**
1069
- * Returns the column names of this [`Table`] in "natural" order (the
1070
- * ordering implied by the input format).
1071
- *
1072
- * # JavaScript Examples
1230
+ * The schema of this [`View`].
1073
1231
  *
1074
- * ```javascript
1075
- * const columns = await table.columns();
1076
- * ```
1232
+ * The [`View`] schema differs from the `schema` returned by
1233
+ * [`Table::schema`]; it may have different column names due to
1234
+ * `expressions` or `columns` configs, or it maye have _different
1235
+ * column types_ due to the application og `group_by` and `aggregates`
1236
+ * config. You can think of [`Table::schema`] as the _input_ schema and
1237
+ * [`View::schema`] as the _output_ schema of a Perspective pipeline.
1077
1238
  * @returns {Promise<any>}
1078
1239
  */
1079
- columns() {
1080
- const ret = wasm.table_columns(this.__wbg_ptr);
1240
+ schema() {
1241
+ const ret = wasm.view_schema(this.__wbg_ptr);
1081
1242
  return takeObject(ret);
1082
1243
  }
1083
1244
  /**
1084
- * Create a unique channel ID on this [`Table`], which allows
1085
- * `View::on_update` callback calls to be associated with the
1086
- * `Table::update` which caused them.
1087
- * @returns {Promise<number>}
1245
+ * Set expansion `depth` of the `group_by` tree.
1246
+ * @param {number} depth
1247
+ * @returns {Promise<void>}
1088
1248
  */
1089
- make_port() {
1090
- const ret = wasm.table_make_port(this.__wbg_ptr);
1249
+ set_depth(depth) {
1250
+ const ret = wasm.view_set_depth(this.__wbg_ptr, depth);
1091
1251
  return takeObject(ret);
1092
1252
  }
1093
1253
  /**
1094
- * Register a callback which is called exactly once, when this [`Table`] is
1095
- * deleted with the [`Table::delete`] method.
1096
- *
1097
- * [`Table::on_delete`] resolves when the subscription message is sent, not
1098
- * when the _delete_ event occurs.
1099
- * @param {Function} on_delete
1100
- * @returns {Promise<any>}
1254
+ * Serializes a [`View`] to the Apache Arrow data format.
1255
+ * @param {ViewWindow | null} [window]
1256
+ * @returns {Promise<ArrayBuffer>}
1101
1257
  */
1102
- on_delete(on_delete) {
1103
- const ret = wasm.table_on_delete(this.__wbg_ptr, addHeapObject(on_delete));
1258
+ to_arrow(window) {
1259
+ const ret = wasm.view_to_arrow(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1104
1260
  return takeObject(ret);
1105
1261
  }
1106
1262
  /**
1107
- * Removes a listener with a given ID, as returned by a previous call to
1108
- * [`Table::on_delete`].
1109
- * @param {number} callback_id
1110
- * @returns {Promise<any>}
1263
+ * Serializes this [`View`] to JavaScript objects in a column-oriented
1264
+ * format.
1265
+ * @param {ViewWindow | null} [window]
1266
+ * @returns {Promise<object>}
1111
1267
  */
1112
- remove_delete(callback_id) {
1113
- const ret = wasm.table_remove_delete(this.__wbg_ptr, callback_id);
1268
+ to_columns(window) {
1269
+ const ret = wasm.view_to_columns(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1114
1270
  return takeObject(ret);
1115
1271
  }
1116
1272
  /**
1117
- * Removes rows from this [`Table`] with the `index` column values
1118
- * supplied.
1119
- *
1120
- * # Arguments
1121
- *
1122
- * - `indices` - A list of `index` column values for rows that should be
1123
- * removed.
1124
- *
1125
- * # JavaScript Examples
1126
- *
1127
- * ```javascript
1128
- * await table.remove([1, 2, 3]);
1129
- * ```
1130
- * @param {any} value
1131
- * @param {UpdateOptions | null} [options]
1132
- * @returns {Promise<void>}
1273
+ * Serializes this [`View`] to a string of JSON data. Useful if you want to
1274
+ * save additional round trip serialize/deserialize cycles.
1275
+ * @param {ViewWindow | null} [window]
1276
+ * @returns {Promise<string>}
1133
1277
  */
1134
- remove(value, options) {
1135
- const ret = wasm.table_remove(this.__wbg_ptr, addHeapObject(value), isLikeNone(options) ? 0 : addHeapObject(options));
1278
+ to_columns_string(window) {
1279
+ const ret = wasm.view_to_columns_string(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1136
1280
  return takeObject(ret);
1137
- }
1138
- /**
1139
- * Replace all rows in this [`Table`] with the input data, coerced to this
1140
- * [`Table`]'s existing [`perspective_client::Schema`], notifying any
1141
- * derived [`View`] and [`View::on_update`] callbacks.
1142
- *
1143
- * Calling [`Table::replace`] is an easy way to replace _all_ the data in a
1144
- * [`Table`] without losing any derived [`View`] instances or
1145
- * [`View::on_update`] callbacks. [`Table::replace`] does _not_ infer
1146
- * data types like [`Client::table`] does, rather it _coerces_ input
1147
- * data to the `Schema` like [`Table::update`]. If you need a [`Table`]
1148
- * with a different `Schema`, you must create a new one.
1149
- *
1150
- * # JavaScript Examples
1151
- *
1152
- * ```javascript
1153
- * await table.replace("x,y\n1,2");
1154
- * ```
1155
- * @param {any} input
1156
- * @param {UpdateOptions | null} [options]
1157
- * @returns {Promise<void>}
1281
+ }
1282
+ /**
1283
+ * Serializes this [`View`] to CSV data in a standard format.
1284
+ * @param {ViewWindow | null} [window]
1285
+ * @returns {Promise<string>}
1158
1286
  */
1159
- replace(input, options) {
1160
- const ret = wasm.table_replace(this.__wbg_ptr, addHeapObject(input), isLikeNone(options) ? 0 : addHeapObject(options));
1287
+ to_csv(window) {
1288
+ const ret = wasm.view_to_csv(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1161
1289
  return takeObject(ret);
1162
1290
  }
1163
1291
  /**
1164
- * Updates the rows of this table and any derived [`View`] instances.
1165
- *
1166
- * Calling [`Table::update`] will trigger the [`View::on_update`] callbacks
1167
- * register to derived [`View`], and the call itself will not resolve until
1168
- * _all_ derived [`View`]'s are notified.
1169
- *
1170
- * When updating a [`Table`] with an `index`, [`Table::update`] supports
1171
- * partial updates, by omitting columns from the update data.
1172
- *
1173
- * # Arguments
1174
- *
1175
- * - `input` - The input data for this [`Table`]. The schema of a [`Table`]
1176
- * is immutable after creation, so this method cannot be called with a
1177
- * schema.
1178
- * - `options` - Options for this update step - see [`UpdateOptions`].
1179
- *
1180
- * # JavaScript Examples
1181
- *
1182
- * ```javascript
1183
- * await table.update("x,y\n1,2");
1184
- * ```
1185
- * @param {string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>} input
1186
- * @param {UpdateOptions | null} [options]
1187
- * @returns {Promise<any>}
1292
+ * Serializes this [`View`] to JavaScript objects in a row-oriented
1293
+ * format.
1294
+ * @param {ViewWindow | null} [window]
1295
+ * @returns {Promise<Array<any>>}
1188
1296
  */
1189
- update(input, options) {
1190
- const ret = wasm.table_update(this.__wbg_ptr, addHeapObject(input), isLikeNone(options) ? 0 : addHeapObject(options));
1297
+ to_json(window) {
1298
+ const ret = wasm.view_to_json(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1191
1299
  return takeObject(ret);
1192
1300
  }
1193
1301
  /**
1194
- * Create a new [`View`] from this table with a specified
1195
- * [`ViewConfigUpdate`].
1196
- *
1197
- * See [`View`] struct.
1198
- *
1199
- * # JavaScript Examples
1200
- *
1201
- * ```javascript
1202
- * const view = await table.view({
1203
- * columns: ["Sales"],
1204
- * aggregates: { Sales: "sum" },
1205
- * group_by: ["Region", "Country"],
1206
- * filter: [["Category", "in", ["Furniture", "Technology"]]],
1207
- * });
1208
- * ```
1209
- * @param {ViewConfigUpdate | null} [config]
1210
- * @returns {Promise<View>}
1302
+ * Render this `View` as a JSON string.
1303
+ * @param {ViewWindow | null} [window]
1304
+ * @returns {Promise<string>}
1211
1305
  */
1212
- view(config) {
1213
- const ret = wasm.table_view(this.__wbg_ptr, isLikeNone(config) ? 0 : addHeapObject(config));
1306
+ to_json_string(window) {
1307
+ const ret = wasm.view_to_json_string(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1214
1308
  return takeObject(ret);
1215
1309
  }
1216
1310
  /**
1217
- * Validates the given expressions.
1218
- * @param {any} exprs
1219
- * @returns {Promise<any>}
1311
+ * Renders this [`View`] as an [NDJSON](https://github.com/ndjson/ndjson-spec)
1312
+ * formatted [`String`].
1313
+ * @param {ViewWindow | null} [window]
1314
+ * @returns {Promise<string>}
1220
1315
  */
1221
- validate_expressions(exprs) {
1222
- const ret = wasm.table_validate_expressions(this.__wbg_ptr, addHeapObject(exprs));
1316
+ to_ndjson(window) {
1317
+ const ret = wasm.view_to_ndjson(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1223
1318
  return takeObject(ret);
1224
1319
  }
1225
1320
  }
1226
- if (Symbol.dispose) Table.prototype[Symbol.dispose] = Table.prototype.free;
1227
-
1228
- const ViewFinalization = (typeof FinalizationRegistry === 'undefined')
1229
- ? { register: () => {}, unregister: () => {} }
1230
- : new FinalizationRegistry(ptr => wasm.__wbg_view_free(ptr >>> 0, 1));
1231
- /**
1232
- * The [`View`] struct is Perspective's query and serialization interface. It
1233
- * represents a query on the `Table`'s dataset and is always created from an
1234
- * existing `Table` instance via the [`Table::view`] method.
1235
- *
1236
- * [`View`]s are immutable with respect to the arguments provided to the
1237
- * [`Table::view`] method; to change these parameters, you must create a new
1238
- * [`View`] on the same [`Table`]. However, each [`View`] is _live_ with
1239
- * respect to the [`Table`]'s data, and will (within a conflation window)
1240
- * update with the latest state as its parent [`Table`] updates, including
1241
- * incrementally recalculating all aggregates, pivots, filters, etc. [`View`]
1242
- * query parameters are composable, in that each parameter works independently
1243
- * _and_ in conjunction with each other, and there is no limit to the number of
1244
- * pivots, filters, etc. which can be applied.
1245
- */
1246
- export class View {
1321
+ if (Symbol.dispose) View.prototype[Symbol.dispose] = View.prototype.free;
1247
1322
 
1323
+ export class VirtualDataSlice {
1248
1324
  static __wrap(ptr) {
1249
1325
  ptr = ptr >>> 0;
1250
- const obj = Object.create(View.prototype);
1326
+ const obj = Object.create(VirtualDataSlice.prototype);
1251
1327
  obj.__wbg_ptr = ptr;
1252
- ViewFinalization.register(obj, obj.__wbg_ptr, obj);
1328
+ VirtualDataSliceFinalization.register(obj, obj.__wbg_ptr, obj);
1253
1329
  return obj;
1254
1330
  }
1255
-
1256
- static __unwrap(jsValue) {
1257
- if (!(jsValue instanceof View)) {
1258
- return 0;
1259
- }
1260
- return jsValue.__destroy_into_raw();
1261
- }
1262
-
1263
1331
  __destroy_into_raw() {
1264
1332
  const ptr = this.__wbg_ptr;
1265
1333
  this.__wbg_ptr = 0;
1266
- ViewFinalization.unregister(this);
1334
+ VirtualDataSliceFinalization.unregister(this);
1267
1335
  return ptr;
1268
1336
  }
1269
-
1270
1337
  free() {
1271
1338
  const ptr = this.__destroy_into_raw();
1272
- wasm.__wbg_view_free(ptr, 0);
1339
+ wasm.__wbg_virtualdataslice_free(ptr, 0);
1273
1340
  }
1274
1341
  /**
1275
- * @returns {View}
1342
+ * @param {ViewConfigUpdate} config
1276
1343
  */
1277
- __get_model() {
1278
- const ret = wasm.view___get_model(this.__wbg_ptr);
1279
- return View.__wrap(ret);
1344
+ constructor(config) {
1345
+ const ret = wasm.virtualdataslice_new(addHeapObject(config));
1346
+ this.__wbg_ptr = ret >>> 0;
1347
+ VirtualDataSliceFinalization.register(this, this.__wbg_ptr, this);
1348
+ return this;
1280
1349
  }
1281
1350
  /**
1282
- * Returns an array of strings containing the column paths of the [`View`]
1283
- * without any of the source columns.
1284
- *
1285
- * A column path shows the columns that a given cell belongs to after
1286
- * pivots are applied.
1287
- * @param {ColumnWindow | null} [window]
1288
- * @returns {Promise<any>}
1351
+ * @param {string} name
1352
+ * @param {number} index
1353
+ * @param {any} val
1354
+ * @param {number | null} [group_by_index]
1289
1355
  */
1290
- column_paths(window) {
1291
- const ret = wasm.view_column_paths(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1292
- return takeObject(ret);
1356
+ setBooleanCol(name, index, val, group_by_index) {
1357
+ try {
1358
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1359
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1360
+ const len0 = WASM_VECTOR_LEN;
1361
+ wasm.virtualdataslice_setBooleanCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
1362
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1363
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1364
+ if (r1) {
1365
+ throw takeObject(r0);
1366
+ }
1367
+ } finally {
1368
+ wasm.__wbindgen_add_to_stack_pointer(16);
1369
+ }
1293
1370
  }
1294
1371
  /**
1295
- * Delete this [`View`] and clean up all resources associated with it.
1296
- * [`View`] objects do not stop consuming resources or processing
1297
- * updates when they are garbage collected - you must call this method
1298
- * to reclaim these.
1299
- * @returns {Promise<void>}
1372
+ * @param {string} dtype
1373
+ * @param {string} name
1374
+ * @param {number} index
1375
+ * @param {any} val
1376
+ * @param {number | null} [group_by_index]
1300
1377
  */
1301
- delete() {
1302
- const ptr = this.__destroy_into_raw();
1303
- const ret = wasm.view_delete(ptr);
1304
- return takeObject(ret);
1378
+ setCol(dtype, name, index, val, group_by_index) {
1379
+ try {
1380
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1381
+ const ptr0 = passStringToWasm0(dtype, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1382
+ const len0 = WASM_VECTOR_LEN;
1383
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1384
+ const len1 = WASM_VECTOR_LEN;
1385
+ wasm.virtualdataslice_setCol(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
1386
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1387
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1388
+ if (r1) {
1389
+ throw takeObject(r0);
1390
+ }
1391
+ } finally {
1392
+ wasm.__wbindgen_add_to_stack_pointer(16);
1393
+ }
1305
1394
  }
1306
1395
  /**
1307
- * Returns this [`View`]'s _dimensions_, row and column count, as well as
1308
- * those of the [`crate::Table`] from which it was derived.
1309
- *
1310
- * - `num_table_rows` - The number of rows in the underlying
1311
- * [`crate::Table`].
1312
- * - `num_table_columns` - The number of columns in the underlying
1313
- * [`crate::Table`] (including the `index` column if this
1314
- * [`crate::Table`] was constructed with one).
1315
- * - `num_view_rows` - The number of rows in this [`View`]. If this
1316
- * [`View`] has a `group_by` clause, `num_view_rows` will also include
1317
- * aggregated rows.
1318
- * - `num_view_columns` - The number of columns in this [`View`]. If this
1319
- * [`View`] has a `split_by` clause, `num_view_columns` will include all
1320
- * _column paths_, e.g. the number of `columns` clause times the number
1321
- * of `split_by` groups.
1322
- * @returns {Promise<any>}
1396
+ * @param {string} name
1397
+ * @param {number} index
1398
+ * @param {any} val
1399
+ * @param {number | null} [group_by_index]
1323
1400
  */
1324
- dimensions() {
1325
- const ret = wasm.view_dimensions(this.__wbg_ptr);
1326
- return takeObject(ret);
1401
+ setDatetimeCol(name, index, val, group_by_index) {
1402
+ try {
1403
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1404
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1405
+ const len0 = WASM_VECTOR_LEN;
1406
+ wasm.virtualdataslice_setDatetimeCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
1407
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1408
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1409
+ if (r1) {
1410
+ throw takeObject(r0);
1411
+ }
1412
+ } finally {
1413
+ wasm.__wbindgen_add_to_stack_pointer(16);
1414
+ }
1327
1415
  }
1328
1416
  /**
1329
- * The expression schema of this [`View`], which contains only the
1330
- * expressions created on this [`View`]. See [`View::schema`] for
1331
- * details.
1332
- * @returns {Promise<any>}
1417
+ * @param {string} name
1418
+ * @param {number} index
1419
+ * @param {any} val
1420
+ * @param {number | null} [group_by_index]
1333
1421
  */
1334
- expression_schema() {
1335
- const ret = wasm.view_expression_schema(this.__wbg_ptr);
1336
- return takeObject(ret);
1422
+ setFloatCol(name, index, val, group_by_index) {
1423
+ try {
1424
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1425
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1426
+ const len0 = WASM_VECTOR_LEN;
1427
+ wasm.virtualdataslice_setFloatCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
1428
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1429
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1430
+ if (r1) {
1431
+ throw takeObject(r0);
1432
+ }
1433
+ } finally {
1434
+ wasm.__wbindgen_add_to_stack_pointer(16);
1435
+ }
1337
1436
  }
1338
1437
  /**
1339
- * A copy of the config object passed to the [`Table::view`] method which
1340
- * created this [`View`].
1341
- * @returns {Promise<any>}
1438
+ * @param {string} name
1439
+ * @param {number} index
1440
+ * @param {any} val
1441
+ * @param {number | null} [group_by_index]
1342
1442
  */
1343
- get_config() {
1344
- const ret = wasm.view_get_config(this.__wbg_ptr);
1345
- return takeObject(ret);
1443
+ setIntegerCol(name, index, val, group_by_index) {
1444
+ try {
1445
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1446
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1447
+ const len0 = WASM_VECTOR_LEN;
1448
+ wasm.virtualdataslice_setIntegerCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
1449
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1450
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1451
+ if (r1) {
1452
+ throw takeObject(r0);
1453
+ }
1454
+ } finally {
1455
+ wasm.__wbindgen_add_to_stack_pointer(16);
1456
+ }
1346
1457
  }
1347
1458
  /**
1348
- * Calculates the [min, max] of the leaf nodes of a column `column_name`.
1349
- *
1350
- * # Returns
1351
- *
1352
- * A tuple of [min, max], whose types are column and aggregate dependent.
1353
1459
  * @param {string} name
1354
- * @returns {Promise<Array<any>>}
1460
+ * @param {number} index
1461
+ * @param {any} val
1462
+ * @param {number | null} [group_by_index]
1355
1463
  */
1356
- get_min_max(name) {
1357
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1358
- const len0 = WASM_VECTOR_LEN;
1359
- const ret = wasm.view_get_min_max(this.__wbg_ptr, ptr0, len0);
1360
- return takeObject(ret);
1464
+ setStringCol(name, index, val, group_by_index) {
1465
+ try {
1466
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1467
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1468
+ const len0 = WASM_VECTOR_LEN;
1469
+ wasm.virtualdataslice_setStringCol(retptr, this.__wbg_ptr, ptr0, len0, index, addHeapObject(val), isLikeNone(group_by_index) ? 0x100000001 : (group_by_index) >>> 0);
1470
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1471
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1472
+ if (r1) {
1473
+ throw takeObject(r0);
1474
+ }
1475
+ } finally {
1476
+ wasm.__wbindgen_add_to_stack_pointer(16);
1477
+ }
1361
1478
  }
1362
- /**
1363
- * The number of aggregated rows in this [`View`]. This is affected by the
1364
- * "group_by" configuration parameter supplied to this view's contructor.
1365
- *
1366
- * # Returns
1367
- *
1368
- * The number of aggregated rows.
1369
- * @returns {Promise<number>}
1370
- */
1371
- num_rows() {
1372
- const ret = wasm.view_num_rows(this.__wbg_ptr);
1373
- return takeObject(ret);
1479
+ }
1480
+ if (Symbol.dispose) VirtualDataSlice.prototype[Symbol.dispose] = VirtualDataSlice.prototype.free;
1481
+
1482
+ export class VirtualServer {
1483
+ __destroy_into_raw() {
1484
+ const ptr = this.__wbg_ptr;
1485
+ this.__wbg_ptr = 0;
1486
+ VirtualServerFinalization.unregister(this);
1487
+ return ptr;
1488
+ }
1489
+ free() {
1490
+ const ptr = this.__destroy_into_raw();
1491
+ wasm.__wbg_virtualserver_free(ptr, 0);
1374
1492
  }
1375
1493
  /**
1376
- * The schema of this [`View`].
1377
- *
1378
- * The [`View`] schema differs from the `schema` returned by
1379
- * [`Table::schema`]; it may have different column names due to
1380
- * `expressions` or `columns` configs, or it maye have _different
1381
- * column types_ due to the application og `group_by` and `aggregates`
1382
- * config. You can think of [`Table::schema`] as the _input_ schema and
1383
- * [`View::schema`] as the _output_ schema of a Perspective pipeline.
1494
+ * @param {Uint8Array} bytes
1384
1495
  * @returns {Promise<any>}
1385
1496
  */
1386
- schema() {
1387
- const ret = wasm.view_schema(this.__wbg_ptr);
1497
+ handleRequest(bytes) {
1498
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1499
+ const len0 = WASM_VECTOR_LEN;
1500
+ const ret = wasm.virtualserver_handleRequest(this.__wbg_ptr, ptr0, len0);
1388
1501
  return takeObject(ret);
1389
1502
  }
1390
1503
  /**
1391
- * Serializes a [`View`] to the Apache Arrow data format.
1392
- * @param {ViewWindow | null} [window]
1393
- * @returns {Promise<ArrayBuffer>}
1504
+ * @param {object} handler
1394
1505
  */
1395
- to_arrow(window) {
1396
- const ret = wasm.view_to_arrow(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1397
- return takeObject(ret);
1506
+ constructor(handler) {
1507
+ try {
1508
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1509
+ wasm.virtualserver_new(retptr, addHeapObject(handler));
1510
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1511
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1512
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1513
+ if (r2) {
1514
+ throw takeObject(r1);
1515
+ }
1516
+ this.__wbg_ptr = r0 >>> 0;
1517
+ VirtualServerFinalization.register(this, this.__wbg_ptr, this);
1518
+ return this;
1519
+ } finally {
1520
+ wasm.__wbindgen_add_to_stack_pointer(16);
1521
+ }
1398
1522
  }
1399
- /**
1400
- * Serializes this [`View`] to a string of JSON data. Useful if you want to
1401
- * save additional round trip serialize/deserialize cycles.
1402
- * @param {ViewWindow | null} [window]
1403
- * @returns {Promise<string>}
1404
- */
1405
- to_columns_string(window) {
1406
- const ret = wasm.view_to_columns_string(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1407
- return takeObject(ret);
1523
+ }
1524
+ if (Symbol.dispose) VirtualServer.prototype[Symbol.dispose] = VirtualServer.prototype.free;
1525
+
1526
+ export function init() {
1527
+ wasm.init();
1528
+ }
1529
+
1530
+ function __wbg_get_imports() {
1531
+ const import0 = {
1532
+ __proto__: null,
1533
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
1534
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1535
+ const ret = Error(v0);
1536
+ return addHeapObject(ret);
1537
+ },
1538
+ __wbg_Number_04624de7d0e8332d: function(arg0) {
1539
+ const ret = Number(getObject(arg0));
1540
+ return ret;
1541
+ },
1542
+ __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
1543
+ const ret = String(getObject(arg1));
1544
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1545
+ const len1 = WASM_VECTOR_LEN;
1546
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1547
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1548
+ },
1549
+ __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
1550
+ const v = getObject(arg1);
1551
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1552
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1553
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1554
+ },
1555
+ __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
1556
+ const v = getObject(arg0);
1557
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1558
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1559
+ },
1560
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
1561
+ const ret = debugString(getObject(arg1));
1562
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1563
+ const len1 = WASM_VECTOR_LEN;
1564
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1565
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1566
+ },
1567
+ __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
1568
+ const ret = getObject(arg0) in getObject(arg1);
1569
+ return ret;
1570
+ },
1571
+ __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {
1572
+ const ret = typeof(getObject(arg0)) === 'bigint';
1573
+ return ret;
1574
+ },
1575
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
1576
+ const ret = typeof(getObject(arg0)) === 'function';
1577
+ return ret;
1578
+ },
1579
+ __wbg___wbindgen_is_null_ac34f5003991759a: function(arg0) {
1580
+ const ret = getObject(arg0) === null;
1581
+ return ret;
1582
+ },
1583
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
1584
+ const val = getObject(arg0);
1585
+ const ret = typeof(val) === 'object' && val !== null;
1586
+ return ret;
1587
+ },
1588
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
1589
+ const ret = typeof(getObject(arg0)) === 'string';
1590
+ return ret;
1591
+ },
1592
+ __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
1593
+ const ret = getObject(arg0) === undefined;
1594
+ return ret;
1595
+ },
1596
+ __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
1597
+ const ret = getObject(arg0) === getObject(arg1);
1598
+ return ret;
1599
+ },
1600
+ __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
1601
+ const ret = getObject(arg0) == getObject(arg1);
1602
+ return ret;
1603
+ },
1604
+ __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
1605
+ const obj = getObject(arg1);
1606
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1607
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1608
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1609
+ },
1610
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
1611
+ const obj = getObject(arg1);
1612
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1613
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1614
+ var len1 = WASM_VECTOR_LEN;
1615
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1616
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1617
+ },
1618
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
1619
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1620
+ throw new Error(v0);
1621
+ },
1622
+ __wbg__wbg_cb_unref_d9b87ff7982e3b21: function(arg0) {
1623
+ getObject(arg0)._wbg_cb_unref();
1624
+ },
1625
+ __wbg_apply_ada2ee1a60ac7b3c: function() { return handleError(function (arg0, arg1, arg2) {
1626
+ const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
1627
+ return addHeapObject(ret);
1628
+ }, arguments); },
1629
+ __wbg_at_dfc235641cc0e40c: function(arg0, arg1) {
1630
+ const ret = getObject(arg0).at(arg1);
1631
+ return addHeapObject(ret);
1632
+ },
1633
+ __wbg_buffer_26d0910f3a5bc899: function(arg0) {
1634
+ const ret = getObject(arg0).buffer;
1635
+ return addHeapObject(ret);
1636
+ },
1637
+ __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
1638
+ const ret = getObject(arg0).call(getObject(arg1));
1639
+ return addHeapObject(ret);
1640
+ }, arguments); },
1641
+ __wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
1642
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1643
+ return addHeapObject(ret);
1644
+ }, arguments); },
1645
+ __wbg_call_812d25f1510c13c8: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1646
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
1647
+ return addHeapObject(ret);
1648
+ }, arguments); },
1649
+ __wbg_client_new: function(arg0) {
1650
+ const ret = Client.__wrap(arg0);
1651
+ return addHeapObject(ret);
1652
+ },
1653
+ __wbg_debug_46a93995fc6f8820: function(arg0, arg1, arg2, arg3) {
1654
+ console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1655
+ },
1656
+ __wbg_debug_a4099fa12db6cd61: function(arg0) {
1657
+ console.debug(getObject(arg0));
1658
+ },
1659
+ __wbg_done_57b39ecd9addfe81: function(arg0) {
1660
+ const ret = getObject(arg0).done;
1661
+ return ret;
1662
+ },
1663
+ __wbg_entries_58c7934c745daac7: function(arg0) {
1664
+ const ret = Object.entries(getObject(arg0));
1665
+ return addHeapObject(ret);
1666
+ },
1667
+ __wbg_error_794d0ffc9d00d5c3: function(arg0, arg1, arg2, arg3) {
1668
+ console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1669
+ },
1670
+ __wbg_error_9a7fe3f932034cde: function(arg0) {
1671
+ console.error(getObject(arg0));
1672
+ },
1673
+ __wbg_error_f852e41c69b0bd84: function(arg0, arg1) {
1674
+ console.error(getObject(arg0), getObject(arg1));
1675
+ },
1676
+ __wbg_from_bddd64e7d5ff6941: function(arg0) {
1677
+ const ret = Array.from(getObject(arg0));
1678
+ return addHeapObject(ret);
1679
+ },
1680
+ __wbg_getEntriesByName_02488cff0bc7581c: function(arg0, arg1, arg2, arg3, arg4) {
1681
+ var v0 = getCachedStringFromWasm0(arg1, arg2);
1682
+ var v1 = getCachedStringFromWasm0(arg3, arg4);
1683
+ const ret = getObject(arg0).getEntriesByName(v0, v1);
1684
+ return addHeapObject(ret);
1685
+ },
1686
+ __wbg_getRandomValues_1c61fac11405ffdc: function() { return handleError(function (arg0, arg1) {
1687
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1688
+ }, arguments); },
1689
+ __wbg_getTime_1e3cd1391c5c3995: function(arg0) {
1690
+ const ret = getObject(arg0).getTime();
1691
+ return ret;
1692
+ },
1693
+ __wbg_get_76e04509d1922a04: function(arg0, arg1, arg2) {
1694
+ var v0 = getCachedStringFromWasm0(arg1, arg2);
1695
+ const ret = getObject(arg0)[v0];
1696
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1697
+ },
1698
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
1699
+ const ret = getObject(arg0)[arg1 >>> 0];
1700
+ return addHeapObject(ret);
1701
+ },
1702
+ __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
1703
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1704
+ return addHeapObject(ret);
1705
+ }, arguments); },
1706
+ __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
1707
+ const ret = getObject(arg0)[getObject(arg1)];
1708
+ return addHeapObject(ret);
1709
+ },
1710
+ __wbg_has_d4e53238966c12b6: function() { return handleError(function (arg0, arg1) {
1711
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
1712
+ return ret;
1713
+ }, arguments); },
1714
+ __wbg_info_148d043840582012: function(arg0) {
1715
+ console.info(getObject(arg0));
1716
+ },
1717
+ __wbg_info_9e602cf10c5c690b: function(arg0, arg1, arg2, arg3) {
1718
+ console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1719
+ },
1720
+ __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
1721
+ let result;
1722
+ try {
1723
+ result = getObject(arg0) instanceof ArrayBuffer;
1724
+ } catch (_) {
1725
+ result = false;
1726
+ }
1727
+ const ret = result;
1728
+ return ret;
1729
+ },
1730
+ __wbg_instanceof_Array_d9eac779cd191cbc: function(arg0) {
1731
+ let result;
1732
+ try {
1733
+ result = getObject(arg0) instanceof Array;
1734
+ } catch (_) {
1735
+ result = false;
1736
+ }
1737
+ const ret = result;
1738
+ return ret;
1739
+ },
1740
+ __wbg_instanceof_Date_1b9f15b87f10aa4c: function(arg0) {
1741
+ let result;
1742
+ try {
1743
+ result = getObject(arg0) instanceof Date;
1744
+ } catch (_) {
1745
+ result = false;
1746
+ }
1747
+ const ret = result;
1748
+ return ret;
1749
+ },
1750
+ __wbg_instanceof_Error_8573fe0b0b480f46: function(arg0) {
1751
+ let result;
1752
+ try {
1753
+ result = getObject(arg0) instanceof Error;
1754
+ } catch (_) {
1755
+ result = false;
1756
+ }
1757
+ const ret = result;
1758
+ return ret;
1759
+ },
1760
+ __wbg_instanceof_Map_53af74335dec57f4: function(arg0) {
1761
+ let result;
1762
+ try {
1763
+ result = getObject(arg0) instanceof Map;
1764
+ } catch (_) {
1765
+ result = false;
1766
+ }
1767
+ const ret = result;
1768
+ return ret;
1769
+ },
1770
+ __wbg_instanceof_Object_1c6af87502b733ed: function(arg0) {
1771
+ let result;
1772
+ try {
1773
+ result = getObject(arg0) instanceof Object;
1774
+ } catch (_) {
1775
+ result = false;
1776
+ }
1777
+ const ret = result;
1778
+ return ret;
1779
+ },
1780
+ __wbg_instanceof_Promise_0094681e3519d6ec: function(arg0) {
1781
+ let result;
1782
+ try {
1783
+ result = getObject(arg0) instanceof Promise;
1784
+ } catch (_) {
1785
+ result = false;
1786
+ }
1787
+ const ret = result;
1788
+ return ret;
1789
+ },
1790
+ __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
1791
+ let result;
1792
+ try {
1793
+ result = getObject(arg0) instanceof Uint8Array;
1794
+ } catch (_) {
1795
+ result = false;
1796
+ }
1797
+ const ret = result;
1798
+ return ret;
1799
+ },
1800
+ __wbg_instanceof_Window_ed49b2db8df90359: function(arg0) {
1801
+ let result;
1802
+ try {
1803
+ result = getObject(arg0) instanceof Window;
1804
+ } catch (_) {
1805
+ result = false;
1806
+ }
1807
+ const ret = result;
1808
+ return ret;
1809
+ },
1810
+ __wbg_isArray_d314bb98fcf08331: function(arg0) {
1811
+ const ret = Array.isArray(getObject(arg0));
1812
+ return ret;
1813
+ },
1814
+ __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
1815
+ const ret = Number.isSafeInteger(getObject(arg0));
1816
+ return ret;
1817
+ },
1818
+ __wbg_iterator_6ff6560ca1568e55: function() {
1819
+ const ret = Symbol.iterator;
1820
+ return addHeapObject(ret);
1821
+ },
1822
+ __wbg_keys_b50a709a76add04e: function(arg0) {
1823
+ const ret = Object.keys(getObject(arg0));
1824
+ return addHeapObject(ret);
1825
+ },
1826
+ __wbg_length_32ed9a279acd054c: function(arg0) {
1827
+ const ret = getObject(arg0).length;
1828
+ return ret;
1829
+ },
1830
+ __wbg_length_35a7bace40f36eac: function(arg0) {
1831
+ const ret = getObject(arg0).length;
1832
+ return ret;
1833
+ },
1834
+ __wbg_mark_3b530a64b09ba08a: function() { return handleError(function (arg0, arg1, arg2) {
1835
+ var v0 = getCachedStringFromWasm0(arg1, arg2);
1836
+ getObject(arg0).mark(v0);
1837
+ }, arguments); },
1838
+ __wbg_measure_288b48c082eae0fe: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1839
+ var v0 = getCachedStringFromWasm0(arg1, arg2);
1840
+ var v1 = getCachedStringFromWasm0(arg3, arg4);
1841
+ getObject(arg0).measure(v0, v1);
1842
+ }, arguments); },
1843
+ __wbg_message_9ddc4b9a62a7c379: function(arg0) {
1844
+ const ret = getObject(arg0).message;
1845
+ return addHeapObject(ret);
1846
+ },
1847
+ __wbg_new_361308b2356cecd0: function() {
1848
+ const ret = new Object();
1849
+ return addHeapObject(ret);
1850
+ },
1851
+ __wbg_new_3eb36ae241fe6f44: function() {
1852
+ const ret = new Array();
1853
+ return addHeapObject(ret);
1854
+ },
1855
+ __wbg_new_72b49615380db768: function(arg0, arg1) {
1856
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1857
+ const ret = new Error(v0);
1858
+ return addHeapObject(ret);
1859
+ },
1860
+ __wbg_new_b5d9e2fb389fef91: function(arg0, arg1) {
1861
+ try {
1862
+ var state0 = {a: arg0, b: arg1};
1863
+ var cb0 = (arg0, arg1) => {
1864
+ const a = state0.a;
1865
+ state0.a = 0;
1866
+ try {
1867
+ return __wasm_bindgen_func_elem_5384(a, state0.b, arg0, arg1);
1868
+ } finally {
1869
+ state0.a = a;
1870
+ }
1871
+ };
1872
+ const ret = new Promise(cb0);
1873
+ return addHeapObject(ret);
1874
+ } finally {
1875
+ state0.a = state0.b = 0;
1876
+ }
1877
+ },
1878
+ __wbg_new_dca287b076112a51: function() {
1879
+ const ret = new Map();
1880
+ return addHeapObject(ret);
1881
+ },
1882
+ __wbg_new_dd2b680c8bf6ae29: function(arg0) {
1883
+ const ret = new Uint8Array(getObject(arg0));
1884
+ return addHeapObject(ret);
1885
+ },
1886
+ __wbg_new_from_slice_a3d2629dc1826784: function(arg0, arg1) {
1887
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1888
+ return addHeapObject(ret);
1889
+ },
1890
+ __wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
1891
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1892
+ const ret = new Function(v0);
1893
+ return addHeapObject(ret);
1894
+ },
1895
+ __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
1896
+ const ret = getObject(arg0).next();
1897
+ return addHeapObject(ret);
1898
+ }, arguments); },
1899
+ __wbg_next_418f80d8f5303233: function(arg0) {
1900
+ const ret = getObject(arg0).next;
1901
+ return addHeapObject(ret);
1902
+ },
1903
+ __wbg_now_ebffdf7e580f210d: function(arg0) {
1904
+ const ret = getObject(arg0).now();
1905
+ return ret;
1906
+ },
1907
+ __wbg_parse_708461a1feddfb38: function() { return handleError(function (arg0, arg1) {
1908
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1909
+ const ret = JSON.parse(v0);
1910
+ return addHeapObject(ret);
1911
+ }, arguments); },
1912
+ __wbg_performance_06f12ba62483475d: function(arg0) {
1913
+ const ret = getObject(arg0).performance;
1914
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1915
+ },
1916
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
1917
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1918
+ },
1919
+ __wbg_push_8ffdcb2063340ba5: function(arg0, arg1) {
1920
+ const ret = getObject(arg0).push(getObject(arg1));
1921
+ return ret;
1922
+ },
1923
+ __wbg_queueMicrotask_0aa0a927f78f5d98: function(arg0) {
1924
+ const ret = getObject(arg0).queueMicrotask;
1925
+ return addHeapObject(ret);
1926
+ },
1927
+ __wbg_queueMicrotask_5bb536982f78a56f: function(arg0) {
1928
+ queueMicrotask(getObject(arg0));
1929
+ },
1930
+ __wbg_reject_a2176de7f1212be5: function(arg0) {
1931
+ const ret = Promise.reject(getObject(arg0));
1932
+ return addHeapObject(ret);
1933
+ },
1934
+ __wbg_resolve_002c4b7d9d8f6b64: function(arg0) {
1935
+ const ret = Promise.resolve(getObject(arg0));
1936
+ return addHeapObject(ret);
1937
+ },
1938
+ __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
1939
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1940
+ return addHeapObject(ret);
1941
+ },
1942
+ __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
1943
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1944
+ },
1945
+ __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
1946
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1947
+ },
1948
+ __wbg_startTime_248495bfbcb427d3: function(arg0) {
1949
+ const ret = getObject(arg0).startTime;
1950
+ return ret;
1951
+ },
1952
+ __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
1953
+ const ret = typeof global === 'undefined' ? null : global;
1954
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1955
+ },
1956
+ __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
1957
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1958
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1959
+ },
1960
+ __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
1961
+ const ret = typeof self === 'undefined' ? null : self;
1962
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1963
+ },
1964
+ __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
1965
+ const ret = typeof window === 'undefined' ? null : window;
1966
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1967
+ },
1968
+ __wbg_stringify_8d1cc6ff383e8bae: function() { return handleError(function (arg0) {
1969
+ const ret = JSON.stringify(getObject(arg0));
1970
+ return addHeapObject(ret);
1971
+ }, arguments); },
1972
+ __wbg_table_new: function(arg0) {
1973
+ const ret = Table.__wrap(arg0);
1974
+ return addHeapObject(ret);
1975
+ },
1976
+ __wbg_then_0d9fe2c7b1857d32: function(arg0, arg1, arg2) {
1977
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1978
+ return addHeapObject(ret);
1979
+ },
1980
+ __wbg_then_b9e7b3b5f1a9e1b5: function(arg0, arg1) {
1981
+ const ret = getObject(arg0).then(getObject(arg1));
1982
+ return addHeapObject(ret);
1983
+ },
1984
+ __wbg_toString_964ff7fe6eca8362: function(arg0) {
1985
+ const ret = getObject(arg0).toString();
1986
+ return addHeapObject(ret);
1987
+ },
1988
+ __wbg_trace_9007714a6fbee374: function(arg0) {
1989
+ console.trace(getObject(arg0));
1990
+ },
1991
+ __wbg_trace_bd16b570941b54fb: function(arg0, arg1, arg2, arg3) {
1992
+ console.trace(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1993
+ },
1994
+ __wbg_value_0546255b415e96c1: function(arg0) {
1995
+ const ret = getObject(arg0).value;
1996
+ return addHeapObject(ret);
1997
+ },
1998
+ __wbg_values_5da93bc719d272cf: function(arg0) {
1999
+ const ret = Object.values(getObject(arg0));
2000
+ return addHeapObject(ret);
2001
+ },
2002
+ __wbg_view_new: function(arg0) {
2003
+ const ret = View.__wrap(arg0);
2004
+ return addHeapObject(ret);
2005
+ },
2006
+ __wbg_view_unwrap: function(arg0) {
2007
+ const ret = View.__unwrap(getObject(arg0));
2008
+ return ret;
2009
+ },
2010
+ __wbg_virtualdataslice_new: function(arg0) {
2011
+ const ret = VirtualDataSlice.__wrap(arg0);
2012
+ return addHeapObject(ret);
2013
+ },
2014
+ __wbg_warn_a40b971467b219c7: function(arg0, arg1, arg2, arg3) {
2015
+ console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
2016
+ },
2017
+ __wbg_warn_f7ae1b2e66ccb930: function(arg0) {
2018
+ console.warn(getObject(arg0));
2019
+ },
2020
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2021
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 13, function: Function { arguments: [], shim_idx: 30, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: false }) -> Externref`.
2022
+ const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1421, __wasm_bindgen_func_elem_1668);
2023
+ return addHeapObject(ret);
2024
+ },
2025
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2026
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 551, function: Function { arguments: [Externref], shim_idx: 552, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2027
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3793, __wasm_bindgen_func_elem_3795);
2028
+ return addHeapObject(ret);
2029
+ },
2030
+ __wbindgen_cast_0000000000000003: function(arg0) {
2031
+ // Cast intrinsic for `F64 -> Externref`.
2032
+ const ret = arg0;
2033
+ return addHeapObject(ret);
2034
+ },
2035
+ __wbindgen_cast_0000000000000004: function(arg0) {
2036
+ // Cast intrinsic for `I64 -> Externref`.
2037
+ const ret = arg0;
2038
+ return addHeapObject(ret);
2039
+ },
2040
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
2041
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
2042
+ // Cast intrinsic for `Ref(CachedString) -> Externref`.
2043
+ const ret = v0;
2044
+ return addHeapObject(ret);
2045
+ },
2046
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
2047
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
2048
+ const ret = getArrayU8FromWasm0(arg0, arg1);
2049
+ return addHeapObject(ret);
2050
+ },
2051
+ __wbindgen_cast_0000000000000007: function(arg0) {
2052
+ // Cast intrinsic for `U64 -> Externref`.
2053
+ const ret = BigInt.asUintN(64, arg0);
2054
+ return addHeapObject(ret);
2055
+ },
2056
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
2057
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
2058
+ wasm.__wbindgen_export4(arg0, arg1 * 4, 4);
2059
+ // Cast intrinsic for `Vector(NamedExternref("string")) -> Externref`.
2060
+ const ret = v0;
2061
+ return addHeapObject(ret);
2062
+ },
2063
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
2064
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
2065
+ wasm.__wbindgen_export4(arg0, arg1 * 1, 1);
2066
+ // Cast intrinsic for `Vector(U8) -> Externref`.
2067
+ const ret = v0;
2068
+ return addHeapObject(ret);
2069
+ },
2070
+ __wbindgen_object_clone_ref: function(arg0) {
2071
+ const ret = getObject(arg0);
2072
+ return addHeapObject(ret);
2073
+ },
2074
+ __wbindgen_object_drop_ref: function(arg0) {
2075
+ takeObject(arg0);
2076
+ },
2077
+ };
2078
+ return {
2079
+ __proto__: null,
2080
+ "./perspective-js.wasm_bg.js": import0,
2081
+ };
2082
+ }
2083
+
2084
+ function __wasm_bindgen_func_elem_1668(arg0, arg1) {
2085
+ const ret = wasm.__wasm_bindgen_func_elem_1668(arg0, arg1);
2086
+ return takeObject(ret);
2087
+ }
2088
+
2089
+ function __wasm_bindgen_func_elem_3795(arg0, arg1, arg2) {
2090
+ wasm.__wasm_bindgen_func_elem_3795(arg0, arg1, addHeapObject(arg2));
2091
+ }
2092
+
2093
+ function __wasm_bindgen_func_elem_5384(arg0, arg1, arg2, arg3) {
2094
+ wasm.__wasm_bindgen_func_elem_5384(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2095
+ }
2096
+
2097
+ const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
2098
+ ? { register: () => {}, unregister: () => {} }
2099
+ : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
2100
+ const GenericSQLVirtualServerModelFinalization = (typeof FinalizationRegistry === 'undefined')
2101
+ ? { register: () => {}, unregister: () => {} }
2102
+ : new FinalizationRegistry(ptr => wasm.__wbg_genericsqlvirtualservermodel_free(ptr >>> 0, 1));
2103
+ const ProxySessionFinalization = (typeof FinalizationRegistry === 'undefined')
2104
+ ? { register: () => {}, unregister: () => {} }
2105
+ : new FinalizationRegistry(ptr => wasm.__wbg_proxysession_free(ptr >>> 0, 1));
2106
+ const TableFinalization = (typeof FinalizationRegistry === 'undefined')
2107
+ ? { register: () => {}, unregister: () => {} }
2108
+ : new FinalizationRegistry(ptr => wasm.__wbg_table_free(ptr >>> 0, 1));
2109
+ const ViewFinalization = (typeof FinalizationRegistry === 'undefined')
2110
+ ? { register: () => {}, unregister: () => {} }
2111
+ : new FinalizationRegistry(ptr => wasm.__wbg_view_free(ptr >>> 0, 1));
2112
+ const VirtualDataSliceFinalization = (typeof FinalizationRegistry === 'undefined')
2113
+ ? { register: () => {}, unregister: () => {} }
2114
+ : new FinalizationRegistry(ptr => wasm.__wbg_virtualdataslice_free(ptr >>> 0, 1));
2115
+ const VirtualServerFinalization = (typeof FinalizationRegistry === 'undefined')
2116
+ ? { register: () => {}, unregister: () => {} }
2117
+ : new FinalizationRegistry(ptr => wasm.__wbg_virtualserver_free(ptr >>> 0, 1));
2118
+
2119
+ function addHeapObject(obj) {
2120
+ if (heap_next === heap.length) heap.push(heap.length + 1);
2121
+ const idx = heap_next;
2122
+ heap_next = heap[idx];
2123
+
2124
+ heap[idx] = obj;
2125
+ return idx;
2126
+ }
2127
+
2128
+ function _assertClass(instance, klass) {
2129
+ if (!(instance instanceof klass)) {
2130
+ throw new Error(`expected instance of ${klass.name}`);
1408
2131
  }
1409
- /**
1410
- * Serializes this [`View`] to JavaScript objects in a column-oriented
1411
- * format.
1412
- * @param {ViewWindow | null} [window]
1413
- * @returns {Promise<object>}
1414
- */
1415
- to_columns(window) {
1416
- const ret = wasm.view_to_columns(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1417
- return takeObject(ret);
2132
+ }
2133
+
2134
+ function addBorrowedObject(obj) {
2135
+ if (stack_pointer == 1) throw new Error('out of js stack');
2136
+ heap[--stack_pointer] = obj;
2137
+ return stack_pointer;
2138
+ }
2139
+
2140
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
2141
+ ? { register: () => {}, unregister: () => {} }
2142
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
2143
+
2144
+ function debugString(val) {
2145
+ // primitive types
2146
+ const type = typeof val;
2147
+ if (type == 'number' || type == 'boolean' || val == null) {
2148
+ return `${val}`;
2149
+ }
2150
+ if (type == 'string') {
2151
+ return `"${val}"`;
2152
+ }
2153
+ if (type == 'symbol') {
2154
+ const description = val.description;
2155
+ if (description == null) {
2156
+ return 'Symbol';
2157
+ } else {
2158
+ return `Symbol(${description})`;
2159
+ }
2160
+ }
2161
+ if (type == 'function') {
2162
+ const name = val.name;
2163
+ if (typeof name == 'string' && name.length > 0) {
2164
+ return `Function(${name})`;
2165
+ } else {
2166
+ return 'Function';
2167
+ }
2168
+ }
2169
+ // objects
2170
+ if (Array.isArray(val)) {
2171
+ const length = val.length;
2172
+ let debug = '[';
2173
+ if (length > 0) {
2174
+ debug += debugString(val[0]);
2175
+ }
2176
+ for(let i = 1; i < length; i++) {
2177
+ debug += ', ' + debugString(val[i]);
2178
+ }
2179
+ debug += ']';
2180
+ return debug;
1418
2181
  }
1419
- /**
1420
- * Render this `View` as a JSON string.
1421
- * @param {ViewWindow | null} [window]
1422
- * @returns {Promise<string>}
1423
- */
1424
- to_json_string(window) {
1425
- const ret = wasm.view_to_json_string(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1426
- return takeObject(ret);
2182
+ // Test for built-in
2183
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
2184
+ let className;
2185
+ if (builtInMatches && builtInMatches.length > 1) {
2186
+ className = builtInMatches[1];
2187
+ } else {
2188
+ // Failed to match the standard '[object ClassName]'
2189
+ return toString.call(val);
1427
2190
  }
1428
- /**
1429
- * Serializes this [`View`] to JavaScript objects in a row-oriented
1430
- * format.
1431
- * @param {ViewWindow | null} [window]
1432
- * @returns {Promise<Array<any>>}
1433
- */
1434
- to_json(window) {
1435
- const ret = wasm.view_to_json(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1436
- return takeObject(ret);
2191
+ if (className == 'Object') {
2192
+ // we're a user defined class or Object
2193
+ // JSON.stringify avoids problems with cycles, and is generally much
2194
+ // easier than looping through ownProperties of `val`.
2195
+ try {
2196
+ return 'Object(' + JSON.stringify(val) + ')';
2197
+ } catch (_) {
2198
+ return 'Object';
2199
+ }
1437
2200
  }
1438
- /**
1439
- * Renders this [`View`] as an [NDJSON](https://github.com/ndjson/ndjson-spec)
1440
- * formatted [`String`].
1441
- * @param {ViewWindow | null} [window]
1442
- * @returns {Promise<string>}
1443
- */
1444
- to_ndjson(window) {
1445
- const ret = wasm.view_to_ndjson(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1446
- return takeObject(ret);
2201
+ // errors
2202
+ if (val instanceof Error) {
2203
+ return `${val.name}: ${val.message}\n${val.stack}`;
1447
2204
  }
1448
- /**
1449
- * Serializes this [`View`] to CSV data in a standard format.
1450
- * @param {ViewWindow | null} [window]
1451
- * @returns {Promise<string>}
1452
- */
1453
- to_csv(window) {
1454
- const ret = wasm.view_to_csv(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
1455
- return takeObject(ret);
2205
+ // TODO we could test for more things here, like `Set`s and `Map`s.
2206
+ return className;
2207
+ }
2208
+
2209
+ function dropObject(idx) {
2210
+ if (idx < 132) return;
2211
+ heap[idx] = heap_next;
2212
+ heap_next = idx;
2213
+ }
2214
+
2215
+ function getArrayJsValueFromWasm0(ptr, len) {
2216
+ ptr = ptr >>> 0;
2217
+ const mem = getDataViewMemory0();
2218
+ const result = [];
2219
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
2220
+ result.push(takeObject(mem.getUint32(i, true)));
1456
2221
  }
1457
- /**
1458
- * Register a callback with this [`View`]. Whenever the view's underlying
1459
- * table emits an update, this callback will be invoked with an object
1460
- * containing `port_id`, indicating which port the update fired on, and
1461
- * optionally `delta`, which is the new data that was updated for each
1462
- * cell or each row.
1463
- *
1464
- * # Arguments
1465
- *
1466
- * - `on_update` - A callback function invoked on update, which receives an
1467
- * object with two keys: `port_id`, indicating which port the update was
1468
- * triggered on, and `delta`, whose value is dependent on the mode
1469
- * parameter.
1470
- * - `options` - If this is provided as `OnUpdateOptions { mode:
1471
- * Some(OnUpdateMode::Row) }`, then `delta` is an Arrow of the updated
1472
- * rows. Otherwise `delta` will be [`Option::None`].
1473
- *
1474
- * # JavaScript Examples
1475
- *
1476
- * ```javascript
1477
- * // Attach an `on_update` callback
1478
- * view.on_update((updated) => console.log(updated.port_id));
1479
- * ```
1480
- *
1481
- * ```javascript
1482
- * // `on_update` with row deltas
1483
- * view.on_update((updated) => console.log(updated.delta), { mode: "row" });
1484
- * ```
1485
- * @param {Function} on_update_js
1486
- * @param {OnUpdateOptions | null} [options]
1487
- * @returns {Promise<any>}
1488
- */
1489
- on_update(on_update_js, options) {
1490
- const ret = wasm.view_on_update(this.__wbg_ptr, addHeapObject(on_update_js), isLikeNone(options) ? 0 : addHeapObject(options));
1491
- return takeObject(ret);
2222
+ return result;
2223
+ }
2224
+
2225
+ function getArrayU8FromWasm0(ptr, len) {
2226
+ ptr = ptr >>> 0;
2227
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
2228
+ }
2229
+
2230
+ function getCachedStringFromWasm0(ptr, len) {
2231
+ if (ptr === 0) {
2232
+ return getObject(len);
2233
+ } else {
2234
+ return getStringFromWasm0(ptr, len);
1492
2235
  }
1493
- /**
1494
- * Unregister a previously registered update callback with this [`View`].
1495
- *
1496
- * # Arguments
1497
- *
1498
- * - `id` - A callback `id` as returned by a recipricol call to
1499
- * [`View::on_update`].
1500
- * @param {number} callback_id
1501
- * @returns {Promise<void>}
1502
- */
1503
- remove_update(callback_id) {
1504
- const ret = wasm.view_remove_update(this.__wbg_ptr, callback_id);
1505
- return takeObject(ret);
2236
+ }
2237
+
2238
+ let cachedDataViewMemory0 = null;
2239
+ function getDataViewMemory0() {
2240
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
2241
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1506
2242
  }
1507
- /**
1508
- * Register a callback with this [`View`]. Whenever the [`View`] is
1509
- * deleted, this callback will be invoked.
1510
- * @param {Function} on_delete
1511
- * @returns {Promise<any>}
1512
- */
1513
- on_delete(on_delete) {
1514
- const ret = wasm.view_on_delete(this.__wbg_ptr, addHeapObject(on_delete));
1515
- return takeObject(ret);
2243
+ return cachedDataViewMemory0;
2244
+ }
2245
+
2246
+ function getStringFromWasm0(ptr, len) {
2247
+ ptr = ptr >>> 0;
2248
+ return decodeText(ptr, len);
2249
+ }
2250
+
2251
+ let cachedUint8ArrayMemory0 = null;
2252
+ function getUint8ArrayMemory0() {
2253
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
2254
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1516
2255
  }
1517
- /**
1518
- * The number of aggregated columns in this [`View`]. This is affected by
1519
- * the "split_by" configuration parameter supplied to this view's
1520
- * contructor.
1521
- *
1522
- * # Returns
1523
- *
1524
- * The number of aggregated columns.
1525
- * @returns {Promise<number>}
1526
- */
1527
- num_columns() {
1528
- const ret = wasm.view_num_columns(this.__wbg_ptr);
1529
- return takeObject(ret);
2256
+ return cachedUint8ArrayMemory0;
2257
+ }
2258
+
2259
+ function getObject(idx) { return heap[idx]; }
2260
+
2261
+ function handleError(f, args) {
2262
+ try {
2263
+ return f.apply(this, args);
2264
+ } catch (e) {
2265
+ wasm.__wbindgen_export3(addHeapObject(e));
1530
2266
  }
1531
- /**
1532
- * Unregister a previously registered [`View::on_delete`] callback.
1533
- * @param {number} callback_id
1534
- * @returns {Promise<any>}
1535
- */
1536
- remove_delete(callback_id) {
1537
- const ret = wasm.view_remove_delete(this.__wbg_ptr, callback_id);
1538
- return takeObject(ret);
2267
+ }
2268
+
2269
+ let heap = new Array(128).fill(undefined);
2270
+ heap.push(undefined, null, true, false);
2271
+
2272
+ let heap_next = heap.length;
2273
+
2274
+ function isLikeNone(x) {
2275
+ return x === undefined || x === null;
2276
+ }
2277
+
2278
+ function makeClosure(arg0, arg1, dtor, f) {
2279
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
2280
+ const real = (...args) => {
2281
+
2282
+ // First up with a closure we increment the internal reference
2283
+ // count. This ensures that the Rust closure environment won't
2284
+ // be deallocated while we're invoking it.
2285
+ state.cnt++;
2286
+ try {
2287
+ return f(state.a, state.b, ...args);
2288
+ } finally {
2289
+ real._wbg_cb_unref();
2290
+ }
2291
+ };
2292
+ real._wbg_cb_unref = () => {
2293
+ if (--state.cnt === 0) {
2294
+ state.dtor(state.a, state.b);
2295
+ state.a = 0;
2296
+ CLOSURE_DTORS.unregister(state);
2297
+ }
2298
+ };
2299
+ CLOSURE_DTORS.register(real, state, state);
2300
+ return real;
2301
+ }
2302
+
2303
+ function makeMutClosure(arg0, arg1, dtor, f) {
2304
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
2305
+ const real = (...args) => {
2306
+
2307
+ // First up with a closure we increment the internal reference
2308
+ // count. This ensures that the Rust closure environment won't
2309
+ // be deallocated while we're invoking it.
2310
+ state.cnt++;
2311
+ const a = state.a;
2312
+ state.a = 0;
2313
+ try {
2314
+ return f(a, state.b, ...args);
2315
+ } finally {
2316
+ state.a = a;
2317
+ real._wbg_cb_unref();
2318
+ }
2319
+ };
2320
+ real._wbg_cb_unref = () => {
2321
+ if (--state.cnt === 0) {
2322
+ state.dtor(state.a, state.b);
2323
+ state.a = 0;
2324
+ CLOSURE_DTORS.unregister(state);
2325
+ }
2326
+ };
2327
+ CLOSURE_DTORS.register(real, state, state);
2328
+ return real;
2329
+ }
2330
+
2331
+ function passArray8ToWasm0(arg, malloc) {
2332
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
2333
+ getUint8ArrayMemory0().set(arg, ptr / 1);
2334
+ WASM_VECTOR_LEN = arg.length;
2335
+ return ptr;
2336
+ }
2337
+
2338
+ function passStringToWasm0(arg, malloc, realloc) {
2339
+ if (realloc === undefined) {
2340
+ const buf = cachedTextEncoder.encode(arg);
2341
+ const ptr = malloc(buf.length, 1) >>> 0;
2342
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
2343
+ WASM_VECTOR_LEN = buf.length;
2344
+ return ptr;
1539
2345
  }
1540
- /**
1541
- * Collapses the `group_by` row at `row_index`.
1542
- * @param {number} row_index
1543
- * @returns {Promise<number>}
1544
- */
1545
- collapse(row_index) {
1546
- const ret = wasm.view_collapse(this.__wbg_ptr, row_index);
1547
- return takeObject(ret);
2346
+
2347
+ let len = arg.length;
2348
+ let ptr = malloc(len, 1) >>> 0;
2349
+
2350
+ const mem = getUint8ArrayMemory0();
2351
+
2352
+ let offset = 0;
2353
+
2354
+ for (; offset < len; offset++) {
2355
+ const code = arg.charCodeAt(offset);
2356
+ if (code > 0x7F) break;
2357
+ mem[ptr + offset] = code;
1548
2358
  }
1549
- /**
1550
- * Expand the `group_by` row at `row_index`.
1551
- * @param {number} row_index
1552
- * @returns {Promise<number>}
1553
- */
1554
- expand(row_index) {
1555
- const ret = wasm.view_expand(this.__wbg_ptr, row_index);
1556
- return takeObject(ret);
2359
+ if (offset !== len) {
2360
+ if (offset !== 0) {
2361
+ arg = arg.slice(offset);
2362
+ }
2363
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
2364
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
2365
+ const ret = cachedTextEncoder.encodeInto(arg, view);
2366
+
2367
+ offset += ret.written;
2368
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1557
2369
  }
1558
- /**
1559
- * Set expansion `depth` of the `group_by` tree.
1560
- * @param {number} depth
1561
- * @returns {Promise<void>}
1562
- */
1563
- set_depth(depth) {
1564
- const ret = wasm.view_set_depth(this.__wbg_ptr, depth);
1565
- return takeObject(ret);
2370
+
2371
+ WASM_VECTOR_LEN = offset;
2372
+ return ptr;
2373
+ }
2374
+
2375
+ let stack_pointer = 128;
2376
+
2377
+ function takeObject(idx) {
2378
+ const ret = getObject(idx);
2379
+ dropObject(idx);
2380
+ return ret;
2381
+ }
2382
+
2383
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2384
+ cachedTextDecoder.decode();
2385
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2386
+ let numBytesDecoded = 0;
2387
+ function decodeText(ptr, len) {
2388
+ numBytesDecoded += len;
2389
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2390
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2391
+ cachedTextDecoder.decode();
2392
+ numBytesDecoded = len;
1566
2393
  }
2394
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1567
2395
  }
1568
- if (Symbol.dispose) View.prototype[Symbol.dispose] = View.prototype.free;
1569
2396
 
1570
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
2397
+ const cachedTextEncoder = new TextEncoder();
2398
+
2399
+ let WASM_VECTOR_LEN = 0;
2400
+
2401
+ let wasmModule, wasm;
2402
+ function __wbg_finalize_init(instance, module) {
2403
+ wasm = instance.exports;
2404
+ wasmModule = module;
2405
+ cachedDataViewMemory0 = null;
2406
+ cachedUint8ArrayMemory0 = null;
2407
+ return wasm;
2408
+ }
1571
2409
 
1572
2410
  async function __wbg_load(module, imports) {
1573
2411
  if (typeof Response === 'function' && module instanceof Response) {
1574
2412
  if (typeof WebAssembly.instantiateStreaming === 'function') {
1575
2413
  try {
1576
2414
  return await WebAssembly.instantiateStreaming(module, imports);
1577
-
1578
2415
  } catch (e) {
1579
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
2416
+ const validResponse = module.ok && expectedResponseType(module.type);
1580
2417
 
1581
2418
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1582
2419
  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);
1583
2420
 
1584
- } else {
1585
- throw e;
1586
- }
2421
+ } else { throw e; }
1587
2422
  }
1588
2423
  }
1589
2424
 
1590
2425
  const bytes = await module.arrayBuffer();
1591
2426
  return await WebAssembly.instantiate(bytes, imports);
1592
-
1593
2427
  } else {
1594
2428
  const instance = await WebAssembly.instantiate(module, imports);
1595
2429
 
1596
2430
  if (instance instanceof WebAssembly.Instance) {
1597
2431
  return { instance, module };
1598
-
1599
2432
  } else {
1600
2433
  return instance;
1601
2434
  }
1602
2435
  }
1603
- }
1604
2436
 
1605
- function __wbg_get_imports() {
1606
- const imports = {};
1607
- imports.wbg = {};
1608
- imports.wbg.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
1609
- var v0 = getCachedStringFromWasm0(arg0, arg1);
1610
- const ret = Error(v0);
1611
- return addHeapObject(ret);
1612
- };
1613
- imports.wbg.__wbg_Number_bb48ca12f395cd08 = function(arg0) {
1614
- const ret = Number(getObject(arg0));
1615
- return ret;
1616
- };
1617
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1618
- const ret = String(getObject(arg1));
1619
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1620
- const len1 = WASM_VECTOR_LEN;
1621
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1622
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1623
- };
1624
- imports.wbg.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function(arg0, arg1) {
1625
- const v = getObject(arg1);
1626
- const ret = typeof(v) === 'bigint' ? v : undefined;
1627
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1628
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1629
- };
1630
- imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
1631
- const v = getObject(arg0);
1632
- const ret = typeof(v) === 'boolean' ? v : undefined;
1633
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1634
- };
1635
- imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
1636
- const ret = debugString(getObject(arg1));
1637
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1638
- const len1 = WASM_VECTOR_LEN;
1639
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1640
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1641
- };
1642
- imports.wbg.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
1643
- const ret = getObject(arg0) in getObject(arg1);
1644
- return ret;
1645
- };
1646
- imports.wbg.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function(arg0) {
1647
- const ret = typeof(getObject(arg0)) === 'bigint';
1648
- return ret;
1649
- };
1650
- imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
1651
- const ret = typeof(getObject(arg0)) === 'function';
1652
- return ret;
1653
- };
1654
- imports.wbg.__wbg___wbindgen_is_null_5e69f72e906cc57c = function(arg0) {
1655
- const ret = getObject(arg0) === null;
1656
- return ret;
1657
- };
1658
- imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
1659
- const val = getObject(arg0);
1660
- const ret = typeof(val) === 'object' && val !== null;
1661
- return ret;
1662
- };
1663
- imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
1664
- const ret = typeof(getObject(arg0)) === 'string';
1665
- return ret;
1666
- };
1667
- imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
1668
- const ret = getObject(arg0) === undefined;
1669
- return ret;
1670
- };
1671
- imports.wbg.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function(arg0, arg1) {
1672
- const ret = getObject(arg0) === getObject(arg1);
1673
- return ret;
1674
- };
1675
- imports.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
1676
- const ret = getObject(arg0) == getObject(arg1);
1677
- return ret;
1678
- };
1679
- imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
1680
- const obj = getObject(arg1);
1681
- const ret = typeof(obj) === 'number' ? obj : undefined;
1682
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1683
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1684
- };
1685
- imports.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
1686
- const obj = getObject(arg1);
1687
- const ret = typeof(obj) === 'string' ? obj : undefined;
1688
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1689
- var len1 = WASM_VECTOR_LEN;
1690
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1691
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1692
- };
1693
- imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
1694
- var v0 = getCachedStringFromWasm0(arg0, arg1);
1695
- throw new Error(v0);
1696
- };
1697
- imports.wbg.__wbg__wbg_cb_unref_2454a539ea5790d9 = function(arg0) {
1698
- getObject(arg0)._wbg_cb_unref();
1699
- };
1700
- imports.wbg.__wbg_apply_04097a755e1e4a1e = function() { return handleError(function (arg0, arg1, arg2) {
1701
- const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
1702
- return addHeapObject(ret);
1703
- }, arguments) };
1704
- imports.wbg.__wbg_at_a848c0ce365c6832 = function(arg0, arg1) {
1705
- const ret = getObject(arg0).at(arg1);
1706
- return addHeapObject(ret);
1707
- };
1708
- imports.wbg.__wbg_buffer_ccc4520b36d3ccf4 = function(arg0) {
1709
- const ret = getObject(arg0).buffer;
1710
- return addHeapObject(ret);
1711
- };
1712
- imports.wbg.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
1713
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1714
- return addHeapObject(ret);
1715
- }, arguments) };
1716
- imports.wbg.__wbg_call_e45d2cf9fc925fcf = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1717
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
1718
- return addHeapObject(ret);
1719
- }, arguments) };
1720
- imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
1721
- const ret = getObject(arg0).call(getObject(arg1));
1722
- return addHeapObject(ret);
1723
- }, arguments) };
1724
- imports.wbg.__wbg_client_new = function(arg0) {
1725
- const ret = Client.__wrap(arg0);
1726
- return addHeapObject(ret);
1727
- };
1728
- imports.wbg.__wbg_debug_e55e1461940eb14d = function(arg0, arg1, arg2, arg3) {
1729
- console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1730
- };
1731
- imports.wbg.__wbg_debug_f4b0c59db649db48 = function(arg0) {
1732
- console.debug(getObject(arg0));
1733
- };
1734
- imports.wbg.__wbg_done_2042aa2670fb1db1 = function(arg0) {
1735
- const ret = getObject(arg0).done;
1736
- return ret;
1737
- };
1738
- imports.wbg.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
1739
- const ret = Object.entries(getObject(arg0));
1740
- return addHeapObject(ret);
1741
- };
1742
- imports.wbg.__wbg_error_6f1d0762f6c8ae2f = function(arg0, arg1) {
1743
- console.error(getObject(arg0), getObject(arg1));
1744
- };
1745
- imports.wbg.__wbg_error_a7f8fbb0523dae15 = function(arg0) {
1746
- console.error(getObject(arg0));
1747
- };
1748
- imports.wbg.__wbg_error_d8b22cf4e59a6791 = function(arg0, arg1, arg2, arg3) {
1749
- console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1750
- };
1751
- imports.wbg.__wbg_from_a4ad7cbddd0d7135 = function(arg0) {
1752
- const ret = Array.from(getObject(arg0));
1753
- return addHeapObject(ret);
1754
- };
1755
- imports.wbg.__wbg_getEntriesByName_b49d266abfb2e9af = function(arg0, arg1, arg2, arg3, arg4) {
1756
- var v0 = getCachedStringFromWasm0(arg1, arg2);
1757
- var v1 = getCachedStringFromWasm0(arg3, arg4);
1758
- const ret = getObject(arg0).getEntriesByName(v0, v1);
1759
- return addHeapObject(ret);
1760
- };
1761
- imports.wbg.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
1762
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1763
- }, arguments) };
1764
- imports.wbg.__wbg_getTime_14776bfb48a1bff9 = function(arg0) {
1765
- const ret = getObject(arg0).getTime();
1766
- return ret;
1767
- };
1768
- imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
1769
- const ret = getObject(arg0)[arg1 >>> 0];
1770
- return addHeapObject(ret);
1771
- };
1772
- imports.wbg.__wbg_get_a499fc4db8c05b3b = function(arg0, arg1, arg2) {
1773
- var v0 = getCachedStringFromWasm0(arg1, arg2);
1774
- const ret = getObject(arg0)[v0];
1775
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1776
- };
1777
- imports.wbg.__wbg_get_efcb449f58ec27c2 = function() { return handleError(function (arg0, arg1) {
1778
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
1779
- return addHeapObject(ret);
1780
- }, arguments) };
1781
- imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
1782
- const ret = getObject(arg0)[getObject(arg1)];
1783
- return addHeapObject(ret);
1784
- };
1785
- imports.wbg.__wbg_has_787fafc980c3ccdb = function() { return handleError(function (arg0, arg1) {
1786
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
1787
- return ret;
1788
- }, arguments) };
1789
- imports.wbg.__wbg_info_68cd5b51ef7e5137 = function(arg0, arg1, arg2, arg3) {
1790
- console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1791
- };
1792
- imports.wbg.__wbg_info_e674a11f4f50cc0c = function(arg0) {
1793
- console.info(getObject(arg0));
1794
- };
1795
- imports.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
1796
- let result;
1797
- try {
1798
- result = getObject(arg0) instanceof ArrayBuffer;
1799
- } catch (_) {
1800
- result = false;
1801
- }
1802
- const ret = result;
1803
- return ret;
1804
- };
1805
- imports.wbg.__wbg_instanceof_Array_fca44e0f4a7f6240 = function(arg0) {
1806
- let result;
1807
- try {
1808
- result = getObject(arg0) instanceof Array;
1809
- } catch (_) {
1810
- result = false;
1811
- }
1812
- const ret = result;
1813
- return ret;
1814
- };
1815
- imports.wbg.__wbg_instanceof_Date_79a0f671f36947f2 = function(arg0) {
1816
- let result;
1817
- try {
1818
- result = getObject(arg0) instanceof Date;
1819
- } catch (_) {
1820
- result = false;
1821
- }
1822
- const ret = result;
1823
- return ret;
1824
- };
1825
- imports.wbg.__wbg_instanceof_Error_a944ec10920129e2 = function(arg0) {
1826
- let result;
1827
- try {
1828
- result = getObject(arg0) instanceof Error;
1829
- } catch (_) {
1830
- result = false;
1831
- }
1832
- const ret = result;
1833
- return ret;
1834
- };
1835
- imports.wbg.__wbg_instanceof_Map_8579b5e2ab5437c7 = function(arg0) {
1836
- let result;
1837
- try {
1838
- result = getObject(arg0) instanceof Map;
1839
- } catch (_) {
1840
- result = false;
1841
- }
1842
- const ret = result;
1843
- return ret;
1844
- };
1845
- imports.wbg.__wbg_instanceof_Object_10bb762262230c68 = function(arg0) {
1846
- let result;
1847
- try {
1848
- result = getObject(arg0) instanceof Object;
1849
- } catch (_) {
1850
- result = false;
1851
- }
1852
- const ret = result;
1853
- return ret;
1854
- };
1855
- imports.wbg.__wbg_instanceof_Promise_001fdd42afa1b7ef = function(arg0) {
1856
- let result;
1857
- try {
1858
- result = getObject(arg0) instanceof Promise;
1859
- } catch (_) {
1860
- result = false;
1861
- }
1862
- const ret = result;
1863
- return ret;
1864
- };
1865
- imports.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
1866
- let result;
1867
- try {
1868
- result = getObject(arg0) instanceof Uint8Array;
1869
- } catch (_) {
1870
- result = false;
1871
- }
1872
- const ret = result;
1873
- return ret;
1874
- };
1875
- imports.wbg.__wbg_instanceof_Window_4846dbb3de56c84c = function(arg0) {
1876
- let result;
1877
- try {
1878
- result = getObject(arg0) instanceof Window;
1879
- } catch (_) {
1880
- result = false;
1881
- }
1882
- const ret = result;
1883
- return ret;
1884
- };
1885
- imports.wbg.__wbg_isArray_96e0af9891d0945d = function(arg0) {
1886
- const ret = Array.isArray(getObject(arg0));
1887
- return ret;
1888
- };
1889
- imports.wbg.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
1890
- const ret = Number.isSafeInteger(getObject(arg0));
1891
- return ret;
1892
- };
1893
- imports.wbg.__wbg_iterator_e5822695327a3c39 = function() {
1894
- const ret = Symbol.iterator;
1895
- return addHeapObject(ret);
1896
- };
1897
- imports.wbg.__wbg_jsvirtualdataslice_new = function(arg0) {
1898
- const ret = JsVirtualDataSlice.__wrap(arg0);
1899
- return addHeapObject(ret);
1900
- };
1901
- imports.wbg.__wbg_keys_b4d27b02ad14f4be = function(arg0) {
1902
- const ret = Object.keys(getObject(arg0));
1903
- return addHeapObject(ret);
1904
- };
1905
- imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
1906
- const ret = getObject(arg0).length;
1907
- return ret;
1908
- };
1909
- imports.wbg.__wbg_length_cdd215e10d9dd507 = function(arg0) {
1910
- const ret = getObject(arg0).length;
1911
- return ret;
1912
- };
1913
- imports.wbg.__wbg_mark_4411b340bdf62a5f = function() { return handleError(function (arg0, arg1, arg2) {
1914
- var v0 = getCachedStringFromWasm0(arg1, arg2);
1915
- getObject(arg0).mark(v0);
1916
- }, arguments) };
1917
- imports.wbg.__wbg_measure_ef89c90a92de6f43 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1918
- var v0 = getCachedStringFromWasm0(arg1, arg2);
1919
- var v1 = getCachedStringFromWasm0(arg3, arg4);
1920
- getObject(arg0).measure(v0, v1);
1921
- }, arguments) };
1922
- imports.wbg.__wbg_message_1ee258909d7264fd = function(arg0) {
1923
- const ret = getObject(arg0).message;
1924
- return addHeapObject(ret);
1925
- };
1926
- imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
1927
- const ret = new Object();
1928
- return addHeapObject(ret);
1929
- };
1930
- imports.wbg.__wbg_new_3c3d849046688a66 = function(arg0, arg1) {
1931
- try {
1932
- var state0 = {a: arg0, b: arg1};
1933
- var cb0 = (arg0, arg1) => {
1934
- const a = state0.a;
1935
- state0.a = 0;
1936
- try {
1937
- return __wasm_bindgen_func_elem_5070(a, state0.b, arg0, arg1);
1938
- } finally {
1939
- state0.a = a;
1940
- }
1941
- };
1942
- const ret = new Promise(cb0);
1943
- return addHeapObject(ret);
1944
- } finally {
1945
- state0.a = state0.b = 0;
2437
+ function expectedResponseType(type) {
2438
+ switch (type) {
2439
+ case 'basic': case 'cors': case 'default': return true;
1946
2440
  }
1947
- };
1948
- imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
1949
- const ret = new Uint8Array(getObject(arg0));
1950
- return addHeapObject(ret);
1951
- };
1952
- imports.wbg.__wbg_new_68651c719dcda04e = function() {
1953
- const ret = new Map();
1954
- return addHeapObject(ret);
1955
- };
1956
- imports.wbg.__wbg_new_a7442b4b19c1a356 = function(arg0, arg1) {
1957
- var v0 = getCachedStringFromWasm0(arg0, arg1);
1958
- const ret = new Error(v0);
1959
- return addHeapObject(ret);
1960
- };
1961
- imports.wbg.__wbg_new_e17d9f43105b08be = function() {
1962
- const ret = new Array();
1963
- return addHeapObject(ret);
1964
- };
1965
- imports.wbg.__wbg_new_from_slice_92f4d78ca282a2d2 = function(arg0, arg1) {
1966
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1967
- return addHeapObject(ret);
1968
- };
1969
- imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
1970
- var v0 = getCachedStringFromWasm0(arg0, arg1);
1971
- const ret = new Function(v0);
1972
- return addHeapObject(ret);
1973
- };
1974
- imports.wbg.__wbg_next_020810e0ae8ebcb0 = function() { return handleError(function (arg0) {
1975
- const ret = getObject(arg0).next();
1976
- return addHeapObject(ret);
1977
- }, arguments) };
1978
- imports.wbg.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
1979
- const ret = getObject(arg0).next;
1980
- return addHeapObject(ret);
1981
- };
1982
- imports.wbg.__wbg_now_f5ba683d8ce2c571 = function(arg0) {
1983
- const ret = getObject(arg0).now();
1984
- return ret;
1985
- };
1986
- imports.wbg.__wbg_parse_2a704d6b78abb2b8 = function() { return handleError(function (arg0, arg1) {
1987
- var v0 = getCachedStringFromWasm0(arg0, arg1);
1988
- const ret = JSON.parse(v0);
1989
- return addHeapObject(ret);
1990
- }, arguments) };
1991
- imports.wbg.__wbg_performance_e8315b5ae987e93f = function(arg0) {
1992
- const ret = getObject(arg0).performance;
1993
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1994
- };
1995
- imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
1996
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1997
- };
1998
- imports.wbg.__wbg_push_df81a39d04db858c = function(arg0, arg1) {
1999
- const ret = getObject(arg0).push(getObject(arg1));
2000
- return ret;
2001
- };
2002
- imports.wbg.__wbg_queueMicrotask_34d692c25c47d05b = function(arg0) {
2003
- const ret = getObject(arg0).queueMicrotask;
2004
- return addHeapObject(ret);
2005
- };
2006
- imports.wbg.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
2007
- queueMicrotask(getObject(arg0));
2008
- };
2009
- imports.wbg.__wbg_reject_9d4761245c015a33 = function(arg0) {
2010
- const ret = Promise.reject(getObject(arg0));
2011
- return addHeapObject(ret);
2012
- };
2013
- imports.wbg.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
2014
- const ret = Promise.resolve(getObject(arg0));
2015
- return addHeapObject(ret);
2016
- };
2017
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
2018
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
2019
- };
2020
- imports.wbg.__wbg_set_907fb406c34a251d = function(arg0, arg1, arg2) {
2021
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2022
- return addHeapObject(ret);
2023
- };
2024
- imports.wbg.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
2025
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
2026
- };
2027
- imports.wbg.__wbg_startTime_539df5e9647037f7 = function(arg0) {
2028
- const ret = getObject(arg0).startTime;
2029
- return ret;
2030
- };
2031
- imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
2032
- const ret = typeof global === 'undefined' ? null : global;
2033
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2034
- };
2035
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
2036
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
2037
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2038
- };
2039
- imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
2040
- const ret = typeof self === 'undefined' ? null : self;
2041
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2042
- };
2043
- imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
2044
- const ret = typeof window === 'undefined' ? null : window;
2045
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2046
- };
2047
- imports.wbg.__wbg_stringify_b5fb28f6465d9c3e = function() { return handleError(function (arg0) {
2048
- const ret = JSON.stringify(getObject(arg0));
2049
- return addHeapObject(ret);
2050
- }, arguments) };
2051
- imports.wbg.__wbg_table_new = function(arg0) {
2052
- const ret = Table.__wrap(arg0);
2053
- return addHeapObject(ret);
2054
- };
2055
- imports.wbg.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
2056
- const ret = getObject(arg0).then(getObject(arg1));
2057
- return addHeapObject(ret);
2058
- };
2059
- imports.wbg.__wbg_then_70d05cf780a18d77 = function(arg0, arg1, arg2) {
2060
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
2061
- return addHeapObject(ret);
2062
- };
2063
- imports.wbg.__wbg_toString_7da7c8dbec78fcb8 = function(arg0) {
2064
- const ret = getObject(arg0).toString();
2065
- return addHeapObject(ret);
2066
- };
2067
- imports.wbg.__wbg_trace_8e50cd754f118df3 = function(arg0) {
2068
- console.trace(getObject(arg0));
2069
- };
2070
- imports.wbg.__wbg_trace_cf9f10b8c61bd472 = function(arg0, arg1, arg2, arg3) {
2071
- console.trace(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
2072
- };
2073
- imports.wbg.__wbg_value_692627309814bb8c = function(arg0) {
2074
- const ret = getObject(arg0).value;
2075
- return addHeapObject(ret);
2076
- };
2077
- imports.wbg.__wbg_values_6f4c6a6a11564d83 = function(arg0) {
2078
- const ret = Object.values(getObject(arg0));
2079
- return addHeapObject(ret);
2080
- };
2081
- imports.wbg.__wbg_view_new = function(arg0) {
2082
- const ret = View.__wrap(arg0);
2083
- return addHeapObject(ret);
2084
- };
2085
- imports.wbg.__wbg_view_unwrap = function(arg0) {
2086
- const ret = View.__unwrap(takeObject(arg0));
2087
- return ret;
2088
- };
2089
- imports.wbg.__wbg_warn_1d74dddbe2fd1dbb = function(arg0) {
2090
- console.warn(getObject(arg0));
2091
- };
2092
- imports.wbg.__wbg_warn_8f5b5437666d0885 = function(arg0, arg1, arg2, arg3) {
2093
- console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
2094
- };
2095
- imports.wbg.__wbindgen_cast_25a0a844437d0e92 = function(arg0, arg1) {
2096
- var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
2097
- wasm.__wbindgen_export4(arg0, arg1 * 4, 4);
2098
- // Cast intrinsic for `Vector(NamedExternref("string")) -> Externref`.
2099
- const ret = v0;
2100
- return addHeapObject(ret);
2101
- };
2102
- imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
2103
- // Cast intrinsic for `U64 -> Externref`.
2104
- const ret = BigInt.asUintN(64, arg0);
2105
- return addHeapObject(ret);
2106
- };
2107
- imports.wbg.__wbindgen_cast_58f1ec65de0445ab = function(arg0, arg1) {
2108
- // Cast intrinsic for `Closure(Closure { dtor_idx: 534, function: Function { arguments: [Externref], shim_idx: 535, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2109
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3500, __wasm_bindgen_func_elem_3515);
2110
- return addHeapObject(ret);
2111
- };
2112
- imports.wbg.__wbindgen_cast_77bc3e92745e9a35 = function(arg0, arg1) {
2113
- var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
2114
- wasm.__wbindgen_export4(arg0, arg1 * 1, 1);
2115
- // Cast intrinsic for `Vector(U8) -> Externref`.
2116
- const ret = v0;
2117
- return addHeapObject(ret);
2118
- };
2119
- imports.wbg.__wbindgen_cast_7e9c58eeb11b0a6f = function(arg0, arg1) {
2120
- var v0 = getCachedStringFromWasm0(arg0, arg1);
2121
- // Cast intrinsic for `Ref(CachedString) -> Externref`.
2122
- const ret = v0;
2123
- return addHeapObject(ret);
2124
- };
2125
- imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
2126
- // Cast intrinsic for `I64 -> Externref`.
2127
- const ret = arg0;
2128
- return addHeapObject(ret);
2129
- };
2130
- imports.wbg.__wbindgen_cast_b4f8efd6e03d7eb3 = function(arg0, arg1) {
2131
- // Cast intrinsic for `Closure(Closure { dtor_idx: 2, function: Function { arguments: [], shim_idx: 3, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: false }) -> Externref`.
2132
- const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_123, __wasm_bindgen_func_elem_553);
2133
- return addHeapObject(ret);
2134
- };
2135
- imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
2136
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
2137
- const ret = getArrayU8FromWasm0(arg0, arg1);
2138
- return addHeapObject(ret);
2139
- };
2140
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
2141
- // Cast intrinsic for `F64 -> Externref`.
2142
- const ret = arg0;
2143
- return addHeapObject(ret);
2144
- };
2145
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
2146
- const ret = getObject(arg0);
2147
- return addHeapObject(ret);
2148
- };
2149
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
2150
- takeObject(arg0);
2151
- };
2152
-
2153
- return imports;
2154
- }
2155
-
2156
- function __wbg_finalize_init(instance, module) {
2157
- wasm = instance.exports;
2158
- __wbg_init.__wbindgen_wasm_module = module;
2159
- cachedDataViewMemory0 = null;
2160
- cachedUint8ArrayMemory0 = null;
2161
-
2162
-
2163
-
2164
- return wasm;
2441
+ return false;
2442
+ }
2165
2443
  }
2166
2444
 
2167
2445
  function initSync(module) {
2168
2446
  if (wasm !== undefined) return wasm;
2169
2447
 
2170
2448
 
2171
- if (typeof module !== 'undefined') {
2449
+ if (module !== undefined) {
2172
2450
  if (Object.getPrototypeOf(module) === Object.prototype) {
2173
2451
  ({module} = module)
2174
2452
  } else {
@@ -2177,13 +2455,10 @@ function initSync(module) {
2177
2455
  }
2178
2456
 
2179
2457
  const imports = __wbg_get_imports();
2180
-
2181
2458
  if (!(module instanceof WebAssembly.Module)) {
2182
2459
  module = new WebAssembly.Module(module);
2183
2460
  }
2184
-
2185
2461
  const instance = new WebAssembly.Instance(module, imports);
2186
-
2187
2462
  return __wbg_finalize_init(instance, module);
2188
2463
  }
2189
2464
 
@@ -2191,7 +2466,7 @@ async function __wbg_init(module_or_path) {
2191
2466
  if (wasm !== undefined) return wasm;
2192
2467
 
2193
2468
 
2194
- if (typeof module_or_path !== 'undefined') {
2469
+ if (module_or_path !== undefined) {
2195
2470
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2196
2471
  ({module_or_path} = module_or_path)
2197
2472
  } else {
@@ -2211,5 +2486,4 @@ async function __wbg_init(module_or_path) {
2211
2486
  return __wbg_finalize_init(instance, module);
2212
2487
  }
2213
2488
 
2214
- export { initSync };
2215
- export default __wbg_init;
2489
+ export { initSync, __wbg_init as default };