jazz-tools 0.19.11 → 0.19.12

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 (44) hide show
  1. package/.turbo/turbo-build.log +46 -46
  2. package/CHANGELOG.md +12 -0
  3. package/dist/{chunk-HX5S6W5E.js → chunk-AGF4HEDH.js} +56 -27
  4. package/dist/chunk-AGF4HEDH.js.map +1 -0
  5. package/dist/index.js +1 -1
  6. package/dist/inspector/{chunk-C6BJPHBQ.js → chunk-YQNK5Y7B.js} +47 -35
  7. package/dist/inspector/chunk-YQNK5Y7B.js.map +1 -0
  8. package/dist/inspector/{custom-element-GJVBPZES.js → custom-element-KYV64IOC.js} +47 -35
  9. package/dist/inspector/{custom-element-GJVBPZES.js.map → custom-element-KYV64IOC.js.map} +1 -1
  10. package/dist/inspector/index.js +1 -1
  11. package/dist/inspector/register-custom-element.js +1 -1
  12. package/dist/inspector/standalone.js +1 -1
  13. package/dist/inspector/tests/utils/transactions-changes.test.d.ts +2 -0
  14. package/dist/inspector/tests/utils/transactions-changes.test.d.ts.map +1 -0
  15. package/dist/inspector/utils/transactions-changes.d.ts +13 -13
  16. package/dist/inspector/utils/transactions-changes.d.ts.map +1 -1
  17. package/dist/react/index.js +4 -1
  18. package/dist/react/index.js.map +1 -1
  19. package/dist/react/provider.d.ts.map +1 -1
  20. package/dist/react-core/index.js +2 -2
  21. package/dist/react-core/index.js.map +1 -1
  22. package/dist/react-native/index.js +4 -1
  23. package/dist/react-native/index.js.map +1 -1
  24. package/dist/react-native-core/index.js +4 -1
  25. package/dist/react-native-core/index.js.map +1 -1
  26. package/dist/react-native-core/provider.d.ts.map +1 -1
  27. package/dist/testing.js +1 -1
  28. package/dist/tools/implementation/ContextManager.d.ts.map +1 -1
  29. package/dist/tools/subscribe/SubscriptionScope.d.ts +3 -6
  30. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  31. package/package.json +4 -4
  32. package/src/inspector/tests/utils/transactions-changes.test.ts +102 -0
  33. package/src/inspector/ui/icons/add-icon.tsx +3 -3
  34. package/src/inspector/utils/history.ts +6 -6
  35. package/src/inspector/utils/transactions-changes.ts +37 -3
  36. package/src/inspector/viewer/history-view.tsx +13 -13
  37. package/src/react/provider.tsx +6 -1
  38. package/src/react-core/hooks.ts +2 -2
  39. package/src/react-core/tests/useSuspenseCoState.test.tsx +47 -0
  40. package/src/react-native-core/provider.tsx +6 -1
  41. package/src/tools/implementation/ContextManager.ts +10 -0
  42. package/src/tools/subscribe/SubscriptionScope.ts +61 -39
  43. package/dist/chunk-HX5S6W5E.js.map +0 -1
  44. package/dist/inspector/chunk-C6BJPHBQ.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.19.11 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.19.12 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types && pnpm build: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/tiptap/index.js 564.00 B
111
- ESM dist/tiptap/index.js.map 1.21 KB
112
- ESM ⚡️ Build success in 66ms
113
110
  ESM dist/worker/index.js 3.19 KB
114
111
  ESM dist/worker/edge-wasm.js 215.00 B
115
112
  ESM dist/worker/napi-crypto.js 110.00 B
116
113
  ESM dist/worker/index.js.map 6.24 KB
117
114
  ESM dist/worker/edge-wasm.js.map 434.00 B
118
115
  ESM dist/worker/napi-crypto.js.map 162.00 B
119
- ESM ⚡️ Build success in 69ms
116
+ ESM ⚡️ Build success in 49ms
117
+ ESM dist/tiptap/index.js 564.00 B
118
+ ESM dist/tiptap/index.js.map 1.21 KB
119
+ ESM ⚡️ Build success in 52ms
120
120
  ESM dist/better-auth/auth/client.js 4.50 KB
121
121
  ESM dist/better-auth/auth/server.js 8.36 KB
122
122
  ESM dist/better-auth/auth/react.js 799.00 B
123
123
  ESM dist/better-auth/auth/client.js.map 8.32 KB
124
124
  ESM dist/better-auth/auth/server.js.map 15.31 KB
125
125
  ESM dist/better-auth/auth/react.js.map 2.04 KB
