jazz-tools 0.19.14 → 0.19.16

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 (37) hide show
  1. package/.turbo/turbo-build.log +56 -56
  2. package/CHANGELOG.md +25 -0
  3. package/dist/{chunk-GAPMDNJY.js → chunk-R3KIZG4P.js} +47 -27
  4. package/dist/chunk-R3KIZG4P.js.map +1 -0
  5. package/dist/index.js +22 -14
  6. package/dist/index.js.map +1 -1
  7. package/dist/react-native/index.js +18 -0
  8. package/dist/react-native/index.js.map +1 -1
  9. package/dist/react-native-core/ReactNativeSessionProvider.d.ts.map +1 -1
  10. package/dist/react-native-core/index.js +18 -0
  11. package/dist/react-native-core/index.js.map +1 -1
  12. package/dist/testing.js +1 -1
  13. package/dist/tools/auth/clerk/index.d.ts +1 -0
  14. package/dist/tools/auth/clerk/index.d.ts.map +1 -1
  15. package/dist/tools/auth/clerk/tests/isClerkAuthStateEqual.test.d.ts +2 -0
  16. package/dist/tools/auth/clerk/tests/isClerkAuthStateEqual.test.d.ts.map +1 -0
  17. package/dist/tools/auth/clerk/types.d.ts +2 -2
  18. package/dist/tools/auth/clerk/types.d.ts.map +1 -1
  19. package/dist/tools/coValues/CoValueBase.d.ts +13 -0
  20. package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
  21. package/dist/tools/subscribe/SubscriptionScope.d.ts +33 -35
  22. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  23. package/package.json +4 -4
  24. package/src/react-native-core/ReactNativeSessionProvider.ts +29 -3
  25. package/src/react-native-core/tests/ReactNativeSessionProvider.test.ts +175 -3
  26. package/src/tools/auth/clerk/index.ts +21 -11
  27. package/src/tools/auth/clerk/tests/JazzClerkAuth.test.ts +77 -0
  28. package/src/tools/auth/clerk/tests/isClerkAuthStateEqual.test.ts +124 -0
  29. package/src/tools/auth/clerk/types.ts +23 -6
  30. package/src/tools/coValues/CoValueBase.ts +24 -0
  31. package/src/tools/coValues/coMap.ts +1 -1
  32. package/src/tools/implementation/createContext.ts +2 -2
  33. package/src/tools/subscribe/SubscriptionScope.ts +43 -34
  34. package/src/tools/tests/account.test.ts +19 -0
  35. package/src/tools/tests/coMap.record.test.ts +43 -0
  36. package/src/tools/tests/coMap.test.ts +67 -1
  37. package/dist/chunk-GAPMDNJY.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.19.14 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.19.16 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"}
@@ -109,21 +109,21 @@
109
109
  ESM Build start
110
110
  ESM dist/tiptap/index.js 564.00 B
111
111
  ESM dist/tiptap/index.js.map 1.21 KB
112
- ESM ⚡️ Build success in 48ms
112
+ ESM ⚡️ Build success in 63ms
113
+ ESM dist/better-auth/auth/client.js 4.50 KB
114
+ ESM dist/better-auth/auth/react.js 799.00 B
115
+ ESM dist/better-auth/auth/server.js 8.36 KB
116
+ ESM dist/better-auth/auth/client.js.map 8.32 KB
117
+ ESM dist/better-auth/auth/react.js.map 2.04 KB
118
+ ESM dist/better-auth/auth/server.js.map 15.31 KB
119
+ ESM ⚡️ Build success in 49ms
113
120
  ESM dist/worker/index.js 3.19 KB
114
121
  ESM dist/worker/edge-wasm.js 215.00 B
115
122
  ESM dist/worker/napi-crypto.js 110.00 B
116
123
  ESM dist/worker/index.js.map 6.26 KB
117
124
  ESM dist/worker/edge-wasm.js.map 434.00 B
118
125
  ESM dist/worker/napi-crypto.js.map 162.00 B
119
- ESM ⚡️ Build success in 47ms
120
- ESM dist/better-auth/auth/client.js 4.50 KB
121
- ESM dist/better-auth/auth/server.js 8.36 KB
122
- ESM dist/better-auth/auth/react.js 799.00 B
123
- ESM dist/better-auth/auth/client.js.map 8.32 KB
124
- ESM dist/better-auth/auth/server.js.map 15.31 KB
125
- ESM dist/better-auth/auth/react.js.map 2.04 KB
126
- ESM ⚡️ Build success in 39ms
126
+ ESM ⚡️ Build success in 62ms
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 46ms
138
- ESM dist/react-core/index.js 17.05 KB
139
- ESM dist/react-core/testing.js 1.22 KB
140
- ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
141
- ESM dist/react-core/testing.js.map 1.86 KB
142
- ESM dist/react-core/index.js.map 49.77 KB
143
- ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
144
- ESM ⚡️ Build success in 45ms
137
+ ESM ⚡️ Build success in 78ms
145
138
  ESM dist/expo/index.js 4.68 KB
