jazz-tools 0.20.1 → 0.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/.turbo/turbo-build.log +49 -49
  2. package/CHANGELOG.md +19 -6
  3. package/dist/{chunk-2OPP7KWV.js → chunk-Q5RNSSUM.js} +121 -22
  4. package/dist/chunk-Q5RNSSUM.js.map +1 -0
  5. package/dist/index.js +1 -1
  6. package/dist/inspector/{chunk-MCTB5ZJC.js → chunk-6JPVMI3V.js} +302 -182
  7. package/dist/inspector/chunk-6JPVMI3V.js.map +1 -0
  8. package/dist/inspector/{custom-element-5YWVZBWA.js → custom-element-WOQY2M4W.js} +1337 -206
  9. package/dist/inspector/custom-element-WOQY2M4W.js.map +1 -0
  10. package/dist/inspector/in-app.d.ts +1 -0
  11. package/dist/inspector/in-app.d.ts.map +1 -1
  12. package/dist/inspector/index.d.ts +1 -0
  13. package/dist/inspector/index.d.ts.map +1 -1
  14. package/dist/inspector/index.js +1044 -17
  15. package/dist/inspector/index.js.map +1 -1
  16. package/dist/inspector/pages/home.d.ts +4 -1
  17. package/dist/inspector/pages/home.d.ts.map +1 -1
  18. package/dist/inspector/pages/performance/PerformancePage.d.ts +7 -0
  19. package/dist/inspector/pages/performance/PerformancePage.d.ts.map +1 -0
  20. package/dist/inspector/pages/performance/SubscriptionDetailPanel.d.ts +8 -0
  21. package/dist/inspector/pages/performance/SubscriptionDetailPanel.d.ts.map +1 -0
  22. package/dist/inspector/pages/performance/SubscriptionRow.d.ts +11 -0
  23. package/dist/inspector/pages/performance/SubscriptionRow.d.ts.map +1 -0
  24. package/dist/inspector/pages/performance/Timeline.d.ts +12 -0
  25. package/dist/inspector/pages/performance/Timeline.d.ts.map +1 -0
  26. package/dist/inspector/pages/performance/helpers.d.ts +5 -0
  27. package/dist/inspector/pages/performance/helpers.d.ts.map +1 -0
  28. package/dist/inspector/pages/performance/index.d.ts +3 -0
  29. package/dist/inspector/pages/performance/index.d.ts.map +1 -0
  30. package/dist/inspector/pages/performance/types.d.ts +13 -0
  31. package/dist/inspector/pages/performance/types.d.ts.map +1 -0
  32. package/dist/inspector/pages/performance/usePerformanceEntries.d.ts +3 -0
  33. package/dist/inspector/pages/performance/usePerformanceEntries.d.ts.map +1 -0
  34. package/dist/inspector/register-custom-element.js +3 -1
  35. package/dist/inspector/register-custom-element.js.map +1 -1
  36. package/dist/inspector/standalone.js +1 -1
  37. package/dist/inspector/tests/pages/performance/PerformancePage.test.d.ts +2 -0
  38. package/dist/inspector/tests/pages/performance/PerformancePage.test.d.ts.map +1 -0
  39. package/dist/inspector/tests/pages/performance/SubscriptionDetailPanel.test.d.ts +2 -0
  40. package/dist/inspector/tests/pages/performance/SubscriptionDetailPanel.test.d.ts.map +1 -0
  41. package/dist/inspector/tests/pages/performance/SubscriptionRow.test.d.ts +2 -0
  42. package/dist/inspector/tests/pages/performance/SubscriptionRow.test.d.ts.map +1 -0
  43. package/dist/inspector/tests/pages/performance/Timeline.test.d.ts +2 -0
  44. package/dist/inspector/tests/pages/performance/Timeline.test.d.ts.map +1 -0
  45. package/dist/inspector/tests/pages/performance/helpers.test.d.ts +2 -0
  46. package/dist/inspector/tests/pages/performance/helpers.test.d.ts.map +1 -0
  47. package/dist/inspector/viewer/delete-local-data.d.ts.map +1 -1
  48. package/dist/inspector/viewer/header.d.ts +4 -2
  49. package/dist/inspector/viewer/header.d.ts.map +1 -1
  50. package/dist/inspector/viewer/page-stack.d.ts +3 -1
  51. package/dist/inspector/viewer/page-stack.d.ts.map +1 -1
  52. package/dist/react-core/hooks.d.ts +2 -2
  53. package/dist/react-core/hooks.d.ts.map +1 -1
  54. package/dist/react-core/index.js +50 -18
  55. package/dist/react-core/index.js.map +1 -1
  56. package/dist/react-core/subscription-provider.d.ts.map +1 -1
  57. package/dist/react-native-core/media/image.d.ts +1 -1
  58. package/dist/svelte/jazz.class.svelte.d.ts.map +1 -1
  59. package/dist/svelte/jazz.class.svelte.js +27 -22
  60. package/dist/testing.js +1 -1
  61. package/dist/tools/coValues/interfaces.d.ts.map +1 -1
  62. package/dist/tools/exports.d.ts +1 -1
  63. package/dist/tools/exports.d.ts.map +1 -1
  64. package/dist/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.d.ts.map +1 -1
  65. package/dist/tools/subscribe/SubscriptionCache.d.ts +2 -2
  66. package/dist/tools/subscribe/SubscriptionCache.d.ts.map +1 -1
  67. package/dist/tools/subscribe/SubscriptionScope.d.ts +19 -12
  68. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  69. package/dist/tools/subscribe/errorReporting.d.ts +6 -0
  70. package/dist/tools/subscribe/errorReporting.d.ts.map +1 -1
  71. package/dist/tools/subscribe/index.d.ts +4 -4
  72. package/dist/tools/subscribe/index.d.ts.map +1 -1
  73. package/dist/tools/subscribe/types.d.ts +48 -3
  74. package/dist/tools/subscribe/types.d.ts.map +1 -1
  75. package/dist/tools/subscribe/utils.d.ts +1 -1
  76. package/dist/tools/subscribe/utils.d.ts.map +1 -1
  77. package/dist/tools/tests/SubscriptionScope.performance.test.d.ts +2 -0
  78. package/dist/tools/tests/SubscriptionScope.performance.test.d.ts.map +1 -0
  79. package/package.json +4 -4
  80. package/src/inspector/in-app.tsx +41 -3
  81. package/src/inspector/index.tsx +5 -1
  82. package/src/inspector/pages/home.tsx +26 -3
  83. package/src/inspector/pages/performance/PerformancePage.tsx +215 -0
  84. package/src/inspector/pages/performance/SubscriptionDetailPanel.tsx +182 -0
  85. package/src/inspector/pages/performance/SubscriptionRow.tsx +242 -0
  86. package/src/inspector/pages/performance/Timeline.tsx +513 -0
  87. package/src/inspector/pages/performance/helpers.ts +70 -0
  88. package/src/inspector/pages/performance/index.ts +2 -0
  89. package/src/inspector/pages/performance/types.ts +12 -0
  90. package/src/inspector/pages/performance/usePerformanceEntries.ts +53 -0
  91. package/src/inspector/register-custom-element.ts +3 -0
  92. package/src/inspector/tests/pages/performance/PerformancePage.test.tsx +83 -0
  93. package/src/inspector/tests/pages/performance/SubscriptionDetailPanel.test.tsx +68 -0
  94. package/src/inspector/tests/pages/performance/SubscriptionRow.test.tsx +93 -0
  95. package/src/inspector/tests/pages/performance/Timeline.test.tsx +57 -0
  96. package/src/inspector/tests/pages/performance/helpers.test.ts +91 -0
  97. package/src/inspector/viewer/delete-local-data.tsx +24 -5
  98. package/src/inspector/viewer/header.tsx +96 -17
  99. package/src/inspector/viewer/page-stack.tsx +22 -18
  100. package/src/react-core/hooks.ts +34 -4
  101. package/src/react-core/subscription-provider.tsx +17 -8
  102. package/src/svelte/jazz.class.svelte.ts +51 -33
  103. package/src/tools/coValues/interfaces.ts +3 -0
  104. package/src/tools/exports.ts +1 -0
  105. package/src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts +13 -0
  106. package/src/tools/subscribe/SubscriptionCache.ts +6 -4
  107. package/src/tools/subscribe/SubscriptionScope.ts +141 -23
  108. package/src/tools/subscribe/errorReporting.ts +1 -1
  109. package/src/tools/subscribe/index.ts +1 -1
  110. package/src/tools/subscribe/types.ts +62 -9
  111. package/src/tools/subscribe/utils.ts +2 -2
  112. package/src/tools/tests/SubscriptionScope.performance.test.ts +149 -0
  113. package/dist/chunk-2OPP7KWV.js.map +0 -1
  114. package/dist/inspector/chunk-MCTB5ZJC.js.map +0 -1
  115. package/dist/inspector/custom-element-5YWVZBWA.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.20.1 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.20.3 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types && pnpm build:svelte && pnpm build:better-auth-svelte
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts","tools/ssr":"src/tools/ssr/index.ts"}
@@ -107,23 +107,23 @@
107
107
  ESM Build start