126
- ESM ⚡️ Build success in 80ms
126
+ ESM ⚡️ Build success in 43ms
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.01 KB
@@ -134,88 +134,88 @@
134
134
  ESM dist/media/index.native.js.map 8.10 KB
135
135
  ESM dist/media/index.server.js.map 6.37 KB
136
136
  ESM dist/media/chunk-3LKBM3G3.js.map 16.99 KB
137
- ESM ⚡️ Build success in 94ms
138
- ESM dist/react-core/index.js 17.04 KB
137
+ ESM ⚡️ Build success in 48ms
139
138
  ESM dist/react-core/testing.js 1.22 KB
139
+ ESM dist/react-core/index.js 17.05 KB
140
140
  ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
141
- ESM dist/react-core/index.js.map 49.75 KB
142
141
  ESM dist/react-core/testing.js.map 1.86 KB
142
+ ESM dist/react-core/index.js.map 49.77 KB
143
143
  ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
144
- ESM ⚡️ Build success in 98ms
145
- ESM dist/browser/index.js 14.06 KB
146
- ESM dist/browser/index.js.map 29.94 KB
147
- ESM ⚡️ Build success in 123ms
148
- ESM dist/better-auth/database-adapter/index.js 26.65 KB
149
- ESM dist/better-auth/database-adapter/index.js.map 58.26 KB
150
- ESM ⚡️ Build success in 105ms
144
+ ESM ⚡️ Build success in 47ms
151
145
  ESM dist/expo/index.js 4.68 KB
152
146
  ESM dist/expo/testing.js 112.00 B
153
- ESM dist/expo/crypto.js 153.00 B
154
147
  ESM dist/expo/polyfills.js 858.00 B
148
+ ESM dist/expo/crypto.js 153.00 B
155
149
  ESM dist/expo/index.js.map 10.23 KB
156
150
  ESM dist/expo/testing.js.map 168.00 B
157
- ESM dist/expo/crypto.js.map 189.00 B
158
151
  ESM dist/expo/polyfills.js.map 1.61 KB
159
- ESM ⚡️ Build success in 116ms
152
+ ESM dist/expo/crypto.js.map 189.00 B
153
+ ESM ⚡️ Build success in 52ms
154
+ ESM dist/better-auth/database-adapter/index.js 26.65 KB
155
+ ESM dist/better-auth/database-adapter/index.js.map 58.26 KB
156
+ ESM ⚡️ Build success in 47ms
157
+ ESM dist/browser/index.js 14.06 KB
158
+ ESM dist/browser/index.js.map 29.94 KB
159
+ ESM ⚡️ Build success in 70ms
160
160
  ESM dist/prosemirror/index.js 77.76 KB
161
161
  ESM dist/prosemirror/index.js.map 307.20 KB
162
- ESM ⚡️ Build success in 129ms
163
- ESM dist/react-native-core/index.js 19.05 KB
162
+ ESM ⚡️ Build success in 79ms
164
163
  ESM dist/react-native-core/testing.js 119.00 B
165
- ESM dist/react-native-core/crypto.js 2.58 KB
164
+ ESM dist/react-native-core/index.js 19.19 KB
166
165
  ESM dist/react-native-core/crypto/RNCrypto.js 120.00 B
167
- ESM dist/react-native-core/index.js.map 38.74 KB
166
+ ESM dist/react-native-core/crypto.js 2.58 KB
168
167
  ESM dist/react-native-core/testing.js.map 175.00 B
169
- ESM dist/react-native-core/crypto.js.map 5.25 KB
168
+ ESM dist/react-native-core/index.js.map 38.96 KB
170
169
  ESM dist/react-native-core/crypto/RNCrypto.js.map 178.00 B
171
- ESM ⚡️ Build success in 135ms
172
- ESM dist/react/index.js 25.83 KB
170
+ ESM dist/react-native-core/crypto.js.map 5.25 KB
171
+ ESM ⚡️ Build success in 78ms
173
172
  ESM dist/react/testing.js 122.00 B
173
+ ESM dist/react/index.js 25.96 KB
174
174
  ESM dist/react/ssr.js 697.00 B
175
- ESM dist/react/index.js.map 55.23 KB
176
175
  ESM dist/react/testing.js.map 165.00 B
177
176
  ESM dist/react/ssr.js.map 1.11 KB
178
- ESM ⚡️ Build success in 125ms
179
- ESM dist/react-native/index.js 21.59 KB
177
+ ESM dist/react/index.js.map 55.44 KB
178
+ ESM ⚡️ Build success in 70ms
180
179
  ESM dist/react-native/testing.js 120.00 B
181
180
  ESM dist/react-native/crypto.js 161.00 B
182
181
  ESM dist/react-native/polyfills.js 858.00 B
