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.
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.15.11 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/worker/index.js 2.34 KB
111
+ ESM dist/worker/index.js.map 4.82 KB
112
+ ESM ⚡️ Build success in 15ms
113
+ ESM dist/tiptap/index.js 564.00 B
114
+ ESM dist/tiptap/index.js.map 1.21 KB
115
+ ESM ⚡️ Build success in 15ms
110
116
  ESM dist/browser-media-images/index.js 2.55 KB
111
117
  ESM dist/browser-media-images/index.js.map 5.44 KB
112
- ESM ⚡️ Build success in 23ms
118
+ ESM ⚡️ Build success in 22ms
113
119
  ESM dist/react-native-media-images/index.js 6.19 KB
114
120
  ESM dist/react-native-media-images/index.js.map 10.96 KB
115
121
  ESM ⚡️ Build success in 19ms
116
- ESM dist/tiptap/index.js 564.00 B
117
- ESM dist/tiptap/index.js.map 1.21 KB
122
+ ESM dist/react-core/testing.js 1.17 KB
123
+ ESM dist/react-core/index.js 8.37 KB
124
+ ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
125
+ ESM dist/react-core/testing.js.map 1.82 KB
126
+ ESM dist/react-core/index.js.map 16.39 KB
127
+ ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
118
128
  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 23ms
122
- ESM dist/browser/index.js 13.43 KB
123
- ESM dist/browser/index.js.map 28.67 KB
124
- ESM ⚡️ Build success in 37ms
125
129
  ESM dist/react-native/index.js 2.53 KB
126
- ESM dist/react-native/testing.js 120.00 B
127
130
  ESM dist/react-native/crypto.js 117.00 B
131
+ ESM dist/react-native/testing.js 120.00 B
128
132
  ESM dist/react-native/index.js.map 5.68 KB
129
- ESM dist/react-native/testing.js.map 176.00 B
130
133
  ESM dist/react-native/crypto.js.map 174.00 B
131
- ESM ⚡️ Build success in 34ms
132
- ESM dist/react-core/index.js 8.37 KB
133
- ESM dist/react-core/testing.js 1.17 KB
134
- ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
135
- ESM dist/react-core/index.js.map 16.39 KB
136
- ESM dist/react-core/testing.js.map 1.82 KB
137
- ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
138
- ESM ⚡️ Build success in 36ms
134
+ ESM dist/react-native/testing.js.map 176.00 B
135
+ ESM ⚡️ Build success in 24ms
136
+ ESM dist/browser/index.js 13.43 KB
137
+ ESM dist/browser/index.js.map 28.67 KB
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
142
  ESM dist/expo/index.js.map 10.17 KB
143
143
  ESM dist/expo/testing.js.map 168.00 B
144
144
  ESM dist/expo/crypto.js.map 166.00 B
145
- ESM ⚡️ Build success in 39ms
146
- ESM dist/prosemirror/index.js 76.90 KB
147
- ESM dist/prosemirror/index.js.map 305.53 KB
148
- ESM ⚡️ Build success in 55ms
145
+ ESM ⚡️ Build success in 38ms
149
146
  ESM dist/react/index.js 20.68 KB
150
147
  ESM dist/react/testing.js 107.00 B
151
148
  ESM dist/react/ssr.js 688.00 B
152
149
  ESM dist/react/index.js.map 34.13 KB
153
150
  ESM dist/react/testing.js.map 163.00 B
154
151
  ESM dist/react/ssr.js.map 1.12 KB
155
- ESM ⚡️ Build success in 56ms
152
+ ESM ⚡️ Build success in 41ms
156
153
  ESM dist/react-native-core/index.js 16.95 KB
157
154
  ESM dist/react-native-core/testing.js 119.00 B
158
155
  ESM dist/react-native-core/crypto.js 2.10 KB
159
156
  ESM dist/react-native-core/index.js.map 33.57 KB
160
- ESM dist/react-native-core/crypto.js.map 4.25 KB
161
157
  ESM dist/react-native-core/testing.js.map 175.00 B
162
- ESM ⚡️ Build success in 55ms
163
- ESM dist/react/testing.js 122.00 B
158
+ ESM dist/react-native-core/crypto.js.map 4.25 KB
159
+ ESM ⚡️ Build success in 40ms
160
+ ESM dist/prosemirror/index.js 76.90 KB
161
+ ESM dist/prosemirror/index.js.map 305.53 KB
162
+ ESM ⚡️ Build success in 50ms
164
163
  ESM dist/react/index.js 20.70 KB
165
- ESM dist/react/testing.js.map 165.00 B
164
+ ESM dist/react/testing.js 122.00 B
166
165
  ESM dist/react/index.js.map 34.13 KB
167
- ESM ⚡️ Build success in 56ms
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 69ms
171
- ESM dist/testing.js 6.72 KB
170
+ ESM ⚡️ Build success in 68ms
172
171
  ESM dist/index.js 16.19 KB
173
- ESM dist/chunk-MLLG3GBR.js 146.10 KB
174
- ESM dist/testing.js.map 13.03 KB
172
+ ESM dist/testing.js 6.72 KB
173
+ ESM dist/chunk-6CCJYSYQ.js 146.58 KB
175
174
  ESM dist/index.js.map 29.03 KB
176
- ESM dist/chunk-MLLG3GBR.js.map 355.42 KB
177
- ESM ⚡️ Build success in 91ms
175
+ ESM dist/testing.js.map 13.03 KB
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 125ms
182
+ ESM ⚡️ Build success in 122ms
183
183
 
184
- > jazz-tools@0.15.11 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.11 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,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
- return coField.ref(schema);
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
- 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
+ }
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
- if (isCoValueClass(inner)) {
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
- return coField.ref(
3917
- schemaUnionDiscriminatorFor(schema)
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.syncManager.addPeer(currentAccountAsPeer);
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-MLLG3GBR.js.map
5118
+ //# sourceMappingURL=chunk-6CCJYSYQ.js.map