@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,546 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { CreateDocumentTypeRequest, PluginDocsPage } from "@kardalum/api-schemas";
|
|
3
|
+
import type { ThemeTokenOverrides } from "@kardalum/design-tokens";
|
|
4
|
+
import type { ZodType } from "zod";
|
|
5
|
+
import type { DataTypePlugin } from "./data-type-plugin.js";
|
|
6
|
+
import type { BUILT_IN_RAIL_SECTIONS } from "./manifest-schema.js";
|
|
7
|
+
import type { PluginApiRouteContext, PublishedContent, ScopedStructuredStorage } from "./structured-storage-types.js";
|
|
8
|
+
import type { Entitlement, PluginTaskContext } from "./entitlement-types.js";
|
|
9
|
+
/**
|
|
10
|
+
* The seven plugin types. Since S268 this is a marketplace listing and
|
|
11
|
+
* filter label only: it does not decide which contributions a plugin may
|
|
12
|
+
* declare (see PluginContributions below), and it never did decide what a
|
|
13
|
+
* plugin may do at runtime. Plugin backend code runs unsandboxed and
|
|
14
|
+
* in-process, so what a plugin may do is what the derived capability list
|
|
15
|
+
* discloses and what marketplace review checks.
|
|
16
|
+
*/
|
|
17
|
+
export type PluginType = "datatype" | "section" | "template" | "theme" | "integration" | "utility" | "bundle";
|
|
18
|
+
/**
|
|
19
|
+
* Databases a plugin can declare support for. Deliberately NOT
|
|
20
|
+
* db-adapter's DatabaseDialect: that union includes 'mock' (the in-memory
|
|
21
|
+
* test adapter), which no plugin may target — and the SDK is a published
|
|
22
|
+
* package that must not depend on the unpublished adapter internals.
|
|
23
|
+
*/
|
|
24
|
+
export type DatabaseDialect = "postgresql" | "mysql" | "sqlite" | "mssql" | "mongodb";
|
|
25
|
+
/**
|
|
26
|
+
* How the plugin stores data and where it can run. Required on every
|
|
27
|
+
* manifest (plugin-sdk.md) — the marketplace pre-filters by the site's
|
|
28
|
+
* active database and install is blocked with a clear reason, never a
|
|
29
|
+
* silent failure.
|
|
30
|
+
*/
|
|
31
|
+
export interface DatabaseCompatibility {
|
|
32
|
+
/** 'simple' = JSON key-value SimpleStorageAPI (default, ~80% of
|
|
33
|
+
* plugins); 'structured' = relational StructuredStorageAPI. Declaring
|
|
34
|
+
* 'structured' IS the declaration that this plugin owns real tables:
|
|
35
|
+
* it derives the `storage.structured` capability, which triggers
|
|
36
|
+
* manual marketplace review (S267 section 6). There is deliberately no
|
|
37
|
+
* boolean beside it, because a second place to say the same thing is a
|
|
38
|
+
* second place for the manifest to disagree with itself. */
|
|
39
|
+
storageType: "simple" | "structured";
|
|
40
|
+
supported: DatabaseDialect[];
|
|
41
|
+
/** Optional human-readable reason per UNSUPPORTED dialect (shown on the
|
|
42
|
+
* blocked-install screen) — hence Partial: supported dialects carry no
|
|
43
|
+
* reason. */
|
|
44
|
+
unsupportedReason?: Partial<Record<DatabaseDialect, string>>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A claim the author makes about what the plugin's code does at runtime,
|
|
48
|
+
* with the reason they make it.
|
|
49
|
+
*
|
|
50
|
+
* A bare boolean is not something an operator can consent to or a
|
|
51
|
+
* reviewer can check. "Calls the Stripe API to create checkout sessions"
|
|
52
|
+
* is. The install screen shows the reason and the generated reference
|
|
53
|
+
* page prints it, so write a sentence about this plugin, not a restating
|
|
54
|
+
* of the assertion's name.
|
|
55
|
+
*/
|
|
56
|
+
export interface PluginAssertion {
|
|
57
|
+
reason: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The short list of claims nothing in the manifest can verify (S267,
|
|
61
|
+
* section 4.2). Everything else a plugin may do is DERIVED from what it
|
|
62
|
+
* declares in `contributions` and `databaseCompatibility`, so it cannot
|
|
63
|
+
* be claimed falsely or held quietly.
|
|
64
|
+
*
|
|
65
|
+
* These two survive as explicit assertions precisely because no
|
|
66
|
+
* declaration can derive what a plugin's code does at runtime, and they
|
|
67
|
+
* are review triggers for the same reason: they are the only claims in
|
|
68
|
+
* the manifest with nothing behind them.
|
|
69
|
+
*
|
|
70
|
+
* Presence is the claim. There is no `false`: a key that is absent is an
|
|
71
|
+
* assertion not made. The whole field is optional, so a plugin that
|
|
72
|
+
* makes neither claim writes nothing.
|
|
73
|
+
*
|
|
74
|
+
* Disclosure, not enforcement: plugin server code runs unsandboxed and
|
|
75
|
+
* in-process, so an omitted assertion is a promise broken, not an action
|
|
76
|
+
* blocked. Marketplace review is the layer that checks these against the
|
|
77
|
+
* code.
|
|
78
|
+
*/
|
|
79
|
+
export interface PluginAssertions {
|
|
80
|
+
/** The plugin reaches hosts other than this site. */
|
|
81
|
+
externalNetwork?: PluginAssertion;
|
|
82
|
+
/** The plugin reads or writes files outside the storage APIs. */
|
|
83
|
+
filesystemAccess?: PluginAssertion;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The storage surface a plugin migration runs against. Deliberately empty
|
|
87
|
+
* for now: plugins never construct raw SQL (non-negotiable), so this is
|
|
88
|
+
* NOT db-adapter's TransactionContext: Month 6's plugin-storage work
|
|
89
|
+
* fills it in (defineTable etc.). Widening a parameter the plugin
|
|
90
|
+
* receives is backward-compatible for plugin authors.
|
|
91
|
+
*/
|
|
92
|
+
export interface PluginMigrationContext {
|
|
93
|
+
}
|
|
94
|
+
/** A database change applied at plugin install/update time. */
|
|
95
|
+
export interface PluginMigration {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
up: (ctx: PluginMigrationContext) => void | Promise<void>;
|
|
99
|
+
down: (ctx: PluginMigrationContext) => void | Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
/** Result of a plugin's validateMigration hook. */
|
|
102
|
+
export interface PluginMigrationValidation {
|
|
103
|
+
compatible: boolean;
|
|
104
|
+
issues: string[];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Participation in a site-wide dialect migration (e.g. SQLite →
|
|
108
|
+
* PostgreSQL, the v1.x wizard): a plugin with its own stored data can
|
|
109
|
+
* veto, transform rows in flight, and run before/after steps.
|
|
110
|
+
*/
|
|
111
|
+
export interface PluginMigrationHooks {
|
|
112
|
+
beforeMigration?: (from: DatabaseDialect, to: DatabaseDialect) => void | Promise<void>;
|
|
113
|
+
transformRow?: (table: string, row: Record<string, unknown>, from: DatabaseDialect, to: DatabaseDialect) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
114
|
+
afterMigration?: (from: DatabaseDialect, to: DatabaseDialect) => void | Promise<void>;
|
|
115
|
+
validateMigration?: (from: DatabaseDialect, to: DatabaseDialect) => PluginMigrationValidation | Promise<PluginMigrationValidation>;
|
|
116
|
+
}
|
|
117
|
+
/** The events a plugin can hook. The hook engine (S159) actually FIRES
|
|
118
|
+
* only three of these — content:afterPublish (including rollbacks),
|
|
119
|
+
* content:afterTrash, content:afterRestore — with the
|
|
120
|
+
* ContentLifecycleHookPayload shape declared below; every other event in
|
|
121
|
+
* this catalog is declared for forward compatibility and stays inert. */
|
|
122
|
+
export type HookEvent = "content:beforeSave" | "content:afterSave" | "content:beforePublish" | "content:afterPublish" | "content:afterTrash" | "content:afterRestore" | "content:beforeDelete" | "media:afterUpload" | "user:afterLogin" | "api:beforeResponse";
|
|
123
|
+
export interface ContentLifecycleHookPayload {
|
|
124
|
+
event: "content:afterPublish" | "content:afterTrash" | "content:afterRestore";
|
|
125
|
+
contentId: string;
|
|
126
|
+
path: string;
|
|
127
|
+
documentTypeId: string;
|
|
128
|
+
occurredAt: string;
|
|
129
|
+
}
|
|
130
|
+
export interface PluginHookContext {
|
|
131
|
+
structuredStorage: ScopedStructuredStorage;
|
|
132
|
+
getPublishedContent(contentId: string): Promise<PublishedContent | null>;
|
|
133
|
+
/** S284b: the host's latest licence verdict for this plugin
|
|
134
|
+
* (`kind: "verdict"`), `kind: "exempt"` on a non-production install,
|
|
135
|
+
* `kind: "none"` when the host holds no verdict. Check it with
|
|
136
|
+
* `requireEntitlement` from `@kardalum/plugin-sdk/entitlement`; a hook
|
|
137
|
+
* that throws its EntitlementError is skipped with one log line. */
|
|
138
|
+
entitlement: Entitlement;
|
|
139
|
+
}
|
|
140
|
+
export type HookHandler = (payload: unknown, context?: PluginHookContext) => void | Promise<void>;
|
|
141
|
+
export type PluginHooks = Partial<Record<HookEvent, HookHandler>>;
|
|
142
|
+
/** A slot's label: a map of language code to text, `en` required (spec D5).
|
|
143
|
+
* Each key is a language code such as `en`, `de` or `pt-BR`. The admin
|
|
144
|
+
* shows the active language's text, else English; `slotLabel` is the one
|
|
145
|
+
* place that choice is made. */
|
|
146
|
+
export interface SlotLabel {
|
|
147
|
+
en: string;
|
|
148
|
+
[locale: string]: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The text of a slot's label for a locale: the locale as given, else its
|
|
152
|
+
* primary subtag (`de-AT` reads `de`), else `en`, which every label carries.
|
|
153
|
+
* Locale codes compare case-insensitively, since BCP 47 tags are
|
|
154
|
+
* case-insensitive and a label written `pt-BR` must answer `pt-br`.
|
|
155
|
+
*/
|
|
156
|
+
export declare function slotLabel(label: SlotLabel, locale: string): string;
|
|
157
|
+
/** The built-in sections a plugin may add a rail entry to. The plugin
|
|
158
|
+
* management screen is not one: it is the operator's, not a host. */
|
|
159
|
+
export type BuiltInRailSection = (typeof BUILT_IN_RAIL_SECTIONS)[number];
|
|
160
|
+
/** An entry in a rail: inside a plugin section's own rail, or (as
|
|
161
|
+
* BuiltInRailEntryContribution) in a built-in section's rail. `id` is
|
|
162
|
+
* unique within its rail, and is the last segment of its URL, so it is
|
|
163
|
+
* lowercase letters, digits and single hyphens (`refunds`,
|
|
164
|
+
* `order-reports`), at most 64 characters. */
|
|
165
|
+
export interface RailEntryContribution {
|
|
166
|
+
id: string;
|
|
167
|
+
label: SlotLabel;
|
|
168
|
+
/** Optional: a rail entry may be text only. A Lucide name when given. */
|
|
169
|
+
icon?: string;
|
|
170
|
+
/** The named permission action a subject must hold to see this entry and
|
|
171
|
+
* open its URL; a subject without it gets the admin's not-found view
|
|
172
|
+
* (spec D4). Prefixed with this plugin's id and declared in `actions`. */
|
|
173
|
+
action: string;
|
|
174
|
+
view: ComponentType;
|
|
175
|
+
}
|
|
176
|
+
/** A top-level section in the admin's app bar (e.g. Forms). Its `view` is
|
|
177
|
+
* the section's landing page; `rail` lists entries in the section's own
|
|
178
|
+
* rail. `id` is unique within this plugin, and two plugins may use the same
|
|
179
|
+
* one, since a section's URL is namespaced by its plugin's id (spec D3, D8).
|
|
180
|
+
* The id is a segment of that URL, so it is lowercase letters, digits and
|
|
181
|
+
* single hyphens (`orders`, `order-reports`), at most 64 characters. */
|
|
182
|
+
export interface AdminSectionContribution {
|
|
183
|
+
id: string;
|
|
184
|
+
label: SlotLabel;
|
|
185
|
+
icon: string;
|
|
186
|
+
/** The named permission action a subject must hold to reach this
|
|
187
|
+
* (S270, theme G1). Required: a contribution that declares no action
|
|
188
|
+
* would be a gate nobody chose, and omission is how a permission
|
|
189
|
+
* silently loosens. Must be prefixed with this plugin's own id, so one
|
|
190
|
+
* plugin cannot declare an action in another's namespace or in core's. */
|
|
191
|
+
action: string;
|
|
192
|
+
view: ComponentType;
|
|
193
|
+
rail?: RailEntryContribution[];
|
|
194
|
+
}
|
|
195
|
+
/** A rail entry in one of the built-in sections' rails. A plugin cannot
|
|
196
|
+
* take over a built-in section's landing page, only add to its rail
|
|
197
|
+
* (spec D2). */
|
|
198
|
+
export interface BuiltInRailEntryContribution extends RailEntryContribution {
|
|
199
|
+
section: BuiltInRailSection;
|
|
200
|
+
}
|
|
201
|
+
export interface DashboardWidgetContribution {
|
|
202
|
+
id: string;
|
|
203
|
+
name: string;
|
|
204
|
+
view: ComponentType;
|
|
205
|
+
/** The named permission action a subject must hold to reach this
|
|
206
|
+
* (S270, theme G1). Required: a contribution that declares no action
|
|
207
|
+
* would be a gate nobody chose, and omission is how a permission
|
|
208
|
+
* silently loosens. Must be prefixed with this plugin's own id, so one
|
|
209
|
+
* plugin cannot declare an action in another's namespace or in core's. */
|
|
210
|
+
action: string;
|
|
211
|
+
}
|
|
212
|
+
/** Mounted under /api/plugins/:pluginId/… so two plugins can never
|
|
213
|
+
* collide on a path (api-design.md) — the host dispatches to this exact
|
|
214
|
+
* (method, path) pair at request time (Month 8, Session 89: the first
|
|
215
|
+
* real server-side consumer). `handler` stays untyped at the SDK
|
|
216
|
+
* boundary (same cross-boundary erasure as view ComponentType fields)
|
|
217
|
+
* — the host casts to real Fastify types internally, since it always
|
|
218
|
+
* passes real FastifyRequest/FastifyReply instances. */
|
|
219
|
+
export interface ApiRouteContribution {
|
|
220
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
221
|
+
/** Relative to /api/plugins/:pluginId/ — must start with "/". */
|
|
222
|
+
path: string;
|
|
223
|
+
/** Who may call this route.
|
|
224
|
+
* - "admin" (the default when omitted) requires a JWT admin session —
|
|
225
|
+
* for admin-facing plugin UIs like Commerce Orders or the Forms
|
|
226
|
+
* builder.
|
|
227
|
+
* - "apiKey" requires a valid public API key — for credentialed
|
|
228
|
+
* headless callers like a storefront checkout.
|
|
229
|
+
* - "public" requires NO credentials — for genuinely anonymous
|
|
230
|
+
* browser traffic such as a contact-form submission. Session 108
|
|
231
|
+
* deliberately deferred this tier ("a webhook/public level can be
|
|
232
|
+
* added when a real consumer needs it"); Session 160's Forms
|
|
233
|
+
* plugin is that consumer. A public route owns its own abuse
|
|
234
|
+
* controls (honeypot, per-IP bucket, body caps) and only reaches
|
|
235
|
+
* browsers cross-origin when the operator allowlists their origin
|
|
236
|
+
* in KARDALUM_CORS_ORIGINS.
|
|
237
|
+
* Anything unrecognized falls back to "admin" — secure by default. */
|
|
238
|
+
access?: "admin" | "apiKey" | "public";
|
|
239
|
+
/** Optional request-side validation. The handler's response is NOT
|
|
240
|
+
* schema-validated — trusted, same as SimpleStorageAPI's handlers
|
|
241
|
+
* today. */
|
|
242
|
+
schema?: {
|
|
243
|
+
body?: ZodType;
|
|
244
|
+
querystring?: ZodType;
|
|
245
|
+
params?: ZodType;
|
|
246
|
+
};
|
|
247
|
+
/** Third argument added Month 8, Session 90 — the first server-side
|
|
248
|
+
* consumer needing privileged host access. Existing two-argument (or
|
|
249
|
+
* fewer) handlers remain perfectly valid: TypeScript allows a function
|
|
250
|
+
* with fewer declared parameters to satisfy a type expecting more. */
|
|
251
|
+
handler: (request: unknown, reply: unknown, context: PluginApiRouteContext) => unknown;
|
|
252
|
+
/** The named permission action a caller must hold (S270, theme G1).
|
|
253
|
+
* Required when `access` is "admin" or omitted. A "public" route needs
|
|
254
|
+
* no credential, so it needs no action either, and an "apiKey" route is
|
|
255
|
+
* gated by its scope until month 26's S299 moves tokens onto actions.
|
|
256
|
+
* `access` decides WHICH CREDENTIAL reaches the handler; this decides
|
|
257
|
+
* WHAT THAT SUBJECT MAY DO. They are orthogonal. */
|
|
258
|
+
action?: string;
|
|
259
|
+
}
|
|
260
|
+
export interface ScheduledTaskContribution {
|
|
261
|
+
id: string;
|
|
262
|
+
name: string;
|
|
263
|
+
/** Standard 5-field cron expression. */
|
|
264
|
+
cron: string;
|
|
265
|
+
run: (context?: PluginTaskContext) => void | Promise<void>;
|
|
266
|
+
}
|
|
267
|
+
/** Media pipeline processor (thumbnails, optimization). The file/result
|
|
268
|
+
* contract firms up when the BullMQ media pipeline lands. */
|
|
269
|
+
export interface MediaProcessorContribution {
|
|
270
|
+
id: string;
|
|
271
|
+
name: string;
|
|
272
|
+
process: (file: unknown) => unknown | Promise<unknown>;
|
|
273
|
+
}
|
|
274
|
+
export interface SettingsPageContribution {
|
|
275
|
+
id: string;
|
|
276
|
+
name: string;
|
|
277
|
+
view: ComponentType;
|
|
278
|
+
/** The named permission action a subject must hold to reach this
|
|
279
|
+
* (S270, theme G1). Required: a contribution that declares no action
|
|
280
|
+
* would be a gate nobody chose, and omission is how a permission
|
|
281
|
+
* silently loosens. Must be prefixed with this plugin's own id, so one
|
|
282
|
+
* plugin cannot declare an action in another's namespace or in core's. */
|
|
283
|
+
action: string;
|
|
284
|
+
}
|
|
285
|
+
export interface ContentTreeActionContribution {
|
|
286
|
+
id: string;
|
|
287
|
+
label: string;
|
|
288
|
+
onSelect: (nodeId: string) => void | Promise<void>;
|
|
289
|
+
/** The named permission action a subject must hold to reach this
|
|
290
|
+
* (S270, theme G1). Required: a contribution that declares no action
|
|
291
|
+
* would be a gate nobody chose, and omission is how a permission
|
|
292
|
+
* silently loosens. Must be prefixed with this plugin's own id, so one
|
|
293
|
+
* plugin cannot declare an action in another's namespace or in core's. */
|
|
294
|
+
action: string;
|
|
295
|
+
}
|
|
296
|
+
/** A button in the rich-text editor's toolbar. TipTap wiring comes with
|
|
297
|
+
* the first consumer. */
|
|
298
|
+
export interface EditorToolbarContribution {
|
|
299
|
+
id: string;
|
|
300
|
+
label: string;
|
|
301
|
+
icon: string;
|
|
302
|
+
onClick: () => void | Promise<void>;
|
|
303
|
+
/** The named permission action a subject must hold to reach this
|
|
304
|
+
* (S270, theme G1). Required: a contribution that declares no action
|
|
305
|
+
* would be a gate nobody chose, and omission is how a permission
|
|
306
|
+
* silently loosens. Must be prefixed with this plugin's own id, so one
|
|
307
|
+
* plugin cannot declare an action in another's namespace or in core's. */
|
|
308
|
+
action: string;
|
|
309
|
+
}
|
|
310
|
+
/** A service an integration plugin exposes for other plugins to consume
|
|
311
|
+
* (e.g. a Stripe client). Shape intentionally opaque until the
|
|
312
|
+
* cross-plugin service registry exists. */
|
|
313
|
+
export interface ExposedServiceContribution {
|
|
314
|
+
id: string;
|
|
315
|
+
name: string;
|
|
316
|
+
service: unknown;
|
|
317
|
+
}
|
|
318
|
+
/** A ready-made frontend starter shipped alongside a plugin (e.g. the
|
|
319
|
+
* Commerce plugin's "Online Store" Next.js starter) — one marketplace
|
|
320
|
+
* listing, working site immediately. Packaging lands Month 13. */
|
|
321
|
+
export interface BundledTemplateContribution {
|
|
322
|
+
name: string;
|
|
323
|
+
description?: string;
|
|
324
|
+
/** Where the starter's source lives until marketplace packaging exists. */
|
|
325
|
+
repository?: string;
|
|
326
|
+
}
|
|
327
|
+
/** One render template a plugin ships under its own `templates/` dir —
|
|
328
|
+
* per S192 §8 ("a new `templates` contribution — template files declared
|
|
329
|
+
* with alias/kind and, for pages, which contributed document type they
|
|
330
|
+
* render"). Any plugin may declare templates (S268): a `page` kind entry
|
|
331
|
+
* may only name a document type this same manifest declares. */
|
|
332
|
+
export interface TemplateContribution {
|
|
333
|
+
/** Relative path under the plugin's `templates/` directory, forward
|
|
334
|
+
* slashes, ending in `.liquid` — this is the file S192 §5 says the
|
|
335
|
+
* developer edits and the mirror-on-edit versioning tracks. */
|
|
336
|
+
file: string;
|
|
337
|
+
name: string;
|
|
338
|
+
/** The cross-reference key other templates use to `{% layout %}` /
|
|
339
|
+
* `{% render %}` this one (S192 §3/§4). */
|
|
340
|
+
alias: string;
|
|
341
|
+
kind: "page" | "layout" | "partial";
|
|
342
|
+
/** `page` kind only: a NAME from THIS manifest's own `documentTypes`
|
|
343
|
+
* contribution — the document type this page template renders.
|
|
344
|
+
* Optional: a catch-all-ish page template with no specific type is
|
|
345
|
+
* legal (S193 allows a null `documentTypeId`). Forbidden on
|
|
346
|
+
* `layout`/`partial` entries, which never render a document type. */
|
|
347
|
+
documentType?: string;
|
|
348
|
+
}
|
|
349
|
+
export interface SerializerContext {
|
|
350
|
+
/** The public core item, post field-serialization. */
|
|
351
|
+
item: {
|
|
352
|
+
id: string;
|
|
353
|
+
documentTypeId: string;
|
|
354
|
+
locale: string;
|
|
355
|
+
publishedAt: string | null;
|
|
356
|
+
version: number;
|
|
357
|
+
};
|
|
358
|
+
/** SERIALIZED field data — contributions run after core serialization. */
|
|
359
|
+
data: Record<string, unknown>;
|
|
360
|
+
documentType: {
|
|
361
|
+
id: string;
|
|
362
|
+
name: string;
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
export interface CustomFormatContribution {
|
|
366
|
+
/** Plugin-scoped name, /^[a-z0-9-]+$/ — addressed as `<pluginId>:<name>`. */
|
|
367
|
+
name: string;
|
|
368
|
+
build: (context: SerializerContext) => unknown | Promise<unknown>;
|
|
369
|
+
}
|
|
370
|
+
export interface SerializerContribution {
|
|
371
|
+
extendContentResponse?: (context: SerializerContext) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
372
|
+
customFormats?: CustomFormatContribution[];
|
|
373
|
+
}
|
|
374
|
+
export interface PluginContributions {
|
|
375
|
+
/** The Month 3 datatype contract, referenced verbatim: a plugin can
|
|
376
|
+
* ship several field types (id/version on each entry are the
|
|
377
|
+
* datatype's own, distinct from the plugin's). */
|
|
378
|
+
dataTypes?: DataTypePlugin[];
|
|
379
|
+
adminSections?: AdminSectionContribution[];
|
|
380
|
+
/** Rail entries in the built-in sections' rails (S280). */
|
|
381
|
+
railEntries?: BuiltInRailEntryContribution[];
|
|
382
|
+
dashboardWidgets?: DashboardWidgetContribution[];
|
|
383
|
+
apiRoutes?: ApiRouteContribution[];
|
|
384
|
+
hooks?: PluginHooks;
|
|
385
|
+
scheduledTasks?: ScheduledTaskContribution[];
|
|
386
|
+
mediaProcessors?: MediaProcessorContribution[];
|
|
387
|
+
settingsPages?: SettingsPageContribution[];
|
|
388
|
+
contentTreeActions?: ContentTreeActionContribution[];
|
|
389
|
+
editorToolbar?: EditorToolbarContribution[];
|
|
390
|
+
exposedServices?: ExposedServiceContribution[];
|
|
391
|
+
serializers?: SerializerContribution;
|
|
392
|
+
/** Document types the plugin provisions at install: the creation shape
|
|
393
|
+
* (server mints ids), same schema the admin's builder POSTs. */
|
|
394
|
+
documentTypes?: CreateDocumentTypeRequest[];
|
|
395
|
+
/** Tokens only, never components: the same ThemeTokenOverrides shape
|
|
396
|
+
* the built-in Light/Dark themes use (color scales + radius, enforced
|
|
397
|
+
* structurally by @kardalum/design-tokens). */
|
|
398
|
+
themeTokens?: ThemeTokenOverrides;
|
|
399
|
+
/** Render templates the plugin ships (S192 §8). A `page` kind entry may
|
|
400
|
+
* only name a document type this same manifest declares in
|
|
401
|
+
* `documentTypes`, which manifest-schema.ts cross-checks. */
|
|
402
|
+
templates?: TemplateContribution[];
|
|
403
|
+
/** Paths relative to the plugin's public/ directory (e.g.
|
|
404
|
+
* "styles/site.css") that the CMS registers as admin-editable text
|
|
405
|
+
* assets (S192 §5): bare, never "public/"-prefixed (manifest-schema.ts
|
|
406
|
+
* rejects a leading "public/" segment). Shipped files it does not list
|
|
407
|
+
* here stay unregistered: still served and referenceable, just not
|
|
408
|
+
* surfaced in the Assets editor. */
|
|
409
|
+
assets?: string[];
|
|
410
|
+
/** Plugin ids installed together, resolved by the marketplace. */
|
|
411
|
+
bundledPlugins?: string[];
|
|
412
|
+
bundledTemplate?: BundledTemplateContribution;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* The contributions that put code in the browser, and so the ones that
|
|
416
|
+
* make a plugin ship a client bundle (S267 section 5, implemented by
|
|
417
|
+
* S268 Task 3). `dataTypes`, `adminSections`, `railEntries` (S280),
|
|
418
|
+
* `dashboardWidgets` and `settingsPages` carry React views; `contentTreeActions` and
|
|
419
|
+
* `editorToolbar` carry client callbacks (`onSelect`, `onClick`), which
|
|
420
|
+
* is just as much browser code even though neither has a `view` key.
|
|
421
|
+
*
|
|
422
|
+
* Everything else is absent on purpose: `apiRoutes`, `hooks`,
|
|
423
|
+
* `scheduledTasks`, `mediaProcessors` and `serializers` run on the
|
|
424
|
+
* server, and `documentTypes`, `themeTokens`, `templates`, `assets`,
|
|
425
|
+
* `bundledPlugins`, `bundledTemplate` and `exposedServices` are data the
|
|
426
|
+
* host consumes rather than code the browser runs.
|
|
427
|
+
*
|
|
428
|
+
* This replaces the type-keyed CLIENT_BUNDLE_TYPES. It is more correct
|
|
429
|
+
* than that list was, not merely equivalent: a plugin listed as
|
|
430
|
+
* `section` with no views had to ship a remoteEntry.js it did not have.
|
|
431
|
+
*/
|
|
432
|
+
export declare const VIEW_BEARING_CONTRIBUTIONS: readonly ["dataTypes", "adminSections", "railEntries", "dashboardWidgets", "settingsPages", "contentTreeActions", "editorToolbar"];
|
|
433
|
+
export type ViewBearingContribution = (typeof VIEW_BEARING_CONTRIBUTIONS)[number];
|
|
434
|
+
/**
|
|
435
|
+
* Whether a manifest's declared contributions require a client bundle:
|
|
436
|
+
* whether a built artifact must contain a `remoteEntry.js`, and whether
|
|
437
|
+
* the Module Federation build runs at all.
|
|
438
|
+
*
|
|
439
|
+
* Accepts both a live `PluginContributions` and the redacted, JSON-safe
|
|
440
|
+
* summary kardalum plugin writes into a package's `manifest.json` (which
|
|
441
|
+
* keeps every contribution key and every array's length, dropping only
|
|
442
|
+
* the function-valued fields inside each entry), so both sides of an
|
|
443
|
+
* install answer this identically.
|
|
444
|
+
*
|
|
445
|
+
* An empty array declares nothing and therefore buys no bundle.
|
|
446
|
+
*
|
|
447
|
+
* NAMED `declaresClientBundle`, not `hasClientBundle`, on purpose. The
|
|
448
|
+
* S144 predicate of that name took a `type` string and answered `true`
|
|
449
|
+
* for `"datatype"`; this one takes an object and answers `false` for the
|
|
450
|
+
* same argument, silently, because a string is not an object. All three
|
|
451
|
+
* things a `false` decides are quiet (skip the federation build, stop
|
|
452
|
+
* requiring a remoteEntry.js, hand out `remoteUrl: ""`), so a caller left
|
|
453
|
+
* on the old shape produced a package that reported "Built" and shipped
|
|
454
|
+
* nothing, which is how this bit during S268 Task 3 itself: a stale
|
|
455
|
+
* `kardalum/dist/plugin/build.js` passed a string and the gap surfaced only
|
|
456
|
+
* as a downstream server test. Under the new name that same stale caller
|
|
457
|
+
* fails at module load with "does not provide an export named
|
|
458
|
+
* 'hasClientBundle'", before it can decide anything. The old name is
|
|
459
|
+
* gone rather than aliased: a name that outlives its meaning is how these
|
|
460
|
+
* get recombined later. A caller passing a string to THIS name is a
|
|
461
|
+
* compile error against the signature below.
|
|
462
|
+
*/
|
|
463
|
+
export declare function declaresClientBundle(contributions: PluginContributions | Record<string, unknown> | null | undefined): boolean;
|
|
464
|
+
/** Fields shared by every plugin type. */
|
|
465
|
+
export interface PluginManifestBase {
|
|
466
|
+
/** Reverse domain, e.g. 'com.yourname.googlemaps'. */
|
|
467
|
+
id: string;
|
|
468
|
+
name: string;
|
|
469
|
+
/** The plugin's own semver. */
|
|
470
|
+
version: string;
|
|
471
|
+
type: PluginType;
|
|
472
|
+
description: string;
|
|
473
|
+
author: string;
|
|
474
|
+
license: string;
|
|
475
|
+
/** Marketplace price; 0 or absent = free. */
|
|
476
|
+
price?: number;
|
|
477
|
+
/**
|
|
478
|
+
* Marketplace verification hash. Optional BY DESIGN, not oversight:
|
|
479
|
+
* per the Trust model, sideloaded/local dev plugins are unsigned by
|
|
480
|
+
* definition (Tier 2 'unverified') — only marketplace-signed plugins
|
|
481
|
+
* carry one. Signing is authenticity, not a sandbox; the safety layer
|
|
482
|
+
* is identical for both tiers.
|
|
483
|
+
*/
|
|
484
|
+
signature?: string;
|
|
485
|
+
/** Semver range of compatible CMS versions, e.g. '^1.0.0'. */
|
|
486
|
+
cmsVersion: string;
|
|
487
|
+
/** Ids of plugins this one requires. */
|
|
488
|
+
pluginDependencies?: string[];
|
|
489
|
+
databaseCompatibility: DatabaseCompatibility;
|
|
490
|
+
assertions?: PluginAssertions;
|
|
491
|
+
/** DB changes applied on install (through plugin storage — never raw
|
|
492
|
+
* SQL). */
|
|
493
|
+
migrations?: PluginMigration[];
|
|
494
|
+
onInstall?: () => void | Promise<void>;
|
|
495
|
+
onUninstall?: () => void | Promise<void>;
|
|
496
|
+
onActivate?: () => void | Promise<void>;
|
|
497
|
+
onDeactivate?: () => void | Promise<void>;
|
|
498
|
+
/** S274c: runs when an installed plugin is updated to this version, after
|
|
499
|
+
* the new migrations and document types and before the new actions sync.
|
|
500
|
+
* A throw rolls the update back and the old version stays installed.
|
|
501
|
+
* `onInstall` never runs on an update. */
|
|
502
|
+
onUpdate?: (ctx: {
|
|
503
|
+
fromVersion: string;
|
|
504
|
+
}) => void | Promise<void>;
|
|
505
|
+
migrationHooks?: PluginMigrationHooks;
|
|
506
|
+
/**
|
|
507
|
+
* The actions this plugin brings (S273). Each gated contribution above
|
|
508
|
+
* names one of these, and each of these is named by at least one, so the
|
|
509
|
+
* install screen shows exactly what installing adds to the permission
|
|
510
|
+
* surface. Ids carry this plugin's prefix and have a label, because
|
|
511
|
+
* nothing ever shows an operator a raw action string.
|
|
512
|
+
*/
|
|
513
|
+
actions?: Array<{
|
|
514
|
+
id: string;
|
|
515
|
+
label: string;
|
|
516
|
+
}>;
|
|
517
|
+
/**
|
|
518
|
+
* Roles this plugin offers (S273). An offer is never applied unasked: the
|
|
519
|
+
* operator accepts it on the install screen or from the installed-plugins
|
|
520
|
+
* view, and the result is an ordinary editable role holding exactly these
|
|
521
|
+
* actions, each one of the plugin's own.
|
|
522
|
+
*/
|
|
523
|
+
roles?: Array<{
|
|
524
|
+
id: string;
|
|
525
|
+
label: string;
|
|
526
|
+
actions: string[];
|
|
527
|
+
}>;
|
|
528
|
+
/** S286: the plugin's docs pages, in reading order. Omit it and the
|
|
529
|
+
* README is the one page (the overview). Which roles the marketplace
|
|
530
|
+
* requires is derived from what the manifest declares, never listed
|
|
531
|
+
* here: a "setup" page when the plugin has migrations, dependencies, a
|
|
532
|
+
* price or document types; a "configuration" page when it has settings
|
|
533
|
+
* pages. */
|
|
534
|
+
docs?: PluginDocsPage[];
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* The full plugin manifest. One shape for every plugin: `type` is a
|
|
538
|
+
* marketplace listing label, and any plugin may declare any contribution
|
|
539
|
+
* (S268, per the S267 capability design). What a plugin may DO is decided
|
|
540
|
+
* by the capability list derived from these contributions and by
|
|
541
|
+
* marketplace review, not by its listing label. Built-ins and Module
|
|
542
|
+
* Federation remotes both register through this same contract.
|
|
543
|
+
*/
|
|
544
|
+
export interface PluginManifest extends PluginManifestBase {
|
|
545
|
+
contributions: PluginContributions;
|
|
546
|
+
}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text of a slot's label for a locale: the locale as given, else its
|
|
3
|
+
* primary subtag (`de-AT` reads `de`), else `en`, which every label carries.
|
|
4
|
+
* Locale codes compare case-insensitively, since BCP 47 tags are
|
|
5
|
+
* case-insensitive and a label written `pt-BR` must answer `pt-br`.
|
|
6
|
+
*/
|
|
7
|
+
export function slotLabel(label, locale) {
|
|
8
|
+
const wanted = locale.toLowerCase();
|
|
9
|
+
const primary = wanted.split("-")[0] ?? "";
|
|
10
|
+
let primaryText;
|
|
11
|
+
for (const [code, text] of Object.entries(label)) {
|
|
12
|
+
const lower = code.toLowerCase();
|
|
13
|
+
if (lower === wanted)
|
|
14
|
+
return text;
|
|
15
|
+
if (primaryText === undefined && primary !== "" && lower === primary)
|
|
16
|
+
primaryText = text;
|
|
17
|
+
}
|
|
18
|
+
return primaryText ?? label.en;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The contributions that put code in the browser, and so the ones that
|
|
22
|
+
* make a plugin ship a client bundle (S267 section 5, implemented by
|
|
23
|
+
* S268 Task 3). `dataTypes`, `adminSections`, `railEntries` (S280),
|
|
24
|
+
* `dashboardWidgets` and `settingsPages` carry React views; `contentTreeActions` and
|
|
25
|
+
* `editorToolbar` carry client callbacks (`onSelect`, `onClick`), which
|
|
26
|
+
* is just as much browser code even though neither has a `view` key.
|
|
27
|
+
*
|
|
28
|
+
* Everything else is absent on purpose: `apiRoutes`, `hooks`,
|
|
29
|
+
* `scheduledTasks`, `mediaProcessors` and `serializers` run on the
|
|
30
|
+
* server, and `documentTypes`, `themeTokens`, `templates`, `assets`,
|
|
31
|
+
* `bundledPlugins`, `bundledTemplate` and `exposedServices` are data the
|
|
32
|
+
* host consumes rather than code the browser runs.
|
|
33
|
+
*
|
|
34
|
+
* This replaces the type-keyed CLIENT_BUNDLE_TYPES. It is more correct
|
|
35
|
+
* than that list was, not merely equivalent: a plugin listed as
|
|
36
|
+
* `section` with no views had to ship a remoteEntry.js it did not have.
|
|
37
|
+
*/
|
|
38
|
+
export const VIEW_BEARING_CONTRIBUTIONS = [
|
|
39
|
+
"dataTypes",
|
|
40
|
+
"adminSections",
|
|
41
|
+
"railEntries",
|
|
42
|
+
"dashboardWidgets",
|
|
43
|
+
"settingsPages",
|
|
44
|
+
"contentTreeActions",
|
|
45
|
+
"editorToolbar",
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Whether a manifest's declared contributions require a client bundle:
|
|
49
|
+
* whether a built artifact must contain a `remoteEntry.js`, and whether
|
|
50
|
+
* the Module Federation build runs at all.
|
|
51
|
+
*
|
|
52
|
+
* Accepts both a live `PluginContributions` and the redacted, JSON-safe
|
|
53
|
+
* summary kardalum plugin writes into a package's `manifest.json` (which
|
|
54
|
+
* keeps every contribution key and every array's length, dropping only
|
|
55
|
+
* the function-valued fields inside each entry), so both sides of an
|
|
56
|
+
* install answer this identically.
|
|
57
|
+
*
|
|
58
|
+
* An empty array declares nothing and therefore buys no bundle.
|
|
59
|
+
*
|
|
60
|
+
* NAMED `declaresClientBundle`, not `hasClientBundle`, on purpose. The
|
|
61
|
+
* S144 predicate of that name took a `type` string and answered `true`
|
|
62
|
+
* for `"datatype"`; this one takes an object and answers `false` for the
|
|
63
|
+
* same argument, silently, because a string is not an object. All three
|
|
64
|
+
* things a `false` decides are quiet (skip the federation build, stop
|
|
65
|
+
* requiring a remoteEntry.js, hand out `remoteUrl: ""`), so a caller left
|
|
66
|
+
* on the old shape produced a package that reported "Built" and shipped
|
|
67
|
+
* nothing, which is how this bit during S268 Task 3 itself: a stale
|
|
68
|
+
* `kardalum/dist/plugin/build.js` passed a string and the gap surfaced only
|
|
69
|
+
* as a downstream server test. Under the new name that same stale caller
|
|
70
|
+
* fails at module load with "does not provide an export named
|
|
71
|
+
* 'hasClientBundle'", before it can decide anything. The old name is
|
|
72
|
+
* gone rather than aliased: a name that outlives its meaning is how these
|
|
73
|
+
* get recombined later. A caller passing a string to THIS name is a
|
|
74
|
+
* compile error against the signature below.
|
|
75
|
+
*/
|
|
76
|
+
export function declaresClientBundle(contributions) {
|
|
77
|
+
if (contributions === null || typeof contributions !== "object")
|
|
78
|
+
return false;
|
|
79
|
+
const declared = contributions;
|
|
80
|
+
return VIEW_BEARING_CONTRIBUTIONS.some((key) => {
|
|
81
|
+
const value = declared[key];
|
|
82
|
+
if (value === null || value === undefined)
|
|
83
|
+
return false;
|
|
84
|
+
return Array.isArray(value) ? value.length > 0 : true;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface MediaPickerItem {
|
|
2
|
+
id: string;
|
|
3
|
+
downloadUrl: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MediaPickerProps {
|
|
7
|
+
onPick: (item: MediaPickerItem) => void;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Whether a pick is followed by an alt-text step. TRUE for rich text,
|
|
11
|
+
* where the alt lives on the inserted node and is authored before the
|
|
12
|
+
* image lands in the document. FALSE for an image field, which stores
|
|
13
|
+
* one media id and has nowhere to put alt text, so a pick commits and
|
|
14
|
+
* closes at once.
|
|
15
|
+
*
|
|
16
|
+
* Required, not defaulted: a caller that has not decided is a caller
|
|
17
|
+
* that has not thought about where its alt text is going to live.
|
|
18
|
+
*/
|
|
19
|
+
collectAlt: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* What the calling field accepts, in the same spellings its settings
|
|
22
|
+
* allow (`image/*`, `image/png`, `.jpg`, `jpg`). Absent or empty means
|
|
23
|
+
* images, which is what rich text has always shown.
|
|
24
|
+
*/
|
|
25
|
+
acceptedTypes?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* The rendition NAME the calling field asks its picture for ("3x4",
|
|
28
|
+
* "thumb"), as `renditionName` in @kardalum/api-schemas produces one
|
|
29
|
+
* and as ImageSettingsSchema stores it. Absent means the field asks for
|
|
30
|
+
* no particular crop.
|
|
31
|
+
*
|
|
32
|
+
* It is not a filter. Items without that crop are still offered, and
|
|
33
|
+
* marked as falling back to their full image: hiding a perfectly good
|
|
34
|
+
* photo would leave an editor hunting for an upload that is right
|
|
35
|
+
* there.
|
|
36
|
+
*/
|
|
37
|
+
rendition?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendition }: MediaPickerProps): import("react").JSX.Element;
|