108
108
  CLI Cleaning output folder
109
109
  ESM Build start
110
- ESM dist/better-auth/auth/client.js 4.54 KB
111
- ESM dist/better-auth/auth/server.js 8.40 KB
112
- ESM dist/better-auth/auth/react.js 813.00 B
113
- ESM dist/better-auth/auth/client.js.map 8.44 KB
114
- ESM dist/better-auth/auth/server.js.map 15.40 KB
115
- ESM dist/better-auth/auth/react.js.map 2.07 KB
116
- ESM ⚡️ Build success in 24ms
117
- ESM dist/tiptap/index.js 564.00 B
118
- ESM dist/tiptap/index.js.map 1.21 KB
119
- ESM ⚡️ Build success in 32ms
120
110
  ESM dist/worker/index.js 3.45 KB
121
111
  ESM dist/worker/edge-wasm.js 259.00 B
122
112
  ESM dist/worker/napi-crypto.js 110.00 B
123
113
  ESM dist/worker/index.js.map 6.97 KB
124
114
  ESM dist/worker/edge-wasm.js.map 505.00 B
125
115
  ESM dist/worker/napi-crypto.js.map 162.00 B
116
+ ESM ⚡️ Build success in 30ms
117
+ ESM dist/tiptap/index.js 564.00 B
118
+ ESM dist/tiptap/index.js.map 1.21 KB
126
119
  ESM ⚡️ Build success in 34ms
