@middag-io/react 0.45.0 → 0.45.3
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/README.md +4 -3
- package/docs/public/schemas/ai-contract-manifest.json +1820 -0
- package/docs/public/schemas/blocks.json +445 -0
- package/docs/public/schemas/components.json +166 -0
- package/docs/public/schemas/connectors.json +97 -0
- package/docs/public/schemas/fragment.json +2329 -0
- package/docs/public/schemas/manifest.json +119 -0
- package/docs/public/schemas/navigation.json +72 -0
- package/docs/public/schemas/page-contract.json +2329 -0
- package/docs/public/schemas/shared-props.json +118 -0
- package/docs/public/schemas/theme-defaults.json +253 -0
- package/docs/public/schemas/theme.json +401 -0
- package/package.json +109 -3
- package/src/assets/lottie/calendar/schedule-1.json +1 -0
- package/src/assets/lottie/calendar/schedule-2.json +1 -0
- package/src/assets/lottie/celebration/confetti-1.json +1 -0
- package/src/assets/lottie/celebration/confetti-2.json +1 -0
- package/src/assets/lottie/celebration/confetti-3.json +1 -0
- package/src/assets/lottie/cloud/cloud-1.json +1 -0
- package/src/assets/lottie/cloud/cloud-2.json +1 -0
- package/src/assets/lottie/connection/network-1.json +1 -0
- package/src/assets/lottie/connection/network-2.json +1 -0
- package/src/assets/lottie/connection/network-3.json +1 -0
- package/src/assets/lottie/dashboard/analytics-1.json +1 -0
- package/src/assets/lottie/dashboard/analytics-2.json +1 -0
- package/src/assets/lottie/dashboard/analytics-3.json +1 -0
- package/src/assets/lottie/email/mail-1.json +1 -0
- package/src/assets/lottie/email/mail-2.json +1 -0
- package/src/assets/lottie/email/mail-3.json +1 -0
- package/src/assets/lottie/empty-state/empty-1.json +1 -0
- package/src/assets/lottie/empty-state/empty-2.json +1 -0
- package/src/assets/lottie/empty-state/empty-3.json +1 -0
- package/src/assets/lottie/error/warning-1.json +1 -0
- package/src/assets/lottie/error/warning-2.json +1 -0
- package/src/assets/lottie/error/warning-3.json +1 -0
- package/src/assets/lottie/index.ts +49 -0
- package/src/assets/lottie/loading/spinner-1.json +1 -0
- package/src/assets/lottie/loading/spinner-2.json +1 -0
- package/src/assets/lottie/loading/spinner-3.json +1 -0
- package/src/assets/lottie/maintenance/construction-1.json +1 -0
- package/src/assets/lottie/maintenance/construction-2.json +1 -0
- package/src/assets/lottie/maintenance/construction-3.json +1 -0
- package/src/assets/lottie/not-found/404-1.json +1 -0
- package/src/assets/lottie/not-found/404-2.json +1 -0
- package/src/assets/lottie/not-found/404-3.json +1 -0
- package/src/assets/lottie/notification/bell-1.json +1 -0
- package/src/assets/lottie/notification/bell-2.json +1 -0
- package/src/assets/lottie/notification/bell-3.json +1 -0
- package/src/assets/lottie/onboarding/welcome-1.json +1 -0
- package/src/assets/lottie/onboarding/welcome-2.json +1 -0
- package/src/assets/lottie/onboarding/welcome-3.json +1 -0
- package/src/assets/lottie/payment/wallet-1.json +1 -0
- package/src/assets/lottie/payment/wallet-2.json +1 -0
- package/src/assets/lottie/payment/wallet-3.json +1 -0
- package/src/assets/lottie/search/search-1.json +1 -0
- package/src/assets/lottie/search/search-2.json +1 -0
- package/src/assets/lottie/search/search-3.json +1 -0
- package/src/assets/lottie/security/lock-1.json +1 -0
- package/src/assets/lottie/security/lock-2.json +1 -0
- package/src/assets/lottie/security/lock-3.json +1 -0
- package/src/assets/lottie/settings/gear-1.json +1 -0
- package/src/assets/lottie/settings/gear-2.json +1 -0
- package/src/assets/lottie/settings/gear-3.json +1 -0
- package/src/assets/lottie/success/check-1.json +1 -0
- package/src/assets/lottie/success/check-2.json +1 -0
- package/src/assets/lottie/success/check-3.json +1 -0
- package/src/assets/lottie/upload/upload-1.json +1 -0
- package/src/assets/lottie/upload/upload-2.json +1 -0
- package/src/assets/lottie/upload/upload-3.json +1 -0
- package/src/assets/lottie/user/profile-1.json +1 -0
- package/src/assets/lottie/user/profile-2.json +1 -0
- package/src/assets/lottie/user/profile-3.json +1 -0
- package/src/base/blocks/ActionGridBlock.tsx +151 -0
- package/src/base/blocks/ActivityTimelineBlock.tsx +180 -0
- package/src/base/blocks/CardGridBlock.tsx +384 -0
- package/src/base/blocks/ChartBlock.tsx +81 -0
- package/src/base/blocks/DenseTableBlock.tsx +403 -0
- package/src/base/blocks/DetailPanelBlock.tsx +189 -0
- package/src/base/blocks/EmptyStateBlock.tsx +46 -0
- package/src/base/blocks/FormPanelBlock.lazy.tsx +38 -0
- package/src/base/blocks/FormPanelBlock.tsx +480 -0
- package/src/base/blocks/LinkListBlock.tsx +94 -0
- package/src/base/blocks/MarkdownPanelBlock.tsx +60 -0
- package/src/base/blocks/MetricCardBlock.tsx +128 -0
- package/src/base/blocks/StatusStripBlock.tsx +43 -0
- package/src/base/blocks/TabsBlock.tsx +94 -0
- package/src/base/form/FormField.tsx +607 -0
- package/src/base/form/fields/CheckboxField.tsx +56 -0
- package/src/base/form/fields/ColorField.tsx +76 -0
- package/src/base/form/fields/CurrencyField.tsx +126 -0
- package/src/base/form/fields/DateField.tsx +168 -0
- package/src/base/form/fields/DateRangeField.tsx +66 -0
- package/src/base/form/fields/DocumentField.tsx +222 -0
- package/src/base/form/fields/EntityPickerField.tsx +244 -0
- package/src/base/form/fields/FileUploadField.tsx +253 -0
- package/src/base/form/fields/MultiSelectField.tsx +286 -0
- package/src/base/form/fields/NativeSelectField.tsx +67 -0
- package/src/base/form/fields/NumberField.tsx +67 -0
- package/src/base/form/fields/OtpField.tsx +88 -0
- package/src/base/form/fields/PasswordField.tsx +69 -0
- package/src/base/form/fields/PhoneField.tsx +64 -0
- package/src/base/form/fields/RadioField.tsx +66 -0
- package/src/base/form/fields/RatingField.tsx +52 -0
- package/src/base/form/fields/SelectField.tsx +76 -0
- package/src/base/form/fields/SliderField.tsx +77 -0
- package/src/base/form/fields/SlugField.tsx +114 -0
- package/src/base/form/fields/StaticField.tsx +25 -0
- package/src/base/form/fields/SwitchField.tsx +56 -0
- package/src/base/form/fields/TagsField.tsx +128 -0
- package/src/base/form/fields/TextField.tsx +55 -0
- package/src/base/form/fields/TextareaField.tsx +55 -0
- package/src/base/form/fields/document-validation.ts +126 -0
- package/src/base/form/fields/field-registry.ts +53 -0
- package/src/base/form/fields/register-default-fields.ts +86 -0
- package/src/base/form/form-schema-builder.ts +192 -0
- package/src/base/form/form-utils.ts +71 -0
- package/src/base/hooks/useIsDark.ts +50 -0
- package/src/base/hooks/useLazyTabs.ts +98 -0
- package/src/base/hooks/usePolling.ts +43 -0
- package/src/base/hooks/useRemember.ts +58 -0
- package/src/base/hooks/useToast.ts +27 -0
- package/src/base/layout/BlockRegion.tsx +39 -0
- package/src/base/layout/DashboardLayout.tsx +110 -0
- package/src/base/layout/SidebarLayout.tsx +38 -0
- package/src/base/layout/StackLayout.tsx +32 -0
- package/src/base/layout/WizardLayout.tsx +49 -0
- package/src/base/partials/ActionBar/index.tsx +115 -0
- package/src/base/partials/ConfirmationDialog/index.tsx +128 -0
- package/src/base/partials/DataTable/cell-registry.ts +50 -0
- package/src/base/partials/DataTable/cell-renderers.tsx +372 -0
- package/src/base/partials/DataTable/index.tsx +1282 -0
- package/src/base/partials/DataTable/register-default-cells.ts +37 -0
- package/src/base/partials/DataTable/sanitize-html.ts +45 -0
- package/src/base/partials/DataTable/types.ts +229 -0
- package/src/base/partials/DetailSection/index.tsx +316 -0
- package/src/base/partials/EmptyPlaceholder/index.tsx +162 -0
- package/src/base/partials/EntityItem/index.tsx +154 -0
- package/src/base/partials/FilterBar/index.tsx +256 -0
- package/src/base/partials/FormSection/index.tsx +87 -0
- package/src/base/partials/LogViewer/JsonBlock.tsx +39 -0
- package/src/base/partials/LogViewer/LogEntry.tsx +68 -0
- package/src/base/partials/LogViewer/LogViewerToolbar.tsx +71 -0
- package/src/base/partials/LogViewer/index.tsx +110 -0
- package/src/base/partials/LogViewer/types.ts +28 -0
- package/src/base/partials/MarkdownContent/index.tsx +307 -0
- package/src/base/partials/MenuBar/index.tsx +80 -0
- package/src/base/partials/QuickRecordSheet/index.tsx +59 -0
- package/src/base/partials/ResizableSidebar/index.tsx +70 -0
- package/src/base/partials/StatRow/index.tsx +28 -0
- package/src/base/partials/StatusBar/index.tsx +126 -0
- package/src/base/partials/StatusIndicator/index.tsx +61 -0
- package/src/base/partials/StepIndicator/index.tsx +63 -0
- package/src/base/partials/TableOfContents/index.tsx +78 -0
- package/src/base/partials/TimelineList/index.tsx +273 -0
- package/src/base/partials/ToggleGroupControl/index.tsx +100 -0
- package/src/base/partials/TreeView/index.tsx +75 -0
- package/src/base/partials/index.ts +23 -0
- package/src/base/shell/AuthShell.tsx +54 -0
- package/src/base/shell/BasicShell.tsx +286 -0
- package/src/base/shell/ImmersiveShell.tsx +85 -0
- package/src/base/shell/partials/EditablePanelContext.tsx +82 -0
- package/src/base/shell/partials/EditablePanelProvider.tsx +122 -0
- package/src/base/shell/partials/InlineEditablePanel.tsx +239 -0
- package/src/base/shell/partials/InspectorContext.tsx +173 -0
- package/src/base/shell/partials/InspectorPanel.tsx +65 -0
- package/src/base/shell/partials/NavErrorBoundary.tsx +82 -0
- package/src/base/shell/partials/OverlayScreen.tsx +67 -0
- package/src/base/shell/partials/PageActionButton.tsx +203 -0
- package/src/base/theme/appearance.ts +133 -0
- package/src/base/theme/host-layout-detector.ts +119 -0
- package/src/base/theme/host-theme-detector.ts +146 -0
- package/src/base/theme/sidebar-safelist.txt +20 -0
- package/src/base/theme/tailwind-theme.css +136 -0
- package/src/base/theme/theme-bridge.css +164 -0
- package/src/base/theme/theme-context.tsx +142 -0
- package/src/base/theme/themes/classic.css +174 -0
- package/src/base/theme/tokens.css +290 -0
- package/src/base/theme/useHostTheme.ts +95 -0
- package/src/base/utils/clipboard.ts +39 -0
- package/src/base/utils/conditions.ts +27 -0
- package/src/base/utils/icon-registry.ts +78 -0
- package/src/base/utils/icons.ts +31 -0
- package/src/base/utils/interpolate.ts +9 -0
- package/src/base/utils/register-default-icons.ts +163 -0
- package/src/base/utils/storage.ts +65 -0
- package/src/base/utils/time.ts +139 -0
- package/src/contracts/block-data/actions.ts +73 -0
- package/src/contracts/block-data/data-display.ts +343 -0
- package/src/contracts/block-data/form.ts +164 -0
- package/src/contracts/block-data/index.ts +15 -0
- package/src/contracts/block-data/interactive.ts +34 -0
- package/src/contracts/block-data/shared.ts +44 -0
- package/src/contracts/connectors.ts +60 -0
- package/src/contracts/generated/contract-schema.ts +1237 -0
- package/src/contracts/generated/contract-types.ts +675 -0
- package/src/contracts/generated/index.ts +15 -0
- package/src/contracts/navigation.ts +59 -0
- package/src/contracts/page-contract-schema.ts +40 -0
- package/src/contracts/page-contract.ts +79 -0
- package/src/contracts/shared-props.ts +92 -0
- package/src/engine/ContractPage.tsx +178 -0
- package/src/engine/EntityRoutes.tsx +72 -0
- package/src/engine/HostSlot.tsx +126 -0
- package/src/engine/LazyBlock.tsx +92 -0
- package/src/engine/bootstrap.tsx +20 -0
- package/src/engine/providers/auth.tsx +87 -0
- package/src/engine/providers/error-reporter.tsx +89 -0
- package/src/engine/providers/flash.tsx +44 -0
- package/src/engine/providers/index.ts +18 -0
- package/src/engine/providers/inertia-error-reporter.tsx +61 -0
- package/src/engine/providers/progress.tsx +56 -0
- package/src/engine/providers/scope.tsx +51 -0
- package/src/engine/register-defaults.ts +88 -0
- package/src/engine/registries.ts +96 -0
- package/src/i18n/I18nProvider.tsx +53 -0
- package/src/i18n/MANIFEST.md +101 -0
- package/src/i18n/host-resolver.ts +18 -0
- package/src/i18n/instance.ts +69 -0
- package/src/i18n/locales/en/ui.json +277 -0
- package/src/i18n/locales/en/validators.json +13 -0
- package/src/i18n/locales/pt-BR/ui.json +277 -0
- package/src/i18n/locales/pt-BR/validators.json +13 -0
- package/src/i18n/register-strings.ts +10 -0
- package/src/i18n/render-label.ts +33 -0
- package/src/i18n/resolve-field-error.ts +29 -0
- package/src/i18n/useHostString.ts +50 -0
- package/src/i18n/useTranslation.ts +83 -0
- package/src/lib/actions/resolve-action-target.ts +151 -0
- package/src/lib/hooks/use-copy-to-clipboard.ts +37 -0
- package/src/lib/hooks/use-file-upload.ts +406 -0
- package/src/lib/hooks/use-mobile.ts +21 -0
- package/src/lib/host-pending.ts +76 -0
- package/src/lib/portal-container.ts +16 -0
- package/src/lib/test-ids.ts +40 -0
- package/src/lib/utils.ts +6 -0
- package/src/primitives/reui/MANIFEST.md +97 -0
- package/src/primitives/reui/accordion.tsx +64 -0
- package/src/primitives/reui/alert-dialog.tsx +196 -0
- package/src/primitives/reui/alert.tsx +92 -0
- package/src/primitives/reui/aspect-ratio.tsx +9 -0
- package/src/primitives/reui/autocomplete.tsx +343 -0
- package/src/primitives/reui/avatar.tsx +109 -0
- package/src/primitives/reui/badge.tsx +94 -0
- package/src/primitives/reui/breadcrumb.tsx +109 -0
- package/src/primitives/reui/button-group.tsx +83 -0
- package/src/primitives/reui/button.tsx +64 -0
- package/src/primitives/reui/calendar.tsx +220 -0
- package/src/primitives/reui/card.tsx +92 -0
- package/src/primitives/reui/carousel.tsx +239 -0
- package/src/primitives/reui/chart.tsx +388 -0
- package/src/primitives/reui/checkbox.tsx +30 -0
- package/src/primitives/reui/collapsible.tsx +31 -0
- package/src/primitives/reui/combobox.tsx +308 -0
- package/src/primitives/reui/command.tsx +182 -0
- package/src/primitives/reui/context-menu.tsx +250 -0
- package/src/primitives/reui/data-grid/data-grid-column-filter.tsx +172 -0
- package/src/primitives/reui/data-grid/data-grid-column-header.tsx +420 -0
- package/src/primitives/reui/data-grid/data-grid-column-visibility.tsx +51 -0
- package/src/primitives/reui/data-grid/data-grid-pagination.tsx +235 -0
- package/src/primitives/reui/data-grid/data-grid-scroll-area.tsx +427 -0
- package/src/primitives/reui/data-grid/data-grid-table-dnd-rows.tsx +308 -0
- package/src/primitives/reui/data-grid/data-grid-table-dnd.tsx +318 -0
- package/src/primitives/reui/data-grid/data-grid-table-virtual.tsx +491 -0
- package/src/primitives/reui/data-grid/data-grid-table.tsx +1430 -0
- package/src/primitives/reui/data-grid/data-grid.tsx +269 -0
- package/src/primitives/reui/data-grid-pagination.tsx +235 -0
- package/src/primitives/reui/date-selector.tsx +1353 -0
- package/src/primitives/reui/dialog.tsx +158 -0
- package/src/primitives/reui/drawer.tsx +133 -0
- package/src/primitives/reui/dropdown-menu.tsx +257 -0
- package/src/primitives/reui/empty.tsx +104 -0
- package/src/primitives/reui/field.tsx +246 -0
- package/src/primitives/reui/filters.tsx +1891 -0
- package/src/primitives/reui/frame.tsx +170 -0
- package/src/primitives/reui/hover-card.tsx +42 -0
- package/src/primitives/reui/icon-placeholder.tsx +39 -0
- package/src/primitives/reui/index.ts +98 -0
- package/src/primitives/reui/input-group.tsx +170 -0
- package/src/primitives/reui/input-otp.tsx +75 -0
- package/src/primitives/reui/input.tsx +21 -0
- package/src/primitives/reui/item.tsx +193 -0
- package/src/primitives/reui/kanban.tsx +743 -0
- package/src/primitives/reui/kbd.tsx +28 -0
- package/src/primitives/reui/label.tsx +22 -0
- package/src/primitives/reui/menubar.tsx +274 -0
- package/src/primitives/reui/native-select.tsx +62 -0
- package/src/primitives/reui/navigation-menu.tsx +168 -0
- package/src/primitives/reui/number-field.tsx +250 -0
- package/src/primitives/reui/pagination.tsx +127 -0
- package/src/primitives/reui/phone-input.tsx +231 -0
- package/src/primitives/reui/popover.tsx +87 -0
- package/src/primitives/reui/progress.tsx +31 -0
- package/src/primitives/reui/radio-group.tsx +43 -0
- package/src/primitives/reui/rating.tsx +177 -0
- package/src/primitives/reui/resizable.tsx +51 -0
- package/src/primitives/reui/scroll-area.tsx +58 -0
- package/src/primitives/reui/scrollspy.tsx +240 -0
- package/src/primitives/reui/select.tsx +188 -0
- package/src/primitives/reui/separator.tsx +28 -0
- package/src/primitives/reui/sheet.tsx +141 -0
- package/src/primitives/reui/sidebar.tsx +732 -0
- package/src/primitives/reui/skeleton.tsx +13 -0
- package/src/primitives/reui/slider.tsx +61 -0
- package/src/primitives/reui/sonner.tsx +47 -0
- package/src/primitives/reui/sortable.tsx +414 -0
- package/src/primitives/reui/spinner.tsx +16 -0
- package/src/primitives/reui/stepper.tsx +484 -0
- package/src/primitives/reui/svgs/claudeAiIcon.tsx +12 -0
- package/src/primitives/reui/svgs/gemini.tsx +171 -0
- package/src/primitives/reui/svgs/openai.tsx +9 -0
- package/src/primitives/reui/svgs/openaiDark.tsx +12 -0
- package/src/primitives/reui/switch.tsx +33 -0
- package/src/primitives/reui/table.tsx +114 -0
- package/src/primitives/reui/tabs.tsx +91 -0
- package/src/primitives/reui/textarea.tsx +18 -0
- package/src/primitives/reui/timeline.tsx +219 -0
- package/src/primitives/reui/toggle-group.tsx +83 -0
- package/src/primitives/reui/toggle.tsx +45 -0
- package/src/primitives/reui/tooltip.tsx +55 -0
- package/src/primitives/reui/tree.tsx +247 -0
- package/src/theme.css +71 -0
|
@@ -0,0 +1,1237 @@
|
|
|
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() });
|