jazz-tools 0.15.12 → 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.
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.15.12 build /home/runner/_work/jazz/jazz/packages/jazz-tools
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
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -107,85 +107,85 @@
107
107
  ESM Build start
108
108
  CLI Cleaning output folder
109
109
  ESM Build start
110
- ESM dist/browser-media-images/index.js 2.55 KB
111
- ESM dist/browser-media-images/index.js.map 5.44 KB
112
- ESM ⚡️ Build success in 26ms
110
+ ESM dist/worker/index.js 2.34 KB
111
+ ESM dist/worker/index.js.map 4.82 KB
112
+ ESM ⚡️ Build success in 15ms
113
113
  ESM dist/tiptap/index.js 564.00 B
114
114
  ESM dist/tiptap/index.js.map 1.21 KB
115
+ ESM ⚡️ Build success in 15ms
116
+ ESM dist/browser-media-images/index.js 2.55 KB
117
+ ESM dist/browser-media-images/index.js.map 5.44 KB
115
118
  ESM ⚡️ Build success in 22ms
116
119
  ESM dist/react-native-media-images/index.js 6.19 KB
117
120
  ESM dist/react-native-media-images/index.js.map 10.96 KB
118
- ESM ⚡️ Build success in 22ms
119
- ESM dist/worker/index.js 2.34 KB
120
- ESM dist/worker/index.js.map 4.82 KB
121
- ESM ⚡️ Build success in 21ms
122
- ESM dist/react-core/index.js 8.37 KB
121
+ ESM ⚡️ Build success in 19ms
123
122
  ESM dist/react-core/testing.js 1.17 KB
123
+ ESM dist/react-core/index.js 8.37 KB
124
124
  ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
125
125
  ESM dist/react-core/testing.js.map 1.82 KB
126
126
  ESM dist/react-core/index.js.map 16.39 KB
127
127
  ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
128
- ESM ⚡️ Build success in 27ms
128
+ ESM ⚡️ Build success in 22ms
129
129
  ESM dist/react-native/index.js 2.53 KB
130
- ESM dist/react-native/testing.js 120.00 B
131
130
  ESM dist/react-native/crypto.js 117.00 B
131
+ ESM dist/react-native/testing.js 120.00 B
132
132
  ESM dist/react-native/index.js.map 5.68 KB
133
- ESM dist/react-native/testing.js.map 176.00 B
134
133
  ESM dist/react-native/crypto.js.map 174.00 B
135
- ESM ⚡️ Build success in 27ms
134
+ ESM dist/react-native/testing.js.map 176.00 B
135
+ ESM ⚡️ Build success in 24ms
136
136
  ESM dist/browser/index.js 13.43 KB
137
137
  ESM dist/browser/index.js.map 28.67 KB
138
- ESM ⚡️ Build success in 36ms
138
+ ESM ⚡️ Build success in 31ms
139
139
  ESM dist/expo/index.js 4.65 KB
140
140
  ESM dist/expo/testing.js 112.00 B
141
141
  ESM dist/expo/crypto.js 109.00 B
142
+ ESM dist/expo/index.js.map 10.17 KB
142
143
  ESM dist/expo/testing.js.map 168.00 B
143
144
  ESM dist/expo/crypto.js.map 166.00 B
144
- ESM dist/expo/index.js.map 10.17 KB
145
- ESM ⚡️ Build success in 43ms
146
- ESM dist/react/testing.js 122.00 B
147
- ESM dist/react/index.js 20.70 KB
148
- ESM dist/react/testing.js.map 165.00 B
149
- ESM dist/react/index.js.map 34.13 KB
150
- ESM ⚡️ Build success in 51ms
145
+ ESM ⚡️ Build success in 38ms
151
146
  ESM dist/react/index.js 20.68 KB
152
147
  ESM dist/react/testing.js 107.00 B
153
148
  ESM dist/react/ssr.js 688.00 B
154
149
  ESM dist/react/index.js.map 34.13 KB
155
150
  ESM dist/react/testing.js.map 163.00 B
