@tldraw/sync-core 4.3.0-canary.cf5673a789a1 → 4.3.0-canary.d428e9e9a7c6

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.
Files changed (51) hide show
  1. package/dist-cjs/index.d.ts +239 -57
  2. package/dist-cjs/index.js +7 -3
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/InMemorySyncStorage.js +289 -0
  5. package/dist-cjs/lib/InMemorySyncStorage.js.map +7 -0
  6. package/dist-cjs/lib/RoomSession.js.map +1 -1
  7. package/dist-cjs/lib/TLSocketRoom.js +117 -69
  8. package/dist-cjs/lib/TLSocketRoom.js.map +2 -2
  9. package/dist-cjs/lib/TLSyncClient.js +7 -0
  10. package/dist-cjs/lib/TLSyncClient.js.map +2 -2
  11. package/dist-cjs/lib/TLSyncRoom.js +357 -688
  12. package/dist-cjs/lib/TLSyncRoom.js.map +3 -3
  13. package/dist-cjs/lib/TLSyncStorage.js +76 -0
  14. package/dist-cjs/lib/TLSyncStorage.js.map +7 -0
  15. package/dist-cjs/lib/recordDiff.js +52 -0
  16. package/dist-cjs/lib/recordDiff.js.map +7 -0
  17. package/dist-esm/index.d.mts +239 -57
  18. package/dist-esm/index.mjs +12 -5
  19. package/dist-esm/index.mjs.map +2 -2
  20. package/dist-esm/lib/InMemorySyncStorage.mjs +274 -0
  21. package/dist-esm/lib/InMemorySyncStorage.mjs.map +7 -0
  22. package/dist-esm/lib/RoomSession.mjs.map +1 -1
  23. package/dist-esm/lib/TLSocketRoom.mjs +121 -70
  24. package/dist-esm/lib/TLSocketRoom.mjs.map +2 -2
  25. package/dist-esm/lib/TLSyncClient.mjs +7 -0
  26. package/dist-esm/lib/TLSyncClient.mjs.map +2 -2
  27. package/dist-esm/lib/TLSyncRoom.mjs +370 -702
  28. package/dist-esm/lib/TLSyncRoom.mjs.map +3 -3
  29. package/dist-esm/lib/TLSyncStorage.mjs +56 -0
  30. package/dist-esm/lib/TLSyncStorage.mjs.map +7 -0
  31. package/dist-esm/lib/recordDiff.mjs +32 -0
  32. package/dist-esm/lib/recordDiff.mjs.map +7 -0
  33. package/package.json +6 -6
  34. package/src/index.ts +21 -3
  35. package/src/lib/InMemorySyncStorage.ts +357 -0
  36. package/src/lib/RoomSession.test.ts +1 -0
  37. package/src/lib/RoomSession.ts +2 -0
  38. package/src/lib/TLSocketRoom.ts +228 -114
  39. package/src/lib/TLSyncClient.ts +12 -0
  40. package/src/lib/TLSyncRoom.ts +473 -913
  41. package/src/lib/TLSyncStorage.ts +216 -0
  42. package/src/lib/recordDiff.ts +73 -0
  43. package/src/test/InMemorySyncStorage.test.ts +1674 -0
  44. package/src/test/TLSocketRoom.test.ts +255 -49
  45. package/src/test/TLSyncRoom.test.ts +1021 -533
  46. package/src/test/TestServer.ts +12 -1
  47. package/src/test/customMessages.test.ts +1 -1
  48. package/src/test/presenceMode.test.ts +6 -6
  49. package/src/test/upgradeDowngrade.test.ts +282 -8
  50. package/src/test/validation.test.ts +10 -10
  51. package/src/test/pruneTombstones.test.ts +0 -178
@@ -1,15 +1,20 @@
1
1
  import { Atom } from '@tldraw/state';
2
2
  import { AtomMap } from '@tldraw/store';
3
+ import { DebouncedFunc } from 'lodash';
3
4
  import { Emitter } from 'nanoevents';
