@kardalum/plugin-sdk 0.0.0-stage → 0.16.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 +118 -0
- package/LICENSE +202 -0
- package/README.md +80 -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 +29 -0
- package/dist/capabilities.js +67 -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 +94 -0
- package/dist/license-verdict-keys.d.ts +18 -0
- package/dist/license-verdict-keys.js +26 -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 +476 -0
- package/dist/manifest-schema.js +823 -0
- package/dist/manifest.d.ts +611 -0
- package/dist/manifest.js +86 -0
- package/dist/media/media-picker.d.ts +39 -0
- package/dist/media/media-picker.js +447 -0
- package/dist/media/upload-error.d.ts +12 -0
- package/dist/media/upload-error.js +30 -0
- package/dist/plugin-context.d.ts +82 -0
- package/dist/plugin-context.js +77 -0
- package/dist/plugin-screen-context.d.ts +71 -0
- package/dist/plugin-screen-context.js +41 -0
- package/dist/read-all-pages.d.ts +23 -0
- package/dist/read-all-pages.js +30 -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 +372 -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 +17 -0
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +25 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +93 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +88 -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 +542 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +357 -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 +260 -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 +152 -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 +352 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +133 -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 +37 -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 +298 -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 +113 -0
- package/node_modules/@kardalum/api-schemas/dist/index.js +64 -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/management-multipart.schema.d.ts +73 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +682 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +269 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +177 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +222 -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 +249 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +84 -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 +172 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +196 -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-install-record.schema.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +585 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +536 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +391 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +413 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +29 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +100 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +162 -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 +314 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +338 -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 +96 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +75 -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/sample-content.schema.d.ts +35 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +79 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +138 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +105 -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 +47 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +27 -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 +97 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +73 -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/build-reference.d.ts +111 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +61 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +351 -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 +13 -0
- package/node_modules/@kardalum/plugin-package/dist/index.js +8 -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/reference-entry.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +6 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +20 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +57 -0
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +43 -0
- package/node_modules/@kardalum/plugin-package/dist/types.js +15 -0
- package/node_modules/@kardalum/plugin-package/package.json +54 -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 +89 -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,56 @@
|
|
|
1
|
+
# @kardalum/api-schemas
|
|
2
|
+
|
|
3
|
+
The [Kardalum CMS](https://kardalum.com) request/response shapes, as Zod
|
|
4
|
+
schemas. This is the single source of truth every other package and the
|
|
5
|
+
server itself derive types, runtime validation, and API documentation
|
|
6
|
+
from: nothing in Kardalum hand-writes a duplicate of a shape defined here.
|
|
7
|
+
|
|
8
|
+
This is an internal package. It is private, never published on its own
|
|
9
|
+
and never installed on its own: it ships inside `@kardalum/server`, `@kardalum/plugin-sdk`, `@kardalum/client` and the `kardalum` CLI, which bundle it.
|
|
10
|
+
|
|
11
|
+
## Who this is for
|
|
12
|
+
|
|
13
|
+
Most people building a Kardalum site never import this package directly:
|
|
14
|
+
`@kardalum/client` already re-exports the types you need for reading
|
|
15
|
+
and writing content. Reach for `api-schemas` yourself if you're working
|
|
16
|
+
below that layer: writing a plugin that needs a `ContentNode` or
|
|
17
|
+
`DocumentTypeDefinition` type, validating a payload against the exact
|
|
18
|
+
schema the server enforces, or building tooling against the public API
|
|
19
|
+
that wants compile-time shapes instead of `any`.
|
|
20
|
+
|
|
21
|
+
## What's in it
|
|
22
|
+
|
|
23
|
+
Zod schemas (and their inferred types) for the content tree, document
|
|
24
|
+
types, content versions, templates, media, snapshots, and every request/
|
|
25
|
+
response body the admin API and the public `/api/v1` REST API use, plus
|
|
26
|
+
small shared helpers like `joinContentPath` and `isReservedRootSlug`.
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { ContentNodeSchema, type ContentNode } from "@kardalum/api-schemas";
|
|
30
|
+
|
|
31
|
+
// Validate a payload the same way the server does.
|
|
32
|
+
const node: ContentNode = ContentNodeSchema.parse(someJson);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import type { PublicContentItem } from "@kardalum/api-schemas";
|
|
37
|
+
|
|
38
|
+
// Type a fetch() call against the public API without hand-rolling the shape.
|
|
39
|
+
const res = await fetch("https://your-site.com/api/v1/content/abc123");
|
|
40
|
+
const body: PublicContentItem = await res.json();
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Relationship to the rest of Kardalum
|
|
44
|
+
|
|
45
|
+
`@kardalum/server` validates every route against these schemas via
|
|
46
|
+
`fastify-type-provider-zod`; `@kardalum/content-service` and
|
|
47
|
+
`@kardalum/db-adapter` use the same types for the content model they
|
|
48
|
+
implement; the admin UI and `@kardalum/plugin-sdk` import them for
|
|
49
|
+
TypeScript types. If you're only consuming a running site, prefer
|
|
50
|
+
`@kardalum/client`: it's built on top of this package and gives you
|
|
51
|
+
request-making methods, not just types.
|
|
52
|
+
|
|
53
|
+
## Source & support
|
|
54
|
+
|
|
55
|
+
Source: [kardalum-starter](https://github.com/kardalum/kardalum-starter).
|
|
56
|
+
Docs: https://docs.kardalum.com. Apache-2.0.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ACTION_SEGMENT_MIN = 2;
|
|
3
|
+
export declare const ACTION_SEGMENT_MAX = 6;
|
|
4
|
+
/** MySQL stores an action id as VARCHAR(191); a longer id would fail to
|
|
5
|
+
* insert on that dialect only, so the cap is enforced where every
|
|
6
|
+
* dialect sees it (S272 handoff). */
|
|
7
|
+
export declare const ACTION_MAX_LENGTH = 191;
|
|
8
|
+
export declare const ActionStringSchema: z.ZodString;
|
|
9
|
+
export type ActionString = z.infer<typeof ActionStringSchema>;
|
|
10
|
+
/**
|
|
11
|
+
* Whether `action` belongs to the plugin with `pluginId`.
|
|
12
|
+
*
|
|
13
|
+
* A plugin's actions are stored under its FULL reverse-domain id, so
|
|
14
|
+
* commerce's refund action is "com.kardalum.commerce.orders.refund" rather
|
|
15
|
+
* than the charter's display form "commerce.orders.refund". The short form
|
|
16
|
+
* collides: com.kardalum.commerce and com.acme.commerce would both claim
|
|
17
|
+
* "commerce.*", and resolving that needs either a registry negotiation at
|
|
18
|
+
* install or a first-come-wins rule that makes a plugin's permissions
|
|
19
|
+
* depend on install order. Nothing ever shows an operator a raw action
|
|
20
|
+
* string, so the cost is confined to storage and code.
|
|
21
|
+
*
|
|
22
|
+
* The segment boundary is load-bearing: without it "com.kardalum.commerce2"
|
|
23
|
+
* would match the prefix of "com.kardalum.commerce" and inherit its
|
|
24
|
+
* permissions.
|
|
25
|
+
*
|
|
26
|
+
* Assumes `action` has already passed ActionStringSchema: this answers
|
|
27
|
+
* only the ownership question, not the shape question, so a caller that
|
|
28
|
+
* skips validation can get true for a malformed string.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isPluginActionFor(action: string, pluginId: string): boolean;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// A permission action: a named string a role grants and a gate requires.
|
|
3
|
+
// S270 (theme G1). The shape is enforced; the vocabulary is not.
|
|
4
|
+
//
|
|
5
|
+
// FLAT BY DECISION, not by omission. The dot groups actions in the role
|
|
6
|
+
// editor's UI and means NOTHING to the permission check, which is set
|
|
7
|
+
// membership on exact strings. A role storing "content.*" was rejected in
|
|
8
|
+
// design: a plugin adding content.destroy later would silently widen every
|
|
9
|
+
// role holding the wildcard, and the install screen could then not tell an
|
|
10
|
+
// operator what they are consenting to. The ergonomics come back at
|
|
11
|
+
// authoring time instead, where "select all in this group" expands to
|
|
12
|
+
// explicit strings before the role is saved.
|
|
13
|
+
export const ACTION_SEGMENT_MIN = 2;
|
|
14
|
+
// 6, not 5: a plugin's actions are prefixed with its full manifest id, and
|
|
15
|
+
// a manifest id may be up to 4 segments (manifestIdSchema), so an action
|
|
16
|
+
// needs room for the id plus an object plus a verb. The two numbers are a
|
|
17
|
+
// pair: manifestIdSchema caps ids at ACTION_SEGMENT_MAX - 2, so raising or
|
|
18
|
+
// lowering one without the other reintroduces ids that can declare no
|
|
19
|
+
// action at all.
|
|
20
|
+
export const ACTION_SEGMENT_MAX = 6;
|
|
21
|
+
/** MySQL stores an action id as VARCHAR(191); a longer id would fail to
|
|
22
|
+
* insert on that dialect only, so the cap is enforced where every
|
|
23
|
+
* dialect sees it (S272 handoff). */
|
|
24
|
+
export const ACTION_MAX_LENGTH = 191;
|
|
25
|
+
// A segment starts lowercase and continues in ASCII letters, digits or
|
|
26
|
+
// hyphens, so camelCase areas like documentTypes pass while DocumentTypes
|
|
27
|
+
// does not.
|
|
28
|
+
//
|
|
29
|
+
// HYPHENS ARE ALLOWED because plugin ids allow them and a plugin's actions
|
|
30
|
+
// are prefixed with its full id: com.kardalum.google-maps and
|
|
31
|
+
// com.kardalum.reading-time could otherwise declare no action at all. The
|
|
32
|
+
// earlier rule banned them to get one spelling per permission, which it
|
|
33
|
+
// never achieved: camelCase means content.unPublish and content.unpublish
|
|
34
|
+
// are both valid, so case already permitted two spellings of one idea.
|
|
35
|
+
// Core's own actions avoid hyphens by convention rather than by validation.
|
|
36
|
+
// Underscores stay out: nothing in a plugin id can produce one.
|
|
37
|
+
const SEGMENT = /^[a-z][a-zA-Z0-9-]*$/;
|
|
38
|
+
export const ActionStringSchema = z
|
|
39
|
+
.string()
|
|
40
|
+
.superRefine((value, ctx) => {
|
|
41
|
+
if (value.length > ACTION_MAX_LENGTH) {
|
|
42
|
+
ctx.addIssue({
|
|
43
|
+
code: "custom",
|
|
44
|
+
message: `an action is at most ${ACTION_MAX_LENGTH} characters (MySQL stores it as VARCHAR(${ACTION_MAX_LENGTH}))`,
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const segments = value.split(".");
|
|
49
|
+
if (segments.length < ACTION_SEGMENT_MIN || segments.length > ACTION_SEGMENT_MAX) {
|
|
50
|
+
ctx.addIssue({
|
|
51
|
+
code: "custom",
|
|
52
|
+
message: `An action has ${ACTION_SEGMENT_MIN} to ${ACTION_SEGMENT_MAX} dot-separated segments; "${value}" has ${segments.length}. A single segment is a namespace, not an action: the last segment is the verb.`,
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
for (const segment of segments) {
|
|
57
|
+
if (!SEGMENT.test(segment)) {
|
|
58
|
+
ctx.addIssue({
|
|
59
|
+
code: "custom",
|
|
60
|
+
message: `Action segment "${segment}" in "${value}" must start with a lowercase letter and contain only letters, digits and hyphens.`,
|
|
61
|
+
});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* Whether `action` belongs to the plugin with `pluginId`.
|
|
68
|
+
*
|
|
69
|
+
* A plugin's actions are stored under its FULL reverse-domain id, so
|
|
70
|
+
* commerce's refund action is "com.kardalum.commerce.orders.refund" rather
|
|
71
|
+
* than the charter's display form "commerce.orders.refund". The short form
|
|
72
|
+
* collides: com.kardalum.commerce and com.acme.commerce would both claim
|
|
73
|
+
* "commerce.*", and resolving that needs either a registry negotiation at
|
|
74
|
+
* install or a first-come-wins rule that makes a plugin's permissions
|
|
75
|
+
* depend on install order. Nothing ever shows an operator a raw action
|
|
76
|
+
* string, so the cost is confined to storage and code.
|
|
77
|
+
*
|
|
78
|
+
* The segment boundary is load-bearing: without it "com.kardalum.commerce2"
|
|
79
|
+
* would match the prefix of "com.kardalum.commerce" and inherit its
|
|
80
|
+
* permissions.
|
|
81
|
+
*
|
|
82
|
+
* Assumes `action` has already passed ActionStringSchema: this answers
|
|
83
|
+
* only the ownership question, not the shape question, so a caller that
|
|
84
|
+
* skips validation can get true for a malformed string.
|
|
85
|
+
*/
|
|
86
|
+
export function isPluginActionFor(action, pluginId) {
|
|
87
|
+
return action.startsWith(`${pluginId}.`) && action.length > pluginId.length + 1;
|
|
88
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ApiErrorSchema: z.ZodObject<{
|
|
3
|
+
message: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export type ApiError = z.infer<typeof ApiErrorSchema>;
|
|
6
|
+
export declare const BodyTooLargeErrorSchema: z.ZodObject<{
|
|
7
|
+
statusCode: z.ZodLiteral<413>;
|
|
8
|
+
code: z.ZodLiteral<"FST_ERR_CTP_BODY_TOO_LARGE">;
|
|
9
|
+
error: z.ZodString;
|
|
10
|
+
message: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type BodyTooLargeError = z.infer<typeof BodyTooLargeErrorSchema>;
|
|
13
|
+
export declare const RateLimitErrorSchema: z.ZodObject<{
|
|
14
|
+
statusCode: z.ZodLiteral<429>;
|
|
15
|
+
message: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type RateLimitError = z.infer<typeof RateLimitErrorSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// The one error body shape every route uses — auth, content, media. Route
|
|
3
|
+
// handlers vary the status code, never the shape.
|
|
4
|
+
export const ApiErrorSchema = z.object({
|
|
5
|
+
message: z.string(),
|
|
6
|
+
});
|
|
7
|
+
// S297: the two answers the host gives every plugin route besides its own
|
|
8
|
+
// error shape, documented in the plugin operations
|
|
9
|
+
// (apps/server/src/docs/plugin-routes-openapi.ts) and never part of the
|
|
10
|
+
// dispatch routes' response map, so the real bodies are not rewritten.
|
|
11
|
+
// Both match what the server sends: the 413 is Fastify's own error body for a
|
|
12
|
+
// request past bodyLimit, the 429 is the rate limiter's errorResponseBuilder
|
|
13
|
+
// return (auth/rate-limit.ts), which carries no `error` field. The
|
|
14
|
+
// integration cases that provoke each status parse the real body with these.
|
|
15
|
+
export const BodyTooLargeErrorSchema = z.object({
|
|
16
|
+
statusCode: z.literal(413),
|
|
17
|
+
code: z.literal("FST_ERR_CTP_BODY_TOO_LARGE"),
|
|
18
|
+
// Node's STATUS_CODES text for 413, which the Node version owns.
|
|
19
|
+
error: z.string(),
|
|
20
|
+
message: z.string(),
|
|
21
|
+
});
|
|
22
|
+
export const RateLimitErrorSchema = z.object({
|
|
23
|
+
statusCode: z.literal(429),
|
|
24
|
+
message: z.string(),
|
|
25
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ApiKeySummarySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
actions: z.ZodArray<z.ZodString>;
|
|
6
|
+
createdAt: z.ZodString;
|
|
7
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
8
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
9
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
10
|
+
createdById: z.ZodNullable<z.ZodString>;
|
|
11
|
+
createdByName: z.ZodNullable<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type ApiKeySummary = z.infer<typeof ApiKeySummarySchema>;
|
|
14
|
+
export declare const ApiKeyListQuerySchema: z.ZodObject<{
|
|
15
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
16
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type ApiKeyListQuery = z.infer<typeof ApiKeyListQuerySchema>;
|
|
19
|
+
export declare const ApiKeyListResponseSchema: z.ZodObject<{
|
|
20
|
+
items: z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
actions: z.ZodArray<z.ZodString>;
|
|
24
|
+
createdAt: z.ZodString;
|
|
25
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
26
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
27
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
28
|
+
createdById: z.ZodNullable<z.ZodString>;
|
|
29
|
+
createdByName: z.ZodNullable<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type ApiKeyListResponse = z.infer<typeof ApiKeyListResponseSchema>;
|
|
34
|
+
/** The most actions one key may be created with: more than the vocabulary plus any plugin will hold. */
|
|
35
|
+
export declare const API_KEY_MAX_ACTIONS = 500;
|
|
36
|
+
export declare const CreateApiKeyRequestSchema: z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
actions: z.ZodArray<z.ZodString>;
|
|
39
|
+
expiresAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type CreateApiKeyRequest = z.infer<typeof CreateApiKeyRequestSchema>;
|
|
42
|
+
export declare const CreateApiKeyResponseSchema: z.ZodObject<{
|
|
43
|
+
apiKey: z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
actions: z.ZodArray<z.ZodString>;
|
|
47
|
+
createdAt: z.ZodString;
|
|
48
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
49
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
50
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
51
|
+
createdById: z.ZodNullable<z.ZodString>;
|
|
52
|
+
createdByName: z.ZodNullable<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
secret: z.ZodString;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type CreateApiKeyResponse = z.infer<typeof CreateApiKeyResponseSchema>;
|
|
57
|
+
export declare const ApiKeyRefusalSchema: z.ZodObject<{
|
|
58
|
+
message: z.ZodString;
|
|
59
|
+
action: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
export type ApiKeyRefusal = z.infer<typeof ApiKeyRefusalSchema>;
|
|
62
|
+
export declare const ApiKeyCreateForbiddenSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
63
|
+
message: z.ZodString;
|
|
64
|
+
action: z.ZodString;
|
|
65
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
+
message: z.ZodString;
|
|
67
|
+
}, z.core.$strip>]>;
|
|
68
|
+
export declare const RevokeApiKeyResponseSchema: z.ZodObject<{
|
|
69
|
+
apiKey: z.ZodObject<{
|
|
70
|
+
id: z.ZodString;
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
actions: z.ZodArray<z.ZodString>;
|
|
73
|
+
createdAt: z.ZodString;
|
|
74
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
75
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
76
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
77
|
+
createdById: z.ZodNullable<z.ZodString>;
|
|
78
|
+
createdByName: z.ZodNullable<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export type RevokeApiKeyResponse = z.infer<typeof RevokeApiKeyResponseSchema>;
|
|
82
|
+
export declare const API_KEY_PRESETS: readonly [{
|
|
83
|
+
readonly id: "read";
|
|
84
|
+
readonly actions: readonly ["content.read", "media.read", "documentTypes.read", "templates.read", "sites.read"];
|
|
85
|
+
}, {
|
|
86
|
+
readonly id: "readWrite";
|
|
87
|
+
readonly actions: readonly ["content.read", "media.read", "documentTypes.read", "templates.read", "sites.read", "content.create", "content.update", "content.publish", "content.delete", "media.create", "media.update", "media.delete"];
|
|
88
|
+
}];
|
|
89
|
+
export type ApiKeyPresetId = (typeof API_KEY_PRESETS)[number]["id"];
|
|
90
|
+
export declare const ApiKeyParamsSchema: z.ZodObject<{
|
|
91
|
+
id: z.ZodString;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
export type ApiKeyParams = z.infer<typeof ApiKeyParamsSchema>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ActionStringSchema } from "./action.schema.js";
|
|
3
|
+
import { ApiErrorSchema } from "./api-error.schema.js";
|
|
4
|
+
// What key management reads: never the keyHash, never the plaintext.
|
|
5
|
+
export const ApiKeySummarySchema = z.object({
|
|
6
|
+
id: z.string().uuid(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
// The actions the key was created with, sorted. Fixed at creation; a key made
|
|
9
|
+
// before S299 holds none.
|
|
10
|
+
actions: z.array(z.string()),
|
|
11
|
+
createdAt: z.string().datetime(),
|
|
12
|
+
// The moment the key stops working, or null when it never expires.
|
|
13
|
+
expiresAt: z.string().datetime().nullable(),
|
|
14
|
+
lastUsedAt: z.string().datetime().nullable(),
|
|
15
|
+
revokedAt: z.string().datetime().nullable(),
|
|
16
|
+
// Who created it, or null when that user is gone or the key came from the ops script.
|
|
17
|
+
createdById: z.string().uuid().nullable(),
|
|
18
|
+
// The display name of the user `createdById` names, so the list can say who
|
|
19
|
+
// made a key instead of showing an editor a uuid. Nullable rather than
|
|
20
|
+
// optional, because the server always decides: null means there is no name to
|
|
21
|
+
// show, which covers a creator who is gone, a key the ops script made and a
|
|
22
|
+
// creator who never set a name (`User.name` is itself nullable).
|
|
23
|
+
//
|
|
24
|
+
// NAME ONLY, deliberately: never the email and never the role. Those live on
|
|
25
|
+
// GET /api/manage/v1/users, which needs users.read, and holding apiKeys.read does not
|
|
26
|
+
// imply it (the same rule MediaVersionSchema.createdByName follows).
|
|
27
|
+
createdByName: z.string().nullable(),
|
|
28
|
+
});
|
|
29
|
+
export const ApiKeyListQuerySchema = z.object({
|
|
30
|
+
cursor: z.string().uuid().optional(),
|
|
31
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
32
|
+
});
|
|
33
|
+
export const ApiKeyListResponseSchema = z.object({
|
|
34
|
+
items: z.array(ApiKeySummarySchema),
|
|
35
|
+
// null = no more pages.
|
|
36
|
+
nextCursor: z.string().uuid().nullable(),
|
|
37
|
+
});
|
|
38
|
+
/** The most actions one key may be created with: more than the vocabulary plus any plugin will hold. */
|
|
39
|
+
export const API_KEY_MAX_ACTIONS = 500;
|
|
40
|
+
export const CreateApiKeyRequestSchema = z.object({
|
|
41
|
+
name: z.string().min(1).max(100),
|
|
42
|
+
// Chosen once: a key keeps exactly these. At least one, because a key that
|
|
43
|
+
// holds nothing can never be given anything.
|
|
44
|
+
actions: z.array(ActionStringSchema).min(1).max(API_KEY_MAX_ACTIONS),
|
|
45
|
+
// Optional; omitted or null means the key never expires.
|
|
46
|
+
expiresAt: z.string().datetime().nullable().default(null),
|
|
47
|
+
});
|
|
48
|
+
// The only response, anywhere, that ever carries the plaintext secret.
|
|
49
|
+
export const CreateApiKeyResponseSchema = z.object({
|
|
50
|
+
apiKey: ApiKeySummarySchema,
|
|
51
|
+
secret: z.string(),
|
|
52
|
+
});
|
|
53
|
+
// The 403 that creating a key answers when the creator does not hold an action
|
|
54
|
+
// the request names (the subset rule). `action` is the first such action, as its
|
|
55
|
+
// id, so a client can mark that row without reading the sentence. It has the
|
|
56
|
+
// shape of the node refusal (`message` plus `action`, node-access.schema.ts), and
|
|
57
|
+
// the admin's error class already reads `action` off any failed response.
|
|
58
|
+
export const ApiKeyRefusalSchema = ApiErrorSchema.extend({ action: ActionStringSchema });
|
|
59
|
+
// The route's whole 403: the subset refusal, or the gate's plain error (the
|
|
60
|
+
// creator's role no longer holds apiKeys.create). The refusal is listed first so
|
|
61
|
+
// it is the one a body with `action` serialises as (a plain object schema would
|
|
62
|
+
// strip `action`), the order ContentForbiddenSchema uses.
|
|
63
|
+
export const ApiKeyCreateForbiddenSchema = z.union([ApiKeyRefusalSchema, ApiErrorSchema]);
|
|
64
|
+
export const RevokeApiKeyResponseSchema = z.object({
|
|
65
|
+
apiKey: ApiKeySummarySchema,
|
|
66
|
+
});
|
|
67
|
+
// S299: the two starting points the admin's key form offers, and the sets the
|
|
68
|
+
// old scopes reached: "read" was every GET under /api/v1 and GraphQL, "write"
|
|
69
|
+
// added every write route (content create, update, publish, delete; media
|
|
70
|
+
// upload, visibility, delete). Typed against the registered actions, so a
|
|
71
|
+
// mistyped string fails to compile. A preset is a convenience: a key stores the
|
|
72
|
+
// actions it was given, never the preset.
|
|
73
|
+
const READ_ACTIONS = ["content.read", "media.read", "documentTypes.read", "templates.read", "sites.read"];
|
|
74
|
+
const WRITE_ACTIONS = [
|
|
75
|
+
"content.create",
|
|
76
|
+
"content.update",
|
|
77
|
+
"content.publish",
|
|
78
|
+
"content.delete",
|
|
79
|
+
"media.create",
|
|
80
|
+
"media.update",
|
|
81
|
+
"media.delete",
|
|
82
|
+
];
|
|
83
|
+
export const API_KEY_PRESETS = [
|
|
84
|
+
{ id: "read", actions: READ_ACTIONS },
|
|
85
|
+
{ id: "readWrite", actions: [...READ_ACTIONS, ...WRITE_ACTIONS] },
|
|
86
|
+
];
|
|
87
|
+
// S301: the params of POST /api-keys/:id/revoke, moved here from the route file.
|
|
88
|
+
export const ApiKeyParamsSchema = z.object({ id: z.string().uuid() });
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ASSET_TREE_MAX_DEPTH = 8;
|
|
3
|
+
export declare const ASSET_TREE_MAX_ENTRIES = 2000;
|
|
4
|
+
export declare const AssetTreeEntrySchema: z.ZodObject<{
|
|
5
|
+
path: z.ZodString;
|
|
6
|
+
kind: z.ZodEnum<{
|
|
7
|
+
file: "file";
|
|
8
|
+
folder: "folder";
|
|
9
|
+
}>;
|
|
10
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
11
|
+
mtimeMs: z.ZodNullable<z.ZodNumber>;
|
|
12
|
+
binary: z.ZodBoolean;
|
|
13
|
+
registered: z.ZodBoolean;
|
|
14
|
+
pluginId: z.ZodNullable<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type AssetTreeEntry = z.infer<typeof AssetTreeEntrySchema>;
|
|
17
|
+
export declare const AssetTreeResponseSchema: z.ZodObject<{
|
|
18
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
19
|
+
path: z.ZodString;
|
|
20
|
+
kind: z.ZodEnum<{
|
|
21
|
+
file: "file";
|
|
22
|
+
folder: "folder";
|
|
23
|
+
}>;
|
|
24
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
mtimeMs: z.ZodNullable<z.ZodNumber>;
|
|
26
|
+
binary: z.ZodBoolean;
|
|
27
|
+
registered: z.ZodBoolean;
|
|
28
|
+
pluginId: z.ZodNullable<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
truncated: z.ZodBoolean;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type AssetTreeResponse = z.infer<typeof AssetTreeResponseSchema>;
|
|
33
|
+
export declare const AssetContentResponseSchema: z.ZodObject<{
|
|
34
|
+
path: z.ZodString;
|
|
35
|
+
content: z.ZodString;
|
|
36
|
+
size: z.ZodNumber;
|
|
37
|
+
registered: z.ZodBoolean;
|
|
38
|
+
pluginId: z.ZodNullable<z.ZodString>;
|
|
39
|
+
version: z.ZodNullable<z.ZodNumber>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type AssetContentResponse = z.infer<typeof AssetContentResponseSchema>;
|
|
42
|
+
export declare const WriteAssetContentRequestSchema: z.ZodObject<{
|
|
43
|
+
path: z.ZodString;
|
|
44
|
+
content: z.ZodString;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
export type WriteAssetContentRequest = z.infer<typeof WriteAssetContentRequestSchema>;
|
|
47
|
+
export declare const CreateAssetFolderRequestSchema: z.ZodObject<{
|
|
48
|
+
path: z.ZodString;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
export type CreateAssetFolderRequest = z.infer<typeof CreateAssetFolderRequestSchema>;
|
|
51
|
+
export declare const RenameAssetRequestSchema: z.ZodObject<{
|
|
52
|
+
path: z.ZodString;
|
|
53
|
+
newPath: z.ZodString;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
export type RenameAssetRequest = z.infer<typeof RenameAssetRequestSchema>;
|
|
56
|
+
export declare const DeleteAssetQuerySchema: z.ZodObject<{
|
|
57
|
+
path: z.ZodString;
|
|
58
|
+
confirm: z.ZodOptional<z.ZodEnum<{
|
|
59
|
+
true: "true";
|
|
60
|
+
}>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export type DeleteAssetQuery = z.infer<typeof DeleteAssetQuerySchema>;
|
|
63
|
+
export declare const AssetDeleteBlockedResponseSchema: z.ZodObject<{
|
|
64
|
+
requiresConfirmation: z.ZodLiteral<true>;
|
|
65
|
+
path: z.ZodString;
|
|
66
|
+
kind: z.ZodEnum<{
|
|
67
|
+
file: "file";
|
|
68
|
+
folder: "folder";
|
|
69
|
+
}>;
|
|
70
|
+
entryCount: z.ZodNumber;
|
|
71
|
+
registered: z.ZodBoolean;
|
|
72
|
+
message: z.ZodString;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export type AssetDeleteBlockedResponse = z.infer<typeof AssetDeleteBlockedResponseSchema>;
|
|
75
|
+
export declare const ZipExtractReportSchema: z.ZodObject<{
|
|
76
|
+
extracted: z.ZodNumber;
|
|
77
|
+
skipped: z.ZodArray<z.ZodObject<{
|
|
78
|
+
path: z.ZodString;
|
|
79
|
+
reason: z.ZodString;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
targetFolder: z.ZodNullable<z.ZodString>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
export type ZipExtractReport = z.infer<typeof ZipExtractReportSchema>;
|
|
84
|
+
export declare const AssetSyncReportSchema: z.ZodObject<{
|
|
85
|
+
checked: z.ZodNumber;
|
|
86
|
+
updated: z.ZodArray<z.ZodString>;
|
|
87
|
+
healed: z.ZodArray<z.ZodString>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
export type AssetSyncReport = z.infer<typeof AssetSyncReportSchema>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AssetPathSchema, MAX_ASSET_CONTENT_BYTES } from "./asset.schema.js";
|
|
3
|
+
// S192 asset tree browser: caps mirror the content-tree pagination
|
|
4
|
+
// philosophy (never load an unbounded subtree) even though the tree
|
|
5
|
+
// walk itself isn't cursor-paginated — depth/entry caps bound the work.
|
|
6
|
+
export const ASSET_TREE_MAX_DEPTH = 8;
|
|
7
|
+
export const ASSET_TREE_MAX_ENTRIES = 2000;
|
|
8
|
+
export const AssetTreeEntrySchema = z.object({
|
|
9
|
+
path: AssetPathSchema,
|
|
10
|
+
kind: z.enum(["file", "folder"]),
|
|
11
|
+
size: z.number().int().min(0).nullable(),
|
|
12
|
+
mtimeMs: z.number().nullable(),
|
|
13
|
+
binary: z.boolean(),
|
|
14
|
+
registered: z.boolean(),
|
|
15
|
+
pluginId: z.string().min(1).nullable(),
|
|
16
|
+
});
|
|
17
|
+
export const AssetTreeResponseSchema = z.object({
|
|
18
|
+
entries: z.array(AssetTreeEntrySchema),
|
|
19
|
+
truncated: z.boolean(),
|
|
20
|
+
});
|
|
21
|
+
export const AssetContentResponseSchema = z.object({
|
|
22
|
+
path: AssetPathSchema,
|
|
23
|
+
content: z.string(),
|
|
24
|
+
size: z.number().int(),
|
|
25
|
+
registered: z.boolean(),
|
|
26
|
+
pluginId: z.string().min(1).nullable(),
|
|
27
|
+
version: z.number().int().min(1).nullable(),
|
|
28
|
+
});
|
|
29
|
+
export const WriteAssetContentRequestSchema = z
|
|
30
|
+
.object({ path: AssetPathSchema, content: z.string().max(MAX_ASSET_CONTENT_BYTES) })
|
|
31
|
+
.strict();
|
|
32
|
+
export const CreateAssetFolderRequestSchema = z.object({ path: AssetPathSchema }).strict();
|
|
33
|
+
export const RenameAssetRequestSchema = z
|
|
34
|
+
.object({ path: AssetPathSchema, newPath: AssetPathSchema })
|
|
35
|
+
.strict();
|
|
36
|
+
// DELETE /api/manage/v1/assets is a two-step confirm gate like content trash and
|
|
37
|
+
// plugin uninstall: confirm is a literal "true" query string (not a
|
|
38
|
+
// boolean) because query params are always strings on the wire.
|
|
39
|
+
export const DeleteAssetQuerySchema = z.object({
|
|
40
|
+
path: AssetPathSchema,
|
|
41
|
+
confirm: z.enum(["true"]).optional(),
|
|
42
|
+
});
|
|
43
|
+
export const AssetDeleteBlockedResponseSchema = z.object({
|
|
44
|
+
requiresConfirmation: z.literal(true),
|
|
45
|
+
path: AssetPathSchema,
|
|
46
|
+
kind: z.enum(["file", "folder"]),
|
|
47
|
+
entryCount: z.number().int().min(0),
|
|
48
|
+
registered: z.boolean(),
|
|
49
|
+
message: z.string(),
|
|
50
|
+
});
|
|
51
|
+
export const ZipExtractReportSchema = z.object({
|
|
52
|
+
extracted: z.number().int().min(0),
|
|
53
|
+
skipped: z.array(z.object({ path: z.string(), reason: z.string() })),
|
|
54
|
+
targetFolder: AssetPathSchema.nullable(),
|
|
55
|
+
});
|
|
56
|
+
export const AssetSyncReportSchema = z.object({
|
|
57
|
+
checked: z.number().int(),
|
|
58
|
+
updated: z.array(z.string()),
|
|
59
|
+
healed: z.array(z.string()),
|
|
60
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AssetPathSchema: z.ZodString;
|
|
3
|
+
export declare const AssetDefinitionSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
path: z.ZodString;
|
|
6
|
+
pluginId: z.ZodNullable<z.ZodString>;
|
|
7
|
+
currentVersion: z.ZodNumber;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type AssetDefinition = z.infer<typeof AssetDefinitionSchema>;
|
|
10
|
+
export declare const MAX_ASSET_CONTENT_BYTES = 5242880;
|
|
11
|
+
export declare const AssetVersionSchema: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
assetId: z.ZodString;
|
|
14
|
+
version: z.ZodNumber;
|
|
15
|
+
content: z.ZodString;
|
|
16
|
+
hash: z.ZodString;
|
|
17
|
+
source: z.ZodEnum<{
|
|
18
|
+
"plugin-install": "plugin-install";
|
|
19
|
+
admin: "admin";
|
|
20
|
+
"file-sync": "file-sync";
|
|
21
|
+
}>;
|
|
22
|
+
createdAt: z.ZodString;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export type AssetVersion = z.infer<typeof AssetVersionSchema>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isReservedRootSlug } from "./reserved-slugs.js";
|
|
3
|
+
import { TemplateVersionSourceSchema } from "./template.schema.js";
|
|
4
|
+
// A registered asset: a text file under public/ whose edits are mirrored
|
|
5
|
+
// into immutable asset_versions rows (S192 spec §5). Unregistered files
|
|
6
|
+
// under public/ are just files — they never get rows here.
|
|
7
|
+
//
|
|
8
|
+
// Path rules: relative, forward slashes, no dot-segments, no leading dot
|
|
9
|
+
// on any segment (no hidden files), and never rooted at any
|
|
10
|
+
// RESERVED_ROOT_SLUGS segment (kardalum, api, docs, plugin-assets, media):
|
|
11
|
+
// the asset tree (walkPublicDir) hides every one of those roots, not just
|
|
12
|
+
// kardalum/, so writing under e.g. media/ or api/ would create an invisible
|
|
13
|
+
// orphan the admin UI can never see or manage again.
|
|
14
|
+
const SEGMENT = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
15
|
+
export const AssetPathSchema = z
|
|
16
|
+
.string()
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(400)
|
|
19
|
+
.refine((p) => !p.includes("\\"), "forward slashes only")
|
|
20
|
+
.refine((p) => p.split("/").every((seg) => SEGMENT.test(seg) && seg !== ".." && seg !== "."), {
|
|
21
|
+
message: "invalid path segment",
|
|
22
|
+
})
|
|
23
|
+
.refine((p) => !isReservedRootSlug(p.split("/")[0] ?? ""), {
|
|
24
|
+
message: "this path root is reserved for the server (see RESERVED_ROOT_SLUGS)",
|
|
25
|
+
});
|
|
26
|
+
export const AssetDefinitionSchema = z
|
|
27
|
+
.object({
|
|
28
|
+
id: z.string().uuid(),
|
|
29
|
+
path: AssetPathSchema,
|
|
30
|
+
pluginId: z.string().min(1).nullable(),
|
|
31
|
+
currentVersion: z.number().int().min(1),
|
|
32
|
+
})
|
|
33
|
+
.strict();
|
|
34
|
+
// 5MB cap: big enough for a vendored bundle someone opens once to patch,
|
|
35
|
+
// while keeping a single version row bounded.
|
|
36
|
+
export const MAX_ASSET_CONTENT_BYTES = 5_242_880;
|
|
37
|
+
export const AssetVersionSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
id: z.string().uuid(),
|
|
40
|
+
assetId: z.string().uuid(),
|
|
41
|
+
version: z.number().int().min(1),
|
|
42
|
+
content: z.string(),
|
|
43
|
+
hash: z.string().length(64),
|
|
44
|
+
source: TemplateVersionSourceSchema,
|
|
45
|
+
createdAt: z.string().min(1),
|
|
46
|
+
})
|
|
47
|
+
.strict();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const LoginRequestSchema: z.ZodObject<{
|
|
3
|
+
email: z.ZodString;
|
|
4
|
+
password: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type LoginRequest = z.infer<typeof LoginRequestSchema>;
|
|
7
|
+
export declare const LoginResponseSchema: z.ZodObject<{
|
|
8
|
+
accessToken: z.ZodString;
|
|
9
|
+
user: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
email: z.ZodString;
|
|
12
|
+
name: z.ZodNullable<z.ZodString>;
|
|
13
|
+
role: z.ZodString;
|
|
14
|
+
roleLabel: z.ZodString;
|
|
15
|
+
actions: z.ZodArray<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type LoginResponse = z.infer<typeof LoginResponseSchema>;
|
|
19
|
+
export declare const RefreshResponseSchema: z.ZodObject<{
|
|
20
|
+
accessToken: z.ZodString;
|
|
21
|
+
user: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
email: z.ZodString;
|
|
24
|
+
name: z.ZodNullable<z.ZodString>;
|
|
25
|
+
role: z.ZodString;
|
|
26
|
+
roleLabel: z.ZodString;
|
|
27
|
+
actions: z.ZodArray<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type RefreshResponse = z.infer<typeof RefreshResponseSchema>;
|
|
31
|
+
export declare const LogoutResponseSchema: z.ZodObject<{
|
|
32
|
+
success: z.ZodLiteral<true>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type LogoutResponse = z.infer<typeof LogoutResponseSchema>;
|
|
35
|
+
export declare const AuthErrorSchema: z.ZodObject<{
|
|
36
|
+
message: z.ZodString;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export type AuthError = z.infer<typeof AuthErrorSchema>;
|