156
151
  ESM dist/react/ssr.js.map 1.12 KB
157
- ESM ⚡️ Build success in 51ms
152
+ ESM ⚡️ Build success in 41ms
158
153
  ESM dist/react-native-core/index.js 16.95 KB
159
154
  ESM dist/react-native-core/testing.js 119.00 B
160
155
  ESM dist/react-native-core/crypto.js 2.10 KB
161
156
  ESM dist/react-native-core/index.js.map 33.57 KB
162
157
  ESM dist/react-native-core/testing.js.map 175.00 B
163
158
  ESM dist/react-native-core/crypto.js.map 4.25 KB
164
- ESM ⚡️ Build success in 49ms
159
+ ESM ⚡️ Build success in 40ms
165
160
  ESM dist/prosemirror/index.js 76.90 KB
166
161
  ESM dist/prosemirror/index.js.map 305.53 KB
167
- ESM ⚡️ Build success in 61ms
162
+ ESM ⚡️ Build success in 50ms
163
+ ESM dist/react/index.js 20.70 KB
164
+ ESM dist/react/testing.js 122.00 B
165
+ ESM dist/react/index.js.map 34.13 KB
166
+ ESM dist/react/testing.js.map 165.00 B
167
+ ESM ⚡️ Build success in 50ms
168
168
  ESM dist/inspector/index.js 60.37 KB
169
169
  ESM dist/inspector/index.js.map 107.85 KB
170
- ESM ⚡️ Build success in 71ms
170
+ ESM ⚡️ Build success in 68ms
171
171
  ESM dist/index.js 16.19 KB
172
172
  ESM dist/testing.js 6.72 KB
173
- ESM dist/chunk-DZFT4EZM.js 146.27 KB
173
+ ESM dist/chunk-6CCJYSYQ.js 146.58 KB
174
174
  ESM dist/index.js.map 29.03 KB
175
175
  ESM dist/testing.js.map 13.03 KB
176
- ESM dist/chunk-DZFT4EZM.js.map 355.92 KB
177
- ESM ⚡️ Build success in 93ms
176
+ ESM dist/chunk-6CCJYSYQ.js.map 356.50 KB
177
+ ESM ⚡️ Build success in 78ms
178
178
  ESM dist/inspector/register-custom-element.js 218.00 B
179
179
  ESM dist/inspector/register-custom-element.js.map 314.00 B
180
180
  ESM dist/inspector/custom-element-TUXKXSZU.js 1.53 MB
181
181
  ESM dist/inspector/custom-element-TUXKXSZU.js.map 2.35 MB
182
- ESM ⚡️ Build success in 140ms
182
+ ESM ⚡️ Build success in 122ms
183
183
 
184
- > jazz-tools@0.15.12 types /home/runner/_work/jazz/jazz/packages/jazz-tools
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.12 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
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,14 @@
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
+
3
12
  ## 0.15.12
4
13
 
5
14
  ### Patch Changes
@@ -3839,27 +3839,31 @@ function isUnionOfPrimitivesDeeply(schema) {
3839
3839
  }
3840
3840
 
3841
3841
  // src/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.ts
