@perspective-dev/client 4.1.1 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/cdn/perspective.js +2 -2
  2. package/dist/cdn/perspective.js.map +4 -4
  3. package/dist/esm/perspective.browser.d.ts +4 -0
  4. package/dist/esm/perspective.inline.js +2 -2
  5. package/dist/esm/perspective.inline.js.map +4 -4
  6. package/dist/esm/perspective.js +2 -2
  7. package/dist/esm/perspective.js.map +4 -4
  8. package/dist/esm/perspective.node.d.ts +9 -0
  9. package/dist/esm/perspective.node.js +1629 -1291
  10. package/dist/esm/perspective.node.js.map +3 -3
  11. package/dist/esm/ts-rs/GroupRollupMode.d.ts +1 -0
  12. package/dist/esm/ts-rs/ViewConfig.d.ts +2 -0
  13. package/dist/esm/ts-rs/ViewConfigUpdate.d.ts +2 -0
  14. package/dist/esm/ts-rs/ViewWindow.d.ts +0 -1
  15. package/dist/esm/virtual_server.d.ts +1 -8
  16. package/dist/esm/virtual_servers/clickhouse.js +2 -0
  17. package/dist/esm/virtual_servers/clickhouse.js.map +7 -0
  18. package/dist/esm/virtual_servers/duckdb.d.ts +22 -7
  19. package/dist/esm/virtual_servers/duckdb.js +1 -11
  20. package/dist/esm/virtual_servers/duckdb.js.map +3 -3
  21. package/dist/wasm/perspective-js.d.ts +723 -647
  22. package/dist/wasm/perspective-js.js +2115 -1841
  23. package/dist/wasm/perspective-js.wasm +0 -0
  24. package/dist/wasm/perspective-js.wasm.d.ts +61 -49
  25. package/package.json +2 -1
  26. package/src/rust/generic_sql_model.rs +189 -0
  27. package/src/rust/lib.rs +2 -2
  28. package/src/rust/utils/console_logger.rs +4 -4
  29. package/src/rust/utils/futures.rs +1 -6
  30. package/src/rust/virtual_server.rs +50 -46
  31. package/src/ts/perspective.browser.ts +15 -2
  32. package/src/ts/perspective.node.ts +21 -1
  33. package/src/ts/ts-rs/GroupRollupMode.ts +3 -0
  34. package/src/ts/ts-rs/ViewConfig.ts +2 -1
  35. package/src/ts/ts-rs/ViewConfigUpdate.ts +2 -1
  36. package/src/ts/ts-rs/ViewWindow.ts +1 -1
  37. package/src/ts/virtual_server.ts +4 -14
  38. package/src/ts/virtual_servers/clickhouse.ts +363 -0
  39. package/src/ts/virtual_servers/duckdb.ts +138 -300
  40. package/tsconfig.json +1 -0
@@ -1,6 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function init(): void;
4
3
 
5
4
  export type * from "../../src/ts/ts-rs/ViewWindow.d.ts";
6
5
  export type * from "../../src/ts/ts-rs/ColumnType.d.ts";
@@ -29,6 +28,7 @@ import type {DeleteOptions} from "../../src/ts/ts-rs/DeleteOptions.d.ts";
29
28
  import type {SystemInfo} from "../../src/ts/ts-rs/SystemInfo.d.ts";
30
29
 
31
30
 
31
+
32
32
  /**
33
33
  * An instance of a [`Client`] is a connection to a single
34
34
  * `perspective_server::Server`, whether locally in-memory or remote over some
@@ -68,381 +68,423 @@ import type {SystemInfo} from "../../src/ts/ts-rs/SystemInfo.d.ts";
68
68
  * ```
69
69
  */