120
+ ESM dist/better-auth/auth/client.js 4.54 KB
121
+ ESM dist/better-auth/auth/server.js 8.40 KB
122
+ ESM dist/better-auth/auth/react.js 813.00 B
123
+ ESM dist/better-auth/auth/server.js.map 15.40 KB
124
+ ESM dist/better-auth/auth/react.js.map 2.07 KB
125
+ ESM dist/better-auth/auth/client.js.map 8.44 KB
126
+ ESM ⚡️ Build success in 26ms
127
127
  ESM dist/media/index.js 236.00 B
128
128
  ESM dist/media/index.browser.js 2.79 KB
129
129
  ESM dist/media/index.native.js 4.04 KB
@@ -134,85 +134,85 @@
134
134
  ESM dist/media/index.native.js.map 8.17 KB
135
135
  ESM dist/media/index.server.js.map 6.37 KB
136
136
  ESM dist/media/chunk-IRL3KNPO.js.map 17.00 KB
137
- ESM ⚡️ Build success in 39ms
137
+ ESM ⚡️ Build success in 42ms
138
138
  ESM dist/expo/index.js 4.70 KB
139
139
  ESM dist/expo/testing.js 112.00 B
140
140
  ESM dist/expo/polyfills.js 858.00 B
141
141
  ESM dist/expo/index.js.map 10.26 KB
142
142
  ESM dist/expo/testing.js.map 168.00 B
143
143
  ESM dist/expo/polyfills.js.map 1.61 KB
144
- ESM ⚡️ Build success in 33ms
145
- ESM dist/react-core/index.js 17.38 KB
144
+ ESM ⚡️ Build success in 36ms
145
+ ESM dist/react-core/index.js 17.87 KB
146
146
  ESM dist/react-core/testing.js 904.00 B
147
147
  ESM dist/react-core/chunk-UOYH6JFJ.js 189.00 B
148
- ESM dist/react-core/index.js.map 57.66 KB
148
+ ESM dist/react-core/index.js.map 58.59 KB
149
149
  ESM dist/react-core/testing.js.map 1.34 KB
150
150
  ESM dist/react-core/chunk-UOYH6JFJ.js.map 363.00 B
151
- ESM ⚡️ Build success in 56ms
151
+ ESM ⚡️ Build success in 45ms
152
+ ESM dist/browser/index.js 15.96 KB
153
+ ESM dist/browser/index.js.map 34.06 KB
154
+ ESM ⚡️ Build success in 53ms
152
155
  ESM dist/prosemirror/index.js 77.76 KB
153
156
  ESM dist/prosemirror/index.js.map 307.20 KB
154
- ESM ⚡️ Build success in 57ms
157
+ ESM ⚡️ Build success in 63ms
155
158
  ESM dist/better-auth/database-adapter/index.js 26.65 KB
156
159
  ESM dist/better-auth/database-adapter/index.js.map 58.27 KB
157
- ESM ⚡️ Build success in 47ms
158
- ESM dist/browser/index.js 15.96 KB
159
- ESM dist/browser/index.js.map 34.06 KB
160
- ESM ⚡️ Build success in 61ms
161
- ESM dist/react-native-core/index.js 34.14 KB
162
- ESM dist/react-native-core/testing.js 119.00 B
163
- ESM dist/react-native-core/index.js.map 68.45 KB
164
- ESM dist/react-native-core/testing.js.map 175.00 B
165
- ESM ⚡️ Build success in 63ms
160
+ ESM ⚡️ Build success in 56ms
166
161
  ESM dist/react/index.js 26.02 KB