3842
- function schemaFieldToCoFieldDef(schema) {
3842
+ function schemaFieldToCoFieldDef(schema, isOptional = false) {
3843
3843
  if (isCoValueClass(schema)) {
3844
- return coField.ref(schema);
3844
+ if (isOptional) {
3845
+ return coField.ref(schema, { optional: true });
3846
+ } else {
3847
+ return coField.ref(schema);
3848
+ }
3845
3849
  } else if (isCoValueSchema(schema)) {
3846
3850
  if (isAnyCoOptionalSchema(schema)) {
3847
3851
  return coField.ref(schema.getCoValueClass(), {
3848
3852
  optional: true
3849
3853
  });
3850
3854
  }
3851
- return coField.ref(schema.getCoValueClass());
3855
+ if (isOptional) {
3856
+ return coField.ref(schema.getCoValueClass(), { optional: true });
3857
+ } else {
3858
+ return coField.ref(schema.getCoValueClass());
3859
+ }
3852
3860
  } else {
3853
3861
  if ("_zod" in schema) {
3854
3862
  if (schema._zod.def.type === "optional") {
3855
3863
  const inner = zodSchemaToCoSchemaOrKeepPrimitive(
3856
3864
  schema._zod.def.innerType
3857
3865
  );
3858
- if (isCoValueClass(inner)) {
3859
- return coField.ref(inner, { optional: true });
3860
- } else {
3861
- return schemaFieldToCoFieldDef(inner);
3862
- }
3866
+ return schemaFieldToCoFieldDef(inner, true);
3863
3867
  } else if (schema._zod.def.type === "string") {
3864
3868
  return coField.string;
3865
3869
  } else if (schema._zod.def.type === "number") {
@@ -3872,7 +3876,8 @@ function schemaFieldToCoFieldDef(schema) {
3872
3876
  return coField.string;
3873
3877
  } else if (schema._zod.def.type === "readonly") {
3874
3878
  return schemaFieldToCoFieldDef(
3875
- schema.def.innerType
3879
+ schema.def.innerType,
3880
+ isOptional
3876
3881
  );
3877
3882
  } else if (schema._zod.def.type === "date") {
3878
3883
  return coField.optional.Date;
@@ -3880,14 +3885,16 @@ function schemaFieldToCoFieldDef(schema) {
3880
3885
  return coField.string;
3881
3886
  } else if (schema._zod.def.type === "lazy") {
3882
3887
  return schemaFieldToCoFieldDef(
3883
- schema.unwrap()
3888
+ schema.unwrap(),
3889
+ isOptional
3884
3890
  );
3885
3891
  } else if (schema._zod.def.type === "default" || schema._zod.def.type === "catch") {
3886
3892
  console.warn(
3887
3893
  "z.default()/z.catch() are not supported in collaborative schemas. They will be ignored."
3888
3894
  );
3889
3895
  return schemaFieldToCoFieldDef(
3890
- schema.def.innerType
3896
+ schema.def.innerType,
3897
+ isOptional
3891
3898
  );
3892
3899
  } else if (schema._zod.def.type === "literal") {
3893
3900
  if (schema._zod.def.values.some(
@@ -3908,7 +3915,7 @@ function schemaFieldToCoFieldDef(schema) {
3908
3915
  return coField.json();
3909
3916
  } else if (schema._zod.def.type === "custom") {
3910
3917
  if ("builtin" in schema) {
3911
- return schemaFieldToCoFieldDef(schema.builtin);
3918
+ return schemaFieldToCoFieldDef(schema.builtin, isOptional);
3912
3919
  } else {
3913
3920
  throw new Error(`Unsupported custom zod type`);
3914
3921
  }
@@ -3916,9 +3923,12 @@ function schemaFieldToCoFieldDef(schema) {
3916
3923
  if (isUnionOfPrimitivesDeeply(schema)) {
3917
3924
  return coField.json();
3918
3925
  } else if (isUnionOfCoMapsDeeply(schema)) {
3919
- return coField.ref(
3920
- schemaUnionDiscriminatorFor(schema)
3921
- );
3926
+ const result = schemaUnionDiscriminatorFor(schema);
3927
+ if (isOptional) {
3928
+ return coField.ref(result, { optional: true });
3929
+ } else {
3930
+ return coField.ref(result);
3931
+ }
3922
3932
  } else {
3923
3933
  throw new Error(
3924
3934
  "z.union()/z.discriminatedUnion() of mixed collaborative and non-collaborative types is not supported"
@@ -5105,4 +5115,4 @@ export {
5105
5115
  JazzContextManager
5106
5116
  };
5107
5117
  /* istanbul ignore file -- @preserve */
5108
- //# sourceMappingURL=chunk-DZFT4EZM.js.map
5118
+ //# sourceMappingURL=chunk-6CCJYSYQ.js.map