jazz-tools 0.15.11 → 0.15.13
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.
- package/.turbo/turbo-build.log +39 -39
- package/CHANGELOG.md +19 -0
- package/dist/{chunk-MLLG3GBR.js → chunk-6CCJYSYQ.js} +31 -17
- package/dist/chunk-6CCJYSYQ.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/testing.js +1 -1
- package/dist/tools/implementation/ContextManager.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts +1 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts.map +1 -1
- package/dist/tools/subscribe/CoValueCoreSubscription.d.ts.map +1 -1
- package/dist/tools/tests/testStorage.d.ts +5 -0
- package/dist/tools/tests/testStorage.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/react-core/tests/useCoState.test.ts +20 -0
- package/src/tools/implementation/ContextManager.ts +5 -1
- package/src/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.ts +27 -12
- package/src/tools/subscribe/CoValueCoreSubscription.ts +4 -0
- package/src/tools/tests/ContextManager.test.ts +79 -4
- package/src/tools/tests/load.test.ts +123 -0
- package/src/tools/tests/testStorage.ts +70 -0
- package/dist/chunk-MLLG3GBR.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.15.
|
2
|
+
> jazz-tools@0.15.13 build /home/runner/_work/jazz/jazz/packages/jazz-tools
|
3
3
|
> tsup && pnpm types && pnpm build:svelte
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
|
@@ -107,85 +107,85 @@
|
|
107
107
|
[34mESM[39m Build start
|
108
108
|
[34mCLI[39m Cleaning output folder
|
109
109
|
[34mESM[39m Build start
|
110
|
+
[32mESM[39m [1mdist/worker/index.js [22m[32m2.34 KB[39m
|
111
|
+
[32mESM[39m [1mdist/worker/index.js.map [22m[32m4.82 KB[39m
|
112
|
+
[32mESM[39m ⚡️ Build success in 15ms
|
113
|
+
[32mESM[39m [1mdist/tiptap/index.js [22m[32m564.00 B[39m
|
114
|
+
[32mESM[39m [1mdist/tiptap/index.js.map [22m[32m1.21 KB[39m
|
115
|
+
[32mESM[39m ⚡️ Build success in 15ms
|
110
116
|
[32mESM[39m [1mdist/browser-media-images/index.js [22m[32m2.55 KB[39m
|
111
117
|
[32mESM[39m [1mdist/browser-media-images/index.js.map [22m[32m5.44 KB[39m
|
112
|
-
[32mESM[39m ⚡️ Build success in
|
118
|
+
[32mESM[39m ⚡️ Build success in 22ms
|
113
119
|
[32mESM[39m [1mdist/react-native-media-images/index.js [22m[32m6.19 KB[39m
|
114
120
|
[32mESM[39m [1mdist/react-native-media-images/index.js.map [22m[32m10.96 KB[39m
|
115
121
|
[32mESM[39m ⚡️ Build success in 19ms
|
116
|
-
[32mESM[39m [1mdist/
|
117
|
-
[32mESM[39m [1mdist/
|
122
|
+
[32mESM[39m [1mdist/react-core/testing.js [22m[32m1.17 KB[39m
|
123
|
+
[32mESM[39m [1mdist/react-core/index.js [22m[32m8.37 KB[39m
|
124
|
+
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js [22m[32m279.00 B[39m
|
125
|
+
[32mESM[39m [1mdist/react-core/testing.js.map [22m[32m1.82 KB[39m
|
126
|
+
[32mESM[39m [1mdist/react-core/index.js.map [22m[32m16.39 KB[39m
|
127
|
+
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js.map [22m[32m533.00 B[39m
|
118
128
|
[32mESM[39m ⚡️ Build success in 22ms
|
119
|
-
[32mESM[39m [1mdist/worker/index.js [22m[32m2.34 KB[39m
|
120
|
-
[32mESM[39m [1mdist/worker/index.js.map [22m[32m4.82 KB[39m
|
121
|
-
[32mESM[39m ⚡️ Build success in 23ms
|
122
|
-
[32mESM[39m [1mdist/browser/index.js [22m[32m13.43 KB[39m
|
123
|
-
[32mESM[39m [1mdist/browser/index.js.map [22m[32m28.67 KB[39m
|
124
|
-
[32mESM[39m ⚡️ Build success in 37ms
|
125
129
|
[32mESM[39m [1mdist/react-native/index.js [22m[32m2.53 KB[39m
|
126
|
-
[32mESM[39m [1mdist/react-native/testing.js [22m[32m120.00 B[39m
|
127
130
|
[32mESM[39m [1mdist/react-native/crypto.js [22m[32m117.00 B[39m
|
131
|
+
[32mESM[39m [1mdist/react-native/testing.js [22m[32m120.00 B[39m
|
128
132
|
[32mESM[39m [1mdist/react-native/index.js.map [22m[32m5.68 KB[39m
|
129
|
-
[32mESM[39m [1mdist/react-native/testing.js.map [22m[32m176.00 B[39m
|
130
133
|
[32mESM[39m [1mdist/react-native/crypto.js.map [22m[32m174.00 B[39m
|
131
|
-
[32mESM[39m
|
132
|
-
[32mESM[39m
|
133
|
-
[32mESM[39m [1mdist/
|
134
|
-
[32mESM[39m [1mdist/
|
135
|
-
[32mESM[39m
|
136
|
-
[32mESM[39m [1mdist/react-core/testing.js.map [22m[32m1.82 KB[39m
|
137
|
-
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js.map [22m[32m533.00 B[39m
|
138
|
-
[32mESM[39m ⚡️ Build success in 36ms
|
134
|
+
[32mESM[39m [1mdist/react-native/testing.js.map [22m[32m176.00 B[39m
|
135
|
+
[32mESM[39m ⚡️ Build success in 24ms
|
136
|
+
[32mESM[39m [1mdist/browser/index.js [22m[32m13.43 KB[39m
|
137
|
+
[32mESM[39m [1mdist/browser/index.js.map [22m[32m28.67 KB[39m
|
138
|
+
[32mESM[39m ⚡️ Build success in 31ms
|
139
139
|
[32mESM[39m [1mdist/expo/index.js [22m[32m4.65 KB[39m
|
140
140
|
[32mESM[39m [1mdist/expo/testing.js [22m[32m112.00 B[39m
|
141
141
|
[32mESM[39m [1mdist/expo/crypto.js [22m[32m109.00 B[39m
|
142
142
|
[32mESM[39m [1mdist/expo/index.js.map [22m[32m10.17 KB[39m
|
143
143
|
[32mESM[39m [1mdist/expo/testing.js.map [22m[32m168.00 B[39m
|
144
144
|
[32mESM[39m [1mdist/expo/crypto.js.map [22m[32m166.00 B[39m
|
145
|
-
[32mESM[39m ⚡️ Build success in
|
146
|
-
[32mESM[39m [1mdist/prosemirror/index.js [22m[32m76.90 KB[39m
|
147
|
-
[32mESM[39m [1mdist/prosemirror/index.js.map [22m[32m305.53 KB[39m
|
148
|
-
[32mESM[39m ⚡️ Build success in 55ms
|
145
|
+
[32mESM[39m ⚡️ Build success in 38ms
|
149
146
|
[32mESM[39m [1mdist/react/index.js [22m[32m20.68 KB[39m
|
150
147
|
[32mESM[39m [1mdist/react/testing.js [22m[32m107.00 B[39m
|
151
148
|
[32mESM[39m [1mdist/react/ssr.js [22m[32m688.00 B[39m
|
152
149
|
[32mESM[39m [1mdist/react/index.js.map [22m[32m34.13 KB[39m
|
153
150
|
[32mESM[39m [1mdist/react/testing.js.map [22m[32m163.00 B[39m
|
154
151
|
[32mESM[39m [1mdist/react/ssr.js.map [22m[32m1.12 KB[39m
|
155
|
-
[32mESM[39m ⚡️ Build success in
|
152
|
+
[32mESM[39m ⚡️ Build success in 41ms
|
156
153
|
[32mESM[39m [1mdist/react-native-core/index.js [22m[32m16.95 KB[39m
|
157
154
|
[32mESM[39m [1mdist/react-native-core/testing.js [22m[32m119.00 B[39m
|
158
155
|
[32mESM[39m [1mdist/react-native-core/crypto.js [22m[32m2.10 KB[39m
|
159
156
|
[32mESM[39m [1mdist/react-native-core/index.js.map [22m[32m33.57 KB[39m
|
160
|
-
[32mESM[39m [1mdist/react-native-core/crypto.js.map [22m[32m4.25 KB[39m
|
161
157
|
[32mESM[39m [1mdist/react-native-core/testing.js.map [22m[32m175.00 B[39m
|
162
|
-
[32mESM[39m
|
163
|
-
[32mESM[39m
|
158
|
+
[32mESM[39m [1mdist/react-native-core/crypto.js.map [22m[32m4.25 KB[39m
|
159
|
+
[32mESM[39m ⚡️ Build success in 40ms
|
160
|
+
[32mESM[39m [1mdist/prosemirror/index.js [22m[32m76.90 KB[39m
|
161
|
+
[32mESM[39m [1mdist/prosemirror/index.js.map [22m[32m305.53 KB[39m
|
162
|
+
[32mESM[39m ⚡️ Build success in 50ms
|
164
163
|
[32mESM[39m [1mdist/react/index.js [22m[32m20.70 KB[39m
|
165
|
-
[32mESM[39m [1mdist/react/testing.js
|
164
|
+
[32mESM[39m [1mdist/react/testing.js [22m[32m122.00 B[39m
|
166
165
|
[32mESM[39m [1mdist/react/index.js.map [22m[32m34.13 KB[39m
|
167
|
-
[32mESM[39m
|
166
|
+
[32mESM[39m [1mdist/react/testing.js.map [22m[32m165.00 B[39m
|
167
|
+
[32mESM[39m ⚡️ Build success in 50ms
|
168
168
|
[32mESM[39m [1mdist/inspector/index.js [22m[32m60.37 KB[39m
|
169
169
|
[32mESM[39m [1mdist/inspector/index.js.map [22m[32m107.85 KB[39m
|
170
|
-
[32mESM[39m ⚡️ Build success in
|
171
|
-
[32mESM[39m [1mdist/testing.js [22m[32m6.72 KB[39m
|
170
|
+
[32mESM[39m ⚡️ Build success in 68ms
|
172
171
|
[32mESM[39m [1mdist/index.js [22m[32m16.19 KB[39m
|
173
|
-
[32mESM[39m [1mdist/
|
174
|
-
[32mESM[39m [1mdist/
|
172
|
+
[32mESM[39m [1mdist/testing.js [22m[32m6.72 KB[39m
|
173
|
+
[32mESM[39m [1mdist/chunk-6CCJYSYQ.js [22m[32m146.58 KB[39m
|
175
174
|
[32mESM[39m [1mdist/index.js.map [22m[32m29.03 KB[39m
|
176
|
-
[32mESM[39m [1mdist/
|
177
|
-
[32mESM[39m
|
175
|
+
[32mESM[39m [1mdist/testing.js.map [22m[32m13.03 KB[39m
|
176
|
+
[32mESM[39m [1mdist/chunk-6CCJYSYQ.js.map [22m[32m356.50 KB[39m
|
177
|
+
[32mESM[39m ⚡️ Build success in 78ms
|
178
178
|
[32mESM[39m [1mdist/inspector/register-custom-element.js [22m[32m218.00 B[39m
|
179
179
|
[32mESM[39m [1mdist/inspector/register-custom-element.js.map [22m[32m314.00 B[39m
|
180
180
|
[32mESM[39m [1mdist/inspector/custom-element-TUXKXSZU.js [22m[32m1.53 MB[39m
|
181
181
|
[32mESM[39m [1mdist/inspector/custom-element-TUXKXSZU.js.map [22m[32m2.35 MB[39m
|
182
|
-
[32mESM[39m ⚡️ Build success in
|
182
|
+
[32mESM[39m ⚡️ Build success in 122ms
|
183
183
|
|
184
|
-
> jazz-tools@0.15.
|
184
|
+
> jazz-tools@0.15.13 types /home/runner/_work/jazz/jazz/packages/jazz-tools
|
185
185
|
> tsc --outDir dist
|
186
186
|
|
187
187
|
|
188
|
-
> jazz-tools@0.15.
|
188
|
+
> jazz-tools@0.15.13 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
|
189
189
|
> rm -rf dist/svelte && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json
|
190
190
|
|
191
191
|
src/svelte -> dist/svelte
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.15.13
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 6c76ff8: Fix load failures when loading a missing ref declared with z.optional and Schema.optional
|
8
|
+
- cojson@0.15.13
|
9
|
+
- cojson-storage-indexeddb@0.15.13
|
10
|
+
- cojson-transport-ws@0.15.13
|
11
|
+
|
12
|
+
## 0.15.12
|
13
|
+
|
14
|
+
### Patch Changes
|
15
|
+
|
16
|
+
- d1c1b0c: Fix stuck authentication when using onAnonymousAccountDiscarded with a storage
|
17
|
+
- cf4ad72: fix unhandled rejection on CoValue.load
|
18
|
+
- cojson@0.15.12
|
19
|
+
- cojson-storage-indexeddb@0.15.12
|
20
|
+
- cojson-transport-ws@0.15.12
|
21
|
+
|
3
22
|
## 0.15.11
|
4
23
|
|
5
24
|
### Patch Changes
|
@@ -2931,6 +2931,9 @@ var CoValueCoreSubscription = class {
|
|
2931
2931
|
this.subscribeToState();
|
2932
2932
|
this.listener("unavailable");
|
2933
2933
|
}
|
2934
|
+
}).catch((error) => {
|
2935
|
+
console.error("Unexpected error loading CoValue: ", error);
|
2936
|
+
this.listener("unavailable");
|
2934
2937
|
});
|
2935
2938
|
}
|
2936
2939
|
}
|
@@ -3836,27 +3839,31 @@ function isUnionOfPrimitivesDeeply(schema) {
|
|
3836
3839
|
}
|
3837
3840
|
|
3838
3841
|
// src/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.ts
|
3839
|
-
function schemaFieldToCoFieldDef(schema) {
|
3842
|
+
function schemaFieldToCoFieldDef(schema, isOptional = false) {
|
3840
3843
|
if (isCoValueClass(schema)) {
|
3841
|
-
|
3844
|
+
if (isOptional) {
|
3845
|
+
return coField.ref(schema, { optional: true });
|
3846
|
+
} else {
|
3847
|
+
return coField.ref(schema);
|
3848
|
+
}
|
3842
3849
|
} else if (isCoValueSchema(schema)) {
|
3843
3850
|
if (isAnyCoOptionalSchema(schema)) {
|
3844
3851
|
return coField.ref(schema.getCoValueClass(), {
|
3845
3852
|
optional: true
|
3846
3853
|
});
|
3847
3854
|
}
|
3848
|
-
|
3855
|
+
if (isOptional) {
|
3856
|
+
return coField.ref(schema.getCoValueClass(), { optional: true });
|
3857
|
+
} else {
|
3858
|
+
return coField.ref(schema.getCoValueClass());
|
3859
|
+
}
|
3849
3860
|
} else {
|
3850
3861
|
if ("_zod" in schema) {
|
3851
3862
|
if (schema._zod.def.type === "optional") {
|
3852
3863
|
const inner = zodSchemaToCoSchemaOrKeepPrimitive(
|
3853
3864
|
schema._zod.def.innerType
|
3854
3865
|
);
|
3855
|
-
|
3856
|
-
return coField.ref(inner, { optional: true });
|
3857
|
-
} else {
|
3858
|
-
return schemaFieldToCoFieldDef(inner);
|
3859
|
-
}
|
3866
|
+
return schemaFieldToCoFieldDef(inner, true);
|
3860
3867
|
} else if (schema._zod.def.type === "string") {
|
3861
3868
|
return coField.string;
|
3862
3869
|
} else if (schema._zod.def.type === "number") {
|
@@ -3869,7 +3876,8 @@ function schemaFieldToCoFieldDef(schema) {
|
|
3869
3876
|
return coField.string;
|
3870
3877
|
} else if (schema._zod.def.type === "readonly") {
|
3871
3878
|
return schemaFieldToCoFieldDef(
|
3872
|
-
schema.def.innerType
|
3879
|
+
schema.def.innerType,
|
3880
|
+
isOptional
|
3873
3881
|
);
|
3874
3882
|
} else if (schema._zod.def.type === "date") {
|
3875
3883
|
return coField.optional.Date;
|
@@ -3877,14 +3885,16 @@ function schemaFieldToCoFieldDef(schema) {
|
|
3877
3885
|
return coField.string;
|
3878
3886
|
} else if (schema._zod.def.type === "lazy") {
|
3879
3887
|
return schemaFieldToCoFieldDef(
|
3880
|
-
schema.unwrap()
|
3888
|
+
schema.unwrap(),
|
3889
|
+
isOptional
|
3881
3890
|
);
|
3882
3891
|
} else if (schema._zod.def.type === "default" || schema._zod.def.type === "catch") {
|
3883
3892
|
console.warn(
|
3884
3893
|
"z.default()/z.catch() are not supported in collaborative schemas. They will be ignored."
|
3885
3894
|
);
|
3886
3895
|
return schemaFieldToCoFieldDef(
|
3887
|
-
schema.def.innerType
|
3896
|
+
schema.def.innerType,
|
3897
|
+
isOptional
|
3888
3898
|
);
|
3889
3899
|
} else if (schema._zod.def.type === "literal") {
|
3890
3900
|
if (schema._zod.def.values.some(
|
@@ -3905,7 +3915,7 @@ function schemaFieldToCoFieldDef(schema) {
|
|
3905
3915
|
return coField.json();
|
3906
3916
|
} else if (schema._zod.def.type === "custom") {
|
3907
3917
|
if ("builtin" in schema) {
|
3908
|
-
return schemaFieldToCoFieldDef(schema.builtin);
|
3918
|
+
return schemaFieldToCoFieldDef(schema.builtin, isOptional);
|
3909
3919
|
} else {
|
3910
3920
|
throw new Error(`Unsupported custom zod type`);
|
3911
3921
|
}
|
@@ -3913,9 +3923,12 @@ function schemaFieldToCoFieldDef(schema) {
|
|
3913
3923
|
if (isUnionOfPrimitivesDeeply(schema)) {
|
3914
3924
|
return coField.json();
|
3915
3925
|
} else if (isUnionOfCoMapsDeeply(schema)) {
|
3916
|
-
|
3917
|
-
|
3918
|
-
|
3926
|
+
const result = schemaUnionDiscriminatorFor(schema);
|
3927
|
+
if (isOptional) {
|
3928
|
+
return coField.ref(result, { optional: true });
|
3929
|
+
} else {
|
3930
|
+
return coField.ref(result);
|
3931
|
+
}
|
3919
3932
|
} else {
|
3920
3933
|
throw new Error(
|
3921
3934
|
"z.union()/z.discriminatedUnion() of mixed collaborative and non-collaborative types is not supported"
|
@@ -4750,8 +4763,9 @@ var JazzContextManager = class {
|
|
4750
4763
|
peer2role: "server"
|
4751
4764
|
}
|
4752
4765
|
);
|
4753
|
-
prevContext.node.
|
4766
|
+
prevContext.node.removeStorage();
|
4754
4767
|
currentContext.node.syncManager.addPeer(prevAccountAsPeer);
|
4768
|
+
prevContext.node.syncManager.addPeer(currentAccountAsPeer);
|
4755
4769
|
try {
|
4756
4770
|
await this.props.onAnonymousAccountDiscarded?.(prevContext.me);
|
4757
4771
|
await prevContext.me.waitForAllCoValuesSync();
|
@@ -5101,4 +5115,4 @@ export {
|
|
5101
5115
|
JazzContextManager
|
5102
5116
|
};
|
5103
5117
|
/* istanbul ignore file -- @preserve */
|
5104
|
-
//# sourceMappingURL=chunk-
|
5118
|
+
//# sourceMappingURL=chunk-6CCJYSYQ.js.map
|