@kardalum/plugin-sdk 0.0.0-stage → 0.15.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.
- package/CHANGELOG.md +108 -0
- package/LICENSE +202 -0
- package/README.md +70 -2
- package/dist/admin-section-registry.d.ts +34 -0
- package/dist/admin-section-registry.js +49 -0
- package/dist/built-in-serializers.d.ts +3 -0
- package/dist/built-in-serializers.js +18 -0
- package/dist/built-in-settings-schemas.d.ts +14 -0
- package/dist/built-in-settings-schemas.js +225 -0
- package/dist/built-in-value-schemas.d.ts +4 -0
- package/dist/built-in-value-schemas.js +47 -0
- package/dist/built-ins.d.ts +1 -0
- package/dist/built-ins.js +257 -0
- package/dist/capabilities.d.ts +99 -0
- package/dist/capabilities.js +363 -0
- package/dist/data-type-plugin.d.ts +28 -0
- package/dist/data-type-plugin.js +1 -0
- package/dist/datatype-validation.d.ts +26 -0
- package/dist/datatype-validation.js +110 -0
- package/dist/datatypes-entry.d.ts +4 -0
- package/dist/datatypes-entry.js +18 -0
- package/dist/define-plugin.d.ts +25 -0
- package/dist/define-plugin.js +51 -0
- package/dist/entitlement-entry.d.ts +5 -0
- package/dist/entitlement-entry.js +24 -0
- package/dist/entitlement-gate.d.ts +36 -0
- package/dist/entitlement-gate.js +201 -0
- package/dist/entitlement-types.d.ts +39 -0
- package/dist/entitlement-types.js +1 -0
- package/dist/entitlement.d.ts +57 -0
- package/dist/entitlement.js +170 -0
- package/dist/host-entry.d.ts +1 -0
- package/dist/host-entry.js +11 -0
- package/dist/icon-name.d.ts +1 -0
- package/dist/icon-name.js +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +10 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +93 -0
- package/dist/license-verdict-keys.d.ts +18 -0
- package/dist/license-verdict-keys.js +22 -0
- package/dist/local-host.d.ts +3 -0
- package/dist/local-host.js +38 -0
- package/dist/manifest-entry.d.ts +8 -0
- package/dist/manifest-entry.js +13 -0
- package/dist/manifest-schema.d.ts +408 -0
- package/dist/manifest-schema.js +774 -0
- package/dist/manifest.d.ts +546 -0
- package/dist/manifest.js +86 -0
- package/dist/media/media-picker.d.ts +39 -0
- package/dist/media/media-picker.js +438 -0
- package/dist/media/upload-error.d.ts +12 -0
- package/dist/media/upload-error.js +30 -0
- package/dist/plugin-context.d.ts +75 -0
- package/dist/plugin-context.js +70 -0
- package/dist/plugin-screen-context.d.ts +40 -0
- package/dist/plugin-screen-context.js +16 -0
- package/dist/register-built-ins.d.ts +1 -0
- package/dist/register-built-ins.js +41 -0
- package/dist/registry.d.ts +4 -0
- package/dist/registry.js +17 -0
- package/dist/rendition-eligibility.d.ts +24 -0
- package/dist/rendition-eligibility.js +40 -0
- package/dist/richtext/block-panel.d.ts +27 -0
- package/dist/richtext/block-panel.js +232 -0
- package/dist/richtext/extensions.d.ts +19 -0
- package/dist/richtext/extensions.js +56 -0
- package/dist/richtext/insert-menu.d.ts +24 -0
- package/dist/richtext/insert-menu.js +142 -0
- package/dist/richtext/kardalum-block.d.ts +33 -0
- package/dist/richtext/kardalum-block.js +282 -0
- package/dist/richtext/style-listbox.d.ts +10 -0
- package/dist/richtext/style-listbox.js +69 -0
- package/dist/richtext/text-style-class.d.ts +18 -0
- package/dist/richtext/text-style-class.js +36 -0
- package/dist/simple-storage-value-provider.d.ts +9 -0
- package/dist/simple-storage-value-provider.js +96 -0
- package/dist/structured-storage-types.d.ts +61 -0
- package/dist/structured-storage-types.js +11 -0
- package/dist/tailwind.d.ts +1 -0
- package/dist/tailwind.js +5 -0
- package/dist/tokens/system-dark.css +75 -0
- package/dist/tokens/tokens.css +239 -0
- package/dist/tokens/tokens.json +212 -0
- package/dist/tokens.d.ts +1 -0
- package/dist/tokens.js +11 -0
- package/dist/ui-entry.d.ts +5 -0
- package/dist/ui-entry.js +42 -0
- package/dist/views/content-list-preview.d.ts +1 -0
- package/dist/views/content-list-preview.js +14 -0
- package/dist/views/content-list-settings-view.d.ts +1 -0
- package/dist/views/content-list-settings-view.js +97 -0
- package/dist/views/content-list-view.d.ts +19 -0
- package/dist/views/content-list-view.js +248 -0
- package/dist/views/crop-view.d.ts +55 -0
- package/dist/views/crop-view.js +161 -0
- package/dist/views/date-range-view.d.ts +6 -0
- package/dist/views/date-range-view.js +55 -0
- package/dist/views/file-upload-view.d.ts +43 -0
- package/dist/views/file-upload-view.js +104 -0
- package/dist/views/html-code-editor.d.ts +10 -0
- package/dist/views/html-code-editor.js +101 -0
- package/dist/views/html-view.d.ts +3 -0
- package/dist/views/html-view.js +53 -0
- package/dist/views/image-view.d.ts +3 -0
- package/dist/views/image-view.js +387 -0
- package/dist/views/rich-text-view.d.ts +2 -0
- package/dist/views/rich-text-view.js +429 -0
- package/node_modules/@kardalum/api-schemas/LICENSE +202 -0
- package/node_modules/@kardalum/api-schemas/README.md +56 -0
- package/node_modules/@kardalum/api-schemas/dist/action.schema.d.ts +30 -0
- package/node_modules/@kardalum/api-schemas/dist/action.schema.js +88 -0
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +36 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +89 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +24 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +47 -0
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.d.ts +38 -0
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +537 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +353 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +158 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +139 -0
- package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +125 -0
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +256 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +23 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +151 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +82 -0
- package/node_modules/@kardalum/api-schemas/dist/content-version.schema.d.ts +18 -0
- package/node_modules/@kardalum/api-schemas/dist/content-version.schema.js +22 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.js +20 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +302 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +97 -0
- package/node_modules/@kardalum/api-schemas/dist/culture-direction.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/culture-direction.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +32 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +32 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +296 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +138 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +121 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +147 -0
- package/node_modules/@kardalum/api-schemas/dist/health.schema.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/health.schema.js +5 -0
- package/node_modules/@kardalum/api-schemas/dist/html-entities.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/html-entities.js +250 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +102 -0
- package/node_modules/@kardalum/api-schemas/dist/index.js +58 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +381 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +197 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +167 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +214 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +117 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +27 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.js +279 -0
- package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.d.ts +74 -0
- package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +157 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +80 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +156 -0
- package/node_modules/@kardalum/api-schemas/dist/nav.schema.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/nav.schema.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +846 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +356 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +169 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +80 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +889 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +89 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +369 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +393 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +87 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +25 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +24 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +306 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +328 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +79 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +50 -0
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +69 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +108 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +93 -0
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +243 -0
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +296 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +43 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +25 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +30 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +112 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +74 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +39 -0
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +89 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +68 -0
- package/node_modules/@kardalum/api-schemas/package.json +35 -0
- package/node_modules/@kardalum/design-tokens/LICENSE +202 -0
- package/node_modules/@kardalum/design-tokens/README.md +29 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +32 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +88 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.d.ts +1 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.js +18 -0
- package/node_modules/@kardalum/design-tokens/dist/index.d.ts +6 -0
- package/node_modules/@kardalum/design-tokens/dist/index.js +4 -0
- package/node_modules/@kardalum/design-tokens/dist/system-dark.css +75 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +33 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +54 -0
- package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +12 -0
- package/node_modules/@kardalum/design-tokens/dist/theme-css.js +42 -0
- package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +43 -0
- package/node_modules/@kardalum/design-tokens/dist/theme-types.js +1 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +13 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +120 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/index.d.ts +5 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/index.js +4 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +9 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/light.js +13 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +239 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +25 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +276 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +212 -0
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +91 -0
- package/node_modules/@kardalum/design-tokens/dist/types.js +5 -0
- package/node_modules/@kardalum/design-tokens/package.json +42 -0
- package/node_modules/@kardalum/plugin-package/LICENSE +202 -0
- package/node_modules/@kardalum/plugin-package/README.md +71 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +50 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +659 -0
- package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +19 -0
- package/node_modules/@kardalum/plugin-package/dist/envelope.js +104 -0
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +37 -0
- package/node_modules/@kardalum/plugin-package/dist/extract.js +199 -0
- package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/hash.js +69 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -0
- package/node_modules/@kardalum/plugin-package/dist/index.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +185 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +236 -0
- package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +50 -0
- package/node_modules/@kardalum/plugin-package/dist/package-contract.js +115 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +17 -0
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +45 -0
- package/node_modules/@kardalum/plugin-package/dist/types.js +1 -0
- package/node_modules/@kardalum/plugin-package/package.json +49 -0
- package/node_modules/@kardalum/ui/LICENSE +202 -0
- package/node_modules/@kardalum/ui/README.md +35 -0
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +14 -0
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +38 -0
- package/node_modules/@kardalum/ui/dist/components/badge.d.ts +9 -0
- package/node_modules/@kardalum/ui/dist/components/badge.js +30 -0
- package/node_modules/@kardalum/ui/dist/components/button.d.ts +11 -0
- package/node_modules/@kardalum/ui/dist/components/button.js +37 -0
- package/node_modules/@kardalum/ui/dist/components/checkbox.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +17 -0
- package/node_modules/@kardalum/ui/dist/components/dialog.js +48 -0
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +18 -0
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +53 -0
- package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +30 -0
- package/node_modules/@kardalum/ui/dist/components/empty-state.js +9 -0
- package/node_modules/@kardalum/ui/dist/components/input.d.ts +4 -0
- package/node_modules/@kardalum/ui/dist/components/input.js +6 -0
- package/node_modules/@kardalum/ui/dist/components/panel.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/components/panel.js +6 -0
- package/node_modules/@kardalum/ui/dist/components/property-field.d.ts +19 -0
- package/node_modules/@kardalum/ui/dist/components/property-field.js +86 -0
- package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +17 -0
- package/node_modules/@kardalum/ui/dist/components/sheet.js +55 -0
- package/node_modules/@kardalum/ui/dist/components/skeleton.d.ts +3 -0
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +9 -0
- package/node_modules/@kardalum/ui/dist/components/switch.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/components/switch.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +34 -0
- package/node_modules/@kardalum/ui/dist/components/tab-strip.js +72 -0
- package/node_modules/@kardalum/ui/dist/components/toast.d.ts +18 -0
- package/node_modules/@kardalum/ui/dist/components/toast.js +42 -0
- package/node_modules/@kardalum/ui/dist/components/toaster.d.ts +12 -0
- package/node_modules/@kardalum/ui/dist/components/toaster.js +11 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.d.ts +17 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.js +62 -0
- package/node_modules/@kardalum/ui/dist/index.d.ts +18 -0
- package/node_modules/@kardalum/ui/dist/index.js +18 -0
- package/node_modules/@kardalum/ui/dist/lib/cn.d.ts +2 -0
- package/node_modules/@kardalum/ui/dist/lib/cn.js +5 -0
- package/node_modules/@kardalum/ui/package.json +63 -0
- package/package.json +146 -4
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CreateDocumentTypeRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
5
|
+
kind: z.ZodLiteral<"page">;
|
|
6
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
datatypeId: z.ZodString;
|
|
10
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strict>>;
|
|
18
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
}, z.core.$strict>>;
|
|
21
|
+
treeRules: z.ZodObject<{
|
|
22
|
+
allowedAtRoot: z.ZodBoolean;
|
|
23
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
24
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
}, z.core.$strict>>>;
|
|
30
|
+
translationMandatory: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
collection: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
35
|
+
kind: z.ZodLiteral<"element">;
|
|
36
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
datatypeId: z.ZodString;
|
|
40
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strict>>;
|
|
48
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
49
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
}, z.core.$strict>>;
|
|
51
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
}, z.core.$strict>>>;
|
|
55
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
58
|
+
kind: z.ZodLiteral<"media">;
|
|
59
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
datatypeId: z.ZodString;
|
|
63
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strict>>;
|
|
71
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
72
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
}, z.core.$strict>>;
|
|
74
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
}, z.core.$strict>>>;
|
|
78
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
catchAll: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
}, z.core.$strict>], "kind">;
|
|
81
|
+
export type CreateDocumentTypeRequest = z.infer<typeof CreateDocumentTypeRequestSchema>;
|
|
82
|
+
export declare const UpdateDocumentTypeRequestSchema: z.ZodObject<{
|
|
83
|
+
name: z.ZodString;
|
|
84
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
85
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
name: z.ZodString;
|
|
88
|
+
datatypeId: z.ZodString;
|
|
89
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strict>>;
|
|
97
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
98
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
}, z.core.$strict>>;
|
|
100
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
101
|
+
id: z.ZodString;
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
}, z.core.$strict>>>;
|
|
104
|
+
treeRules: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
allowedAtRoot: z.ZodBoolean;
|
|
106
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
107
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
translationMandatory: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
collection: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
catchAll: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
export type UpdateDocumentTypeRequest = z.infer<typeof UpdateDocumentTypeRequestSchema>;
|
|
115
|
+
export declare const CreateDocumentTypeResponseSchema: z.ZodObject<{
|
|
116
|
+
documentType: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
117
|
+
id: z.ZodString;
|
|
118
|
+
name: z.ZodString;
|
|
119
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
120
|
+
kind: z.ZodLiteral<"page">;
|
|
121
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
name: z.ZodString;
|
|
124
|
+
datatypeId: z.ZodString;
|
|
125
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
126
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
131
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.core.$strict>>;
|
|
133
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
134
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
treeRules: z.ZodObject<{
|
|
137
|
+
allowedAtRoot: z.ZodBoolean;
|
|
138
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
139
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
142
|
+
id: z.ZodString;
|
|
143
|
+
name: z.ZodString;
|
|
144
|
+
}, z.core.$strict>>>;
|
|
145
|
+
defaultTemplateId: z.ZodOptional<z.ZodString>;
|
|
146
|
+
translationMandatory: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
collection: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
name: z.ZodString;
|
|
151
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
152
|
+
kind: z.ZodLiteral<"element">;
|
|
153
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
154
|
+
id: z.ZodString;
|
|
155
|
+
name: z.ZodString;
|
|
156
|
+
datatypeId: z.ZodString;
|
|
157
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
158
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
160
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
162
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
164
|
+
}, z.core.$strict>>;
|
|
165
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
166
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
167
|
+
}, z.core.$strict>>;
|
|
168
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
169
|
+
id: z.ZodString;
|
|
170
|
+
name: z.ZodString;
|
|
171
|
+
}, z.core.$strict>>>;
|
|
172
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
173
|
+
id: z.ZodString;
|
|
174
|
+
name: z.ZodString;
|
|
175
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
176
|
+
kind: z.ZodLiteral<"media">;
|
|
177
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
datatypeId: z.ZodString;
|
|
181
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
183
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
185
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
188
|
+
}, z.core.$strict>>;
|
|
189
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
190
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
193
|
+
id: z.ZodString;
|
|
194
|
+
name: z.ZodString;
|
|
195
|
+
}, z.core.$strict>>>;
|
|
196
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
197
|
+
catchAll: z.ZodOptional<z.ZodBoolean>;
|
|
198
|
+
}, z.core.$strict>], "kind">;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
export type CreateDocumentTypeResponse = z.infer<typeof CreateDocumentTypeResponseSchema>;
|
|
201
|
+
export declare const DocumentTypeListQuerySchema: z.ZodObject<{
|
|
202
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
203
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
export type DocumentTypeListQuery = z.infer<typeof DocumentTypeListQuerySchema>;
|
|
206
|
+
export declare const DocumentTypeListResponseSchema: z.ZodObject<{
|
|
207
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
208
|
+
id: z.ZodString;
|
|
209
|
+
name: z.ZodString;
|
|
210
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
211
|
+
kind: z.ZodLiteral<"page">;
|
|
212
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
name: z.ZodString;
|
|
215
|
+
datatypeId: z.ZodString;
|
|
216
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
217
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
218
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
219
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
220
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
222
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strict>>;
|
|
224
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
225
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
226
|
+
}, z.core.$strict>>;
|
|
227
|
+
treeRules: z.ZodObject<{
|
|
228
|
+
allowedAtRoot: z.ZodBoolean;
|
|
229
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
230
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
231
|
+
}, z.core.$strip>;
|
|
232
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
233
|
+
id: z.ZodString;
|
|
234
|
+
name: z.ZodString;
|
|
235
|
+
}, z.core.$strict>>>;
|
|
236
|
+
defaultTemplateId: z.ZodOptional<z.ZodString>;
|
|
237
|
+
translationMandatory: z.ZodOptional<z.ZodBoolean>;
|
|
238
|
+
collection: z.ZodOptional<z.ZodBoolean>;
|
|
239
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
240
|
+
id: z.ZodString;
|
|
241
|
+
name: z.ZodString;
|
|
242
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
243
|
+
kind: z.ZodLiteral<"element">;
|
|
244
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
245
|
+
id: z.ZodString;
|
|
246
|
+
name: z.ZodString;
|
|
247
|
+
datatypeId: z.ZodString;
|
|
248
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
249
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
250
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
251
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
252
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
253
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
255
|
+
}, z.core.$strict>>;
|
|
256
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
257
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
258
|
+
}, z.core.$strict>>;
|
|
259
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
260
|
+
id: z.ZodString;
|
|
261
|
+
name: z.ZodString;
|
|
262
|
+
}, z.core.$strict>>>;
|
|
263
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
264
|
+
id: z.ZodString;
|
|
265
|
+
name: z.ZodString;
|
|
266
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
267
|
+
kind: z.ZodLiteral<"media">;
|
|
268
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
269
|
+
id: z.ZodString;
|
|
270
|
+
name: z.ZodString;
|
|
271
|
+
datatypeId: z.ZodString;
|
|
272
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
273
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
274
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
275
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
276
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
277
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
279
|
+
}, z.core.$strict>>;
|
|
280
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
281
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
282
|
+
}, z.core.$strict>>;
|
|
283
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
284
|
+
id: z.ZodString;
|
|
285
|
+
name: z.ZodString;
|
|
286
|
+
}, z.core.$strict>>>;
|
|
287
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
288
|
+
catchAll: z.ZodOptional<z.ZodBoolean>;
|
|
289
|
+
}, z.core.$strict>], "kind">>;
|
|
290
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
291
|
+
}, z.core.$strip>;
|
|
292
|
+
export type DocumentTypeListResponse = z.infer<typeof DocumentTypeListResponseSchema>;
|
|
293
|
+
export declare const DeleteDocumentTypeResponseSchema: z.ZodObject<{
|
|
294
|
+
success: z.ZodLiteral<true>;
|
|
295
|
+
}, z.core.$strip>;
|
|
296
|
+
export type DeleteDocumentTypeResponse = z.infer<typeof DeleteDocumentTypeResponseSchema>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DocumentTypeDefinitionSchema, FieldDefinitionSchema, TabDefinitionSchema, TreeRulesSchema, } from "./document-type.schema.js";
|
|
3
|
+
// Shared by create AND update: duplicate field keys within one document
|
|
4
|
+
// type would silently collide in ContentVersion.data later, and a tabId
|
|
5
|
+
// must reference a tab declared in the same payload.
|
|
6
|
+
function validateFieldsAndTabs(value, ctx) {
|
|
7
|
+
const seen = new Set();
|
|
8
|
+
for (const [index, field] of value.fields.entries()) {
|
|
9
|
+
if (seen.has(field.id)) {
|
|
10
|
+
ctx.addIssue({
|
|
11
|
+
code: "custom",
|
|
12
|
+
message: `Duplicate field id "${field.id}": field ids must be unique within a document type`,
|
|
13
|
+
path: ["fields", index, "id"],
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
seen.add(field.id);
|
|
17
|
+
}
|
|
18
|
+
const tabIds = new Set(value.tabs.map((tab) => tab.id));
|
|
19
|
+
for (const [index, field] of value.fields.entries()) {
|
|
20
|
+
if (field.tabId !== undefined && !tabIds.has(field.tabId)) {
|
|
21
|
+
ctx.addIssue({
|
|
22
|
+
code: "custom",
|
|
23
|
+
message: `Field references unknown tab id "${field.tabId}"`,
|
|
24
|
+
path: ["fields", index, "tabId"],
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Same shape as DocumentTypeDefinitionSchema minus `id` — the server
|
|
30
|
+
// mints that. `defaultTemplateId` is deliberately absent even on the
|
|
31
|
+
// 'page' branch — it's only ever set afterward via the dedicated
|
|
32
|
+
// default-template endpoint, since a template can't exist before its
|
|
33
|
+
// document type does.
|
|
34
|
+
export const CreateDocumentTypeRequestSchema = z
|
|
35
|
+
.discriminatedUnion("kind", [
|
|
36
|
+
z
|
|
37
|
+
.object({
|
|
38
|
+
name: z.string().min(1),
|
|
39
|
+
// Optional since S183: absent/empty renders the default document
|
|
40
|
+
// icon in the admin. Stored values stay untouched.
|
|
41
|
+
icon: z.string().optional().default(""),
|
|
42
|
+
kind: z.literal("page"),
|
|
43
|
+
fields: z.array(FieldDefinitionSchema),
|
|
44
|
+
treeRules: TreeRulesSchema,
|
|
45
|
+
tabs: z.array(TabDefinitionSchema).default([]),
|
|
46
|
+
// S230c: refuse publishing a language whose required varying
|
|
47
|
+
// fields are unfilled. Page types only.
|
|
48
|
+
translationMandatory: z.boolean().optional(),
|
|
49
|
+
// S232: the tree draws this type's pages as a single row with a
|
|
50
|
+
// child count and lists their children as a table instead of
|
|
51
|
+
// expanding them. Page types only.
|
|
52
|
+
collection: z.boolean().optional(),
|
|
53
|
+
})
|
|
54
|
+
.strict(),
|
|
55
|
+
z
|
|
56
|
+
.object({
|
|
57
|
+
name: z.string().min(1),
|
|
58
|
+
// Optional since S183: absent/empty renders the default document
|
|
59
|
+
// icon in the admin. Stored values stay untouched.
|
|
60
|
+
icon: z.string().optional().default(""),
|
|
61
|
+
kind: z.literal("element"),
|
|
62
|
+
fields: z.array(FieldDefinitionSchema),
|
|
63
|
+
tabs: z.array(TabDefinitionSchema).default([]),
|
|
64
|
+
})
|
|
65
|
+
.strict(),
|
|
66
|
+
// S234a: the third kind. No treeRules, no translationMandatory and no
|
|
67
|
+
// collection, for the same reason the 'element' branch has none: media
|
|
68
|
+
// has no tree presence at all. The two keys it does add are the upload
|
|
69
|
+
// router's, not the tree's: see apps/server/src/media/media-type-router.ts.
|
|
70
|
+
z
|
|
71
|
+
.object({
|
|
72
|
+
name: z.string().min(1),
|
|
73
|
+
// Optional since S183: absent/empty renders the default document
|
|
74
|
+
// icon in the admin. Stored values stay untouched.
|
|
75
|
+
icon: z.string().optional().default(""),
|
|
76
|
+
kind: z.literal("media"),
|
|
77
|
+
fields: z.array(FieldDefinitionSchema),
|
|
78
|
+
tabs: z.array(TabDefinitionSchema).default([]),
|
|
79
|
+
// Which type claims an uploaded file when more than one accepts
|
|
80
|
+
// its extension: lower sorts first, and a type with no number at
|
|
81
|
+
// all sorts after every type that has one.
|
|
82
|
+
sortOrder: z.number().int().nonnegative().optional(),
|
|
83
|
+
// The type an upload lands on when nothing else claims the
|
|
84
|
+
// extension. A singleton: the route moves it rather than letting
|
|
85
|
+
// a second type claim it, and refuses to leave an install with
|
|
86
|
+
// none.
|
|
87
|
+
catchAll: z.boolean().optional(),
|
|
88
|
+
})
|
|
89
|
+
.strict(),
|
|
90
|
+
])
|
|
91
|
+
.superRefine(validateFieldsAndTabs);
|
|
92
|
+
// PUT /api/document-types/:id — the mutable subset only. `kind` is
|
|
93
|
+
// immutable after creation (a payload carrying it fails .strict() — the
|
|
94
|
+
// intended behavior, not an accident) and `defaultTemplateId` stays with
|
|
95
|
+
// its dedicated pointer endpoint. `treeRules` is optional HERE because
|
|
96
|
+
// the schema can't know the stored kind; the route requires it for
|
|
97
|
+
// 'page' types and rejects it for 'element' types.
|
|
98
|
+
export const UpdateDocumentTypeRequestSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
name: z.string().min(1),
|
|
101
|
+
// Optional since S183: absent/empty renders the default document
|
|
102
|
+
// icon in the admin. Stored values stay untouched.
|
|
103
|
+
icon: z.string().optional().default(""),
|
|
104
|
+
fields: z.array(FieldDefinitionSchema),
|
|
105
|
+
tabs: z.array(TabDefinitionSchema).default([]),
|
|
106
|
+
treeRules: TreeRulesSchema.optional(),
|
|
107
|
+
// S230c: refuse publishing a language whose required varying
|
|
108
|
+
// fields are unfilled. Page types only.
|
|
109
|
+
translationMandatory: z.boolean().optional(),
|
|
110
|
+
// S232: page types only, the same as translationMandatory. Optional
|
|
111
|
+
// here because the schema cannot know the stored kind; the route
|
|
112
|
+
// rejects it for an 'element' type and treats omission as "keep".
|
|
113
|
+
collection: z.boolean().optional(),
|
|
114
|
+
// S234a: media types only, and optional here for exactly the same
|
|
115
|
+
// reason as the two above: the schema cannot know the stored kind.
|
|
116
|
+
// The route rejects both for a non-media type, treats omission as
|
|
117
|
+
// "keep" (the adapter writes them verbatim, so omission would
|
|
118
|
+
// otherwise clear the File type's catch-all on a plain rename), and
|
|
119
|
+
// owns the singleton rule for catchAll.
|
|
120
|
+
sortOrder: z.number().int().nonnegative().optional(),
|
|
121
|
+
catchAll: z.boolean().optional(),
|
|
122
|
+
})
|
|
123
|
+
.strict()
|
|
124
|
+
.superRefine(validateFieldsAndTabs);
|
|
125
|
+
export const CreateDocumentTypeResponseSchema = z.object({
|
|
126
|
+
documentType: DocumentTypeDefinitionSchema,
|
|
127
|
+
});
|
|
128
|
+
export const DocumentTypeListQuerySchema = z.object({
|
|
129
|
+
cursor: z.string().uuid().optional(),
|
|
130
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
131
|
+
});
|
|
132
|
+
export const DocumentTypeListResponseSchema = z.object({
|
|
133
|
+
items: z.array(DocumentTypeDefinitionSchema),
|
|
134
|
+
nextCursor: z.string().uuid().nullable(),
|
|
135
|
+
});
|
|
136
|
+
export const DeleteDocumentTypeResponseSchema = z.object({
|
|
137
|
+
success: z.literal(true),
|
|
138
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const FieldValidationSchema: z.ZodObject<{
|
|
3
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
4
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
export type FieldValidation = z.infer<typeof FieldValidationSchema>;
|
|
11
|
+
export declare const TabDefinitionSchema: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type TabDefinition = z.infer<typeof TabDefinitionSchema>;
|
|
16
|
+
export declare const FieldDefinitionSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
datatypeId: z.ZodString;
|
|
20
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>>;
|
|
28
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
29
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export type FieldDefinition = z.infer<typeof FieldDefinitionSchema>;
|
|
32
|
+
export declare const TreeRulesSchema: z.ZodObject<{
|
|
33
|
+
allowedAtRoot: z.ZodBoolean;
|
|
34
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
35
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type TreeRules = z.infer<typeof TreeRulesSchema>;
|
|
38
|
+
export declare const DocumentTypeDefinitionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
name: z.ZodString;
|
|
41
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
42
|
+
kind: z.ZodLiteral<"page">;
|
|
43
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
datatypeId: z.ZodString;
|
|
47
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$strict>>;
|
|
55
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
56
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
treeRules: z.ZodObject<{
|
|
59
|
+
allowedAtRoot: z.ZodBoolean;
|
|
60
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
61
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
name: z.ZodString;
|
|
66
|
+
}, z.core.$strict>>>;
|
|
67
|
+
defaultTemplateId: z.ZodOptional<z.ZodString>;
|
|
68
|
+
translationMandatory: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
collection: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
name: z.ZodString;
|
|
73
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
74
|
+
kind: z.ZodLiteral<"element">;
|
|
75
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
datatypeId: z.ZodString;
|
|
79
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strict>>;
|
|
87
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
88
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
}, z.core.$strict>>;
|
|
90
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
91
|
+
id: z.ZodString;
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
}, z.core.$strict>>>;
|
|
94
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
icon: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
98
|
+
kind: z.ZodLiteral<"media">;
|
|
99
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
name: z.ZodString;
|
|
102
|
+
datatypeId: z.ZodString;
|
|
103
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
104
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.core.$strict>>;
|
|
111
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
varies: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
+
}, z.core.$strict>>;
|
|
114
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
name: z.ZodString;
|
|
117
|
+
}, z.core.$strict>>>;
|
|
118
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
catchAll: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
}, z.core.$strict>], "kind">;
|
|
121
|
+
export type DocumentTypeDefinition = z.infer<typeof DocumentTypeDefinitionSchema>;
|