@tldraw/sync-core 5.2.0-canary.a1c843a2b505 → 5.2.0-canary.b5edd6c3c8b1

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 CHANGED
@@ -4,6 +4,10 @@ This project contains core functionality for [tldraw sync](https://tldraw.dev/do
4
4
 
5
5
  ## Documentation
6
6
 
7
+ Documentation for the most recent release can be found on [tldraw.dev/docs](https://tldraw.dev/docs), including [reference docs](https://tldraw.dev/reference/editor/Editor). Our release notes can be found [here](https://tldraw.dev/releases).
8
+
9
+ For more agent-friendly docs, see our [LLMs.txt](https://tldraw.dev/llms.txt).
10
+
7
11
  A `DOCS.md` file is included alongside this README in the published package, with detailed API documentation and usage examples.
8
12
 
9
13
  ## License
package/dist-cjs/index.js CHANGED
@@ -61,7 +61,7 @@ var import_TLSyncRoom = require("./lib/TLSyncRoom");
61
61
  var import_TLSyncStorage = require("./lib/TLSyncStorage");
62
62
  (0, import_utils.registerTldrawLibraryVersion)(
63
63
  "@tldraw/sync-core",
64
- "5.2.0-canary.a1c843a2b505",
64
+ "5.2.0-canary.b5edd6c3c8b1",
65
65
  "cjs"
66
66
  );
67
67
  //# sourceMappingURL=index.js.map
@@ -36,7 +36,7 @@ import {
36
36
  } from "./lib/TLSyncStorage.mjs";
37
37
  registerTldrawLibraryVersion(
38
38
  "@tldraw/sync-core",
39
- "5.2.0-canary.a1c843a2b505",
39
+ "5.2.0-canary.b5edd6c3c8b1",
40
40
  "esm"
41
41
  );
42
42
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tldraw/sync-core",
3
3
  "description": "tldraw infinite canvas SDK (multiplayer sync).",
4
- "version": "5.2.0-canary.a1c843a2b505",
4
+ "version": "5.2.0-canary.b5edd6c3c8b1",
5
5
  "author": {
6
6
  "name": "tldraw GB Ltd.",
7
7
  "email": "hello@tldraw.com"
@@ -49,17 +49,17 @@
49
49
  "@types/uuid-readable": "^0.0.3",
50
50
  "react": "^19.2.1",
51
51
  "react-dom": "^19.2.1",
52
- "tldraw": "5.2.0-canary.a1c843a2b505",
52
+ "tldraw": "5.2.0-canary.b5edd6c3c8b1",
53
53
  "typescript": "^5.8.3",
54
54
  "uuid-by-string": "^4.0.0",
55
55
  "uuid-readable": "^0.0.2",
56
56
  "vitest": "^4.1.7"
57
57
  },
58
58
  "dependencies": {
59
- "@tldraw/state": "5.2.0-canary.a1c843a2b505",
60
- "@tldraw/store": "5.2.0-canary.a1c843a2b505",
61
- "@tldraw/tlschema": "5.2.0-canary.a1c843a2b505",
62
- "@tldraw/utils": "5.2.0-canary.a1c843a2b505",
59
+ "@tldraw/state": "5.2.0-canary.b5edd6c3c8b1",
60
+ "@tldraw/store": "5.2.0-canary.b5edd6c3c8b1",
61
+ "@tldraw/tlschema": "5.2.0-canary.b5edd6c3c8b1",
62
+ "@tldraw/utils": "5.2.0-canary.b5edd6c3c8b1",
63
63
  "nanoevents": "^7.0.1",
64
64
  "ws": "^8.18.0"
65
65
  },
@@ -1,8 +1,10 @@
1
1
  /* eslint-disable @typescript-eslint/no-deprecated */
2
2
  import {
3
+ createUserId,
3
4
  InstancePresenceRecordType,
4
5
  PageRecordType,
5
6
  TLDocument,
7
+ TLInstancePresence,
6
8
  TLPage,
7
9
  TLRecord,
8
10
  } from '@tldraw/tlschema'
@@ -192,14 +194,14 @@ describe(TLSocketRoom, () => {
192
194
  // Create presence records for each session
193
195
  const presence1 = InstancePresenceRecordType.create({
194
196
  id: InstancePresenceRecordType.createId('presence1'),
195
- userId: 'user1',
197
+ userId: createUserId('user1'),
196
198
  userName: 'User 1',
197
199
  currentPageId: PageRecordType.createId('page'),
198
200
  })
199
201
 
200
202
  const presence2 = InstancePresenceRecordType.create({
201
203
  id: InstancePresenceRecordType.createId('presence2'),
202
- userId: 'user2',
204
+ userId: createUserId('user2'),
203
205
  userName: 'User 2',
204
206
  currentPageId: PageRecordType.createId('page'),
205
207
  })
@@ -226,8 +228,12 @@ describe(TLSocketRoom, () => {
226
228
  expect(Object.keys(presenceRecords)).toHaveLength(2)
227
229
 
228
230
  // Find the presence records by their user data since the IDs are generated by the room
229
- const user1Presence = Object.values(presenceRecords).find((p) => (p as any).userId === 'user1')
230
- const user2Presence = Object.values(presenceRecords).find((p) => (p as any).userId === 'user2')
231
+ const user1Presence = Object.values(presenceRecords).find(
232
+ (p) => (p as TLInstancePresence).userId === createUserId('user1')
233
+ )
234
+ const user2Presence = Object.values(presenceRecords).find(
235
+ (p) => (p as TLInstancePresence).userId === createUserId('user2')
236
+ )
231
237
 
232
238
  expect(user1Presence).toBeDefined()
233
239
  expect(user2Presence).toBeDefined()
@@ -235,13 +241,13 @@ describe(TLSocketRoom, () => {
235
241
  // Verify the records are properly structured
236
242
  expect(user1Presence).toMatchObject({
237
243
  typeName: 'instance_presence',
238
- userId: 'user1',
244
+ userId: createUserId('user1'),
239
245
  userName: 'User 1',
240
246
  })
241
247
 
242
248
  expect(user2Presence).toMatchObject({
243
249
  typeName: 'instance_presence',
244
- userId: 'user2',
250
+ userId: createUserId('user2'),
245
251
  userName: 'User 2',
246
252
  })
247
253
 
@@ -854,7 +860,7 @@ describe('Hibernation support', () => {
854
860
 
855
861
  const presence = InstancePresenceRecordType.create({
856
862
  id: InstancePresenceRecordType.createId('p1'),
857
- userId: 'user1',
863
+ userId: createUserId('user1'),
858
864
  userName: 'User 1',
859
865
  currentPageId: PageRecordType.createId('page'),
860
866
  })
@@ -868,7 +874,7 @@ describe('Hibernation support', () => {
868
874
  const snapshot = room.getSessionSnapshot('test')
869
875
  expect(snapshot).not.toBeNull()
870
876
  expect(snapshot!.presenceRecord).not.toBeNull()
871
- expect((snapshot!.presenceRecord as any).userId).toBe('user1')
877
+ expect((snapshot!.presenceRecord as TLInstancePresence).userId).toBe(createUserId('user1'))
872
878
  })
873
879
  })
874
880
 
@@ -944,7 +950,7 @@ describe('Hibernation support', () => {
944
950
  // Push presence
945
951
  const presence = InstancePresenceRecordType.create({
946
952
  id: InstancePresenceRecordType.createId('p1'),
947
- userId: 'user1',
953
+ userId: createUserId('user1'),
948
954
  userName: 'User 1',
949
955
  currentPageId: PageRecordType.createId('page'),
950
956
  })
@@ -973,7 +979,7 @@ describe('Hibernation support', () => {
973
979
  const presenceRecords = room2.getPresenceRecords()
974
980
  expect(Object.keys(presenceRecords)).toHaveLength(1)
975
981
  const restored = Object.values(presenceRecords)[0]
976
- expect((restored as any).userId).toBe('user1')
982
+ expect((restored as TLInstancePresence).userId).toBe(createUserId('user1'))
977
983
  })
978
984
 
979
985
  it('does not attach event listeners', () => {
@@ -1167,7 +1173,7 @@ describe('Hibernation support', () => {
1167
1173
  // Push presence
1168
1174
  const presence = InstancePresenceRecordType.create({
1169
1175
  id: InstancePresenceRecordType.createId('p1'),
1170
- userId: 'user1',
1176
+ userId: createUserId('user1'),
1171
1177
  userName: 'User 1',
1172
1178
  currentPageId: PageRecordType.createId('page'),
1173
1179
  })
@@ -12,6 +12,7 @@ import {
12
12
  TLRecord,
13
13
  TLShapeId,
14
14
  createTLSchema,
15
+ createUserId,
15
16
  } from '@tldraw/tlschema'
16
17
  import { IndexKey, ZERO_INDEX_KEY, mockUniqueId, sortById } from '@tldraw/utils'
17
18
  import { vi } from 'vitest'
@@ -301,7 +302,7 @@ describe('isReadonly', () => {
301
302
  InstancePresenceRecordType.create({
302
303
  id: InstancePresenceRecordType.createId('foo'),
303
304
  currentPageId: 'page:page_2' as any,
304
- userId: 'foo',
305
+ userId: createUserId('foo'),
305
306
  userName: 'Jimbo',
306
307
  }),
307
308
  ],
@@ -349,7 +350,7 @@ describe('isReadonly', () => {
349
350
  "scribbles": [],
350
351
  "selectedShapeIds": [],
351
352
  "typeName": "instance_presence",
352
- "userId": "foo",
353
+ "userId": "user:foo",
353
354
  "userName": "Jimbo",
354
355
  },
355
356
  ],
@@ -904,7 +905,7 @@ describe('Presence store isolation', () => {
904
905
  InstancePresenceRecordType.create({
905
906
  id: InstancePresenceRecordType.createId('presence-1'),
906
907
  currentPageId: PageRecordType.createId('page_2'),
907
- userId: 'user-1',
908
+ userId: createUserId('user-1'),
908
909
  userName: 'Test User',
909
910
  }),
910
911
  ],
@@ -949,7 +950,7 @@ describe('Presence store isolation', () => {
949
950
  InstancePresenceRecordType.create({
950
951
  id: InstancePresenceRecordType.createId('any'),
951
952
  currentPageId: PageRecordType.createId('page_2'),
952
- userId: 'user-1',
953
+ userId: createUserId('user-1'),
953
954
  userName: 'Test User',
954
955
  }),
955
956
  ],
@@ -999,7 +1000,7 @@ describe('Presence store isolation', () => {
999
1000
  InstancePresenceRecordType.create({
1000
1001
  id: InstancePresenceRecordType.createId('any'),
1001
1002
  currentPageId: PageRecordType.createId('page_2'),
1002
- userId: 'user-1',
1003
+ userId: createUserId('user-1'),
1003
1004
  userName: 'Test User',
1004
1005
  }),
1005
1006
  ],