jazz-tools 0.18.38 → 0.19.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 (304) hide show
  1. package/.svelte-kit/__package__/jazz.class.svelte.d.ts +8 -8
  2. package/.svelte-kit/__package__/jazz.class.svelte.d.ts.map +1 -1
  3. package/.svelte-kit/__package__/jazz.class.svelte.js +39 -14
  4. package/.svelte-kit/__package__/media/image.svelte +6 -5
  5. package/.svelte-kit/__package__/media/image.svelte.d.ts.map +1 -1
  6. package/.svelte-kit/__package__/tests/AccountCoState.svelte.test-d.d.ts +2 -0
  7. package/.svelte-kit/__package__/tests/AccountCoState.svelte.test-d.d.ts.map +1 -0
  8. package/.svelte-kit/__package__/tests/AccountCoState.svelte.test-d.js +19 -0
  9. package/.svelte-kit/__package__/tests/CoState.svelte.test-d.d.ts +2 -0
  10. package/.svelte-kit/__package__/tests/CoState.svelte.test-d.d.ts.map +1 -0
  11. package/.svelte-kit/__package__/tests/CoState.svelte.test-d.js +16 -0
  12. package/.svelte-kit/__package__/tests/CoState.svelte.test.d.ts +2 -0
  13. package/.svelte-kit/__package__/tests/CoState.svelte.test.d.ts.map +1 -0
  14. package/.svelte-kit/__package__/tests/CoState.svelte.test.js +42 -0
  15. package/.svelte-kit/__package__/tests/TestCoStateWrapper.svelte +23 -0
  16. package/.svelte-kit/__package__/tests/TestCoStateWrapper.svelte.d.ts +12 -0
  17. package/.svelte-kit/__package__/tests/TestCoStateWrapper.svelte.d.ts.map +1 -0
  18. package/.turbo/turbo-build.log +62 -62
  19. package/CHANGELOG.md +32 -0
  20. package/dist/better-auth/database-adapter/index.js +14 -11
  21. package/dist/better-auth/database-adapter/index.js.map +1 -1
  22. package/dist/better-auth/database-adapter/repository/generic.d.ts +1 -1
  23. package/dist/better-auth/database-adapter/repository/generic.d.ts.map +1 -1
  24. package/dist/better-auth/database-adapter/repository/user.d.ts.map +1 -1
  25. package/dist/{chunk-OSQ7S47Q.js → chunk-NCNM6UDZ.js} +563 -252
  26. package/dist/chunk-NCNM6UDZ.js.map +1 -0
  27. package/dist/index.js +14 -6
  28. package/dist/index.js.map +1 -1
  29. package/dist/media/{chunk-K6GCHLQU.js → chunk-3LKBM3G3.js} +23 -15
  30. package/dist/media/chunk-3LKBM3G3.js.map +1 -0
  31. package/dist/media/create-image/browser.d.ts +2 -2
  32. package/dist/media/create-image/react-native.d.ts +2 -2
  33. package/dist/media/create-image/server.d.ts +2 -2
  34. package/dist/media/create-image-factory.d.ts +2 -2
  35. package/dist/media/index.browser.js +1 -1
  36. package/dist/media/index.js +1 -1
  37. package/dist/media/index.native.js +1 -1
  38. package/dist/media/index.server.js +1 -1
  39. package/dist/media/utils.d.ts.map +1 -1
  40. package/dist/react/hooks.d.ts +1 -1
  41. package/dist/react/hooks.d.ts.map +1 -1
  42. package/dist/react/index.d.ts +1 -1
  43. package/dist/react/index.d.ts.map +1 -1
  44. package/dist/react/index.js +31 -15
  45. package/dist/react/index.js.map +1 -1
  46. package/dist/react/media/image.d.ts.map +1 -1
  47. package/dist/react-core/hooks.d.ts +126 -224
  48. package/dist/react-core/hooks.d.ts.map +1 -1
  49. package/dist/react-core/index.js +65 -63
  50. package/dist/react-core/index.js.map +1 -1
  51. package/dist/react-core/subscription-provider.d.ts.map +1 -1
  52. package/dist/react-core/tests/createCoValueSubscriptionContext.test.d.ts +2 -0
  53. package/dist/react-core/tests/createCoValueSubscriptionContext.test.d.ts.map +1 -0
  54. package/dist/react-core/tests/useAccount.selector.test.d.ts +2 -0
  55. package/dist/react-core/tests/useAccount.selector.test.d.ts.map +1 -0
  56. package/dist/react-core/tests/useCoState.selector.test.d.ts +2 -0
  57. package/dist/react-core/tests/useCoState.selector.test.d.ts.map +1 -0
  58. package/dist/react-native-core/hooks.d.ts +1 -1
  59. package/dist/react-native-core/hooks.d.ts.map +1 -1
  60. package/dist/react-native-core/index.js +7 -5
  61. package/dist/react-native-core/index.js.map +1 -1
  62. package/dist/react-native-core/media/image.d.ts.map +1 -1
  63. package/dist/svelte/jazz.class.svelte.d.ts +8 -8
  64. package/dist/svelte/jazz.class.svelte.d.ts.map +1 -1
  65. package/dist/svelte/jazz.class.svelte.js +39 -14
  66. package/dist/svelte/media/image.svelte +6 -5
  67. package/dist/svelte/media/image.svelte.d.ts.map +1 -1
  68. package/dist/svelte/tests/AccountCoState.svelte.test-d.d.ts +2 -0
  69. package/dist/svelte/tests/AccountCoState.svelte.test-d.d.ts.map +1 -0
  70. package/dist/svelte/tests/AccountCoState.svelte.test-d.js +19 -0
  71. package/dist/svelte/tests/CoState.svelte.test-d.d.ts +2 -0
  72. package/dist/svelte/tests/CoState.svelte.test-d.d.ts.map +1 -0
  73. package/dist/svelte/tests/CoState.svelte.test-d.js +16 -0
  74. package/dist/svelte/tests/CoState.svelte.test.d.ts +2 -0
  75. package/dist/svelte/tests/CoState.svelte.test.d.ts.map +1 -0
  76. package/dist/svelte/tests/CoState.svelte.test.js +42 -0
  77. package/dist/svelte/tests/TestCoStateWrapper.svelte +23 -0
  78. package/dist/svelte/tests/TestCoStateWrapper.svelte.d.ts +12 -0
  79. package/dist/svelte/tests/TestCoStateWrapper.svelte.d.ts.map +1 -0
  80. package/dist/testing.js +3 -1
  81. package/dist/testing.js.map +1 -1
  82. package/dist/tools/coValues/CoValueBase.d.ts +4 -1
  83. package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
  84. package/dist/tools/coValues/account.d.ts +6 -6
  85. package/dist/tools/coValues/account.d.ts.map +1 -1
  86. package/dist/tools/coValues/coFeed.d.ts +5 -5
  87. package/dist/tools/coValues/coFeed.d.ts.map +1 -1
  88. package/dist/tools/coValues/coList.d.ts +9 -8
  89. package/dist/tools/coValues/coList.d.ts.map +1 -1
  90. package/dist/tools/coValues/coMap.d.ts +17 -17
  91. package/dist/tools/coValues/coMap.d.ts.map +1 -1
  92. package/dist/tools/coValues/coPlainText.d.ts +3 -3
  93. package/dist/tools/coValues/coPlainText.d.ts.map +1 -1
  94. package/dist/tools/coValues/coVector.d.ts +3 -3
  95. package/dist/tools/coValues/coVector.d.ts.map +1 -1
  96. package/dist/tools/coValues/deepLoading.d.ts +71 -40
  97. package/dist/tools/coValues/deepLoading.d.ts.map +1 -1
  98. package/dist/tools/coValues/extensions/imageDef.d.ts +1 -1
  99. package/dist/tools/coValues/extensions/imageDef.d.ts.map +1 -1
  100. package/dist/tools/coValues/group.d.ts +2 -2
  101. package/dist/tools/coValues/group.d.ts.map +1 -1
  102. package/dist/tools/coValues/inbox.d.ts.map +1 -1
  103. package/dist/tools/coValues/interfaces.d.ts +17 -9
  104. package/dist/tools/coValues/interfaces.d.ts.map +1 -1
  105. package/dist/tools/coValues/request.d.ts.map +1 -1
  106. package/dist/tools/coValues/schemaUnion.d.ts +6 -9
  107. package/dist/tools/coValues/schemaUnion.d.ts.map +1 -1
  108. package/dist/tools/exports.d.ts +3 -3
  109. package/dist/tools/exports.d.ts.map +1 -1
  110. package/dist/tools/implementation/refs.d.ts +3 -3
  111. package/dist/tools/implementation/refs.d.ts.map +1 -1
  112. package/dist/tools/implementation/schema.d.ts +2 -2
  113. package/dist/tools/implementation/schema.d.ts.map +1 -1
  114. package/dist/tools/implementation/schemaUtils.d.ts +8 -0
  115. package/dist/tools/implementation/schemaUtils.d.ts.map +1 -1
  116. package/dist/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.d.ts.map +1 -1
  117. package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts +33 -18
  118. package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
  119. package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.d.ts +19 -7
  120. package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.d.ts.map +1 -1
  121. package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts +23 -12
  122. package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts.map +1 -1
  123. package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +29 -18
  124. package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
  125. package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +39 -22
  126. package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
  127. package/dist/tools/implementation/zodSchema/schemaTypes/CoOptionalSchema.d.ts +1 -0
  128. package/dist/tools/implementation/zodSchema/schemaTypes/CoOptionalSchema.d.ts.map +1 -1
  129. package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts +30 -19
  130. package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts.map +1 -1
  131. package/dist/tools/implementation/zodSchema/schemaTypes/CoValueSchema.d.ts +5 -0
  132. package/dist/tools/implementation/zodSchema/schemaTypes/CoValueSchema.d.ts.map +1 -1
  133. package/dist/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.d.ts +6 -5
  134. package/dist/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.d.ts.map +1 -1
  135. package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts +3 -2
  136. package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts.map +1 -1
  137. package/dist/tools/implementation/zodSchema/schemaTypes/GroupSchema.d.ts +3 -2
  138. package/dist/tools/implementation/zodSchema/schemaTypes/GroupSchema.d.ts.map +1 -1
  139. package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts +3 -2
  140. package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts.map +1 -1
  141. package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts +3 -2
  142. package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts.map +1 -1
  143. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts +3 -0
  144. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts.map +1 -1
  145. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesMaybeLoaded.d.ts +22 -0
  146. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesMaybeLoaded.d.ts.map +1 -0
  147. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts +4 -0
  148. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts.map +1 -1
  149. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesMaybeLoaded.d.ts +9 -0
  150. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesMaybeLoaded.d.ts.map +1 -0
  151. package/dist/tools/implementation/zodSchema/unionUtils.d.ts.map +1 -1
  152. package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
  153. package/dist/tools/implementation/zodSchema/zodSchema.d.ts +7 -6
  154. package/dist/tools/implementation/zodSchema/zodSchema.d.ts.map +1 -1
  155. package/dist/tools/internal.d.ts +3 -3
  156. package/dist/tools/internal.d.ts.map +1 -1
  157. package/dist/tools/lib/utils.d.ts +14 -0
  158. package/dist/tools/lib/utils.d.ts.map +1 -0
  159. package/dist/tools/lib/utils.test.d.ts +2 -0
  160. package/dist/tools/lib/utils.test.d.ts.map +1 -0
  161. package/dist/tools/subscribe/CoValueCoreSubscription.d.ts +3 -2
  162. package/dist/tools/subscribe/CoValueCoreSubscription.d.ts.map +1 -1
  163. package/dist/tools/subscribe/JazzError.d.ts +4 -3
  164. package/dist/tools/subscribe/JazzError.d.ts.map +1 -1
  165. package/dist/tools/subscribe/SubscriptionScope.d.ts +7 -5
  166. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  167. package/dist/tools/subscribe/index.d.ts.map +1 -1
  168. package/dist/tools/subscribe/types.d.ts +23 -3
  169. package/dist/tools/subscribe/types.d.ts.map +1 -1
  170. package/dist/tools/subscribe/utils.d.ts.map +1 -1
  171. package/dist/tools/testing.d.ts +3 -2
  172. package/dist/tools/testing.d.ts.map +1 -1
  173. package/dist/tools/tests/schema.resolved.test.d.ts +2 -0
  174. package/dist/tools/tests/schema.resolved.test.d.ts.map +1 -0
  175. package/dist/tools/tests/utils.d.ts +2 -1
  176. package/dist/tools/tests/utils.d.ts.map +1 -1
  177. package/package.json +4 -4
  178. package/src/better-auth/database-adapter/index.ts +2 -2
  179. package/src/better-auth/database-adapter/repository/account.ts +3 -3
  180. package/src/better-auth/database-adapter/repository/generic.ts +9 -6
  181. package/src/better-auth/database-adapter/repository/user.ts +6 -2
  182. package/src/better-auth/database-adapter/schema.ts +1 -1
  183. package/src/better-auth/database-adapter/tests/index.test.ts +3 -4
  184. package/src/inspector/tests/viewer/history-view.test.tsx +6 -2
  185. package/src/media/utils.test.ts +5 -0
  186. package/src/media/utils.ts +25 -16
  187. package/src/react/hooks.tsx +2 -2
  188. package/src/react/index.ts +2 -2
  189. package/src/react/media/image.tsx +10 -2
  190. package/src/react/tests/useAcceptInvite.test.ts +3 -1
  191. package/src/react-core/hooks.ts +226 -304
  192. package/src/react-core/subscription-provider.tsx +14 -7
  193. package/src/react-core/tests/createCoValueSubscriptionContext.test.tsx +233 -0
  194. package/src/react-core/tests/subscription.bench.tsx +32 -15
  195. package/src/react-core/tests/{useAccountWithSelector.test.ts → useAccount.selector.test.ts} +72 -24
  196. package/src/react-core/tests/useAccount.test.ts +92 -106
  197. package/src/react-core/tests/{useCoStateWithSelector.test.ts → useCoState.selector.test.ts} +23 -8
  198. package/src/react-core/tests/useCoState.test.ts +173 -49
  199. package/src/react-core/tests/useInboxSender.test.ts +3 -1
  200. package/src/react-core/tests/usePassPhraseAuth.test.ts +11 -82
  201. package/src/react-core/tests/useSubscriptionSelector.test.ts +48 -14
  202. package/src/react-native-core/hooks.tsx +2 -2
  203. package/src/react-native-core/media/image.tsx +3 -1
  204. package/src/svelte/jazz.class.svelte.ts +103 -27
  205. package/src/svelte/media/image.svelte +6 -5
  206. package/src/svelte/tests/AccountCoState.svelte.test-d.ts +23 -0
  207. package/src/svelte/tests/CoState.svelte.test-d.ts +20 -0
  208. package/src/svelte/tests/CoState.svelte.test.ts +57 -0
  209. package/src/svelte/tests/TestCoStateWrapper.svelte +23 -0
  210. package/src/tools/coValues/CoValueBase.ts +12 -0
  211. package/src/tools/coValues/account.ts +17 -12
  212. package/src/tools/coValues/coFeed.ts +38 -15
  213. package/src/tools/coValues/coList.ts +17 -12
  214. package/src/tools/coValues/coMap.ts +15 -14
  215. package/src/tools/coValues/coPlainText.ts +6 -3
  216. package/src/tools/coValues/coVector.ts +6 -5
  217. package/src/tools/coValues/deepLoading.ts +147 -86
  218. package/src/tools/coValues/group.ts +3 -2
  219. package/src/tools/coValues/inbox.ts +11 -10
  220. package/src/tools/coValues/interfaces.ts +52 -30
  221. package/src/tools/coValues/request.ts +8 -6
  222. package/src/tools/coValues/schemaUnion.ts +20 -14
  223. package/src/tools/exports.ts +11 -1
  224. package/src/tools/implementation/refs.ts +19 -13
  225. package/src/tools/implementation/schema.ts +5 -4
  226. package/src/tools/implementation/schemaUtils.ts +15 -0
  227. package/src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts +4 -4
  228. package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +131 -95
  229. package/src/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.ts +86 -16
  230. package/src/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.ts +73 -22
  231. package/src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts +86 -28
  232. package/src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts +204 -148
  233. package/src/tools/implementation/zodSchema/schemaTypes/CoOptionalSchema.ts +1 -0
  234. package/src/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.ts +71 -27
  235. package/src/tools/implementation/zodSchema/schemaTypes/CoValueSchema.ts +7 -0
  236. package/src/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.ts +8 -6
  237. package/src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.ts +4 -1
  238. package/src/tools/implementation/zodSchema/schemaTypes/GroupSchema.ts +4 -1
  239. package/src/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.ts +4 -1
  240. package/src/tools/implementation/zodSchema/schemaTypes/RichTextSchema.ts +4 -1
  241. package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.ts +3 -0
  242. package/src/tools/implementation/zodSchema/typeConverters/{InstanceOfSchemaCoValuesNullable.ts → InstanceOfSchemaCoValuesMaybeLoaded.ts} +47 -39
  243. package/src/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.ts +4 -0
  244. package/src/tools/implementation/zodSchema/typeConverters/{InstanceOrPrimitiveOfSchemaCoValuesNullable.ts → InstanceOrPrimitiveOfSchemaCoValuesMaybeLoaded.ts} +7 -3
  245. package/src/tools/implementation/zodSchema/unionUtils.ts +35 -4
  246. package/src/tools/implementation/zodSchema/zodSchema.ts +15 -7
  247. package/src/tools/internal.ts +3 -3
  248. package/src/tools/lib/utils.test.ts +56 -0
  249. package/src/tools/lib/utils.ts +32 -0
  250. package/src/tools/subscribe/CoValueCoreSubscription.ts +13 -8
  251. package/src/tools/subscribe/JazzError.ts +8 -2
  252. package/src/tools/subscribe/SubscriptionScope.ts +57 -57
  253. package/src/tools/subscribe/index.ts +12 -4
  254. package/src/tools/subscribe/types.ts +36 -2
  255. package/src/tools/subscribe/utils.ts +2 -1
  256. package/src/tools/testing.ts +5 -0
  257. package/src/tools/tests/CoValueCoreSubscription.test.ts +10 -4
  258. package/src/tools/tests/ContextManager.test.ts +12 -5
  259. package/src/tools/tests/account.test.ts +22 -12
  260. package/src/tools/tests/coDiscriminatedUnion.test.ts +354 -8
  261. package/src/tools/tests/coFeed.branch.test.ts +48 -32
  262. package/src/tools/tests/coFeed.test-d.ts +17 -10
  263. package/src/tools/tests/coFeed.test.ts +52 -30
  264. package/src/tools/tests/coList.branch.test.ts +21 -21
  265. package/src/tools/tests/coList.test-d.ts +39 -23
  266. package/src/tools/tests/coList.test.ts +51 -25
  267. package/src/tools/tests/coList.unique.test.ts +34 -29
  268. package/src/tools/tests/coMap.branch.test.ts +20 -21
  269. package/src/tools/tests/coMap.record.test-d.ts +28 -26
  270. package/src/tools/tests/coMap.record.test.ts +30 -20
  271. package/src/tools/tests/coMap.test-d.ts +31 -29
  272. package/src/tools/tests/coMap.test.ts +67 -40
  273. package/src/tools/tests/coMap.unique.test.ts +25 -24
  274. package/src/tools/tests/coVector.test.ts +29 -15
  275. package/src/tools/tests/createContext.test.ts +5 -3
  276. package/src/tools/tests/deepLoading.test.ts +369 -176
  277. package/src/tools/tests/exportImport.test.ts +16 -15
  278. package/src/tools/tests/groupsAndAccounts.test.ts +39 -16
  279. package/src/tools/tests/inbox.test.ts +3 -1
  280. package/src/tools/tests/load.test.ts +29 -23
  281. package/src/tools/tests/patterns/quest.test.ts +3 -2
  282. package/src/tools/tests/patterns/requestToJoin.test.ts +17 -17
  283. package/src/tools/tests/request.test.ts +12 -2
  284. package/src/tools/tests/schema.resolved.test.ts +792 -0
  285. package/src/tools/tests/schemaUnion.test.ts +7 -3
  286. package/src/tools/tests/subscribe.test.ts +39 -21
  287. package/src/tools/tests/testing.test.ts +3 -2
  288. package/src/tools/tests/utils.ts +15 -2
  289. package/dist/chunk-OSQ7S47Q.js.map +0 -1
  290. package/dist/media/chunk-K6GCHLQU.js.map +0 -1
  291. package/dist/react-core/tests/useAccountWithSelector.test.d.ts +0 -2
  292. package/dist/react-core/tests/useAccountWithSelector.test.d.ts.map +0 -1
  293. package/dist/react-core/tests/useCoStateWithSelector.test.d.ts +0 -2
  294. package/dist/react-core/tests/useCoStateWithSelector.test.d.ts.map +0 -1
  295. package/dist/tools/implementation/errors.d.ts +0 -2
  296. package/dist/tools/implementation/errors.d.ts.map +0 -1
  297. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts +0 -19
  298. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts.map +0 -1
  299. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts +0 -5
  300. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts.map +0 -1
  301. package/dist/tools/lib/id.d.ts +0 -2
  302. package/dist/tools/lib/id.d.ts.map +0 -1
  303. package/src/tools/implementation/errors.ts +0 -1
  304. package/src/tools/lib/id.ts +0 -3