167
162
  ESM dist/react/testing.js 122.00 B
168
163
  ESM dist/react/ssr.js 693.00 B
169
164
  ESM dist/react/index.js.map 55.45 KB
170
165
  ESM dist/react/testing.js.map 165.00 B
171
166
  ESM dist/react/ssr.js.map 1.10 KB
172
- ESM ⚡️ Build success in 62ms
167
+ ESM ⚡️ Build success in 59ms
168
+ ESM dist/react-native-core/testing.js 119.00 B
169
+ ESM dist/react-native-core/index.js 34.14 KB
170
+ ESM dist/react-native-core/testing.js.map 175.00 B
171
+ ESM dist/react-native-core/index.js.map 68.45 KB
172
+ ESM ⚡️ Build success in 68ms
173
173
  ESM dist/react-native/index.js 36.68 KB
174
174
  ESM dist/react-native/testing.js 120.00 B
175
175
  ESM dist/react-native/polyfills.js 858.00 B
176
176
  ESM dist/react-native/index.js.map 74.00 KB
177
- ESM dist/react-native/testing.js.map 176.00 B
178
177
  ESM dist/react-native/polyfills.js.map 1.61 KB
179
- ESM ⚡️ Build success in 75ms
180
- ESM dist/inspector/index.js 6.30 KB
178
+ ESM dist/react-native/testing.js.map 176.00 B
179
+ ESM ⚡️ Build success in 70ms
180
+ ESM dist/inspector/index.js 37.43 KB
181
181
  ESM dist/inspector/standalone.js 12.61 KB
182
- ESM dist/inspector/chunk-MCTB5ZJC.js 127.21 KB
183
- ESM dist/inspector/index.js.map 9.66 KB
182
+ ESM dist/inspector/chunk-6JPVMI3V.js 130.10 KB
183
+ ESM dist/inspector/index.js.map 63.71 KB
184
184
  ESM dist/inspector/standalone.js.map 20.11 KB
185
- ESM dist/inspector/chunk-MCTB5ZJC.js.map 221.22 KB
186
- ESM ⚡️ Build success in 86ms
187
- ESM dist/index.js 32.17 KB
185
+ ESM dist/inspector/chunk-6JPVMI3V.js.map 225.43 KB
186
+ ESM ⚡️ Build success in 92ms
188
187
  ESM dist/testing.js 8.56 KB
189
- ESM dist/chunk-2OPP7KWV.js 234.52 KB
188
+ ESM dist/index.js 32.17 KB
190
189
  ESM dist/tools/ssr.js 156.00 B
191
- ESM dist/chunk-K4D7IMFM.js 690.00 B
192
190
  ESM dist/chunk-ZQWSQH6L.js 945.00 B
193
- ESM dist/index.js.map 65.34 KB
191
+ ESM dist/chunk-K4D7IMFM.js 690.00 B
192
+ ESM dist/chunk-Q5RNSSUM.js 237.30 KB
194
193
  ESM dist/testing.js.map 16.22 KB
195
194
  ESM dist/tools/ssr.js.map 71.00 B
196
- ESM dist/chunk-K4D7IMFM.js.map 1.10 KB
197
195
  ESM dist/chunk-ZQWSQH6L.js.map 71.00 B
198
- ESM dist/chunk-2OPP7KWV.js.map 550.64 KB
199
- ESM ⚡️ Build success in 108ms
200
- ESM dist/inspector/register-custom-element.js 218.00 B
201
- ESM dist/inspector/custom-element-5YWVZBWA.js 1.60 MB
202
- ESM dist/inspector/register-custom-element.js.map 314.00 B
203
- ESM dist/inspector/custom-element-5YWVZBWA.js.map 2.47 MB
204
- ESM ⚡️ Build success in 140ms
196
+ ESM dist/index.js.map 65.34 KB
197
+ ESM dist/chunk-K4D7IMFM.js.map 1.10 KB
198
+ ESM dist/chunk-Q5RNSSUM.js.map 558.08 KB
199
+ ESM ⚡️ Build success in 121ms
200
+ ESM dist/inspector/register-custom-element.js 305.00 B
201
+ ESM dist/inspector/register-custom-element.js.map 445.00 B
202
+ ESM dist/inspector/custom-element-WOQY2M4W.js 1.64 MB
203
+ ESM dist/inspector/custom-element-WOQY2M4W.js.map 2.52 MB
204
+ ESM ⚡️ Build success in 143ms
205
205
 