146
- ESM dist/expo/crypto.js 153.00 B
147
139
  ESM dist/expo/testing.js 112.00 B
140
+ ESM dist/expo/crypto.js 153.00 B
148
141
  ESM dist/expo/polyfills.js 858.00 B
149
- ESM dist/expo/crypto.js.map 189.00 B
150
142
  ESM dist/expo/index.js.map 10.23 KB
151
143
  ESM dist/expo/testing.js.map 168.00 B
144
+ ESM dist/expo/crypto.js.map 189.00 B
152
145
  ESM dist/expo/polyfills.js.map 1.61 KB
153
- ESM ⚡️ Build success in 40ms
146
+ ESM ⚡️ Build success in 76ms
147
+ ESM dist/react-core/index.js 17.05 KB
148
+ ESM dist/react-core/testing.js 1.22 KB
149
+ ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
150
+ ESM dist/react-core/index.js.map 49.77 KB
151
+ ESM dist/react-core/testing.js.map 1.86 KB
152
+ ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
153
+ ESM ⚡️ Build success in 98ms
154
154
  ESM dist/browser/index.js 16.14 KB
155
155
  ESM dist/browser/index.js.map 34.66 KB
156
- ESM ⚡️ Build success in 54ms
157
- ESM dist/better-auth/database-adapter/index.js 26.65 KB
158
- ESM dist/better-auth/database-adapter/index.js.map 58.26 KB
159
- ESM ⚡️ Build success in 46ms
156
+ ESM ⚡️ Build success in 111ms
157
+ ESM dist/react-native-core/index.js 20.57 KB
158
+ ESM dist/react-native-core/testing.js 119.00 B
159
+ ESM dist/react-native-core/crypto.js 2.58 KB
160
+ ESM dist/react-native-core/crypto/RNCrypto.js 120.00 B
161
+ ESM dist/react-native-core/index.js.map 41.80 KB
162
+ ESM dist/react-native-core/testing.js.map 175.00 B
163
+ ESM dist/react-native-core/crypto.js.map 5.25 KB
164
+ ESM dist/react-native-core/crypto/RNCrypto.js.map 178.00 B
165
+ ESM ⚡️ Build success in 124ms
160
166
  ESM dist/prosemirror/index.js 77.76 KB
161
167
  ESM dist/prosemirror/index.js.map 307.20 KB
162
- ESM ⚡️ Build success in 61ms
168
+ ESM ⚡️ Build success in 138ms
169
+ ESM dist/react/index.js 25.96 KB
163
170
  ESM dist/react/testing.js 122.00 B
164
171
  ESM dist/react/ssr.js 697.00 B
165
- ESM dist/react/index.js 25.96 KB
172
+ ESM dist/react/index.js.map 55.44 KB
166
173
  ESM dist/react/testing.js.map 165.00 B
167
174
  ESM dist/react/ssr.js.map 1.11 KB
168
- ESM dist/react/index.js.map 55.44 KB
169
- ESM ⚡️ Build success in 49ms
170
- ESM dist/react-native/index.js 22.50 KB
171
- ESM dist/react-native/crypto.js 161.00 B
175
+ ESM ⚡️ Build success in 122ms
176
+ ESM dist/better-auth/database-adapter/index.js 26.65 KB
177
+ ESM dist/better-auth/database-adapter/index.js.map 58.26 KB
178
+ ESM ⚡️ Build success in 124ms
179
+ ESM dist/react-native/index.js 23.11 KB
172
180
  ESM dist/react-native/testing.js 120.00 B
181
+ ESM dist/react-native/crypto.js 161.00 B
173
182
  ESM dist/react-native/polyfills.js 858.00 B
174
- ESM dist/react-native/index.js.map 46.13 KB
175
- ESM dist/react-native/crypto.js.map 197.00 B
183
+ ESM dist/react-native/index.js.map 47.35 KB
176
184
  ESM dist/react-native/testing.js.map 176.00 B
185
+ ESM dist/react-native/crypto.js.map 197.00 B
177
186
  ESM dist/react-native/polyfills.js.map 1.61 KB
