@perspective-dev/client 5.8.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/perspective.js +3 -3
- package/dist/cdn/perspective.js.map +3 -3
- package/dist/esm/perspective.browser.d.ts +34 -4
- package/dist/esm/perspective.js +2 -2
- package/dist/esm/perspective.js.map +3 -3
- package/dist/esm/perspective.node.d.ts +34 -4
- package/dist/esm/perspective.node.js +69 -77
- package/dist/esm/perspective.node.js.map +3 -3
- package/dist/esm/public_types.d.ts +1 -1
- package/dist/esm/wasm/migrate.d.ts +39 -11
- package/dist/esm/wasm/registry.d.ts +5 -11
- package/dist/esm/wasm/registry.js +2 -2
- package/dist/esm/wasm/registry.js.map +3 -3
- package/dist/ts-rs/OnRemoveData.d.ts +4 -4
- package/dist/ts-rs/RemoveCause.d.ts +7 -0
- package/dist/wasm/perspective-js.d.ts +20 -15
- package/dist/wasm/perspective-js.js +28 -23
- package/dist/wasm/perspective-js.wasm +0 -0
- package/dist/wasm/perspective-js.wasm.d.ts +6 -6
- package/dist/wasm/perspective-migrate.d.ts +7 -0
- package/dist/wasm/perspective-migrate.js +23 -0
- package/dist/wasm/perspective-migrate.wasm +0 -0
- package/dist/wasm/perspective-migrate.wasm.d.ts +1 -0
- package/package.json +5 -5
- package/dist/ts-rs/ViewOnRemoveResp.d.ts +0 -3
|
@@ -4,12 +4,26 @@ import http from "node:http";
|
|
|
4
4
|
import * as perspective_client from "../../dist/wasm/perspective-js.js";
|
|
5
5
|
import { host_supports_memory64 } from "./wasm/features.ts";
|
|
6
6
|
import * as engine from "./wasm/engine.ts";
|
|
7
|
-
import type { MigrateKind, MigrateResult } from "./wasm/migrate.ts";
|
|
7
|
+
import type { MigrateKind, MigrateResult, Validator } from "./wasm/migrate.ts";
|
|
8
8
|
export { host_supports_memory64 } from "./wasm/features.ts";
|
|
9
9
|
export type { InitOptions, WasmBinary, WasmRegistration, WasmSource, } from "./wasm/registry.ts";
|
|
10
|
-
export type { MigrateKind, MigrateNotice, MigrateResult, } from "./wasm/migrate.ts";
|
|
10
|
+
export type { MigrateKind, MigrateNotice, MigrateResult, Validator, } from "./wasm/migrate.ts";
|
|
11
11
|
import * as virtual_server from "./virtual_server.ts";
|
|
12
12
|
export { GenericSQLVirtualServerModel, VirtualDataSlice, VirtualServer, } from "../../dist/wasm/perspective-js.js";
|
|
13
|
+
/**
|
|
14
|
+
* Load the `perspective-migrate` binary and return synchronous `migrate()`
|
|
15
|
+
* and `validate()` over it; the process shares one instance.
|
|
16
|
+
*
|
|
17
|
+
* # Examples
|
|
18
|
+
*
|
|
19
|
+
* ```javascript
|
|
20
|
+
* const validator = await perspective.create_validator();
|
|
21
|
+
* for (const token of tokens) {
|
|
22
|
+
* validator.validate("viewer", token, { strict: true });
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function create_validator(): Promise<Validator>;
|
|
13
27
|
/**
|
|
14
28
|
* Upgrade a persisted config written by any Perspective release since 2.0.0
|
|
15
29
|
* to the current schema.
|
|
@@ -17,13 +31,27 @@ export { GenericSQLVirtualServerModel, VirtualDataSlice, VirtualServer, } from "
|
|
|
17
31
|
* # Arguments
|
|
18
32
|
*
|
|
19
33
|
* - `kind` - `"view"` for a `ViewConfig`, `"viewer"` for a
|
|
20
|
-
* `<perspective-viewer>` `save()` token,
|
|
21
|
-
* `saveWorkspace()` token.
|
|
34
|
+
* `<perspective-viewer>` `save()` token, `"panel"` for one workspace
|
|
35
|
+
* panel, or `"workspace"` for a `saveWorkspace()` token.
|
|
22
36
|
* - `config` - The config to upgrade.
|
|
23
37
|
* - `from_version` - The release which wrote `config`, used only when it has
|
|
24
38
|
* no `version` field.
|
|
25
39
|
*/
|
|
26
40
|
export declare function migrate<T = Record<string, unknown>>(kind: MigrateKind, config: unknown, from_version?: string): Promise<MigrateResult<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* Check that a config is valid for this release without migrating it,
|
|
43
|
+
* rejecting with the offending JSON pointer and reason otherwise.
|
|
44
|
+
*
|
|
45
|
+
* # Arguments
|
|
46
|
+
*
|
|
47
|
+
* - `kind` - `"view"`, `"viewer"`, `"panel"` or `"workspace"`.
|
|
48
|
+
* - `config` - The config to check.
|
|
49
|
+
* - `options.strict` - Require the complete `save()` form rather than the
|
|
50
|
+
* field-wise `restore()` update form.
|
|
51
|
+
*/
|
|
52
|
+
export declare function validate(kind: MigrateKind, config: unknown, options?: {
|
|
53
|
+
strict?: boolean;
|
|
54
|
+
}): Promise<void>;
|
|
27
55
|
export declare class PerspectiveServer extends engine.PerspectiveServer {
|
|
28
56
|
constructor(options?: engine.PerspectiveServerOptions);
|
|
29
57
|
}
|
|
@@ -101,7 +129,9 @@ declare const _default: {
|
|
|
101
129
|
join: typeof join;
|
|
102
130
|
websocket: typeof websocket;
|
|
103
131
|
worker: typeof worker;
|
|
132
|
+
create_validator: typeof create_validator;
|
|
104
133
|
migrate: typeof migrate;
|
|
134
|
+
validate: typeof validate;
|
|
105
135
|
host_supports_memory64: typeof host_supports_memory64;
|
|
106
136
|
get_hosted_table_names: typeof get_hosted_table_names;
|
|
107
137
|
on_hosted_tables_update: typeof on_hosted_tables_update;
|
|
@@ -1576,19 +1576,24 @@ var View = class _View {
|
|
|
1576
1576
|
return takeObject(ret);
|
|
1577
1577
|
}
|
|
1578
1578
|
/**
|
|
1579
|
-
* Register a callback which is invoked whenever rows
|
|
1580
|
-
*
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1579
|
+
* Register a callback which is invoked whenever rows leave this
|
|
1580
|
+
* [`View`], with an object containing `port_id`, `indices` (their keys
|
|
1581
|
+
* as an Arrow of one column per key column named after it) and `cause`,
|
|
1582
|
+
* one of `"key"`, `"filter"` or `"group"`.
|
|
1583
1583
|
*
|
|
1584
|
-
* [`
|
|
1585
|
-
* [`Table
|
|
1586
|
-
* [`Table`]
|
|
1584
|
+
* For a [`View`] without `group_by` the keys are the `index` columns of
|
|
1585
|
+
* the [`Table`], which must have one: `"key"` when [`Table::remove`]
|
|
1586
|
+
* removed them ([`Table::replace`] reports the keys it does not
|
|
1587
|
+
* re-supply and [`Table::clear`] every key) and `"filter"` when
|
|
1588
|
+
* [`Table::update`] moved them outside the [`View`]'s `filter`. For a
|
|
1589
|
+
* [`View`] with `group_by` the keys are the `group_by` columns of each
|
|
1590
|
+
* group which no longer has any rows, `"group"`, `null` below the
|
|
1591
|
+
* group's depth. It fires once per cause per update step.
|
|
1587
1592
|
*
|
|
1588
1593
|
* # JavaScript Examples
|
|
1589
1594
|
*
|
|
1590
1595
|
* ```javascript
|
|
1591
|
-
* const id = await view.on_remove(({ indices, port_id }) => {
|
|
1596
|
+
* const id = await view.on_remove(({ indices, port_id, cause }) => {
|
|
1592
1597
|
* replica.remove(indices);
|
|
1593
1598
|
* });
|
|
1594
1599
|
* ```
|
|
@@ -2377,7 +2382,7 @@ function __wbg_get_imports() {
|
|
|
2377
2382
|
const a = state0.a;
|
|
2378
2383
|
state0.a = 0;
|
|
2379
2384
|
try {
|
|
2380
|
-
return
|
|
2385
|
+
return __wasm_bindgen_func_elem_13332(a, state0.b, arg02, arg12);
|
|
2381
2386
|
} finally {
|
|
2382
2387
|
state0.a = a;
|
|
2383
2388
|
}
|
|
@@ -2456,7 +2461,7 @@ function __wbg_get_imports() {
|
|
|
2456
2461
|
const ret = Promise.resolve(getObject(arg0));
|
|
2457
2462
|
return addHeapObject(ret);
|
|
2458
2463
|
},
|
|
2459
|
-
|
|
2464
|
+
__wbg_run_ce6bcc7f4952334e: function() {
|
|
2460
2465
|
return handleError(function(arg0, arg1) {
|
|
2461
2466
|
const ret = getObject(arg0).run(getObject(arg1));
|
|
2462
2467
|
return addHeapObject(ret);
|
|
@@ -2553,15 +2558,15 @@ function __wbg_get_imports() {
|
|
|
2553
2558
|
console.warn(getObject(arg0));
|
|
2554
2559
|
},
|
|
2555
2560
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2556
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
2561
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1751, __wasm_bindgen_func_elem_2093);
|
|
2557
2562
|
return addHeapObject(ret);
|
|
2558
2563
|
},
|
|
2559
2564
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2560
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
2565
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1751, __wasm_bindgen_func_elem_2094);
|
|
2561
2566
|
return addHeapObject(ret);
|
|
2562
2567
|
},
|
|
2563
2568
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2564
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
2569
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_4765, __wasm_bindgen_func_elem_4767);
|
|
2565
2570
|
return addHeapObject(ret);
|
|
2566
2571
|
},
|
|
2567
2572
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -2626,18 +2631,18 @@ function __wbg_get_imports() {
|
|
|
2626
2631
|
"./perspective-js.wasm_bg.js": import0
|
|
2627
2632
|
};
|
|
2628
2633
|
}
|
|
2629
|
-
function
|
|
2630
|
-
wasm.
|
|
2634
|
+
function __wasm_bindgen_func_elem_2094(arg0, arg1) {
|
|
2635
|
+
wasm.__wasm_bindgen_func_elem_2094(arg0, arg1);
|
|
2631
2636
|
}
|
|
2632
|
-
function
|
|
2633
|
-
const ret = wasm.
|
|
2637
|
+
function __wasm_bindgen_func_elem_2093(arg0, arg1) {
|
|
2638
|
+
const ret = wasm.__wasm_bindgen_func_elem_2093(arg0, arg1);
|
|
2634
2639
|
return takeObject(ret);
|
|
2635
2640
|
}
|
|
2636
|
-
function
|
|
2637
|
-
wasm.
|
|
2641
|
+
function __wasm_bindgen_func_elem_4767(arg0, arg1, arg2) {
|
|
2642
|
+
wasm.__wasm_bindgen_func_elem_4767(arg0, arg1, addHeapObject(arg2));
|
|
2638
2643
|
}
|
|
2639
|
-
function
|
|
2640
|
-
wasm.
|
|
2644
|
+
function __wasm_bindgen_func_elem_13332(arg0, arg1, arg2, arg3) {
|
|
2645
|
+
wasm.__wasm_bindgen_func_elem_13332(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
2641
2646
|
}
|
|
2642
2647
|
var ClientFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
2643
2648
|
}, unregister: () => {
|
|
@@ -3278,12 +3283,6 @@ async function decode_api_responses(core, ptr, callback) {
|
|
|
3278
3283
|
}
|
|
3279
3284
|
|
|
3280
3285
|
// dist/wasm/perspective-migrate.js
|
|
3281
|
-
var perspective_migrate_exports = {};
|
|
3282
|
-
__export(perspective_migrate_exports, {
|
|
3283
|
-
default: () => __wbg_init2,
|
|
3284
|
-
initSync: () => initSync2,
|
|
3285
|
-
migrate: () => migrate
|
|
3286
|
-
});
|
|
3287
3286
|
function migrate(kind, from, value) {
|
|
3288
3287
|
try {
|
|
3289
3288
|
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
@@ -3303,6 +3302,21 @@ function migrate(kind, from, value) {
|
|
|
3303
3302
|
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
3304
3303
|
}
|
|
3305
3304
|
}
|
|
3305
|
+
function validate_config(kind, value, strict) {
|
|
3306
|
+
try {
|
|
3307
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
3308
|
+
const ptr0 = passStringToWasm02(kind, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
3309
|
+
const len0 = WASM_VECTOR_LEN2;
|
|
3310
|
+
wasm2.validate_config(retptr, ptr0, len0, addHeapObject2(value), isLikeNone2(strict) ? 16777215 : strict ? 1 : 0);
|
|
3311
|
+
var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
|
|
3312
|
+
var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
|
|
3313
|
+
if (r1) {
|
|
3314
|
+
throw takeObject2(r0);
|
|
3315
|
+
}
|
|
3316
|
+
} finally {
|
|
3317
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3306
3320
|
function __wbg_get_imports2() {
|
|
3307
3321
|
const import0 = {
|
|
3308
3322
|
__proto__: null,
|
|
@@ -3722,22 +3736,6 @@ async function __wbg_load2(module, imports) {
|
|
|
3722
3736
|
return false;
|
|
3723
3737
|
}
|
|
3724
3738
|
}
|
|
3725
|
-
function initSync2(module) {
|
|
3726
|
-
if (wasm2 !== void 0) return wasm2;
|
|
3727
|
-
if (module !== void 0) {
|
|
3728
|
-
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
3729
|
-
({ module } = module);
|
|
3730
|
-
} else {
|
|
3731
|
-
console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
|
|
3732
|
-
}
|
|
3733
|
-
}
|
|
3734
|
-
const imports = __wbg_get_imports2();
|
|
3735
|
-
if (!(module instanceof WebAssembly.Module)) {
|
|
3736
|
-
module = new WebAssembly.Module(module);
|
|
3737
|
-
}
|
|
3738
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
3739
|
-
return __wbg_finalize_init2(instance, module);
|
|
3740
|
-
}
|
|
3741
3739
|
async function __wbg_init2(module_or_path) {
|
|
3742
3740
|
if (wasm2 !== void 0) return wasm2;
|
|
3743
3741
|
if (module_or_path !== void 0) {
|
|
@@ -3756,34 +3754,21 @@ async function __wbg_init2(module_or_path) {
|
|
|
3756
3754
|
}
|
|
3757
3755
|
|
|
3758
3756
|
// src/ts/wasm/migrate.ts
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
const source = this.source;
|
|
3772
|
-
const module = source().then(async (module_or_path) => {
|
|
3773
|
-
await __wbg_init2({ module_or_path });
|
|
3774
|
-
return perspective_migrate_exports;
|
|
3775
|
-
});
|
|
3776
|
-
this.module = module;
|
|
3777
|
-
module.catch(() => {
|
|
3778
|
-
if (this.module === module) {
|
|
3779
|
-
this.module = void 0;
|
|
3780
|
-
}
|
|
3781
|
-
});
|
|
3757
|
+
async function load_validator(binary) {
|
|
3758
|
+
await __wbg_init2({ module_or_path: binary });
|
|
3759
|
+
return {
|
|
3760
|
+
migrate(kind, config, from_version) {
|
|
3761
|
+
return migrate(
|
|
3762
|
+
kind,
|
|
3763
|
+
from_version,
|
|
3764
|
+
config
|
|
3765
|
+
);
|
|
3766
|
+
},
|
|
3767
|
+
validate(kind, config, options) {
|
|
3768
|
+
validate_config(kind, config, options?.strict);
|
|
3782
3769
|
}
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
}
|
|
3786
|
-
};
|
|
3770
|
+
};
|
|
3771
|
+
}
|
|
3787
3772
|
|
|
3788
3773
|
// src/ts/wasm/perspective-server.poly.ts
|
|
3789
3774
|
var out = console.log.bind(console);
|
|
@@ -4262,15 +4247,18 @@ if (!globalThis.crypto) {
|
|
|
4262
4247
|
}
|
|
4263
4248
|
var uncompressed_client_wasm = await fs.readFile(path.join(__dirname, "../../dist/wasm/perspective-js.wasm")).then((buffer) => load_wasm_stage_0(buffer.buffer));
|
|
4264
4249
|
await __wbg_init({ module_or_path: uncompressed_client_wasm });
|
|
4265
|
-
var
|
|
4266
|
-
|
|
4267
|
-
|
|
4250
|
+
var VALIDATOR;
|
|
4251
|
+
async function create_validator() {
|
|
4252
|
+
VALIDATOR ??= fs.readFile(
|
|
4268
4253
|
path.join(__dirname, "../../dist/wasm/perspective-migrate.wasm")
|
|
4269
|
-
);
|
|
4270
|
-
return await
|
|
4271
|
-
}
|
|
4254
|
+
).then((buffer) => load_wasm_stage_0(buffer.buffer)).then(load_validator);
|
|
4255
|
+
return await VALIDATOR;
|
|
4256
|
+
}
|
|
4272
4257
|
async function migrate2(kind, config, from_version) {
|
|
4273
|
-
return await
|
|
4258
|
+
return (await create_validator()).migrate(kind, config, from_version);
|
|
4259
|
+
}
|
|
4260
|
+
async function validate(kind, config, options) {
|
|
4261
|
+
(await create_validator()).validate(kind, config, options);
|
|
4274
4262
|
}
|
|
4275
4263
|
function make_node_disk_bridge({
|
|
4276
4264
|
heap: heap3,
|
|
@@ -4593,7 +4581,9 @@ var perspective_node_default = {
|
|
|
4593
4581
|
join,
|
|
4594
4582
|
websocket: websocket2,
|
|
4595
4583
|
worker,
|
|
4584
|
+
create_validator,
|
|
4596
4585
|
migrate: migrate2,
|
|
4586
|
+
validate,
|
|
4597
4587
|
host_supports_memory64,
|
|
4598
4588
|
get_hosted_table_names,
|
|
4599
4589
|
on_hosted_tables_update,
|
|
@@ -4612,6 +4602,7 @@ export {
|
|
|
4612
4602
|
VirtualServer,
|
|
4613
4603
|
WebSocketServer,
|
|
4614
4604
|
createMessageHandler2 as createMessageHandler,
|
|
4605
|
+
create_validator,
|
|
4615
4606
|
cwd_static_file_handler,
|
|
4616
4607
|
perspective_node_default as default,
|
|
4617
4608
|
get_hosted_table_names,
|
|
@@ -4625,6 +4616,7 @@ export {
|
|
|
4625
4616
|
remove_hosted_tables_update,
|
|
4626
4617
|
system_info,
|
|
4627
4618
|
table,
|
|
4619
|
+
validate,
|
|
4628
4620
|
perspective_js_exports as wasmModule,
|
|
4629
4621
|
websocket2 as websocket,
|
|
4630
4622
|
worker
|