4
5
  import { RecordsDiff } from '@tldraw/store';
5
6
  import { RecordType } from '@tldraw/store';
6
- import { Result } from '@tldraw/utils';
7
7
  import { SerializedSchema } from '@tldraw/store';
8
+ import { SerializedSchemaV2 } from '@tldraw/store';
8
9
  import { Signal } from '@tldraw/state';
9
10
  import { Store } from '@tldraw/store';
10
11
  import { StoreSchema } from '@tldraw/store';
12
+ import { SynchronousStorage } from '@tldraw/store';
13
+ import { TLDocument } from '@tldraw/tlschema';
14
+ import { TLPage } from '@tldraw/tlschema';
11
15
  import { TLRecord } from '@tldraw/tlschema';
12
16
  import { TLStoreSnapshot } from '@tldraw/tlschema';
17
+ import { TLStoreSnapshot as TLStoreSnapshot_2 } from 'tldraw';
13
18
  import { UnknownRecord } from '@tldraw/store';
14
19
 
15
20
  /* Excluded from this release type: AppendOp */
@@ -20,16 +25,55 @@ import { UnknownRecord } from '@tldraw/store';
20
25
 
21
26
  /* Excluded from this release type: ClientWebSocketAdapter */
22
27
 
28
+ /**
29
+ * Default initial snapshot for a new room.
30
+ * @public
31
+ */
32
+ export declare const DEFAULT_INITIAL_SNAPSHOT: {
33
+ documentClock: number;
34
+ documents: ({
35
+ lastChangedClock: number;
36
+ state: TLDocument;
37
+ } | {
38
+ lastChangedClock: number;
39
+ state: TLPage;
40
+ })[];
41
+ schema: SerializedSchemaV2;
42
+ tombstoneHistoryStartsAtClock: number;
43
+ };
44
+
23
45
  /* Excluded from this release type: DeleteOp */
24
46
 
25
47
  /* Excluded from this release type: diffRecord */
26
48
 
27
- /* Excluded from this release type: DocumentState */
28
-
29
49
  /* Excluded from this release type: getNetworkDiff */
30
50
 
31
51
  /* Excluded from this release type: getTlsyncProtocolVersion */
32
52
 
53
+ /**
54
+ * In-memory implementation of TLSyncStorage using AtomMap for documents and tombstones,
55
+ * and atoms for clock values. This is the default storage implementation used by TLSyncRoom.
56
+ *
57
+ * @public
58
+ */
59
+ export declare class InMemorySyncStorage<R extends UnknownRecord> implements TLSyncStorage<R> {
60
+ /* Excluded from this release type: documents */
61
+ /* Excluded from this release type: tombstones */
62
+ /* Excluded from this release type: schema */
63
+ /* Excluded from this release type: documentClock */
64
+ /* Excluded from this release type: tombstoneHistoryStartsAtClock */
65
+ private listeners;
66
+ onChange(callback: (arg: TLSyncStorageOnChangeCallbackProps) => unknown): () => void;
67
+ constructor({ snapshot, onChange, }?: {
68
+ onChange?(arg: TLSyncStorageOnChangeCallbackProps): unknown;
69
+ snapshot?: RoomSnapshot;
70
+ });
71
+ transaction<T>(callback: TLSyncStorageTransactionCallback<R, T>, opts?: TLSyncStorageTransactionOptions): TLSyncStorageTransactionResult<T, R>;
72
+ getClock(): number;
73
+ /* Excluded from this release type: pruneTombstones */
74
+ getSnapshot(): RoomSnapshot;
75
+ }
76
+
33
77
  /**
34
78
  * Assembles chunked JSON messages back into complete objects.
35
79
  * Handles both regular JSON messages and chunked messages created by the chunk() function.
@@ -94,6 +138,19 @@ export declare class JsonChunkAssembler {
94
138
  } | null;
95
139
  }
96
140
 
141
+ /**
142
+ * Loads a snapshot into storage during a transaction.
143
+ * Migrates the snapshot to the current schema and loads it into storage.
144
+ *
145
+ * @public
146
+ * @param txn - The transaction to load the snapshot into
147
+ * @param schema - The current schema
148
+ * @param snapshot - The snapshot to load
149
+ */
150
+ export declare function loadSnapshotIntoStorage<R extends UnknownRecord>(txn: TLSyncStorageTransaction<R>, schema: StoreSchema<R, any>, snapshot: RoomSnapshot | TLStoreSnapshot_2): void;
151
+
152
+ /* Excluded from this release type: MinimalDocStore */
153
+
97
154
  /* Excluded from this release type: NetworkDiff */