@@ -58,6 +58,11 @@ function removeGetters(obj) {
58
58
  }
59
59
  return result;
60
60
  }
61
+ function withSchemaResolveQuery(loadOptions, schemaResolveQuery) {
62
+ const newOptions = loadOptions ? { ...loadOptions } : {};
63
+ newOptions.resolve ||= schemaResolveQuery;
64
+ return newOptions;
65
+ }
61
66
 
62
67
  // src/tools/implementation/zodSchema/zodReExport.ts
63
68
  import {
@@ -130,6 +135,11 @@ import {
130
135
  // src/tools/coValues/CoValueBase.ts
131
136
  import { ControlledAccount } from "cojson";
132
137
  var CoValueBase = class {
138
+ constructor() {
139
+ Object.defineProperties(this, {
140
+ $isLoaded: { value: true, enumerable: false }
141
+ });
142
+ }
133
143
  /** @category Internals */
134
144
  static fromRaw(raw) {
135
145
  return new this({ fromRaw: raw });
@@ -161,6 +171,9 @@ var CoValueJazzApi = class {
161
171
  }
162
172
  return this.raw.id;
163
173
  }
174
+ get loadingState() {
175
+ return CoValueLoadingState.LOADED;
176
+ }
164
177
  /** @internal */
165
178
  get localNode() {
166
179
  return this.raw.core.node;
@@ -453,7 +466,7 @@ var _CoMap = class _CoMap extends CoValueBase {
453
466
  /**
454
467
  * Given some data, updates an existing CoMap or initialises a new one if none exists.
455
468
  *
456
- * Note: This method respects resolve options, and thus can return `null` if the references cannot be resolved.
469
+ * Note: This method respects resolve options, and thus can return a not-loaded value if the references cannot be resolved.
457
470
  *
458
471
  * @example
459
472
  * ```ts
@@ -500,7 +513,7 @@ var _CoMap = class _CoMap extends CoValueBase {
500
513
  * @param unique The unique identifier of the CoMap to load.
501
514
  * @param ownerID The ID of the owner of the CoMap.
502
515
  * @param options Additional options for loading the CoMap.
503
- * @returns The loaded CoMap, or null if unavailable.
516
+ * @returns The loaded CoMap, or an not-loaded value if unavailable.
504
517
  *
505
518
  * @deprecated Use `co.map(...).loadUnique` instead.
506
519
  */
@@ -509,7 +522,7 @@ var _CoMap = class _CoMap extends CoValueBase {
509
522
  const owner = await Group2.load(ownerID, {
510
523
  loadAs: options?.loadAs
511
524
  });
512
- if (!owner) return owner;
525
+ if (!owner.$isLoaded) return owner;
513
526
  return internalLoadUnique(this, {
514
527
  header,
515
528
  owner,
@@ -888,7 +901,8 @@ var _CoList = class _CoList extends Array {
888
901
  $jazz: {
889
902
  value: new CoListJazzApi(proxy, () => options.fromRaw),
890
903
  enumerable: false
891
- }
904
+ },
905
+ $isLoaded: { value: true, enumerable: false }
892
906
  });
893
907
  }
894
908
  return proxy;
@@ -922,7 +936,8 @@ var _CoList = class _CoList extends Array {
922
936
  $jazz: {
923
937
  value: new CoListJazzApi(instance, () => raw),
924
938
  enumerable: false
925
- }
939
+ },
940
+ $isLoaded: { value: true, enumerable: false }
926
941
  });
927
942
  const raw = owner.$jazz.raw.createList(
928
943
  toRawItems(items, instance.$jazz.schema[ItemsSym], owner),
@@ -1012,7 +1027,7 @@ var _CoList = class _CoList extends Array {
1012
1027
  /**
1013
1028
  * Given some data, updates an existing CoList or initialises a new one if none exists.
1014
1029
  *
1015
- * Note: This method respects resolve options, and thus can return `null` if the references cannot be resolved.
1030
+ * Note: This method respects resolve options, and thus can return a not-loaded value if the references cannot be resolved.
1016
1031
  *
1017
1032
  * @example
1018
1033
  * ```ts
@@ -1054,14 +1069,14 @@ var _CoList = class _CoList extends Array {
1054
1069
  * @param unique The unique identifier of the CoList to load.
1055
1070
  * @param ownerID The ID of the owner of the CoList.
1056
1071
  * @param options Additional options for loading the CoList.
1057
- * @returns The loaded CoList, or null if unavailable.
1072
+ * @returns The loaded CoList, or an not-loaded value if unavailable.
1058
1073
  */
1059
1074
  static async loadUnique(unique, ownerID, options) {
1060
1075
  const header = _CoList._getUniqueHeader(unique, ownerID);
1061
1076
  const owner = await Group2.load(ownerID, {
1062
1077
  loadAs: options?.loadAs
1063
1078
  });
1064
- if (!owner) return owner;
1079
+ if (!owner.$isLoaded) return owner;
1065
1080
  return internalLoadUnique(this, {
1066
1081
  header,
1067
1082
  owner,
@@ -1970,13 +1985,19 @@ var FileStream = class extends CoValueBase {
1970
1985
  */
1971
1986
  static async loadAsBlob(id, options) {
1972
1987
  let stream = await this.load(id, options);
1973
- return stream?.toBlob({
1988
+ if (!stream.$isLoaded) {
1989
+ return void 0;
1990
+ }
1991
+ return stream.toBlob({
1974
1992
  allowUnfinished: options?.allowUnfinished
1975
1993
  });
1976
1994
  }
1977
1995
  static async loadAsBase64(id, options) {
1978
1996
  const stream = await this.load(id, options);
1979
- return stream?.asBase64(options);
1997
+ if (!stream.$isLoaded) {
1998
+ return void 0;
1999
+ }
2000
+ return stream.asBase64(options);
1980
2001
  }
1981
2002
  asBase64(options) {
1982
2003
  const chunks = this.getChunks(options);
@@ -2078,7 +2099,7 @@ var FileStream = class extends CoValueBase {
2078
2099
  */
2079
2100
  static async load(id, options) {
2080
2101
  const stream = await loadCoValueWithoutMe(this, id, options);
2081
- if (!options?.allowUnfinished && !stream?.isBinaryStreamEnded()) {
2102
+ if (!options?.allowUnfinished && stream.$isLoaded && !stream.isBinaryStreamEnded()) {
2082
2103
  return new Promise((resolve) => {
2083
2104
  subscribeToCoValueWithoutMe(
2084
2105
  this,
@@ -2676,7 +2697,7 @@ var _Group = class _Group extends CoValueBase {
2676
2697
  const group = await loadCoValueWithoutMe(this, id, {
2677
2698
  loadAs: options?.loadAs
2678
2699
  });
2679
- if (!group) {
2700
+ if (!group.$isLoaded) {
2680
2701
  throw new Error(`Group with id ${id} not found`);
2681
2702
  }
2682
2703
  return group.$jazz.createInvite(options?.role ?? "reader");
@@ -2776,10 +2797,21 @@ import {
2776
2797
  RawAccount as RawAccount3
2777
2798
  } from "cojson";
2778
2799
 
2779
- // src/tools/lib/id.ts
2800
+ // src/tools/lib/utils.ts
2780
2801
  function isCoValueId(id) {
2781
2802
  return typeof id === "string" && id.startsWith("co_z");
2782
2803
  }
2804
+ function assertLoaded(coValue) {
2805
+ if (!coValue.$isLoaded) {
2806
+ throw new Error("CoValue is not loaded");
2807
+ }
2808
+ }
2809
+ function getLoadedOrUndefined(coValue) {
2810
+ if (!coValue?.$isLoaded) {
2811
+ return void 0;
2812
+ }
2813
+ return coValue;
2814
+ }
2783
2815
 
2784
2816
  // src/tools/coValues/inbox.ts
2785
2817
  function createInboxRoot(account) {
@@ -2888,7 +2920,7 @@ var Inbox = class _Inbox {
2888
2920
  const messagesFeed = new IncrementalFeed(this.messages.core);
2889
2921
  const processMessage = async (txKey, messageId) => {
2890
2922
  const message = await node.load(messageId);
2891
- if (message === "unavailable") {
2923
+ if (message === CoValueLoadingState.UNAVAILABLE) {
2892
2924
  throw new Error(`Inbox: message ${messageId} is unavailable`);
2893
2925
  }
2894
2926
  const value = await loadCoValue(
@@ -2962,7 +2994,7 @@ var Inbox = class _Inbox {
2962
2994
  }
2963
2995
  static async load(account) {
2964
2996
  const profile = account.profile;
2965
- if (!profile) {
2997
+ if (!profile.$isLoaded) {
2966
2998
  throw new Error("Account profile should already be loaded");
2967
2999
  }
2968
3000
  if (!profile.inbox) {
@@ -2970,7 +3002,7 @@ var Inbox = class _Inbox {
2970
3002
  }
2971
3003
  const node = account.$jazz.localNode;
2972
3004
  const root = await node.load(profile.inbox);
2973
- if (root === "unavailable") {
3005
+ if (root === CoValueLoadingState.UNAVAILABLE) {
2974
3006
  throw new Error("Inbox not found");
2975
3007
  }
2976
3008
  const [messages, processed, failed] = await Promise.all([
@@ -2978,7 +3010,7 @@ var Inbox = class _Inbox {
2978
3010
  node.load(root.get("processed")),
2979
3011
  node.load(root.get("failed"))
2980
3012
  ]);
2981
- if (messages === "unavailable" || processed === "unavailable" || failed === "unavailable") {
3013
+ if (messages === CoValueLoadingState.UNAVAILABLE || processed === CoValueLoadingState.UNAVAILABLE || failed === CoValueLoadingState.UNAVAILABLE) {
2982
3014
  throw new Error("Inbox not found");
2983
3015
  }
2984
3016
  await processed.core.waitForFullStreaming();
@@ -3018,11 +3050,11 @@ var InboxSender = class _InboxSender {
3018
3050
  const inboxOwnerRaw = await node.load(
3019
3051
  inboxOwnerID
3020
3052
  );
3021
- if (inboxOwnerRaw === "unavailable") {
3053
+ if (inboxOwnerRaw === CoValueLoadingState.UNAVAILABLE) {
3022
3054
  throw new Error("Failed to load the inbox owner");
3023
3055
  }
3024
3056
  const inboxOwnerProfileRaw = await node.load(inboxOwnerRaw.get("profile"));
3025
- if (inboxOwnerProfileRaw === "unavailable") {
3057
+ if (inboxOwnerProfileRaw === CoValueLoadingState.UNAVAILABLE) {
3026
3058
  throw new Error("Failed to load the inbox owner profile");
3027
3059
  }
3028
3060
  const inboxOwnerRole = inboxOwnerProfileRaw.group.roleOf(
@@ -3039,7 +3071,7 @@ var InboxSender = class _InboxSender {
3039
3071
  }
3040
3072
  const id = await acceptInvite(inboxInvite, currentAccount);
3041
3073
  const messages = await node.load(id);
3042
- if (messages === "unavailable") {
3074
+ if (messages === CoValueLoadingState.UNAVAILABLE) {
3043
3075
  throw new Error("Inbox not found");
3044
3076
  }
3045
3077
  return new _InboxSender(currentAccount, inboxOwnerRaw, messages);
@@ -3085,7 +3117,8 @@ var CoPlainText = class extends String {
3085
3117
  $jazz: {
3086
3118
  value: new CoTextJazzApi(this, raw),
3087
3119
  enumerable: false
3088
- }
3120
+ },
3121
+ $isLoaded: { value: true, enumerable: false }
3089
3122
  });
3090
3123
  return;
3091
3124
  }
@@ -3097,7 +3130,8 @@ var CoPlainText = class extends String {
3097
3130
  $jazz: {
3098
3131
  value: new CoTextJazzApi(this, raw),
3099
3132
  enumerable: false
3100
- }
3133
+ },
3134
+ $isLoaded: { value: true, enumerable: false }
3101
3135
  });
3102
3136
  return;
3103
3137
  }
@@ -3306,8 +3340,6 @@ var SchemaUnion = class _SchemaUnion extends CoValueBase {
3306
3340
  /**
3307
3341
  * Load a `SchemaUnion` with a given ID, as a given account.
3308
3342
  *
3309
- * Note: The `resolve` option is not supported for `SchemaUnion`s due to https://github.com/garden-co/jazz/issues/2639
3310
- *
3311
3343
  * @category Subscription & Loading
3312
3344
  */
3313
3345
  static load(id, options) {
@@ -3341,6 +3373,7 @@ var _CoVector = class _CoVector extends Float32Array {
3341
3373
  value: new CoVectorJazzApi(this, raw),
3342
3374
  enumerable: false
3343
3375
  },
3376
+ $isLoaded: { value: true, enumerable: false },
3344
3377
  _isVectorLoaded: { value: false, enumerable: false, writable: true },
3345
3378
  _requiredDimensionsCount: {
3346
3379
  value: dimensionsCount,
@@ -3441,7 +3474,7 @@ var _CoVector = class _CoVector extends Float32Array {
3441
3474
  */
3442
3475
  static async load(id, options) {
3443
3476
  const coVector = await loadCoValueWithoutMe(this, id, options);
3444
- if (!coVector?.$jazz.raw.isBinaryStreamEnded()) {
3477
+ if (!coVector.$isLoaded || !coVector.$jazz.raw.isBinaryStreamEnded()) {
3445
3478
  return new Promise((resolve) => {
3446
3479
  subscribeToCoValueWithoutMe(
3447
3480
  this,
@@ -3662,23 +3695,27 @@ var Ref = class {
3662
3695
  node = subscriptionScope.childNodes.get(this.id);
3663
3696
  }
3664
3697
  if (!node) {
3665
- return null;
3698
+ return createUnloadedCoValue(this.id, CoValueLoadingState.LOADING);
3666
3699
  }
3667
3700
  const value = node.value;
3668
- if (value?.type === "loaded") {
3701
+ if (value?.type === CoValueLoadingState.LOADED) {
3669
3702
  return value.value;
3670
3703
  } else {
3671
3704
  return new Promise((resolve) => {
3672
3705
  const unsubscribe = node.subscribe((value2) => {
3673
- if (value2?.type === "loaded") {
3706
+ if (value2?.type === CoValueLoadingState.LOADED) {
3674
3707
  unsubscribe();
3675
3708
  resolve(value2.value);
3676
- } else if (value2?.type === "unavailable") {
3709
+ } else if (value2?.type === CoValueLoadingState.UNAVAILABLE) {
3677
3710
  unsubscribe();
3678
- resolve(null);
3679
- } else if (value2?.type === "unauthorized") {
3711
+ resolve(
3712
+ createUnloadedCoValue(this.id, CoValueLoadingState.UNAVAILABLE)
3713
+ );
3714
+ } else if (value2?.type === CoValueLoadingState.UNAUTHORIZED) {
3680
3715
  unsubscribe();
3681
- resolve(null);
3716
+ resolve(
3717
+ createUnloadedCoValue(this.id, CoValueLoadingState.UNAUTHORIZED)
3718
+ );
3682
3719
  }
3683
3720
  if (subscriptionScope.closed) {
3684
3721
  node.destroy();
@@ -3855,6 +3892,28 @@ function applyCoValueMigrations(instance) {
3855
3892
  import {
3856
3893
  cojsonInternals as cojsonInternals4
3857
3894
  } from "cojson";
3895
+
3896
+ // src/tools/subscribe/types.ts
3897
+ var CoValueLoadingState = {
3898
+ /**
3899
+ * The coValue is loaded.
3900
+ */
3901
+ LOADED: "loaded",
3902
+ /**
3903
+ * The coValue is being loaded.
3904
+ */
3905
+ LOADING: "loading",
3906
+ /**
3907
+ * The coValue was loaded but the account is not authorized to access it.
3908
+ */
3909
+ UNAUTHORIZED: "unauthorized",
3910
+ /**
3911
+ * Tried to load the coValue but failed.
3912
+ */
3913
+ UNAVAILABLE: "unavailable"
3914
+ };
3915
+
3916
+ // src/tools/subscribe/CoValueCoreSubscription.ts
3858
3917
  var CoValueCoreSubscription = class {
3859
3918
  constructor(localNode, id, listener, skipRetry, branch) {
3860
3919
  this._unsubscribe = () => {
@@ -3922,14 +3981,14 @@ var CoValueCoreSubscription = class {
3922
3981
  handleBranchCheckout() {
3923
3982
  this.localNode.checkoutBranch(this.source.id, this.branchName, this.branchOwnerId).then((value) => {
3924
3983
  if (this.unsubscribed) return;
3925
- if (value !== "unavailable") {
3984
+ if (value !== CoValueLoadingState.UNAVAILABLE) {
3926
3985
  this.subscribe(value);
3927
3986
  } else {
3928
3987
  this.handleUnavailableBranch();
3929
3988
  }
3930
3989
  }).catch((error) => {
3931
3990
  console.error(error);
3932
- this.emit("unavailable");
3991
+ this.emit(CoValueLoadingState.UNAVAILABLE);
3933
3992
  });
3934
3993
  }
3935
3994
  /**
@@ -3942,7 +4001,7 @@ var CoValueCoreSubscription = class {
3942
4001
  throw new Error("Branch is unavailable");
3943
4002
  }
3944
4003
  this.subscribeToUnavailableSource();
3945
- this.emit("unavailable");
4004
+ this.emit(CoValueLoadingState.UNAVAILABLE);
3946
4005
  }
3947
4006
  /**
3948
4007
  * Loads the CoValue core from the network/storage.
@@ -3955,11 +4014,11 @@ var CoValueCoreSubscription = class {
3955
4014
  this.subscribe(value.getCurrentContent());
3956
4015
  } else {
3957
4016
  this.subscribeToUnavailableSource();
3958
- this.emit("unavailable");
4017
+ this.emit(CoValueLoadingState.UNAVAILABLE);
3959
4018
  }
3960
4019
  }).catch((error) => {
3961
4020
  console.error(error);
3962
- this.emit("unavailable");
4021
+ this.emit(CoValueLoadingState.UNAVAILABLE);
3963
4022
  });
3964
4023
  }
3965
4024
  /**
@@ -4083,7 +4142,7 @@ function createCoValue(ref2, raw, subscriptionScope) {
4083
4142
  configurable: false
4084
4143
  });
4085
4144
  return {
4086
- type: "loaded",
4145
+ type: CoValueLoadingState.LOADED,
4087
4146
  value: freshValueInstance,
4088
4147
  id: subscriptionScope.id
4089
4148
  };
@@ -4116,18 +4175,19 @@ var SubscriptionScope = class _SubscriptionScope {
4116
4175
  this.autoloadedKeys = /* @__PURE__ */ new Set();
4117
4176
  this.skipInvalidKeys = /* @__PURE__ */ new Set();
4118
4177
  this.totalValidTransactions = 0;
4178
+ this.version = 0;
4119
4179
  this.migrated = false;
4120
4180
  this.migrating = false;
4121
4181
  this.closed = false;
4122
4182
  this.silenceUpdates = false;
4123
4183
  this.handleChildUpdate = (id, value, key) => {
4124
- if (value.type === "unloaded") {
4184
+ if (value.type === CoValueLoadingState.LOADING) {
4125
4185
  return;
4126
4186
  }
4127
4187
  this.pendingLoadedChildren.delete(id);
4128
4188
  this.pendingAutoloadedChildren.delete(id);
4129
4189
  this.childValues.set(id, value);
4130
- if (value.type === "unavailable" || value.type === "unauthorized") {
4190
+ if (value.type === CoValueLoadingState.UNAVAILABLE || value.type === CoValueLoadingState.UNAUTHORIZED) {
4131
4191
  this.childErrors.set(id, value.prependPath(key ?? id));
4132
4192
  this.errorFromChildren = this.computeChildErrors();
4133
4193
  } else if (this.errorFromChildren && this.childErrors.has(id)) {
@@ -4135,7 +4195,7 @@ var SubscriptionScope = class _SubscriptionScope {
4135
4195
  this.errorFromChildren = this.computeChildErrors();
4136
4196
  }
4137
4197
  if (this.shouldSendUpdates()) {
4138
- if (this.value.type === "loaded") {
4198
+ if (this.value.type === CoValueLoadingState.LOADED) {
4139
4199
  this.updateValue(
4140
4200
  createCoValue(this.schema, this.value.value.$jazz.raw, this)
4141
4201
  );
@@ -4145,18 +4205,18 @@ var SubscriptionScope = class _SubscriptionScope {
4145
4205
  };
4146
4206
  this.subscribers = /* @__PURE__ */ new Set();
4147
4207
  this.resolve = resolve;
4148
- this.value = { type: "unloaded", id };
4208
+ this.value = { type: CoValueLoadingState.LOADING, id };
4149
4209
  let lastUpdate;
4150
4210
  this.subscription = new CoValueCoreSubscription(
4151
4211
  node,
4152
4212
  id,
4153
4213
  (value) => {
4154
4214
  lastUpdate = value;
4155
- if (skipRetry && value === "unavailable") {
4215
+ if (skipRetry && value === CoValueLoadingState.UNAVAILABLE) {
4156
4216
  this.handleUpdate(value);
4157
4217
  return;
4158
4218
  }
4159
- if (!this.migrated && value !== "unavailable") {
4219
+ if (!this.migrated && value !== CoValueLoadingState.UNAVAILABLE) {
4160
4220
  if (this.migrating) {
4161
4221
  return;
4162
4222
  }
@@ -4179,12 +4239,12 @@ var SubscriptionScope = class _SubscriptionScope {
4179
4239
  this.dirty = true;
4180
4240
  }
4181
4241
  handleUpdate(update) {
4182
- if (update === "unavailable") {
4183
- if (this.value.type === "unloaded") {
4242
+ if (update === CoValueLoadingState.UNAVAILABLE) {
4243
+ if (this.value.type === CoValueLoadingState.LOADING) {
4184
4244
  this.updateValue(
4185
- new JazzError(this.id, "unavailable", [
4245
+ new JazzError(this.id, CoValueLoadingState.UNAVAILABLE, [
4186
4246
  {
4187
- code: "unavailable",
4247
+ code: CoValueLoadingState.UNAVAILABLE,
4188
4248
  message: "The value is unavailable",
4189
4249
  params: {
4190
4250
  id: this.id
@@ -4200,11 +4260,11 @@ var SubscriptionScope = class _SubscriptionScope {
4200
4260
  const ruleset = update.core.verified.header.ruleset;
4201
4261
  const hasAccess = ruleset.type !== "ownedByGroup" || myRoleForRawValue(update) !== void 0;
4202
4262
  if (!hasAccess) {
4203
- if (this.value.type !== "unauthorized") {
4263
+ if (this.value.type !== CoValueLoadingState.UNAUTHORIZED) {
4204
4264
  this.updateValue(
4205
- new JazzError(this.id, "unauthorized", [
4265
+ new JazzError(this.id, CoValueLoadingState.UNAUTHORIZED, [
4206
4266
  {
4207
- code: "unauthorized",
4267
+ code: CoValueLoadingState.UNAUTHORIZED,
4208
4268
  message: `The current user (${this.node.getCurrentAgent().id}) is not authorized to access this value`,
4209
4269
  params: {
4210
4270
  id: this.id
@@ -4218,13 +4278,11 @@ var SubscriptionScope = class _SubscriptionScope {
4218
4278
  return;
4219
4279
  }
4220
4280
  this.silenceUpdates = true;
4221
- if (this.value.type !== "loaded") {
4281
+ if (this.value.type !== CoValueLoadingState.LOADED) {
4222
4282
  this.updateValue(createCoValue(this.schema, update, this));
4223
4283
  this.loadChildren();
4224
4284
  } else {
4225
- const hasChanged = update.totalValidTransactions !== this.totalValidTransactions || // Checking the identity of the raw value makes us cover the cases where the group
4226
- // has been updated and the coValues that don't update the totalValidTransactions value (e.g. FileStream)
4227
- this.value.value.$jazz.raw !== update;
4285
+ const hasChanged = update.totalValidTransactions !== this.totalValidTransactions || update.version !== this.version;
4228
4286
  if (this.loadChildren()) {
4229
4287
  this.updateValue(createCoValue(this.schema, update, this));
4230
4288
  } else if (hasChanged) {
@@ -4232,12 +4290,13 @@ var SubscriptionScope = class _SubscriptionScope {
4232
4290
  }
4233
4291
  }
4234
4292
  this.totalValidTransactions = update.totalValidTransactions;
4293
+ this.version = update.version;
4235
4294
  this.silenceUpdates = false;
4236
4295
  this.triggerUpdate();
4237
4296
  }
4238
4297
  computeChildErrors() {
4239
4298
  let issues = [];
4240
- let errorType = "unavailable";
4299
+ let errorType = CoValueLoadingState.UNAVAILABLE;
4241
4300
  if (this.childErrors.size === 0 && this.validationErrors.size === 0) {
4242
4301
  return void 0;
4243
4302
  }
@@ -4271,26 +4330,26 @@ var SubscriptionScope = class _SubscriptionScope {
4271
4330
  return void 0;
4272
4331
  }
4273
4332
  shouldSendUpdates() {
4274
- if (this.value.type === "unloaded") return false;
4275
- if (this.value.type !== "loaded") return true;
4333
+ if (this.value.type === CoValueLoadingState.LOADING) return false;
4334
+ if (this.value.type !== CoValueLoadingState.LOADED) return true;
4276
4335
  return this.pendingLoadedChildren.size === 0;
4277
4336
  }
4278
4337
  getCurrentValue() {
4279
- if (this.value.type === "unauthorized" || this.value.type === "unavailable") {
4338
+ if (this.value.type === CoValueLoadingState.UNAUTHORIZED || this.value.type === CoValueLoadingState.UNAVAILABLE) {
4280
4339
  console.error(this.value.toString());
4281
- return null;
4340
+ return this.value.type;
4282
4341
  }
4283
4342
  if (!this.shouldSendUpdates()) {
4284
- return void 0;
4343
+ return CoValueLoadingState.LOADING;
4285
4344
  }
4286
4345
  if (this.errorFromChildren) {
4287
4346
  console.error(this.errorFromChildren.toString());
4288
- return null;
4347
+ return this.errorFromChildren.type;
4289
4348
  }
4290
- if (this.value.type === "loaded") {
4349
+ if (this.value.type === CoValueLoadingState.LOADED) {
4291
4350
  return this.value.value;
4292
4351
  }
4293
- return void 0;
4352
+ return CoValueLoadingState.LOADING;
4294
4353
  }
4295
4354
  triggerUpdate() {
4296
4355
  if (!this.shouldSendUpdates()) return;
@@ -4301,7 +4360,7 @@ var SubscriptionScope = class _SubscriptionScope {
4301
4360
  const value = this.value;
4302
4361
  if (error) {
4303
4362
  this.subscribers.forEach((listener) => listener(error));
4304
- } else if (value.type !== "unloaded") {
4363
+ } else if (value.type !== CoValueLoadingState.LOADING) {
4305
4364
  this.subscribers.forEach((listener) => listener(value));
4306
4365
  }
4307
4366
  this.dirty = false;
@@ -4320,12 +4379,12 @@ var SubscriptionScope = class _SubscriptionScope {
4320
4379
  if (this.resolve === true || !this.resolve) {
4321
4380
  this.resolve = {};
4322
4381
  }
4323
- if (!this.resolve.$each && !(key in this.resolve)) {
4324
- const resolve = this.resolve;
4382
+ const resolve = this.resolve;
4383
+ if (!resolve.$each && !(key in resolve)) {
4325
4384
  resolve[key] = true;
4326
4385
  this.autoloadedKeys.add(key);
4327
4386
  }
4328
- if (this.value.type !== "loaded") {
4387
+ if (this.value.type !== CoValueLoadingState.LOADED) {
4329
4388
  return;
4330
4389
  }
4331
4390
  const value = this.value.value;
@@ -4351,14 +4410,14 @@ var SubscriptionScope = class _SubscriptionScope {
4351
4410
  if (!this.closed) {
4352
4411
  throw new Error("Cannot pull a non-closed subscription scope");
4353
4412
  }
4354
- if (this.value.type === "loaded") {
4413
+ if (this.value.type === CoValueLoadingState.LOADED) {
4355
4414
  return;
4356
4415
  }
4357
4416
  this.subscription.pullValue();
4358
4417
  const value = this.getCurrentValue();
4359
- if (value) {
4418
+ if (typeof value !== "string") {
4360
4419
  listener({
4361
- type: "loaded",
4420
+ type: CoValueLoadingState.LOADED,
4362
4421
  value,
4363
4422
  id: this.id
4364
4423
  });
@@ -4397,7 +4456,7 @@ var SubscriptionScope = class _SubscriptionScope {
4397
4456
  }
4398
4457
  loadChildren() {
4399
4458
  const { resolve } = this;
4400
- if (this.value.type !== "loaded") {
4459
+ if (this.value.type !== CoValueLoadingState.LOADED) {
4401
4460
  return false;
4402
4461
  }
4403
4462
  const value = this.value.value;
@@ -4448,7 +4507,7 @@ var SubscriptionScope = class _SubscriptionScope {
4448
4507
  } else if (!descriptor.optional) {
4449
4508
  this.validationErrors.set(
4450
4509
  key,
4451
- new JazzError(void 0, "unavailable", [
4510
+ new JazzError(void 0, CoValueLoadingState.UNAVAILABLE, [
4452
4511
  {
4453
4512
  code: "validationError",
4454
4513
  message: `The ref on position ${key} requested on ${stream.constructor.name} is missing`,
@@ -4486,17 +4545,6 @@ var SubscriptionScope = class _SubscriptionScope {
4486
4545
  const id = map.$jazz.raw.get(key);
4487
4546
  const descriptor = map.$jazz.getDescriptor(key);
4488
4547
  if (!descriptor) {
4489
- this.childErrors.set(
4490
- key,
4491
- new JazzError(void 0, "unavailable", [
4492
- {
4493
- code: "validationError",
4494
- message: `The ref ${key} requested on ${map.constructor.name} is not defined in the schema`,
4495
- params: {},
4496
- path: [key]
4497
- }
4498
- ])
4499
- );
4500
4548
  return void 0;
4501
4549
  }
4502
4550
  if (isRefEncoded(descriptor)) {
@@ -4507,7 +4555,7 @@ var SubscriptionScope = class _SubscriptionScope {
4507
4555
  } else if (!descriptor.optional) {
4508
4556
  this.validationErrors.set(
4509
4557
  key,
4510
- new JazzError(void 0, "unavailable", [
4558
+ new JazzError(void 0, CoValueLoadingState.UNAVAILABLE, [
4511
4559
  {
4512
4560
  code: "validationError",
4513
4561
  message: `The ref ${key} requested on ${map.constructor.name} is missing`,
@@ -4538,7 +4586,7 @@ var SubscriptionScope = class _SubscriptionScope {
4538
4586
  } else if (!descriptor.optional) {
4539
4587
  this.validationErrors.set(
4540
4588
  key,
4541
- new JazzError(void 0, "unavailable", [
4589
+ new JazzError(void 0, CoValueLoadingState.UNAVAILABLE, [
4542
4590
  {
4543
4591
  code: "validationError",
4544
4592
  message: `The ref on position ${key} requested on ${list.constructor.name} is missing`,
@@ -4558,7 +4606,7 @@ var SubscriptionScope = class _SubscriptionScope {
4558
4606
  if (isAutoloaded) {
4559
4607
  this.autoloaded.add(id);
4560
4608
  }
4561
- const skipInvalid = typeof query === "object" && query.$onError === null;
4609
+ const skipInvalid = typeof query === "object" && query.$onError === "catch";
4562
4610
  if (skipInvalid) {
4563
4611
  if (key) {
4564
4612
  this.skipInvalidKeys.add(key);
@@ -4627,20 +4675,26 @@ function accessChildByKey(parent, childId, key) {
4627
4675
  );
4628
4676
  }
4629
4677
  const value = subscriptionScope.childValues.get(childId);
4630
- if (value?.type === "loaded") {
4678
+ if (value?.type === CoValueLoadingState.LOADED) {
4631
4679
  return value.value;
4632
4680
  } else {
4633
- return null;
4681
+ return createUnloadedCoValue(
4682
+ childId,
4683
+ value?.type ?? CoValueLoadingState.LOADING
4684
+ );
4634
4685
  }
4635
4686
  }
4636
4687
  function accessChildById(parent, childId, schema) {
4637
4688
  const subscriptionScope = getSubscriptionScope(parent);
4638
4689
  subscriptionScope.subscribeToId(childId, schema);
4639
4690
  const value = subscriptionScope.childValues.get(childId);
4640
- if (value?.type === "loaded") {
4691
+ if (value?.type === CoValueLoadingState.LOADED) {
4641
4692
  return value.value;
4642
4693
  } else {
4643
- return null;
4694
+ return createUnloadedCoValue(
4695
+ childId,
4696
+ value?.type ?? CoValueLoadingState.LOADING
4697
+ );
4644
4698
  }
4645
4699
  }
4646
4700
 
@@ -4822,18 +4876,32 @@ function createAnonymousJazzContext({
4822
4876
  }
4823
4877
 
4824
4878
  // src/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.ts
4825
- var CoDiscriminatedUnionSchema = class {
4879
+ var CoDiscriminatedUnionSchema = class _CoDiscriminatedUnionSchema {
4826
4880
  constructor(coreSchema, coValueClass) {
4827
4881
  this.coValueClass = coValueClass;
4828
4882
  this.collaborative = true;
4829
4883
  this.builtin = "CoDiscriminatedUnion";
4884
+ /**
4885
+ * Default resolve query to be used when loading instances of this schema.
4886
+ * This resolve query will be used when no resolve query is provided to the load method.
4887
+ * @default true
4888
+ */
4889
+ this.resolveQuery = true;
4830
4890
  this.getDefinition = coreSchema.getDefinition;
4831
4891
  }
4832
4892
  load(id, options) {
4833
- return this.coValueClass.load(id, options);
4893
+ return this.coValueClass.load(
4894
+ id,
4895
+ // @ts-expect-error
4896
+ withSchemaResolveQuery(options, this.resolveQuery)
4897
+ );
4834
4898
  }
4835
4899
  subscribe(id, options, listener) {
4836
- return this.coValueClass.subscribe(id, options, listener);
4900
+ return this.coValueClass.subscribe(
4901
+ id,
4902
+ withSchemaResolveQuery(options, this.resolveQuery),
4903
+ listener
4904
+ );
4837
4905
  }
4838
4906
  getCoValueClass() {
4839
4907
  return this.coValueClass;
@@ -4841,6 +4909,23 @@ var CoDiscriminatedUnionSchema = class {
4841
4909
  optional() {
4842
4910
  return coOptionalDefiner(this);
4843
4911
  }
4912
+ /**
4913
+ * Adds a default resolve query to be used when loading instances of this schema.
4914
+ * This resolve query will be used when no resolve query is provided to the load method.
4915
+ */
4916
+ resolved(resolveQuery) {
4917
+ const definition = this.getDefinition();
4918
+ const coreSchema = createCoreCoDiscriminatedUnionSchema(
4919
+ definition.discriminator,
4920
+ definition.options
4921
+ );
4922
+ const copy = new _CoDiscriminatedUnionSchema(
4923
+ coreSchema,
4924
+ this.coValueClass
4925
+ );
4926
+ copy.resolveQuery = resolveQuery;
4927
+ return copy;
4928
+ }
4844
4929
  };
4845
4930
  function createCoreCoDiscriminatedUnionSchema(discriminator, schemas) {
4846
4931
  return {
@@ -4868,7 +4953,8 @@ function createCoreCoDiscriminatedUnionSchema(discriminator, schemas) {
4868
4953
  get options() {
4869
4954
  return schemas;
4870
4955
  }
4871
- })
4956
+ }),
4957
+ resolveQuery: true
4872
4958
  };
4873
4959
  }
4874
4960
 
@@ -4881,6 +4967,7 @@ var CoOptionalSchema = class {
4881
4967
  this.getDefinition = () => ({
4882
4968
  innerType: this.innerType
4883
4969
  });
4970
+ this.resolveQuery = true;
4884
4971
  }
4885
4972
  getCoValueClass() {
4886
4973
  return this.innerType.getCoValueClass();
@@ -4891,7 +4978,8 @@ var CoOptionalSchema = class {
4891
4978
  function createCoreCoRichTextSchema() {
4892
4979
  return {
4893
4980
  collaborative: true,
4894
- builtin: "CoRichText"
4981
+ builtin: "CoRichText",
4982
+ resolveQuery: true
4895
4983
  };
4896
4984
  }
4897
4985
  var RichTextSchema = class {
@@ -4899,6 +4987,7 @@ var RichTextSchema = class {
4899
4987
  this.coValueClass = coValueClass;
4900
4988
  this.collaborative = true;
4901
4989
  this.builtin = "CoRichText";
4990
+ this.resolveQuery = true;
4902
4991
  }
4903
4992
  create(text, options) {
4904
4993
  return this.coValueClass.create(text, options);
@@ -4910,7 +4999,7 @@ var RichTextSchema = class {
4910
4999
  return this.coValueClass.subscribe(...args);
4911
5000
  }
4912
5001
  unstable_merge(id, options) {
4913
- return unstable_mergeBranchWithResolve2(this.coValueClass, id, options);
5002
+ return unstable_mergeBranchWithResolve(this.coValueClass, id, options);
4914
5003
  }
4915
5004
  getCoValueClass() {
4916
5005
  return this.coValueClass;
@@ -4924,13 +5013,15 @@ var RichTextSchema = class {
4924
5013
  function createCoreGroupSchema() {
4925
5014
  return {
4926
5015
  collaborative: true,
4927
- builtin: "Group"
5016
+ builtin: "Group",
5017
+ resolveQuery: true
4928
5018
  };
4929
5019
  }
4930
5020
  var GroupSchema = class {
4931
5021
  constructor() {
4932
5022
  this.collaborative = true;
4933
5023
  this.builtin = "Group";
5024
+ this.resolveQuery = true;
4934
5025
  }
4935
5026
  getCoValueClass() {
4936
5027
  return Group2;
@@ -5062,11 +5153,13 @@ var coDiscriminatedUnionDefiner = (discriminator, schemas) => {
5062
5153
  // src/tools/implementation/zodSchema/coExport.ts
5063
5154
  var coExport_exports = {};
5064
5155
  __export(coExport_exports, {
5156
+ Account: () => AccountSchema,
5065
5157
  DiscriminatedUnion: () => CoDiscriminatedUnionSchema,
5066
5158
  Feed: () => CoFeedSchema,
5067
5159
  FileStream: () => FileStreamSchema,
5068
5160
  Group: () => GroupSchema,
5069
5161
  List: () => CoListSchema,
5162
+ Map: () => CoMapSchema,
5070
5163
  Optional: () => CoOptionalSchema,
5071
5164
  PlainText: () => PlainTextSchema,
5072
5165
  RichText: () => RichTextSchema,
@@ -5088,6 +5181,156 @@ __export(coExport_exports, {
5088
5181
  });
5089
5182
 
5090
5183
  // src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts
5184
+ var CoMapSchema = class _CoMapSchema {
5185
+ constructor(coreSchema, coValueClass) {
5186
+ this.coValueClass = coValueClass;
5187
+ this.collaborative = true;
5188
+ this.builtin = "CoMap";
5189
+ /**
5190
+ * Default resolve query to be used when loading instances of this schema.
5191
+ * This resolve query will be used when no resolve query is provided to the load method.
5192
+ * @default true
5193
+ */
5194
+ this.resolveQuery = true;
5195
+ this.shape = coreSchema.shape;
5196
+ this.catchAll = coreSchema.catchAll;
5197
+ this.getDefinition = coreSchema.getDefinition;
5198
+ }
5199
+ create(...args) {
5200
+ return this.coValueClass.create(...args);
5201
+ }
5202
+ load(id, options) {
5203
+ return this.coValueClass.load(
5204
+ id,
5205
+ // @ts-expect-error
5206
+ withSchemaResolveQuery(options, this.resolveQuery)
5207
+ );
5208
+ }
5209
+ unstable_merge(id, options) {
5210
+ return unstable_mergeBranchWithResolve(
5211
+ this.coValueClass,
5212
+ id,
5213
+ // @ts-expect-error
5214
+ withSchemaResolveQuery(options, this.resolveQuery)
5215
+ );
5216
+ }
5217
+ subscribe(id, options, listener) {
5218
+ return this.coValueClass.subscribe(
5219
+ id,
5220
+ withSchemaResolveQuery(options, this.resolveQuery),
5221
+ listener
5222
+ );
5223
+ }
5224
+ /** @deprecated Use `CoMap.upsertUnique` and `CoMap.loadUnique` instead. */
5225
+ findUnique(unique, ownerID, as) {
5226
+ return this.coValueClass.findUnique(unique, ownerID, as);
5227
+ }
5228
+ upsertUnique(options) {
5229
+ return this.coValueClass.upsertUnique(
5230
+ // @ts-expect-error
5231
+ withSchemaResolveQuery(options, this.resolveQuery)
5232
+ );
5233
+ }
5234
+ loadUnique(unique, ownerID, options) {
5235
+ return this.coValueClass.loadUnique(
5236
+ unique,
5237
+ ownerID,
5238
+ // @ts-expect-error
5239
+ withSchemaResolveQuery(options, this.resolveQuery)
5240
+ );
5241
+ }
5242
+ /**
5243
+ * @deprecated `co.map().catchall` will be removed in an upcoming version.
5244
+ *
5245
+ * Use a `co.record` nested inside a `co.map` if you need to store key-value properties.
5246
+ *
5247
+ * @example
5248
+ * ```ts
5249
+ * // Instead of:
5250
+ * const Image = co.map({
5251
+ * original: co.fileStream(),
5252
+ * }).catchall(co.fileStream());
5253
+ *
5254
+ * // Use:
5255
+ * const Image = co.map({
5256
+ * original: co.fileStream(),
5257
+ * resolutions: co.record(z.string(), co.fileStream()),
5258
+ * });
5259
+ * ```
5260
+ */
5261
+ catchall(schema) {
5262
+ const schemaWithCatchAll = createCoreCoMapSchema(this.shape, schema);
5263
+ return hydrateCoreCoValueSchema(schemaWithCatchAll);
5264
+ }
5265
+ withMigration(migration) {
5266
+ this.coValueClass.prototype.migrate = migration;
5267
+ return this;
5268
+ }
5269
+ getCoValueClass() {
5270
+ return this.coValueClass;
5271
+ }
5272
+ optional() {
5273
+ return coOptionalDefiner(this);
5274
+ }
5275
+ /**
5276
+ * Creates a new CoMap schema by picking the specified keys from the original schema.
5277
+ *
5278
+ * @param keys - The keys to pick from the original schema.
5279
+ * @returns A new CoMap schema with the picked keys.
5280
+ */
5281
+ pick(keys) {
5282
+ const keysSet = new Set(Object.keys(keys));
5283
+ const pickedShape = {};
5284
+ for (const [key, value] of Object.entries(this.shape)) {
5285
+ if (keysSet.has(key)) {
5286
+ pickedShape[key] = value;
5287
+ }
5288
+ }
5289
+ return coMapDefiner(pickedShape);
5290
+ }
5291
+ /**
5292
+ * Creates a new CoMap schema by making all fields optional.
5293
+ *
5294
+ * @returns A new CoMap schema with all fields optional.
5295
+ */
5296
+ partial(keys) {
5297
+ const partialShape = {};
5298
+ for (const [key, value] of Object.entries(this.shape)) {
5299
+ if (keys && !keys[key]) {
5300
+ partialShape[key] = value;
5301
+ continue;
5302
+ }
5303
+ if (isAnyCoValueSchema2(value)) {
5304
+ partialShape[key] = coOptionalDefiner(value);
5305
+ } else {
5306
+ partialShape[key] = z.optional(this.shape[key]);
5307
+ }
5308
+ }
5309
+ const partialCoMapSchema = coMapDefiner(partialShape);
5310
+ if (this.catchAll) {
5311
+ return partialCoMapSchema.catchall(
5312
+ this.catchAll
5313
+ );
5314
+ }
5315
+ return partialCoMapSchema;
5316
+ }
5317
+ /**
5318
+ * Adds a default resolve query to be used when loading instances of this schema.
5319
+ * This resolve query will be used when no resolve query is provided to the load method.
5320
+ */
5321
+ resolved(resolveQuery) {
5322
+ const coreSchema = createCoreCoMapSchema(
5323
+ this.shape,
5324
+ this.catchAll
5325
+ );
5326
+ const copy = new _CoMapSchema(
5327
+ coreSchema,
5328
+ this.coValueClass
5329
+ );
5330
+ copy.resolveQuery = resolveQuery;
5331
+ return copy;
5332
+ }
5333
+ };
5091
5334
  function createCoreCoMapSchema(shape, catchAll) {
5092
5335
  return {
5093
5336
  collaborative: true,
@@ -5115,103 +5358,49 @@ function createCoreCoMapSchema(shape, catchAll) {
5115
5358
  }
5116
5359
  return propValues;
5117
5360
  }
5118
- })
5361
+ }),
5362
+ resolveQuery: true
5119
5363
  };
5120
5364
  }
5121
- function enrichCoMapSchema(schema, coValueClass) {
5122
- const coValueSchema = Object.assign(schema, {
5123
- create: (...args) => {
5124
- return coValueClass.create(...args);
5125
- },
5126
- load: (...args) => {
5127
- return coValueClass.load(...args);
5128
- },
5129
- subscribe: (...args) => {
5130
- return coValueClass.subscribe(...args);
5131
- },
5132
- findUnique: (...args) => {
5133
- return coValueClass.findUnique(...args);
5134
- },
5135
- upsertUnique: (...args) => {
5136
- return coValueClass.upsertUnique(...args);
5137
- },
5138
- loadUnique: (...args) => {
5139
- return coValueClass.loadUnique(...args);
5140
- },
5141
- unstable_merge: (...args) => {
5142
- return unstable_mergeBranchWithResolve2(coValueClass, ...args);
5143
- },
5144
- catchall: (catchAll) => {
5145
- const schemaWithCatchAll = createCoreCoMapSchema(
5146
- coValueSchema.getDefinition().shape,
5147
- catchAll
5148
- );
5149
- return hydrateCoreCoValueSchema(schemaWithCatchAll);
5150
- },
5151
- withMigration: (migration) => {
5152
- coValueClass.prototype.migrate = migration;
5153
- return coValueSchema;
5154
- },
5155
- getCoValueClass: () => {
5156
- return coValueClass;
5157
- },
5158
- optional: () => {
5159
- return coOptionalDefiner(coValueSchema);
5160
- },
5161
- pick: (keys) => {
5162
- const keysSet = new Set(Object.keys(keys));
5163
- const pickedShape = {};
5164
- for (const [key, value] of Object.entries(coValueSchema.shape)) {
5165
- if (keysSet.has(key)) {
5166
- pickedShape[key] = value;
5167
- }
5168
- }
5169
- return coMapDefiner(pickedShape);
5170
- },
5171
- partial: (keys) => {
5172
- const partialShape = {};
5173
- for (const [key, value] of Object.entries(coValueSchema.shape)) {
5174
- if (keys && !keys[key]) {
5175
- partialShape[key] = value;
5176
- continue;
5177
- }
5178
- if (isAnyCoValueSchema2(value)) {
5179
- partialShape[key] = coOptionalDefiner(value);
5180
- } else {
5181
- partialShape[key] = z.optional(coValueSchema.shape[key]);
5182
- }
5183
- }
5184
- const partialCoMapSchema = coMapDefiner(partialShape);
5185
- if (coValueSchema.catchAll) {
5186
- return partialCoMapSchema.catchall(
5187
- coValueSchema.catchAll
5188
- );
5189
- }
5190
- return partialCoMapSchema;
5191
- }
5192
- });
5193
- return coValueSchema;
5194
- }
5195
5365
 
5196
5366
  // src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts
5197
- var CoListSchema = class {
5367
+ var CoListSchema = class _CoListSchema {
5198
5368
  constructor(element, coValueClass) {
5199
5369
  this.element = element;
5200
5370
  this.coValueClass = coValueClass;
5201
5371
  this.collaborative = true;
5202
5372
  this.builtin = "CoList";
5373
+ /**
5374
+ * Default resolve query to be used when loading instances of this schema.
5375
+ * This resolve query will be used when no resolve query is provided to the load method.
5376
+ * @default true
5377
+ */
5378
+ this.resolveQuery = true;
5203
5379
  }
5204
5380
  create(items, options) {
5205
5381
  return this.coValueClass.create(items, options);
5206
5382
  }
5207
5383
  load(id, options) {
5208
- return this.coValueClass.load(id, options);
5384
+ return this.coValueClass.load(
5385
+ id,
5386
+ // @ts-expect-error
5387
+ withSchemaResolveQuery(options, this.resolveQuery)
5388
+ );
5209
5389
  }
5210
5390
  unstable_merge(id, options) {
5211
- return unstable_mergeBranchWithResolve2(this.coValueClass, id, options);
5391
+ return unstable_mergeBranchWithResolve(
5392
+ this.coValueClass,
5393
+ id,
5394
+ // @ts-expect-error
5395
+ withSchemaResolveQuery(options, this.resolveQuery)
5396
+ );
5212
5397
  }
5213
5398
  subscribe(id, options, listener) {
5214
- return this.coValueClass.subscribe(id, options, listener);
5399
+ return this.coValueClass.subscribe(
5400
+ id,
5401
+ withSchemaResolveQuery(options, this.resolveQuery),
5402
+ listener
5403
+ );
5215
5404
  }
5216
5405
  getCoValueClass() {
5217
5406
  return this.coValueClass;
@@ -5221,42 +5410,81 @@ var CoListSchema = class {
5221
5410
  return this.coValueClass.findUnique(unique, ownerID, as);
5222
5411
  }
5223
5412
  upsertUnique(options) {
5224
- return this.coValueClass.upsertUnique(options);
5413
+ return this.coValueClass.upsertUnique(
5414
+ // @ts-expect-error
5415
+ withSchemaResolveQuery(options, this.resolveQuery)
5416
+ );
5225
5417
  }
5226
5418
  loadUnique(unique, ownerID, options) {
5227
- return this.coValueClass.loadUnique(unique, ownerID, options);
5419
+ return this.coValueClass.loadUnique(
5420
+ unique,
5421
+ ownerID,
5422
+ // @ts-expect-error
5423
+ withSchemaResolveQuery(options, this.resolveQuery)
5424
+ );
5228
5425
  }
5229
5426
  optional() {
5230
5427
  return coOptionalDefiner(this);
5231
5428
  }
5429
+ /**
5430
+ * Adds a default resolve query to be used when loading instances of this schema.
5431
+ * This resolve query will be used when no resolve query is provided to the load method.
5432
+ */
5433
+ resolved(resolveQuery) {
5434
+ const copy = new _CoListSchema(this.element, this.coValueClass);
5435
+ copy.resolveQuery = resolveQuery;
5436
+ return copy;
5437
+ }
5232
5438
  };
5233
5439
  function createCoreCoListSchema(element) {
5234
5440
  return {
5235
5441
  collaborative: true,
5236
5442
  builtin: "CoList",
5237
- element
5443
+ element,
5444
+ resolveQuery: true
5238
5445
  };
5239
5446
  }
5240
5447
 
5241
5448
  // src/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.ts
5242
- var CoFeedSchema = class {
5449
+ var CoFeedSchema = class _CoFeedSchema {
5243
5450
  constructor(element, coValueClass) {
5244
5451
  this.element = element;
5245
5452
  this.coValueClass = coValueClass;
5246
5453
  this.collaborative = true;
5247
5454
  this.builtin = "CoFeed";
5455
+ /**
5456
+ * Default resolve query to be used when loading instances of this schema.
5457
+ * This resolve query will be used when no resolve query is provided to the load method.
5458
+ * @default true
5459
+ */
5460
+ this.resolveQuery = true;
5248
5461
  }
5249
5462
  create(init, options) {
5250
5463
  return this.coValueClass.create(init, options);
5251
5464
  }
5252
5465
  load(id, options) {
5253
- return this.coValueClass.load(id, options);
5466
+ return this.coValueClass.load(
5467
+ id,
5468
+ // @ts-expect-error
5469
+ withSchemaResolveQuery(options, this.resolveQuery)
5470
+ );
5254
5471
  }
5255
5472
  unstable_merge(id, options) {
5256
- return unstable_mergeBranchWithResolve2(this.coValueClass, id, options);
5473
+ return unstable_mergeBranchWithResolve(
5474
+ this.coValueClass,
5475
+ id,
5476
+ // @ts-expect-error
5477
+ withSchemaResolveQuery(options, this.resolveQuery)
5478
+ );
5257
5479
  }
5258
- subscribe(...args) {
5259
- return this.coValueClass.subscribe(...args);
5480
+ subscribe(id, ...args) {
5481
+ const { options, listener } = parseSubscribeRestArgs(args);
5482
+ return this.coValueClass.subscribe(
5483
+ id,
5484
+ // @ts-expect-error
5485
+ withSchemaResolveQuery(options, this.resolveQuery),
5486
+ listener
5487
+ );
5260
5488
  }
5261
5489
  getCoValueClass() {
5262
5490
  return this.coValueClass;
@@ -5264,12 +5492,22 @@ var CoFeedSchema = class {
5264
5492
  optional() {
5265
5493
  return coOptionalDefiner(this);
5266
5494
  }
5495
+ /**
5496
+ * Adds a default resolve query to be used when loading instances of this schema.
5497
+ * This resolve query will be used when no resolve query is provided to the load method.
5498
+ */
5499
+ resolved(resolveQuery) {
5500
+ const copy = new _CoFeedSchema(this.element, this.coValueClass);
5501
+ copy.resolveQuery = resolveQuery;
5502
+ return copy;
5503
+ }
5267
5504
  };
5268
5505
  function createCoreCoFeedSchema(element) {
5269
5506
  return {
5270
5507
  collaborative: true,
5271
5508
  builtin: "CoFeed",
5272
- element
5509
+ element,
5510
+ resolveQuery: true
5273
5511
  };
5274
5512
  }
5275
5513
 
@@ -5277,7 +5515,8 @@ function createCoreCoFeedSchema(element) {
5277
5515
  function createCoreCoPlainTextSchema() {
5278
5516
  return {
5279
5517
  collaborative: true,
5280
- builtin: "CoPlainText"
5518
+ builtin: "CoPlainText",
5519
+ resolveQuery: true
5281
5520
  };
5282
5521
  }
5283
5522
  var PlainTextSchema = class {
@@ -5285,6 +5524,7 @@ var PlainTextSchema = class {
5285
5524
  this.coValueClass = coValueClass;
5286
5525
  this.collaborative = true;
5287
5526
  this.builtin = "CoPlainText";
5527
+ this.resolveQuery = true;
5288
5528
  }
5289
5529
  create(text, options) {
5290
5530
  return this.coValueClass.create(text, options);
@@ -5296,7 +5536,7 @@ var PlainTextSchema = class {
5296
5536
  return this.coValueClass.subscribe(...args);
5297
5537
  }
5298
5538
  unstable_merge(id, options) {
5299
- return unstable_mergeBranchWithResolve2(this.coValueClass, id, options);
5539
+ return unstable_mergeBranchWithResolve(this.coValueClass, id, options);
5300
5540
  }
5301
5541
  fromRaw(raw) {
5302
5542
  return this.coValueClass.fromRaw(raw);
@@ -5313,7 +5553,8 @@ var PlainTextSchema = class {
5313
5553
  function createCoreFileStreamSchema() {
5314
5554
  return {
5315
5555
  collaborative: true,
5316
- builtin: "FileStream"
5556
+ builtin: "FileStream",
5557
+ resolveQuery: true
5317
5558
  };
5318
5559
  }
5319
5560
  var FileStreamSchema = class {
@@ -5321,6 +5562,7 @@ var FileStreamSchema = class {
5321
5562
  this.coValueClass = coValueClass;
5322
5563
  this.collaborative = true;
5323
5564
  this.builtin = "FileStream";
5565
+ this.resolveQuery = true;
5324
5566
  }
5325
5567
  create(options) {
5326
5568
  return this.coValueClass.create(options);
@@ -5338,7 +5580,7 @@ var FileStreamSchema = class {
5338
5580
  return this.coValueClass.load(id, options);
5339
5581
  }
5340
5582
  unstable_merge(id, options) {
5341
- return unstable_mergeBranchWithResolve2(this.coValueClass, id, options);
5583
+ return unstable_mergeBranchWithResolve(this.coValueClass, id, options);
5342
5584
  }
5343
5585
  subscribe(...args) {
5344
5586
  return this.coValueClass.subscribe(...args);
@@ -5356,7 +5598,8 @@ function createCoreCoVectorSchema(dimensions) {
5356
5598
  return {
5357
5599
  collaborative: true,
5358
5600
  builtin: "CoVector",
5359
- dimensions
5601
+ dimensions,
5602
+ resolveQuery: true
5360
5603
  };
5361
5604
  }
5362
5605
  var CoVectorSchema = class {
@@ -5365,6 +5608,7 @@ var CoVectorSchema = class {
5365
5608
  this.coValueClass = coValueClass;
5366
5609
  this.collaborative = true;
5367
5610
  this.builtin = "CoVector";
5611
+ this.resolveQuery = true;
5368
5612
  }
5369
5613
  create(vector, options) {
5370
5614
  return this.coValueClass.create(vector, options);
@@ -5387,48 +5631,84 @@ var CoVectorSchema = class {
5387
5631
  };
5388
5632
 
5389
5633
  // src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts
5634
+ var AccountSchema = class _AccountSchema {
5635
+ constructor(coreSchema, coValueClass) {
5636
+ this.coValueClass = coValueClass;
5637
+ this.collaborative = true;
5638
+ this.builtin = "Account";
5639
+ /**
5640
+ * Default resolve query to be used when loading instances of this schema.
5641
+ * This resolve query will be used when no resolve query is provided to the load method.
5642
+ * @default true
5643
+ */
5644
+ this.resolveQuery = true;
5645
+ this.shape = coreSchema.shape;
5646
+ this.getDefinition = coreSchema.getDefinition;
5647
+ }
5648
+ create(options) {
5649
+ return this.coValueClass.create(options);
5650
+ }
5651
+ load(id, options) {
5652
+ return this.coValueClass.load(
5653
+ id,
5654
+ // @ts-expect-error
5655
+ withSchemaResolveQuery(options, this.resolveQuery)
5656
+ );
5657
+ }
5658
+ /** @internal */
5659
+ createAs(as, options) {
5660
+ return this.coValueClass.createAs(as, options);
5661
+ }
5662
+ unstable_merge(id, options) {
5663
+ return unstable_mergeBranchWithResolve(
5664
+ this.coValueClass,
5665
+ id,
5666
+ // @ts-expect-error
5667
+ withSchemaResolveQuery(options, this.resolveQuery)
5668
+ );
5669
+ }
5670
+ subscribe(id, options, listener) {
5671
+ return this.coValueClass.subscribe(
5672
+ id,
5673
+ // @ts-expect-error
5674
+ withSchemaResolveQuery(options, this.resolveQuery),
5675
+ listener
5676
+ );
5677
+ }
5678
+ getMe() {
5679
+ return this.coValueClass.getMe();
5680
+ }
5681
+ withMigration(migration) {
5682
+ this.coValueClass.prototype.migrate = async function(creationProps) {
5683
+ await migration(this, creationProps);
5684
+ };
5685
+ return this;
5686
+ }
5687
+ getCoValueClass() {
5688
+ return this.coValueClass;
5689
+ }
5690
+ optional() {
5691
+ return coOptionalDefiner(this);
5692
+ }
5693
+ /**
5694
+ * Adds a default resolve query to be used when loading instances of this schema.
5695
+ * This resolve query will be used when no resolve query is provided to the load method.
5696
+ */
5697
+ resolved(resolveQuery) {
5698
+ const coreSchema = createCoreAccountSchema(
5699
+ this.shape
5700
+ );
5701
+ const copy = new _AccountSchema(coreSchema, this.coValueClass);
5702
+ copy.resolveQuery = resolveQuery;
5703
+ return copy;
5704
+ }
5705
+ };
5390
5706
  function createCoreAccountSchema(shape) {
5391
5707
  return {
5392
5708
  ...createCoreCoMapSchema(shape),
5393
5709
  builtin: "Account"
5394
5710
  };
5395
5711
  }
5396
- function enrichAccountSchema(schema, coValueClass) {
5397
- const enrichedSchema = Object.assign(schema, {
5398
- create: (...args) => {
5399
- return coValueClass.create(...args);
5400
- },
5401
- createAs: (...args) => {
5402
- return coValueClass.createAs(...args);
5403
- },
5404
- getMe: (...args) => {
5405
- return coValueClass.getMe(...args);
5406
- },
5407
- load: (...args) => {
5408
- return coValueClass.load(...args);
5409
- },
5410
- subscribe: (...args) => {
5411
- return coValueClass.subscribe(...args);
5412
- },
5413
- fromRaw: (...args) => {
5414
- return coValueClass.fromRaw(...args);
5415
- },
5416
- unstable_merge: (...args) => {
5417
- return unstable_mergeBranchWithResolve(coValueClass, ...args);
5418
- },
5419
- withMigration: (migration) => {
5420
- coValueClass.prototype.migrate = async function(creationProps) {
5421
- await migration(this, creationProps);
5422
- };
5423
- return enrichedSchema;
5424
- },
5425
- getCoValueClass: () => {
5426
- return coValueClass;
5427
- },
5428
- optional: () => coOptionalDefiner(enrichedSchema)
5429
- });
5430
- return enrichedSchema;
5431
- }
5432
5712
 
5433
5713
  // src/tools/implementation/zodSchema/unionUtils.ts
5434
5714
  function schemaUnionDiscriminatorFor(schema) {
@@ -5465,10 +5745,20 @@ function schemaUnionDiscriminatorFor(schema) {
5465
5745
  }
5466
5746
  }
5467
5747
  const determineSchema = (discriminable) => {
5748
+ const allNestedRefKeys = /* @__PURE__ */ new Set();
5749
+ for (const option of availableOptions) {
5750
+ const coMapShape = option.getDefinition().shape;
5751
+ for (const [key, value] of Object.entries(coMapShape)) {
5752
+ if (isAnyCoValueSchema2(value)) {
5753
+ allNestedRefKeys.add(key);
5754
+ }
5755
+ }
5756
+ }
5468
5757
  for (const option of availableOptions) {
5469
5758
  let match = true;
5759
+ const optionDef = option.getDefinition();
5470
5760
  for (const key of Object.keys(discriminatorMap)) {
5471
- const discriminatorDef = option.getDefinition().shape[key];
5761
+ const discriminatorDef = optionDef.shape[key];
5472
5762
  const discriminatorValue = discriminable.get(key);
5473
5763
  if (discriminatorValue && typeof discriminatorValue === "object") {
5474
5764
  throw new Error("Discriminator must be a primitive value");
@@ -5492,7 +5782,19 @@ function schemaUnionDiscriminatorFor(schema) {
5492
5782
  }
5493
5783
  if (match) {
5494
5784
  const coValueSchema = hydrateCoreCoValueSchema(option);
5495
- return coValueSchema.getCoValueClass();
5785
+ const coValueClass = coValueSchema.getCoValueClass();
5786
+ const dummyFieldNames = allNestedRefKeys.keys().filter((key) => !optionDef.shape[key]).toArray();
5787
+ if (dummyFieldNames.length === 0) {
5788
+ return coValueClass;
5789
+ }
5790
+ return class extends coValueClass {
5791
+ constructor(...args) {
5792
+ super(...args);
5793
+ for (const key of dummyFieldNames) {
5794
+ this[key] = coField.null;
5795
+ }
5796
+ }
5797
+ };
5496
5798
  }
5497
5799
  }
5498
5800
  throw new Error(
@@ -5679,7 +5981,7 @@ function hydrateCoreCoValueSchema(schema) {
5679
5981
  }
5680
5982
  }
5681
5983
  };
5682
- const coValueSchema = ClassToExtend === Account ? enrichAccountSchema(schema, coValueClass) : enrichCoMapSchema(schema, coValueClass);
5984
+ const coValueSchema = ClassToExtend === Account ? new AccountSchema(schema, coValueClass) : new CoMapSchema(schema, coValueClass);
5683
5985
  return coValueSchema;
5684
5986
  } else if (schema.builtin === "CoList") {
5685
5987
  const element = schema.element;
@@ -6236,6 +6538,12 @@ globalThis.devtoolsFormatters = [
6236
6538
  function isCoValueClass(value) {
6237
6539
  return typeof value === "function" && value.fromRaw !== void 0;
6238
6540
  }
6541
+ function createUnloadedCoValue(id, loadingState) {
6542
+ return {
6543
+ $jazz: { id, loadingState },
6544
+ $isLoaded: false
6545
+ };
6546
+ }
6239
6547
  function loadCoValueWithoutMe(cls, id, options) {
6240
6548
  return loadCoValue(cls, id, {
6241
6549
  ...options,
@@ -6254,10 +6562,10 @@ function loadCoValue(cls, id, options) {
6254
6562
  syncResolution: true,
6255
6563
  skipRetry: options.skipRetry,
6256
6564
  onUnavailable: () => {
6257
- resolve(null);
6565
+ resolve(createUnloadedCoValue(id, CoValueLoadingState.UNAVAILABLE));
6258
6566
  },
6259
6567
  onUnauthorized: () => {
6260
- resolve(null);
6568
+ resolve(createUnloadedCoValue(id, CoValueLoadingState.UNAUTHORIZED));
6261
6569
  },
6262
6570
  unstable_branch: options.unstable_branch
6263
6571
  },
@@ -6278,7 +6586,7 @@ async function ensureCoValueLoaded(existing, options) {
6278
6586
  unstable_branch: options?.unstable_branch
6279
6587
  }
6280
6588
  );
6281
- if (!response) {
6589
+ if (!response.$isLoaded) {
6282
6590
  throw new Error("Failed to deeply load CoValue " + existing.$jazz.id);
6283
6591
  }
6284
6592
  return response;
@@ -6337,15 +6645,15 @@ function subscribeToCoValue(cls, id, options, listener) {
6337
6645
  );
6338
6646
  const handleUpdate = (value) => {
6339
6647
  if (unsubscribed) return;
6340
- if (value.type === "unavailable") {
6648
+ if (value.type === CoValueLoadingState.UNAVAILABLE) {
6341
6649
  options.onUnavailable?.();
6342
6650
  if (!options.skipRetry) {
6343
6651
  console.error(value.toString());
6344
6652
  }
6345
- } else if (value.type === "unauthorized") {
6653
+ } else if (value.type === CoValueLoadingState.UNAUTHORIZED) {
6346
6654
  options.onUnauthorized?.();
6347
6655
  console.error(value.toString());
6348
- } else if (value.type === "loaded") {
6656
+ } else if (value.type === CoValueLoadingState.LOADED) {
6349
6657
  listener(value.value, unsubscribe);
6350
6658
  }
6351
6659
  };
@@ -6431,10 +6739,8 @@ async function unstable_loadUnique(schema, options) {
6431
6739
  return internalLoadUnique(cls, {
6432
6740
  header,
6433
6741
  onCreateWhenMissing: options.onCreateWhenMissing,
6434
- // @ts-expect-error loaded is not compatible with Resolved at type level, but they are the same thing
6435
6742
  onUpdateWhenFound: options.onUpdateWhenFound,
6436
6743
  owner: options.owner,
6437
- // @ts-expect-error loaded is not compatible with Resolved at type level, but they are the same thing
6438
6744
  resolve: options.resolve
6439
6745
  });
6440
6746
  }
@@ -6442,7 +6748,7 @@ async function internalLoadUnique(cls, options) {
6442
6748
  const loadAs = options.owner.$jazz.loadedAs;
6443
6749
  const node = loadAs[TypeSym] === "Anonymous" ? loadAs.node : loadAs.$jazz.localNode;
6444
6750
  const id = cojsonInternals6.idforHeader(options.header, node.crypto);
6445
- await loadCoValueWithoutMe(cls, id, {
6751
+ const maybeLoadedCoValue = await loadCoValueWithoutMe(cls, id, {
6446
6752
  skipRetry: true,
6447
6753
  loadAs
6448
6754
  });
@@ -6455,14 +6761,14 @@ async function internalLoadUnique(cls, options) {
6455
6761
  });
6456
6762
  }
6457
6763
  if (!isAvailable) {
6458
- return null;
6764
+ return maybeLoadedCoValue;
6459
6765
  }
6460
6766
  if (options.onUpdateWhenFound) {
6461
6767
  const loaded = await loadCoValueWithoutMe(cls, id, {
6462
6768
  loadAs,
6463
6769
  resolve: options.resolve
6464
6770
  });
6465
- if (loaded) {
6771
+ if (loaded.$isLoaded) {
6466
6772
  options.onUpdateWhenFound(loaded);
6467
6773
  } else {
6468
6774
  return loaded;
@@ -6491,13 +6797,13 @@ async function exportCoValue(cls, id, options) {
6491
6797
  );
6492
6798
  const value = await new Promise((resolve2) => {
6493
6799
  rootNode.setListener((value2) => {
6494
- if (value2.type === "unavailable") {
6800
+ if (value2.type === CoValueLoadingState.UNAVAILABLE) {
6495
6801
  resolve2(null);
6496
6802
  console.error(value2.toString());
6497
- } else if (value2.type === "unauthorized") {
6803
+ } else if (value2.type === CoValueLoadingState.UNAUTHORIZED) {
6498
6804
  resolve2(null);
6499
6805
  console.error(value2.toString());
6500
- } else if (value2.type === "loaded") {
6806
+ } else if (value2.type === CoValueLoadingState.LOADED) {
6501
6807
  resolve2(value2.value);
6502
6808
  }
6503
6809
  rootNode.destroy();
@@ -6516,8 +6822,9 @@ function loadContentPiecesFromSubscription(subscription, valuesExported, content
6516
6822
  return;
6517
6823
  }
6518
6824
  valuesExported.add(subscription.id);
6519
- const core2 = subscription.getCurrentValue()?.$jazz.raw.core;
6520
- if (core2) {
6825
+ const currentValue = subscription.getCurrentValue();
6826
+ if (typeof currentValue !== "string") {
6827
+ const core2 = currentValue.$jazz.raw.core;
6521
6828
  loadContentPiecesFromCoValue(core2, valuesExported, contentPieces);
6522
6829
  }
6523
6830
  for (const child of subscription.childNodes.values()) {
@@ -6552,7 +6859,7 @@ function unstable_mergeBranch(subscriptionScope) {
6552
6859
  return;
6553
6860
  }
6554
6861
  function handleMerge(subscriptionNode) {
6555
- if (subscriptionNode.value.type === "loaded") {
6862
+ if (subscriptionNode.value.type === CoValueLoadingState.LOADED) {
6556
6863
  subscriptionNode.value.value.$jazz.raw.core.mergeBranch();
6557
6864
  }
6558
6865
  for (const childNode of subscriptionNode.childNodes.values()) {
@@ -6561,7 +6868,7 @@ function unstable_mergeBranch(subscriptionScope) {
6561
6868
  }
6562
6869
  handleMerge(subscriptionScope);
6563
6870
  }
6564
- async function unstable_mergeBranchWithResolve2(cls, id, options) {
6871
+ async function unstable_mergeBranchWithResolve(cls, id, options) {
6565
6872
  const loadAs = options.loadAs ?? activeAccountContext3.get();
6566
6873
  const node = "node" in loadAs ? loadAs.node : loadAs.$jazz.localNode;
6567
6874
  const resolve = options.resolve ?? true;
@@ -6579,11 +6886,11 @@ async function unstable_mergeBranchWithResolve2(cls, id, options) {
6579
6886
  );
6580
6887
  await new Promise((resolve2, reject) => {
6581
6888
  rootNode.setListener((value) => {
6582
- if (value.type === "unavailable") {
6889
+ if (value.type === CoValueLoadingState.UNAVAILABLE) {
6583
6890
  reject(new Error("Unable to load the branch. " + value.toString()));
6584
- } else if (value.type === "unauthorized") {
6891
+ } else if (value.type === CoValueLoadingState.UNAUTHORIZED) {
6585
6892
  reject(new Error("Unable to load the branch. " + value.toString()));
6586
- } else if (value.type === "loaded") {
6893
+ } else if (value.type === CoValueLoadingState.LOADED) {
6587
6894
  resolve2();
6588
6895
  }
6589
6896
  rootNode.destroy();
@@ -6594,6 +6901,7 @@ async function unstable_mergeBranchWithResolve2(cls, id, options) {
6594
6901
 
6595
6902
  export {
6596
6903
  zodReExport_exports,
6904
+ createUnloadedCoValue,
6597
6905
  loadCoValue,
6598
6906
  subscribeToCoValue,
6599
6907
  unstable_loadUnique,
@@ -6609,6 +6917,8 @@ export {
6609
6917
  Group2 as Group,
6610
6918
  Profile,
6611
6919
  isCoValueId,
6920
+ assertLoaded,
6921
+ getLoadedOrUndefined,
6612
6922
  Inbox,
6613
6923
  InboxSender,
6614
6924
  CoPlainText,
@@ -6619,6 +6929,7 @@ export {
6619
6929
  Ref,
6620
6930
  Encoders,
6621
6931
  coField,
6932
+ CoValueLoadingState,
6622
6933
  SubscriptionScope,
6623
6934
  randomSessionProvider,
6624
6935
  createJazzContextFromExistingCredentials,
@@ -6635,4 +6946,4 @@ export {
6635
6946
  JazzContextManager
6636
6947
  };
6637
6948
  /* istanbul ignore file -- @preserve */
6638
- //# sourceMappingURL=chunk-OSQ7S47Q.js.map
6949
+ //# sourceMappingURL=chunk-NCNM6UDZ.js.map