178
- ESM ⚡️ Build success in 60ms
179
- ESM dist/react-native-core/testing.js 119.00 B
180
- ESM dist/react-native-core/crypto.js 2.58 KB
181
- ESM dist/react-native-core/index.js 19.96 KB
182
- ESM dist/react-native-core/crypto/RNCrypto.js 120.00 B
183
- ESM dist/react-native-core/testing.js.map 175.00 B
184
- ESM dist/react-native-core/crypto.js.map 5.25 KB
185
- ESM dist/react-native-core/index.js.map 40.58 KB
186
- ESM dist/react-native-core/crypto/RNCrypto.js.map 178.00 B
187
- ESM ⚡️ Build success in 59ms
187
+ ESM ⚡️ Build success in 144ms
188
188
  ESM dist/inspector/index.js 6.29 KB
189
189
  ESM dist/inspector/standalone.js 12.61 KB
190
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
193
  ESM dist/inspector/chunk-YQNK5Y7B.js.map 221.30 KB
194
- ESM ⚡️ Build success in 69ms
195
- ESM dist/index.js 29.82 KB
196
- ESM dist/chunk-GAPMDNJY.js 225.38 KB
194
+ ESM ⚡️ Build success in 163ms
195
+ ESM dist/index.js 30.20 KB
196
+ ESM dist/testing.js 8.56 KB
197
+ ESM dist/chunk-R3KIZG4P.js 226.01 KB
197
198
  ESM dist/tools/ssr.js 156.00 B
198
199
  ESM dist/chunk-M2HGBOXS.js 694.00 B
199
200
  ESM dist/chunk-PZ5AY32C.js 233.00 B
200
- ESM dist/testing.js 8.56 KB
201
+ ESM dist/index.js.map 61.58 KB
202
+ ESM dist/testing.js.map 16.21 KB
201
203
  ESM dist/tools/ssr.js.map 71.00 B
202
- 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.21 KB
205
- ESM dist/index.js.map 60.59 KB
206
- ESM dist/chunk-GAPMDNJY.js.map 530.58 KB
207
- ESM ⚡️ Build success in 74ms
205
+ ESM dist/chunk-PZ5AY32C.js.map 71.00 B
206
+ ESM dist/chunk-R3KIZG4P.js.map 531.93 KB
207
+ ESM ⚡️ Build success in 227ms
208
208
  ESM dist/inspector/register-custom-element.js 218.00 B
209
- ESM dist/inspector/register-custom-element.js.map 314.00 B
210
209
  ESM dist/inspector/custom-element-KYV64IOC.js 1.60 MB
210
+ ESM dist/inspector/register-custom-element.js.map 314.00 B
211
211
  ESM dist/inspector/custom-element-KYV64IOC.js.map 2.47 MB
212
- ESM ⚡️ Build success in 122ms
212
+ ESM ⚡️ Build success in 244ms
213
213
 
214
- > jazz-tools@0.19.14 types /home/runner/_work/jazz/jazz/packages/jazz-tools
214
+ > jazz-tools@0.19.16 types /home/runner/_work/jazz/jazz/packages/jazz-tools
215
215
  > tsc --outDir dist
216
216
 
217
217
 
218
- > jazz-tools@0.19.14 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
218
+ > jazz-tools@0.19.16 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,30 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.19.16
4
+
5
+ ### Patch Changes
6
+
7
+ - 25268bf: Bugfix: fixed a race condition in Clerk auth where the signup flow could trigger a duplicate login attempt
8
+ - Updated dependencies [265d0e9]
9
+ - cojson@0.19.16
10
+ - cojson-storage-indexeddb@0.19.16
11
+ - cojson-transport-ws@0.19.16
12
+
13
+ ## 0.19.15
14
+
15
+ ### Patch Changes
16
+
17
+ - 94012a1: Added a locking system for session IDs in React Native
18
+
19
+ Now it should be safer to mount multiple JazzProviders, but still not advised as it is really expensive
20
+
21
+ - 86f9676: Adds a createdBy getter
22
+ - b27dbc2: Fix Object.keys(coMap.getEdits()) to return also deleted keys
23
+ - Updated dependencies [71ed9d6]
24
+ - cojson@0.19.15
25
+ - cojson-storage-indexeddb@0.19.15
26
+ - cojson-transport-ws@0.19.15
27
+
3
28
  ## 0.19.14
4
29
 
5
30
  ### Patch Changes
@@ -203,6 +203,26 @@ var CoValueJazzApi = class {
203
203
  }
204
204
  return this.raw.core.earliestTxMadeAt;
205
205
  }
