jazz-tools 0.17.14 → 0.18.1

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 (250) hide show
  1. package/.svelte-kit/__package__/jazz.class.svelte.js +1 -1
  2. package/.svelte-kit/__package__/media/image.svelte +3 -9
  3. package/.svelte-kit/__package__/media/image.svelte.d.ts +1 -6
  4. package/.svelte-kit/__package__/media/image.svelte.d.ts.map +1 -1
  5. package/.svelte-kit/__package__/media/image.types.d.ts +7 -0
  6. package/.svelte-kit/__package__/media/image.types.d.ts.map +1 -0
  7. package/.svelte-kit/__package__/media/image.types.js +1 -0
  8. package/.svelte-kit/__package__/tests/media/image.svelte.test.js +31 -31
  9. package/.turbo/turbo-build.log +60 -46
  10. package/CHANGELOG.md +41 -0
  11. package/dist/better-auth/auth/client.d.ts +29 -0
  12. package/dist/better-auth/auth/client.d.ts.map +1 -0
  13. package/dist/better-auth/auth/client.js +127 -0
  14. package/dist/better-auth/auth/client.js.map +1 -0
  15. package/dist/better-auth/auth/react.d.ts +2170 -0
  16. package/dist/better-auth/auth/react.d.ts.map +1 -0
  17. package/dist/better-auth/auth/react.js +40 -0
  18. package/dist/better-auth/auth/react.js.map +1 -0
  19. package/dist/better-auth/auth/server.d.ts +14 -0
  20. package/dist/better-auth/auth/server.d.ts.map +1 -0
  21. package/dist/better-auth/auth/server.js +198 -0
  22. package/dist/better-auth/auth/server.js.map +1 -0
  23. package/dist/better-auth/auth/tests/client.test.d.ts +2 -0
  24. package/dist/better-auth/auth/tests/client.test.d.ts.map +1 -0
  25. package/dist/better-auth/auth/tests/server.test.d.ts +2 -0
  26. package/dist/better-auth/auth/tests/server.test.d.ts.map +1 -0
  27. package/dist/browser/index.js +2 -2
  28. package/dist/browser/index.js.map +1 -1
  29. package/dist/{chunk-LZOF6WP5.js → chunk-IERUTUXB.js} +1336 -1017
  30. package/dist/chunk-IERUTUXB.js.map +1 -0
  31. package/dist/index.js +18 -18
  32. package/dist/index.js.map +1 -1
  33. package/dist/inspector/{custom-element-ZSNTCECD.js → custom-element-WCY6D3QJ.js} +3 -3
  34. package/dist/inspector/{custom-element-ZSNTCECD.js.map → custom-element-WCY6D3QJ.js.map} +1 -1
  35. package/dist/inspector/index.js +1 -1
  36. package/dist/inspector/index.js.map +1 -1
  37. package/dist/inspector/register-custom-element.js +1 -1
  38. package/dist/media/{chunk-E5J3WLQW.js → chunk-KR2V6X2N.js} +14 -9
  39. package/dist/media/chunk-KR2V6X2N.js.map +1 -0
  40. package/dist/media/create-image.d.ts +6 -6
  41. package/dist/media/index.browser.d.ts +6 -6
  42. package/dist/media/index.browser.js +1 -1
  43. package/dist/media/index.d.ts +1 -1
  44. package/dist/media/index.js +1 -1
  45. package/dist/media/index.native.d.ts +6 -6
  46. package/dist/media/index.native.js +1 -1
  47. package/dist/media/utils.d.ts.map +1 -1
  48. package/dist/prosemirror/index.js +2 -2
  49. package/dist/prosemirror/index.js.map +1 -1
  50. package/dist/react/index.js +7 -5
  51. package/dist/react/index.js.map +1 -1
  52. package/dist/react-core/hooks.d.ts.map +1 -1
  53. package/dist/react-core/index.js +4675 -23
  54. package/dist/react-core/index.js.map +1 -1
  55. package/dist/react-native-core/index.js +1 -1
  56. package/dist/react-native-core/index.js.map +1 -1
  57. package/dist/svelte/jazz.class.svelte.js +1 -1
  58. package/dist/svelte/media/image.svelte +3 -9
  59. package/dist/svelte/media/image.svelte.d.ts +1 -6
  60. package/dist/svelte/media/image.svelte.d.ts.map +1 -1
  61. package/dist/svelte/media/image.types.d.ts +7 -0
  62. package/dist/svelte/media/image.types.d.ts.map +1 -0
  63. package/dist/svelte/media/image.types.js +1 -0
  64. package/dist/svelte/tests/media/image.svelte.test.js +31 -31
  65. package/dist/testing.js +18 -14
  66. package/dist/testing.js.map +1 -1
  67. package/dist/tools/coValues/CoFieldInit.d.ts +13 -0
  68. package/dist/tools/coValues/CoFieldInit.d.ts.map +1 -0
  69. package/dist/tools/coValues/CoValueBase.d.ts +18 -15
  70. package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
  71. package/dist/tools/coValues/account.d.ts +101 -46
  72. package/dist/tools/coValues/account.d.ts.map +1 -1
  73. package/dist/tools/coValues/coFeed.d.ts +78 -62
  74. package/dist/tools/coValues/coFeed.d.ts.map +1 -1
  75. package/dist/tools/coValues/coList.d.ts +212 -99
  76. package/dist/tools/coValues/coList.d.ts.map +1 -1
  77. package/dist/tools/coValues/coMap.d.ts +210 -192
  78. package/dist/tools/coValues/coMap.d.ts.map +1 -1
  79. package/dist/tools/coValues/coPlainText.d.ts +30 -22
  80. package/dist/tools/coValues/coPlainText.d.ts.map +1 -1
  81. package/dist/tools/coValues/deepLoading.d.ts +13 -13
  82. package/dist/tools/coValues/deepLoading.d.ts.map +1 -1
  83. package/dist/tools/coValues/extensions/imageDef.d.ts +1 -1
  84. package/dist/tools/coValues/group.d.ts +32 -32
  85. package/dist/tools/coValues/group.d.ts.map +1 -1
  86. package/dist/tools/coValues/inbox.d.ts.map +1 -1
  87. package/dist/tools/coValues/interfaces.d.ts +18 -17
  88. package/dist/tools/coValues/interfaces.d.ts.map +1 -1
  89. package/dist/tools/coValues/profile.d.ts +6 -5
  90. package/dist/tools/coValues/profile.d.ts.map +1 -1
  91. package/dist/tools/coValues/schemaUnion.d.ts +3 -3
  92. package/dist/tools/coValues/schemaUnion.d.ts.map +1 -1
  93. package/dist/tools/exports.d.ts +1 -1
  94. package/dist/tools/exports.d.ts.map +1 -1
  95. package/dist/tools/implementation/anonymousJazzAgent.d.ts +2 -1
  96. package/dist/tools/implementation/anonymousJazzAgent.d.ts.map +1 -1
  97. package/dist/tools/implementation/schema.d.ts +5 -5
  98. package/dist/tools/implementation/schema.d.ts.map +1 -1
  99. package/dist/tools/implementation/symbols.d.ts +2 -0
  100. package/dist/tools/implementation/symbols.d.ts.map +1 -1
  101. package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts +2 -2
  102. package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
  103. package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts +6 -2
  104. package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts.map +1 -1
  105. package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +8 -3
  106. package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
  107. package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +12 -7
  108. package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
  109. package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts +13 -7
  110. package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts.map +1 -1
  111. package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts +11 -2
  112. package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts.map +1 -1
  113. package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts +4 -0
  114. package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts.map +1 -1
  115. package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts +4 -0
  116. package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts.map +1 -1
  117. package/dist/tools/implementation/zodSchema/typeConverters/{CoFieldInit.d.ts → CoFieldSchemaInit.d.ts} +7 -7
  118. package/dist/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.d.ts.map +1 -0
  119. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts +4 -4
  120. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts.map +1 -1
  121. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts +4 -4
  122. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts.map +1 -1
  123. package/dist/tools/implementation/zodSchema/zodCo.d.ts +3 -3
  124. package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
  125. package/dist/tools/internal.d.ts +2 -1
  126. package/dist/tools/internal.d.ts.map +1 -1
  127. package/dist/tools/lib/migration.d.ts +1 -1
  128. package/dist/tools/lib/migration.d.ts.map +1 -1
  129. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  130. package/dist/tools/subscribe/index.d.ts +1 -1
  131. package/dist/tools/subscribe/index.d.ts.map +1 -1
  132. package/dist/tools/subscribe/utils.d.ts +2 -2
  133. package/dist/tools/subscribe/utils.d.ts.map +1 -1
  134. package/dist/tools/testing.d.ts.map +1 -1
  135. package/dist/tools/tests/utils.d.ts +2 -6
  136. package/dist/tools/tests/utils.d.ts.map +1 -1
  137. package/dist/worker/index.js +3 -3
  138. package/dist/worker/index.js.map +1 -1
  139. package/package.json +23 -4
  140. package/src/better-auth/auth/client.ts +169 -0
  141. package/src/better-auth/auth/react.tsx +105 -0
  142. package/src/better-auth/auth/server.ts +250 -0
  143. package/src/better-auth/auth/tests/client.test.ts +249 -0
  144. package/src/better-auth/auth/tests/server.test.ts +226 -0
  145. package/src/browser/auth/PasskeyAuth.ts +2 -2
  146. package/src/browser/createBrowserContext.ts +2 -2
  147. package/src/browser/tests/PasskeyAuth.test.ts +2 -2
  148. package/src/inspector/custom-element.tsx +2 -2
  149. package/src/inspector/viewer/new-app.tsx +1 -1
  150. package/src/media/create-image.test.ts +7 -7
  151. package/src/media/create-image.ts +5 -3
  152. package/src/media/index.ts +1 -1
  153. package/src/media/utils.test.ts +72 -66
  154. package/src/media/utils.ts +9 -6
  155. package/src/prosemirror/lib/plugin.ts +1 -1
  156. package/src/prosemirror/lib/sync.ts +1 -1
  157. package/src/prosemirror/tests/plugin.test.ts +4 -4
  158. package/src/react/media/image.tsx +2 -2
  159. package/src/react/tests/media/image.test.tsx +52 -32
  160. package/src/react-core/hooks.ts +11 -5
  161. package/src/react-core/tests/useAccount.test.ts +16 -22
  162. package/src/react-core/tests/useCoState.test.ts +19 -19
  163. package/src/react-core/tests/useInboxSender.test.ts +5 -2
  164. package/src/react-core/tests/usePassPhraseAuth.test.ts +6 -6
  165. package/src/react-native-core/media/image.tsx +1 -1
  166. package/src/svelte/jazz.class.svelte.ts +1 -1
  167. package/src/svelte/media/image.svelte +3 -9
  168. package/src/svelte/media/image.types.ts +7 -0
  169. package/src/svelte/tests/media/image.svelte.test.ts +34 -32
  170. package/src/tools/auth/DemoAuth.ts +2 -2
  171. package/src/tools/auth/PassphraseAuth.ts +2 -2
  172. package/src/tools/auth/clerk/index.ts +2 -2
  173. package/src/tools/auth/clerk/tests/JazzClerkAuth.test.ts +1 -1
  174. package/src/tools/coValues/CoFieldInit.ts +20 -0
  175. package/src/tools/coValues/CoValueBase.ts +40 -60
  176. package/src/tools/coValues/account.ts +311 -232
  177. package/src/tools/coValues/coFeed.ts +185 -153
  178. package/src/tools/coValues/coList.ts +507 -334
  179. package/src/tools/coValues/coMap.ts +434 -286
  180. package/src/tools/coValues/coPlainText.ts +94 -110
  181. package/src/tools/coValues/deepLoading.ts +13 -13
  182. package/src/tools/coValues/group.ts +100 -114
  183. package/src/tools/coValues/inbox.ts +16 -14
  184. package/src/tools/coValues/interfaces.ts +49 -31
  185. package/src/tools/coValues/profile.ts +8 -6
  186. package/src/tools/coValues/request.ts +9 -9
  187. package/src/tools/coValues/schemaUnion.ts +11 -5
  188. package/src/tools/exports.ts +1 -1
  189. package/src/tools/implementation/ContextManager.ts +4 -4
  190. package/src/tools/implementation/anonymousJazzAgent.ts +2 -1
  191. package/src/tools/implementation/createContext.ts +1 -1
  192. package/src/tools/implementation/devtoolsFormatters.ts +9 -9
  193. package/src/tools/implementation/invites.ts +2 -2
  194. package/src/tools/implementation/schema.ts +7 -7
  195. package/src/tools/implementation/symbols.ts +3 -0
  196. package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +2 -2
  197. package/src/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.ts +11 -2
  198. package/src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts +18 -7
  199. package/src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts +17 -7
  200. package/src/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.ts +20 -11
  201. package/src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.ts +19 -2
  202. package/src/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.ts +6 -0
  203. package/src/tools/implementation/zodSchema/schemaTypes/RichTextSchema.ts +6 -0
  204. package/src/tools/implementation/zodSchema/typeConverters/{CoFieldInit.ts → CoFieldSchemaInit.ts} +11 -11
  205. package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.ts +4 -4
  206. package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.ts +4 -4
  207. package/src/tools/implementation/zodSchema/zodCo.ts +3 -3
  208. package/src/tools/internal.ts +2 -1
  209. package/src/tools/lib/migration.ts +5 -5
  210. package/src/tools/subscribe/SubscriptionScope.ts +32 -24
  211. package/src/tools/subscribe/index.ts +4 -4
  212. package/src/tools/subscribe/utils.ts +11 -11
  213. package/src/tools/testing.ts +17 -13
  214. package/src/tools/tests/ContextManager.test.ts +70 -59
  215. package/src/tools/tests/PassphraseAuth.test.ts +2 -2
  216. package/src/tools/tests/account.test.ts +188 -67
  217. package/src/tools/tests/coDiscriminatedUnion.test-d.ts +12 -6
  218. package/src/tools/tests/coDiscriminatedUnion.test.ts +26 -17
  219. package/src/tools/tests/coFeed.test-d.ts +18 -17
  220. package/src/tools/tests/coFeed.test.ts +108 -97
  221. package/src/tools/tests/coList.test-d.ts +18 -23
  222. package/src/tools/tests/coList.test.ts +350 -165
  223. package/src/tools/tests/coMap.record.test-d.ts +9 -13
  224. package/src/tools/tests/coMap.record.test.ts +37 -23
  225. package/src/tools/tests/coMap.test-d.ts +43 -21
  226. package/src/tools/tests/coMap.test.ts +459 -182
  227. package/src/tools/tests/coOptional.test.ts +28 -13
  228. package/src/tools/tests/coPlainText.test.ts +15 -15
  229. package/src/tools/tests/createContext.test.ts +14 -14
  230. package/src/tools/tests/deepLoading.test.ts +95 -94
  231. package/src/tools/tests/exportImport.test.ts +61 -41
  232. package/src/tools/tests/groupsAndAccounts.test.ts +333 -116
  233. package/src/tools/tests/inbox.test.ts +22 -17
  234. package/src/tools/tests/interfaces.test.ts +12 -11
  235. package/src/tools/tests/invites.test.ts +6 -4
  236. package/src/tools/tests/load.test.ts +20 -18
  237. package/src/tools/tests/patterns/notifications.test.ts +7 -7
  238. package/src/tools/tests/patterns/quest.test.ts +3 -3
  239. package/src/tools/tests/patterns/requestToJoin.test.ts +22 -22
  240. package/src/tools/tests/request.test.ts +38 -39
  241. package/src/tools/tests/schemaUnion.test.ts +64 -10
  242. package/src/tools/tests/subscribe.test.ts +64 -64
  243. package/src/tools/tests/testing.test.ts +7 -11
  244. package/src/tools/tests/utils.ts +3 -3
  245. package/src/tools/tests/zod.test.ts +3 -3
  246. package/src/worker/index.ts +3 -3
  247. package/tsup.config.ts +9 -0
  248. package/dist/chunk-LZOF6WP5.js.map +0 -1
  249. package/dist/media/chunk-E5J3WLQW.js.map +0 -1
  250. package/dist/tools/implementation/zodSchema/typeConverters/CoFieldInit.d.ts.map +0 -1
