@xnetjs/data-bridge 0.0.2 → 0.0.3

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.
@@ -0,0 +1,547 @@
1
+ import * as _xnetjs_data from '@xnetjs/data';
2
+ import { NodeState, SchemaIRI, PropertyBuilder, DefinedSchema, InferCreateProps, NodeQueryPageCountMode, NodeQueryPlanMetadata, NodeBatchWriteInput, NodeBatchWriteResult, TransactionOperation, NodeChangeEvent, ListNodesOptions } from '@xnetjs/data';
3
+ import { Awareness } from 'y-protocols/awareness';
4
+ import { Doc } from 'yjs';
5
+
6
+ /**
7
+ * Query stream event types and deterministic reducers.
8
+ */
9
+
10
+ type QueryStreamEvent = {
11
+ type: 'snapshot';
12
+ nodes: NodeState[];
13
+ metadata?: QueryMetadata | null;
14
+ } | {
15
+ type: 'insert';
16
+ node: NodeState;
17
+ index?: number;
18
+ metadata?: QueryMetadata | null;
19
+ } | {
20
+ type: 'update';
21
+ nodeId: string;
22
+ node: NodeState;
23
+ metadata?: QueryMetadata | null;
24
+ } | {
25
+ type: 'delete';
26
+ nodeId: string;
27
+ metadata?: QueryMetadata | null;
28
+ } | {
29
+ type: 'reset';
30
+ reason: QueryStreamResetReason;
31
+ nodes?: NodeState[];
32
+ metadata?: QueryMetadata | null;
33
+ } | {
34
+ type: 'progress';
35
+ progress: QueryStreamProgress;
36
+ metadata?: QueryMetadata | null;
37
+ } | {
38
+ type: 'error';
39
+ error: string;
40
+ code?: string;
41
+ recoverable?: boolean;
42
+ metadata?: QueryMetadata | null;
43
+ };
44
+ type QueryStreamState = {
45
+ data: NodeState[] | null;
46
+ metadata: QueryMetadata | null;
47
+ progress: QueryStreamProgress | null;
48
+ error: string | null;
49
+ status: QueryStreamStatus;
50
+ };
51
+ declare function createQueryStreamState(input?: {
52
+ data?: NodeState[] | null;
53
+ metadata?: QueryMetadata | null;
54
+ progress?: QueryStreamProgress | null;
55
+ error?: string | null;
56
+ status?: QueryStreamStatus;
57
+ }): QueryStreamState;
58
+ declare function reduceQueryStreamEvent(state: QueryStreamState, event: QueryStreamEvent): QueryStreamState;
59
+ declare function reduceQueryStreamEvents(state: QueryStreamState, events: readonly QueryStreamEvent[]): QueryStreamState;
60
+
61
+ /**
62
+ * Versioned protocol types for future remote Node descriptor reads.
63
+ */
64
+
65
+ declare const REMOTE_NODE_QUERY_PROTOCOL = "xnet.node-query";
66
+ declare const REMOTE_NODE_QUERY_PROTOCOL_VERSION = 1;
67
+ type RemoteNodeQuerySource = Extract<QuerySourcePreference, 'hub' | 'federated'>;
68
+ type RemoteNodeQueryMode = Extract<QueryExecutionMode, 'local-then-remote' | 'remote' | 'live' | 'stream'>;
69
+ type RemoteNodeQueryAuth = {
70
+ bearerToken?: string;
71
+ ucan?: string;
72
+ capabilities?: string[];
73
+ };
74
+ type RemoteNodeQueryClientState = {
75
+ localSnapshotAt?: number;
76
+ knownNodeIds?: string[];
77
+ };
78
+ type RemoteQueryCompleteness = QueryCompletenessMetadata;
79
+ type RemoteQueryStaleness = QueryStalenessMetadata;
80
+ type RemoteQueryVerification = QueryVerificationMetadata;
81
+ type RemoteNodeQueryRequest = {
82
+ protocol: typeof REMOTE_NODE_QUERY_PROTOCOL;
83
+ version: typeof REMOTE_NODE_QUERY_PROTOCOL_VERSION;
84
+ requestId: string;
85
+ descriptor: QueryDescriptor;
86
+ mode: RemoteNodeQueryMode;
87
+ source: RemoteNodeQuerySource;
88
+ requestedAt: number;
89
+ auth?: RemoteNodeQueryAuth;
90
+ client?: RemoteNodeQueryClientState;
91
+ };
92
+ type RemoteNodeQuerySuccessResponse = {
93
+ type: 'node-query/result';
94
+ requestId: string;
95
+ source: RemoteNodeQuerySource;
96
+ nodes: NodeState[];
97
+ pageInfo: QueryPageInfo;
98
+ metadata: QueryMetadata;
99
+ completeness: RemoteQueryCompleteness;
100
+ staleness: RemoteQueryStaleness;
101
+ verification: RemoteQueryVerification;
102
+ };
103
+ type RemoteNodeQueryErrorResponse = {
104
+ type: 'node-query/error';
105
+ requestId: string;
106
+ source: RemoteNodeQuerySource;
107
+ code: 'AUTH_DENIED' | 'REMOTE_UNAVAILABLE' | 'QUERY_UNSUPPORTED' | 'TIMEOUT' | 'VERIFICATION_FAILED' | 'UNKNOWN';
108
+ message: string;
109
+ retryAfterMs?: number;
110
+ };
111
+ type RemoteNodeQueryResponse = RemoteNodeQuerySuccessResponse | RemoteNodeQueryErrorResponse;
112
+ type RemoteNodeQueryStreamObserver = {
113
+ next(event: QueryStreamEvent): void;
114
+ error?(error: Error): void;
115
+ complete?(): void;
116
+ };
117
+ type RemoteNodeQueryStreamController = {
118
+ unsubscribe(): void;
119
+ };
120
+ type RemoteNodeQueryStreamSubscription = RemoteNodeQueryStreamController | (() => void) | void;
121
+ type RemoteNodeQueryInvalidationReason = 'poke' | 'descriptor-invalidated' | 'schema-invalidated' | 'node-invalidated';
122
+ type RemoteNodeQueryInvalidation = {
123
+ type: 'node-query/invalidate';
124
+ source?: RemoteNodeQuerySource;
125
+ requestId?: string;
126
+ descriptor?: QueryDescriptor;
127
+ schemaId?: SchemaIRI;
128
+ nodeIds?: string[];
129
+ reason?: RemoteNodeQueryInvalidationReason;
130
+ invalidatedAt?: number;
131
+ };
132
+ type RemoteNodeQueryInvalidationObserver = {
133
+ next(event: RemoteNodeQueryInvalidation): void;
134
+ error?(error: Error): void;
135
+ complete?(): void;
136
+ };
137
+ type RemoteNodeQueryInvalidationController = {
138
+ unsubscribe(): void;
139
+ };
140
+ type RemoteNodeQueryInvalidationSubscription = RemoteNodeQueryInvalidationController | (() => void) | void;
141
+ type RemoteNodeQueryClient = {
142
+ query(request: RemoteNodeQueryRequest): Promise<RemoteNodeQueryResponse>;
143
+ stream?(request: RemoteNodeQueryRequest, observer: RemoteNodeQueryStreamObserver): RemoteNodeQueryStreamSubscription | Promise<RemoteNodeQueryStreamSubscription>;
144
+ subscribeInvalidations?(observer: RemoteNodeQueryInvalidationObserver): RemoteNodeQueryInvalidationSubscription | Promise<RemoteNodeQueryInvalidationSubscription>;
145
+ };
146
+ declare function isRemoteNodeQuerySource(source: QuerySourcePreference | undefined): source is RemoteNodeQuerySource;
147
+ declare function createRemoteNodeQueryRequest(input: {
148
+ requestId: string;
149
+ descriptor: QueryDescriptor;
150
+ mode?: RemoteNodeQueryMode;
151
+ source: RemoteNodeQuerySource;
152
+ requestedAt?: number;
153
+ auth?: RemoteNodeQueryAuth;
154
+ client?: RemoteNodeQueryClientState;
155
+ }): RemoteNodeQueryRequest;
156
+ declare function isRemoteNodeQuerySuccess(response: RemoteNodeQueryResponse): response is RemoteNodeQuerySuccessResponse;
157
+ declare function isRemoteNodeQueryError(response: RemoteNodeQueryResponse): response is RemoteNodeQueryErrorResponse;
158
+
159
+ /**
160
+ * Sort direction for ordering results
161
+ */
162
+ type SortDirection = 'asc' | 'desc';
163
+ /**
164
+ * System fields that can be used for ordering
165
+ */
166
+ type SystemOrderField = 'createdAt' | 'updatedAt';
167
+ type QuerySpatialPoint = {
168
+ x: number;
169
+ y: number;
170
+ };
171
+ type QuerySpatialRect = QuerySpatialPoint & {
172
+ width: number;
173
+ height: number;
174
+ };
175
+ type QuerySpatialPointFields = {
176
+ x: string;
177
+ y: string;
178
+ };
179
+ type QuerySpatialRectFields = QuerySpatialPointFields & {
180
+ width?: string;
181
+ height?: string;
182
+ };
183
+ type QuerySpatialWindow = {
184
+ kind: 'window';
185
+ rect: QuerySpatialRect;
186
+ fields: QuerySpatialRectFields;
187
+ overscan?: number;
188
+ };
189
+ type QuerySpatialRadius = {
190
+ kind: 'radius';
191
+ center: QuerySpatialPoint;
192
+ radius: number;
193
+ fields: QuerySpatialPointFields;
194
+ };
195
+ type QuerySpatialFilter = QuerySpatialWindow | QuerySpatialRadius;
196
+ type QuerySearchField = 'title' | 'content';
197
+ type QuerySearchFilter = {
198
+ text: string;
199
+ fields?: QuerySearchField[];
200
+ };
201
+ type QueryMaterializedViewOptions = {
202
+ viewId: string;
203
+ maxAgeMs?: number;
204
+ forceRefresh?: boolean;
205
+ };
206
+ type QueryPageCountMode = NodeQueryPageCountMode;
207
+ type QueryExecutionMode = 'local' | 'local-then-remote' | 'remote' | 'live' | 'stream';
208
+ type QuerySourcePreference = 'auto' | 'local' | 'hub' | 'federated';
209
+ type QueryPageOptions = {
210
+ first: number;
211
+ after?: string;
212
+ count?: NodeQueryPageCountMode;
213
+ };
214
+ /**
215
+ * Options for querying nodes via the DataBridge.
216
+ * Maps to the filter options used by useQuery.
217
+ */
218
+ interface QueryOptions<P extends Record<string, PropertyBuilder> = Record<string, PropertyBuilder>> {
219
+ /** Filter by single node ID (makes this a single-node query) */
220
+ nodeId?: string;
221
+ /** Filter conditions (property: value) */
222
+ where?: Partial<InferCreateProps<P>>;
223
+ /** Include soft-deleted nodes */
224
+ includeDeleted?: boolean;
225
+ /** Sort by property or system field */
226
+ orderBy?: {
227
+ [K in keyof InferCreateProps<P> | SystemOrderField]?: SortDirection;
228
+ };
229
+ /** Limit results */
230
+ limit?: number;
231
+ /** Offset for pagination */
232
+ offset?: number;
233
+ /** Recommended forward-compatible pagination shape. `first` lowers to `limit`. */
234
+ page?: QueryPageOptions;
235
+ /** Spatial filtering for viewport windows, canvases, or geo-style proximity queries */
236
+ spatial?: QuerySpatialFilter;
237
+ /** Tokenized full-text search over searchable node fields */
238
+ search?: string | QuerySearchFilter;
239
+ /** Stable database view cache key for JIT materialized result sets */
240
+ materializedView?: string | QueryMaterializedViewOptions;
241
+ /** Future execution mode hint. Local execution remains the only active runtime today. */
242
+ mode?: QueryExecutionMode;
243
+ /** Future source preference hint for hub or federated reads. */
244
+ source?: QuerySourcePreference;
245
+ }
246
+ /**
247
+ * Canonical descriptor for a live query.
248
+ * Shared across hooks and bridge implementations.
249
+ */
250
+ interface QueryDescriptor {
251
+ /** Schema IRI for the query */
252
+ schemaId: _xnetjs_data.SchemaIRI;
253
+ /** Optional single-node query */
254
+ nodeId?: string;
255
+ /** Normalized property filters */
256
+ where?: Record<string, unknown>;
257
+ /** Whether soft-deleted nodes are included */
258
+ includeDeleted: boolean;
259
+ /** Normalized ordering rules */
260
+ orderBy?: Record<string, SortDirection>;
261
+ /** Limit applied after filtering and sorting */
262
+ limit?: number;
263
+ /** Offset applied after filtering and sorting */
264
+ offset?: number;
265
+ /** Cursor applied after filtering and sorting */
266
+ after?: string;
267
+ /** Count strategy requested by the page options */
268
+ count?: NodeQueryPageCountMode;
269
+ /** Optional spatial filter metadata used by canvas-style queries */
270
+ spatial?: QuerySpatialFilter;
271
+ /** Optional full-text filter metadata */
272
+ search?: QuerySearchFilter;
273
+ /** Optional stable view cache key for storage-backed materialization */
274
+ materializedView?: QueryMaterializedViewOptions;
275
+ /** Execution mode hint for routing local, remote, live, or streamed reads */
276
+ mode?: QueryExecutionMode;
277
+ /** Preferred read source for future hub/federated execution */
278
+ source?: QuerySourcePreference;
279
+ }
280
+ type QuerySource = 'local' | 'memory' | 'hub' | 'federated' | 'hybrid';
281
+ type NodeQueryRouterThresholds = {
282
+ /** Local row counts below this value stay local for `source: "auto"` reads. */
283
+ localRowThreshold: number;
284
+ /** Local row counts at or above this value prefer a hub refresh for `source: "auto"` reads. */
285
+ hybridRowThreshold: number;
286
+ /** Full-text descriptors request remote completion when a remote client exists. */
287
+ searchToRemote: boolean;
288
+ /** Spatial descriptors request remote completion when a remote client exists. */
289
+ spatialToRemote: boolean;
290
+ };
291
+ type QueryRoutingMetadata = {
292
+ source: QuerySource;
293
+ reason: string;
294
+ localRowCount?: number;
295
+ thresholds: Pick<NodeQueryRouterThresholds, 'localRowThreshold' | 'hybridRowThreshold'>;
296
+ };
297
+ interface QueryPageInfo {
298
+ totalCount: number | null;
299
+ countMode: QueryPageCountMode;
300
+ hasMore: boolean;
301
+ hasNextPage: boolean;
302
+ hasPreviousPage: boolean;
303
+ startCursor?: string;
304
+ endCursor?: string;
305
+ loadedCount: number;
306
+ }
307
+ interface QueryMaterializedMetadata {
308
+ viewId: string;
309
+ cacheHit: boolean;
310
+ generatedAt: number;
311
+ invalidatedAt?: number;
312
+ rowCount: number;
313
+ }
314
+ type QueryCompletenessMetadata = {
315
+ level: 'complete' | 'partial' | 'unknown';
316
+ reason?: 'auth-filtered' | 'federation-partial' | 'page-limited' | 'remote-unavailable' | 'source-timeout' | 'verification-failed';
317
+ sourceCount?: number;
318
+ };
319
+ type QueryStalenessMetadata = {
320
+ level: 'fresh' | 'stale' | 'unknown';
321
+ asOf?: number;
322
+ maxAgeMs?: number;
323
+ };
324
+ type QueryVerificationMetadata = {
325
+ status: 'verified' | 'unverified' | 'failed' | 'mixed';
326
+ verifiedNodeIds?: string[];
327
+ failedNodeIds?: string[];
328
+ };
329
+ type QueryStreamProgressPhase = 'connecting' | 'snapshot' | 'catching-up' | 'live' | 'reconnecting' | 'complete';
330
+ type QueryStreamProgress = {
331
+ phase: QueryStreamProgressPhase;
332
+ loaded?: number;
333
+ total?: number | null;
334
+ message?: string;
335
+ };
336
+ type QueryStreamResetReason = 'descriptor-changed' | 'reconnect' | 'server-reset' | 'client-reset';
337
+ type QueryStreamStatus = 'idle' | 'loading' | 'ready' | 'error';
338
+ type QueryStreamEventType = 'snapshot' | 'insert' | 'update' | 'delete' | 'reset' | 'progress' | 'error';
339
+ type QueryStreamMetadata = {
340
+ status: QueryStreamStatus;
341
+ lastEvent: QueryStreamEventType;
342
+ lastEventAt: number;
343
+ progress?: QueryStreamProgress | null;
344
+ error?: string | null;
345
+ resetReason?: QueryStreamResetReason;
346
+ };
347
+ interface QueryMetadata {
348
+ source: QuerySource;
349
+ updatedAt: number;
350
+ pageInfo: QueryPageInfo;
351
+ plan?: NodeQueryPlanMetadata;
352
+ materialized?: QueryMaterializedMetadata;
353
+ routing?: QueryRoutingMetadata;
354
+ completeness?: QueryCompletenessMetadata;
355
+ staleness?: QueryStalenessMetadata;
356
+ verification?: QueryVerificationMetadata;
357
+ stream?: QueryStreamMetadata;
358
+ error?: string;
359
+ }
360
+ /**
361
+ * A subscription to a query result.
362
+ * Compatible with React's useSyncExternalStore pattern.
363
+ *
364
+ * @typeParam P - Property builder type (unused at runtime, for type inference)
365
+ */
366
+ interface QuerySubscription<P extends Record<string, PropertyBuilder> = Record<string, PropertyBuilder>> {
367
+ /** Get current snapshot (synchronous - reads from cache). Returns null if loading. */
368
+ getSnapshot(): NodeState[] | null;
369
+ /** Get current query metadata, if the bridge can provide it. */
370
+ getMetadata?(): QueryMetadata | null;
371
+ /** Subscribe to updates (React will call this) */
372
+ subscribe(callback: () => void): () => void;
373
+ }
374
+ /**
375
+ * Result of a create operation
376
+ */
377
+ interface CreateResult {
378
+ node: NodeState;
379
+ }
380
+ /**
381
+ * Result of an update operation
382
+ */
383
+ interface UpdateResult {
384
+ node: NodeState;
385
+ }
386
+ /**
387
+ * Result of a bridge-level atomic transaction.
388
+ *
389
+ * A structured-clone-safe subset of NodeStore's `TransactionResult`: the
390
+ * signed change list stays on the data thread; callers only need the
391
+ * materialized results and temp ID mapping.
392
+ */
393
+ interface BridgeTransactionResult {
394
+ /** The batch ID shared by all changes */
395
+ batchId: string;
396
+ /** Results for each operation (NodeState or null for delete) */
397
+ results: (NodeState | null)[];
398
+ /** Map from temp ID → generated real ID (empty if no temp IDs were used) */
399
+ tempIds: Record<string, string>;
400
+ }
401
+ /**
402
+ * Result of acquiring a Y.Doc for editing.
403
+ * The doc is kept in sync with the data thread via the bridge.
404
+ */
405
+ interface AcquiredDoc {
406
+ /** The Y.Doc instance (on main thread for TipTap binding) */
407
+ doc: Doc;
408
+ /** Awareness instance for presence/cursors */
409
+ awareness: Awareness;
410
+ }
411
+ /**
412
+ * Sync connection status
413
+ */
414
+ type SyncStatus = 'connecting' | 'connected' | 'disconnected' | 'error';
415
+ /**
416
+ * Configuration for initializing a DataBridge
417
+ */
418
+ interface DataBridgeConfig {
419
+ /** Database name for storage */
420
+ dbName?: string;
421
+ /** Author's DID for signing changes */
422
+ authorDID: string;
423
+ /** Ed25519 signing key */
424
+ signingKey: Uint8Array;
425
+ /** Signaling server URL for sync */
426
+ signalingUrl?: string;
427
+ /**
428
+ * Optional MessagePort connected to a storage worker (e.g. the SQLite
429
+ * worker via `WebSQLiteProxy.createMessagePort()`). Worker-backed bridges
430
+ * transfer it to the data worker so storage calls bypass the main thread.
431
+ */
432
+ storagePort?: MessagePort;
433
+ /** Optional main-thread remote Node query client for progressive hub/federated reads. */
434
+ remoteNodeQueryClient?: RemoteNodeQueryClient;
435
+ /** Optional source:auto routing thresholds for main-thread Node descriptor reads. */
436
+ remoteNodeQueryRouting?: Partial<NodeQueryRouterThresholds>;
437
+ }
438
+ /**
439
+ * The DataBridge interface abstracts data access across different platforms.
440
+ *
441
+ * Implementations:
442
+ * - MainThreadBridge: Direct NodeStore access (Phase 0, fallback)
443
+ * - WorkerBridge: Web Worker via Comlink (Phase 1)
444
+ * - IPCBridge: Electron utility process (Phase 2)
445
+ * - NativeBridge: React Native Turbo Module (Phase 5)
446
+ *
447
+ * All implementations provide the same API, allowing React hooks to work
448
+ * identically across all platforms.
449
+ */
450
+ interface DataBridge {
451
+ /**
452
+ * Create a subscription to a query result.
453
+ * Returns an object compatible with useSyncExternalStore.
454
+ *
455
+ * The subscription loads data asynchronously and updates the cache.
456
+ * getSnapshot() returns null while loading, then the result array.
457
+ */
458
+ query<P extends Record<string, PropertyBuilder>>(schema: DefinedSchema<P>, options?: QueryOptions<P>): QuerySubscription<P>;
459
+ /**
460
+ * Force a reload for a canonical query descriptor.
461
+ */
462
+ reloadQuery?(descriptor: QueryDescriptor): Promise<void>;
463
+ /**
464
+ * Create a new node.
465
+ */
466
+ create<P extends Record<string, PropertyBuilder>>(schema: DefinedSchema<P>, data: InferCreateProps<P>, id?: string): Promise<NodeState>;
467
+ /**
468
+ * Update an existing node.
469
+ */
470
+ update(nodeId: string, changes: Record<string, unknown>): Promise<NodeState>;
471
+ /**
472
+ * Soft-delete a node.
473
+ */
474
+ delete(nodeId: string): Promise<void>;
475
+ /**
476
+ * Restore a soft-deleted node.
477
+ */
478
+ restore(nodeId: string): Promise<NodeState>;
479
+ /**
480
+ * Execute a storage-owned batch write when the runtime supports it.
481
+ */
482
+ bulkWrite(input: NodeBatchWriteInput): Promise<NodeBatchWriteResult>;
483
+ /**
484
+ * Execute multiple operations atomically with temp ID resolution.
485
+ *
486
+ * All operations succeed or fail together. Implemented by every bridge
487
+ * that owns (or proxies to) a transaction-capable NodeStore; consumers
488
+ * should feature-detect rather than reaching for `bridge.nodeStore`.
489
+ */
490
+ transaction?(operations: TransactionOperation[]): Promise<BridgeTransactionResult>;
491
+ /**
492
+ * Acquire a Y.Doc for editing. Returns the doc with current state.
493
+ * The doc receives updates from the data thread via the bridge.
494
+ */
495
+ acquireDoc?(nodeId: string): Promise<AcquiredDoc>;
496
+ /**
497
+ * Release a Y.Doc when no longer editing.
498
+ * The data thread continues syncing in the background.
499
+ */
500
+ releaseDoc?(nodeId: string): void;
501
+ /**
502
+ * Initialize the bridge with configuration.
503
+ * For MainThreadBridge, this is a no-op (already initialized with NodeStore).
504
+ */
505
+ initialize?(config: DataBridgeConfig): Promise<void>;
506
+ /**
507
+ * Clean up resources.
508
+ */
509
+ destroy(): void;
510
+ /**
511
+ * Current sync status.
512
+ */
513
+ readonly status: SyncStatus;
514
+ /**
515
+ * Subscribe to status changes.
516
+ */
517
+ on(event: 'status', handler: (status: SyncStatus) => void): () => void;
518
+ /**
519
+ * Get the underlying NodeStore directly.
520
+ * Only available in MainThreadBridge for backward compatibility.
521
+ * Will be removed in later phases.
522
+ *
523
+ * @deprecated Reach for bridge-level APIs (`transaction`, `bulkWrite`,
524
+ * `get`, `subscribeToChanges`) instead — worker-backed bridges have no
525
+ * main-thread store, so this is `undefined` there. Long-lived services
526
+ * (SyncManager, search indexing, devtools) should use the provider-owned
527
+ * store from XNetProvider context, not the bridge.
528
+ */
529
+ readonly nodeStore?: _xnetjs_data.NodeStore;
530
+ /**
531
+ * Subscribe to store changes directly.
532
+ * Only available in MainThreadBridge for backward compatibility.
533
+ */
534
+ subscribeToChanges?(listener: (event: NodeChangeEvent) => void): () => void;
535
+ /**
536
+ * Get a single node by ID directly.
537
+ * Only available in MainThreadBridge for backward compatibility.
538
+ */
539
+ get?(nodeId: string): Promise<NodeState | null>;
540
+ /**
541
+ * List nodes with options directly.
542
+ * Only available in MainThreadBridge for backward compatibility.
543
+ */
544
+ list?(options?: ListNodesOptions): Promise<NodeState[]>;
545
+ }
546
+
547
+ export { type RemoteNodeQueryInvalidationReason as $, type AcquiredDoc as A, type BridgeTransactionResult as B, type QuerySpatialRectFields as C, type DataBridge as D, type QuerySpatialWindow as E, type QueryStreamEventType as F, type QueryStreamMetadata as G, type QueryStalenessMetadata as H, type SortDirection as I, type SystemOrderField as J, type CreateResult as K, REMOTE_NODE_QUERY_PROTOCOL as L, REMOTE_NODE_QUERY_PROTOCOL_VERSION as M, type NodeQueryRouterThresholds as N, createRemoteNodeQueryRequest as O, isRemoteNodeQueryError as P, type QueryOptions as Q, type RemoteNodeQueryClient as R, type SyncStatus as S, isRemoteNodeQuerySource as T, type UpdateResult as U, isRemoteNodeQuerySuccess as V, type RemoteNodeQueryAuth as W, type RemoteNodeQueryClientState as X, type RemoteNodeQueryInvalidation as Y, type RemoteNodeQueryInvalidationController as Z, type RemoteNodeQueryInvalidationObserver as _, type QuerySubscription as a, type RemoteNodeQueryInvalidationSubscription as a0, type RemoteNodeQueryRequest as a1, type RemoteNodeQueryResponse as a2, type RemoteNodeQueryStreamController as a3, type RemoteNodeQueryStreamObserver as a4, type RemoteNodeQueryStreamSubscription as a5, type RemoteQueryCompleteness as a6, type RemoteQueryStaleness as a7, type RemoteQueryVerification as a8, createQueryStreamState as a9, reduceQueryStreamEvent as aa, reduceQueryStreamEvents as ab, type QueryStreamEvent as ac, type QueryStreamProgress as ad, type QueryStreamProgressPhase as ae, type QueryStreamResetReason as af, type QueryStreamState as ag, type QueryStreamStatus as ah, type QueryDescriptor as b, type DataBridgeConfig as c, type QueryMetadata as d, type QuerySource as e, type RemoteNodeQueryMode as f, type RemoteNodeQuerySource as g, type QueryRoutingMetadata as h, type RemoteNodeQueryErrorResponse as i, type RemoteNodeQuerySuccessResponse as j, type QueryVerificationMetadata as k, type QueryCompletenessMetadata as l, type QueryExecutionMode as m, type QueryMaterializedMetadata as n, type QueryMaterializedViewOptions as o, type QueryPageInfo as p, type QueryPageCountMode as q, type QueryPageOptions as r, type QuerySearchField as s, type QuerySearchFilter as t, type QuerySourcePreference as u, type QuerySpatialFilter as v, type QuerySpatialPoint as w, type QuerySpatialPointFields as x, type QuerySpatialRadius as y, type QuerySpatialRect as z };
@@ -0,0 +1,4 @@
1
+ import '@xnetjs/data';
2
+ export { A as AcquiredDoc, B as BridgeTransactionResult, K as CreateResult, D as DataBridge, c as DataBridgeConfig, N as NodeQueryRouterThresholds, l as QueryCompletenessMetadata, b as QueryDescriptor, m as QueryExecutionMode, n as QueryMaterializedMetadata, o as QueryMaterializedViewOptions, d as QueryMetadata, Q as QueryOptions, q as QueryPageCountMode, p as QueryPageInfo, r as QueryPageOptions, h as QueryRoutingMetadata, s as QuerySearchField, t as QuerySearchFilter, e as QuerySource, u as QuerySourcePreference, v as QuerySpatialFilter, w as QuerySpatialPoint, x as QuerySpatialPointFields, y as QuerySpatialRadius, z as QuerySpatialRect, C as QuerySpatialRectFields, E as QuerySpatialWindow, H as QueryStalenessMetadata, F as QueryStreamEventType, G as QueryStreamMetadata, ad as QueryStreamProgress, ae as QueryStreamProgressPhase, af as QueryStreamResetReason, ah as QueryStreamStatus, a as QuerySubscription, k as QueryVerificationMetadata, I as SortDirection, S as SyncStatus, J as SystemOrderField, U as UpdateResult } from './types-BRvuTwEn.js';
3
+ import 'y-protocols/awareness';
4
+ import 'yjs';
package/dist/types.js ADDED
File without changes