183
- ESM dist/react-native/index.js.map 44.29 KB
182
+ ESM dist/react-native/index.js 21.73 KB
184
183
  ESM dist/react-native/testing.js.map 176.00 B
185
184
  ESM dist/react-native/crypto.js.map 197.00 B
186
185
  ESM dist/react-native/polyfills.js.map 1.61 KB
187
- ESM ⚡️ Build success in 148ms
186
+ ESM dist/react-native/index.js.map 44.50 KB
187
+ ESM ⚡️ Build success in 80ms
188
188
  ESM dist/inspector/index.js 6.29 KB
189
189
  ESM dist/inspector/standalone.js 12.61 KB
190
- ESM dist/inspector/chunk-C6BJPHBQ.js 126.24 KB
190
+ ESM dist/inspector/chunk-YQNK5Y7B.js 127.21 KB
191
191
  ESM dist/inspector/index.js.map 9.65 KB
192
192
  ESM dist/inspector/standalone.js.map 20.11 KB
193
- ESM dist/inspector/chunk-C6BJPHBQ.js.map 219.48 KB
194
- ESM ⚡️ Build success in 183ms
195
- ESM dist/tools/ssr.js 156.00 B
196
- ESM dist/chunk-PZ5AY32C.js 233.00 B
193
+ ESM dist/inspector/chunk-YQNK5Y7B.js.map 221.30 KB
194
+ ESM ⚡️ Build success in 91ms
197
195
  ESM dist/index.js 29.76 KB
198
- ESM dist/chunk-M2HGBOXS.js 694.00 B
199
196
  ESM dist/testing.js 8.51 KB
200
- ESM dist/chunk-HX5S6W5E.js 213.29 KB
197
+ ESM dist/chunk-AGF4HEDH.js 214.23 KB
198
+ ESM dist/tools/ssr.js 156.00 B
199
+ ESM dist/chunk-M2HGBOXS.js 694.00 B
200
+ ESM dist/chunk-PZ5AY32C.js 233.00 B
201
201
  ESM dist/tools/ssr.js.map 71.00 B
202
+ ESM dist/testing.js.map 16.13 KB
202
203
  ESM dist/chunk-PZ5AY32C.js.map 71.00 B
203
204
  ESM dist/chunk-M2HGBOXS.js.map 1.10 KB
204
- ESM dist/testing.js.map 16.13 KB
205
205
  ESM dist/index.js.map 60.59 KB
206
- ESM dist/chunk-HX5S6W5E.js.map 502.74 KB
207
- ESM ⚡️ Build success in 218ms
206
+ ESM dist/chunk-AGF4HEDH.js.map 504.49 KB
207
+ ESM ⚡️ Build success in 93ms
208
208
  ESM dist/inspector/register-custom-element.js 218.00 B
209
209
  ESM dist/inspector/register-custom-element.js.map 314.00 B
210
- ESM dist/inspector/custom-element-GJVBPZES.js 1.60 MB
211
- ESM dist/inspector/custom-element-GJVBPZES.js.map 2.47 MB
212
- ESM ⚡️ Build success in 244ms
210
+ ESM dist/inspector/custom-element-KYV64IOC.js 1.60 MB
211
+ ESM dist/inspector/custom-element-KYV64IOC.js.map 2.47 MB
212
+ ESM ⚡️ Build success in 141ms
213
213
 
214
- > jazz-tools@0.19.11 types /home/runner/_work/jazz/jazz/packages/jazz-tools
214
+ > jazz-tools@0.19.12 types /home/runner/_work/jazz/jazz/packages/jazz-tools
215
215
  > tsc --outDir dist
216
216
 
217
217
 
218
- > jazz-tools@0.19.11 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
218
+ > jazz-tools@0.19.12 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
219
219
  > rm -rf dist/svelte && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json
220
220
 
221
221
  src/svelte -> dist/svelte
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.19.12
4
+
5
+ ### Patch Changes
6
+
7
+ - 9ca9e72: Fix the inspector to guess correctly Group's transactions
8
+ - 5b0bb7d: Bugfix: ensure that the promises used for Suspense is always cached
9
+ - fa0759b: Bugfix: close the server peers before calling the onAnonymousAccountDiscarded hook, to ensure that there won't be conflicting issues with the new context sync
10
+ - a2372db: Bugfix: ensure onAnonymousAccountDiscarded hook is conditionally applied in React providers
11
+ - cojson@0.19.12
12
+ - cojson-storage-indexeddb@0.19.12
13
+ - cojson-transport-ws@0.19.12
14
+
3
15
  ## 0.19.11
4
16
 
5
17
  ### Patch Changes
