/* tslint:disable */ /* eslint-disable */ /** * Wrapper around FeltDb for JavaScript interop */ export class JsDb { private constructor(); free(): void; [Symbol.dispose](): void; /** * Acknowledge receipt of operations from a peer * * # Arguments * * `peer_id` - Unique identifier for the peer * * `sequence` - Acknowledge operations up to this sequence number * * # Returns * JsResult with success status */ acknowledge_peer_operations(peer_id: string, sequence: bigint): JsResult; /** * Add a peer for synchronization * * # Arguments * * `peer_id` - Unique identifier for the peer * * # Returns * JsResult with success status */ add_sync_peer(peer_id: string): JsResult; /** * Delete a record from the database. */ delete(key: string): JsResult; execute_canonical_query(schema: string, authorization: string, state_namespace: string, query: string): JsResult; execute_canonical_transaction(schema: string, request: string): JsResult; execute_semantic_decision(request: string): JsResult; /** * Retrieve a record from the database * * # Arguments * * `key` - Key for the record * * # Returns * JSON string of the record or error */ get(key: string): JsResult; /** * Get all records in a capability namespace * * # Arguments * * `capability` - Capability/namespace name * * # Returns * JSON array string of all records in the capability */ get_capability_records(capability: string): JsResult; /** * Get pending operations for a peer since a given sequence * * # Arguments * * `peer_id` - Unique identifier for the peer * * `since_sequence` - Get operations after this sequence number * * # Returns * JSON array of operations as a string */ get_pending_for_peer(peer_id: string, since_sequence: bigint): JsResult; /** * Get the current sequence number for this instance * * # Returns * The current sequence number */ get_sequence(): bigint; /** * Insert a record into the database * * # Arguments * * `key` - Key for the record (e.g., "users:123") * * `value` - JSON object as a string * * # Returns * JsResult with success status */ insert(key: string, value: string): JsResult; /** * Get the instance ID for this FeltDB instance * * # Returns * The unique instance ID as a string */ instance_id(): string; /** * Check if a type is auto-indexed * * # Returns * Whether the default (generic JSON) type is auto-indexed */ is_auto_indexed(): boolean; /** * Query records in the database with a predicate * * For now, this returns all records of a given type namespace as a simplified implementation. * The full closure-based predicate from Rust cannot be directly represented in WASM bindings. * * # Arguments * * `capability` - Capability/namespace to query (e.g., "users") * * # Returns * JSON array string of matching records */ query(capability: string): JsResult; /** * Remove a peer from synchronization * * # Arguments * * `peer_id` - Unique identifier for the peer * * # Returns * JsResult with success status */ remove_sync_peer(peer_id: string): JsResult; /** * Get current sync state information * * # Returns * JSON string containing sync state metrics */ sync_info(): JsResult; /** * Update an existing record through the canonical update operation. */ update(key: string, value: string): JsResult; } /** * Result type for WASM operations */ export class JsResult { private constructor(); free(): void; [Symbol.dispose](): void; readonly data: string | undefined; readonly error: string | undefined; readonly success: boolean; } /** * High-performance analytics engine for index monitoring. * Tracks metrics, generates reports, and provides tuning recommendations. */ export class WasmAnalytics { free(): void; [Symbol.dispose](): void; /** * Generate performance report for a collection. */ generate_report(collection_name: string, period: string): string; /** * Get metrics for all indexes. */ get_all_metrics(): string; /** * Get most frequently accessed fields. */ get_frequent_fields(limit: number): string; /** * Get metrics for a specific index. */ get_index_metrics(index_name: string): string; /** * Get slowest queries. */ get_slowest_queries(limit: number): string; constructor(); /** * Record an index usage event. */ record_index_usage(index_name: string, operation: string, time_ms: number): void; /** * Record a query execution with performance metrics. */ record_query(fields_json: string, operator: string, execution_time_ms: number, rows_scanned: bigint, result_count: bigint, index_used?: string | null): void; /** * Reset all collected metrics. */ reset(): void; } /** * Distributed index manager for multi-node synchronization. * Coordinates index replication, consistency, and conflict resolution. */ export class WasmDistributedIndexManager { free(): void; [Symbol.dispose](): void; /** * Create a replicated index */ create_replicated_index(name: string, field: string, index_type: string): void; /** * Detect version conflicts */ detect_conflicts(index_name: string): string; /** * Get replication status for an index */ get_replication_status(index_name: string): string; /** * Get list of peers needing replication for an index */ get_replication_targets(index_name: string): string; /** * Get overall synchronization status */ get_sync_status(): string; /** * Merge concurrent versions */ merge_versions(index_name: string): void; constructor(peer_id: string); /** * Register a peer for replication */ register_peer(peer_id: string): void; /** * Set peer reachability */ set_peer_reachable(peer_id: string, reachable: boolean): void; } /** * High-performance index manager for collections. * Wraps Rust IndexManager for optimal query performance. */ export class WasmIndexManager { free(): void; [Symbol.dispose](): void; /** * Create a new index on the collection. */ create_index(config: string): void; /** * Get statistics for an index. */ get_stats(name: string): string; /** * List all indexes. */ list_indexes(): string; constructor(); /** * Query an index. */ query_index(index_name: string, operator: string, value: string): string; /** * Update a record's index entries. */ update_record(record_id: string, old_value: string | null | undefined, new_value: string): void; } /** * Shard manager for horizontal scaling. * Distributes data across shards and handles rebalancing. */ export class WasmShardManager { free(): void; [Symbol.dispose](): void; /** * Detect hotspots */ detect_hotspots(): string; /** * Generate rebalance operations */ generate_rebalance_ops(): string; /** * Get all shard metrics */ get_all_metrics(): string; /** * Get distribution summary */ get_distribution_summary(): string; /** * Get shard for a key */ get_shard_for_key(key: string): string; /** * Initialize shards */ initialize_shards(shard_ids_json: string): void; constructor(shard_field: string, strategy: string); /** * Record a shard operation */ record_shard_operation(shard_id: string, operation: string, time_ms: number, records_affected: number, size_bytes: bigint): void; } export function apply_sync_result(local_runtime: string, result: string): string; export function authorize_offline(signed_grant: string, key_id: string, verification_key: string, request: string, grant_chain: string, revocations: string): string; export function canonical_bundle_hash(bundle_json: string): string; /** * Canonicalizes a typed application manifest using the same Rust implementation * used by the server. JavaScript never defines revision identity independently. */ export function canonicalize_application_manifest(input: string): string; export function compare_state_schemas(before: string, after: string): string; export function diff_application_revisions(from: string | null | undefined, to: string): string; /** * Execute one semantic decision through the Rust-authoritative WASM boundary. */ export function execute_semantic_decision(request: string): string; export function hash_application_manifest(input: string): string; export function hash_application_runtime(revision: string, environment: string): string; export function hash_state_schema(schema: string): string; /** * Opens or creates a FeltDB database * * # Arguments * * `path` - Path to the database file * * # Returns * JsDb instance or error */ export function open(path: string): JsDb; export function resolve_application_runtime(revision: string, environment: string): string; export function validate_mesh_claim(claim: string, worker: string, workload: string, now: bigint): void; /** * Validate and canonicalize a typed semantic decision definition in the Rust core. */ export function validate_semantic_decision_definition(definition: string): string; /** * Validate a runtime-produced semantic decision result against the Rust contract. */ export function validate_semantic_decision_result(request: string, result: string): string; export function validate_state_schema(schema: string): string; export function validate_sync_operation(operation: string): string; export function validate_worker_transition(from: string, to: string): boolean; export function validate_workload_transition(from: string, to: string): boolean; export function verify_bundle_integrity(bundle_json: string): boolean; /** * Verify a portable signed grant with the exact Rust canonicalization used by * the server. The verification key is provisioned with the offline app shell. */ export function verify_signed_grant(signed_grant: string, key_id: string, verification_key: string, request: string, grant_chain: string, revocations: string): string; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly __wbg_jsdb_free: (a: number, b: number) => void; readonly __wbg_jsresult_free: (a: number, b: number) => void; readonly __wbg_wasmanalytics_free: (a: number, b: number) => void; readonly __wbg_wasmdistributedindexmanager_free: (a: number, b: number) => void; readonly __wbg_wasmindexmanager_free: (a: number, b: number) => void; readonly __wbg_wasmshardmanager_free: (a: number, b: number) => void; readonly apply_sync_result: (a: number, b: number, c: number, d: number) => [number, number, number, number]; readonly authorize_offline: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number]; readonly canonical_bundle_hash: (a: number, b: number) => [number, number, number, number]; readonly canonicalize_application_manifest: (a: number, b: number) => [number, number, number, number]; readonly compare_state_schemas: (a: number, b: number, c: number, d: number) => [number, number, number, number]; readonly diff_application_revisions: (a: number, b: number, c: number, d: number) => [number, number, number, number]; readonly execute_semantic_decision: (a: number, b: number) => [number, number, number, number]; readonly hash_application_manifest: (a: number, b: number) => [number, number, number, number]; readonly hash_application_runtime: (a: number, b: number, c: number, d: number) => [number, number, number, number]; readonly hash_state_schema: (a: number, b: number) => [number, number, number, number]; readonly jsdb_acknowledge_peer_operations: (a: number, b: number, c: number, d: bigint) => number; readonly jsdb_add_sync_peer: (a: number, b: number, c: number) => number; readonly jsdb_delete: (a: number, b: number, c: number) => number; readonly jsdb_execute_canonical_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number; readonly jsdb_execute_canonical_transaction: (a: number, b: number, c: number, d: number, e: number) => number; readonly jsdb_execute_semantic_decision: (a: number, b: number, c: number) => number; readonly jsdb_get: (a: number, b: number, c: number) => number; readonly jsdb_get_capability_records: (a: number, b: number, c: number) => number; readonly jsdb_get_pending_for_peer: (a: number, b: number, c: number, d: bigint) => number; readonly jsdb_get_sequence: (a: number) => bigint; readonly jsdb_insert: (a: number, b: number, c: number, d: number, e: number) => number; readonly jsdb_instance_id: (a: number) => [number, number]; readonly jsdb_is_auto_indexed: (a: number) => number; readonly jsdb_query: (a: number, b: number, c: number) => number; readonly jsdb_remove_sync_peer: (a: number, b: number, c: number) => number; readonly jsdb_sync_info: (a: number) => number; readonly jsdb_update: (a: number, b: number, c: number, d: number, e: number) => number; readonly jsresult_data: (a: number) => [number, number]; readonly jsresult_error: (a: number) => [number, number]; readonly jsresult_success: (a: number) => number; readonly open: (a: number, b: number) => [number, number, number]; readonly resolve_application_runtime: (a: number, b: number, c: number, d: number) => [number, number, number, number]; readonly validate_mesh_claim: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => [number, number]; readonly validate_semantic_decision_definition: (a: number, b: number) => [number, number, number, number]; readonly validate_semantic_decision_result: (a: number, b: number, c: number, d: number) => [number, number, number, number]; readonly validate_state_schema: (a: number, b: number) => [number, number, number, number]; readonly validate_sync_operation: (a: number, b: number) => [number, number, number, number]; readonly validate_worker_transition: (a: number, b: number, c: number, d: number) => [number, number, number]; readonly validate_workload_transition: (a: number, b: number, c: number, d: number) => [number, number, number]; readonly verify_bundle_integrity: (a: number, b: number) => [number, number, number]; readonly verify_signed_grant: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number]; readonly wasmanalytics_generate_report: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number]; readonly wasmanalytics_get_all_metrics: (a: number) => [number, number, number, number]; readonly wasmanalytics_get_frequent_fields: (a: number, b: number) => [number, number, number, number]; readonly wasmanalytics_get_index_metrics: (a: number, b: number, c: number) => [number, number, number, number]; readonly wasmanalytics_get_slowest_queries: (a: number, b: number) => [number, number, number, number]; readonly wasmanalytics_new: () => number; readonly wasmanalytics_record_index_usage: (a: number, b: number, c: number, d: number, e: number, f: number) => void; readonly wasmanalytics_record_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: bigint, i: number, j: number) => [number, number]; readonly wasmanalytics_reset: (a: number) => void; readonly wasmdistributedindexmanager_create_replicated_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number]; readonly wasmdistributedindexmanager_detect_conflicts: (a: number, b: number, c: number) => [number, number, number, number]; readonly wasmdistributedindexmanager_get_replication_status: (a: number, b: number, c: number) => [number, number, number, number]; readonly wasmdistributedindexmanager_get_replication_targets: (a: number, b: number, c: number) => [number, number, number, number]; readonly wasmdistributedindexmanager_get_sync_status: (a: number) => [number, number, number, number]; readonly wasmdistributedindexmanager_merge_versions: (a: number, b: number, c: number) => [number, number]; readonly wasmdistributedindexmanager_new: (a: number, b: number) => number; readonly wasmdistributedindexmanager_register_peer: (a: number, b: number, c: number) => void; readonly wasmdistributedindexmanager_set_peer_reachable: (a: number, b: number, c: number, d: number) => void; readonly wasmindexmanager_create_index: (a: number, b: number, c: number) => [number, number]; readonly wasmindexmanager_get_stats: (a: number, b: number, c: number) => [number, number, number, number]; readonly wasmindexmanager_list_indexes: (a: number) => [number, number, number, number]; readonly wasmindexmanager_new: () => number; readonly wasmindexmanager_query_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number]; readonly wasmindexmanager_update_record: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number]; readonly wasmshardmanager_detect_hotspots: (a: number) => [number, number, number, number]; readonly wasmshardmanager_generate_rebalance_ops: (a: number) => [number, number, number, number]; readonly wasmshardmanager_get_all_metrics: (a: number) => [number, number, number, number]; readonly wasmshardmanager_get_distribution_summary: (a: number) => [number, number, number, number]; readonly wasmshardmanager_get_shard_for_key: (a: number, b: number, c: number) => [number, number, number, number]; readonly wasmshardmanager_initialize_shards: (a: number, b: number, c: number) => [number, number]; readonly wasmshardmanager_new: (a: number, b: number, c: number, d: number) => number; readonly wasmshardmanager_record_shard_operation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: bigint) => void; readonly __wbindgen_externrefs: WebAssembly.Table; readonly __wbindgen_malloc: (a: number, b: number) => number; readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; readonly __externref_table_dealloc: (a: number) => void; readonly __wbindgen_free: (a: number, b: number, c: number) => void; readonly __wbindgen_start: () => void; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise;