jazz-tools 0.19.0 → 0.19.2

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 (84) hide show
  1. package/.turbo/turbo-build.log +53 -53
  2. package/CHANGELOG.md +21 -0
  3. package/dist/{chunk-P3YLNFN4.js → chunk-NCNM6UDZ.js} +61 -22
  4. package/dist/chunk-NCNM6UDZ.js.map +1 -0
  5. package/dist/index.js +1 -1
  6. package/dist/inspector/{custom-element-QESCMFY7.js → custom-element-ABVPHX53.js} +1118 -465
  7. package/dist/inspector/custom-element-ABVPHX53.js.map +1 -0
  8. package/dist/inspector/index.js +1090 -437
  9. package/dist/inspector/index.js.map +1 -1
  10. package/dist/inspector/register-custom-element.js +1 -1
  11. package/dist/inspector/tests/utils/history.test.d.ts +2 -0
  12. package/dist/inspector/tests/utils/history.test.d.ts.map +1 -0
  13. package/dist/inspector/tests/viewer/co-value-editor.test.d.ts +2 -0
  14. package/dist/inspector/tests/viewer/co-value-editor.test.d.ts.map +1 -0
  15. package/dist/inspector/tests/viewer/comap-view.test.d.ts +2 -0
  16. package/dist/inspector/tests/viewer/comap-view.test.d.ts.map +1 -0
  17. package/dist/inspector/ui/icon.d.ts +6 -0
  18. package/dist/inspector/ui/icon.d.ts.map +1 -1
  19. package/dist/inspector/ui/icons/add-icon.d.ts +2 -0
  20. package/dist/inspector/ui/icons/add-icon.d.ts.map +1 -0
  21. package/dist/inspector/ui/icons/edit-icon.d.ts +2 -0
  22. package/dist/inspector/ui/icons/edit-icon.d.ts.map +1 -0
  23. package/dist/inspector/ui/icons/history.d.ts +2 -0
  24. package/dist/inspector/ui/icons/history.d.ts.map +1 -0
  25. package/dist/inspector/utils/history.d.ts +3 -0
  26. package/dist/inspector/utils/history.d.ts.map +1 -0
  27. package/dist/inspector/utils/transactions-changes.d.ts +38 -0
  28. package/dist/inspector/utils/transactions-changes.d.ts.map +1 -0
  29. package/dist/inspector/viewer/co-map-view.d.ts +9 -0
  30. package/dist/inspector/viewer/co-map-view.d.ts.map +1 -0
  31. package/dist/inspector/viewer/co-value-editor.d.ts +10 -0
  32. package/dist/inspector/viewer/co-value-editor.d.ts.map +1 -0
  33. package/dist/inspector/viewer/grid-view.d.ts +3 -2
  34. package/dist/inspector/viewer/grid-view.d.ts.map +1 -1
  35. package/dist/inspector/viewer/history-view.d.ts.map +1 -1
  36. package/dist/inspector/viewer/page.d.ts.map +1 -1
  37. package/dist/testing.js +1 -1
  38. package/dist/tools/coValues/CoFieldInit.d.ts +2 -1
  39. package/dist/tools/coValues/CoFieldInit.d.ts.map +1 -1
  40. package/dist/tools/coValues/deepLoading.d.ts +8 -7
  41. package/dist/tools/coValues/deepLoading.d.ts.map +1 -1
  42. package/dist/tools/coValues/interfaces.d.ts +3 -3
  43. package/dist/tools/coValues/interfaces.d.ts.map +1 -1
  44. package/dist/tools/coValues/schemaUnion.d.ts +6 -9
  45. package/dist/tools/coValues/schemaUnion.d.ts.map +1 -1
  46. package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.d.ts +18 -7
  47. package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.d.ts.map +1 -1
  48. package/dist/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.d.ts +3 -2
  49. package/dist/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.d.ts.map +1 -1
  50. package/dist/tools/implementation/zodSchema/unionUtils.d.ts.map +1 -1
  51. package/dist/tools/subscribe/SubscriptionScope.d.ts +1 -0
  52. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  53. package/package.json +4 -4
  54. package/src/inspector/tests/utils/history.test.ts +401 -0
  55. package/src/inspector/tests/viewer/co-value-editor.test.tsx +903 -0
  56. package/src/inspector/tests/viewer/comap-view.test.tsx +581 -0
  57. package/src/inspector/ui/icon.tsx +6 -0
  58. package/src/inspector/ui/icons/add-icon.tsx +21 -0
  59. package/src/inspector/ui/icons/edit-icon.tsx +17 -0
  60. package/src/inspector/ui/icons/history.tsx +28 -0
  61. package/src/inspector/ui/modal.tsx +3 -3
  62. package/src/inspector/utils/history.ts +49 -0
  63. package/src/inspector/utils/transactions-changes.ts +98 -0
  64. package/src/inspector/viewer/co-map-view.tsx +312 -0
  65. package/src/inspector/viewer/co-value-editor.tsx +164 -0
  66. package/src/inspector/viewer/grid-view.tsx +139 -10
  67. package/src/inspector/viewer/history-view.tsx +16 -118
  68. package/src/inspector/viewer/page.tsx +13 -0
  69. package/src/react-core/tests/usePassPhraseAuth.test.ts +1 -1
  70. package/src/tools/coValues/CoFieldInit.ts +6 -3
  71. package/src/tools/coValues/coList.ts +1 -1
  72. package/src/tools/coValues/deepLoading.ts +85 -71
  73. package/src/tools/coValues/interfaces.ts +3 -3
  74. package/src/tools/coValues/schemaUnion.ts +19 -14
  75. package/src/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.ts +69 -9
  76. package/src/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.ts +12 -7
  77. package/src/tools/implementation/zodSchema/unionUtils.ts +35 -4
  78. package/src/tools/subscribe/SubscriptionScope.ts +3 -14
  79. package/src/tools/tests/coDiscriminatedUnion.test.ts +347 -5
  80. package/src/tools/tests/coVector.test.ts +43 -0
  81. package/src/tools/tests/deepLoading.test.ts +55 -59
  82. package/src/tools/tests/schema.resolved.test.ts +70 -1
  83. package/dist/chunk-P3YLNFN4.js.map +0 -1
  84. package/dist/inspector/custom-element-QESCMFY7.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.19.0 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.19.2 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,103 +109,103 @@
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 47ms
112
+ ESM ⚡️ Build success in 42ms
113
113
  ESM dist/worker/index.js 3.19 KB
114
- ESM dist/worker/napi-crypto.js 110.00 B
115
114
  ESM dist/worker/edge-wasm.js 215.00 B
115
+ ESM dist/worker/napi-crypto.js 110.00 B
116
116
  ESM dist/worker/index.js.map 6.24 KB
117
- ESM dist/worker/napi-crypto.js.map 162.00 B
118
117
  ESM dist/worker/edge-wasm.js.map 434.00 B
119
- ESM ⚡️ Build success in 48ms
118
+ ESM dist/worker/napi-crypto.js.map 162.00 B
119
+ ESM ⚡️ Build success in 45ms
120
120
  ESM dist/better-auth/auth/client.js 4.50 KB
121
121
  ESM dist/better-auth/auth/server.js 8.36 KB
122
122
  ESM dist/better-auth/auth/react.js 799.00 B
123
123
  ESM dist/better-auth/auth/client.js.map 8.32 KB
124
124
  ESM dist/better-auth/auth/server.js.map 15.31 KB
125
125
  ESM dist/better-auth/auth/react.js.map 2.04 KB
126
- ESM ⚡️ Build success in 42ms
127
- ESM dist/react-native/index.js 2.53 KB
128
- ESM dist/react-native/testing.js 120.00 B
129
- ESM dist/react-native/crypto.js 161.00 B
130
- ESM dist/react-native/index.js.map 5.68 KB
131
- ESM dist/react-native/testing.js.map 176.00 B
132
- ESM dist/react-native/crypto.js.map 197.00 B
133
- ESM ⚡️ Build success in 45ms
134
- ESM dist/media/index.js 236.00 B
135
- ESM dist/media/index.browser.js 2.79 KB
126
+ ESM ⚡️ Build success in 38ms
136
127
  ESM dist/media/index.native.js 4.01 KB
128
+ ESM dist/media/index.js 236.00 B
137
129
  ESM dist/media/index.server.js 2.95 KB
130
+ ESM dist/media/index.browser.js 2.79 KB
138
131
  ESM dist/media/chunk-3LKBM3G3.js 6.69 KB
139
- ESM dist/media/index.js.map 71.00 B
140
- ESM dist/media/index.browser.js.map 6.15 KB
141
132
  ESM dist/media/index.native.js.map 8.10 KB
142
133
  ESM dist/media/index.server.js.map 6.37 KB
134
+ ESM dist/media/index.browser.js.map 6.15 KB
143
135
  ESM dist/media/chunk-3LKBM3G3.js.map 16.99 KB
144
- ESM ⚡️ Build success in 52ms
136
+ ESM dist/media/index.js.map 71.00 B
137
+ ESM ⚡️ Build success in 45ms
138
+ ESM dist/react-native/index.js 2.53 KB
139
+ ESM dist/react-native/testing.js 120.00 B
140
+ ESM dist/react-native/crypto.js 161.00 B
141
+ ESM dist/react-native/index.js.map 5.68 KB
142
+ ESM dist/react-native/testing.js.map 176.00 B
143
+ ESM dist/react-native/crypto.js.map 197.00 B
144
+ ESM ⚡️ Build success in 63ms
145
145
  ESM dist/browser/index.js 14.06 KB
146
146
  ESM dist/browser/index.js.map 29.94 KB
147
- ESM ⚡️ Build success in 79ms
148
- ESM dist/expo/index.js 4.68 KB
149
- ESM dist/expo/crypto.js 153.00 B
150
- ESM dist/expo/testing.js 112.00 B
151
- ESM dist/expo/index.js.map 10.23 KB
152
- ESM dist/expo/crypto.js.map 189.00 B
153
- ESM dist/expo/testing.js.map 168.00 B
154
- ESM ⚡️ Build success in 69ms
155
- ESM dist/react-core/testing.js 1.22 KB
147
+ ESM ⚡️ Build success in 85ms
156
148
  ESM dist/react-core/index.js 14.37 KB
149
+ ESM dist/react-core/testing.js 1.22 KB
157
150
  ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
158
- ESM dist/react-core/testing.js.map 1.86 KB
159
151
  ESM dist/react-core/index.js.map 40.54 KB
152
+ ESM dist/react-core/testing.js.map 1.86 KB
160
153
  ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
161
- ESM ⚡️ Build success in 75ms
162
- ESM dist/react/testing.js 122.00 B
154
+ ESM ⚡️ Build success in 92ms
155
+ ESM dist/expo/index.js 4.68 KB
156
+ ESM dist/expo/testing.js 112.00 B
157
+ ESM dist/expo/crypto.js 153.00 B
158
+ ESM dist/expo/index.js.map 10.23 KB
159
+ ESM dist/expo/testing.js.map 168.00 B
160
+ ESM dist/expo/crypto.js.map 189.00 B
161
+ ESM ⚡️ Build success in 87ms
162
+ ESM dist/react-native-core/testing.js 119.00 B
163
+ ESM dist/react-native-core/crypto.js 2.10 KB
164
+ ESM dist/react-native-core/index.js 18.97 KB
165
+ ESM dist/react-native-core/testing.js.map 175.00 B
166
+ ESM dist/react-native-core/crypto.js.map 4.25 KB
167
+ ESM dist/react-native-core/index.js.map 38.60 KB
168
+ ESM ⚡️ Build success in 96ms
163
169
  ESM dist/react/index.js 25.74 KB
170
+ ESM dist/react/testing.js 122.00 B
164
171
  ESM dist/react/ssr.js 697.00 B
165
172
  ESM dist/react/testing.js.map 165.00 B
166
173
  ESM dist/react/index.js.map 55.43 KB
167
174
  ESM dist/react/ssr.js.map 1.11 KB
