import type * as wasm_module_type from "../../dist/wasm/perspective-viewer.js"; import type { InitOptions, MigrateKind, MigrateResult, Validator, WasmRegistration } from "@perspective-dev/client/registry"; export type { InitOptions, WasmBinary, WasmRegistration, WasmSource, } from "@perspective-dev/client/registry"; /** * Register Perspective's WebAssembly binaries for this page; the same function * as `@perspective-dev/client`'s `init()`. */ export declare function init(wasm: WasmRegistration, options?: InitOptions): Promise; /** * A WebAssembly binary in any form `init_client` accepts; thunks are only * invoked when the binary is needed. */ export type ViewerWasmSource = Promise | Response | ArrayBuffer | Uint8Array | (() => Promise); /** * The `` binary, and the `perspective-migrate` binary * behind `migrate()`. */ export interface ViewerWasmRegistration { viewer?: ViewerWasmSource; migrate?: ViewerWasmSource; } /** * Initialize `` from its WebAssembly binary, and register * the `perspective-migrate` binary which `migrate()` downloads on first use; * a wrapper over `init()`'s `viewer` and `migrate` roles. * * # Examples * * ```javascript * await init_client({ * viewer: () => fetch("perspective-viewer.wasm"), * migrate: () => fetch("perspective-migrate.wasm"), * }); * ``` */ export declare function init_client(wasm: ViewerWasmSource | ViewerWasmRegistration, wasm_module?: typeof wasm_module_type): Promise; /** * Load the `migrate` binary registered with `init()` and return synchronous * `migrate()` and `validate()` over it; the page shares one instance. * * # Examples * * ```javascript * const validator = await perspective_viewer.create_validator(); * for (const token of tokens) { * validator.validate("viewer", token, { strict: true }); * } * ``` */ export declare function create_validator(): Promise; /** * Upgrade a persisted config written by any Perspective release since 2.0.0 * to the current schema, using the `migrate` binary registered with `init()`. * * # Arguments * * - `kind` - `"view"` for a `ViewConfig`, `"viewer"` for a `save()` token, * `"panel"` for one workspace panel, or `"workspace"` for a * `saveWorkspace()` token. * - `config` - The config to upgrade. * - `from_version` - The release which wrote `config`, used only when it has * no `version` field. */ export declare function migrate>(kind: MigrateKind, config: unknown, from_version?: string): Promise>; /** * Check that a config is valid for this release without migrating it, * rejecting with the offending JSON pointer and reason otherwise. * * # Arguments * * - `kind` - `"view"`, `"viewer"`, `"panel"` or `"workspace"`. * - `config` - The config to check. * - `options.strict` - Require the complete `save()` form rather than the * field-wise `restore()` update form. */ export declare function validate(kind: MigrateKind, config: unknown, options?: { strict?: boolean; }): Promise;