70
70
  export class Client {
71
- free(): void;
72
- [Symbol.dispose](): void;
73
- __getClassname(): string;
74
- constructor(send_request: Function, close?: Function | null);
75
- new_proxy_session(on_response: Function): ProxySession;
76
- handle_response(value: any): Promise<void>;
77
- handle_error(error: string, reconnect?: Function | null): Promise<void>;
78
- on_error(callback: Function): Promise<number>;
79
- /**
80
- * Creates a new [`Table`] from either a _schema_ or _data_.
81
- *
82
- * The [`Client::table`] factory function can be initialized with either a
83
- * _schema_ (see [`Table::schema`]), or data in one of these formats:
84
- *
85
- * - Apache Arrow
86
- * - CSV
87
- * - JSON row-oriented
88
- * - JSON column-oriented
89
- * - NDJSON
90
- *
91
- * When instantiated with _data_, the schema is inferred from this data.
92
- * While this is convenient, inferrence is sometimes imperfect e.g.
93
- * when the input is empty, null or ambiguous. For these cases,
94
- * [`Client::table`] can first be instantiated with a explicit schema.
95
- *
96
- * When instantiated with a _schema_, the resulting [`Table`] is empty but
97
- * with known column names and column types. When subsqeuently
98
- * populated with [`Table::update`], these columns will be _coerced_ to
99
- * the schema's type. This behavior can be useful when
100
- * [`Client::table`]'s column type inferences doesn't work.
101
- *
102
- * The resulting [`Table`] is _virtual_, and invoking its methods
103
- * dispatches events to the `perspective_server::Server` this
104
- * [`Client`] connects to, where the data is stored and all calculation
105
- * occurs.
106
- *
107
- * # Arguments
108
- *
109
- * - `arg` - Either _schema_ or initialization _data_.
110
- * - `options` - Optional configuration which provides one of:
111
- * - `limit` - The max number of rows the resulting [`Table`] can
112
- * store.
113
- * - `index` - The column name to use as an _index_ column. If this
114
- * `Table` is being instantiated by _data_, this column name must be
115
- * present in the data.
116
- * - `name` - The name of the table. This will be generated if it is
117
- * not provided.
118
- * - `format` - The explicit format of the input data, can be one of
119
- * `"json"`, `"columns"`, `"csv"` or `"arrow"`. This overrides
120
- * language-specific type dispatch behavior, which allows stringified
121
- * and byte array alternative inputs.
122
- *
123
- * # JavaScript Examples
124
- *
125
- * Load a CSV from a `string`:
126
- *
127
- * ```javascript
128
- * const table = await client.table("x,y\n1,2\n3,4");
129
- * ```
130
- *
131
- * Load an Arrow from an `ArrayBuffer`:
132
- *
133
- * ```javascript
134
- * import * as fs from "node:fs/promises";
135
- * const table2 = await client.table(await fs.readFile("superstore.arrow"));
136
- * ```
137
- *
138
- * Load a CSV from a `UInt8Array` (the default for this type is Arrow)
139
- * using a format override:
140
- *
141
- * ```javascript
142
- * const enc = new TextEncoder();
143
- * const table = await client.table(enc.encode("x,y\n1,2\n3,4"), {
144
- * format: "csv",
145
- * });
146
- * ```
147
- *
148
- * Create a table with an `index`:
149
- *
150
- * ```javascript
151
- * const table = await client.table(data, { index: "Row ID" });
152
- * ```
153
- */
154
- table(value: string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>, options?: TableInitOptions | null): Promise<Table>;
155
- /**
156
- * Terminates this [`Client`], cleaning up any [`crate::View`] handles the
157
- * [`Client`] has open as well as its callbacks.
158
- */
159
- terminate(): any;
160
- /**
161
- * Opens a [`Table`] that is hosted on the `perspective_server::Server`
162
- * that is connected to this [`Client`].
163
- *
164
- * The `name` property of [`TableInitOptions`] is used to identify each
165
- * [`Table`]. [`Table`] `name`s can be looked up for each [`Client`]
166
- * via [`Client::get_hosted_table_names`].
167
- *
168
- * # JavaScript Examples
169
- *
170
- * Get a virtual [`Table`] named "table_one" from this [`Client`]
171
- *
172
- * ```javascript
173
- * const tables = await client.open_table("table_one");
174
- * ```
175
- */
176
- open_table(entity_id: string): Promise<Table>;
177
- /**
178
- * Retrieves the names of all tables that this client has access to.
179
- *
180
- * `name` is a string identifier unique to the [`Table`] (per [`Client`]),
181
- * which can be used in conjunction with [`Client::open_table`] to get
182
- * a [`Table`] instance without the use of [`Client::table`]
183
- * constructor directly (e.g., one created by another [`Client`]).
184
- *
185
- * # JavaScript Examples
186
- *
187
- * ```javascript
188
- * const tables = await client.get_hosted_table_names();
189
- * ```
190
- */
191
- get_hosted_table_names(): Promise<string[]>;
192
- /**
193
- * Register a callback which is invoked whenever [`Client::table`] (on this
194
- * [`Client`]) or [`Table::delete`] (on a [`Table`] belinging to this
195
- * [`Client`]) are called.
196
- */
197
- on_hosted_tables_update(on_update_js: Function): Promise<number>;
198
- /**
199
- * Remove a callback previously registered via
200
- * `Client::on_hosted_tables_update`.
201
- */
202
- remove_hosted_tables_update(update_id: number): Promise<void>;
203
- /**
204
- * Provides the [`SystemInfo`] struct, implementation-specific metadata
205
- * about the [`perspective_server::Server`] runtime such as Memory and
206
- * CPU usage.
207
- *
208
- * For WebAssembly servers, this method includes the WebAssembly heap size.
209
- *
210
- * # JavaScript Examples
211
- *
212
- * ```javascript
213
- * const info = await client.system_info();
214
- * ```
215
- */
216
- system_info(): Promise<SystemInfo>;
217
- }
218
- export class JsVirtualDataSlice {
219
- free(): void;
220
- [Symbol.dispose](): void;
221
- constructor();
222
- setCol(dtype: string, name: string, index: number, val: any, group_by_index?: number | null): void;
223
- setStringCol(name: string, index: number, val: any, group_by_index?: number | null): void;
224
- setIntegerCol(name: string, index: number, val: any, group_by_index?: number | null): void;
225
- setFloatCol(name: string, index: number, val: any, group_by_index?: number | null): void;
226
- setBooleanCol(name: string, index: number, val: any, group_by_index?: number | null): void;
227
- setDatetimeCol(name: string, index: number, val: any, group_by_index?: number | null): void;
71
+ free(): void;
72
+ [Symbol.dispose](): void;
73
+ __getClassname(): string;
74
+ /**
75
+ * Retrieves the names of all tables that this client has access to.
76
+ *
77
+ * `name` is a string identifier unique to the [`Table`] (per [`Client`]),
78
+ * which can be used in conjunction with [`Client::open_table`] to get
79
+ * a [`Table`] instance without the use of [`Client::table`]
80
+ * constructor directly (e.g., one created by another [`Client`]).
81
+ *
82
+ * # JavaScript Examples
83
+ *
84
+ * ```javascript
85
+ * const tables = await client.get_hosted_table_names();
86
+ * ```
87
+ */
88
+ get_hosted_table_names(): Promise<string[]>;
89
+ handle_error(error: string, reconnect?: Function | null): Promise<void>;
90
+ handle_response(value: any): Promise<void>;
91
+ constructor(send_request: Function, close?: Function | null);
92
+ new_proxy_session(on_response: Function): ProxySession;
93
+ on_error(callback: Function): Promise<number>;
94
+ /**
95
+ * Register a callback which is invoked whenever [`Client::table`] (on this
96
+ * [`Client`]) or [`Table::delete`] (on a [`Table`] belinging to this
97
+ * [`Client`]) are called.
98
+ */
99
+ on_hosted_tables_update(on_update_js: Function): Promise<number>;
100
+ /**
101
+ * Opens a [`Table`] that is hosted on the `perspective_server::Server`
102
+ * that is connected to this [`Client`].
103
+ *
104
+ * The `name` property of [`TableInitOptions`] is used to identify each
105
+ * [`Table`]. [`Table`] `name`s can be looked up for each [`Client`]
106
+ * via [`Client::get_hosted_table_names`].
107
+ *
108
+ * # JavaScript Examples
109
+ *
110
+ * Get a virtual [`Table`] named "table_one" from this [`Client`]
111
+ *
112
+ * ```javascript
113
+ * const tables = await client.open_table("table_one");
114
+ * ```
115
+ */
116
+ open_table(entity_id: string): Promise<Table>;
117
+ /**
118
+ * Remove a callback previously registered via
119
+ * `Client::on_hosted_tables_update`.
120
+ */
121
+ remove_hosted_tables_update(update_id: number): Promise<void>;
122
+ /**
123
+ * Provides the [`SystemInfo`] struct, implementation-specific metadata
124
+ * about the [`perspective_server::Server`] runtime such as Memory and
125
+ * CPU usage.
126
+ *
127
+ * For WebAssembly servers, this method includes the WebAssembly heap size.
128
+ *
129
+ * # JavaScript Examples
130
+ *
131
+ * ```javascript
132
+ * const info = await client.system_info();
133
+ * ```
134
+ */
135
+ system_info(): Promise<SystemInfo>;
136
+ /**
137
+ * Creates a new [`Table`] from either a _schema_ or _data_.
138
+ *
139
+ * The [`Client::table`] factory function can be initialized with either a
140
+ * _schema_ (see [`Table::schema`]), or data in one of these formats:
141
+ *
142
+ * - Apache Arrow
143
+ * - CSV
144
+ * - JSON row-oriented
145
+ * - JSON column-oriented
146
+ * - NDJSON
147
+ *
148
+ * When instantiated with _data_, the schema is inferred from this data.
149
+ * While this is convenient, inferrence is sometimes imperfect e.g.
150
+ * when the input is empty, null or ambiguous. For these cases,
151
+ * [`Client::table`] can first be instantiated with a explicit schema.
152
+ *
153
+ * When instantiated with a _schema_, the resulting [`Table`] is empty but
154
+ * with known column names and column types. When subsqeuently
155
+ * populated with [`Table::update`], these columns will be _coerced_ to
156
+ * the schema's type. This behavior can be useful when
157
+ * [`Client::table`]'s column type inferences doesn't work.
158
+ *
159
+ * The resulting [`Table`] is _virtual_, and invoking its methods
160
+ * dispatches events to the `perspective_server::Server` this
161
+ * [`Client`] connects to, where the data is stored and all calculation
162
+ * occurs.
163
+ *
164
+ * # Arguments
165
+ *
166
+ * - `arg` - Either _schema_ or initialization _data_.
167
+ * - `options` - Optional configuration which provides one of:
168
+ * - `limit` - The max number of rows the resulting [`Table`] can
169
+ * store.
170
+ * - `index` - The column name to use as an _index_ column. If this
171
+ * `Table` is being instantiated by _data_, this column name must be
172
+ * present in the data.
173
+ * - `name` - The name of the table. This will be generated if it is
174
+ * not provided.
175
+ * - `format` - The explicit format of the input data, can be one of
176
+ * `"json"`, `"columns"`, `"csv"` or `"arrow"`. This overrides
177
+ * language-specific type dispatch behavior, which allows stringified
178
+ * and byte array alternative inputs.
179
+ *
180
+ * # JavaScript Examples
181
+ *
182
+ * Load a CSV from a `string`:
183
+ *
184
+ * ```javascript
185
+ * const table = await client.table("x,y\n1,2\n3,4");
186
+ * ```
187
+ *
188
+ * Load an Arrow from an `ArrayBuffer`:
189
+ *
190
+ * ```javascript
191
+ * import * as fs from "node:fs/promises";
192
+ * const table2 = await client.table(await fs.readFile("superstore.arrow"));
193
+ * ```
194
+ *
195
+ * Load a CSV from a `UInt8Array` (the default for this type is Arrow)
196
+ * using a format override:
197
+ *
198
+ * ```javascript
199
+ * const enc = new TextEncoder();
200
+ * const table = await client.table(enc.encode("x,y\n1,2\n3,4"), {
201
+ * format: "csv",
202
+ * });
203
+ * ```
204
+ *
205
+ * Create a table with an `index`:
206
+ *
207
+ * ```javascript
208
+ * const table = await client.table(data, { index: "Row ID" });
209
+ * ```
210
+ */
211
+ table(value: string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>, options?: TableInitOptions | null): Promise<Table>;
212
+ /**
213
+ * Terminates this [`Client`], cleaning up any [`crate::View`] handles the
214
+ * [`Client`] has open as well as its callbacks.
215
+ */
216
+ terminate(): any;
228
217
  }