168
- ESM ⚡️ Build success in 65ms
169
- ESM dist/better-auth/database-adapter/index.js 26.65 KB
170
- ESM dist/better-auth/database-adapter/index.js.map 58.26 KB
171
- ESM ⚡️ Build success in 64ms
172
- ESM dist/react-native-core/index.js 18.97 KB
173
- ESM dist/react-native-core/testing.js 119.00 B
174
- ESM dist/react-native-core/crypto.js 2.10 KB
175
- ESM dist/react-native-core/index.js.map 38.60 KB
176
- ESM dist/react-native-core/testing.js.map 175.00 B
177
- ESM dist/react-native-core/crypto.js.map 4.25 KB
178
- ESM ⚡️ Build success in 88ms
175
+ ESM ⚡️ Build success in 98ms
179
176
  ESM dist/prosemirror/index.js 77.76 KB
180
177
  ESM dist/prosemirror/index.js.map 307.20 KB
181
- ESM ⚡️ Build success in 93ms
182
- ESM dist/inspector/index.js 97.51 KB
183
- ESM dist/inspector/index.js.map 171.35 KB
178
+ ESM ⚡️ Build success in 111ms
179
+ ESM dist/better-auth/database-adapter/index.js 26.65 KB
180
+ ESM dist/better-auth/database-adapter/index.js.map 58.26 KB
184
181
  ESM ⚡️ Build success in 95ms
182
+ ESM dist/inspector/index.js 119.76 KB
183
+ ESM dist/inspector/index.js.map 204.43 KB
184
+ ESM ⚡️ Build success in 132ms
185
185
  ESM dist/index.js 29.09 KB
186
186
  ESM dist/testing.js 8.51 KB
187
- ESM dist/chunk-P3YLNFN4.js 199.68 KB
187
+ ESM dist/chunk-NCNM6UDZ.js 200.80 KB
188
188
  ESM dist/tools/ssr.js 156.00 B
189
189
  ESM dist/chunk-M2HGBOXS.js 694.00 B
190
190
  ESM dist/chunk-PZ5AY32C.js 233.00 B
191
- ESM dist/index.js.map 60.08 KB
192
191
  ESM dist/testing.js.map 16.17 KB
193
- ESM dist/chunk-P3YLNFN4.js.map 470.44 KB
192
+ ESM dist/index.js.map 60.08 KB
194
193
  ESM dist/tools/ssr.js.map 71.00 B
195
194
  ESM dist/chunk-M2HGBOXS.js.map 1.10 KB
196
195
  ESM dist/chunk-PZ5AY32C.js.map 71.00 B
197
- ESM ⚡️ Build success in 111ms
196
+ ESM dist/chunk-NCNM6UDZ.js.map 473.58 KB
197
+ ESM ⚡️ Build success in 135ms
198
198
  ESM dist/inspector/register-custom-element.js 218.00 B
199
199
  ESM dist/inspector/register-custom-element.js.map 314.00 B
200
- ESM dist/inspector/custom-element-QESCMFY7.js 1.57 MB
201
- ESM dist/inspector/custom-element-QESCMFY7.js.map 2.41 MB
202
- ESM ⚡️ Build success in 162ms
200
+ ESM dist/inspector/custom-element-ABVPHX53.js 1.59 MB
201
+ ESM dist/inspector/custom-element-ABVPHX53.js.map 2.44 MB
202
+ ESM ⚡️ Build success in 208ms
203
203
 
204
- > jazz-tools@0.19.0 types /home/runner/_work/jazz/jazz/packages/jazz-tools
204
+ > jazz-tools@0.19.2 types /home/runner/_work/jazz/jazz/packages/jazz-tools
205
205
  > tsc --outDir dist
206
206
 
207
207
 
208
- > jazz-tools@0.19.0 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
208
+ > jazz-tools@0.19.2 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
209
209
  > rm -rf dist/svelte && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json
210
210
 
211
211
  src/svelte -> dist/svelte
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.19.2
4
+
5
+ ### Patch Changes
6
+
7
+ - ef24afb: Support creating CoVectors using plain `number[]` or `Float32Array` objects inside CoValue containers
8
+ - 5f2b34b: Inline editing and snapshot restore for CoMaps in the inspector
9
+ - Updated dependencies [7e76313]
10
+ - cojson@0.19.2
11
+ - cojson-storage-indexeddb@0.19.2
12
+ - cojson-transport-ws@0.19.2
13
+
14
+ ## 0.19.1
15
+
16
+ ### Patch Changes
17
+
18
+ - f444bd9: Add `resolve` support for `co.discriminatedUnion`
19
+ - Updated dependencies [afd2ded]
20
+ - cojson@0.19.1
21
+ - cojson-storage-indexeddb@0.19.1
22
+ - cojson-transport-ws@0.19.1
23
+
3
24
  ## 0.19.0