206
- > jazz-tools@0.20.1 types /home/runner/_work/jazz/jazz/packages/jazz-tools
206
+ > jazz-tools@0.20.3 types /home/runner/_work/jazz/jazz/packages/jazz-tools
207
207
  > tsc --outDir dist
208
208
 
209
209
 
210
- > jazz-tools@0.20.1 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
210
+ > jazz-tools@0.20.3 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
211
211
  > rm -rf dist/svelte && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json
212
212
 
213
213
  src/svelte -> dist/svelte
214
214
 
215
- > jazz-tools@0.20.1 build:better-auth-svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
215
+ > jazz-tools@0.20.3 build:better-auth-svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
216
216
  > mkdir -p dist/better-auth/auth && svelte-package -i src/better-auth/auth -o dist/better-auth/auth-temp --tsconfig tsconfig.svelte.json && cp dist/better-auth/auth-temp/svelte.svelte dist/better-auth/auth/svelte.svelte && cp dist/better-auth/auth-temp/svelte.svelte.d.ts dist/better-auth/auth/svelte.d.ts && rm -rf dist/better-auth/auth-temp
217
217
 
218
218
  src/better-auth/auth -> dist/better-auth/auth-temp
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.20.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [eca8b83]
8
+ - cojson@0.20.3
9
+ - cojson-storage-indexeddb@0.20.3
10
+ - cojson-transport-ws@0.20.3
11
+
12
+ ## 0.20.2
13
+
14
+ ### Patch Changes
15
+
16
+ - 2df568f: Added a Performance tab in the Jazz tools inspector
17
+ - Updated dependencies [251a89e]
18
+ - cojson@0.20.2
19
+ - cojson-storage-indexeddb@0.20.2
20
+ - cojson-transport-ws@0.20.2
21
+
3
22
  ## 0.20.1
4
23
 
5
24
  ### Patch Changes
@@ -18,7 +37,6 @@
18
37
  - ee19292: Removed `JazzContextManagerContext` and added error when nesting `JazzProvider` components. This prevents bad patterns like nested providers and simplifies the alternative approach of using `JazzContext.Provider` directly with `useJazzContext()`.
19
38
 
20
39
  ### Breaking changes
21
-
22
40
  - Removed `JazzContextManagerContext` export from `jazz-tools/react-core`
23
41
  - Renamed `useJazzContext` to `useJazzContextValue` (returns the context value)
24
42
  - `useJazzContext` now returns the context manager instead of the context value
@@ -51,7 +69,6 @@
51
69
  ## 💥 Breaking changes
52
70
 
53
71
  ### Crypto providers / fallback behavior
54
-
55
72
  - **Removed `PureJSCrypto`** from `cojson` (including the `cojson/crypto/PureJSCrypto` export).
56
73
  - **Removed `RNQuickCrypto`** from `jazz-tools`.
57
74
  - **No more fallback to JavaScript crypto**: if crypto fails to initialize, Jazz now throws an error instead of falling back silently.
@@ -62,7 +79,6 @@
62
79
  ### Patch Changes
63
80
 
64
81
  - 6b9368a: Added `deleteCoValues` function to permanently delete CoValues and their nested references.
65
-
66
82
  - CoValues are marked with a tombstone, making them inaccessible to all users
67
83
  - Supports deleting nested CoValues via resolve queries
68
84
  - Requires admin permissions on the CoValue's group
@@ -557,7 +573,6 @@
557
573
  ### Patch Changes
558
574
 
559
575
  - f2f478a: Add connection status API for React and Svelte
560
-
561
576
  - **React**: Added `useSyncConnectionStatus()` hook that returns the current connection status to the Jazz sync server
562
577
  - **Svelte**: Added `SyncConnectionStatus` class that provides reactive connection status monitoring
563
578
 
@@ -593,7 +608,6 @@
593
608
  ### Patch Changes
594
609
 
595
610
  - a584ab3: Add WasmCrypto support for Cloudflare Workers and edge runtimes by importing `jazz-tools/load-edge-wasm`.
596
-
597
611
  - Enable WasmCrypto functionality by initializing the WebAssembly environment with the import: `import "jazz-tools/load-edge-wasm"` in edge runtimes.
598
612
  - Guarantee compatibility across Cloudflare Workers and other edge runtime environments.
599
613
 
@@ -977,7 +991,6 @@
977
991
  - 3cd1586: Makes the key rotation not fail when child groups are unavailable or their readkey is not accessible.
978
992
 
979
993
  Also changes the Group.removeMember method to not return a Promise, because:
980
-
981
994
  - All the locally available child groups are rotated immediately
982
995
  - All the remote child groups are rotated in background, but since they are not locally available the user won't need the new key immediately
983
996
 