206
+ /**
207
+ * Returns the account ID of the user who created this CoValue.
208
+ *
209
+ * Creation is determined by inspecting the earliest valid transaction,
210
+ * Note: Where the author is a sealer/signer identifiers (e.g. accounts)
211
+ * nothing is returned intentionally
212
+ *
213
+ * @returns {string | undefined} The creating user's account ID, or
214
+ * `undefined` if no author can be determined
215
+ *
216
+ * @category Content
217
+ */
218
+ get createdBy() {
219
+ const createdBy = this.raw.core.getValidSortedTransactions({
220
+ ignorePrivateTransactions: false
221
+ })[0]?.author;
222
+ if (typeof createdBy === "string" && createdBy.startsWith("co_z"))
223
+ return createdBy;
224
+ return void 0;
225
+ }
206
226
  /**
207
227
  * The timestamp of the last updated time of the CoValue
208
228
  *
@@ -739,7 +759,7 @@ var CoMapJazzApi = class extends CoValueJazzApi {
739
759
  };
740
760
  },
741
761
  ownKeys(_target) {
742
- return map.$jazz.raw.keys();
762
+ return Object.keys(map.$jazz.raw.ops);
743
763
  },
744
764
  getOwnPropertyDescriptor(target, key) {
745
765
  return {
@@ -4290,29 +4310,6 @@ var SubscriptionScope = class _SubscriptionScope {
4290
4310
  this.migrating = false;
4291
4311
  this.closed = false;
4292
4312
  this.silenceUpdates = false;
4293
- this.handleChildUpdate = (id, value, key) => {
4294
- if (value.type === CoValueLoadingState.LOADING) {
4295
- return;
4296
- }
4297
- this.pendingLoadedChildren.delete(id);
4298
- this.pendingAutoloadedChildren.delete(id);
4299
- this.childValues.set(id, value);
4300
- if (value.type === CoValueLoadingState.UNAVAILABLE || value.type === CoValueLoadingState.UNAUTHORIZED) {
4301
- this.childErrors.set(id, value.prependPath(key ?? id));
4302
- this.errorFromChildren = this.computeChildErrors();
4303
- } else if (this.errorFromChildren && this.childErrors.has(id)) {
4304
- this.childErrors.delete(id);
4305
- this.errorFromChildren = this.computeChildErrors();
4306
- }
4307
- if (this.shouldSendUpdates()) {
4308
- if (this.value.type === CoValueLoadingState.LOADED) {
4309
- this.updateValue(
4310
- createCoValue(this.schema, this.value.value.$jazz.raw, this)
4311
- );
4312
- }
4313
- }
4314
- this.triggerUpdate();
4315
- };
4316
4313
  this.subscribers = /* @__PURE__ */ new Set();
4317
4314
  this.subscriberChangeCallbacks = /* @__PURE__ */ new Set();
4318
4315
  this.callerStack = callerStack;
@@ -4438,6 +4435,29 @@ var SubscriptionScope = class _SubscriptionScope {
4438
4435
  }
4439
4436
  return void 0;
4440
4437
  }
4438
+ handleChildUpdate(id, value, key) {
4439
+ if (value.type === CoValueLoadingState.LOADING) {
4440
+ return;
4441
+ }
4442
+ this.pendingLoadedChildren.delete(id);
4443
+ this.pendingAutoloadedChildren.delete(id);
4444
+ this.childValues.set(id, value);
4445
+ if (value.type === CoValueLoadingState.UNAVAILABLE || value.type === CoValueLoadingState.UNAUTHORIZED) {
4446
+ this.childErrors.set(id, value.prependPath(key ?? id));
4447
+ this.errorFromChildren = this.computeChildErrors();
4448
+ } else if (this.errorFromChildren && this.childErrors.has(id)) {
4449
+ this.childErrors.delete(id);
4450
+ this.errorFromChildren = this.computeChildErrors();
4451
+ }
4452
+ if (this.shouldSendUpdates()) {
4453
+ if (this.value.type === CoValueLoadingState.LOADED) {
4454
+ this.updateValue(
4455
+ createCoValue(this.schema, this.value.value.$jazz.raw, this)
4456
+ );
4457
+ }
4458
+ }
4459
+ this.triggerUpdate();
4460
+ }
4441
4461
  shouldSendUpdates() {
4442
4462
  if (this.value.type === CoValueLoadingState.LOADING) return false;
4443
4463
  if (this.value.type !== CoValueLoadingState.LOADED) return true;
@@ -5096,8 +5116,8 @@ async function createJazzContext(options) {
5096
5116
  crypto,
5097
5117
  AccountSchema: options.AccountSchema,
5098
5118
  sessionProvider: options.sessionProvider,
5099
- onLogOut: () => {
5100
- authSecretStorage.clearWithoutNotify();
5119
+ onLogOut: async () => {
5120
+ await authSecretStorage.clearWithoutNotify();
5101
5121
  },
5102
5122
  storage: options.storage,
5103
5123
  asActiveAccount: true
@@ -7782,4 +7802,4 @@ export {
7782
7802
  JazzContextManager
7783
7803
  };
7784
7804
  /* istanbul ignore file -- @preserve */
7785
- //# sourceMappingURL=chunk-GAPMDNJY.js.map
7805
+ //# sourceMappingURL=chunk-R3KIZG4P.js.map