229
- export class JsVirtualServer {
230
- free(): void;
231
- [Symbol.dispose](): void;
232
- constructor(handler: object);
233
- handleRequest(bytes: Uint8Array): Promise<any>;
218
+
219
+ /**
220
+ * JavaScript-facing DuckDB SQL query builder.
221
+ *
222
+ * This struct wraps the Rust `DuckDBSqlBuilder` and exposes it to JavaScript
223
+ * via wasm_bindgen.
224
+ */
225
+ export class GenericSQLVirtualServerModel {
226
+ free(): void;
227
+ [Symbol.dispose](): void;
228
+ /**
229
+ * Returns the SQL query to list all hosted tables.
230
+ */
231
+ getHostedTables(): string;
232
+ /**
233
+ * Creates a new `JsDuckDBSqlBuilder` instance.
234
+ */
235
+ constructor(args?: any | null);
236
+ /**
237
+ * Returns the SQL query to create a view from a table with the given
238
+ * configuration.
239
+ */
240
+ tableMakeView(table_id: string, view_id: string, config: any): string;
241
+ /**
242
+ * Returns the SQL query to describe a table's schema.
243
+ */
244
+ tableSchema(table_id: string): string;
245
+ /**
246
+ * Returns the SQL query to get the row count of a table.
247
+ */
248
+ tableSize(table_id: string): string;
249
+ /**
250
+ * Returns the SQL query to validate an expression against a table.
251
+ */
252
+ tableValidateExpression(table_id: string, expression: string): string;
253
+ /**
254
+ * Returns the SQL query to get the column count of a view.
255
+ */
256
+ viewColumnSize(view_id: string): string;
257
+ /**
258
+ * Returns the SQL query to delete a view.
259
+ */
260
+ viewDelete(view_id: string): string;
261
+ /**
262
+ * Returns the SQL query to fetch data from a view with the given viewport.
263
+ */
264
+ viewGetData(view_id: string, config: any, viewport: any, schema: any): string;
265
+ /**
266
+ * Returns the SQL query to describe a view's schema.
267
+ */
268
+ viewSchema(view_id: string): string;
269
+ /**
270
+ * Returns the SQL query to get the row count of a view.
271
+ */
272
+ viewSize(view_id: string): string;
234
273
  }
274
+
235
275
  export class ProxySession {
236
- free(): void;
237
- [Symbol.dispose](): void;
238
- constructor(client: Client, on_response: Function);
239
- handle_request(value: any): Promise<void>;
240
- close(): Promise<void>;
276
+ free(): void;
277
+ [Symbol.dispose](): void;
278
+ close(): Promise<void>;
279
+ handle_request(value: any): Promise<void>;
280
+ constructor(client: Client, on_response: Function);
241
281
  }
282
+
242
283
  export class Table {
243
- private constructor();
244
- free(): void;
245
- [Symbol.dispose](): void;
246
- __getClassname(): string;
247
- /**
248
- * Returns the name of the index column for the table.
249
- *
250
- * # JavaScript Examples
251
- *
252
- * ```javascript
253
- * const table = await client.table("x,y\n1,2\n3,4", { index: "x" });
254
- * const index = table.get_index(); // "x"
255
- * ```
256
- */
257
- get_index(): Promise<string>;
258
- /**
259
- * Get a copy of the [`Client`] this [`Table`] came from.
260
- */
261
- get_client(): Promise<Client>;
262
- /**
263
- * Returns the user-specified name for this table, or the auto-generated
264
- * name if a name was not specified when the table was created.
265
- */
266
- get_name(): Promise<string>;
267
- /**
268
- * Returns the user-specified row limit for this table.
269
- */
270
- get_limit(): Promise<number | undefined>;
271
- /**
272
- * Removes all the rows in the [`Table`], but preserves everything else
273
- * including the schema, index, and any callbacks or registered
274
- * [`View`] instances.
275
- *
276
- * Calling [`Table::clear`], like [`Table::update`] and [`Table::remove`],
277
- * will trigger an update event to any registered listeners via
278
- * [`View::on_update`].
279
- */
280
- clear(): Promise<void>;
281
- /**
282
- * Delete this [`Table`] and cleans up associated resources.
283
- *
284
- * [`Table`]s do not stop consuming resources or processing updates when
285
- * they are garbage collected in their host language - you must call
286
- * this method to reclaim these.
287
- *
288
- * # Arguments
289
- *
290
- * - `options` An options dictionary.
291
- * - `lazy` Whether to delete this [`Table`] _lazily_. When false (the
292
- * default), the delete will occur immediately, assuming it has no
293
- * [`View`] instances registered to it (which must be deleted first,
294
- * otherwise this method will throw an error). When true, the
295
- * [`Table`] will only be marked for deltion once its [`View`]
296
- * dependency count reaches 0.
297
- *
298
- * # JavaScript Examples
299
- *
300
- * ```javascript
301
- * const table = await client.table("x,y\n1,2\n3,4");
302
- *
303
- * // ...
304
- *
305
- * await table.delete({ lazy: true });
306
- * ```
307
- */
308
- delete(options?: DeleteOptions | null): Promise<void>;
309
- /**
310
- * Returns the number of rows in a [`Table`].
311
- */
312
- size(): Promise<number>;
313
- /**
314
- * Returns a table's [`Schema`], a mapping of column names to column types.
315
- *
316
- * The mapping of a [`Table`]'s column names to data types is referred to
317
- * as a [`Schema`]. Each column has a unique name and a data type, one
318
- * of:
319
- *
320
- * - `"boolean"` - A boolean type
321
- * - `"date"` - A timesonze-agnostic date type (month/day/year)
322
- * - `"datetime"` - A millisecond-precision datetime type in the UTC
323
- * timezone
324
- * - `"float"` - A 64 bit float
325
- * - `"integer"` - A signed 32 bit integer (the integer type supported by
326
- * JavaScript)
327
- * - `"string"` - A [`String`] data type (encoded internally as a
328
- * _dictionary_)
329
- *
330
- * Note that all [`Table`] columns are _nullable_, regardless of the data
331
- * type.
332
- */
333
- schema(): Promise<Record<string, ColumnType>>;
334
- /**
335
- * Returns the column names of this [`Table`] in "natural" order (the
336
- * ordering implied by the input format).
337
- *
338
- * # JavaScript Examples
339
- *
340
- * ```javascript
341
- * const columns = await table.columns();
342
- * ```
343
- */
344
- columns(): Promise<any>;
345
- /**
346
- * Create a unique channel ID on this [`Table`], which allows
347
- * `View::on_update` callback calls to be associated with the
348
- * `Table::update` which caused them.
349
- */
350
- make_port(): Promise<number>;
351
- /**
352
- * Register a callback which is called exactly once, when this [`Table`] is
353
- * deleted with the [`Table::delete`] method.
354
- *
355
- * [`Table::on_delete`] resolves when the subscription message is sent, not
356
- * when the _delete_ event occurs.
357
- */
358
- on_delete(on_delete: Function): Promise<any>;
359
- /**
360
- * Removes a listener with a given ID, as returned by a previous call to
361
- * [`Table::on_delete`].
362
- */
363
- remove_delete(callback_id: number): Promise<any>;
364
- /**
365
- * Removes rows from this [`Table`] with the `index` column values
366
- * supplied.
367
- *
368
- * # Arguments
369
- *
370
- * - `indices` - A list of `index` column values for rows that should be
371
- * removed.
372
- *
373
- * # JavaScript Examples
374
- *
375
- * ```javascript
376
- * await table.remove([1, 2, 3]);
377
- * ```
378
- */
379
- remove(value: any, options?: UpdateOptions | null): Promise<void>;
380
- /**
381
- * Replace all rows in this [`Table`] with the input data, coerced to this
382
- * [`Table`]'s existing [`perspective_client::Schema`], notifying any
383
- * derived [`View`] and [`View::on_update`] callbacks.
384
- *
385
- * Calling [`Table::replace`] is an easy way to replace _all_ the data in a
386
- * [`Table`] without losing any derived [`View`] instances or
387
- * [`View::on_update`] callbacks. [`Table::replace`] does _not_ infer
388
- * data types like [`Client::table`] does, rather it _coerces_ input
389
- * data to the `Schema` like [`Table::update`]. If you need a [`Table`]
390
- * with a different `Schema`, you must create a new one.
391
- *
392
- * # JavaScript Examples
393
- *
394
- * ```javascript
395
- * await table.replace("x,y\n1,2");
396
- * ```
397
- */
398
- replace(input: any, options?: UpdateOptions | null): Promise<void>;
399
- /**
400
- * Updates the rows of this table and any derived [`View`] instances.
401
- *
402
- * Calling [`Table::update`] will trigger the [`View::on_update`] callbacks
403
- * register to derived [`View`], and the call itself will not resolve until
404
- * _all_ derived [`View`]'s are notified.
405
- *
406
- * When updating a [`Table`] with an `index`, [`Table::update`] supports
407
- * partial updates, by omitting columns from the update data.
408
- *
409
- * # Arguments
410
- *
411
- * - `input` - The input data for this [`Table`]. The schema of a [`Table`]
412
- * is immutable after creation, so this method cannot be called with a
413
- * schema.
414
- * - `options` - Options for this update step - see [`UpdateOptions`].
415
- *
416
- * # JavaScript Examples
417
- *
418
- * ```javascript
419
- * await table.update("x,y\n1,2");
420
- * ```
421
- */
422
- update(input: string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>, options?: UpdateOptions | null): Promise<any>;
423
- /**
424
- * Create a new [`View`] from this table with a specified
425
- * [`ViewConfigUpdate`].
426
- *
427
- * See [`View`] struct.
428
- *
429
- * # JavaScript Examples
430
- *
431
- * ```javascript
432
- * const view = await table.view({
433
- * columns: ["Sales"],
434
- * aggregates: { Sales: "sum" },
435
- * group_by: ["Region", "Country"],
436
- * filter: [["Category", "in", ["Furniture", "Technology"]]],
437
- * });
438
- * ```
439
- */
440
- view(config?: ViewConfigUpdate | null): Promise<View>;
441
- /**
442
- * Validates the given expressions.
443
- */
444
- validate_expressions(exprs: any): Promise<any>;
284
+ private constructor();
285
+ free(): void;
286
+ [Symbol.dispose](): void;
287
+ __getClassname(): string;
288
+ /**
289
+ * Removes all the rows in the [`Table`], but preserves everything else
290
+ * including the schema, index, and any callbacks or registered
291
+ * [`View`] instances.
292
+ *
293
+ * Calling [`Table::clear`], like [`Table::update`] and [`Table::remove`],
294
+ * will trigger an update event to any registered listeners via
295
+ * [`View::on_update`].
296
+ */
297
+ clear(): Promise<void>;
298
+ /**
299
+ * Returns the column names of this [`Table`] in "natural" order (the
300
+ * ordering implied by the input format).
301
+ *
302
+ * # JavaScript Examples
303
+ *
304
+ * ```javascript
305
+ * const columns = await table.columns();
306
+ * ```
307
+ */
308
+ columns(): Promise<any>;
309
+ /**
310
+ * Delete this [`Table`] and cleans up associated resources.
311
+ *
312
+ * [`Table`]s do not stop consuming resources or processing updates when
313
+ * they are garbage collected in their host language - you must call
314
+ * this method to reclaim these.
315
+ *
316
+ * # Arguments
317
+ *
318
+ * - `options` An options dictionary.
319
+ * - `lazy` Whether to delete this [`Table`] _lazily_. When false (the
320
+ * default), the delete will occur immediately, assuming it has no
321
+ * [`View`] instances registered to it (which must be deleted first,
322
+ * otherwise this method will throw an error). When true, the
323
+ * [`Table`] will only be marked for deltion once its [`View`]
324
+ * dependency count reaches 0.
325
+ *
326
+ * # JavaScript Examples
327
+ *
328
+ * ```javascript
329
+ * const table = await client.table("x,y\n1,2\n3,4");
330
+ *
331
+ * // ...
332
+ *
333
+ * await table.delete({ lazy: true });
334
+ * ```
335
+ */
336
+ delete(options?: DeleteOptions | null): Promise<void>;
337
+ /**
338
+ * Get a copy of the [`Client`] this [`Table`] came from.
339
+ */
340
+ get_client(): Promise<Client>;
341
+ /**
342
+ * Returns the name of the index column for the table.
343
+ *
344
+ * # JavaScript Examples
345
+ *
346
+ * ```javascript
347
+ * const table = await client.table("x,y\n1,2\n3,4", { index: "x" });
348
+ * const index = table.get_index(); // "x"
349
+ * ```
350
+ */
351
+ get_index(): Promise<string>;
352
+ /**
353
+ * Returns the user-specified row limit for this table.
354
+ */
355
+ get_limit(): Promise<number | undefined>;
356
+ /**
357
+ * Returns the user-specified name for this table, or the auto-generated
358
+ * name if a name was not specified when the table was created.
359
+ */
360
+ get_name(): Promise<string>;
361
+ /**
362
+ * Create a unique channel ID on this [`Table`], which allows
363
+ * `View::on_update` callback calls to be associated with the
364
+ * `Table::update` which caused them.
365
+ */
366
+ make_port(): Promise<number>;
367
+ /**
368
+ * Register a callback which is called exactly once, when this [`Table`] is
369
+ * deleted with the [`Table::delete`] method.
370
+ *
371
+ * [`Table::on_delete`] resolves when the subscription message is sent, not
372
+ * when the _delete_ event occurs.
373
+ */
374
+ on_delete(on_delete: Function): Promise<any>;
375
+ /**
376
+ * Removes rows from this [`Table`] with the `index` column values
377
+ * supplied.
378
+ *
379
+ * # Arguments
380
+ *
381
+ * - `indices` - A list of `index` column values for rows that should be
382
+ * removed.
383
+ *
384
+ * # JavaScript Examples
385
+ *
386
+ * ```javascript
387
+ * await table.remove([1, 2, 3]);
388
+ * ```
389
+ */
390
+ remove(value: any, options?: UpdateOptions | null): Promise<void>;
391
+ /**
392
+ * Removes a listener with a given ID, as returned by a previous call to
393
+ * [`Table::on_delete`].
394
+ */
395
+ remove_delete(callback_id: number): Promise<any>;
396
+ /**
397
+ * Replace all rows in this [`Table`] with the input data, coerced to this
398
+ * [`Table`]'s existing [`perspective_client::Schema`], notifying any
399
+ * derived [`View`] and [`View::on_update`] callbacks.
400
+ *
401
+ * Calling [`Table::replace`] is an easy way to replace _all_ the data in a
402
+ * [`Table`] without losing any derived [`View`] instances or
403
+ * [`View::on_update`] callbacks. [`Table::replace`] does _not_ infer
404
+ * data types like [`Client::table`] does, rather it _coerces_ input
405
+ * data to the `Schema` like [`Table::update`]. If you need a [`Table`]
406
+ * with a different `Schema`, you must create a new one.
407
+ *
408
+ * # JavaScript Examples
409
+ *
410
+ * ```javascript
411
+ * await table.replace("x,y\n1,2");
412
+ * ```
413
+ */
414
+ replace(input: any, options?: UpdateOptions | null): Promise<void>;
415
+ /**
416
+ * Returns a table's [`Schema`], a mapping of column names to column types.
417
+ *
418
+ * The mapping of a [`Table`]'s column names to data types is referred to
419
+ * as a [`Schema`]. Each column has a unique name and a data type, one
420
+ * of:
421
+ *
422
+ * - `"boolean"` - A boolean type
423
+ * - `"date"` - A timesonze-agnostic date type (month/day/year)
424
+ * - `"datetime"` - A millisecond-precision datetime type in the UTC
425
+ * timezone
426
+ * - `"float"` - A 64 bit float
427
+ * - `"integer"` - A signed 32 bit integer (the integer type supported by
428
+ * JavaScript)
429
+ * - `"string"` - A [`String`] data type (encoded internally as a
430
+ * _dictionary_)
431
+ *
432
+ * Note that all [`Table`] columns are _nullable_, regardless of the data
433
+ * type.
434
+ */
435
+ schema(): Promise<Record<string, ColumnType>>;
436
+ /**
437
+ * Returns the number of rows in a [`Table`].
438
+ */
439
+ size(): Promise<number>;
440
+ /**
441
+ * Updates the rows of this table and any derived [`View`] instances.
442
+ *
443
+ * Calling [`Table::update`] will trigger the [`View::on_update`] callbacks
444
+ * register to derived [`View`], and the call itself will not resolve until
445
+ * _all_ derived [`View`]'s are notified.
446
+ *
447
+ * When updating a [`Table`] with an `index`, [`Table::update`] supports
448
+ * partial updates, by omitting columns from the update data.
449
+ *
450
+ * # Arguments
451
+ *
452
+ * - `input` - The input data for this [`Table`]. The schema of a [`Table`]
453
+ * is immutable after creation, so this method cannot be called with a
454
+ * schema.
455
+ * - `options` - Options for this update step - see [`UpdateOptions`].
456
+ *
457
+ * # JavaScript Examples
458
+ *
459
+ * ```javascript
460
+ * await table.update("x,y\n1,2");
461
+ * ```
462
+ */
463
+ update(input: string | ArrayBuffer | Record<string, unknown[]> | Record<string, unknown>[] | Record<string, ColumnType>, options?: UpdateOptions | null): Promise<any>;
464
+ /**
465
+ * Validates the given expressions.
466
+ */
467
+ validate_expressions(exprs: any): Promise<any>;
468
+ /**
469
+ * Create a new [`View`] from this table with a specified
470
+ * [`ViewConfigUpdate`].
471
+ *
472
+ * See [`View`] struct.
473
+ *
474
+ * # JavaScript Examples
475
+ *
476
+ * ```javascript
477
+ * const view = await table.view({
478
+ * columns: ["Sales"],
479
+ * aggregates: { Sales: "sum" },
480
+ * group_by: ["Region", "Country"],
481
+ * filter: [["Category", "in", ["Furniture", "Technology"]]],
482
+ * });
483
+ * ```
484
+ */
485
+ view(config?: ViewConfigUpdate | null): Promise<View>;
445
486
  }
487
+
446
488
  /**
447
489
  * The [`View`] struct is Perspective's query and serialization interface. It
448
490
  * represents a query on the `Table`'s dataset and is always created from an
@@ -459,293 +501,327 @@ export class Table {
459
501
  * pivots, filters, etc. which can be applied.
460
502
  */
461
503
  export class View {
462
- private constructor();
463
- free(): void;
464
- [Symbol.dispose](): void;
465
- __get_model(): View;
466
- /**
467
- * Returns an array of strings containing the column paths of the [`View`]
468
- * without any of the source columns.
469
- *
470
- * A column path shows the columns that a given cell belongs to after
471
- * pivots are applied.
472
- */
473
- column_paths(window?: ColumnWindow | null): Promise<any>;
474
- /**
475
- * Delete this [`View`] and clean up all resources associated with it.
476
- * [`View`] objects do not stop consuming resources or processing
477
- * updates when they are garbage collected - you must call this method
478
- * to reclaim these.
479
- */
480
- delete(): Promise<void>;
481
- /**
482
- * Returns this [`View`]'s _dimensions_, row and column count, as well as
483
- * those of the [`crate::Table`] from which it was derived.
484
- *
485
- * - `num_table_rows` - The number of rows in the underlying
486
- * [`crate::Table`].
487
- * - `num_table_columns` - The number of columns in the underlying
488
- * [`crate::Table`] (including the `index` column if this
489
- * [`crate::Table`] was constructed with one).
490
- * - `num_view_rows` - The number of rows in this [`View`]. If this
491
- * [`View`] has a `group_by` clause, `num_view_rows` will also include
492
- * aggregated rows.
493
- * - `num_view_columns` - The number of columns in this [`View`]. If this
494
- * [`View`] has a `split_by` clause, `num_view_columns` will include all
495
- * _column paths_, e.g. the number of `columns` clause times the number
496
- * of `split_by` groups.
497
- */
498
- dimensions(): Promise<any>;
499
- /**
500
- * The expression schema of this [`View`], which contains only the
501
- * expressions created on this [`View`]. See [`View::schema`] for
502
- * details.
503
- */
504
- expression_schema(): Promise<any>;
505
- /**
506
- * A copy of the config object passed to the [`Table::view`] method which
507
- * created this [`View`].
508
- */
509
- get_config(): Promise<any>;
510
- /**
511
- * Calculates the [min, max] of the leaf nodes of a column `column_name`.
512
- *
513
- * # Returns
514
- *
515
- * A tuple of [min, max], whose types are column and aggregate dependent.
516
- */
517
- get_min_max(name: string): Promise<Array<any>>;
518
- /**
519
- * The number of aggregated rows in this [`View`]. This is affected by the
520
- * "group_by" configuration parameter supplied to this view's contructor.
521
- *
522
- * # Returns
523
- *
524
- * The number of aggregated rows.
525
- */
526
- num_rows(): Promise<number>;
527
- /**
528
- * The schema of this [`View`].
529
- *
530
- * The [`View`] schema differs from the `schema` returned by
531
- * [`Table::schema`]; it may have different column names due to
532
- * `expressions` or `columns` configs, or it maye have _different
533
- * column types_ due to the application og `group_by` and `aggregates`
534
- * config. You can think of [`Table::schema`] as the _input_ schema and
535
- * [`View::schema`] as the _output_ schema of a Perspective pipeline.
536
- */
537
- schema(): Promise<any>;
538
- /**
539
- * Serializes a [`View`] to the Apache Arrow data format.
540
- */
541
- to_arrow(window?: ViewWindow | null): Promise<ArrayBuffer>;
542
- /**
543
- * Serializes this [`View`] to a string of JSON data. Useful if you want to
544
- * save additional round trip serialize/deserialize cycles.
545
- */
546
- to_columns_string(window?: ViewWindow | null): Promise<string>;
547
- /**
548
- * Serializes this [`View`] to JavaScript objects in a column-oriented
549
- * format.
550
- */
551
- to_columns(window?: ViewWindow | null): Promise<object>;
552
- /**
553
- * Render this `View` as a JSON string.
554
- */
555
- to_json_string(window?: ViewWindow | null): Promise<string>;
556
- /**
557
- * Serializes this [`View`] to JavaScript objects in a row-oriented
558
- * format.
559
- */
560
- to_json(window?: ViewWindow | null): Promise<Array<any>>;
561
- /**
562
- * Renders this [`View`] as an [NDJSON](https://github.com/ndjson/ndjson-spec)
563
- * formatted [`String`].
564
- */
565
- to_ndjson(window?: ViewWindow | null): Promise<string>;
566
- /**
567
- * Serializes this [`View`] to CSV data in a standard format.
568
- */
569
- to_csv(window?: ViewWindow | null): Promise<string>;
570
- /**
571
- * Register a callback with this [`View`]. Whenever the view's underlying
572
- * table emits an update, this callback will be invoked with an object
573
- * containing `port_id`, indicating which port the update fired on, and
574
- * optionally `delta`, which is the new data that was updated for each
575
- * cell or each row.
576
- *
577
- * # Arguments
578
- *
579
- * - `on_update` - A callback function invoked on update, which receives an
580
- * object with two keys: `port_id`, indicating which port the update was
581
- * triggered on, and `delta`, whose value is dependent on the mode
582
- * parameter.
583
- * - `options` - If this is provided as `OnUpdateOptions { mode:
584
- * Some(OnUpdateMode::Row) }`, then `delta` is an Arrow of the updated
585
- * rows. Otherwise `delta` will be [`Option::None`].
586
- *
587
- * # JavaScript Examples
588
- *
589
- * ```javascript
590
- * // Attach an `on_update` callback
591
- * view.on_update((updated) => console.log(updated.port_id));
592
- * ```
593
- *
594
- * ```javascript
595
- * // `on_update` with row deltas
596
- * view.on_update((updated) => console.log(updated.delta), { mode: "row" });
597
- * ```
598
- */
599
- on_update(on_update_js: Function, options?: OnUpdateOptions | null): Promise<any>;
600
- /**
601
- * Unregister a previously registered update callback with this [`View`].
602
- *
603
- * # Arguments
604
- *
605
- * - `id` - A callback `id` as returned by a recipricol call to
606
- * [`View::on_update`].
607
- */
608
- remove_update(callback_id: number): Promise<void>;
609
- /**
610
- * Register a callback with this [`View`]. Whenever the [`View`] is
611
- * deleted, this callback will be invoked.
612
- */
613
- on_delete(on_delete: Function): Promise<any>;
614
- /**
615
- * The number of aggregated columns in this [`View`]. This is affected by
616
- * the "split_by" configuration parameter supplied to this view's
617
- * contructor.
618
- *
619
- * # Returns
620
- *
621
- * The number of aggregated columns.
622
- */
623
- num_columns(): Promise<number>;
624
- /**
625
- * Unregister a previously registered [`View::on_delete`] callback.
626
- */
627
- remove_delete(callback_id: number): Promise<any>;
628
- /**
629
- * Collapses the `group_by` row at `row_index`.
630
- */
631
- collapse(row_index: number): Promise<number>;
632
- /**
633
- * Expand the `group_by` row at `row_index`.
634
- */
635
- expand(row_index: number): Promise<number>;
636
- /**
637
- * Set expansion `depth` of the `group_by` tree.
638
- */
639
- set_depth(depth: number): Promise<void>;
504
+ private constructor();
505
+ free(): void;
506
+ [Symbol.dispose](): void;
507
+ __get_model(): View;
508
+ /**
509
+ * Collapses the `group_by` row at `row_index`.
510
+ */
511
+ collapse(row_index: number): Promise<number>;
512
+ /**
513
+ * Returns an array of strings containing the column paths of the [`View`]
514
+ * without any of the source columns.
515
+ *
516
+ * A column path shows the columns that a given cell belongs to after
517
+ * pivots are applied.
518
+ */
519
+ column_paths(window?: ColumnWindow | null): Promise<any>;
520
+ /**
521
+ * Delete this [`View`] and clean up all resources associated with it.
522
+ * [`View`] objects do not stop consuming resources or processing
523
+ * updates when they are garbage collected - you must call this method
524
+ * to reclaim these.
525
+ */
526
+ delete(): Promise<void>;
527
+ /**
528
+ * Returns this [`View`]'s _dimensions_, row and column count, as well as
529
+ * those of the [`crate::Table`] from which it was derived.
530
+ *
531
+ * - `num_table_rows` - The number of rows in the underlying
532
+ * [`crate::Table`].
533
+ * - `num_table_columns` - The number of columns in the underlying
534
+ * [`crate::Table`] (including the `index` column if this
535
+ * [`crate::Table`] was constructed with one).
536
+ * - `num_view_rows` - The number of rows in this [`View`]. If this
537
+ * [`View`] has a `group_by` clause, `num_view_rows` will also include
538
+ * aggregated rows.
539
+ * - `num_view_columns` - The number of columns in this [`View`]. If this
540
+ * [`View`] has a `split_by` clause, `num_view_columns` will include all
541
+ * _column paths_, e.g. the number of `columns` clause times the number
542
+ * of `split_by` groups.
543
+ */
544
+ dimensions(): Promise<any>;
545
+ /**
546
+ * Expand the `group_by` row at `row_index`.
547
+ */
548
+ expand(row_index: number): Promise<number>;
549
+ /**
550
+ * The expression schema of this [`View`], which contains only the
551
+ * expressions created on this [`View`]. See [`View::schema`] for
552
+ * details.
553
+ */
554
+ expression_schema(): Promise<any>;
555
+ /**
556
+ * A copy of the config object passed to the [`Table::view`] method which
557
+ * created this [`View`].
558
+ */
559
+ get_config(): Promise<any>;
560
+ /**
561
+ * Calculates the [min, max] of the leaf nodes of a column `column_name`.
562
+ *
563
+ * # Returns
564
+ *
565
+ * A tuple of [min, max], whose types are column and aggregate dependent.
566
+ */
567
+ get_min_max(name: string): Promise<Array<any>>;
568
+ /**
569
+ * The number of aggregated columns in this [`View`]. This is affected by
570
+ * the "split_by" configuration parameter supplied to this view's
571
+ * contructor.
572
+ *
573
+ * # Returns
574
+ *
575
+ * The number of aggregated columns.
576
+ */
577
+ num_columns(): Promise<number>;
578
+ /**
579
+ * The number of aggregated rows in this [`View`]. This is affected by the
580
+ * "group_by" configuration parameter supplied to this view's contructor.
581
+ *
582
+ * # Returns
583
+ *
584
+ * The number of aggregated rows.
585
+ */
586
+ num_rows(): Promise<number>;
587
+ /**
588
+ * Register a callback with this [`View`]. Whenever the [`View`] is
589
+ * deleted, this callback will be invoked.
590
+ */
591
+ on_delete(on_delete: Function): Promise<any>;
592
+ /**
593
+ * Register a callback with this [`View`]. Whenever the view's underlying
594
+ * table emits an update, this callback will be invoked with an object
595
+ * containing `port_id`, indicating which port the update fired on, and
596
+ * optionally `delta`, which is the new data that was updated for each
597
+ * cell or each row.
598
+ *
599
+ * # Arguments
600
+ *
601
+ * - `on_update` - A callback function invoked on update, which receives an
602
+ * object with two keys: `port_id`, indicating which port the update was
603
+ * triggered on, and `delta`, whose value is dependent on the mode
604
+ * parameter.
605
+ * - `options` - If this is provided as `OnUpdateOptions { mode:
606
+ * Some(OnUpdateMode::Row) }`, then `delta` is an Arrow of the updated
607
+ * rows. Otherwise `delta` will be [`Option::None`].
608
+ *
609
+ * # JavaScript Examples
610
+ *
611
+ * ```javascript
612
+ * // Attach an `on_update` callback
613
+ * view.on_update((updated) => console.log(updated.port_id));
614
+ * ```
615
+ *
616
+ * ```javascript
617
+ * // `on_update` with row deltas
618
+ * view.on_update((updated) => console.log(updated.delta), { mode: "row" });
619
+ * ```
620
+ */
621
+ on_update(on_update_js: Function, options?: OnUpdateOptions | null): Promise<any>;
622
+ /**
623
+ * Unregister a previously registered [`View::on_delete`] callback.
624
+ */
625
+ remove_delete(callback_id: number): Promise<any>;
626
+ /**
627
+ * Unregister a previously registered update callback with this [`View`].
628
+ *
629
+ * # Arguments
630
+ *
631
+ * - `id` - A callback `id` as returned by a recipricol call to
632
+ * [`View::on_update`].
633
+ */
634
+ remove_update(callback_id: number): Promise<void>;
635
+ /**
636
+ * The schema of this [`View`].
637
+ *
638
+ * The [`View`] schema differs from the `schema` returned by
639
+ * [`Table::schema`]; it may have different column names due to
640
+ * `expressions` or `columns` configs, or it maye have _different
641
+ * column types_ due to the application og `group_by` and `aggregates`
642
+ * config. You can think of [`Table::schema`] as the _input_ schema and
643
+ * [`View::schema`] as the _output_ schema of a Perspective pipeline.
644
+ */
645
+ schema(): Promise<any>;
646
+ /**
647
+ * Set expansion `depth` of the `group_by` tree.
648
+ */
649
+ set_depth(depth: number): Promise<void>;
650
+ /**
651
+ * Serializes a [`View`] to the Apache Arrow data format.
652
+ */
653
+ to_arrow(window?: ViewWindow | null): Promise<ArrayBuffer>;
654
+ /**
655
+ * Serializes this [`View`] to JavaScript objects in a column-oriented
656
+ * format.
657
+ */
658
+ to_columns(window?: ViewWindow | null): Promise<object>;
659
+ /**
660
+ * Serializes this [`View`] to a string of JSON data. Useful if you want to
661
+ * save additional round trip serialize/deserialize cycles.
662
+ */
663
+ to_columns_string(window?: ViewWindow | null): Promise<string>;
664
+ /**
665
+ * Serializes this [`View`] to CSV data in a standard format.
666
+ */
667
+ to_csv(window?: ViewWindow | null): Promise<string>;
668
+ /**
669
+ * Serializes this [`View`] to JavaScript objects in a row-oriented
670
+ * format.
671
+ */
672
+ to_json(window?: ViewWindow | null): Promise<Array<any>>;
673
+ /**
674
+ * Render this `View` as a JSON string.
675
+ */
676
+ to_json_string(window?: ViewWindow | null): Promise<string>;
677
+ /**
678
+ * Renders this [`View`] as an [NDJSON](https://github.com/ndjson/ndjson-spec)
679
+ * formatted [`String`].
680
+ */
681
+ to_ndjson(window?: ViewWindow | null): Promise<string>;
682
+ }
683
+
684
+ export class VirtualDataSlice {
685
+ free(): void;
686
+ [Symbol.dispose](): void;
687
+ constructor(config: ViewConfigUpdate);
688
+ setBooleanCol(name: string, index: number, val: any, group_by_index?: number | null): void;
689
+ setCol(dtype: string, name: string, index: number, val: any, group_by_index?: number | null): void;
690
+ setDatetimeCol(name: string, index: number, val: any, group_by_index?: number | null): void;
691
+ setFloatCol(name: string, index: number, val: any, group_by_index?: number | null): void;
692
+ setIntegerCol(name: string, index: number, val: any, group_by_index?: number | null): void;
693
+ setStringCol(name: string, index: number, val: any, group_by_index?: number | null): void;
640
694
  }
641
695
 
696
+ export class VirtualServer {
697
+ free(): void;
698
+ [Symbol.dispose](): void;
699
+ handleRequest(bytes: Uint8Array): Promise<any>;
700
+ constructor(handler: object);
701
+ }
702
+
703
+ export function init(): void;
704
+
642
705
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
643
706
 
644
707
  export interface InitOutput {
645
- readonly memory: WebAssembly.Memory;
646
- readonly __wbg_proxysession_free: (a: number, b: number) => void;
647
- readonly proxysession_handle_request: (a: number, b: number) => number;
648
- readonly proxysession_close: (a: number) => number;
649
- readonly __wbg_client_free: (a: number, b: number) => void;
650
- readonly client___getClassname: (a: number, b: number) => void;
651
- readonly client_new: (a: number, b: number, c: number) => void;
652
- readonly client_new_proxy_session: (a: number, b: number) => number;
653
- readonly client_handle_response: (a: number, b: number) => number;
654
- readonly client_handle_error: (a: number, b: number, c: number, d: number) => number;
655
- readonly client_on_error: (a: number, b: number) => number;
656
- readonly client_table: (a: number, b: number, c: number) => number;
657
- readonly client_terminate: (a: number, b: number) => void;
658
- readonly client_open_table: (a: number, b: number, c: number) => number;
659
- readonly client_get_hosted_table_names: (a: number) => number;
660
- readonly client_on_hosted_tables_update: (a: number, b: number) => number;
661
- readonly client_remove_hosted_tables_update: (a: number, b: number) => number;
662
- readonly client_system_info: (a: number) => number;
663
- readonly table___getClassname: (a: number, b: number) => void;
664
- readonly __wbg_table_free: (a: number, b: number) => void;
665
- readonly table_get_index: (a: number) => number;
666
- readonly table_get_client: (a: number) => number;
667
- readonly table_get_name: (a: number) => number;
668
- readonly table_get_limit: (a: number) => number;
669
- readonly table_clear: (a: number) => number;
670
- readonly table_delete: (a: number, b: number) => number;
671
- readonly table_size: (a: number) => number;
672
- readonly table_schema: (a: number) => number;
673
- readonly table_columns: (a: number) => number;
674
- readonly table_make_port: (a: number) => number;
675
- readonly table_on_delete: (a: number, b: number) => number;
676
- readonly table_remove_delete: (a: number, b: number) => number;
677
- readonly table_remove: (a: number, b: number, c: number) => number;
678
- readonly table_replace: (a: number, b: number, c: number) => number;
679
- readonly table_update: (a: number, b: number, c: number) => number;
680
- readonly table_view: (a: number, b: number) => number;
681
- readonly table_validate_expressions: (a: number, b: number) => number;
682
- readonly __wbg_view_free: (a: number, b: number) => void;
683
- readonly view___get_model: (a: number) => number;
684
- readonly view_column_paths: (a: number, b: number) => number;
685
- readonly view_delete: (a: number) => number;
686
- readonly view_dimensions: (a: number) => number;
687
- readonly view_expression_schema: (a: number) => number;
688
- readonly view_get_config: (a: number) => number;
689
- readonly view_get_min_max: (a: number, b: number, c: number) => number;
690
- readonly view_num_rows: (a: number) => number;
691
- readonly view_schema: (a: number) => number;
692
- readonly view_to_arrow: (a: number, b: number) => number;
693
- readonly view_to_columns_string: (a: number, b: number) => number;
694
- readonly view_to_columns: (a: number, b: number) => number;
695
- readonly view_to_json_string: (a: number, b: number) => number;
696
- readonly view_to_json: (a: number, b: number) => number;
697
- readonly view_to_ndjson: (a: number, b: number) => number;
698
- readonly view_to_csv: (a: number, b: number) => number;
699
- readonly view_on_update: (a: number, b: number, c: number) => number;
700
- readonly view_remove_update: (a: number, b: number) => number;
701
- readonly view_on_delete: (a: number, b: number) => number;
702
- readonly view_num_columns: (a: number) => number;
703
- readonly view_remove_delete: (a: number, b: number) => number;
704
- readonly view_collapse: (a: number, b: number) => number;
705
- readonly view_expand: (a: number, b: number) => number;
706
- readonly view_set_depth: (a: number, b: number) => number;
707
- readonly __wbg_jsvirtualdataslice_free: (a: number, b: number) => void;
708
- readonly jsvirtualdataslice_new: () => number;
709
- readonly jsvirtualdataslice_setCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
710
- readonly jsvirtualdataslice_setStringCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
711
- readonly jsvirtualdataslice_setIntegerCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
712
- readonly jsvirtualdataslice_setFloatCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
713
- readonly jsvirtualdataslice_setBooleanCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
714
- readonly jsvirtualdataslice_setDatetimeCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
715
- readonly __wbg_jsvirtualserver_free: (a: number, b: number) => void;
716
- readonly jsvirtualserver_new: (a: number, b: number) => void;
717
- readonly jsvirtualserver_handleRequest: (a: number, b: number, c: number) => number;
718
- readonly init: () => void;
719
- readonly proxysession_new: (a: number, b: number) => number;
720
- readonly __wasm_bindgen_func_elem_553: (a: number, b: number) => number;
721
- readonly __wasm_bindgen_func_elem_123: (a: number, b: number) => void;
722
- readonly __wasm_bindgen_func_elem_3515: (a: number, b: number, c: number) => void;
723
- readonly __wasm_bindgen_func_elem_3500: (a: number, b: number) => void;
724
- readonly __wasm_bindgen_func_elem_5070: (a: number, b: number, c: number, d: number) => void;
725
- readonly __wbindgen_export: (a: number, b: number) => number;
726
- readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
727
- readonly __wbindgen_export3: (a: number) => void;
728
- readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
729
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
708
+ readonly memory: WebAssembly.Memory;
709
+ readonly __wbg_client_free: (a: number, b: number) => void;
710
+ readonly __wbg_genericsqlvirtualservermodel_free: (a: number, b: number) => void;
711
+ readonly __wbg_proxysession_free: (a: number, b: number) => void;
712
+ readonly __wbg_table_free: (a: number, b: number) => void;
713
+ readonly __wbg_view_free: (a: number, b: number) => void;
714
+ readonly __wbg_virtualdataslice_free: (a: number, b: number) => void;
715
+ readonly __wbg_virtualserver_free: (a: number, b: number) => void;
716
+ readonly client___getClassname: (a: number, b: number) => void;
717
+ readonly client_get_hosted_table_names: (a: number) => number;
718
+ readonly client_handle_error: (a: number, b: number, c: number, d: number) => number;
719
+ readonly client_handle_response: (a: number, b: number) => number;
720
+ readonly client_new: (a: number, b: number, c: number) => void;
721
+ readonly client_new_proxy_session: (a: number, b: number) => number;
722
+ readonly client_on_error: (a: number, b: number) => number;
723
+ readonly client_on_hosted_tables_update: (a: number, b: number) => number;
724
+ readonly client_open_table: (a: number, b: number, c: number) => number;
725
+ readonly client_remove_hosted_tables_update: (a: number, b: number) => number;
726
+ readonly client_system_info: (a: number) => number;
727
+ readonly client_table: (a: number, b: number, c: number) => number;
728
+ readonly client_terminate: (a: number, b: number) => void;
729
+ readonly genericsqlvirtualservermodel_getHostedTables: (a: number, b: number) => void;
730
+ readonly genericsqlvirtualservermodel_new: (a: number, b: number) => void;
731
+ readonly genericsqlvirtualservermodel_tableMakeView: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
732
+ readonly genericsqlvirtualservermodel_tableSchema: (a: number, b: number, c: number, d: number) => void;
733
+ readonly genericsqlvirtualservermodel_tableSize: (a: number, b: number, c: number, d: number) => void;
734
+ readonly genericsqlvirtualservermodel_tableValidateExpression: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
735
+ readonly genericsqlvirtualservermodel_viewColumnSize: (a: number, b: number, c: number, d: number) => void;
736
+ readonly genericsqlvirtualservermodel_viewDelete: (a: number, b: number, c: number, d: number) => void;
737
+ readonly genericsqlvirtualservermodel_viewGetData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
738
+ readonly genericsqlvirtualservermodel_viewSchema: (a: number, b: number, c: number, d: number) => void;
739
+ readonly genericsqlvirtualservermodel_viewSize: (a: number, b: number, c: number, d: number) => void;
740
+ readonly init: () => void;
741
+ readonly proxysession_close: (a: number) => number;
742
+ readonly proxysession_handle_request: (a: number, b: number) => number;
743
+ readonly proxysession_new: (a: number, b: number) => number;
744
+ readonly table___getClassname: (a: number, b: number) => void;
745
+ readonly table_clear: (a: number) => number;
746
+ readonly table_columns: (a: number) => number;
747
+ readonly table_delete: (a: number, b: number) => number;
748
+ readonly table_get_client: (a: number) => number;
749
+ readonly table_get_index: (a: number) => number;
750
+ readonly table_get_limit: (a: number) => number;
751
+ readonly table_get_name: (a: number) => number;
752
+ readonly table_make_port: (a: number) => number;
753
+ readonly table_on_delete: (a: number, b: number) => number;
754
+ readonly table_remove: (a: number, b: number, c: number) => number;
755
+ readonly table_remove_delete: (a: number, b: number) => number;
756
+ readonly table_replace: (a: number, b: number, c: number) => number;
757
+ readonly table_schema: (a: number) => number;
758
+ readonly table_size: (a: number) => number;
759
+ readonly table_update: (a: number, b: number, c: number) => number;
760
+ readonly table_validate_expressions: (a: number, b: number) => number;
761
+ readonly table_view: (a: number, b: number) => number;
762
+ readonly view___get_model: (a: number) => number;
763
+ readonly view_collapse: (a: number, b: number) => number;
764
+ readonly view_column_paths: (a: number, b: number) => number;
765
+ readonly view_delete: (a: number) => number;
766
+ readonly view_dimensions: (a: number) => number;
767
+ readonly view_expand: (a: number, b: number) => number;
768
+ readonly view_expression_schema: (a: number) => number;
769
+ readonly view_get_config: (a: number) => number;
770
+ readonly view_get_min_max: (a: number, b: number, c: number) => number;
771
+ readonly view_num_columns: (a: number) => number;
772
+ readonly view_num_rows: (a: number) => number;
773
+ readonly view_on_delete: (a: number, b: number) => number;
774
+ readonly view_on_update: (a: number, b: number, c: number) => number;
775
+ readonly view_remove_delete: (a: number, b: number) => number;
776
+ readonly view_remove_update: (a: number, b: number) => number;
777
+ readonly view_schema: (a: number) => number;
778
+ readonly view_set_depth: (a: number, b: number) => number;
779
+ readonly view_to_arrow: (a: number, b: number) => number;
780
+ readonly view_to_columns: (a: number, b: number) => number;
781
+ readonly view_to_columns_string: (a: number, b: number) => number;
782
+ readonly view_to_csv: (a: number, b: number) => number;
783
+ readonly view_to_json: (a: number, b: number) => number;
784
+ readonly view_to_json_string: (a: number, b: number) => number;
785
+ readonly view_to_ndjson: (a: number, b: number) => number;
786
+ readonly virtualdataslice_new: (a: number) => number;
787
+ readonly virtualdataslice_setBooleanCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
788
+ readonly virtualdataslice_setCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
789
+ readonly virtualdataslice_setDatetimeCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
790
+ readonly virtualdataslice_setFloatCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
791
+ readonly virtualdataslice_setIntegerCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
792
+ readonly virtualdataslice_setStringCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
793
+ readonly virtualserver_handleRequest: (a: number, b: number, c: number) => number;
794
+ readonly virtualserver_new: (a: number, b: number) => void;
795
+ readonly __wasm_bindgen_func_elem_813: (a: number, b: number) => void;
796
+ readonly __wasm_bindgen_func_elem_3857: (a: number, b: number) => void;
797
+ readonly __wasm_bindgen_func_elem_5713: (a: number, b: number, c: number, d: number) => void;
798
+ readonly __wasm_bindgen_func_elem_3874: (a: number, b: number, c: number) => void;
799
+ readonly __wasm_bindgen_func_elem_1689: (a: number, b: number) => number;
800
+ readonly __wbindgen_export: (a: number, b: number) => number;
801
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
802
+ readonly __wbindgen_export3: (a: number) => void;
803
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
804
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
730
805
  }
731
806
 
732
807
  export type SyncInitInput = BufferSource | WebAssembly.Module;
808
+
733
809
  /**
734
- * Instantiates the given `module`, which can either be bytes or
735
- * a precompiled `WebAssembly.Module`.
736
- *
737
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
738
- *
739
- * @returns {InitOutput}
740
- */
810
+ * Instantiates the given `module`, which can either be bytes or
811
+ * a precompiled `WebAssembly.Module`.
812
+ *
813
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
814
+ *
815
+ * @returns {InitOutput}
816
+ */
741
817
  export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
742
818
 
743
819
  /**
744
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
745
- * for everything else, calls `WebAssembly.instantiate` directly.
746
- *
747
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
748
- *
749
- * @returns {Promise<InitOutput>}
750
- */
820
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
821
+ * for everything else, calls `WebAssembly.instantiate` directly.
822
+ *
823
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
824
+ *
825
+ * @returns {Promise<InitOutput>}
826
+ */
751
827
  export default function __wbg_init (module_or_path: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;