@@ -4421,14 +4421,6 @@ var SubscriptionScope = class _SubscriptionScope {
4421
4421
  if (this.value.type !== CoValueLoadingState.LOADED) return true;
4422
4422
  return this.pendingLoadedChildren.size === 0;
4423
4423
  }
4424
- cachePromise(value, callback) {
4425
- if (this.lastPromise?.value === value) {
4426
- return this.lastPromise.promise;
4427
- }
4428
- const promise = callback();
4429
- this.lastPromise = { value, promise };
4430
- return promise;
4431
- }
4432
4424
  getPromise() {
4433
4425
  const currentValue = this.getCurrentValue();
4434
4426
  if (currentValue.$isLoaded) {
@@ -4442,26 +4434,57 @@ var SubscriptionScope = class _SubscriptionScope {
4442
4434
  })
4443
4435
  );
4444
4436
  }
4445
- return this.cachePromise(currentValue, () => {
4446
- return new Promise((resolve, reject) => {
4447
- const unsubscribe = this.subscribe(() => {
4448
- const currentValue2 = this.getCurrentValue();
4449
- if (currentValue2.$jazz.loadingState === CoValueLoadingState.LOADING) {
4450
- return;
4451
- }
4452
- if (currentValue2.$isLoaded) {
4453
- resolve(currentValue2);
4454
- } else {
4455
- reject(
4456
- new Error(this.getError()?.toString() ?? "Unknown error", {
4457
- cause: this.callerStack
4458
- })
4459
- );
4460
- }
4461
- unsubscribe();
4462
- });
4437
+ const promise = new Promise((resolve, reject) => {
4438
+ const unsubscribe = this.subscribe(() => {
4439
+ const currentValue2 = this.getCurrentValue();
4440
+ if (currentValue2.$jazz.loadingState === CoValueLoadingState.LOADING) {
4441
+ return;
4442
+ }
4443
+ if (currentValue2.$isLoaded) {
4444
+ promise.status = "fulfilled";
4445
+ promise.value = currentValue2;
4446
+ resolve(currentValue2);
4447
+ } else {
4448
+ promise.status = "rejected";
4449
+ promise.reason = new Error(
4450
+ this.getError()?.toString() ?? "Unknown error",
4451
+ {
4452
+ cause: this.callerStack
4453
+ }
4454
+ );
4455
+ reject(
4456
+ new Error(this.getError()?.toString() ?? "Unknown error", {
4457
+ cause: this.callerStack
4458
+ })
4459
+ );
4460
+ }
4461
+ unsubscribe();
4463
4462
  });
4464
4463
  });
4464
+ promise.status = "pending";
4465
+ return promise;
4466
+ }
4467
+ getCachedPromise() {
4468
+ if (this.lastPromise) {
4469
+ const value = this.getCurrentValue();
4470
+ if (value.$isLoaded) {
4471
+ this.lastPromise.status = "fulfilled";
4472
+ this.lastPromise.value = value;
4473
+ } else if (value.$jazz.loadingState !== CoValueLoadingState.LOADING) {
4474
+ this.lastPromise.status = "rejected";
4475
+ this.lastPromise.reason = new Error(
4476
+ this.getError()?.toString() ?? "Unknown error",
4477
+ {
4478
+ cause: this.callerStack
4479
+ }
4480
+ );
4481
+ } else if (this.lastPromise.status !== "pending") {
4482
+ this.lastPromise = this.getPromise();
4483
+ }
4484
+ } else {
4485
+ this.lastPromise = this.getPromise();
4486
+ }
4487
+ return this.lastPromise;
4465
4488
  }
4466
4489
  getUnloadedValue(reason) {
4467
4490
  if (this.unloadedValue?.$jazz.loadingState === reason) {
@@ -6860,6 +6883,12 @@ var JazzContextManager = class {
6860
6883
  }
6861
6884
  );
6862
6885
  prevContext.node.removeStorage();
6886
+ for (const peer of Object.values(prevContext.node.syncManager.peers)) {
6887
+ if (!peer.closed) {
6888
+ peer.gracefulShutdown();
6889
+ }
6890
+ }
6891
+ prevContext.node.syncManager.peers = {};
6863
6892
  currentContext.node.syncManager.addPeer(prevAccountAsPeer);
6864
6893
  prevContext.node.syncManager.addPeer(currentAccountAsPeer);
6865
6894
  try {
@@ -7398,4 +7427,4 @@ export {
7398
7427
  JazzContextManager
7399
7428
  };
7400
7429
  /* istanbul ignore file -- @preserve */
7401
- //# sourceMappingURL=chunk-HX5S6W5E.js.map
7430
+ //# sourceMappingURL=chunk-AGF4HEDH.js.map