@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,353 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { RESERVED_ROOT_SLUGS, isReservedRootSlug } from "./reserved-slugs.js";
|
|
3
|
+
import { ContentNodeSchema, NodeCultureSchema } from "./content.schema.js";
|
|
4
|
+
import { ContentVersionSchema } from "./content-version.schema.js";
|
|
5
|
+
import { NodeAccessFlagsSchema } from "./node-access.schema.js";
|
|
6
|
+
// createdBy is deliberately absent from mutation request bodies — it comes
|
|
7
|
+
// from the authenticated JWT (sub claim), never from the caller.
|
|
8
|
+
// The culture is a BCP 47 language tag, the same shape Accept-Language is
|
|
9
|
+
// matched against.
|
|
10
|
+
// Validated by shape rather than against a fixed list: the site's actual
|
|
11
|
+
// culture list lives in Settings (S229b, apps/server/src/settings/
|
|
12
|
+
// culture-settings.ts) and is read there, not re-validated against here:
|
|
13
|
+
// a closed list in this schema would be a second source of truth.
|
|
14
|
+
//
|
|
15
|
+
// Declared here, ahead of every schema in this file that references it
|
|
16
|
+
// (PublishContentRequestSchema, ContentItemQuerySchema below), so nothing
|
|
17
|
+
// downstream trips a temporal-dead-zone ReferenceError at module load.
|
|
18
|
+
export const CultureSchema = z
|
|
19
|
+
.string()
|
|
20
|
+
.regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/, "Use a language tag such as en, de or pt-BR.");
|
|
21
|
+
export const CreateContentRequestSchema = z.object({
|
|
22
|
+
documentTypeId: z.string().uuid(),
|
|
23
|
+
parentId: z.string().uuid().nullable(),
|
|
24
|
+
// The server stores a node under its parent's stored row and a slug: the
|
|
25
|
+
// slug is `slug` when sent, otherwise the last segment of `path`. The rest
|
|
26
|
+
// of `path`, and `depth`, are accepted for existing callers and not used.
|
|
27
|
+
// S278b (D13): the admin sends `slug` alone, so `path` and `depth` are
|
|
28
|
+
// optional; a body must still carry one of `slug` or `path`.
|
|
29
|
+
path: z.string().min(1).optional(),
|
|
30
|
+
depth: z.number().int().nonnegative().optional(),
|
|
31
|
+
slug: z.string().min(1).optional(),
|
|
32
|
+
sortOrder: z.number().int(),
|
|
33
|
+
data: z.record(z.string(), z.unknown()),
|
|
34
|
+
}).refine((body) => body.slug !== undefined || body.path !== undefined, {
|
|
35
|
+
message: "Send a slug (or a path whose last segment is the slug).",
|
|
36
|
+
path: ["slug"],
|
|
37
|
+
});
|
|
38
|
+
export const ContentItemResponseSchema = z.object({
|
|
39
|
+
node: ContentNodeSchema,
|
|
40
|
+
// S277c: the address a visitor would use for this node in the culture
|
|
41
|
+
// this response is for: the stored path with the default site's own
|
|
42
|
+
// segment hidden, and the culture prefix on a site with more than one
|
|
43
|
+
// language. Computed by the server, which knows the default site; the
|
|
44
|
+
// admin shows it and never derives one from `node.path`.
|
|
45
|
+
// S277e: null when no link can be made from the domain this request
|
|
46
|
+
// came on (the admin is open on a site's own domain, and the page lives
|
|
47
|
+
// on a default address that has no name).
|
|
48
|
+
url: z.string().nullable(),
|
|
49
|
+
version: ContentVersionSchema,
|
|
50
|
+
// The pointer of the culture this response is for: the requested one, or
|
|
51
|
+
// the site's default. Null when that culture has never been published or
|
|
52
|
+
// bootstrapped for this node.
|
|
53
|
+
culture: NodeCultureSchema.nullable(),
|
|
54
|
+
// What the signed-in person may do on this node (S276).
|
|
55
|
+
access: NodeAccessFlagsSchema,
|
|
56
|
+
});
|
|
57
|
+
// S156 admin by-path lookup — the admin origin's honest-headless view
|
|
58
|
+
// resolves a pasted URL against the content tree. Drafts ARE visible here
|
|
59
|
+
// (this is the back office); the public no-leak rule lives on the server
|
|
60
|
+
// origin's bridge, not on this authenticated route.
|
|
61
|
+
export const ContentByPathQuerySchema = z.object({
|
|
62
|
+
path: z.string().min(1),
|
|
63
|
+
});
|
|
64
|
+
export const ContentByPathResponseSchema = z.object({
|
|
65
|
+
node: ContentNodeSchema,
|
|
66
|
+
// What the signed-in person may do on this node (S276). The lookup never
|
|
67
|
+
// refuses a node: a locked one answers with read false.
|
|
68
|
+
access: NodeAccessFlagsSchema,
|
|
69
|
+
});
|
|
70
|
+
// S277c: the admin's by-address lookup reads `path` as a visitor's address
|
|
71
|
+
// (GET /api/content/by-address), where by-path reads it as a stored path.
|
|
72
|
+
// The same answer on purpose: the node it finds is described exactly as
|
|
73
|
+
// by-path describes it, stored path included.
|
|
74
|
+
//
|
|
75
|
+
// S277d: an address is a host and a path once a site can have its own
|
|
76
|
+
// domain. `host` is the host to read the address on; without it the
|
|
77
|
+
// address is read on the host this request came to. It is only compared
|
|
78
|
+
// with the domains stored on sites, so any text is accepted: a value that
|
|
79
|
+
// is no host reads as a host no site has claimed. The cap is the longest
|
|
80
|
+
// request host the server looks at.
|
|
81
|
+
export const ContentByAddressQuerySchema = z.object({
|
|
82
|
+
path: z.string().min(1),
|
|
83
|
+
host: z
|
|
84
|
+
.string()
|
|
85
|
+
.max(300)
|
|
86
|
+
.optional()
|
|
87
|
+
.describe("The host to read the address on. Defaults to the host of this request."),
|
|
88
|
+
});
|
|
89
|
+
export const ContentByAddressResponseSchema = ContentByPathResponseSchema;
|
|
90
|
+
export const SaveContentRequestSchema = z.object({
|
|
91
|
+
data: z.record(z.string(), z.unknown()),
|
|
92
|
+
// S230: which culture the varying fields in `data` belong to. Omitted
|
|
93
|
+
// means the site's default culture. Publish already took a culture; save
|
|
94
|
+
// did not, so there was no route by which German content could be saved
|
|
95
|
+
// at all, only published.
|
|
96
|
+
culture: CultureSchema.optional(),
|
|
97
|
+
// S233: the version the editor had loaded when it saved. The other
|
|
98
|
+
// languages' slices are carried from this version instead of the latest,
|
|
99
|
+
// so a save from a loaded old version stores what every language tab
|
|
100
|
+
// showed. Omitted means the latest, which is every save before S233.
|
|
101
|
+
baseVersion: z.number().int().positive().optional(),
|
|
102
|
+
});
|
|
103
|
+
export const SaveContentResponseSchema = z.object({
|
|
104
|
+
version: ContentVersionSchema,
|
|
105
|
+
// S277e: the node as it is after this save. A save can rename the node,
|
|
106
|
+
// which moves its stored path, so the editor replaces the node it holds
|
|
107
|
+
// with this one: the path in its header, its breadcrumb and its rename
|
|
108
|
+
// warning then follow the save at once.
|
|
109
|
+
node: ContentNodeSchema,
|
|
110
|
+
// S277c: the address a visitor would use for the node as it is after
|
|
111
|
+
// this save, in the culture the save was for. A save can rename the node,
|
|
112
|
+
// so the editor takes its URL from here and never keeps the one it
|
|
113
|
+
// loaded.
|
|
114
|
+
// S277e: null when no link can be made from the domain this request
|
|
115
|
+
// came on (the admin is open on a site's own domain, and the page lives
|
|
116
|
+
// on a default address that has no name).
|
|
117
|
+
url: z.string().nullable(),
|
|
118
|
+
});
|
|
119
|
+
// GET /api/content/:id/versions/latest — the newest saved version,
|
|
120
|
+
// regardless of the current_version pointer. This is what the content
|
|
121
|
+
// editor edits: after a draft save, GET /api/content/:id still serves the
|
|
122
|
+
// pointer (published) version by design, so the draft would otherwise be
|
|
123
|
+
// unreachable over REST. Also the response shape of
|
|
124
|
+
// GET /api/content/:id/versions/:version (same "one full version" read).
|
|
125
|
+
// S230c: ?locale= reads the newest save's values for one language exactly
|
|
126
|
+
// as stored, for the editor's language tab.
|
|
127
|
+
export const LatestVersionQuerySchema = z.object({ locale: CultureSchema.optional() });
|
|
128
|
+
// S233: GET /api/content/:id/versions/:version takes the same ?locale= the
|
|
129
|
+
// latest read does, so the editor can load an old version for one language.
|
|
130
|
+
export const VersionQuerySchema = LatestVersionQuerySchema;
|
|
131
|
+
export const LatestVersionResponseSchema = z.object({
|
|
132
|
+
version: ContentVersionSchema,
|
|
133
|
+
// With ?locale=: the varying field ids this language has no value for,
|
|
134
|
+
// whether or not the default language has one. Unlike the public read,
|
|
135
|
+
// where fellBack lists only the fields actually filled from the default.
|
|
136
|
+
// Absent without locale.
|
|
137
|
+
fellBack: z.array(z.string()).optional(),
|
|
138
|
+
});
|
|
139
|
+
// Version history list: metadata only — `data` can be arbitrarily large
|
|
140
|
+
// and the history view only needs the row facts; the full snapshot is one
|
|
141
|
+
// GET /api/content/:id/versions/:version away.
|
|
142
|
+
export const ContentVersionMetaSchema = ContentVersionSchema.omit({ data: true });
|
|
143
|
+
// Newest-first pages. Version numbers are contiguous (1..latest, rows are
|
|
144
|
+
// never deleted — immutability), so the cursor is simply the last version
|
|
145
|
+
// number of the previous page.
|
|
146
|
+
export const VersionListQuerySchema = z.object({
|
|
147
|
+
cursor: z.coerce.number().int().positive().optional(),
|
|
148
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
149
|
+
});
|
|
150
|
+
export const VersionListResponseSchema = z.object({
|
|
151
|
+
items: z.array(ContentVersionMetaSchema),
|
|
152
|
+
// null = no more pages.
|
|
153
|
+
nextCursor: z.number().int().positive().nullable(),
|
|
154
|
+
});
|
|
155
|
+
export const PublishContentRequestSchema = z.object({
|
|
156
|
+
// Omitted = publish the latest saved version.
|
|
157
|
+
version: z.number().int().positive().optional(),
|
|
158
|
+
// S229b: which culture's pointer to move. Omitted = the site's default
|
|
159
|
+
// culture, resolved server-side from Settings.
|
|
160
|
+
culture: CultureSchema.optional(),
|
|
161
|
+
});
|
|
162
|
+
// S233: publish-all at a version other than the latest, the whole-node
|
|
163
|
+
// rollback. Omitted = the latest saved version, as before.
|
|
164
|
+
export const PublishAllRequestSchema = z.object({
|
|
165
|
+
version: z.number().int().positive().optional(),
|
|
166
|
+
});
|
|
167
|
+
export const PublishContentResponseSchema = z.object({
|
|
168
|
+
node: ContentNodeSchema,
|
|
169
|
+
// S277c: the address a visitor would use for `node` in the culture that
|
|
170
|
+
// was published. It is worked out after the publish, which can itself
|
|
171
|
+
// change it: publishing the pinned default site is what hides its
|
|
172
|
+
// segment.
|
|
173
|
+
// S277e: null when no link can be made from the domain this request
|
|
174
|
+
// came on (the admin is open on a site's own domain, and the page lives
|
|
175
|
+
// on a default address that has no name).
|
|
176
|
+
url: z.string().nullable(),
|
|
177
|
+
// The pointer the publish just moved.
|
|
178
|
+
culture: NodeCultureSchema,
|
|
179
|
+
});
|
|
180
|
+
// S230c: one result per site language. A language refused for an
|
|
181
|
+
// incomplete mandatory translation does not stop the others.
|
|
182
|
+
export const PublishAllResultSchema = z.discriminatedUnion("status", [
|
|
183
|
+
z.object({ culture: z.string(), status: z.literal("published"), version: z.number().int().positive() }),
|
|
184
|
+
z.object({ culture: z.string(), status: z.literal("incomplete"), fieldIds: z.array(z.string()) }),
|
|
185
|
+
]);
|
|
186
|
+
export const PublishAllResponseSchema = z.object({ results: z.array(PublishAllResultSchema) });
|
|
187
|
+
// POST /api/content/:id/preview-token (Session 116) — mints a stateless,
|
|
188
|
+
// short-TTL, single-content-id preview token (see
|
|
189
|
+
// apps/server/src/auth/preview-tokens.ts). Any existing content id may be
|
|
190
|
+
// minted for, published or not; `expiresAt` is an ISO datetime string.
|
|
191
|
+
// Session 117: added `previewUrl` — the full preview URL (including token),
|
|
192
|
+
// or null if KARDALUM_PREVIEW_BASE_URL is not configured.
|
|
193
|
+
export const PreviewTokenResponseSchema = z.object({
|
|
194
|
+
token: z.string(),
|
|
195
|
+
expiresAt: z.string().datetime(),
|
|
196
|
+
previewUrl: z.string().nullable(),
|
|
197
|
+
});
|
|
198
|
+
// `locale` selects which culture of the node to read; omitted means the
|
|
199
|
+
// site's default culture. There is no fallback parameter: a field the
|
|
200
|
+
// culture has not translated always falls back to the default culture's
|
|
201
|
+
// value (ContentService.getContentForCulture).
|
|
202
|
+
export const ContentItemQuerySchema = z.object({
|
|
203
|
+
locale: CultureSchema.optional(),
|
|
204
|
+
});
|
|
205
|
+
export const ContentChildrenQuerySchema = z.object({
|
|
206
|
+
// Cursor = id of the previous page's last node, same semantics as
|
|
207
|
+
// DatabaseAdapter.getChildren.
|
|
208
|
+
cursor: z.string().uuid().optional(),
|
|
209
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
210
|
+
});
|
|
211
|
+
// S227: the tree labels itself from the node's NAME, which lives in the
|
|
212
|
+
// current version's data rather than on ContentNode. Rather than widen
|
|
213
|
+
// ContentNode (a node row genuinely has no name column), the list
|
|
214
|
+
// responses carry it alongside.
|
|
215
|
+
//
|
|
216
|
+
// Optional, and absent rather than empty when a node has no name recorded:
|
|
217
|
+
// that is every node created before S227, and the client falls back to the
|
|
218
|
+
// last path segment for them. Making it `""` would render a blank,
|
|
219
|
+
// unclickable tree row.
|
|
220
|
+
export const ContentNodeWithNameSchema = ContentNodeSchema.extend({
|
|
221
|
+
name: z.string().min(1).optional(),
|
|
222
|
+
// S230c: how many other site languages have a saved edit that is not
|
|
223
|
+
// live yet (Z18). Zero for a document type with no field that varies by
|
|
224
|
+
// culture, not just for a single-language site.
|
|
225
|
+
culturesBehind: z.number().int().nonnegative(),
|
|
226
|
+
// S230c: the default language's own publish pointer, or null when this
|
|
227
|
+
// node has none in the default language. The tree badge reads this,
|
|
228
|
+
// not publishedAt, which means "published in any language".
|
|
229
|
+
defaultCulture: NodeCultureSchema.nullable(),
|
|
230
|
+
// S232: how many children this node has. Required (not optional): the
|
|
231
|
+
// tree uses it to decide whether to render the "past 50" collection
|
|
232
|
+
// hint, and a collection-typed node's row uses it as the count badge
|
|
233
|
+
// instead of expanding into the tree. Every list route that produces a
|
|
234
|
+
// ContentNodeWithName must count children now, not just the ones with a
|
|
235
|
+
// collection-typed document type.
|
|
236
|
+
childCount: z.number().int().nonnegative(),
|
|
237
|
+
// What the signed-in person may do on this node (S276). The row is always
|
|
238
|
+
// listed; read false means its content is withheld, not its place.
|
|
239
|
+
access: NodeAccessFlagsSchema,
|
|
240
|
+
});
|
|
241
|
+
// S228: copy and move.
|
|
242
|
+
//
|
|
243
|
+
// Both take the TARGET PARENT rather than a path: the server computes the
|
|
244
|
+
// path from the parent, so a client can never place a node by asserting a
|
|
245
|
+
// path the tree does not agree with.
|
|
246
|
+
export const CopyContentRequestSchema = z.object({
|
|
247
|
+
targetParentId: z.string().uuid().nullable(),
|
|
248
|
+
// Offered only when the source has descendants. A copy without children
|
|
249
|
+
// is the common case and stays the default.
|
|
250
|
+
includeChildren: z.boolean().default(false),
|
|
251
|
+
});
|
|
252
|
+
export const MoveContentRequestSchema = z.object({
|
|
253
|
+
targetParentId: z.string().uuid().nullable(),
|
|
254
|
+
});
|
|
255
|
+
// The moved node, with what the signed-in person may do on it at its new
|
|
256
|
+
// stored path.
|
|
257
|
+
export const MoveContentResponseSchema = z.object({
|
|
258
|
+
node: ContentNodeSchema,
|
|
259
|
+
access: NodeAccessFlagsSchema,
|
|
260
|
+
});
|
|
261
|
+
// S228: the 409 a taken sibling path produces, for a rename, a move or a
|
|
262
|
+
// copy. `path` is what the caller would have occupied, so the UI can name
|
|
263
|
+
// it rather than saying "something is in the way".
|
|
264
|
+
// S278b (A2, D6): `path` is the page that holds the address, sent only when
|
|
265
|
+
// the asker may read it; without it the message says only that the name is in
|
|
266
|
+
// use.
|
|
267
|
+
export const ContentPathConflictSchema = z.object({
|
|
268
|
+
message: z.string(),
|
|
269
|
+
path: z.string().optional(),
|
|
270
|
+
});
|
|
271
|
+
export const ContentChildrenResponseSchema = z.object({
|
|
272
|
+
items: z.array(ContentNodeWithNameSchema),
|
|
273
|
+
// null = no more pages.
|
|
274
|
+
nextCursor: z.string().uuid().nullable(),
|
|
275
|
+
});
|
|
276
|
+
// Whole-array reorder (mirrors the document-type fields/tabs pattern) —
|
|
277
|
+
// orderedIds must exactly match the current children of the parent (or
|
|
278
|
+
// root nodes, for /api/content/roots/reorder); the adapter rejects
|
|
279
|
+
// otherwise. Only practical for a fully-loaded sibling list, so the admin
|
|
280
|
+
// UI only offers drag-reorder once every page has loaded.
|
|
281
|
+
export const ReorderNodesRequestSchema = z.object({
|
|
282
|
+
orderedIds: z.array(z.string().uuid()).min(1),
|
|
283
|
+
});
|
|
284
|
+
export const ReorderNodesResponseSchema = z.object({
|
|
285
|
+
success: z.literal(true),
|
|
286
|
+
});
|
|
287
|
+
// The one deliberate exception to ApiErrorSchema's "every route, same
|
|
288
|
+
// shape" rule (api-error.schema.ts) — field validation failures are
|
|
289
|
+
// per-field by nature, and the admin editor needs that structure to
|
|
290
|
+
// eventually highlight the right field/tab, not just show a string.
|
|
291
|
+
//
|
|
292
|
+
// Two reporting routes (S198): a webmaster-configured rule and a built-in
|
|
293
|
+
// datatype's hook both report `key` (a translation key the admin already
|
|
294
|
+
// renders); a third-party datatype's hook reports `message` (its own
|
|
295
|
+
// string — plugin-message i18n is a later concern). Exactly one of the two
|
|
296
|
+
// is always present, and `path` names a sub-key inside a composite value
|
|
297
|
+
// (a date range's "end") so the form can mark the precise sub-input rather
|
|
298
|
+
// than the whole field.
|
|
299
|
+
export const FieldValidationFailureSchema = z.union([
|
|
300
|
+
z.object({
|
|
301
|
+
fieldId: z.string(),
|
|
302
|
+
key: z.string(),
|
|
303
|
+
params: z.record(z.string(), z.unknown()).optional(),
|
|
304
|
+
path: z.string().optional(),
|
|
305
|
+
}),
|
|
306
|
+
z.object({
|
|
307
|
+
fieldId: z.string(),
|
|
308
|
+
message: z.string(),
|
|
309
|
+
path: z.string().optional(),
|
|
310
|
+
}),
|
|
311
|
+
]);
|
|
312
|
+
export const ContentValidationErrorSchema = z.object({
|
|
313
|
+
message: z.string(),
|
|
314
|
+
fieldErrors: z.array(FieldValidationFailureSchema),
|
|
315
|
+
// S278b (A2, D6): a name another page holds as the first part of an
|
|
316
|
+
// address names that page here, only when the asker may read it.
|
|
317
|
+
heldByPath: z.string().optional(),
|
|
318
|
+
});
|
|
319
|
+
// S229b: the site's cultures and which is default. The default must be one
|
|
320
|
+
// of the listed cultures, so the pair cannot name a culture that does not
|
|
321
|
+
// exist. A site with one culture has, for every purpose above this, no
|
|
322
|
+
// language dimension at all.
|
|
323
|
+
export const CultureSettingsSchema = z
|
|
324
|
+
.object({
|
|
325
|
+
cultures: z.array(CultureSchema).min(1),
|
|
326
|
+
defaultCulture: CultureSchema,
|
|
327
|
+
})
|
|
328
|
+
.refine((value) => value.cultures.includes(value.defaultCulture), {
|
|
329
|
+
message: "The default culture must be one of the site's cultures.",
|
|
330
|
+
path: ["defaultCulture"],
|
|
331
|
+
})
|
|
332
|
+
// S230d: language tags are case-insensitive (BCP 47), so "pt-BR" and
|
|
333
|
+
// "pt-br" are the same language and listing both is refused.
|
|
334
|
+
.refine((value) => new Set(value.cultures.map((culture) => culture.toLowerCase())).size === value.cultures.length, { message: "Each language can only be listed once.", path: ["cultures"] })
|
|
335
|
+
// S230: a culture code and a reserved root slug both live in the first
|
|
336
|
+
// path segment, and "api" is a reserved slug AND a well-formed three
|
|
337
|
+
// letter language tag. So is any ISO 639-3 code that collides. The server
|
|
338
|
+
// owns those paths, so a site configured with such a culture could never
|
|
339
|
+
// serve it: /api/about-us reaches the API, not the renderer. Refused here
|
|
340
|
+
// rather than accepted and silently unreachable.
|
|
341
|
+
.refine((value) => !value.cultures.some((culture) => isReservedRootSlug(culture)), {
|
|
342
|
+
message: `A culture cannot be named after a path the server owns (${RESERVED_ROOT_SLUGS.join(", ")}).`,
|
|
343
|
+
path: ["cultures"],
|
|
344
|
+
});
|
|
345
|
+
// S229b: the 409 a publish produces when a culture's mandatory translation
|
|
346
|
+
// is incomplete. `culture` and `fieldIds` mirror TranslationIncompleteError
|
|
347
|
+
// so the editor can point at exactly what is unfilled, and in which
|
|
348
|
+
// language.
|
|
349
|
+
export const TranslationIncompleteResponseSchema = z.object({
|
|
350
|
+
message: z.string(),
|
|
351
|
+
culture: z.string(),
|
|
352
|
+
fieldIds: z.array(z.string()),
|
|
353
|
+
});
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { DataTypeConfig } from "./data-type-config.schema.js";
|
|
3
|
+
export declare const CONTENT_TREE_HINT_THRESHOLD = 50;
|
|
4
|
+
export declare const CONTENT_LIST_EDITOR_ID = "com.kardalum.contentlist";
|
|
5
|
+
export declare const FILE_UPLOAD_EDITOR_ID = "com.kardalum.fileupload";
|
|
6
|
+
export declare const VALUELESS_EDITOR_IDS: ReadonlySet<string>;
|
|
7
|
+
export declare const FileUploadSettingsSchema: z.ZodObject<{
|
|
8
|
+
extensions: z.ZodArray<z.ZodString>;
|
|
9
|
+
maxSizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type FileUploadSettings = z.infer<typeof FileUploadSettingsSchema>;
|
|
12
|
+
export declare const CONTENT_LIST_PROPERTIES: readonly ["name", "id", "url", "status", "updatedAt", "publishedAt"];
|
|
13
|
+
export declare const ContentListColumnSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
|
+
kind: z.ZodLiteral<"property">;
|
|
15
|
+
property: z.ZodEnum<{
|
|
16
|
+
url: "url";
|
|
17
|
+
id: "id";
|
|
18
|
+
name: "name";
|
|
19
|
+
updatedAt: "updatedAt";
|
|
20
|
+
publishedAt: "publishedAt";
|
|
21
|
+
status: "status";
|
|
22
|
+
}>;
|
|
23
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
24
|
+
kind: z.ZodLiteral<"field">;
|
|
25
|
+
fieldId: z.ZodString;
|
|
26
|
+
label: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>], "kind">;
|
|
28
|
+
export type ContentListColumn = z.infer<typeof ContentListColumnSchema>;
|
|
29
|
+
export declare const ContentListSettingsSchema: z.ZodObject<{
|
|
30
|
+
columns: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
31
|
+
kind: z.ZodLiteral<"property">;
|
|
32
|
+
property: z.ZodEnum<{
|
|
33
|
+
url: "url";
|
|
34
|
+
id: "id";
|
|
35
|
+
name: "name";
|
|
36
|
+
updatedAt: "updatedAt";
|
|
37
|
+
publishedAt: "publishedAt";
|
|
38
|
+
status: "status";
|
|
39
|
+
}>;
|
|
40
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<"field">;
|
|
42
|
+
fieldId: z.ZodString;
|
|
43
|
+
label: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strict>], "kind">>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
export type ContentListSettings = z.infer<typeof ContentListSettingsSchema>;
|
|
47
|
+
export declare const CONTENT_LIST_DEFAULT_SETTINGS: ContentListSettings;
|
|
48
|
+
export declare const ContentListQuerySchema: z.ZodObject<{
|
|
49
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
50
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
51
|
+
name: z.ZodOptional<z.ZodString>;
|
|
52
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type ContentListQuery = z.infer<typeof ContentListQuerySchema>;
|
|
55
|
+
export declare const ContentListRowSchema: z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
url: z.ZodNullable<z.ZodString>;
|
|
59
|
+
status: z.ZodEnum<{
|
|
60
|
+
changes: "changes";
|
|
61
|
+
published: "published";
|
|
62
|
+
draft: "draft";
|
|
63
|
+
}>;
|
|
64
|
+
updatedAt: z.ZodString;
|
|
65
|
+
publishedAt: z.ZodNullable<z.ZodString>;
|
|
66
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
67
|
+
access: z.ZodObject<{
|
|
68
|
+
read: z.ZodBoolean;
|
|
69
|
+
create: z.ZodBoolean;
|
|
70
|
+
update: z.ZodBoolean;
|
|
71
|
+
publish: z.ZodBoolean;
|
|
72
|
+
delete: z.ZodBoolean;
|
|
73
|
+
denied: z.ZodRecord<z.ZodEnum<{
|
|
74
|
+
"content.read": "content.read";
|
|
75
|
+
"content.create": "content.create";
|
|
76
|
+
"content.update": "content.update";
|
|
77
|
+
"content.publish": "content.publish";
|
|
78
|
+
"content.delete": "content.delete";
|
|
79
|
+
}> & z.core.$partial, z.ZodObject<{
|
|
80
|
+
reason: z.ZodEnum<{
|
|
81
|
+
"role-lacks-action": "role-lacks-action";
|
|
82
|
+
"not-granted": "not-granted";
|
|
83
|
+
}>;
|
|
84
|
+
decidedAt: z.ZodNullable<z.ZodObject<{
|
|
85
|
+
nodeId: z.ZodString;
|
|
86
|
+
path: z.ZodNullable<z.ZodString>;
|
|
87
|
+
name: z.ZodNullable<z.ZodString>;
|
|
88
|
+
mode: z.ZodEnum<{
|
|
89
|
+
restricted: "restricted";
|
|
90
|
+
open: "open";
|
|
91
|
+
}>;
|
|
92
|
+
grants: z.ZodArray<z.ZodObject<{
|
|
93
|
+
subjectKind: z.ZodEnum<{
|
|
94
|
+
role: "role";
|
|
95
|
+
user: "user";
|
|
96
|
+
}>;
|
|
97
|
+
subjectId: z.ZodString;
|
|
98
|
+
label: z.ZodNullable<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
export type ContentListRow = z.infer<typeof ContentListRowSchema>;
|
|
105
|
+
export declare const ContentListResponseSchema: z.ZodObject<{
|
|
106
|
+
items: z.ZodArray<z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
name: z.ZodString;
|
|
109
|
+
url: z.ZodNullable<z.ZodString>;
|
|
110
|
+
status: z.ZodEnum<{
|
|
111
|
+
changes: "changes";
|
|
112
|
+
published: "published";
|
|
113
|
+
draft: "draft";
|
|
114
|
+
}>;
|
|
115
|
+
updatedAt: z.ZodString;
|
|
116
|
+
publishedAt: z.ZodNullable<z.ZodString>;
|
|
117
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
118
|
+
access: z.ZodObject<{
|
|
119
|
+
read: z.ZodBoolean;
|
|
120
|
+
create: z.ZodBoolean;
|
|
121
|
+
update: z.ZodBoolean;
|
|
122
|
+
publish: z.ZodBoolean;
|
|
123
|
+
delete: z.ZodBoolean;
|
|
124
|
+
denied: z.ZodRecord<z.ZodEnum<{
|
|
125
|
+
"content.read": "content.read";
|
|
126
|
+
"content.create": "content.create";
|
|
127
|
+
"content.update": "content.update";
|
|
128
|
+
"content.publish": "content.publish";
|
|
129
|
+
"content.delete": "content.delete";
|
|
130
|
+
}> & z.core.$partial, z.ZodObject<{
|
|
131
|
+
reason: z.ZodEnum<{
|
|
132
|
+
"role-lacks-action": "role-lacks-action";
|
|
133
|
+
"not-granted": "not-granted";
|
|
134
|
+
}>;
|
|
135
|
+
decidedAt: z.ZodNullable<z.ZodObject<{
|
|
136
|
+
nodeId: z.ZodString;
|
|
137
|
+
path: z.ZodNullable<z.ZodString>;
|
|
138
|
+
name: z.ZodNullable<z.ZodString>;
|
|
139
|
+
mode: z.ZodEnum<{
|
|
140
|
+
restricted: "restricted";
|
|
141
|
+
open: "open";
|
|
142
|
+
}>;
|
|
143
|
+
grants: z.ZodArray<z.ZodObject<{
|
|
144
|
+
subjectKind: z.ZodEnum<{
|
|
145
|
+
role: "role";
|
|
146
|
+
user: "user";
|
|
147
|
+
}>;
|
|
148
|
+
subjectId: z.ZodString;
|
|
149
|
+
label: z.ZodNullable<z.ZodString>;
|
|
150
|
+
}, z.core.$strip>>;
|
|
151
|
+
}, z.core.$strip>>;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
}, z.core.$strip>>;
|
|
155
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
export type ContentListResponse = z.infer<typeof ContentListResponseSchema>;
|
|
158
|
+
export declare const CONTENT_LIST_DATA_TYPE_CONFIG: DataTypeConfig;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { THUMBNAIL_EDITOR_ID } from "./media-rendition.schema.js";
|
|
3
|
+
import { NodeAccessFlagsSchema } from "./node-access.schema.js";
|
|
4
|
+
// S232: past this many children, the tree stops rendering them as
|
|
5
|
+
// expandable rows and shows a hint to mark the type as a collection
|
|
6
|
+
// instead (see contentTree.collectionHint in the admin). Shared between
|
|
7
|
+
// the tree's hint logic and the adapter's count query so both agree on
|
|
8
|
+
// where "too many for a tree" starts.
|
|
9
|
+
export const CONTENT_TREE_HINT_THRESHOLD = 50;
|
|
10
|
+
// The registry editor id for the Content List SDK view (Task 4), the same
|
|
11
|
+
// shape as 'com.kardalum.text' etc. Referenced by CONTENT_LIST_DATA_TYPE_CONFIG
|
|
12
|
+
// below and by the editor registration itself.
|
|
13
|
+
export const CONTENT_LIST_EDITOR_ID = "com.kardalum.contentlist";
|
|
14
|
+
// S234a: the registry editor id for the file upload data type, the input
|
|
15
|
+
// control a media document type's fields use to accept an uploaded file.
|
|
16
|
+
// Named beside CONTENT_LIST_EDITOR_ID: this file is where a built-in
|
|
17
|
+
// editor's id constant lives once something besides the editor
|
|
18
|
+
// registration itself needs to reference it (here, the two seeded "Image
|
|
19
|
+
// file" / "Any file" data type configs in media.schema.ts).
|
|
20
|
+
export const FILE_UPLOAD_EDITOR_ID = "com.kardalum.fileupload";
|
|
21
|
+
// S234a final fix wave: editors whose field stores NO value of its own, so
|
|
22
|
+
// no writer ever puts their field's key into a saved item and no rule ever
|
|
23
|
+
// judges one. A fact about the editor id, not about whether a validator
|
|
24
|
+
// happens to be registered for it, which is why it is a literal set rather
|
|
25
|
+
// than something read off the plugin registry.
|
|
26
|
+
//
|
|
27
|
+
// It lives here, beside the two ids, because BOTH sides of the product
|
|
28
|
+
// need the same answer and they are different services: ContentService
|
|
29
|
+
// (content nodes, adapter-owned) and MediaService (media items,
|
|
30
|
+
// Prisma-owned). They disagreed until now. ContentService tested
|
|
31
|
+
// CONTENT_LIST_EDITOR_ID alone, but the data type list is global, so a
|
|
32
|
+
// webmaster can put an "Any file" field on a page type, and `required` can
|
|
33
|
+
// be set on it through the API even though the builder hides the checkbox.
|
|
34
|
+
// Since that editor's isEmpty always answers true, such a page became
|
|
35
|
+
// permanently unsavable: the rule "required never binds on a field that
|
|
36
|
+
// stores nothing" was enforced in one place and reachable from another.
|
|
37
|
+
// Piece C adds ONE more, not the two this comment used to predict. A
|
|
38
|
+
// thumbnail is automatic and stores nothing, so it belongs here. A CROP
|
|
39
|
+
// does store a value, the rectangle it last cut, so `required` binds on it
|
|
40
|
+
// perfectly well and means "you must cut this one": it is deliberately
|
|
41
|
+
// absent. That is the whole reason this is one exported set rather than a
|
|
42
|
+
// condition repeated per service.
|
|
43
|
+
export const VALUELESS_EDITOR_IDS = new Set([
|
|
44
|
+
CONTENT_LIST_EDITOR_ID,
|
|
45
|
+
FILE_UPLOAD_EDITOR_ID,
|
|
46
|
+
THUMBNAIL_EDITOR_ID,
|
|
47
|
+
]);
|
|
48
|
+
// S234a: which files this upload accepts, as bare lowercase extensions
|
|
49
|
+
// without dots ("jpg", not ".jpg" or "image/jpeg"), because that is what
|
|
50
|
+
// the router compares against a filename. An empty list accepts anything,
|
|
51
|
+
// which is what the built-in File type uses.
|
|
52
|
+
export const FileUploadSettingsSchema = z.object({
|
|
53
|
+
extensions: z.array(z.string().regex(/^[a-z0-9]+$/, "Use a bare extension such as jpg, with no dot.")),
|
|
54
|
+
maxSizeBytes: z.number().int().positive().optional(),
|
|
55
|
+
});
|
|
56
|
+
// The built-in row properties a column can show, as opposed to a
|
|
57
|
+
// document-type field. Kept as a fixed list (not "any ContentNode key")
|
|
58
|
+
// so the query and the column picker only ever offer values the list
|
|
59
|
+
// route actually knows how to project.
|
|
60
|
+
export const CONTENT_LIST_PROPERTIES = ["name", "id", "url", "status", "updatedAt", "publishedAt"];
|
|
61
|
+
// A column is either a built-in property or a document-type field,
|
|
62
|
+
// discriminated so a 'field' column never carries a stray `property` key
|
|
63
|
+
// or vice versa (.strict() on both branches, same reasoning as
|
|
64
|
+
// DocumentTypeDefinitionSchema's page/element split).
|
|
65
|
+
export const ContentListColumnSchema = z.discriminatedUnion("kind", [
|
|
66
|
+
z.object({ kind: z.literal("property"), property: z.enum(CONTENT_LIST_PROPERTIES) }).strict(),
|
|
67
|
+
// fieldId references a FieldDefinition.id on the collection's child
|
|
68
|
+
// document type(s), not cross-validated here (same non-goal as
|
|
69
|
+
// FieldDefinition.datatypeId). label overrides the field's own name for
|
|
70
|
+
// the column header, e.g. when two fields share a name across types.
|
|
71
|
+
z.object({ kind: z.literal("field"), fieldId: z.string().min(1), label: z.string().min(1).optional() }).strict(),
|
|
72
|
+
]);
|
|
73
|
+
// The Content List data type's `settings`: which columns to show, and in
|
|
74
|
+
// what order. `columns` may not be empty, an editor with nothing to show
|
|
75
|
+
// is a misconfiguration, not a valid empty state.
|
|
76
|
+
export const ContentListSettingsSchema = z.object({ columns: z.array(ContentListColumnSchema).min(1) }).strict();
|
|
77
|
+
// What a newly-added Content List field starts with: name, id and url,
|
|
78
|
+
// the three columns every collection has regardless of its children's
|
|
79
|
+
// document type.
|
|
80
|
+
export const CONTENT_LIST_DEFAULT_SETTINGS = {
|
|
81
|
+
columns: [
|
|
82
|
+
{ kind: "property", property: "name" },
|
|
83
|
+
{ kind: "property", property: "id" },
|
|
84
|
+
{ kind: "property", property: "url" },
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
// GET /api/content/:id/list query (Task 3). Cursor-paginated like every
|
|
88
|
+
// other content list (api-design.md), plus a name filter and a
|
|
89
|
+
// comma-separated set of field ids so the response only carries the data
|
|
90
|
+
// the configured columns actually need.
|
|
91
|
+
export const ContentListQuerySchema = z.object({
|
|
92
|
+
cursor: z.string().uuid().optional(),
|
|
93
|
+
limit: z.coerce.number().int().min(1).max(50).default(25),
|
|
94
|
+
name: z.string().max(200).optional(),
|
|
95
|
+
// Comma-separated field ids (not z.array: this is a query string param).
|
|
96
|
+
// Parsed by the route, not here, the same split as ContentByPathQuery
|
|
97
|
+
// taking a raw path string.
|
|
98
|
+
fields: z.string().max(2000).optional(),
|
|
99
|
+
});
|
|
100
|
+
// One row of the list. `fields` carries only the requested field ids
|
|
101
|
+
// (ContentListQuery.fields), not the whole document, keeping the response
|
|
102
|
+
// bounded by what the configured columns need rather than the full
|
|
103
|
+
// ContentVersion payload.
|
|
104
|
+
export const ContentListRowSchema = z.object({
|
|
105
|
+
id: z.string().uuid(),
|
|
106
|
+
name: z.string(),
|
|
107
|
+
// S277e: null when no link to the row's page can be made from the
|
|
108
|
+
// domain the list was asked on.
|
|
109
|
+
url: z.string().nullable(),
|
|
110
|
+
status: z.enum(["draft", "published", "changes"]),
|
|
111
|
+
updatedAt: z.string().datetime(),
|
|
112
|
+
publishedAt: z.string().datetime().nullable(),
|
|
113
|
+
fields: z.record(z.string(), z.unknown()),
|
|
114
|
+
// What the signed-in person may do on this node (S276). A row whose read is
|
|
115
|
+
// false has empty `fields`; its name, url and status stay.
|
|
116
|
+
access: NodeAccessFlagsSchema,
|
|
117
|
+
});
|
|
118
|
+
export const ContentListResponseSchema = z.object({
|
|
119
|
+
items: z.array(ContentListRowSchema),
|
|
120
|
+
// null = no more pages.
|
|
121
|
+
nextCursor: z.string().uuid().nullable(),
|
|
122
|
+
});
|
|
123
|
+
// The Content List data type's own seed row (Task 2 migration 0021). NOT
|
|
124
|
+
// added to BUILT_IN_DATA_TYPE_CONFIGS: that array is inserted at migration
|
|
125
|
+
// 0006 time, so a new entry there would only reach fresh installs.
|
|
126
|
+
// Migration 0021 inserts this row directly, on every install that is
|
|
127
|
+
// missing it, existing and fresh alike.
|
|
128
|
+
//
|
|
129
|
+
// Unlike the six 0006 seeds, this row stores REAL settings rather than
|
|
130
|
+
// `{}`: ContentListSettingsSchema requires a non-empty `columns`, and the
|
|
131
|
+
// server validates a built-in editor's settings on every save
|
|
132
|
+
// (validate-data-type-settings.ts), so an empty object here would be a row
|
|
133
|
+
// that cannot be saved back unchanged.
|
|
134
|
+
export const CONTENT_LIST_DATA_TYPE_CONFIG = {
|
|
135
|
+
id: "b1e00000-0000-4000-8000-000000000007",
|
|
136
|
+
name: "Content List",
|
|
137
|
+
editorId: CONTENT_LIST_EDITOR_ID,
|
|
138
|
+
settings: CONTENT_LIST_DEFAULT_SETTINGS,
|
|
139
|
+
};
|