98
155
 
99
156
  /* Excluded from this release type: ObjectDiff */
@@ -119,6 +176,8 @@ export declare type OmitVoid<T, KS extends keyof T = keyof T> = {
119
176
 
120
177
  /* Excluded from this release type: PersistedRoomSnapshotForSupabase */
121
178
 
179
+ /* Excluded from this release type: PresenceStore */
180
+
122
181
  /* Excluded from this release type: PutOp */
123
182
 
124
183
  /* Excluded from this release type: ReconnectManager */
@@ -143,7 +202,7 @@ export declare interface RoomSnapshot {
143
202
  /**
144
203
  * The current logical clock value for the room
145
204
  */
146
- clock: number;
205
+ clock?: number;
147
206
  /**
148
207
  * Clock value when document data was last changed (optional for backwards compatibility)
149
208
  */
@@ -185,6 +244,7 @@ export declare interface RoomSnapshot {
185
244
  * ```
186
245
  *
187
246
  * @public
247
+ * @deprecated use the storage.transaction method instead
188
248
  */
189
249
  export declare interface RoomStoreMethods<R extends UnknownRecord = UnknownRecord> {
190
250
  /**
@@ -453,35 +513,12 @@ export declare class TLRemoteSyncError extends Error {
453
513
  * @public
454
514
  */
455
515
  export declare class TLSocketRoom<R extends UnknownRecord = UnknownRecord, SessionMeta = void> {
456
- readonly opts: {
457
- /* Excluded from this release type: onPresenceChange */
458
- clientTimeout?: number;
459
- initialSnapshot?: RoomSnapshot | TLStoreSnapshot;
460
- log?: TLSyncLog;
461
- onAfterReceiveMessage?: (args: {
462
- /* Excluded from this release type: message */
463
- meta: SessionMeta;
464
- sessionId: string;
465
- stringified: string;
466
- }) => void;
467
- onBeforeSendMessage?: (args: {
468
- /* Excluded from this release type: message */
469
- meta: SessionMeta;
470
- sessionId: string;
471
- stringified: string;
472
- }) => void;
473
- onDataChange?(): void;
474
- onSessionRemoved?: (room: TLSocketRoom<R, SessionMeta>, args: {
475
- meta: SessionMeta;
476
- numSessionsRemaining: number;
477
- sessionId: string;
478
- }) => void;
479
- schema?: StoreSchema<R, any>;
480
- };
516
+ readonly opts: TLSocketRoomOptions<R, SessionMeta>;
481
517
  private room;
482
518
  private readonly sessions;
483
519
  readonly log?: TLSyncLog;
484
- private readonly syncCallbacks;
520
+ storage: TLSyncStorage<R>;
521
+ private disposables;
485
522
  /**
486
523
  * Creates a new TLSocketRoom instance for managing collaborative document synchronization.
487
524
  *
@@ -496,31 +533,7 @@ export declare class TLSocketRoom<R extends UnknownRecord = UnknownRecord, Sessi
496
533
  * - onDataChange - Called when document data changes
497
534
  * - onPresenceChange - Called when presence data changes
498
535
  */
499
- constructor(opts: {
500
- /* Excluded from this release type: onPresenceChange */
501
- clientTimeout?: number;
502
- initialSnapshot?: RoomSnapshot | TLStoreSnapshot;
503
- log?: TLSyncLog;
504
- onAfterReceiveMessage?: (args: {
505
- /* Excluded from this release type: message */
506
- meta: SessionMeta;
507
- sessionId: string;
508
- stringified: string;
509
- }) => void;
510
- onBeforeSendMessage?: (args: {
511
- /* Excluded from this release type: message */
512
- meta: SessionMeta;
513
- sessionId: string;
514
- stringified: string;
515
- }) => void;
516
- onDataChange?(): void;
517
- onSessionRemoved?: (room: TLSocketRoom<R, SessionMeta>, args: {
518
- meta: SessionMeta;
519
- numSessionsRemaining: number;
520
- sessionId: string;
521
- }) => void;
522
- schema?: StoreSchema<R, any>;
523
- });
536
+ constructor(opts: TLSocketRoomOptions<R, SessionMeta>);
524
537
  /**
525
538
  * Returns the number of active sessions.
526
539
  * Note that this is not the same as the number of connected sockets!
@@ -658,7 +671,7 @@ export declare class TLSocketRoom<R extends UnknownRecord = UnknownRecord, Sessi
658
671
  * }
659
672
  * ```
660
673
  */
661
- getRecord(id: string): R | undefined;
674
+ getRecord(id: string): R;
662
675
  /**
663
676
  * Returns information about all active sessions in the room. Each session
664
677
  * represents a connected client with their current connection status and metadata.
@@ -694,6 +707,7 @@ export declare class TLSocketRoom<R extends UnknownRecord = UnknownRecord, Sessi
694
707
  * to restore the room state later or revert to a previous version.
695
708
  *
696
709
  * @returns Complete room snapshot including documents, clock values, and tombstones
710
+ * @deprecated if you need to do this use
697
711
  *
698
712
  * @example
699
713
  * ```ts
@@ -708,7 +722,6 @@ export declare class TLSocketRoom<R extends UnknownRecord = UnknownRecord, Sessi
708
722
  */
709
723
  getCurrentSnapshot(): RoomSnapshot;
710
724
  /* Excluded from this release type: getPresenceRecords */
711
- /* Excluded from this release type: getCurrentSerializedSnapshot */
712
725
  /**
713
726
  * Loads a document snapshot, completely replacing the current room state.
714
727
  * This will disconnect all current clients and update the document to match
@@ -770,6 +783,7 @@ export declare class TLSocketRoom<R extends UnknownRecord = UnknownRecord, Sessi
770
783
  * }
771
784
  * })
772
785
  * ```
786
+ * @deprecated use the storage.transaction method instead
773
787
  */
774
788
  updateStore(updater: (store: RoomStoreMethods<R>) => Promise<void> | void): Promise<void>;
775
789
  /**
@@ -859,6 +873,43 @@ export declare class TLSocketRoom<R extends UnknownRecord = UnknownRecord, Sessi
859
873
  isClosed(): boolean;
860
874
  }
861
875
 
876
+ /**
877
+ * Base options for TLSocketRoom.
878
+ * @public
879
+ */
880
+ export declare interface TLSocketRoomOptions<R extends UnknownRecord, SessionMeta> {
881
+ storage?: TLSyncStorage<R>;
882
+ /**
883
+ * @deprecated use the storage option instead
884
+ */
885
+ initialSnapshot?: RoomSnapshot | TLStoreSnapshot;
886
+ /**
887
+ * @deprecated use the storage option with an onChange callback instead
888
+ */
889
+ onDataChange?(): void;
890
+ schema?: StoreSchema<R, any>;
891
+ clientTimeout?: number;
892
+ log?: TLSyncLog;
893
+ onSessionRemoved?: (room: TLSocketRoom<R, SessionMeta>, args: {
894
+ meta: SessionMeta;
895
+ numSessionsRemaining: number;
896
+ sessionId: string;
897
+ }) => void;
898
+ onBeforeSendMessage?: (args: {
899
+ /* Excluded from this release type: message */
900
+ meta: SessionMeta;
901
+ sessionId: string;
902
+ stringified: string;
903
+ }) => void;
904
+ onAfterReceiveMessage?: (args: {
905
+ /* Excluded from this release type: message */
906
+ meta: SessionMeta;
907
+ sessionId: string;
908
+ stringified: string;
909
+ }) => void;
910
+ /* Excluded from this release type: onPresenceChange */
911
+ }
912
+
862
913
  /* Excluded from this release type: TLSocketServerSentDataEvent */
863
914
 
864
915
  /* Excluded from this release type: TLSocketServerSentEvent */
@@ -1144,6 +1195,15 @@ export declare const TLSyncErrorCloseEventReason: {
1144
1195
  */
1145
1196
  export declare type TLSyncErrorCloseEventReason = (typeof TLSyncErrorCloseEventReason)[keyof typeof TLSyncErrorCloseEventReason];
1146
1197
 
1198
+ /**
1199
+ * Respresents a diff of puts and deletes.
1200
+ * @public
1201
+ */
1202
+ export declare interface TLSyncForwardDiff<R extends UnknownRecord> {
1203
+ puts: Record<string, [before: R, after: R] | R>;
1204
+ deletes: string[];
1205
+ }
1206
+
1147
1207
  /**
1148
1208
  * Logging interface for TLSocketRoom operations. Provides optional methods
1149
1209
  * for warning and error logging during synchronization operations.
@@ -1175,6 +1235,128 @@ export declare interface TLSyncLog {
1175
1235
 
1176
1236
  /* Excluded from this release type: TLSyncRoom */
1177
1237
 
1238
+ /**
1239
+ * Pluggable synchronous transactional storage layer for TLSyncRoom.
1240
+ * Provides methods for managing documents, tombstones, and clocks within transactions.
1241
+ *
1242
+ * @public
1243
+ */
1244
+ export declare interface TLSyncStorage<R extends UnknownRecord> {
1245
+ transaction<T>(callback: TLSyncStorageTransactionCallback<R, T>, opts?: TLSyncStorageTransactionOptions): TLSyncStorageTransactionResult<T, R>;
1246
+ getClock(): number;
1247
+ onChange(callback: (arg: TLSyncStorageOnChangeCallbackProps) => unknown): () => void;
1248
+ getSnapshot?(): RoomSnapshot;
1249
+ }
1250
+
1251
+ /**
1252
+ * Result returned from getChangesSince, containing all changes since a given clock time.
1253
+ * @public
1254
+ */
1255
+ export declare interface TLSyncStorageGetChangesSinceResult<R extends UnknownRecord> {
1256
+ /**
1257
+ * The changes as a TLSyncForwardDiff.
1258
+ */
1259
+ diff: TLSyncForwardDiff<R>;
1260
+ /**
1261
+ * If true, the client should wipe all local data and replace with the server's state.
1262
+ * This happens when the client's clock is too old and we've lost tombstone history.
1263
+ */
1264
+ wipeAll: boolean;
1265
+ }
1266
+
1267
+ /**
1268
+ * Properties passed to the onChange callback.
1269
+ * @public
1270
+ */
1271
+ export declare interface TLSyncStorageOnChangeCallbackProps {
1272
+ /**
1273
+ * The ID of the transaction that caused the change.
1274
+ * This is useful for ignoring certain changes in onChange callbacks.
1275
+ */
1276
+ id?: string;
1277
+ documentClock: number;
1278
+ }
1279
+
1280
+ /**
1281
+ * Transaction interface for storage operations. Provides methods to read and modify
1282
+ * documents, tombstones, and metadata within a transaction.
1283
+ *
1284
+ * @public
1285
+ */
1286
+ export declare interface TLSyncStorageTransaction<R extends UnknownRecord> extends SynchronousStorage<R> {
1287
+ /**
1288
+ * Get the current clock value.
1289
+ * If the clock has incremented during the transaction,
1290
+ * the incremented value will be returned.
1291
+ *
1292
+ * @returns The current clock value
1293
+ */
1294
+ getClock(): number;
1295
+ /**
1296
+ * Get all changes (document updates and deletions) since a given clock time.
1297
+ * This is the main method for calculating diffs for client sync.
1298
+ *
1299
+ * @param sinceClock - The clock time to get changes since
1300
+ * @returns Changes since the specified clock time
1301
+ */
1302
+ getChangesSince(sinceClock: number): TLSyncStorageGetChangesSinceResult<R> | undefined;
1303
+ }
1304
+
1305
+ /**
1306
+ * Callback type for a transaction.
1307
+ * The conditional return type ensures that the callback is synchronous.
1308
+ * @public
1309
+ */
1310
+ export declare type TLSyncStorageTransactionCallback<R extends UnknownRecord, T> = (txn: TLSyncStorageTransaction<R>) => T extends Promise<any> ? {
1311
+ __error: 'Transaction callbacks cannot be async. Use synchronous operations only.';
1312
+ } : T;
1313
+
1314
+ /**
1315
+ * Options for a transaction.
1316
+ * @public
1317
+ */
1318
+ export declare interface TLSyncStorageTransactionOptions {
1319
+ /**
1320
+ * Use this if you need to identify the transaction for logging or debugging purposes
1321
+ * or for ignoring certain changes in onChange callbacks
1322
+ */
1323
+ id?: string;
1324
+ /**
1325
+ * Controls when the storage layer should emit the actual changes that occurred during the transaction.
1326
+ *
1327
+ * - `'always'` - Always emit the changes, regardless of whether they were applied verbatim
1328
+ * - `'when-different'` - Only emit changes if the storage layer modified/embellished the records
1329
+ * (e.g., added server timestamps, normalized data, etc.)
1330
+ *
1331
+ * When changes are emitted, they will be available in the `changes` field of the transaction result.
1332
+ * This is useful when the storage layer may transform records and the caller needs to know
1333
+ * what actually changed rather than what was requested.
1334
+ */
1335
+ emitChanges?: 'always' | 'when-different';
1336
+ }
1337
+
1338
+ /**
1339
+ * Result returned from a storage transaction.
1340
+ * @public
1341
+ */
1342
+ export declare interface TLSyncStorageTransactionResult<T, R extends UnknownRecord = UnknownRecord> {
1343
+ documentClock: number;
1344
+ didChange: boolean;
1345
+ result: T;
1346
+ /**
1347
+ * The actual changes that occurred during the transaction, if requested via `emitChanges` option.
1348
+ * This is a RecordsDiff where:
1349
+ * - `added` contains records that were put (we don't have "from" state for emitted changes)
1350
+ * - `removed` contains records that were deleted (with placeholder values since we only have IDs)
1351
+ * - `updated` is empty (emitted changes don't track before/after pairs)
1352
+ *
1353
+ * Only populated when:
1354
+ * - `emitChanges: 'always'` was specified, or
1355
+ * - `emitChanges: 'when-different'` was specified and the storage layer modified records
1356
+ */
1357
+ changes?: TLSyncForwardDiff<R>;
1358
+ }
1359
+
1178
1360
  /* Excluded from this release type: ValueOp */
1179
1361
 
1180
1362
  /* Excluded from this release type: ValueOpType */
package/dist-cjs/index.js CHANGED
@@ -19,7 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var index_exports = {};
20
20
  __export(index_exports, {
21
21
  ClientWebSocketAdapter: () => import_ClientWebSocketAdapter.ClientWebSocketAdapter,
22
- DocumentState: () => import_TLSyncRoom.DocumentState,
22
+ DEFAULT_INITIAL_SNAPSHOT: () => import_InMemorySyncStorage.DEFAULT_INITIAL_SNAPSHOT,
23
+ InMemorySyncStorage: () => import_InMemorySyncStorage.InMemorySyncStorage,
23
24
  JsonChunkAssembler: () => import_chunk.JsonChunkAssembler,
24
25
  ReconnectManager: () => import_ClientWebSocketAdapter.ReconnectManager,
25
26
  RecordOpType: () => import_diff.RecordOpType,
@@ -36,22 +37,25 @@ __export(index_exports, {
36
37
  chunk: () => import_chunk.chunk,
37
38
  diffRecord: () => import_diff.diffRecord,
38
39
  getNetworkDiff: () => import_diff.getNetworkDiff,
39
- getTlsyncProtocolVersion: () => import_protocol.getTlsyncProtocolVersion
40
+ getTlsyncProtocolVersion: () => import_protocol.getTlsyncProtocolVersion,
41
+ loadSnapshotIntoStorage: () => import_TLSyncStorage.loadSnapshotIntoStorage
40
42
  });
41
43
  module.exports = __toCommonJS(index_exports);
42
44
  var import_utils = require("@tldraw/utils");
43
45
  var import_chunk = require("./lib/chunk");
44
46
  var import_ClientWebSocketAdapter = require("./lib/ClientWebSocketAdapter");
45
47
  var import_diff = require("./lib/diff");
48
+ var import_InMemorySyncStorage = require("./lib/InMemorySyncStorage");
46
49
  var import_protocol = require("./lib/protocol");
47
50
  var import_RoomSession = require("./lib/RoomSession");
48
51
  var import_TLRemoteSyncError = require("./lib/TLRemoteSyncError");
49
52
  var import_TLSocketRoom = require("./lib/TLSocketRoom");
50
53
  var import_TLSyncClient = require("./lib/TLSyncClient");
51
54
  var import_TLSyncRoom = require("./lib/TLSyncRoom");
55
+ var import_TLSyncStorage = require("./lib/TLSyncStorage");
52
56
  (0, import_utils.registerTldrawLibraryVersion)(
53
57
  "@tldraw/sync-core",
54
- "4.3.0-canary.cf5673a789a1",
58
+ "4.3.0-canary.d428e9e9a7c6",
55
59
  "cjs"
56
60
  );
57
61
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport { chunk, JsonChunkAssembler } from './lib/chunk'\nexport { ClientWebSocketAdapter, ReconnectManager } from './lib/ClientWebSocketAdapter'\nexport {\n\tapplyObjectDiff,\n\tdiffRecord,\n\tgetNetworkDiff,\n\tRecordOpType,\n\tValueOpType,\n\ttype AppendOp,\n\ttype DeleteOp,\n\ttype NetworkDiff,\n\ttype ObjectDiff,\n\ttype PatchOp,\n\ttype PutOp,\n\ttype RecordOp,\n\ttype ValueOp,\n} from './lib/diff'\nexport {\n\tgetTlsyncProtocolVersion,\n\tTLIncompatibilityReason,\n\ttype TLConnectRequest,\n\ttype TLPingRequest,\n\ttype TLPushRequest,\n\ttype TLSocketClientSentEvent,\n\ttype TLSocketServerSentDataEvent,\n\ttype TLSocketServerSentEvent,\n} from './lib/protocol'\nexport { RoomSessionState, type RoomSession, type RoomSessionBase } from './lib/RoomSession'\nexport type { PersistedRoomSnapshotForSupabase } from './lib/server-types'\nexport type { WebSocketMinimal } from './lib/ServerSocketAdapter'\nexport { TLRemoteSyncError } from './lib/TLRemoteSyncError'\nexport { TLSocketRoom, type OmitVoid, type TLSyncLog } from './lib/TLSocketRoom'\nexport {\n\tTLSyncClient,\n\tTLSyncErrorCloseEventCode,\n\tTLSyncErrorCloseEventReason,\n\ttype SubscribingFn,\n\ttype TLCustomMessageHandler,\n\ttype TLPersistentClientSocket,\n\ttype TLPersistentClientSocketStatus,\n\ttype TLPresenceMode,\n\ttype TLSocketStatusChangeEvent,\n\ttype TLSocketStatusListener,\n} from './lib/TLSyncClient'\nexport {\n\tDocumentState,\n\tTLSyncRoom,\n\ttype RoomSnapshot,\n\ttype RoomStoreMethods,\n\ttype TLRoomSocket,\n} from './lib/TLSyncRoom'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAC7C,mBAA0C;AAC1C,oCAAyD;AACzD,kBAcO;AACP,sBASO;AACP,yBAAyE;AAGzE,+BAAkC;AAClC,0BAA4D;AAC5D,0BAWO;AACP,wBAMO;AAAA,IAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport { chunk, JsonChunkAssembler } from './lib/chunk'\nexport { ClientWebSocketAdapter, ReconnectManager } from './lib/ClientWebSocketAdapter'\nexport {\n\tapplyObjectDiff,\n\tdiffRecord,\n\tgetNetworkDiff,\n\tRecordOpType,\n\tValueOpType,\n\ttype AppendOp,\n\ttype DeleteOp,\n\ttype NetworkDiff,\n\ttype ObjectDiff,\n\ttype PatchOp,\n\ttype PutOp,\n\ttype RecordOp,\n\ttype ValueOp,\n} from './lib/diff'\nexport { DEFAULT_INITIAL_SNAPSHOT, InMemorySyncStorage } from './lib/InMemorySyncStorage'\nexport {\n\tgetTlsyncProtocolVersion,\n\tTLIncompatibilityReason,\n\ttype TLConnectRequest,\n\ttype TLPingRequest,\n\ttype TLPushRequest,\n\ttype TLSocketClientSentEvent,\n\ttype TLSocketServerSentDataEvent,\n\ttype TLSocketServerSentEvent,\n} from './lib/protocol'\nexport { RoomSessionState, type RoomSession, type RoomSessionBase } from './lib/RoomSession'\nexport type { PersistedRoomSnapshotForSupabase } from './lib/server-types'\nexport type { WebSocketMinimal } from './lib/ServerSocketAdapter'\nexport { TLRemoteSyncError } from './lib/TLRemoteSyncError'\nexport {\n\tTLSocketRoom,\n\ttype OmitVoid,\n\ttype RoomStoreMethods,\n\ttype TLSocketRoomOptions,\n\ttype TLSyncLog,\n} from './lib/TLSocketRoom'\nexport {\n\tTLSyncClient,\n\tTLSyncErrorCloseEventCode,\n\tTLSyncErrorCloseEventReason,\n\ttype SubscribingFn,\n\ttype TLCustomMessageHandler,\n\ttype TLPersistentClientSocket,\n\ttype TLPersistentClientSocketStatus,\n\ttype TLPresenceMode,\n\ttype TLSocketStatusChangeEvent,\n\ttype TLSocketStatusListener,\n} from './lib/TLSyncClient'\nexport {\n\tTLSyncRoom,\n\ttype MinimalDocStore,\n\ttype PresenceStore,\n\ttype RoomSnapshot,\n\ttype TLRoomSocket,\n} from './lib/TLSyncRoom'\nexport {\n\tloadSnapshotIntoStorage,\n\ttype TLSyncForwardDiff,\n\ttype TLSyncStorage,\n\ttype TLSyncStorageGetChangesSinceResult,\n\ttype TLSyncStorageOnChangeCallbackProps,\n\ttype TLSyncStorageTransaction,\n\ttype TLSyncStorageTransactionCallback,\n\ttype TLSyncStorageTransactionOptions,\n\ttype TLSyncStorageTransactionResult,\n} from './lib/TLSyncStorage'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAC7C,mBAA0C;AAC1C,oCAAyD;AACzD,kBAcO;AACP,iCAA8D;AAC9D,sBASO;AACP,yBAAyE;AAGzE,+BAAkC;AAClC,0BAMO;AACP,0BAWO;AACP,wBAMO;AACP,2BAUO;AAAA,IAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }