jazz-tools 0.19.16 → 0.19.17

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 (39) hide show
  1. package/.svelte-kit/__package__/tests/media/image.svelte.test.js +4 -1
  2. package/.turbo/turbo-build.log +55 -55
  3. package/CHANGELOG.md +9 -0
  4. package/dist/{chunk-R3KIZG4P.js → chunk-OH2GW5WP.js} +24 -8
  5. package/dist/{chunk-R3KIZG4P.js.map → chunk-OH2GW5WP.js.map} +1 -1
  6. package/dist/index.js +72 -48
  7. package/dist/index.js.map +1 -1
  8. package/dist/react-native/index.js +18 -17
  9. package/dist/react-native/index.js.map +1 -1
  10. package/dist/react-native-core/ReactNativeSessionProvider.d.ts.map +1 -1
  11. package/dist/react-native-core/index.js +18 -17
  12. package/dist/react-native-core/index.js.map +1 -1
  13. package/dist/svelte/tests/media/image.svelte.test.js +4 -1
  14. package/dist/testing.js +1 -1
  15. package/dist/tools/auth/clerk/getClerkUsername.d.ts +2 -2
  16. package/dist/tools/auth/clerk/getClerkUsername.d.ts.map +1 -1
  17. package/dist/tools/auth/clerk/index.d.ts +4 -4
  18. package/dist/tools/auth/clerk/index.d.ts.map +1 -1
  19. package/dist/tools/auth/clerk/tests/isClerkCredentials.test.d.ts +2 -0
  20. package/dist/tools/auth/clerk/tests/isClerkCredentials.test.d.ts.map +1 -0
  21. package/dist/tools/auth/clerk/types.d.ts +62 -19
  22. package/dist/tools/auth/clerk/types.d.ts.map +1 -1
  23. package/dist/tools/implementation/ContextManager.d.ts +10 -0
  24. package/dist/tools/implementation/ContextManager.d.ts.map +1 -1
  25. package/package.json +5 -6
  26. package/src/react/tests/media/image.test.tsx +5 -1
  27. package/src/react-native-core/ReactNativeSessionProvider.ts +24 -24
  28. package/src/svelte/tests/media/image.svelte.test.ts +5 -1
  29. package/src/tools/auth/clerk/getClerkUsername.ts +13 -20
  30. package/src/tools/auth/clerk/index.ts +25 -28
  31. package/src/tools/auth/clerk/tests/JazzClerkAuth.test.ts +29 -34
  32. package/src/tools/auth/clerk/tests/getClerkUsername.test.ts +25 -45
  33. package/src/tools/auth/clerk/tests/isClerkAuthStateEqual.test.ts +7 -3
  34. package/src/tools/auth/clerk/tests/{types.test.ts → isClerkCredentials.test.ts} +4 -2
  35. package/src/tools/auth/clerk/types.ts +55 -34
  36. package/src/tools/implementation/ContextManager.ts +28 -7
  37. package/src/tools/tests/ContextManager.test.ts +16 -0
  38. package/dist/tools/auth/clerk/tests/types.test.d.ts +0 -2
  39. package/dist/tools/auth/clerk/tests/types.test.d.ts.map +0 -1
@@ -1,9 +1,12 @@
1
1
  // @vitest-environment happy-dom
2
2
  import { FileStream, ImageDefinition } from "jazz-tools";
3
3
  import { createJazzTestAccount } from "jazz-tools/testing";
4
- import { describe, expect, it, vi } from "vitest";
4
+ import { beforeEach, describe, expect, it, vi } from "vitest";
5
5
  import Image from "../../media/image.svelte";
6
6
  import { render, screen, waitFor } from "../testUtils";
7
+ beforeEach(() => {
8
+ vi.clearAllMocks();
9
+ });
7
10
  describe("Image", async () => {
8
11
  const account = await createJazzTestAccount({
9
12
  isCurrentActiveAccount: true,
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.19.16 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.19.17 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,32 +109,39 @@
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 63ms
112
+ ESM ⚡️ Build success in 44ms
113
+ ESM dist/better-auth/auth/server.js 8.36 KB
113
114
  ESM dist/better-auth/auth/client.js 4.50 KB
114
115
  ESM dist/better-auth/auth/react.js 799.00 B
115
- ESM dist/better-auth/auth/server.js 8.36 KB
116
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
117
  ESM dist/better-auth/auth/server.js.map 15.31 KB
119
- ESM ⚡️ Build success in 49ms
120
- ESM dist/worker/index.js 3.19 KB
118
+ ESM dist/better-auth/auth/react.js.map 2.04 KB
119
+ ESM ⚡️ Build success in 39ms
121
120
  ESM dist/worker/edge-wasm.js 215.00 B
122
121
  ESM dist/worker/napi-crypto.js 110.00 B
123
- ESM dist/worker/index.js.map 6.26 KB
122
+ ESM dist/worker/index.js 3.19 KB
124
123
  ESM dist/worker/edge-wasm.js.map 434.00 B
124
+ ESM dist/worker/index.js.map 6.26 KB
125
125
  ESM dist/worker/napi-crypto.js.map 162.00 B
126
- ESM ⚡️ Build success in 62ms
126
+ ESM ⚡️ Build success in 49ms
127
127
  ESM dist/media/index.js 236.00 B
128
- ESM dist/media/index.browser.js 2.79 KB
129
- ESM dist/media/index.native.js 4.01 KB
130
128
  ESM dist/media/index.server.js 2.95 KB
129
+ ESM dist/media/index.native.js 4.01 KB
130
+ ESM dist/media/index.browser.js 2.79 KB
131
131
  ESM dist/media/chunk-3LKBM3G3.js 6.69 KB
132
132
  ESM dist/media/index.js.map 71.00 B
133
- ESM dist/media/index.browser.js.map 6.15 KB
134
- ESM dist/media/index.native.js.map 8.10 KB
135
133
  ESM dist/media/index.server.js.map 6.37 KB
134
+ ESM dist/media/index.native.js.map 8.10 KB
135
+ ESM dist/media/index.browser.js.map 6.15 KB
136
136
  ESM dist/media/chunk-3LKBM3G3.js.map 16.99 KB
137
- ESM ⚡️ Build success in 78ms
137
+ ESM ⚡️ Build success in 50ms
138
+ ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
139
+ ESM dist/react-core/testing.js 1.22 KB
140
+ ESM dist/react-core/index.js 17.05 KB
141
+ ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
142
+ ESM dist/react-core/testing.js.map 1.86 KB
143
+ ESM dist/react-core/index.js.map 49.77 KB
144
+ ESM ⚡️ Build success in 48ms
138
145
  ESM dist/expo/index.js 4.68 KB
139
146
  ESM dist/expo/testing.js 112.00 B
140
147
  ESM dist/expo/crypto.js 153.00 B
@@ -143,79 +150,72 @@
143
150
  ESM dist/expo/testing.js.map 168.00 B
144
151
  ESM dist/expo/crypto.js.map 189.00 B
145
152
  ESM dist/expo/polyfills.js.map 1.61 KB
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
153
+ ESM ⚡️ Build success in 44ms
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 37ms
154
157
  ESM dist/browser/index.js 16.14 KB
155
158
  ESM dist/browser/index.js.map 34.66 KB
156
- ESM ⚡️ Build success in 111ms
157
- ESM dist/react-native-core/index.js 20.57 KB
159
+ ESM ⚡️ Build success in 58ms
158
160
  ESM dist/react-native-core/testing.js 119.00 B
159
161
  ESM dist/react-native-core/crypto.js 2.58 KB
160
162
  ESM dist/react-native-core/crypto/RNCrypto.js 120.00 B
161
- ESM dist/react-native-core/index.js.map 41.80 KB
163
+ ESM dist/react-native-core/index.js 20.62 KB
164
+ ESM dist/react-native-core/crypto/RNCrypto.js.map 178.00 B
162
165
  ESM dist/react-native-core/testing.js.map 175.00 B
166
+ ESM dist/react-native-core/index.js.map 41.57 KB
163
167
  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
166
- ESM dist/prosemirror/index.js 77.76 KB
167
- ESM dist/prosemirror/index.js.map 307.20 KB
168
- ESM ⚡️ Build success in 138ms
169
- ESM dist/react/index.js 25.96 KB
168
+ ESM ⚡️ Build success in 52ms
170
169
  ESM dist/react/testing.js 122.00 B
170
+ ESM dist/react/index.js 25.96 KB
171
171
  ESM dist/react/ssr.js 697.00 B
172
- ESM dist/react/index.js.map 55.44 KB
173
172
  ESM dist/react/testing.js.map 165.00 B
173
+ ESM dist/react/index.js.map 55.44 KB
174
174
  ESM dist/react/ssr.js.map 1.11 KB
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
180
- ESM dist/react-native/testing.js 120.00 B
175
+ ESM ⚡️ Build success in 45ms
181
176
  ESM dist/react-native/crypto.js 161.00 B
177
+ ESM dist/react-native/testing.js 120.00 B
182
178
  ESM dist/react-native/polyfills.js 858.00 B
183
- ESM dist/react-native/index.js.map 47.35 KB
184
- ESM dist/react-native/testing.js.map 176.00 B
179
+ ESM dist/react-native/index.js 23.17 KB
185
180
  ESM dist/react-native/crypto.js.map 197.00 B
181
+ ESM dist/react-native/testing.js.map 176.00 B
186
182
  ESM dist/react-native/polyfills.js.map 1.61 KB
187
- ESM ⚡️ Build success in 144ms
183
+ ESM dist/react-native/index.js.map 47.12 KB
184
+ ESM ⚡️ Build success in 59ms
185
+ ESM dist/prosemirror/index.js 77.76 KB
186
+ ESM dist/prosemirror/index.js.map 307.20 KB
187
+ ESM ⚡️ Build success in 62ms
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 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
194
+ ESM ⚡️ Build success in 73ms
195
+ ESM dist/chunk-PZ5AY32C.js 233.00 B
196
+ ESM dist/index.js 30.78 KB
198
197
  ESM dist/tools/ssr.js 156.00 B
199
198
  ESM dist/chunk-M2HGBOXS.js 694.00 B
200
- ESM dist/chunk-PZ5AY32C.js 233.00 B
201
- ESM dist/index.js.map 61.58 KB
202
- ESM dist/testing.js.map 16.21 KB
203
- ESM dist/tools/ssr.js.map 71.00 B
204
- ESM dist/chunk-M2HGBOXS.js.map 1.10 KB
199
+ ESM dist/testing.js 8.56 KB
200
+ ESM dist/chunk-OH2GW5WP.js 226.59 KB
205
201
  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
202
+ ESM dist/index.js.map 62.39 KB
203
+ ESM dist/chunk-M2HGBOXS.js.map 1.10 KB
204
+ ESM dist/tools/ssr.js.map 71.00 B
205
+ ESM dist/testing.js.map 16.21 KB
206
+ ESM dist/chunk-OH2GW5WP.js.map 532.76 KB
207
+ ESM ⚡️ Build success in 74ms
208
208
  ESM dist/inspector/register-custom-element.js 218.00 B
209
- ESM dist/inspector/custom-element-KYV64IOC.js 1.60 MB
210
209
  ESM dist/inspector/register-custom-element.js.map 314.00 B
210
+ ESM dist/inspector/custom-element-KYV64IOC.js 1.60 MB
211
211
  ESM dist/inspector/custom-element-KYV64IOC.js.map 2.47 MB
212
- ESM ⚡️ Build success in 244ms
212
+ ESM ⚡️ Build success in 122ms
213
213
 
214
- > jazz-tools@0.19.16 types /home/runner/_work/jazz/jazz/packages/jazz-tools
214
+ > jazz-tools@0.19.17 types /home/runner/_work/jazz/jazz/packages/jazz-tools
215
215
  > tsc --outDir dist
216
216
 
217
217
 
218
- > jazz-tools@0.19.16 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
218
+ > jazz-tools@0.19.17 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,14 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.19.17
4
+
5
+ ### Patch Changes
6
+
7
+ - d46cffd: Bugfix: fixed an issue where calling logOut multiple times concurrently could trigger duplicate logout operations
8
+ - cojson@0.19.17
9
+ - cojson-storage-indexeddb@0.19.17
10
+ - cojson-transport-ws@0.19.17
11
+
3
12
  ## 0.19.16
4
13
 
5
14
  ### Patch Changes
@@ -7061,19 +7061,35 @@ var JazzContextManager = class {
7061
7061
  constructor(opts) {
7062
7062
  this.keepContextOpen = false;
7063
7063
  this.authenticatingAccountID = null;
7064
+ /**
7065
+ * Flag to indicate if a logout operation is currently in progress.
7066
+ * Used to prevent concurrent logout attempts or double-logout issues.
7067
+ * Set to true when logout starts, reset to false once all logout logic runs.
7068
+ */
7069
+ this.loggingOut = false;
7070
+ /**
7071
+ * Handles the logout process.
7072
+ * Uses the loggingOut flag to ensure only one logout can happen at a time.
7073
+ */
7064
7074
  this.logOut = async () => {
7065
- if (!this.context || !this.props) {
7075
+ if (!this.context || !this.props || this.loggingOut) {
7066
7076
  return;
7067
7077
  }
7078
+ this.loggingOut = true;
7068
7079
  this.authenticatingAccountID = null;
7069
7080
  this.subscriptionCache.clear();
7070
- await this.props.onLogOut?.();
7071
- if (this.props.logOutReplacement) {
7072
- await this.props.logOutReplacement();
7073
- } else {
7074
- await this.context.logOut();
7075
- return this.createContext(this.props);
7081
+ try {
7082
+ await this.props.onLogOut?.();
7083
+ if (this.props.logOutReplacement) {
7084
+ await this.props.logOutReplacement();
7085
+ } else {
7086
+ await this.context.logOut();
7087
+ await this.createContext(this.props);
7088
+ }
7089
+ } catch (error) {
7090
+ console.error("Error during logout", error);
7076
7091
  }
7092
+ this.loggingOut = false;
7077
7093
  };
7078
7094
  this.done = () => {
7079
7095
  if (!this.context) {
@@ -7802,4 +7818,4 @@ export {
7802
7818
  JazzContextManager
7803
7819
  };
7804
7820
  /* istanbul ignore file -- @preserve */
7805
- //# sourceMappingURL=chunk-R3KIZG4P.js.map
7821
+ //# sourceMappingURL=chunk-OH2GW5WP.js.map