4
25
 
5
26
  ### Minor Changes
@@ -3340,8 +3340,6 @@ var SchemaUnion = class _SchemaUnion extends CoValueBase {
3340
3340
  /**
3341
3341
  * Load a `SchemaUnion` with a given ID, as a given account.
3342
3342
  *
3343
- * Note: The `resolve` option is not supported for `SchemaUnion`s due to https://github.com/garden-co/jazz/issues/2639
3344
- *
3345
3343
  * @category Subscription & Loading
3346
3344
  */
3347
3345
  static load(id, options) {
@@ -4177,6 +4175,7 @@ var SubscriptionScope = class _SubscriptionScope {
4177
4175
  this.autoloadedKeys = /* @__PURE__ */ new Set();
4178
4176
  this.skipInvalidKeys = /* @__PURE__ */ new Set();
4179
4177
  this.totalValidTransactions = 0;
4178
+ this.version = 0;
4180
4179
  this.migrated = false;
4181
4180
  this.migrating = false;
4182
4181
  this.closed = false;
@@ -4283,9 +4282,7 @@ var SubscriptionScope = class _SubscriptionScope {
4283
4282
  this.updateValue(createCoValue(this.schema, update, this));
4284
4283
  this.loadChildren();
4285
4284
  } else {
4286
- const hasChanged = update.totalValidTransactions !== this.totalValidTransactions || // Checking the identity of the raw value makes us cover the cases where the group
4287
- // has been updated and the coValues that don't update the totalValidTransactions value (e.g. FileStream)
4288
- this.value.value.$jazz.raw !== update;
4285
+ const hasChanged = update.totalValidTransactions !== this.totalValidTransactions || update.version !== this.version;
4289
4286
  if (this.loadChildren()) {
4290
4287
  this.updateValue(createCoValue(this.schema, update, this));
4291
4288
  } else if (hasChanged) {
@@ -4293,6 +4290,7 @@ var SubscriptionScope = class _SubscriptionScope {
4293
4290
  }
4294
4291
  }
4295
4292
  this.totalValidTransactions = update.totalValidTransactions;
4293
+ this.version = update.version;
4296
4294
  this.silenceUpdates = false;
4297
4295
  this.triggerUpdate();
4298
4296
  }
@@ -4547,17 +4545,6 @@ var SubscriptionScope = class _SubscriptionScope {
4547
4545
  const id = map.$jazz.raw.get(key);
4548
4546
  const descriptor = map.$jazz.getDescriptor(key);
4549
4547
  if (!descriptor) {
4550
- this.childErrors.set(
4551
- key,
4552
- new JazzError(void 0, CoValueLoadingState.UNAVAILABLE, [
4553
- {
4554
- code: "validationError",
4555
- message: `The ref ${key} requested on ${map.constructor.name} is not defined in the schema`,
4556
- params: {},
4557
- path: [key]
4558
- }
4559
- ])
4560
- );
4561
4548
  return void 0;
4562
4549
  }
4563
4550
  if (isRefEncoded(descriptor)) {
@@ -4889,19 +4876,32 @@ function createAnonymousJazzContext({
4889
4876
  }
4890
4877
 
4891
4878
  // src/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.ts
4892
- var CoDiscriminatedUnionSchema = class {
4879
+ var CoDiscriminatedUnionSchema = class _CoDiscriminatedUnionSchema {
4893
4880
  constructor(coreSchema, coValueClass) {
4894
4881
  this.coValueClass = coValueClass;
4895
4882
  this.collaborative = true;
4896
4883
  this.builtin = "CoDiscriminatedUnion";
4884
+ /**
4885
+ * Default resolve query to be used when loading instances of this schema.
4886
+ * This resolve query will be used when no resolve query is provided to the load method.
4887
+ * @default true
4888
+ */
4897
4889
  this.resolveQuery = true;
4898
4890
  this.getDefinition = coreSchema.getDefinition;
4899
4891
  }
4900
4892
  load(id, options) {
4901
- return this.coValueClass.load(id, options);
4893
+ return this.coValueClass.load(
4894
+ id,
4895
+ // @ts-expect-error
4896
+ withSchemaResolveQuery(options, this.resolveQuery)
4897
+ );
4902
4898
  }
4903
4899
  subscribe(id, options, listener) {
4904
- return this.coValueClass.subscribe(id, options, listener);
4900
+ return this.coValueClass.subscribe(
4901
+ id,
4902
+ withSchemaResolveQuery(options, this.resolveQuery),
4903
+ listener
4904
+ );
4905
4905
  }
4906
4906
  getCoValueClass() {
4907
4907
  return this.coValueClass;
@@ -4909,6 +4909,23 @@ var CoDiscriminatedUnionSchema = class {
4909
4909
  optional() {
4910
4910
  return coOptionalDefiner(this);
4911
4911
  }
4912
+ /**
4913
+ * Adds a default resolve query to be used when loading instances of this schema.
4914
+ * This resolve query will be used when no resolve query is provided to the load method.
4915
+ */
4916
+ resolved(resolveQuery) {
4917
+ const definition = this.getDefinition();
4918
+ const coreSchema = createCoreCoDiscriminatedUnionSchema(
4919
+ definition.discriminator,
4920
+ definition.options
4921
+ );
4922
+ const copy = new _CoDiscriminatedUnionSchema(
4923
+ coreSchema,
4924
+ this.coValueClass
4925
+ );
4926
+ copy.resolveQuery = resolveQuery;
4927
+ return copy;
4928
+ }
4912
4929
  };
4913
4930
  function createCoreCoDiscriminatedUnionSchema(discriminator, schemas) {
4914
4931
  return {
@@ -5728,10 +5745,20 @@ function schemaUnionDiscriminatorFor(schema) {
5728
5745
  }
5729
5746
  }
5730
5747
  const determineSchema = (discriminable) => {
5748
+ const allNestedRefKeys = /* @__PURE__ */ new Set();
5749
+ for (const option of availableOptions) {
5750
+ const coMapShape = option.getDefinition().shape;
5751
+ for (const [key, value] of Object.entries(coMapShape)) {
5752
+ if (isAnyCoValueSchema2(value)) {
5753
+ allNestedRefKeys.add(key);
5754
+ }
5755
+ }
5756
+ }
5731
5757
  for (const option of availableOptions) {
5732
5758
  let match = true;
5759
+ const optionDef = option.getDefinition();
5733
5760
  for (const key of Object.keys(discriminatorMap)) {
5734
- const discriminatorDef = option.getDefinition().shape[key];
5761
+ const discriminatorDef = optionDef.shape[key];
5735
5762
  const discriminatorValue = discriminable.get(key);
5736
5763
  if (discriminatorValue && typeof discriminatorValue === "object") {
5737
5764
  throw new Error("Discriminator must be a primitive value");
@@ -5755,7 +5782,19 @@ function schemaUnionDiscriminatorFor(schema) {
5755
5782
  }
5756
5783
  if (match) {
5757
5784
  const coValueSchema = hydrateCoreCoValueSchema(option);
5758
- return coValueSchema.getCoValueClass();
5785
+ const coValueClass = coValueSchema.getCoValueClass();
5786
+ const dummyFieldNames = allNestedRefKeys.keys().filter((key) => !optionDef.shape[key]).toArray();
5787
+ if (dummyFieldNames.length === 0) {
5788
+ return coValueClass;
5789
+ }
5790
+ return class extends coValueClass {
5791
+ constructor(...args) {
5792
+ super(...args);
5793
+ for (const key of dummyFieldNames) {
5794
+ this[key] = coField.null;
5795
+ }
5796
+ }
5797
+ };
5759
5798
  }
5760
5799
  }
5761
5800
  throw new Error(
@@ -6907,4 +6946,4 @@ export {
6907
6946
  JazzContextManager
6908
6947
  };
6909
6948
  /* istanbul ignore file -- @preserve */
6910
- //# sourceMappingURL=chunk-P3YLNFN4.js.map
6949
+ //# sourceMappingURL=chunk-NCNM6UDZ.js.map