@@ -2413,17 +2413,17 @@ var _Account = class _Account extends CoValueBase {
2413
2413
  * @deprecated Use `co.account(...).createAs` instead.
2414
2414
  */
2415
2415
  static async createAs(worker, options) {
2416
- const crypto = worker.$jazz.localNode.crypto;
2416
+ const crypto2 = worker.$jazz.localNode.crypto;
2417
2417
  const connectedPeers = cojsonInternals2.connectedPeers(
2418
2418
  "creatingAccount",
2419
- crypto.uniquenessForHeader(),
2419
+ crypto2.uniquenessForHeader(),
2420
2420
  // Use a unique id for the client peer, so we don't have clashes in the worker node
2421
2421
  { peer1role: "server", peer2role: "client" }
2422
2422
  );
2423
2423
  worker.$jazz.localNode.syncManager.addPeer(connectedPeers[1]);
2424
2424
  const account = await this.create({
2425
2425
  creationProps: options.creationProps,
2426
- crypto,
2426
+ crypto: crypto2,
2427
2427
  peers: [connectedPeers[0]]
2428
2428
  });
2429
2429
  const credentials = {
@@ -4332,7 +4332,7 @@ function isEqualRefsToResolve(a, b) {
4332
4332
  }
4333
4333
 
4334
4334
  // src/tools/subscribe/SubscriptionScope.ts
4335
- var SubscriptionScope = class _SubscriptionScope {
4335
+ var _SubscriptionScope = class _SubscriptionScope {
4336
4336
  constructor(node, resolve, id, schema, skipRetry = false, bestEffortResolution = false, unstable_branch, callerStack) {
4337
4337
  this.node = node;
4338
4338
  this.id = id;
@@ -4396,6 +4396,93 @@ var SubscriptionScope = class _SubscriptionScope {
4396
4396
  this.unstable_branch
4397
4397
  );
4398
4398
  }
4399
+ static setProfilingEnabled(enabled) {
4400
+ this.isProfilingEnabled = enabled;
4401
+ }
4402
+ static enableProfiling() {
4403
+ this.isProfilingEnabled = true;
4404
+ }
4405
+ trackLoadingPerformance(source) {
4406
+ if (!_SubscriptionScope.isProfilingEnabled) {
4407
+ return;
4408
+ }
4409
+ if (this.performanceUuid) {
4410
+ return;
4411
+ }
4412
+ const currentState = this.getCurrentRawValue();
4413
+ this.performanceUuid = crypto.randomUUID();
4414
+ this.performanceSource = source;
4415
+ const detail = {
4416
+ type: "jazz-subscription",
4417
+ uuid: this.performanceUuid,
4418
+ id: this.id,
4419
+ source,
4420
+ resolve: this.resolve,
4421
+ status: "pending",
4422
+ startTime: performance.now(),
4423
+ callerStack: this.callerStack?.stack
4424
+ };
4425
+ performance.mark(`jazz.subscription.start:${this.performanceUuid}`, {
4426
+ detail
4427
+ });
4428
+ if (currentState !== CoValueLoadingState.LOADING) {
4429
+ this.emitLoadingComplete(currentState);
4430
+ return;
4431
+ }
4432
+ const unsubscribe = this.subscribe(() => {
4433
+ const rawValue = this.getCurrentRawValue();
4434
+ if (rawValue === CoValueLoadingState.LOADING) {
4435
+ return;
4436
+ }
4437
+ this.emitLoadingComplete(rawValue);
4438
+ unsubscribe();
4439
+ });
4440
+ }
4441
+ emitLoadingComplete(rawValue) {
4442
+ if (!this.performanceUuid) return;
4443
+ const isError = typeof rawValue === "string";
4444
+ const endTime = performance.now();
4445
+ let errorType;
4446
+ if (isError) {
4447
+ if (rawValue === CoValueLoadingState.UNAVAILABLE || rawValue === CoValueLoadingState.UNAUTHORIZED || rawValue === CoValueLoadingState.DELETED) {
4448
+ errorType = rawValue;
4449
+ }
4450
+ }
4451
+ const detail = {
4452
+ type: "jazz-subscription",
4453
+ uuid: this.performanceUuid,
4454
+ id: this.id,
4455
+ source: this.performanceSource ?? "unknown",
4456
+ resolve: this.resolve,
4457
+ status: isError ? "error" : "loaded",
4458
+ startTime: 0,
4459
+ // Will be calculated from measure
4460
+ endTime,
4461
+ errorType,
4462
+ devtools: {
4463
+ track: "Jazz \u{1F3B6}",
4464
+ properties: [
4465
+ ["id", this.id],
4466
+ ["source", this.performanceSource ?? "unknown"]
4467
+ ],
4468
+ tooltipText: this.getCreationStackLines(false)
4469
+ }
4470
+ };
4471
+ performance.mark(`jazz.subscription.end:${this.performanceUuid}`, {
4472
+ detail
4473
+ });
4474
+ try {
4475
+ performance.measure(
4476
+ `${detail.source}(${this.id}, ${JSON.stringify(this.resolve)})`,
4477
+ {
4478
+ start: `jazz.subscription.start:${this.performanceUuid}`,
4479
+ end: `jazz.subscription.end:${this.performanceUuid}`,
4480
+ detail
4481
+ }
4482
+ );
4483
+ } catch {
4484
+ }
4485
+ }
4399
4486
  updateValue(value) {
4400
4487
  this.value = value;
4401
4488
  this.dirty = true;
@@ -4627,7 +4714,7 @@ var SubscriptionScope = class _SubscriptionScope {
4627
4714
  }
4628
4715
  return CoValueLoadingState.LOADING;
4629
4716
  }
4630
- getCreationStackLines() {
4717
+ getCreationStackLines(fullFrame = true) {
4631
4718
  const stack = this.callerStack?.stack;
4632
4719
  if (!stack) {
4633
4720
  return "";
@@ -4640,6 +4727,9 @@ var SubscriptionScope = class _SubscriptionScope {
4640
4727
  if (creationAppFrame) {
4641
4728
  result += "Subscription created ", result += creationAppFrame.trim();
4642
4729
  }
4730
+ if (!fullFrame) {
4731
+ return result;
4732
+ }
4643
4733
  result += "\nFull subscription creation stack:";
4644
4734
  for (const line of creationStackLines.slice(0, 8)) {
4645
4735
  result += "\n " + line.trim();
@@ -4994,6 +5084,8 @@ var SubscriptionScope = class _SubscriptionScope {
4994
5084
  this.childNodes.forEach((child) => child.destroy());
4995
5085
  }
4996
5086
  };
5087
+ _SubscriptionScope.isProfilingEnabled = isDev;
5088
+ var SubscriptionScope = _SubscriptionScope;
4997
5089
  function hasAccessToCoValue(rawCoValue) {
4998
5090
  const ruleset = rawCoValue.core.verified.header.ruleset;
4999
5091
  return ruleset.type !== "ownedByGroup" || myRoleForRawValue(rawCoValue) !== void 0;
@@ -5060,9 +5152,9 @@ import {
5060
5152
  LocalNode as LocalNode5
5061
5153
  } from "cojson";
5062
5154
  var MockSessionProvider = class {
5063
- async acquireSession(accountID, crypto) {
5155
+ async acquireSession(accountID, crypto2) {
5064
5156
  return {
5065
- sessionID: crypto.newRandomSessionID(
5157
+ sessionID: crypto2.newRandomSessionID(
5066
5158
  accountID
5067
5159
  ),
5068
5160
  sessionDone: () => {
@@ -5080,7 +5172,7 @@ async function createJazzContextFromExistingCredentials({
5080
5172
  credentials,
5081
5173
  peers,
5082
5174
  syncWhen,
5083
- crypto,
5175
+ crypto: crypto2,
5084
5176
  storage,
5085
5177
  AccountSchema: PropsAccountSchema,
5086
5178
  sessionProvider,
@@ -5089,7 +5181,7 @@ async function createJazzContextFromExistingCredentials({
5089
5181
  }) {
5090
5182
  const { sessionID, sessionDone } = await sessionProvider.acquireSession(
5091
5183
  credentials.accountID,
5092
- crypto
5184
+ crypto2
5093
5185
  );
5094
5186
  const CurrentAccountSchema = PropsAccountSchema ?? RegisteredSchemas["Account"];
5095
5187
  const AccountClass = coValueClassFromCoValueClassOrSchema(CurrentAccountSchema);
@@ -5099,7 +5191,7 @@ async function createJazzContextFromExistingCredentials({
5099
5191
  sessionID,
5100
5192
  peers,
5101
5193
  syncWhen,
5102
- crypto,
5194
+ crypto: crypto2,
5103
5195
  storage,
5104
5196
  migration: async (rawAccount, _node, creationProps) => {
5105
5197
  const account2 = AccountClass.fromRaw(rawAccount);
@@ -5132,7 +5224,7 @@ async function createJazzContextForNewAccount({
5132
5224
  initialAgentSecret,
5133
5225
  peers,
5134
5226
  syncWhen,
5135
- crypto,
5227
+ crypto: crypto2,
5136
5228
  AccountSchema: PropsAccountSchema,
5137
5229
  onLogOut,
5138
5230
  storage,
@@ -5144,7 +5236,7 @@ async function createJazzContextForNewAccount({
5144
5236
  creationProps,
5145
5237
  peers,
5146
5238
  syncWhen,
5147
- crypto,
5239
+ crypto: crypto2,
5148
5240
  initialAgentSecret,
5149
5241
  storage,
5150
5242
  migration: async (rawAccount, _node, creationProps2) => {
@@ -5173,7 +5265,7 @@ async function createJazzContextForNewAccount({
5173
5265
  };
5174
5266
  }
5175
5267
  async function createJazzContext(options) {
5176
- const crypto = options.crypto;
5268
+ const crypto2 = options.crypto;
5177
5269
  let context;
5178
5270
  const authSecretStorage = options.authSecretStorage;
5179
5271
  await authSecretStorage.migrate();
@@ -5189,7 +5281,7 @@ async function createJazzContext(options) {
5189
5281
  },
5190
5282
  peers: options.peers,
5191
5283
  syncWhen: options.syncWhen,
5192
- crypto,
5284
+ crypto: crypto2,
5193
5285
  AccountSchema: options.AccountSchema,
5194
5286
  sessionProvider: options.sessionProvider,
5195
5287
  onLogOut: async () => {
@@ -5200,7 +5292,7 @@ async function createJazzContext(options) {
5200
5292
  });
5201
5293
  } else {
5202
5294
  const secretSeed = options.crypto.newRandomSecretSeed();
5203
- const initialAgentSecret = options.newAccountProps?.secret ?? crypto.agentSecretFromSecretSeed(secretSeed);
5295
+ const initialAgentSecret = options.newAccountProps?.secret ?? crypto2.agentSecretFromSecretSeed(secretSeed);
5204
5296
  const creationProps = options.newAccountProps?.creationProps ?? {
5205
5297
  name: options.defaultProfileName ?? "Anonymous user"
5206
5298
  };
@@ -5209,7 +5301,7 @@ async function createJazzContext(options) {
5209
5301
  initialAgentSecret,
5210
5302
  peers: options.peers,
5211
5303
  syncWhen: options.syncWhen,
5212
- crypto,
5304
+ crypto: crypto2,
5213
5305
  AccountSchema: options.AccountSchema,
5214
5306
  sessionProvider: options.sessionProvider,
5215
5307
  onLogOut: async () => {
@@ -5234,14 +5326,14 @@ async function createJazzContext(options) {
5234
5326
  function createAnonymousJazzContext({
5235
5327
  peers,
5236
5328
  syncWhen,
5237
- crypto,
5329
+ crypto: crypto2,
5238
5330
  storage
5239
5331
  }) {
5240
- const agentSecret = crypto.newRandomAgentSecret();
5332
+ const agentSecret = crypto2.newRandomAgentSecret();
5241
5333
  const node = new LocalNode5(
5242
5334
  agentSecret,
5243
- crypto.newRandomSessionID(crypto.getAgentID(agentSecret)),
5244
- crypto,
5335
+ crypto2.newRandomSessionID(crypto2.getAgentID(agentSecret)),
5336
+ crypto2,
5245
5337
  syncWhen
5246
5338
  );
5247
5339
  for (const peer of peers) {
@@ -6774,6 +6866,13 @@ function discriminatedUnionFieldPermissions(schema) {
6774
6866
  }
6775
6867
 
6776
6868
  // src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts
6869
+ var isDev2 = function() {
6870
+ try {
6871
+ return process.env.NODE_ENV === "development";
6872
+ } catch {
6873
+ return false;
6874
+ }
6875
+ }();
6777
6876
  function isAnyCoValueSchema2(schema) {
6778
6877
  return typeof schema === "object" && schema !== null && "collaborative" in schema && schema.collaborative === true;
6779
6878
  }
@@ -7171,7 +7270,6 @@ var SubscriptionCache = class {
7171
7270
  };
7172
7271
  const subscriptionScope = new SubscriptionScope(
7173
7272
  node,
7174
- // @ts-expect-error the SubscriptionScope is too generic for TS to infer its instances are CoValues
7175
7273
  resolve,
7176
7274
  id,
7177
7275
  refEncoded,
@@ -7683,6 +7781,7 @@ function subscribeToCoValue(cls, id, options, listener) {
7683
7781
  false,
7684
7782
  options.unstable_branch
7685
7783
  );
7784
+ rootNode.trackLoadingPerformance("subscribe");
7686
7785
  const handleUpdate = () => {
7687
7786
  if (unsubscribed) return;
7688
7787
  const value = rootNode.getCurrentValue();
@@ -8085,4 +8184,4 @@ export {
8085
8184
  JazzContextManager
8086
8185
  };
8087
8186
  /* istanbul ignore file -- @preserve */
8088
- //# sourceMappingURL=chunk-2OPP7KWV.js.map
8187
+ //# sourceMappingURL=chunk-Q5RNSSUM.js.map