@@ -27,7 +27,7 @@ describe("Image", async () => {
27
27
  });
28
28
 
29
29
  it("should render an empty image if the image is not loaded yet", async () => {
30
- const original = FileStream.create({ owner: account._owner });
30
+ const original = FileStream.create({ owner: account });
31
31
  original.start({ mimeType: "image/jpeg" });
32
32
  // Don't end original, so it has no chunks
33
33
 
@@ -42,7 +42,7 @@ describe("Image", async () => {
42
42
  },
43
43
  );
44
44
 
45
- const { container } = render(<Image imageId={im.id} alt="test" />, {
45
+ const { container } = render(<Image imageId={im.$jazz.id} alt="test" />, {
46
46
  account,
47
47
  });
48
48
 
@@ -58,7 +58,7 @@ describe("Image", async () => {
58
58
  const placeholderDataUrl =
59
59
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=";
60
60
 
61
- const original = FileStream.create({ owner: account._owner });
61
+ const original = FileStream.create({ owner: account });
62
62
  original.start({ mimeType: "image/jpeg" });
63
63
  // Don't end original, so it has no chunks
64
64
 
@@ -74,7 +74,7 @@ describe("Image", async () => {
74
74
  },
75
75
  );
76
76
 
77
- const { container } = render(<Image imageId={im.id} alt="test" />, {
77
+ const { container } = render(<Image imageId={im.$jazz.id} alt="test" />, {
78
78
  account,
79
79
  });
80
80
 
@@ -104,7 +104,7 @@ describe("Image", async () => {
104
104
  },
105
105
  );
106
106
 
107
- render(<Image imageId={im.id} alt="test-loading" />, { account });
107
+ render(<Image imageId={im.$jazz.id} alt="test-loading" />, { account });
108
108
 
109
109
  await waitFor(() => {
110
110
  expect(
@@ -129,7 +129,7 @@ describe("Image", async () => {
129
129
  },
130
130
  );
131
131
 
132
- const { container } = render(<Image imageId={im.id} alt="test" />, {
132
+ const { container } = render(<Image imageId={im.$jazz.id} alt="test" />, {
133
133
  account,
134
134
  });
135
135
 
@@ -152,7 +152,12 @@ describe("Image", async () => {
152
152
  );
153
153
 
154
154
  const { container } = render(
155
- <Image imageId={im.id} alt="test" width="original" height="original" />,
155
+ <Image
156
+ imageId={im.$jazz.id}
157
+ alt="test"
158
+ width="original"
159
+ height="original"
160
+ />,
156
161
  {
157
162
  account,
158
163
  },
@@ -177,7 +182,12 @@ describe("Image", async () => {
177
182
  );
178
183
 
179
184
  const { container } = render(
180
- <Image imageId={im.id} alt="test" width="original" height={300} />,
185
+ <Image
186
+ imageId={im.$jazz.id}
187
+ alt="test"
188
+ width="original"
189
+ height={300}
190
+ />,
181
191
  {
182
192
  account,
183
193
  },
@@ -202,7 +212,7 @@ describe("Image", async () => {
202
212
  );
203
213
 
204
214
  const { container } = render(
205
- <Image imageId={im.id} alt="test" width={50} />,
215
+ <Image imageId={im.$jazz.id} alt="test" width={50} />,
206
216
  { account },
207
217
  );
208
218
 
@@ -225,7 +235,7 @@ describe("Image", async () => {
225
235
  );
226
236
 
227
237
  const { container } = render(
228
- <Image imageId={im.id} alt="test" height={50} />,
238
+ <Image imageId={im.$jazz.id} alt="test" height={50} />,
229
239
  { account },
230
240
  );
231
241
 
@@ -248,7 +258,7 @@ describe("Image", async () => {
248
258
  );
249
259
 
250
260
  const { container } = render(
251
- <Image imageId={im.id} alt="test" className="test-class" />,
261
+ <Image imageId={im.$jazz.id} alt="test" className="test-class" />,
252
262
  { account },
253
263
  );
254
264
 
@@ -282,11 +292,11 @@ describe("Image", async () => {
282
292
  },
283
293
  );
284
294
 
285
- im["500x500"] = original;
286
- im["256x256"] = await createDummyFileStream(256, account);
295
+ im.$jazz.set("500x500", original);
296
+ im.$jazz.set("256x256", await createDummyFileStream(256, account));
287
297
 
288
298
  const { container } = render(
289
- <Image imageId={im.id} alt="test-progressive" width={300} />,
299
+ <Image imageId={im.$jazz.id} alt="test-progressive" width={300} />,
290
300
  { account },
291
301
  );
292
302
 
@@ -322,11 +332,11 @@ describe("Image", async () => {
322
332
  },
323
333
  );
324
334
 
325
- im["1920x1080"] = original;
326
- im["256x256"] = await createDummyFileStream(256, account);
335
+ im.$jazz.set("1920x1080", original);
336
+ im.$jazz.set("256x256", await createDummyFileStream(256, account));
327
337
 
328
338
  const { container } = render(
329
- <Image imageId={im.id} alt="test-progressive" width={1024} />,
339
+ <Image imageId={im.$jazz.id} alt="test-progressive" width={1024} />,
330
340
  { account },
331
341
  );
332
342
 
@@ -339,7 +349,7 @@ describe("Image", async () => {
339
349
  expect(createObjectURLSpy).toHaveBeenCalledTimes(1);
340
350
 
341
351
  // Load higher resolution image
342
- im["1024x1024"] = await createDummyFileStream(1024, account);
352
+ im.$jazz.set("1024x1024", await createDummyFileStream(1024, account));
343
353
 
344
354
  await waitFor(() => {
345
355
  expect((container.querySelector("img") as HTMLImageElement).src).toBe(
@@ -375,12 +385,12 @@ describe("Image", async () => {
375
385
  },
376
386
  );
377
387
 
378
- im["100x100"] = original;
379
- im["256x256"] = await createDummyFileStream(256, account);
380
- im["1024x1024"] = await createDummyFileStream(1024, account);
388
+ im.$jazz.set("100x100", original);
389
+ im.$jazz.set("256x256", await createDummyFileStream(256, account));
390
+ im.$jazz.set("1024x1024", await createDummyFileStream(1024, account));
381
391
 
382
392
  const { container } = render(
383
- <Image imageId={im.id} alt="test-progressive" width={256} />,
393
+ <Image imageId={im.$jazz.id} alt="test-progressive" width={256} />,
384
394
  { account },
385
395
  );
386
396
 
@@ -415,11 +425,11 @@ describe("Image", async () => {
415
425
  },
416
426
  );
417
427
 
418
- im["100x100"] = original;
419
- im["256x256"] = await createDummyFileStream(256, account);
428
+ im.$jazz.set("100x100", original);
429
+ im.$jazz.set("256x256", await createDummyFileStream(256, account));
420
430
 
421
431
  const { container } = render(
422
- <Image imageId={im.id} alt="test-progressive" width={100} />,
432
+ <Image imageId={im.$jazz.id} alt="test-progressive" width={100} />,
423
433
  { account },
424
434
  );
425
435
 
@@ -453,11 +463,16 @@ describe("Image", async () => {
453
463
  owner: account,
454
464
  },
455
465
  );
456
- im["256x256"] = original;
457
- im["1024x1024"] = await createDummyFileStream(1024, account);
466
+ im.$jazz.set("256x256", original);
467
+ im.$jazz.set("1024x1024", await createDummyFileStream(1024, account));
458
468
 
459
469
  const { container, rerender } = render(
460
- <Image imageId={im.id} alt="test-dynamic" width={256} height={256} />,
470
+ <Image
471
+ imageId={im.$jazz.id}
472
+ alt="test-dynamic"
473
+ width={256}
474
+ height={256}
475
+ />,
461
476
  { account },
462
477
  );
463
478
 
@@ -470,7 +485,12 @@ describe("Image", async () => {
470
485
  expect(createObjectURLSpy).toHaveBeenCalledTimes(1);
471
486
 
472
487
  rerender(
473
- <Image imageId={im.id} alt="test-dynamic" width={1024} height={1024} />,
488
+ <Image
489
+ imageId={im.$jazz.id}
490
+ alt="test-dynamic"
491
+ width={1024}
492
+ height={1024}
493
+ />,
474
494
  );
475
495
 
476
496
  // After prop change, should load 1024x1024
@@ -499,7 +519,7 @@ describe("Image", async () => {
499
519
  const ref = { current: null as HTMLImageElement | null };
500
520
 
501
521
  const { container } = render(
502
- <Image imageId={im.id} alt="test" ref={ref} />,
522
+ <Image imageId={im.$jazz.id} alt="test" ref={ref} />,
503
523
  { account },
504
524
  );
505
525
 
@@ -523,7 +543,7 @@ describe("Image", async () => {
523
543
  );
524
544
 
525
545
  const { container } = render(
526
- <Image imageId={im.id} alt="test" loading="lazy" />,
546
+ <Image imageId={im.$jazz.id} alt="test" loading="lazy" />,
527
547
  { account },
528
548
  );
529
549
 
@@ -554,7 +574,7 @@ describe("Image", async () => {
554
574
  );
555
575
 
556
576
  const { container } = render(
557
- <Image imageId={im.id} alt="test" loading="lazy" />,
577
+ <Image imageId={im.$jazz.id} alt="test" loading="lazy" />,
558
578
  { account },
559
579
  );
560
580
 
@@ -24,6 +24,7 @@ import {
24
24
  } from "jazz-tools";
25
25
  import { JazzContext, JazzContextManagerContext } from "./provider.js";
26
26
  import { getCurrentAccountFromContextManager } from "./utils.js";
27
+ import { TypeSym } from "../tools/internal.js";
27
28
 
28
29
  export function useJazzContext<Acc extends Account>() {
29
30
  const value = useContext(JazzContext) as JazzContextType<Acc>;
@@ -274,7 +275,7 @@ function useAccountSubscription<
274
275
  const createSubscription = () => {
275
276
  const agent = getCurrentAccountFromContextManager(contextManager);
276
277
 
277
- if (agent._type === "Anonymous") {
278
+ if (agent[TypeSym] === "Anonymous") {
278
279
  return {
279
280
  subscription: null,
280
281
  contextManager,
@@ -286,10 +287,15 @@ function useAccountSubscription<
286
287
  const resolve: any = options?.resolve ?? true;
287
288
 
288
289
  const node = contextManager.getCurrentValue()!.node;
289
- const subscription = new SubscriptionScope<any>(node, resolve, agent.id, {
290
- ref: coValueClassFromCoValueClassOrSchema(Schema),
291
- optional: true,
292
- });
290
+ const subscription = new SubscriptionScope<any>(
291
+ node,
292
+ resolve,
293
+ agent.$jazz.id,
294
+ {
295
+ ref: coValueClassFromCoValueClassOrSchema(Schema),
296
+ optional: true,
297
+ },
298
+ );
293
299
 
294
300
  return {
295
301
  subscription,
@@ -37,11 +37,8 @@ describe("useAccount", () => {
37
37
  profile: co.profile(),
38
38
  })
39
39
  .withMigration((account, creationProps) => {
40
- if (!account._refs.root) {
41
- account.root = AccountRoot.create(
42
- { value: "123" },
43
- { owner: account },
44
- );
40
+ if (!account.$jazz.refs.root) {
41
+ account.$jazz.set("root", { value: "123" });
45
42
  }
46
43
  });
47
44
 
@@ -79,13 +76,13 @@ describe("useAccount", () => {
79
76
  const account = useAccount();
80
77
 
81
78
  if (account.me) {
82
- if (!accounts.includes(account.me.id)) {
83
- accounts.push(account.me.id);
79
+ if (!accounts.includes(account.me.$jazz.id)) {
80
+ accounts.push(account.me.$jazz.id);
84
81
  }
85
82
 
86
83
  updates.push({
87
84
  isAuthenticated,
88
- accountIndex: accounts.indexOf(account.me.id),
85
+ accountIndex: accounts.indexOf(account.me.$jazz.id),
89
86
  });
90
87
  }
91
88
 
@@ -100,14 +97,14 @@ describe("useAccount", () => {
100
97
  expect(result.current?.isAuthenticated).toBe(true);
101
98
  expect(result.current?.account?.me).toBeDefined();
102
99
 
103
- const id = result.current?.account?.me?.id;
100
+ const id = result.current?.account?.me?.$jazz.id;
104
101
 
105
102
  await act(async () => {
106
103
  await result.current?.account?.logOut();
107
104
  });
108
105
 
109
106
  expect(result.current?.isAuthenticated).toBe(false);
110
- expect(result.current?.account?.me?.id).not.toBe(id);
107
+ expect(result.current?.account?.me?.$jazz.id).not.toBe(id);
111
108
 
112
109
  expect(updates).toMatchInlineSnapshot(`
113
110
  [
@@ -141,13 +138,13 @@ describe("useAccount", () => {
141
138
  const contextManager = useJazzContextManager();
142
139
 
143
140
  if (account.me) {
144
- if (!accounts.includes(account.me.id)) {
145
- accounts.push(account.me.id);
141
+ if (!accounts.includes(account.me.$jazz.id)) {
142
+ accounts.push(account.me.$jazz.id);
146
143
  }
147
144
 
148
145
  updates.push({
149
146
  isAuthenticated,
150
- accountIndex: accounts.indexOf(account.me.id),
147
+ accountIndex: accounts.indexOf(account.me.$jazz.id),
151
148
  });
152
149
  }
153
150
 
@@ -162,18 +159,18 @@ describe("useAccount", () => {
162
159
  expect(result.current?.isAuthenticated).toBe(false);
163
160
  expect(result.current?.account?.me).toBeDefined();
164
161
 
165
- const id = result.current?.account?.me?.id;
162
+ const id = result.current?.account?.me?.$jazz.id;
166
163
 
167
164
  await act(async () => {
168
165
  await result.current?.contextManager?.authenticate({
169
- accountID: accountToAuthenticate.id,
166
+ accountID: accountToAuthenticate.$jazz.id,
170
167
  accountSecret:
171
- accountToAuthenticate._raw.core.node.getCurrentAgent().agentSecret,
168
+ accountToAuthenticate.$jazz.localNode.getCurrentAgent().agentSecret,
172
169
  });
173
170
  });
174
171
 
175
172
  expect(result.current?.isAuthenticated).toBe(true);
176
- expect(result.current?.account?.me?.id).not.toBe(id);
173
+ expect(result.current?.account?.me?.$jazz.id).not.toBe(id);
177
174
 
178
175
  expect(updates).toMatchInlineSnapshot(`
179
176
  [
@@ -200,11 +197,8 @@ describe("useAccount", () => {
200
197
  profile: co.profile(),
201
198
  })
202
199
  .withMigration((account, creationProps) => {
203
- if (!account._refs.root) {
204
- account.root = AccountRoot.create(
205
- { value: "123" },
206
- { owner: account },
207
- );
200
+ if (!account.$jazz.refs.root) {
201
+ account.$jazz.set("root", { value: "123" });
208
202
  }
209
203
  });
210
204
 
@@ -40,7 +40,7 @@ describe("useCoState", () => {
40
40
  value: "123",
41
41
  });
42
42
 
43
- const { result } = renderHook(() => useCoState(TestMap, map.id, {}), {
43
+ const { result } = renderHook(() => useCoState(TestMap, map.$jazz.id, {}), {
44
44
  account,
45
45
  });
46
46
 
@@ -80,14 +80,14 @@ describe("useCoState", () => {
80
80
  value: "123",
81
81
  });
82
82
 
83
- const { result } = renderHook(() => useCoState(TestMap, map.id, {}), {
83
+ const { result } = renderHook(() => useCoState(TestMap, map.$jazz.id, {}), {
84
84
  account,
85
85
  });
86
86
 
87
87
  expect(result.current?.value).toBe("123");
88
88
 
89
89
  act(() => {
90
- map.value = "456";
90
+ map.$jazz.set("value", "456");
91
91
  });
92
92
 
93
93
  expect(result.current?.value).toBe("456");
@@ -116,7 +116,7 @@ describe("useCoState", () => {
116
116
 
117
117
  const { result } = renderHook(
118
118
  () =>
119
- useCoState(TestMap, map.id, {
119
+ useCoState(TestMap, map.$jazz.id, {
120
120
  resolve: {
121
121
  nested: true,
122
122
  },
@@ -151,7 +151,7 @@ describe("useCoState", () => {
151
151
  }),
152
152
  });
153
153
 
154
- const { result } = renderHook(() => useCoState(TestMap, map.id, {}), {
154
+ const { result } = renderHook(() => useCoState(TestMap, map.$jazz.id, {}), {
155
155
  account,
156
156
  });
157
157
 
@@ -172,11 +172,11 @@ describe("useCoState", () => {
172
172
  isCurrentActiveAccount: true,
173
173
  });
174
174
 
175
- for (const peer of account._raw.core.node.syncManager.getClientPeers()) {
175
+ for (const peer of account.$jazz.localNode.syncManager.getClientPeers()) {
176
176
  peer.gracefulShutdown();
177
177
  }
178
178
 
179
- const { result } = renderHook(() => useCoState(TestMap, map.id), {
179
+ const { result } = renderHook(() => useCoState(TestMap, map.$jazz.id), {
180
180
  account,
181
181
  });
182
182
 
@@ -205,7 +205,7 @@ describe("useCoState", () => {
205
205
  isCurrentActiveAccount: true,
206
206
  });
207
207
 
208
- const { result } = renderHook(() => useCoState(TestMap, map.id), {
208
+ const { result } = renderHook(() => useCoState(TestMap, map.$jazz.id), {
209
209
  account,
210
210
  });
211
211
 
@@ -237,7 +237,7 @@ describe("useCoState", () => {
237
237
  isCurrentActiveAccount: true,
238
238
  });
239
239
 
240
- const { result } = renderHook(() => useCoState(TestMap, map.id), {
240
+ const { result } = renderHook(() => useCoState(TestMap, map.$jazz.id), {
241
241
  account,
242
242
  });
243
243
 
@@ -268,7 +268,7 @@ describe("useCoState", () => {
268
268
  isCurrentActiveAccount: true,
269
269
  });
270
270
 
271
- const { result } = renderHook(() => useCoState(TestMap, map.id), {
271
+ const { result } = renderHook(() => useCoState(TestMap, map.$jazz.id), {
272
272
  account,
273
273
  });
274
274
 
@@ -307,11 +307,11 @@ describe("useCoState", () => {
307
307
  isCurrentActiveAccount: true,
308
308
  });
309
309
 
310
- await account.waitForAllCoValuesSync();
310
+ await account.$jazz.waitForAllCoValuesSync();
311
311
 
312
312
  group.addMember(account, "reader");
313
313
 
314
- const { result } = renderHook(() => useCoState(TestMap, map.id), {
314
+ const { result } = renderHook(() => useCoState(TestMap, map.$jazz.id), {
315
315
  account,
316
316
  });
317
317
 
@@ -371,7 +371,7 @@ describe("useCoState", () => {
371
371
 
372
372
  const { result } = renderHook(
373
373
  () =>
374
- useCoState(TestMap, map.id, {
374
+ useCoState(TestMap, map.$jazz.id, {
375
375
  resolve: {
376
376
  nested: true,
377
377
  },
@@ -403,7 +403,7 @@ describe("useCoState", () => {
403
403
  });
404
404
 
405
405
  const { result } = renderHook(() =>
406
- useCoState(TestMap, map.id as ID<CoValue>),
406
+ useCoState(TestMap, map.$jazz.id as ID<CoValue>),
407
407
  );
408
408
  expectTypeOf(result).toEqualTypeOf<{
409
409
  current: Loaded<typeof TestMap> | null | undefined;
@@ -422,7 +422,7 @@ describe("useCoState", () => {
422
422
  const { result, rerender } = renderHook(
423
423
  (props) => useCoState(TestMap, props.id),
424
424
  {
425
- initialProps: { id: map.id } as { id: ID<CoValue> | undefined },
425
+ initialProps: { id: map.$jazz.id } as { id: ID<CoValue> | undefined },
426
426
  },
427
427
  );
428
428
 
@@ -457,7 +457,7 @@ describe("useCoState", () => {
457
457
  renderHook(
458
458
  () => {
459
459
  renderCount++;
460
- useCoState(TestList, list.id, { resolve: { $each: true } });
460
+ useCoState(TestList, list.$jazz.id, { resolve: { $each: true } });
461
461
  },
462
462
  {
463
463
  account,
@@ -487,7 +487,7 @@ describe("useCoState", () => {
487
487
  },
488
488
  });
489
489
 
490
- const janeOnJohn = await Account.load(jane.id, {
490
+ const janeOnJohn = await Account.load(jane.$jazz.id, {
491
491
  loadAs: john,
492
492
  });
493
493
 
@@ -504,7 +504,7 @@ describe("useCoState", () => {
504
504
  );
505
505
 
506
506
  const { result } = renderHook(
507
- () => useCoState(Dog, dog.id)?._owner.castAs(Group).members,
507
+ () => useCoState(Dog, dog.$jazz.id)?.$jazz.owner.members,
508
508
  {
509
509
  account: john,
510
510
  },
@@ -542,7 +542,7 @@ describe("useCoState", () => {
542
542
  const renderings: boolean[] = [];
543
543
 
544
544
  renderHook(() => {
545
- const data = useCoState(Thread, thread.id, {
545
+ const data = useCoState(Thread, thread.$jazz.id, {
546
546
  resolve: {
547
547
  messages: {
548
548
  $each: {
@@ -22,7 +22,7 @@ describe("useInboxSender", () => {
22
22
  experimental_useInboxSender<
23
23
  Loaded<typeof TestMap>,
24
24
  Loaded<typeof TestMap>
25
- >(inboxReceiver.id),
25
+ >(inboxReceiver.$jazz.id),
26
26
  {
27
27
  account,
28
28
  },
@@ -43,7 +43,10 @@ describe("useInboxSender", () => {
43
43
  inbox.subscribe(TestMap, async (message) => {
44
44
  resolve(message);
45
45
 
46
- return TestMap.create({ value: "got it" }, { owner: message._owner });
46
+ return TestMap.create(
47
+ { value: "got it" },
48
+ { owner: message.$jazz.owner },
49
+ );
47
50
  });
48
51
  });
49
52
 
@@ -119,13 +119,13 @@ describe("usePassphraseAuth", () => {
119
119
  const account = useAccount();
120
120
 
121
121
  if (account.me) {
122
- if (!accounts.includes(account.me.id)) {
123
- accounts.push(account.me.id);
122
+ if (!accounts.includes(account.me.$jazz.id)) {
123
+ accounts.push(account.me.$jazz.id);
124
124
  }
125
125
 
126
126
  updates.push({
127
127
  state: passphraseAuth.state,
128
- accountIndex: accounts.indexOf(account.me.id),
128
+ accountIndex: accounts.indexOf(account.me.$jazz.id),
129
129
  });
130
130
  }
131
131
 
@@ -140,21 +140,21 @@ describe("usePassphraseAuth", () => {
140
140
  expect(result.current?.passphraseAuth.state).toBe("anonymous");
141
141
  expect(result.current?.account?.me).toBeDefined();
142
142
 
143
- const id = result.current?.account?.me?.id;
143
+ const id = result.current?.account?.me?.$jazz.id;
144
144
 
145
145
  await act(async () => {
146
146
  await result.current?.passphraseAuth.signUp();
147
147
  });
148
148
 
149
149
  expect(result.current?.passphraseAuth.state).toBe("signedIn");
150
- expect(result.current?.account?.me?.id).toBe(id);
150
+ expect(result.current?.account?.me?.$jazz.id).toBe(id);
151
151
 
152
152
  await act(async () => {
153
153
  await result.current?.account?.logOut();
154
154
  });
155
155
 
156
156
  expect(result.current?.passphraseAuth.state).toBe("anonymous");
157
- expect(result.current?.account?.me?.id).not.toBe(id);
157
+ expect(result.current?.account?.me?.$jazz.id).not.toBe(id);
158
158
 
159
159
  expect(updates).toMatchInlineSnapshot(`
160
160
  [
@@ -116,7 +116,7 @@ export const Image = forwardRef<RNImage, ImageProps>(function Image(
116
116
  let lastBestImage: FileStream | string | undefined =
117
117
  image.placeholderDataURL;
118
118
 
119
- const unsub = image.subscribe({}, (update) => {
119
+ const unsub = image.$jazz.subscribe({}, (update) => {
120
120
  if (lastBestImage === undefined && update.placeholderDataURL) {
121
121
  setSrc(update.placeholderDataURL);
122
122
  lastBestImage = update.placeholderDataURL;
@@ -116,7 +116,7 @@ export class AccountCoState<
116
116
 
117
117
  const unsubscribe = subscribeToCoValue(
118
118
  coValueClassFromCoValueClassOrSchema(Schema),
119
- me.id,
119
+ me.$jazz.id,
120
120
  {
121
121
  // @ts-expect-error The resolve query type isn't compatible with the coValueClassFromCoValueClassOrSchema conversion
122
122
  resolve: options?.resolve,
@@ -2,14 +2,8 @@
2
2
  import { ImageDefinition } from "jazz-tools";
3
3
  import { highestResAvailable } from "jazz-tools/media";
4
4
  import { onDestroy } from "svelte";
5
- import type { HTMLImgAttributes } from "svelte/elements";
6
5
  import { CoState } from "../jazz.class.svelte";
7
-
8
- interface ImageProps extends Omit<HTMLImgAttributes, "width" | "height"> {
9
- imageId: string;
10
- width?: number | "original";
11
- height?: number | "original";
12
- }
6
+ import type { ImageProps } from "./image.types.js";
13
7
 
14
8
  const { imageId, width, height, ...rest }: ImageProps = $props();
15
9
 
@@ -83,14 +77,14 @@ const src = $derived.by(() => {
83
77
  );
84
78
 
85
79
  if (!bestImage) return image.placeholderDataURL;
86
- if (lastBestImage?.[0] === bestImage.image.id) return lastBestImage?.[1];
80
+ if (lastBestImage?.[0] === bestImage.image.$jazz.id) return lastBestImage?.[1];
87
81
 
88
82
  const blob = bestImage.image.toBlob();
89
83
 
90
84
  if (blob) {
91
85
  const url = URL.createObjectURL(blob);
92
86
  revokeObjectURL(lastBestImage?.[1]);
93
- lastBestImage = [bestImage.image.id, url];
87
+ lastBestImage = [bestImage.image.$jazz.id, url];
94
88
  return url;
95
89
  }
96
90
 
@@ -0,0 +1,7 @@
1
+ import type { HTMLImgAttributes } from "svelte/elements";
2
+
3
+ export interface ImageProps extends Omit<HTMLImgAttributes, "width" | "height"> {
4
+ imageId: string;
5
+ width?: number | "original";
6
+ height?: number | "original";
7
+ }