@xnetjs/data 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.
- package/README.md +112 -0
- package/dist/account-BZHETMC4.js +12 -0
- package/dist/auth/index.d.ts +413 -0
- package/dist/auth/index.js +102 -0
- package/dist/budget-WR2Q4YH3.js +12 -0
- package/dist/canvas-HFMMVQLD.js +10 -0
- package/dist/channel-DXDYJ3ZH.js +12 -0
- package/dist/chat-message-QUUQGXEW.js +10 -0
- package/dist/chunk-2DSDH2ZH.js +52 -0
- package/dist/chunk-337E3ZOB.js +54 -0
- package/dist/chunk-37267RSF.js +41 -0
- package/dist/chunk-3JKW6TDE.js +66 -0
- package/dist/chunk-3RB2FMMO.js +148 -0
- package/dist/{chunk-BQBPA5HS.js → chunk-4U4KBCDN.js} +16 -2
- package/dist/chunk-4UQTURCD.js +722 -0
- package/dist/chunk-54Y7QRZN.js +109 -0
- package/dist/chunk-5FHJE7RC.js +46 -0
- package/dist/chunk-64AM6JPM.js +40 -0
- package/dist/chunk-6CN53PON.js +143 -0
- package/dist/chunk-6GB7PBCR.js +40 -0
- package/dist/chunk-6OPZJ7MG.js +78 -0
- package/dist/{chunk-IDMBCRUC.js → chunk-77UDLVQY.js} +1 -1
- package/dist/chunk-7GMJOAPF.js +52 -0
- package/dist/chunk-7PDRDSFH.js +69 -0
- package/dist/chunk-C5IRSEEZ.js +69 -0
- package/dist/chunk-CHZUSBSB.js +45 -0
- package/dist/chunk-DOZJXPQ6.js +232 -0
- package/dist/chunk-DTPSTMUD.js +105 -0
- package/dist/chunk-E6S557NC.js +402 -0
- package/dist/chunk-EIQX7INF.js +45 -0
- package/dist/chunk-ENTHVNOC.js +57 -0
- package/dist/chunk-EZA5UT4Y.js +5543 -0
- package/dist/chunk-GR3NDMBY.js +76 -0
- package/dist/chunk-GWYVY2K4.js +63 -0
- package/dist/chunk-IJ675GJR.js +42 -0
- package/dist/chunk-IP4BEVVD.js +57 -0
- package/dist/chunk-J4IVJA5M.js +102 -0
- package/dist/chunk-J6EDPPH4.js +84 -0
- package/dist/{chunk-SZC345Z2.js → chunk-JESSJ5CZ.js} +1015 -1110
- package/dist/chunk-JO6Y4E5V.js +73 -0
- package/dist/chunk-KPVBKKZS.js +47 -0
- package/dist/chunk-KTJLFJEQ.js +43 -0
- package/dist/chunk-L66WXPTW.js +32 -0
- package/dist/chunk-LGD72FVD.js +48 -0
- package/dist/chunk-O64EK5FK.js +887 -0
- package/dist/chunk-PMUQACPY.js +33 -0
- package/dist/chunk-PSUJEKVV.js +1722 -0
- package/dist/chunk-QVZXXJSP.js +6122 -0
- package/dist/chunk-QWFTRZQT.js +142 -0
- package/dist/chunk-RSSZXCLL.js +51 -0
- package/dist/chunk-S4B5OPZU.js +415 -0
- package/dist/{chunk-VYR5GPJP.js → chunk-SPFKSTPT.js} +9 -3
- package/dist/chunk-U6CBYDVZ.js +50 -0
- package/dist/chunk-UDUPQKRB.js +49 -0
- package/dist/chunk-V6HZ3LF3.js +380 -0
- package/dist/chunk-WMSCEBFH.js +64 -0
- package/dist/chunk-WUR3WWQM.js +65 -0
- package/dist/chunk-XHEA5UER.js +75 -0
- package/dist/chunk-XTUGZSYQ.js +75 -0
- package/dist/chunk-XWA3CJQ6.js +45 -0
- package/dist/chunk-YEQ6LLUY.js +49 -0
- package/dist/chunk-YWN27MLD.js +47 -0
- package/dist/chunk-YXZGYLKV.js +65 -0
- package/dist/chunk-ZICIXDEE.js +54 -0
- package/dist/chunk-ZMCO3O2Z.js +70 -0
- package/dist/clone-DpbVKLUu.d.ts +2205 -0
- package/dist/comment-Y2Y3QYYI.js +10 -0
- package/dist/crm-AAJXYIJY.js +68 -0
- package/dist/dashboard-3DC6B4BJ.js +10 -0
- package/dist/database/index.d.ts +882 -0
- package/dist/database/index.js +523 -0
- package/dist/database-DRGL5UYS.js +10 -0
- package/dist/database-field-F47FY3XX.js +10 -0
- package/dist/database-row-77OXW2NF.js +10 -0
- package/dist/database-select-option-6S3TTA7A.js +10 -0
- package/dist/database-view-YW7DQG5X.js +10 -0
- package/dist/experiment-TJOAL3OH.js +10 -0
- package/dist/external-item-D654PKLI.js +14 -0
- package/dist/external-reference-K5SUJIQN.js +8 -0
- package/dist/feed-L23XTNDI.js +12 -0
- package/dist/feed-item-GSO242J6.js +12 -0
- package/dist/folder-ONKSWHUT.js +21 -0
- package/dist/game-BF7DP5JU.js +50 -0
- package/dist/grant-NNKMWXPX.js +8 -0
- package/dist/grant-expiration-cleaner-DBiNTWbD.d.ts +249 -0
- package/dist/import-batch-JMESZ4VI.js +12 -0
- package/dist/inbox-state-AN6FPCIY.js +12 -0
- package/dist/index.d.ts +224 -4548
- package/dist/index.js +2206 -4754
- package/dist/map-AUV65YS3.js +10 -0
- package/dist/media-asset-4I5YPR4R.js +8 -0
- package/dist/memory-NV6EVJBE.js +12 -0
- package/dist/metric-X7W55DLC.js +10 -0
- package/dist/milestone-JJGOGK4R.js +12 -0
- package/dist/moderation-QSUVBCNS.js +30 -0
- package/dist/observation-UZSXXGBC.js +10 -0
- package/dist/page-NI7XODS6.js +10 -0
- package/dist/posting-FZOYVGH2.js +12 -0
- package/dist/profile-42A43GES.js +8 -0
- package/dist/project-G2CTLDXY.js +10 -0
- package/dist/query-ast-CWo6_30h.d.ts +226 -0
- package/dist/reaction-VAQBVDUD.js +10 -0
- package/dist/registry-CQoN_p8U.d.ts +99 -0
- package/dist/saved-view-AOQHGHNM.js +10 -0
- package/dist/schema/index.d.ts +6182 -0
- package/dist/schema/index.js +631 -0
- package/dist/schema-extension-5BUXRDPB.js +18 -0
- package/dist/space-PZ737CIS.js +42 -0
- package/dist/space-membership-N35NRX6F.js +14 -0
- package/dist/store/index.d.ts +391 -0
- package/dist/store/index.js +135 -0
- package/dist/store-CvgiydME.d.ts +338 -0
- package/dist/sync/awareness.d.ts +69 -0
- package/dist/sync/awareness.js +20 -0
- package/dist/system-Q5I6STDC.js +38 -0
- package/dist/tag-C677GKQW.js +16 -0
- package/dist/task-WQLMPN5U.js +16 -0
- package/dist/task-view-T5S32V4L.js +10 -0
- package/dist/transaction-U3ITRGJP.js +12 -0
- package/dist/transcription-F3T23LLO.js +12 -0
- package/dist/types-Def-5Nka.d.ts +1525 -0
- package/dist/updates.d.ts +44 -0
- package/dist/updates.js +16 -0
- package/dist/user-widget-4SJJFPG5.js +8 -0
- package/dist/view-types-DSde-uT_.d.ts +316 -0
- package/package.json +32 -9
- package/dist/canvas-HSIKIQFK.js +0 -7
- package/dist/chunk-2L5ZUGG5.js +0 -53
- package/dist/chunk-4MTS5KAQ.js +0 -22
- package/dist/chunk-GZHARFKC.js +0 -25
- package/dist/chunk-WKIKJTI2.js +0 -45
- package/dist/comment-277JD7DV.js +0 -7
- package/dist/database-W3KEHLI3.js +0 -7
- package/dist/database-row-3O2QSNZN.js +0 -7
- package/dist/grant-QVZ454YC.js +0 -7
- package/dist/page-O4WTOIEO.js +0 -7
- package/dist/task-SEKAYJH7.js +0 -7
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { e as StoreAuthAPI, f as NodeStoreOptions, g as NodeStorageAdapter, C as CreateNodeOptions, h as NodeState, i as NodeId, G as GetWithMigrationOptions, M as MigratedNodeState, U as UpdateNodeOptions, L as ListNodesOptions, j as NodeQueryDescriptor, k as NodeQueryResult, T as TransactionOperation, l as TransactionResult, m as DeterministicNodeImportDraft, n as ImportDeterministicNodesOptions, o as ImportDeterministicNodesResult, p as NodeBatchWriteInput, q as NodeBatchWriteResult, S as SchemaIRI, r as NodeChange, s as MergeConflict, t as NodeChangeListener, u as NodeBatchChangeListener } from './types-Def-5Nka.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* NodeStore - Event-sourced storage for Nodes
|
|
5
|
+
*
|
|
6
|
+
* Manages Nodes using Change<T> from @xnetjs/sync with LWW conflict resolution.
|
|
7
|
+
*
|
|
8
|
+
* Key features:
|
|
9
|
+
* - Simple CRUD API that creates Changes under the hood
|
|
10
|
+
* - LWW conflict resolution using Lamport timestamps
|
|
11
|
+
* - Sparse updates (only store changed properties)
|
|
12
|
+
* - Materialized state for fast reads
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* NodeStore manages event-sourced Nodes with LWW conflict resolution.
|
|
17
|
+
*/
|
|
18
|
+
declare class NodeStore {
|
|
19
|
+
private storage;
|
|
20
|
+
private authorDID;
|
|
21
|
+
private signingKey;
|
|
22
|
+
private changeSigner?;
|
|
23
|
+
private clock;
|
|
24
|
+
private conflicts;
|
|
25
|
+
private listeners;
|
|
26
|
+
private nodeListeners;
|
|
27
|
+
private batchListeners;
|
|
28
|
+
private schemaLookup?;
|
|
29
|
+
private propertyLookup?;
|
|
30
|
+
private lensRegistry?;
|
|
31
|
+
private authEvaluator?;
|
|
32
|
+
private nodeContentCipher?;
|
|
33
|
+
private contentKeyCache?;
|
|
34
|
+
private authRelevantPropertyLookup?;
|
|
35
|
+
private onRecipientsMayNeedRecompute?;
|
|
36
|
+
private onUnauthorizedRemoteChange?;
|
|
37
|
+
readonly auth?: StoreAuthAPI;
|
|
38
|
+
private telemetry?;
|
|
39
|
+
constructor(options: NodeStoreOptions);
|
|
40
|
+
/**
|
|
41
|
+
* Initialize the store by loading the last Lamport time from storage.
|
|
42
|
+
* Call this before using the store.
|
|
43
|
+
*/
|
|
44
|
+
initialize(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Get the underlying storage adapter.
|
|
47
|
+
*
|
|
48
|
+
* Use this to access low-level storage operations like change history,
|
|
49
|
+
* document content, and Lamport timestamps. Useful for building history,
|
|
50
|
+
* audit, and verification features.
|
|
51
|
+
*
|
|
52
|
+
* @returns The NodeStorageAdapter instance
|
|
53
|
+
*/
|
|
54
|
+
getStorageAdapter(): NodeStorageAdapter;
|
|
55
|
+
private cloneNodeState;
|
|
56
|
+
/**
|
|
57
|
+
* Create a new Node.
|
|
58
|
+
*/
|
|
59
|
+
create(options: CreateNodeOptions): Promise<NodeState>;
|
|
60
|
+
/**
|
|
61
|
+
* Get a Node by ID.
|
|
62
|
+
*/
|
|
63
|
+
get(id: NodeId): Promise<NodeState | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Return the subset of IDs that already exist in materialized storage.
|
|
66
|
+
*
|
|
67
|
+
* This intentionally returns identifiers only and does not hydrate node
|
|
68
|
+
* contents. Importers use it to route deterministic drafts to create/update.
|
|
69
|
+
*/
|
|
70
|
+
getExistingNodeIds(ids: readonly NodeId[]): Promise<NodeId[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Get a Node by ID with automatic schema migration.
|
|
73
|
+
*
|
|
74
|
+
* If the stored node's schema version differs from the target schema,
|
|
75
|
+
* and a migration path exists in the lens registry, the node's properties
|
|
76
|
+
* will be automatically transformed.
|
|
77
|
+
*
|
|
78
|
+
* @param id - The node ID to fetch
|
|
79
|
+
* @param options - Options including the target schema IRI
|
|
80
|
+
* @returns The node with migrated properties, or null if not found
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* // Get node and migrate to TaskSchema v2.0.0
|
|
85
|
+
* const node = await store.getWithMigration('node-123', {
|
|
86
|
+
* targetSchemaId: TaskSchemaV2['@id']
|
|
87
|
+
* })
|
|
88
|
+
*
|
|
89
|
+
* if (node?._migrationInfo) {
|
|
90
|
+
* console.log('Migrated from:', node._migrationInfo.from)
|
|
91
|
+
* if (!node._migrationInfo.lossless) {
|
|
92
|
+
* console.warn('Migration warnings:', node._migrationInfo.warnings)
|
|
93
|
+
* }
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
getWithMigration(id: NodeId, options: GetWithMigrationOptions): Promise<MigratedNodeState | null>;
|
|
98
|
+
/**
|
|
99
|
+
* Update a Node's properties.
|
|
100
|
+
*/
|
|
101
|
+
update(id: NodeId, options: UpdateNodeOptions): Promise<NodeState>;
|
|
102
|
+
/**
|
|
103
|
+
* Delete a Node (soft delete).
|
|
104
|
+
*/
|
|
105
|
+
delete(id: NodeId): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Restore a deleted Node.
|
|
108
|
+
*/
|
|
109
|
+
restore(id: NodeId): Promise<NodeState>;
|
|
110
|
+
/**
|
|
111
|
+
* List Nodes with optional filtering.
|
|
112
|
+
*/
|
|
113
|
+
list(options?: ListNodesOptions): Promise<NodeState[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Query nodes with descriptor semantics and storage-level pushdown when available.
|
|
116
|
+
*/
|
|
117
|
+
query(descriptor: NodeQueryDescriptor): Promise<NodeQueryResult>;
|
|
118
|
+
private loadQueryFallbackCandidates;
|
|
119
|
+
private canPushSystemListQuery;
|
|
120
|
+
/**
|
|
121
|
+
* Execute multiple operations as a single atomic transaction.
|
|
122
|
+
*
|
|
123
|
+
* All changes created in the transaction share the same batchId and Lamport
|
|
124
|
+
* timestamp, making them logically atomic. This is useful for:
|
|
125
|
+
* - Multi-node operations (move task between projects)
|
|
126
|
+
* - Undo/redo grouping
|
|
127
|
+
* - Audit trails ("user did X" as a single action)
|
|
128
|
+
* - Future blockchain integration (batch = transaction)
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const result = await store.transaction([
|
|
133
|
+
* { type: 'update', nodeId: task.id, options: { properties: { projectId: newProject.id } } },
|
|
134
|
+
* { type: 'update', nodeId: oldProject.id, options: { properties: { taskIds: [...] } } },
|
|
135
|
+
* { type: 'update', nodeId: newProject.id, options: { properties: { taskIds: [...] } } },
|
|
136
|
+
* ])
|
|
137
|
+
* console.log(`Batch ${result.batchId} applied ${result.changes.length} changes`)
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
transaction(operations: TransactionOperation[]): Promise<TransactionResult>;
|
|
141
|
+
/**
|
|
142
|
+
* Execute a batch of transaction operations atomically: the preflight +
|
|
143
|
+
* applyNodeBatch fast path when storage supports it, otherwise the
|
|
144
|
+
* legacy per-operation path inside a storage transaction.
|
|
145
|
+
*/
|
|
146
|
+
private runTransactionOperationsBatch;
|
|
147
|
+
/**
|
|
148
|
+
* Import deterministic node drafts as signed node changes.
|
|
149
|
+
*
|
|
150
|
+
* This is optimized for importers that already have stable node IDs. It uses
|
|
151
|
+
* one Lamport timestamp and batch ID for the whole import, materializes nodes
|
|
152
|
+
* in memory, then persists final node states and all changes in one storage
|
|
153
|
+
* transaction when the adapter supports it.
|
|
154
|
+
*/
|
|
155
|
+
importDeterministicNodes(drafts: readonly DeterministicNodeImportDraft[], options?: ImportDeterministicNodesOptions): Promise<ImportDeterministicNodesResult>;
|
|
156
|
+
batchWrite(input: NodeBatchWriteInput): Promise<NodeBatchWriteResult>;
|
|
157
|
+
private resolveNodeBatchWritePolicy;
|
|
158
|
+
private toImportDeterministicNodesResult;
|
|
159
|
+
private executeOperationNodeBatch;
|
|
160
|
+
private executeDeterministicNodeBatch;
|
|
161
|
+
private resolveDeterministicImportIndexMode;
|
|
162
|
+
private emitDeterministicImportEvents;
|
|
163
|
+
private invalidateAuthForNodes;
|
|
164
|
+
private createDeterministicImportAuthOps;
|
|
165
|
+
private planDeterministicNodeImport;
|
|
166
|
+
private executeDeterministicNodeImport;
|
|
167
|
+
private getNodesById;
|
|
168
|
+
private getBatchPreflight;
|
|
169
|
+
private cloneNodeMap;
|
|
170
|
+
private getLastChangesByNodeId;
|
|
171
|
+
private importMaterializedNodes;
|
|
172
|
+
rebuildIndexesForSchemas(schemaIds: readonly SchemaIRI[]): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Refresh query-planner statistics (ANALYZE). Call after a bulk import so the
|
|
175
|
+
* first post-import reads use indexes instead of full scans (exploration
|
|
176
|
+
* 0184). No-op when the storage backend doesn't support it.
|
|
177
|
+
*/
|
|
178
|
+
analyze(): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Incremental planner maintenance (`PRAGMA optimize`). Cheap; intended for an
|
|
181
|
+
* idle tick after first paint and before close.
|
|
182
|
+
*/
|
|
183
|
+
optimize(): Promise<void>;
|
|
184
|
+
private appendImportedChanges;
|
|
185
|
+
private executeTransactionOperations;
|
|
186
|
+
/**
|
|
187
|
+
* Transaction fast path: one preflight for all touched nodes, in-memory
|
|
188
|
+
* materialization and signing, then one transactional applyNodeBatch.
|
|
189
|
+
* Avoids the per-operation storage round trips of
|
|
190
|
+
* {@link executeTransactionOperations} and the adapter-level
|
|
191
|
+
* withTransaction snapshotting that dominates small interactive
|
|
192
|
+
* transactions.
|
|
193
|
+
*/
|
|
194
|
+
private executeTransactionOperationsFast;
|
|
195
|
+
/**
|
|
196
|
+
* Apply a remote change (from sync).
|
|
197
|
+
* Verifies the change signature before applying.
|
|
198
|
+
*
|
|
199
|
+
* @throws Error if signature verification fails
|
|
200
|
+
*/
|
|
201
|
+
applyRemoteChange(change: NodeChange): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Apply multiple remote changes (from sync).
|
|
204
|
+
*/
|
|
205
|
+
applyRemoteChanges(changes: NodeChange[]): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Get all changes for a Node (for sync).
|
|
208
|
+
*/
|
|
209
|
+
getChanges(nodeId: NodeId): Promise<NodeChange[]>;
|
|
210
|
+
/**
|
|
211
|
+
* Get all changes (for full sync).
|
|
212
|
+
*/
|
|
213
|
+
getAllChanges(): Promise<NodeChange[]>;
|
|
214
|
+
/**
|
|
215
|
+
* Get changes since a Lamport time (for delta sync).
|
|
216
|
+
*/
|
|
217
|
+
getChangesSince(sinceLamport: number): Promise<NodeChange[]>;
|
|
218
|
+
/**
|
|
219
|
+
* Per-room sync cursor (confirmed high-water mark). Returns 0 when the
|
|
220
|
+
* storage adapter doesn't persist cursors (degrades to replay-from-0).
|
|
221
|
+
*/
|
|
222
|
+
getSyncCursor(room: string): Promise<number>;
|
|
223
|
+
/** Persist the per-room confirmed sync cursor (monotonic in the adapter). */
|
|
224
|
+
setSyncCursor(room: string, lamport: number): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Get the current Lamport time (for sync protocol).
|
|
227
|
+
*/
|
|
228
|
+
getCurrentLamportTime(): number;
|
|
229
|
+
/**
|
|
230
|
+
* Get recent merge conflicts (for debugging/UI).
|
|
231
|
+
*/
|
|
232
|
+
getRecentConflicts(): MergeConflict[];
|
|
233
|
+
/**
|
|
234
|
+
* Clear conflict history.
|
|
235
|
+
*/
|
|
236
|
+
clearConflicts(): void;
|
|
237
|
+
/**
|
|
238
|
+
* Get CRDT document content for a node.
|
|
239
|
+
* Returns null if no document content exists.
|
|
240
|
+
*/
|
|
241
|
+
getDocumentContent(nodeId: NodeId): Promise<Uint8Array | null>;
|
|
242
|
+
/**
|
|
243
|
+
* Set CRDT document content for a node.
|
|
244
|
+
* Used to persist serialized Y.Doc or other CRDT state.
|
|
245
|
+
*/
|
|
246
|
+
setDocumentContent(nodeId: NodeId, content: Uint8Array): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Subscribe to node changes.
|
|
249
|
+
*
|
|
250
|
+
* @param listener - Callback invoked when nodes change
|
|
251
|
+
* @returns Unsubscribe function
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* const unsubscribe = store.subscribe((event) => {
|
|
256
|
+
* console.log('Node changed:', event.node?.id, event.isRemote)
|
|
257
|
+
* })
|
|
258
|
+
* // Later: unsubscribe()
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
subscribe(listener: NodeChangeListener): () => void;
|
|
262
|
+
/**
|
|
263
|
+
* Subscribe to change events for a single node.
|
|
264
|
+
*
|
|
265
|
+
* Dispatch is O(listeners-for-that-node) instead of O(all-listeners):
|
|
266
|
+
* per-cell/per-row UI hooks should prefer this over filtering the global
|
|
267
|
+
* feed, where every change event invokes every mounted callback.
|
|
268
|
+
*/
|
|
269
|
+
subscribeToNode(nodeId: NodeId, listener: NodeChangeListener): () => void;
|
|
270
|
+
subscribeToBatchChanges(listener: NodeBatchChangeListener): () => void;
|
|
271
|
+
private emitDeterministicImportBatch;
|
|
272
|
+
/**
|
|
273
|
+
* Emit a change event to all listeners.
|
|
274
|
+
*/
|
|
275
|
+
private emit;
|
|
276
|
+
/**
|
|
277
|
+
* Create a signed change.
|
|
278
|
+
*/
|
|
279
|
+
private createChange;
|
|
280
|
+
private signNodeChange;
|
|
281
|
+
/**
|
|
282
|
+
* Create a signed change with batch metadata.
|
|
283
|
+
* Used for transaction support - all changes in a batch share the same
|
|
284
|
+
* batchId, Lamport timestamp, and wallTime.
|
|
285
|
+
*/
|
|
286
|
+
private createBatchedChange;
|
|
287
|
+
private createBatchedChangeWithParentHash;
|
|
288
|
+
private createInitialNodeFromChange;
|
|
289
|
+
/**
|
|
290
|
+
* Whether singular writes can use the two-round-trip fast path
|
|
291
|
+
* (preflight + transactional applyNodeBatch). Content ciphers need the
|
|
292
|
+
* legacy per-step path for encrypted snapshot persistence.
|
|
293
|
+
*/
|
|
294
|
+
private canUseSingleWriteFastPath;
|
|
295
|
+
/**
|
|
296
|
+
* Singular write fast path: one preflight round trip (existing node +
|
|
297
|
+
* parent change), in-memory materialization and signing, then one
|
|
298
|
+
* transactional applyNodeBatch round trip. Replaces the legacy
|
|
299
|
+
* seven-round-trip getNode/getLastChange/getNode/appendChange/
|
|
300
|
+
* setLastLamportTime/setNode/getNode sequence.
|
|
301
|
+
*/
|
|
302
|
+
private applySingleNodeWrite;
|
|
303
|
+
/**
|
|
304
|
+
* Apply a change to storage and update materialized state.
|
|
305
|
+
*/
|
|
306
|
+
private applyChange;
|
|
307
|
+
private materializeNodeChange;
|
|
308
|
+
/**
|
|
309
|
+
* Apply one property from a change to a node with LWW conflict
|
|
310
|
+
* resolution, recording any conflict against the existing timestamp.
|
|
311
|
+
* Mutates `node` in place (callers own a fresh clone).
|
|
312
|
+
*/
|
|
313
|
+
private applyPropertyChangeWithLWW;
|
|
314
|
+
/**
|
|
315
|
+
* Determine if newTs should replace existingTs (LWW).
|
|
316
|
+
*/
|
|
317
|
+
private shouldReplace;
|
|
318
|
+
/**
|
|
319
|
+
* Trim conflicts array to prevent unbounded memory growth.
|
|
320
|
+
* Keeps only the most recent MAX_CONFLICTS entries.
|
|
321
|
+
*/
|
|
322
|
+
private trimConflicts;
|
|
323
|
+
private assertAuthorized;
|
|
324
|
+
private canReadNode;
|
|
325
|
+
private filterReadableNodes;
|
|
326
|
+
private applyListPagination;
|
|
327
|
+
private getQueryFallbackReason;
|
|
328
|
+
private assertAuthorizedBatch;
|
|
329
|
+
private inferActionFromChange;
|
|
330
|
+
private shouldRecomputeRecipients;
|
|
331
|
+
private persistEncryptedNodeSnapshot;
|
|
332
|
+
private decryptNodeSnapshotIfPresent;
|
|
333
|
+
private serializeNodeSnapshot;
|
|
334
|
+
private deserializeNodeSnapshot;
|
|
335
|
+
private parseEncryptedNodeSnapshot;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export { NodeStore as N };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Doc } from 'yjs';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Awareness/presence tracking for collaborative editing
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* User presence information
|
|
10
|
+
*/
|
|
11
|
+
interface UserPresence {
|
|
12
|
+
did: string;
|
|
13
|
+
name: string;
|
|
14
|
+
color: string;
|
|
15
|
+
cursor?: CursorPosition;
|
|
16
|
+
selection?: SelectionRange;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Cursor position in a document
|
|
20
|
+
*/
|
|
21
|
+
interface CursorPosition {
|
|
22
|
+
blockId: string;
|
|
23
|
+
offset: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Selection range in a document
|
|
27
|
+
*/
|
|
28
|
+
interface SelectionRange {
|
|
29
|
+
anchor: CursorPosition;
|
|
30
|
+
head: CursorPosition;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create an awareness instance for a document
|
|
34
|
+
*/
|
|
35
|
+
declare function createAwareness(doc: Doc): Awareness;
|
|
36
|
+
/**
|
|
37
|
+
* Set local user presence
|
|
38
|
+
*/
|
|
39
|
+
declare function setLocalPresence(awareness: Awareness, presence: UserPresence): void;
|
|
40
|
+
/**
|
|
41
|
+
* Clear local user presence
|
|
42
|
+
*/
|
|
43
|
+
declare function clearLocalPresence(awareness: Awareness): void;
|
|
44
|
+
/**
|
|
45
|
+
* Get remote user presences
|
|
46
|
+
*/
|
|
47
|
+
declare function getRemotePresences(awareness: Awareness): Map<number, UserPresence>;
|
|
48
|
+
/**
|
|
49
|
+
* Get all presences including local
|
|
50
|
+
*/
|
|
51
|
+
declare function getAllPresences(awareness: Awareness): Map<number, UserPresence>;
|
|
52
|
+
/**
|
|
53
|
+
* Subscribe to presence changes
|
|
54
|
+
*/
|
|
55
|
+
declare function onPresenceChange(awareness: Awareness, callback: (changes: {
|
|
56
|
+
added: number[];
|
|
57
|
+
updated: number[];
|
|
58
|
+
removed: number[];
|
|
59
|
+
}) => void): () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Get local client ID
|
|
62
|
+
*/
|
|
63
|
+
declare function getLocalClientId(awareness: Awareness): number;
|
|
64
|
+
/**
|
|
65
|
+
* Generate a random color for user presence
|
|
66
|
+
*/
|
|
67
|
+
declare function generateUserColor(): string;
|
|
68
|
+
|
|
69
|
+
export { type CursorPosition, type SelectionRange, type UserPresence, clearLocalPresence, createAwareness, generateUserColor, getAllPresences, getLocalClientId, getRemotePresences, onPresenceChange, setLocalPresence };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearLocalPresence,
|
|
3
|
+
createAwareness,
|
|
4
|
+
generateUserColor,
|
|
5
|
+
getAllPresences,
|
|
6
|
+
getLocalClientId,
|
|
7
|
+
getRemotePresences,
|
|
8
|
+
onPresenceChange,
|
|
9
|
+
setLocalPresence
|
|
10
|
+
} from "../chunk-7PDRDSFH.js";
|
|
11
|
+
export {
|
|
12
|
+
clearLocalPresence,
|
|
13
|
+
createAwareness,
|
|
14
|
+
generateUserColor,
|
|
15
|
+
getAllPresences,
|
|
16
|
+
getLocalClientId,
|
|
17
|
+
getRemotePresences,
|
|
18
|
+
onPresenceChange,
|
|
19
|
+
setLocalPresence
|
|
20
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PresenceSummarySchema,
|
|
3
|
+
SYSTEM_NAMESPACE_KINDS,
|
|
4
|
+
SYSTEM_SCHEMA_BASE_IRIS,
|
|
5
|
+
SYSTEM_SCHEMA_IRIS,
|
|
6
|
+
SchemaCompatibilitySchema,
|
|
7
|
+
SchemaDefinitionSchema,
|
|
8
|
+
SyncPolicySchema,
|
|
9
|
+
buildSystemNamespace,
|
|
10
|
+
buildSystemNodeId,
|
|
11
|
+
computeSchemaDefinitionContentHash,
|
|
12
|
+
createSchemaDefinitionSigningPayload,
|
|
13
|
+
isSystemNamespaceResource,
|
|
14
|
+
isSystemSchemaIri,
|
|
15
|
+
parseSystemNamespaceResource,
|
|
16
|
+
resolveSchemaAuthority,
|
|
17
|
+
validateSchemaDefinitionNode
|
|
18
|
+
} from "./chunk-V6HZ3LF3.js";
|
|
19
|
+
import "./chunk-O64EK5FK.js";
|
|
20
|
+
import "./chunk-JESSJ5CZ.js";
|
|
21
|
+
export {
|
|
22
|
+
PresenceSummarySchema,
|
|
23
|
+
SYSTEM_NAMESPACE_KINDS,
|
|
24
|
+
SYSTEM_SCHEMA_BASE_IRIS,
|
|
25
|
+
SYSTEM_SCHEMA_IRIS,
|
|
26
|
+
SchemaCompatibilitySchema,
|
|
27
|
+
SchemaDefinitionSchema,
|
|
28
|
+
SyncPolicySchema,
|
|
29
|
+
buildSystemNamespace,
|
|
30
|
+
buildSystemNodeId,
|
|
31
|
+
computeSchemaDefinitionContentHash,
|
|
32
|
+
createSchemaDefinitionSigningPayload,
|
|
33
|
+
isSystemNamespaceResource,
|
|
34
|
+
isSystemSchemaIri,
|
|
35
|
+
parseSystemNamespaceResource,
|
|
36
|
+
resolveSchemaAuthority,
|
|
37
|
+
validateSchemaDefinitionNode
|
|
38
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MAX_TAG_NAME_LENGTH,
|
|
3
|
+
TAG_SCHEMA_IRI,
|
|
4
|
+
TagSchema,
|
|
5
|
+
isValidTagName,
|
|
6
|
+
normalizeTagName
|
|
7
|
+
} from "./chunk-YWN27MLD.js";
|
|
8
|
+
import "./chunk-O64EK5FK.js";
|
|
9
|
+
import "./chunk-JESSJ5CZ.js";
|
|
10
|
+
export {
|
|
11
|
+
MAX_TAG_NAME_LENGTH,
|
|
12
|
+
TAG_SCHEMA_IRI,
|
|
13
|
+
TagSchema,
|
|
14
|
+
isValidTagName,
|
|
15
|
+
normalizeTagName
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TASK_STATUS_CATEGORIES,
|
|
3
|
+
TaskSchema,
|
|
4
|
+
getTaskStatusCategory,
|
|
5
|
+
isCompletedTaskStatus
|
|
6
|
+
} from "./chunk-3RB2FMMO.js";
|
|
7
|
+
import "./chunk-6OPZJ7MG.js";
|
|
8
|
+
import "./chunk-ZICIXDEE.js";
|
|
9
|
+
import "./chunk-O64EK5FK.js";
|
|
10
|
+
import "./chunk-JESSJ5CZ.js";
|
|
11
|
+
export {
|
|
12
|
+
TASK_STATUS_CATEGORIES,
|
|
13
|
+
TaskSchema,
|
|
14
|
+
getTaskStatusCategory,
|
|
15
|
+
isCompletedTaskStatus
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TRANSACTION_SCHEMA_IRI,
|
|
3
|
+
TransactionSchema
|
|
4
|
+
} from "./chunk-YXZGYLKV.js";
|
|
5
|
+
import "./chunk-6OPZJ7MG.js";
|
|
6
|
+
import "./chunk-ZICIXDEE.js";
|
|
7
|
+
import "./chunk-O64EK5FK.js";
|
|
8
|
+
import "./chunk-JESSJ5CZ.js";
|
|
9
|
+
export {
|
|
10
|
+
TRANSACTION_SCHEMA_IRI,
|
|
11
|
+
TransactionSchema
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TRANSCRIPTION_SCHEMA_IRI,
|
|
3
|
+
TranscriptionSchema
|
|
4
|
+
} from "./chunk-J6EDPPH4.js";
|
|
5
|
+
import "./chunk-6OPZJ7MG.js";
|
|
6
|
+
import "./chunk-ZICIXDEE.js";
|
|
7
|
+
import "./chunk-O64EK5FK.js";
|
|
8
|
+
import "./chunk-JESSJ5CZ.js";
|
|
9
|
+
export {
|
|
10
|
+
TRANSCRIPTION_SCHEMA_IRI,
|
|
11
|
+
TranscriptionSchema
|
|
12
|
+
};
|