@middag-io/react 0.46.0 → 0.47.0

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 (50) hide show
  1. package/dist-lib/{FormField-Csx8hGAW.js → FormField-BGqAQLtX.js} +1863 -1806
  2. package/dist-lib/{FormPanelBlock-Bmd0DpiX.js → FormPanelBlock-CGgA83Mu.js} +50 -49
  3. package/dist-lib/base/blocks/CardGridBlock.d.ts.map +1 -1
  4. package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
  5. package/dist-lib/base/blocks/DetailPanelBlock.d.ts.map +1 -1
  6. package/dist-lib/base/blocks/FormPanelBlock.d.ts.map +1 -1
  7. package/dist-lib/base/partials/ActionBar/index.d.ts.map +1 -1
  8. package/dist-lib/base/partials/FilterBar/index.d.ts.map +1 -1
  9. package/dist-lib/base/shell/BasicShell.js +1 -1
  10. package/dist-lib/base/shell/partials/InlineEditablePanel.d.ts.map +1 -1
  11. package/dist-lib/base/shell/partials/InlineEditablePanel.js +131 -127
  12. package/dist-lib/base/shell/partials/PageActionButton.d.ts.map +1 -1
  13. package/dist-lib/base/shell/partials/PageActionButton.js +1 -1
  14. package/dist-lib/base/theme/appearance.d.ts.map +1 -1
  15. package/dist-lib/base/theme/appearance.js +1 -1
  16. package/dist-lib/base/utils/action-intent.d.ts +3 -0
  17. package/dist-lib/base/utils/action-intent.d.ts.map +1 -0
  18. package/dist-lib/base/utils/action-intent.js +16 -0
  19. package/dist-lib/chunks/subpath-Bs35txZS.js +166 -0
  20. package/dist-lib/contracts/generated/index.d.ts +7 -7
  21. package/dist-lib/contracts/generated/index.d.ts.map +1 -1
  22. package/dist-lib/contracts/generated/schemas.d.ts +3992 -0
  23. package/dist-lib/contracts/generated/schemas.d.ts.map +1 -0
  24. package/dist-lib/contracts/generated/{contract-types.d.ts → types.d.ts} +26 -16
  25. package/dist-lib/contracts/generated/types.d.ts.map +1 -0
  26. package/dist-lib/contracts/page-contract-schema.d.ts +217 -27
  27. package/dist-lib/contracts/page-contract-schema.d.ts.map +1 -1
  28. package/dist-lib/middag-react.js +10111 -10782
  29. package/dist-lib/primitives/reui/button.d.ts +1 -1
  30. package/docs/public/schemas/fragment.json +66 -2
  31. package/docs/public/schemas/page-contract.json +66 -2
  32. package/package.json +1 -1
  33. package/src/base/blocks/CardGridBlock.tsx +2 -1
  34. package/src/base/blocks/DenseTableBlock.tsx +2 -1
  35. package/src/base/blocks/DetailPanelBlock.tsx +2 -1
  36. package/src/base/blocks/FormPanelBlock.tsx +2 -1
  37. package/src/base/partials/ActionBar/index.tsx +3 -2
  38. package/src/base/partials/FilterBar/index.tsx +12 -1
  39. package/src/base/shell/partials/InlineEditablePanel.tsx +14 -7
  40. package/src/base/shell/partials/PageActionButton.tsx +3 -1
  41. package/src/base/theme/appearance.ts +2 -1
  42. package/src/base/utils/action-intent.ts +22 -0
  43. package/src/contracts/generated/index.ts +7 -7
  44. package/src/contracts/generated/schemas.ts +565 -0
  45. package/src/contracts/generated/{contract-types.ts → types.ts} +42 -15
  46. package/dist-lib/chunks/subpath-Bh1MAmBT.js +0 -165
  47. package/dist-lib/contracts/generated/contract-schema.d.ts +0 -183
  48. package/dist-lib/contracts/generated/contract-schema.d.ts.map +0 -1
  49. package/dist-lib/contracts/generated/contract-types.d.ts.map +0 -1
  50. package/src/contracts/generated/contract-schema.ts +0 -1237
@@ -1,1237 +0,0 @@
1
- /**
2
- * @generated by scripts/gen-contracts.mjs — DO NOT EDIT BY HAND.
3
- *
4
- * Zod schemas (core) for the MIDDAG wire contract.
5
- *
6
- * Source of truth: middag-php-ui value objects -> JSON Schema (draft 2020-12).
7
- * Regenerate: npm run gen:contracts
8
- * Drift gate: npm run gen:contracts:check
9
- *
10
- * @source middag-php-ui/schema/{page-contract,fragment}.json
11
- * @contract-version 1
12
- * @hash 61137d173165ca8e
13
- */
14
- import { z } from "zod";
15
-
16
- /** Zod schema for a full PageContract wire payload. Validates known canonical
17
- * fields; unknown keys (premium overlay, forward-compat) are stripped. */
18
- export const pageContractSchemaCore = z.object({ "version": z.literal("1"), "shell": z.string(), "page": z.object({ "key": z.string(), "title": z.any().superRefine((x, ctx) => {
19
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
20
- const { errors, failed } = schemas.reduce<{
21
- errors: z.core.$ZodIssue[];
22
- failed: number;
23
- }>(
24
- ({ errors, failed }, schema) =>
25
- ((result) =>
26
- result.error
27
- ? {
28
- errors: [...errors, ...result.error.issues],
29
- failed: failed + 1,
30
- }
31
- : { errors, failed })(
32
- schema.safeParse(x),
33
- ),
34
- { errors: [], failed: 0 },
35
- );
36
- const passed = schemas.length - failed;
37
- if (passed !== 1) {
38
- ctx.addIssue(errors.length ? {
39
- path: [],
40
- code: "invalid_union",
41
- errors: [errors],
42
- message: "Invalid input: Should pass single schema. Passed " + passed,
43
- } : {
44
- path: [],
45
- code: "custom",
46
- errors: [errors],
47
- message: "Invalid input: Should pass single schema. Passed " + passed,
48
- });
49
- }
50
- }), "subtitle": z.any().superRefine((x, ctx) => {
51
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
52
- const { errors, failed } = schemas.reduce<{
53
- errors: z.core.$ZodIssue[];
54
- failed: number;
55
- }>(
56
- ({ errors, failed }, schema) =>
57
- ((result) =>
58
- result.error
59
- ? {
60
- errors: [...errors, ...result.error.issues],
61
- failed: failed + 1,
62
- }
63
- : { errors, failed })(
64
- schema.safeParse(x),
65
- ),
66
- { errors: [], failed: 0 },
67
- );
68
- const passed = schemas.length - failed;
69
- if (passed !== 1) {
70
- ctx.addIssue(errors.length ? {
71
- path: [],
72
- code: "invalid_union",
73
- errors: [errors],
74
- message: "Invalid input: Should pass single schema. Passed " + passed,
75
- } : {
76
- path: [],
77
- code: "custom",
78
- errors: [errors],
79
- message: "Invalid input: Should pass single schema. Passed " + passed,
80
- });
81
- }
82
- }).optional(), "breadcrumbs": z.array(z.object({ "label": z.any().superRefine((x, ctx) => {
83
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
84
- const { errors, failed } = schemas.reduce<{
85
- errors: z.core.$ZodIssue[];
86
- failed: number;
87
- }>(
88
- ({ errors, failed }, schema) =>
89
- ((result) =>
90
- result.error
91
- ? {
92
- errors: [...errors, ...result.error.issues],
93
- failed: failed + 1,
94
- }
95
- : { errors, failed })(
96
- schema.safeParse(x),
97
- ),
98
- { errors: [], failed: 0 },
99
- );
100
- const passed = schemas.length - failed;
101
- if (passed !== 1) {
102
- ctx.addIssue(errors.length ? {
103
- path: [],
104
- code: "invalid_union",
105
- errors: [errors],
106
- message: "Invalid input: Should pass single schema. Passed " + passed,
107
- } : {
108
- path: [],
109
- code: "custom",
110
- errors: [errors],
111
- message: "Invalid input: Should pass single schema. Passed " + passed,
112
- });
113
- }
114
- }), "href": z.string().optional(), "external": z.literal(true).optional() })).optional(), "actions": z.array(z.object({ "id": z.string(), "label": z.any().superRefine((x, ctx) => {
115
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
116
- const { errors, failed } = schemas.reduce<{
117
- errors: z.core.$ZodIssue[];
118
- failed: number;
119
- }>(
120
- ({ errors, failed }, schema) =>
121
- ((result) =>
122
- result.error
123
- ? {
124
- errors: [...errors, ...result.error.issues],
125
- failed: failed + 1,
126
- }
127
- : { errors, failed })(
128
- schema.safeParse(x),
129
- ),
130
- { errors: [], failed: 0 },
131
- );
132
- const passed = schemas.length - failed;
133
- if (passed !== 1) {
134
- ctx.addIssue(errors.length ? {
135
- path: [],
136
- code: "invalid_union",
137
- errors: [errors],
138
- message: "Invalid input: Should pass single schema. Passed " + passed,
139
- } : {
140
- path: [],
141
- code: "custom",
142
- errors: [errors],
143
- message: "Invalid input: Should pass single schema. Passed " + passed,
144
- });
145
- }
146
- }), "target": z.any().superRefine((x, ctx) => {
147
- const schemas = [z.object({ "kind": z.literal("link"), "href": z.string(), "external": z.literal(true).optional() }), z.object({ "kind": z.literal("route"), "route": z.string(), "params": z.record(z.string(), z.any()).optional() }), z.object({ "kind": z.literal("request"), "endpoint": z.string(), "method": z.enum(["get","post","put","patch","delete"]) }), z.object({ "kind": z.literal("panel") })];
148
- const { errors, failed } = schemas.reduce<{
149
- errors: z.core.$ZodIssue[];
150
- failed: number;
151
- }>(
152
- ({ errors, failed }, schema) =>
153
- ((result) =>
154
- result.error
155
- ? {
156
- errors: [...errors, ...result.error.issues],
157
- failed: failed + 1,
158
- }
159
- : { errors, failed })(
160
- schema.safeParse(x),
161
- ),
162
- { errors: [], failed: 0 },
163
- );
164
- const passed = schemas.length - failed;
165
- if (passed !== 1) {
166
- ctx.addIssue(errors.length ? {
167
- path: [],
168
- code: "invalid_union",
169
- errors: [errors],
170
- message: "Invalid input: Should pass single schema. Passed " + passed,
171
- } : {
172
- path: [],
173
- code: "custom",
174
- errors: [errors],
175
- message: "Invalid input: Should pass single schema. Passed " + passed,
176
- });
177
- }
178
- }), "intent": z.enum(["primary","secondary","danger","success","warning","info","link","ghost"]), "icon": z.string().optional(), "confirmation": z.object({ "title": z.any().superRefine((x, ctx) => {
179
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
180
- const { errors, failed } = schemas.reduce<{
181
- errors: z.core.$ZodIssue[];
182
- failed: number;
183
- }>(
184
- ({ errors, failed }, schema) =>
185
- ((result) =>
186
- result.error
187
- ? {
188
- errors: [...errors, ...result.error.issues],
189
- failed: failed + 1,
190
- }
191
- : { errors, failed })(
192
- schema.safeParse(x),
193
- ),
194
- { errors: [], failed: 0 },
195
- );
196
- const passed = schemas.length - failed;
197
- if (passed !== 1) {
198
- ctx.addIssue(errors.length ? {
199
- path: [],
200
- code: "invalid_union",
201
- errors: [errors],
202
- message: "Invalid input: Should pass single schema. Passed " + passed,
203
- } : {
204
- path: [],
205
- code: "custom",
206
- errors: [errors],
207
- message: "Invalid input: Should pass single schema. Passed " + passed,
208
- });
209
- }
210
- }), "message": z.any().superRefine((x, ctx) => {
211
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
212
- const { errors, failed } = schemas.reduce<{
213
- errors: z.core.$ZodIssue[];
214
- failed: number;
215
- }>(
216
- ({ errors, failed }, schema) =>
217
- ((result) =>
218
- result.error
219
- ? {
220
- errors: [...errors, ...result.error.issues],
221
- failed: failed + 1,
222
- }
223
- : { errors, failed })(
224
- schema.safeParse(x),
225
- ),
226
- { errors: [], failed: 0 },
227
- );
228
- const passed = schemas.length - failed;
229
- if (passed !== 1) {
230
- ctx.addIssue(errors.length ? {
231
- path: [],
232
- code: "invalid_union",
233
- errors: [errors],
234
- message: "Invalid input: Should pass single schema. Passed " + passed,
235
- } : {
236
- path: [],
237
- code: "custom",
238
- errors: [errors],
239
- message: "Invalid input: Should pass single schema. Passed " + passed,
240
- });
241
- }
242
- }), "variant": z.string(), "confirmLabel": z.any().superRefine((x, ctx) => {
243
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
244
- const { errors, failed } = schemas.reduce<{
245
- errors: z.core.$ZodIssue[];
246
- failed: number;
247
- }>(
248
- ({ errors, failed }, schema) =>
249
- ((result) =>
250
- result.error
251
- ? {
252
- errors: [...errors, ...result.error.issues],
253
- failed: failed + 1,
254
- }
255
- : { errors, failed })(
256
- schema.safeParse(x),
257
- ),
258
- { errors: [], failed: 0 },
259
- );
260
- const passed = schemas.length - failed;
261
- if (passed !== 1) {
262
- ctx.addIssue(errors.length ? {
263
- path: [],
264
- code: "invalid_union",
265
- errors: [errors],
266
- message: "Invalid input: Should pass single schema. Passed " + passed,
267
- } : {
268
- path: [],
269
- code: "custom",
270
- errors: [errors],
271
- message: "Invalid input: Should pass single schema. Passed " + passed,
272
- });
273
- }
274
- }).optional(), "cancelLabel": z.any().superRefine((x, ctx) => {
275
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
276
- const { errors, failed } = schemas.reduce<{
277
- errors: z.core.$ZodIssue[];
278
- failed: number;
279
- }>(
280
- ({ errors, failed }, schema) =>
281
- ((result) =>
282
- result.error
283
- ? {
284
- errors: [...errors, ...result.error.issues],
285
- failed: failed + 1,
286
- }
287
- : { errors, failed })(
288
- schema.safeParse(x),
289
- ),
290
- { errors: [], failed: 0 },
291
- );
292
- const passed = schemas.length - failed;
293
- if (passed !== 1) {
294
- ctx.addIssue(errors.length ? {
295
- path: [],
296
- code: "invalid_union",
297
- errors: [errors],
298
- message: "Invalid input: Should pass single schema. Passed " + passed,
299
- } : {
300
- path: [],
301
- code: "custom",
302
- errors: [errors],
303
- message: "Invalid input: Should pass single schema. Passed " + passed,
304
- });
305
- }
306
- }).optional() }).optional(), "capability": z.string().optional(), "disabled": z.literal(true).optional(), "loading": z.literal(true).optional() })).optional() }), "layout": z.object({ "template": z.string(), "regions": z.any().superRefine((x, ctx) => {
307
- const schemas = [z.record(z.string(), z.array(z.object({ "type": z.string(), "key": z.string(), "data": z.any().superRefine((x, ctx) => {
308
- const schemas = [z.record(z.string(), z.any()), z.array(z.any()).max(0)];
309
- const { errors, failed } = schemas.reduce<{
310
- errors: z.core.$ZodIssue[];
311
- failed: number;
312
- }>(
313
- ({ errors, failed }, schema) =>
314
- ((result) =>
315
- result.error
316
- ? {
317
- errors: [...errors, ...result.error.issues],
318
- failed: failed + 1,
319
- }
320
- : { errors, failed })(
321
- schema.safeParse(x),
322
- ),
323
- { errors: [], failed: 0 },
324
- );
325
- const passed = schemas.length - failed;
326
- if (passed !== 1) {
327
- ctx.addIssue(errors.length ? {
328
- path: [],
329
- code: "invalid_union",
330
- errors: [errors],
331
- message: "Invalid input: Should pass single schema. Passed " + passed,
332
- } : {
333
- path: [],
334
- code: "custom",
335
- errors: [errors],
336
- message: "Invalid input: Should pass single schema. Passed " + passed,
337
- });
338
- }
339
- }), "variant": z.string().optional(), "title": z.any().superRefine((x, ctx) => {
340
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
341
- const { errors, failed } = schemas.reduce<{
342
- errors: z.core.$ZodIssue[];
343
- failed: number;
344
- }>(
345
- ({ errors, failed }, schema) =>
346
- ((result) =>
347
- result.error
348
- ? {
349
- errors: [...errors, ...result.error.issues],
350
- failed: failed + 1,
351
- }
352
- : { errors, failed })(
353
- schema.safeParse(x),
354
- ),
355
- { errors: [], failed: 0 },
356
- );
357
- const passed = schemas.length - failed;
358
- if (passed !== 1) {
359
- ctx.addIssue(errors.length ? {
360
- path: [],
361
- code: "invalid_union",
362
- errors: [errors],
363
- message: "Invalid input: Should pass single schema. Passed " + passed,
364
- } : {
365
- path: [],
366
- code: "custom",
367
- errors: [errors],
368
- message: "Invalid input: Should pass single schema. Passed " + passed,
369
- });
370
- }
371
- }).optional(), "subtitle": z.any().superRefine((x, ctx) => {
372
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
373
- const { errors, failed } = schemas.reduce<{
374
- errors: z.core.$ZodIssue[];
375
- failed: number;
376
- }>(
377
- ({ errors, failed }, schema) =>
378
- ((result) =>
379
- result.error
380
- ? {
381
- errors: [...errors, ...result.error.issues],
382
- failed: failed + 1,
383
- }
384
- : { errors, failed })(
385
- schema.safeParse(x),
386
- ),
387
- { errors: [], failed: 0 },
388
- );
389
- const passed = schemas.length - failed;
390
- if (passed !== 1) {
391
- ctx.addIssue(errors.length ? {
392
- path: [],
393
- code: "invalid_union",
394
- errors: [errors],
395
- message: "Invalid input: Should pass single schema. Passed " + passed,
396
- } : {
397
- path: [],
398
- code: "custom",
399
- errors: [errors],
400
- message: "Invalid input: Should pass single schema. Passed " + passed,
401
- });
402
- }
403
- }).optional(), "actions": z.array(z.object({ "id": z.string(), "label": z.any().superRefine((x, ctx) => {
404
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
405
- const { errors, failed } = schemas.reduce<{
406
- errors: z.core.$ZodIssue[];
407
- failed: number;
408
- }>(
409
- ({ errors, failed }, schema) =>
410
- ((result) =>
411
- result.error
412
- ? {
413
- errors: [...errors, ...result.error.issues],
414
- failed: failed + 1,
415
- }
416
- : { errors, failed })(
417
- schema.safeParse(x),
418
- ),
419
- { errors: [], failed: 0 },
420
- );
421
- const passed = schemas.length - failed;
422
- if (passed !== 1) {
423
- ctx.addIssue(errors.length ? {
424
- path: [],
425
- code: "invalid_union",
426
- errors: [errors],
427
- message: "Invalid input: Should pass single schema. Passed " + passed,
428
- } : {
429
- path: [],
430
- code: "custom",
431
- errors: [errors],
432
- message: "Invalid input: Should pass single schema. Passed " + passed,
433
- });
434
- }
435
- }), "target": z.any().superRefine((x, ctx) => {
436
- const schemas = [z.object({ "kind": z.literal("link"), "href": z.string(), "external": z.literal(true).optional() }), z.object({ "kind": z.literal("route"), "route": z.string(), "params": z.record(z.string(), z.any()).optional() }), z.object({ "kind": z.literal("request"), "endpoint": z.string(), "method": z.enum(["get","post","put","patch","delete"]) }), z.object({ "kind": z.literal("panel") })];
437
- const { errors, failed } = schemas.reduce<{
438
- errors: z.core.$ZodIssue[];
439
- failed: number;
440
- }>(
441
- ({ errors, failed }, schema) =>
442
- ((result) =>
443
- result.error
444
- ? {
445
- errors: [...errors, ...result.error.issues],
446
- failed: failed + 1,
447
- }
448
- : { errors, failed })(
449
- schema.safeParse(x),
450
- ),
451
- { errors: [], failed: 0 },
452
- );
453
- const passed = schemas.length - failed;
454
- if (passed !== 1) {
455
- ctx.addIssue(errors.length ? {
456
- path: [],
457
- code: "invalid_union",
458
- errors: [errors],
459
- message: "Invalid input: Should pass single schema. Passed " + passed,
460
- } : {
461
- path: [],
462
- code: "custom",
463
- errors: [errors],
464
- message: "Invalid input: Should pass single schema. Passed " + passed,
465
- });
466
- }
467
- }), "intent": z.enum(["primary","secondary","danger","success","warning","info","link","ghost"]), "icon": z.string().optional(), "confirmation": z.object({ "title": z.any().superRefine((x, ctx) => {
468
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
469
- const { errors, failed } = schemas.reduce<{
470
- errors: z.core.$ZodIssue[];
471
- failed: number;
472
- }>(
473
- ({ errors, failed }, schema) =>
474
- ((result) =>
475
- result.error
476
- ? {
477
- errors: [...errors, ...result.error.issues],
478
- failed: failed + 1,
479
- }
480
- : { errors, failed })(
481
- schema.safeParse(x),
482
- ),
483
- { errors: [], failed: 0 },
484
- );
485
- const passed = schemas.length - failed;
486
- if (passed !== 1) {
487
- ctx.addIssue(errors.length ? {
488
- path: [],
489
- code: "invalid_union",
490
- errors: [errors],
491
- message: "Invalid input: Should pass single schema. Passed " + passed,
492
- } : {
493
- path: [],
494
- code: "custom",
495
- errors: [errors],
496
- message: "Invalid input: Should pass single schema. Passed " + passed,
497
- });
498
- }
499
- }), "message": z.any().superRefine((x, ctx) => {
500
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
501
- const { errors, failed } = schemas.reduce<{
502
- errors: z.core.$ZodIssue[];
503
- failed: number;
504
- }>(
505
- ({ errors, failed }, schema) =>
506
- ((result) =>
507
- result.error
508
- ? {
509
- errors: [...errors, ...result.error.issues],
510
- failed: failed + 1,
511
- }
512
- : { errors, failed })(
513
- schema.safeParse(x),
514
- ),
515
- { errors: [], failed: 0 },
516
- );
517
- const passed = schemas.length - failed;
518
- if (passed !== 1) {
519
- ctx.addIssue(errors.length ? {
520
- path: [],
521
- code: "invalid_union",
522
- errors: [errors],
523
- message: "Invalid input: Should pass single schema. Passed " + passed,
524
- } : {
525
- path: [],
526
- code: "custom",
527
- errors: [errors],
528
- message: "Invalid input: Should pass single schema. Passed " + passed,
529
- });
530
- }
531
- }), "variant": z.string(), "confirmLabel": z.any().superRefine((x, ctx) => {
532
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
533
- const { errors, failed } = schemas.reduce<{
534
- errors: z.core.$ZodIssue[];
535
- failed: number;
536
- }>(
537
- ({ errors, failed }, schema) =>
538
- ((result) =>
539
- result.error
540
- ? {
541
- errors: [...errors, ...result.error.issues],
542
- failed: failed + 1,
543
- }
544
- : { errors, failed })(
545
- schema.safeParse(x),
546
- ),
547
- { errors: [], failed: 0 },
548
- );
549
- const passed = schemas.length - failed;
550
- if (passed !== 1) {
551
- ctx.addIssue(errors.length ? {
552
- path: [],
553
- code: "invalid_union",
554
- errors: [errors],
555
- message: "Invalid input: Should pass single schema. Passed " + passed,
556
- } : {
557
- path: [],
558
- code: "custom",
559
- errors: [errors],
560
- message: "Invalid input: Should pass single schema. Passed " + passed,
561
- });
562
- }
563
- }).optional(), "cancelLabel": z.any().superRefine((x, ctx) => {
564
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
565
- const { errors, failed } = schemas.reduce<{
566
- errors: z.core.$ZodIssue[];
567
- failed: number;
568
- }>(
569
- ({ errors, failed }, schema) =>
570
- ((result) =>
571
- result.error
572
- ? {
573
- errors: [...errors, ...result.error.issues],
574
- failed: failed + 1,
575
- }
576
- : { errors, failed })(
577
- schema.safeParse(x),
578
- ),
579
- { errors: [], failed: 0 },
580
- );
581
- const passed = schemas.length - failed;
582
- if (passed !== 1) {
583
- ctx.addIssue(errors.length ? {
584
- path: [],
585
- code: "invalid_union",
586
- errors: [errors],
587
- message: "Invalid input: Should pass single schema. Passed " + passed,
588
- } : {
589
- path: [],
590
- code: "custom",
591
- errors: [errors],
592
- message: "Invalid input: Should pass single schema. Passed " + passed,
593
- });
594
- }
595
- }).optional() }).optional(), "capability": z.string().optional(), "disabled": z.literal(true).optional(), "loading": z.literal(true).optional() })).optional(), "meta": z.record(z.string(), z.any()).optional(), "poll": z.object({ "endpoint": z.string(), "intervalMs": z.number().int(), "pauseWhenHidden": z.boolean(), "stopAfterMs": z.number().int().optional() }).optional(), "deferred": z.boolean().optional(), "remember": z.boolean().optional() }))), z.array(z.any()).max(0)];
596
- const { errors, failed } = schemas.reduce<{
597
- errors: z.core.$ZodIssue[];
598
- failed: number;
599
- }>(
600
- ({ errors, failed }, schema) =>
601
- ((result) =>
602
- result.error
603
- ? {
604
- errors: [...errors, ...result.error.issues],
605
- failed: failed + 1,
606
- }
607
- : { errors, failed })(
608
- schema.safeParse(x),
609
- ),
610
- { errors: [], failed: 0 },
611
- );
612
- const passed = schemas.length - failed;
613
- if (passed !== 1) {
614
- ctx.addIssue(errors.length ? {
615
- path: [],
616
- code: "invalid_union",
617
- errors: [errors],
618
- message: "Invalid input: Should pass single schema. Passed " + passed,
619
- } : {
620
- path: [],
621
- code: "custom",
622
- errors: [errors],
623
- message: "Invalid input: Should pass single schema. Passed " + passed,
624
- });
625
- }
626
- }), "meta": z.record(z.string(), z.any()).optional() }), "resources": z.object({ "preferences": z.object({ "theme": z.enum(["light","dark","system"]), "locale": z.string(), "timezone": z.string().optional(), "dateFormat": z.string().optional(), "numberFormat": z.string().optional() }).catchall(z.any()), "capabilities": z.any().superRefine((x, ctx) => {
627
- const schemas = [z.record(z.string(), z.boolean()), z.array(z.any()).max(0)];
628
- const { errors, failed } = schemas.reduce<{
629
- errors: z.core.$ZodIssue[];
630
- failed: number;
631
- }>(
632
- ({ errors, failed }, schema) =>
633
- ((result) =>
634
- result.error
635
- ? {
636
- errors: [...errors, ...result.error.issues],
637
- failed: failed + 1,
638
- }
639
- : { errors, failed })(
640
- schema.safeParse(x),
641
- ),
642
- { errors: [], failed: 0 },
643
- );
644
- const passed = schemas.length - failed;
645
- if (passed !== 1) {
646
- ctx.addIssue(errors.length ? {
647
- path: [],
648
- code: "invalid_union",
649
- errors: [errors],
650
- message: "Invalid input: Should pass single schema. Passed " + passed,
651
- } : {
652
- path: [],
653
- code: "custom",
654
- errors: [errors],
655
- message: "Invalid input: Should pass single schema. Passed " + passed,
656
- });
657
- }
658
- }), "featureFlags": z.any().superRefine((x, ctx) => {
659
- const schemas = [z.record(z.string(), z.boolean()), z.array(z.any()).max(0)];
660
- const { errors, failed } = schemas.reduce<{
661
- errors: z.core.$ZodIssue[];
662
- failed: number;
663
- }>(
664
- ({ errors, failed }, schema) =>
665
- ((result) =>
666
- result.error
667
- ? {
668
- errors: [...errors, ...result.error.issues],
669
- failed: failed + 1,
670
- }
671
- : { errors, failed })(
672
- schema.safeParse(x),
673
- ),
674
- { errors: [], failed: 0 },
675
- );
676
- const passed = schemas.length - failed;
677
- if (passed !== 1) {
678
- ctx.addIssue(errors.length ? {
679
- path: [],
680
- code: "invalid_union",
681
- errors: [errors],
682
- message: "Invalid input: Should pass single schema. Passed " + passed,
683
- } : {
684
- path: [],
685
- code: "custom",
686
- errors: [errors],
687
- message: "Invalid input: Should pass single schema. Passed " + passed,
688
- });
689
- }
690
- }), "user": z.object({ "id": z.string(), "name": z.string(), "email": z.string().optional(), "avatarUrl": z.string().optional(), "roles": z.array(z.string()).optional() }).optional(), "branding": z.object({ "appName": z.string(), "logoUrl": z.string().optional(), "logoCompactUrl": z.string().optional() }).optional() }).optional(), "notifications": z.array(z.object({ "level": z.enum(["success","info","warning","error"]), "message": z.any().superRefine((x, ctx) => {
691
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
692
- const { errors, failed } = schemas.reduce<{
693
- errors: z.core.$ZodIssue[];
694
- failed: number;
695
- }>(
696
- ({ errors, failed }, schema) =>
697
- ((result) =>
698
- result.error
699
- ? {
700
- errors: [...errors, ...result.error.issues],
701
- failed: failed + 1,
702
- }
703
- : { errors, failed })(
704
- schema.safeParse(x),
705
- ),
706
- { errors: [], failed: 0 },
707
- );
708
- const passed = schemas.length - failed;
709
- if (passed !== 1) {
710
- ctx.addIssue(errors.length ? {
711
- path: [],
712
- code: "invalid_union",
713
- errors: [errors],
714
- message: "Invalid input: Should pass single schema. Passed " + passed,
715
- } : {
716
- path: [],
717
- code: "custom",
718
- errors: [errors],
719
- message: "Invalid input: Should pass single schema. Passed " + passed,
720
- });
721
- }
722
- }), "dismissible": z.boolean(), "title": z.any().superRefine((x, ctx) => {
723
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
724
- const { errors, failed } = schemas.reduce<{
725
- errors: z.core.$ZodIssue[];
726
- failed: number;
727
- }>(
728
- ({ errors, failed }, schema) =>
729
- ((result) =>
730
- result.error
731
- ? {
732
- errors: [...errors, ...result.error.issues],
733
- failed: failed + 1,
734
- }
735
- : { errors, failed })(
736
- schema.safeParse(x),
737
- ),
738
- { errors: [], failed: 0 },
739
- );
740
- const passed = schemas.length - failed;
741
- if (passed !== 1) {
742
- ctx.addIssue(errors.length ? {
743
- path: [],
744
- code: "invalid_union",
745
- errors: [errors],
746
- message: "Invalid input: Should pass single schema. Passed " + passed,
747
- } : {
748
- path: [],
749
- code: "custom",
750
- errors: [errors],
751
- message: "Invalid input: Should pass single schema. Passed " + passed,
752
- });
753
- }
754
- }).optional(), "timeout": z.number().int().optional(), "action": z.object({ "id": z.string(), "label": z.any().superRefine((x, ctx) => {
755
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
756
- const { errors, failed } = schemas.reduce<{
757
- errors: z.core.$ZodIssue[];
758
- failed: number;
759
- }>(
760
- ({ errors, failed }, schema) =>
761
- ((result) =>
762
- result.error
763
- ? {
764
- errors: [...errors, ...result.error.issues],
765
- failed: failed + 1,
766
- }
767
- : { errors, failed })(
768
- schema.safeParse(x),
769
- ),
770
- { errors: [], failed: 0 },
771
- );
772
- const passed = schemas.length - failed;
773
- if (passed !== 1) {
774
- ctx.addIssue(errors.length ? {
775
- path: [],
776
- code: "invalid_union",
777
- errors: [errors],
778
- message: "Invalid input: Should pass single schema. Passed " + passed,
779
- } : {
780
- path: [],
781
- code: "custom",
782
- errors: [errors],
783
- message: "Invalid input: Should pass single schema. Passed " + passed,
784
- });
785
- }
786
- }), "target": z.any().superRefine((x, ctx) => {
787
- const schemas = [z.object({ "kind": z.literal("link"), "href": z.string(), "external": z.literal(true).optional() }), z.object({ "kind": z.literal("route"), "route": z.string(), "params": z.record(z.string(), z.any()).optional() }), z.object({ "kind": z.literal("request"), "endpoint": z.string(), "method": z.enum(["get","post","put","patch","delete"]) }), z.object({ "kind": z.literal("panel") })];
788
- const { errors, failed } = schemas.reduce<{
789
- errors: z.core.$ZodIssue[];
790
- failed: number;
791
- }>(
792
- ({ errors, failed }, schema) =>
793
- ((result) =>
794
- result.error
795
- ? {
796
- errors: [...errors, ...result.error.issues],
797
- failed: failed + 1,
798
- }
799
- : { errors, failed })(
800
- schema.safeParse(x),
801
- ),
802
- { errors: [], failed: 0 },
803
- );
804
- const passed = schemas.length - failed;
805
- if (passed !== 1) {
806
- ctx.addIssue(errors.length ? {
807
- path: [],
808
- code: "invalid_union",
809
- errors: [errors],
810
- message: "Invalid input: Should pass single schema. Passed " + passed,
811
- } : {
812
- path: [],
813
- code: "custom",
814
- errors: [errors],
815
- message: "Invalid input: Should pass single schema. Passed " + passed,
816
- });
817
- }
818
- }), "intent": z.enum(["primary","secondary","danger","success","warning","info","link","ghost"]), "icon": z.string().optional(), "confirmation": z.object({ "title": z.any().superRefine((x, ctx) => {
819
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
820
- const { errors, failed } = schemas.reduce<{
821
- errors: z.core.$ZodIssue[];
822
- failed: number;
823
- }>(
824
- ({ errors, failed }, schema) =>
825
- ((result) =>
826
- result.error
827
- ? {
828
- errors: [...errors, ...result.error.issues],
829
- failed: failed + 1,
830
- }
831
- : { errors, failed })(
832
- schema.safeParse(x),
833
- ),
834
- { errors: [], failed: 0 },
835
- );
836
- const passed = schemas.length - failed;
837
- if (passed !== 1) {
838
- ctx.addIssue(errors.length ? {
839
- path: [],
840
- code: "invalid_union",
841
- errors: [errors],
842
- message: "Invalid input: Should pass single schema. Passed " + passed,
843
- } : {
844
- path: [],
845
- code: "custom",
846
- errors: [errors],
847
- message: "Invalid input: Should pass single schema. Passed " + passed,
848
- });
849
- }
850
- }), "message": z.any().superRefine((x, ctx) => {
851
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
852
- const { errors, failed } = schemas.reduce<{
853
- errors: z.core.$ZodIssue[];
854
- failed: number;
855
- }>(
856
- ({ errors, failed }, schema) =>
857
- ((result) =>
858
- result.error
859
- ? {
860
- errors: [...errors, ...result.error.issues],
861
- failed: failed + 1,
862
- }
863
- : { errors, failed })(
864
- schema.safeParse(x),
865
- ),
866
- { errors: [], failed: 0 },
867
- );
868
- const passed = schemas.length - failed;
869
- if (passed !== 1) {
870
- ctx.addIssue(errors.length ? {
871
- path: [],
872
- code: "invalid_union",
873
- errors: [errors],
874
- message: "Invalid input: Should pass single schema. Passed " + passed,
875
- } : {
876
- path: [],
877
- code: "custom",
878
- errors: [errors],
879
- message: "Invalid input: Should pass single schema. Passed " + passed,
880
- });
881
- }
882
- }), "variant": z.string(), "confirmLabel": z.any().superRefine((x, ctx) => {
883
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
884
- const { errors, failed } = schemas.reduce<{
885
- errors: z.core.$ZodIssue[];
886
- failed: number;
887
- }>(
888
- ({ errors, failed }, schema) =>
889
- ((result) =>
890
- result.error
891
- ? {
892
- errors: [...errors, ...result.error.issues],
893
- failed: failed + 1,
894
- }
895
- : { errors, failed })(
896
- schema.safeParse(x),
897
- ),
898
- { errors: [], failed: 0 },
899
- );
900
- const passed = schemas.length - failed;
901
- if (passed !== 1) {
902
- ctx.addIssue(errors.length ? {
903
- path: [],
904
- code: "invalid_union",
905
- errors: [errors],
906
- message: "Invalid input: Should pass single schema. Passed " + passed,
907
- } : {
908
- path: [],
909
- code: "custom",
910
- errors: [errors],
911
- message: "Invalid input: Should pass single schema. Passed " + passed,
912
- });
913
- }
914
- }).optional(), "cancelLabel": z.any().superRefine((x, ctx) => {
915
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
916
- const { errors, failed } = schemas.reduce<{
917
- errors: z.core.$ZodIssue[];
918
- failed: number;
919
- }>(
920
- ({ errors, failed }, schema) =>
921
- ((result) =>
922
- result.error
923
- ? {
924
- errors: [...errors, ...result.error.issues],
925
- failed: failed + 1,
926
- }
927
- : { errors, failed })(
928
- schema.safeParse(x),
929
- ),
930
- { errors: [], failed: 0 },
931
- );
932
- const passed = schemas.length - failed;
933
- if (passed !== 1) {
934
- ctx.addIssue(errors.length ? {
935
- path: [],
936
- code: "invalid_union",
937
- errors: [errors],
938
- message: "Invalid input: Should pass single schema. Passed " + passed,
939
- } : {
940
- path: [],
941
- code: "custom",
942
- errors: [errors],
943
- message: "Invalid input: Should pass single schema. Passed " + passed,
944
- });
945
- }
946
- }).optional() }).optional(), "capability": z.string().optional(), "disabled": z.literal(true).optional(), "loading": z.literal(true).optional() }).optional() })).optional(), "entities": z.record(z.string(), z.string()).optional() });
947
-
948
- /** Zod schema for a Fragment (partial update) wire payload. Lenient on unknown keys. */
949
- export const fragmentSchemaCore = z.object({ "version": z.literal("1"), "kind": z.enum(["block","region","table","form","detail","inspector","notifications","custom"]), "payload": z.record(z.string(), z.any()).optional(), "notifications": z.array(z.object({ "level": z.enum(["success","info","warning","error"]), "message": z.any().superRefine((x, ctx) => {
950
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
951
- const { errors, failed } = schemas.reduce<{
952
- errors: z.core.$ZodIssue[];
953
- failed: number;
954
- }>(
955
- ({ errors, failed }, schema) =>
956
- ((result) =>
957
- result.error
958
- ? {
959
- errors: [...errors, ...result.error.issues],
960
- failed: failed + 1,
961
- }
962
- : { errors, failed })(
963
- schema.safeParse(x),
964
- ),
965
- { errors: [], failed: 0 },
966
- );
967
- const passed = schemas.length - failed;
968
- if (passed !== 1) {
969
- ctx.addIssue(errors.length ? {
970
- path: [],
971
- code: "invalid_union",
972
- errors: [errors],
973
- message: "Invalid input: Should pass single schema. Passed " + passed,
974
- } : {
975
- path: [],
976
- code: "custom",
977
- errors: [errors],
978
- message: "Invalid input: Should pass single schema. Passed " + passed,
979
- });
980
- }
981
- }), "dismissible": z.boolean(), "title": z.any().superRefine((x, ctx) => {
982
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
983
- const { errors, failed } = schemas.reduce<{
984
- errors: z.core.$ZodIssue[];
985
- failed: number;
986
- }>(
987
- ({ errors, failed }, schema) =>
988
- ((result) =>
989
- result.error
990
- ? {
991
- errors: [...errors, ...result.error.issues],
992
- failed: failed + 1,
993
- }
994
- : { errors, failed })(
995
- schema.safeParse(x),
996
- ),
997
- { errors: [], failed: 0 },
998
- );
999
- const passed = schemas.length - failed;
1000
- if (passed !== 1) {
1001
- ctx.addIssue(errors.length ? {
1002
- path: [],
1003
- code: "invalid_union",
1004
- errors: [errors],
1005
- message: "Invalid input: Should pass single schema. Passed " + passed,
1006
- } : {
1007
- path: [],
1008
- code: "custom",
1009
- errors: [errors],
1010
- message: "Invalid input: Should pass single schema. Passed " + passed,
1011
- });
1012
- }
1013
- }).optional(), "timeout": z.number().int().optional(), "action": z.object({ "id": z.string(), "label": z.any().superRefine((x, ctx) => {
1014
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
1015
- const { errors, failed } = schemas.reduce<{
1016
- errors: z.core.$ZodIssue[];
1017
- failed: number;
1018
- }>(
1019
- ({ errors, failed }, schema) =>
1020
- ((result) =>
1021
- result.error
1022
- ? {
1023
- errors: [...errors, ...result.error.issues],
1024
- failed: failed + 1,
1025
- }
1026
- : { errors, failed })(
1027
- schema.safeParse(x),
1028
- ),
1029
- { errors: [], failed: 0 },
1030
- );
1031
- const passed = schemas.length - failed;
1032
- if (passed !== 1) {
1033
- ctx.addIssue(errors.length ? {
1034
- path: [],
1035
- code: "invalid_union",
1036
- errors: [errors],
1037
- message: "Invalid input: Should pass single schema. Passed " + passed,
1038
- } : {
1039
- path: [],
1040
- code: "custom",
1041
- errors: [errors],
1042
- message: "Invalid input: Should pass single schema. Passed " + passed,
1043
- });
1044
- }
1045
- }), "target": z.any().superRefine((x, ctx) => {
1046
- const schemas = [z.object({ "kind": z.literal("link"), "href": z.string(), "external": z.literal(true).optional() }), z.object({ "kind": z.literal("route"), "route": z.string(), "params": z.record(z.string(), z.any()).optional() }), z.object({ "kind": z.literal("request"), "endpoint": z.string(), "method": z.enum(["get","post","put","patch","delete"]) }), z.object({ "kind": z.literal("panel") })];
1047
- const { errors, failed } = schemas.reduce<{
1048
- errors: z.core.$ZodIssue[];
1049
- failed: number;
1050
- }>(
1051
- ({ errors, failed }, schema) =>
1052
- ((result) =>
1053
- result.error
1054
- ? {
1055
- errors: [...errors, ...result.error.issues],
1056
- failed: failed + 1,
1057
- }
1058
- : { errors, failed })(
1059
- schema.safeParse(x),
1060
- ),
1061
- { errors: [], failed: 0 },
1062
- );
1063
- const passed = schemas.length - failed;
1064
- if (passed !== 1) {
1065
- ctx.addIssue(errors.length ? {
1066
- path: [],
1067
- code: "invalid_union",
1068
- errors: [errors],
1069
- message: "Invalid input: Should pass single schema. Passed " + passed,
1070
- } : {
1071
- path: [],
1072
- code: "custom",
1073
- errors: [errors],
1074
- message: "Invalid input: Should pass single schema. Passed " + passed,
1075
- });
1076
- }
1077
- }), "intent": z.enum(["primary","secondary","danger","success","warning","info","link","ghost"]), "icon": z.string().optional(), "confirmation": z.object({ "title": z.any().superRefine((x, ctx) => {
1078
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
1079
- const { errors, failed } = schemas.reduce<{
1080
- errors: z.core.$ZodIssue[];
1081
- failed: number;
1082
- }>(
1083
- ({ errors, failed }, schema) =>
1084
- ((result) =>
1085
- result.error
1086
- ? {
1087
- errors: [...errors, ...result.error.issues],
1088
- failed: failed + 1,
1089
- }
1090
- : { errors, failed })(
1091
- schema.safeParse(x),
1092
- ),
1093
- { errors: [], failed: 0 },
1094
- );
1095
- const passed = schemas.length - failed;
1096
- if (passed !== 1) {
1097
- ctx.addIssue(errors.length ? {
1098
- path: [],
1099
- code: "invalid_union",
1100
- errors: [errors],
1101
- message: "Invalid input: Should pass single schema. Passed " + passed,
1102
- } : {
1103
- path: [],
1104
- code: "custom",
1105
- errors: [errors],
1106
- message: "Invalid input: Should pass single schema. Passed " + passed,
1107
- });
1108
- }
1109
- }), "message": z.any().superRefine((x, ctx) => {
1110
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
1111
- const { errors, failed } = schemas.reduce<{
1112
- errors: z.core.$ZodIssue[];
1113
- failed: number;
1114
- }>(
1115
- ({ errors, failed }, schema) =>
1116
- ((result) =>
1117
- result.error
1118
- ? {
1119
- errors: [...errors, ...result.error.issues],
1120
- failed: failed + 1,
1121
- }
1122
- : { errors, failed })(
1123
- schema.safeParse(x),
1124
- ),
1125
- { errors: [], failed: 0 },
1126
- );
1127
- const passed = schemas.length - failed;
1128
- if (passed !== 1) {
1129
- ctx.addIssue(errors.length ? {
1130
- path: [],
1131
- code: "invalid_union",
1132
- errors: [errors],
1133
- message: "Invalid input: Should pass single schema. Passed " + passed,
1134
- } : {
1135
- path: [],
1136
- code: "custom",
1137
- errors: [errors],
1138
- message: "Invalid input: Should pass single schema. Passed " + passed,
1139
- });
1140
- }
1141
- }), "variant": z.string(), "confirmLabel": z.any().superRefine((x, ctx) => {
1142
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
1143
- const { errors, failed } = schemas.reduce<{
1144
- errors: z.core.$ZodIssue[];
1145
- failed: number;
1146
- }>(
1147
- ({ errors, failed }, schema) =>
1148
- ((result) =>
1149
- result.error
1150
- ? {
1151
- errors: [...errors, ...result.error.issues],
1152
- failed: failed + 1,
1153
- }
1154
- : { errors, failed })(
1155
- schema.safeParse(x),
1156
- ),
1157
- { errors: [], failed: 0 },
1158
- );
1159
- const passed = schemas.length - failed;
1160
- if (passed !== 1) {
1161
- ctx.addIssue(errors.length ? {
1162
- path: [],
1163
- code: "invalid_union",
1164
- errors: [errors],
1165
- message: "Invalid input: Should pass single schema. Passed " + passed,
1166
- } : {
1167
- path: [],
1168
- code: "custom",
1169
- errors: [errors],
1170
- message: "Invalid input: Should pass single schema. Passed " + passed,
1171
- });
1172
- }
1173
- }).optional(), "cancelLabel": z.any().superRefine((x, ctx) => {
1174
- const schemas = [z.string(), z.object({ "key": z.string(), "domain": z.string(), "params": z.record(z.string(), z.any()).optional() })];
1175
- const { errors, failed } = schemas.reduce<{
1176
- errors: z.core.$ZodIssue[];
1177
- failed: number;
1178
- }>(
1179
- ({ errors, failed }, schema) =>
1180
- ((result) =>
1181
- result.error
1182
- ? {
1183
- errors: [...errors, ...result.error.issues],
1184
- failed: failed + 1,
1185
- }
1186
- : { errors, failed })(
1187
- schema.safeParse(x),
1188
- ),
1189
- { errors: [], failed: 0 },
1190
- );
1191
- const passed = schemas.length - failed;
1192
- if (passed !== 1) {
1193
- ctx.addIssue(errors.length ? {
1194
- path: [],
1195
- code: "invalid_union",
1196
- errors: [errors],
1197
- message: "Invalid input: Should pass single schema. Passed " + passed,
1198
- } : {
1199
- path: [],
1200
- code: "custom",
1201
- errors: [errors],
1202
- message: "Invalid input: Should pass single schema. Passed " + passed,
1203
- });
1204
- }
1205
- }).optional() }).optional(), "capability": z.string().optional(), "disabled": z.literal(true).optional(), "loading": z.literal(true).optional() }).optional() })).optional(), "resources": z.any().superRefine((x, ctx) => {
1206
- const schemas = [z.object({ "preferences": z.object({ "theme": z.enum(["light","dark","system"]), "locale": z.string(), "timezone": z.string().optional(), "dateFormat": z.string().optional(), "numberFormat": z.string().optional() }).catchall(z.any()).optional(), "capabilities": z.record(z.string(), z.boolean()).optional(), "featureFlags": z.record(z.string(), z.boolean()).optional() }), z.array(z.any()).max(0)];
1207
- const { errors, failed } = schemas.reduce<{
1208
- errors: z.core.$ZodIssue[];
1209
- failed: number;
1210
- }>(
1211
- ({ errors, failed }, schema) =>
1212
- ((result) =>
1213
- result.error
1214
- ? {
1215
- errors: [...errors, ...result.error.issues],
1216
- failed: failed + 1,
1217
- }
1218
- : { errors, failed })(
1219
- schema.safeParse(x),
1220
- ),
1221
- { errors: [], failed: 0 },
1222
- );
1223
- const passed = schemas.length - failed;
1224
- if (passed !== 1) {
1225
- ctx.addIssue(errors.length ? {
1226
- path: [],
1227
- code: "invalid_union",
1228
- errors: [errors],
1229
- message: "Invalid input: Should pass single schema. Passed " + passed,
1230
- } : {
1231
- path: [],
1232
- code: "custom",
1233
- errors: [errors],
1234
- message: "Invalid input: Should pass single schema. Passed " + passed,
1235
- });
1236
- }
1237
- }).optional(), "customType": z.string().optional() });