@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,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every contribution key, classified. Keyed by `keyof PluginContributions`
|
|
3
|
+
* rather than by a loose string, so a contribution added to the contract
|
|
4
|
+
* and not classified here is a compile error rather than a capability that
|
|
5
|
+
* silently never appears on an install screen.
|
|
6
|
+
*
|
|
7
|
+
* Classification follows S267 section 6 and its stated principle: a
|
|
8
|
+
* capability is automatic when the platform decides the outcome, and needs
|
|
9
|
+
* a person when the plugin does. Every contribution below is mediated,
|
|
10
|
+
* because every one of them is consumed by the host: it mounts the view,
|
|
11
|
+
* dispatches the hook, runs the task, registers the template. The only
|
|
12
|
+
* contribution that is not wholly mediated is `apiRoutes`, and only for
|
|
13
|
+
* the tiers that let traffic reach a handler without an admin session.
|
|
14
|
+
*
|
|
15
|
+
* `exposedServices`, `bundledPlugins` and `bundledTemplate` are not named
|
|
16
|
+
* in section 6's automatic list, which enumerates a policy rather than the
|
|
17
|
+
* contract's keys. They are classified mediated here rather than dropped:
|
|
18
|
+
* the marketplace resolves the two bundle keys, and the cross-plugin
|
|
19
|
+
* service registry (when it exists) is the host's own lookup.
|
|
20
|
+
* `exposedServices` reads promised until you remember that plugin backend
|
|
21
|
+
* code is unsandboxed and in-process already, so handing another plugin a
|
|
22
|
+
* service adds a lookup rather than a privilege it could not otherwise
|
|
23
|
+
* reach. Emitting them changes no review outcome, since mediated is
|
|
24
|
+
* automatic, and not emitting them would be the exact failure this design
|
|
25
|
+
* exists to prevent, a declaration the install screen does not disclose.
|
|
26
|
+
*/
|
|
27
|
+
const CONTRIBUTION_RULES = {
|
|
28
|
+
dataTypes: { derives: "one", id: "content.dataType", mediation: "mediated", actionGated: false },
|
|
29
|
+
documentTypes: { derives: "one", id: "content.documentType", mediation: "mediated", actionGated: false },
|
|
30
|
+
adminSections: { derives: "one", id: "admin.section", mediation: "mediated", actionGated: true },
|
|
31
|
+
// S280: a rail entry in a built-in section. Mediated like a section: the
|
|
32
|
+
// host decides where it renders and checks its action before it does. A
|
|
33
|
+
// section's own rail entries are part of the section's declaration, so
|
|
34
|
+
// they are disclosed under admin.section rather than counted here.
|
|
35
|
+
railEntries: { derives: "one", id: "admin.railEntry", mediation: "mediated", actionGated: true },
|
|
36
|
+
dashboardWidgets: { derives: "one", id: "admin.dashboardWidget", mediation: "mediated", actionGated: true },
|
|
37
|
+
settingsPages: { derives: "one", id: "admin.settingsPage", mediation: "mediated", actionGated: true },
|
|
38
|
+
contentTreeActions: { derives: "one", id: "admin.contentTreeAction", mediation: "mediated", actionGated: true },
|
|
39
|
+
editorToolbar: { derives: "one", id: "admin.editorToolbarItem", mediation: "mediated", actionGated: true },
|
|
40
|
+
templates: { derives: "one", id: "render.template", mediation: "mediated", actionGated: false },
|
|
41
|
+
assets: { derives: "one", id: "render.asset", mediation: "mediated", actionGated: false },
|
|
42
|
+
themeTokens: { derives: "one", id: "theme.tokens", mediation: "mediated", actionGated: false },
|
|
43
|
+
hooks: { derives: "one", id: "server.hook", mediation: "mediated", actionGated: false },
|
|
44
|
+
scheduledTasks: { derives: "one", id: "server.scheduledTask", mediation: "mediated", actionGated: false },
|
|
45
|
+
mediaProcessors: { derives: "one", id: "media.processor", mediation: "mediated", actionGated: false },
|
|
46
|
+
serializers: { derives: "one", id: "api.serializer", mediation: "mediated", actionGated: false },
|
|
47
|
+
exposedServices: { derives: "one", id: "service.exposed", mediation: "mediated", actionGated: false },
|
|
48
|
+
bundledPlugins: { derives: "one", id: "bundle.plugin", mediation: "mediated", actionGated: false },
|
|
49
|
+
bundledTemplate: { derives: "one", id: "bundle.template", mediation: "mediated", actionGated: false },
|
|
50
|
+
apiRoutes: { derives: "perApiRouteTier", actionGated: true },
|
|
51
|
+
};
|
|
52
|
+
/** Whether this contribution kind sits behind a named permission action.
|
|
53
|
+
* Lives on CONTRIBUTION_RULES rather than in a separate list, because that
|
|
54
|
+
* record is compiler-total over the 19 contribution keys: a twentieth key
|
|
55
|
+
* cannot be added without classifying it here. */
|
|
56
|
+
export function isActionGated(key) {
|
|
57
|
+
return CONTRIBUTION_RULES[key].actionGated;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The order capabilities are emitted in, fixed here rather than taken from
|
|
61
|
+
* the manifest's own key order. Two manifests declaring the same things in
|
|
62
|
+
* a different order must produce the same list, or the install screen, the
|
|
63
|
+
* review queue and the reference page would each print a different
|
|
64
|
+
* ordering of one fact.
|
|
65
|
+
*
|
|
66
|
+
* Storage leads because it is the heaviest thing an operator consents to.
|
|
67
|
+
* The assertions trail because they are the claims with nothing behind
|
|
68
|
+
* them, and they read as a closing caveat rather than as a feature.
|
|
69
|
+
*/
|
|
70
|
+
const CONTRIBUTION_ORDER = [
|
|
71
|
+
"dataTypes",
|
|
72
|
+
"documentTypes",
|
|
73
|
+
"adminSections",
|
|
74
|
+
"railEntries",
|
|
75
|
+
"dashboardWidgets",
|
|
76
|
+
"settingsPages",
|
|
77
|
+
"contentTreeActions",
|
|
78
|
+
"editorToolbar",
|
|
79
|
+
"templates",
|
|
80
|
+
"assets",
|
|
81
|
+
"themeTokens",
|
|
82
|
+
"hooks",
|
|
83
|
+
"scheduledTasks",
|
|
84
|
+
"mediaProcessors",
|
|
85
|
+
"serializers",
|
|
86
|
+
"apiRoutes",
|
|
87
|
+
"exposedServices",
|
|
88
|
+
"bundledPlugins",
|
|
89
|
+
"bundledTemplate",
|
|
90
|
+
];
|
|
91
|
+
/**
|
|
92
|
+
* The access tiers, in emission order, with the classification S267
|
|
93
|
+
* section 6 gives each.
|
|
94
|
+
*
|
|
95
|
+
* `admin` is mediated: the host checks the JWT admin session before the
|
|
96
|
+
* handler runs. `apiKey` and `public` are promised: the host enforces the
|
|
97
|
+
* tier, but a route reachable without an admin session is an abuse surface
|
|
98
|
+
* whose handling belongs to the author.
|
|
99
|
+
*/
|
|
100
|
+
const API_ROUTE_TIERS = [
|
|
101
|
+
{ tier: "admin", id: "api.route.admin", mediation: "mediated" },
|
|
102
|
+
{ tier: "apiKey", id: "api.route.apiKey", mediation: "promised" },
|
|
103
|
+
{ tier: "public", id: "api.route.public", mediation: "promised" },
|
|
104
|
+
];
|
|
105
|
+
/**
|
|
106
|
+
* The tier a route actually runs at.
|
|
107
|
+
*
|
|
108
|
+
* This is a real coupling to `apps/server/src/routes/plugin-api-routes.ts`,
|
|
109
|
+
* which resolves `route.access ?? "admin"` and documents that anything
|
|
110
|
+
* unrecognised falls back to `admin`, secure by default. If the two
|
|
111
|
+
* disagreed, the install screen would promise a gate the runtime does not
|
|
112
|
+
* apply, or warn about one it does. The dispatcher is canonical; this
|
|
113
|
+
* follows it.
|
|
114
|
+
*/
|
|
115
|
+
function routeTier(access) {
|
|
116
|
+
const match = API_ROUTE_TIERS.find((entry) => entry.tier === access);
|
|
117
|
+
return match ?? API_ROUTE_TIERS[0];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Capability id per assertion, in emission order. The reason the author
|
|
121
|
+
* gave is the capability's only detail, because the reason is the only
|
|
122
|
+
* checkable thing an assertion carries.
|
|
123
|
+
*
|
|
124
|
+
* Keyed by `keyof PluginAssertions` for the same reason
|
|
125
|
+
* CONTRIBUTION_RULES is keyed by `keyof PluginContributions`, and with
|
|
126
|
+
* more force: an unclassified contribution is at worst an undisclosed
|
|
127
|
+
* mediated addition, while an unclassified assertion is an undisclosed
|
|
128
|
+
* PROMISE, so it would never reach the consent list and never send the
|
|
129
|
+
* submission to a person. A third kind added to the type and not here is
|
|
130
|
+
* a compile error.
|
|
131
|
+
*/
|
|
132
|
+
const ASSERTION_RULES = {
|
|
133
|
+
externalNetwork: "network.external",
|
|
134
|
+
filesystemAccess: "filesystem.access",
|
|
135
|
+
};
|
|
136
|
+
/** The rules as the derivation walks them. Object key order is stable for
|
|
137
|
+
* string keys, so this is the literal's own order rather than a second
|
|
138
|
+
* list to keep in step. */
|
|
139
|
+
const ASSERTION_ENTRIES = Object.entries(ASSERTION_RULES);
|
|
140
|
+
/**
|
|
141
|
+
* Derived from `databaseCompatibility.storageType`, and NOT from a
|
|
142
|
+
* contribution: `PluginContributions` has no storage-shaped key and the
|
|
143
|
+
* contract cannot silently grow one. Declaring structured storage IS the
|
|
144
|
+
* declaration that the plugin owns real tables. The server agrees: it
|
|
145
|
+
* persists `storageType` on the installed-plugin row, because uninstall
|
|
146
|
+
* has to answer that question without the manifest.
|
|
147
|
+
*/
|
|
148
|
+
const STRUCTURED_STORAGE_ID = "storage.structured";
|
|
149
|
+
/** Every capability id this contract can produce, for the readers that
|
|
150
|
+
* need to be pinned against it (the marketplace's static mirror) and for
|
|
151
|
+
* the reference page S289 generates. */
|
|
152
|
+
export const CAPABILITY_IDS = [
|
|
153
|
+
STRUCTURED_STORAGE_ID,
|
|
154
|
+
...CONTRIBUTION_ORDER.flatMap((key) => {
|
|
155
|
+
const rule = CONTRIBUTION_RULES[key];
|
|
156
|
+
return rule.derives === "one" ? [rule.id] : API_ROUTE_TIERS.map((entry) => entry.id);
|
|
157
|
+
}),
|
|
158
|
+
...ASSERTION_ENTRIES.map(([, id]) => id),
|
|
159
|
+
];
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// Reading a declaration's readable detail
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
/** The plain string fields a contribution entry can be named by, in the
|
|
164
|
+
* order they are preferred. Every one of them survives the redaction
|
|
165
|
+
* kardalum plugin applies when it writes a package's manifest.json, which
|
|
166
|
+
* is the only form the marketplace ever sees. */
|
|
167
|
+
const ENTRY_NAME_FIELDS = ["name", "label", "alias", "file", "id"];
|
|
168
|
+
/** A slot's label is a map of language to text (S280), and the detail is a
|
|
169
|
+
* plain identifying string, so a label map reads as its English text, the
|
|
170
|
+
* one language every label must carry. A map without readable English
|
|
171
|
+
* yields nothing, and the next name field is tried. */
|
|
172
|
+
function readableField(value) {
|
|
173
|
+
if (typeof value === "string")
|
|
174
|
+
return value.trim() ? value : null;
|
|
175
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
176
|
+
const en = value.en;
|
|
177
|
+
if (typeof en === "string" && en.trim())
|
|
178
|
+
return en;
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
function describeEntry(entry) {
|
|
183
|
+
if (typeof entry === "string")
|
|
184
|
+
return entry.trim() || null;
|
|
185
|
+
if (entry === null || typeof entry !== "object")
|
|
186
|
+
return null;
|
|
187
|
+
const record = entry;
|
|
188
|
+
// An apiRoute is named by what it exposes, not by an id it has no field
|
|
189
|
+
// for: "GET /orders" is the thing a reviewer looks up in the code.
|
|
190
|
+
if (typeof record.method === "string" && typeof record.path === "string") {
|
|
191
|
+
return `${record.method} ${record.path}`;
|
|
192
|
+
}
|
|
193
|
+
for (const field of ENTRY_NAME_FIELDS) {
|
|
194
|
+
const value = readableField(record[field]);
|
|
195
|
+
if (value !== null)
|
|
196
|
+
return value;
|
|
197
|
+
}
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Normalises one declared contribution value into the entries that
|
|
202
|
+
* produced it, handling the three shapes the contract uses: a list, the
|
|
203
|
+
* `hooks` map (whose keys are the events, and which arrives as a plain key
|
|
204
|
+
* array once redacted), and a single object like `themeTokens`.
|
|
205
|
+
*
|
|
206
|
+
* Returns an empty list for a declaration that declares nothing, which is
|
|
207
|
+
* the same rule `declaresClientBundle` applies: a present-but-empty array
|
|
208
|
+
* or object buys nothing. The one shape that is NOT nothing is the
|
|
209
|
+
* redactor's `true`, which is a declaration stripped of its detail rather
|
|
210
|
+
* than an absent one.
|
|
211
|
+
*/
|
|
212
|
+
function declaredEntries(key, value) {
|
|
213
|
+
if (value === null || value === undefined)
|
|
214
|
+
return [];
|
|
215
|
+
if (Array.isArray(value))
|
|
216
|
+
return value;
|
|
217
|
+
// `true` is what kardalum plugin's redactor writes for a contribution it
|
|
218
|
+
// can keep no safe per-entry detail from (`serializers` is the only key
|
|
219
|
+
// that lands there today). It means "declared, nothing readable to
|
|
220
|
+
// show", which is exactly one entry with no detail, the same answer the
|
|
221
|
+
// live object form gives. Reading it as "declares nothing" is what made
|
|
222
|
+
// every marketplace surface omit a capability the SDK derived from the
|
|
223
|
+
// same plugin.
|
|
224
|
+
if (value === true)
|
|
225
|
+
return [true];
|
|
226
|
+
if (typeof value !== "object")
|
|
227
|
+
return [];
|
|
228
|
+
// `hooks` is Record<event, handler> live and string[] once redacted; the
|
|
229
|
+
// array branch above already covered the redacted form.
|
|
230
|
+
if (key === "hooks")
|
|
231
|
+
return Object.keys(value);
|
|
232
|
+
// A present-but-empty object buys nothing, which is the rule the array
|
|
233
|
+
// branch gets for free: `themeTokens: {}` declares no tokens, so it is
|
|
234
|
+
// not a theme capability.
|
|
235
|
+
return Object.keys(value).length === 0 ? [] : [value];
|
|
236
|
+
}
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
// The derivation
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
240
|
+
/**
|
|
241
|
+
* Compute a manifest's capability list.
|
|
242
|
+
*
|
|
243
|
+
* Accepts both a live `PluginManifest` and the redacted, JSON-safe summary
|
|
244
|
+
* kardalum plugin writes into a package's `manifest.json`, for the same
|
|
245
|
+
* reason `declaresClientBundle` does: the marketplace never executes
|
|
246
|
+
* plugin code, so the only manifest it can read is the redacted one, and
|
|
247
|
+
* the two sides of an install must not disagree about what a package
|
|
248
|
+
* declares.
|
|
249
|
+
*
|
|
250
|
+
* Defensive about its input rather than trusting it. It is handed parsed
|
|
251
|
+
* JSON from an artifact an author built, so a missing or wrongly-shaped
|
|
252
|
+
* field degrades to "declares nothing" for that field instead of throwing
|
|
253
|
+
* inside a review queue listing.
|
|
254
|
+
*/
|
|
255
|
+
export function deriveCapabilities(manifest) {
|
|
256
|
+
if (manifest === null || typeof manifest !== "object")
|
|
257
|
+
return [];
|
|
258
|
+
const source = manifest;
|
|
259
|
+
const capabilities = [];
|
|
260
|
+
const databaseCompatibility = source.databaseCompatibility;
|
|
261
|
+
const storageType = databaseCompatibility !== null && typeof databaseCompatibility === "object"
|
|
262
|
+
? databaseCompatibility.storageType
|
|
263
|
+
: undefined;
|
|
264
|
+
if (storageType === "structured") {
|
|
265
|
+
capabilities.push({
|
|
266
|
+
id: STRUCTURED_STORAGE_ID,
|
|
267
|
+
payload: { count: 1, details: [] },
|
|
268
|
+
mediation: "promised",
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
const contributions = source.contributions !== null && typeof source.contributions === "object"
|
|
272
|
+
? source.contributions
|
|
273
|
+
: {};
|
|
274
|
+
for (const key of CONTRIBUTION_ORDER) {
|
|
275
|
+
const entries = declaredEntries(key, contributions[key]);
|
|
276
|
+
if (entries.length === 0)
|
|
277
|
+
continue;
|
|
278
|
+
const rule = CONTRIBUTION_RULES[key];
|
|
279
|
+
if (rule.derives === "one") {
|
|
280
|
+
capabilities.push({
|
|
281
|
+
id: rule.id,
|
|
282
|
+
payload: {
|
|
283
|
+
count: entries.length,
|
|
284
|
+
details: entries.map(describeEntry).filter((detail) => detail !== null),
|
|
285
|
+
},
|
|
286
|
+
mediation: rule.mediation,
|
|
287
|
+
});
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
// One contribution, up to three capabilities: the routes are grouped
|
|
291
|
+
// by the tier the dispatcher will actually run them at.
|
|
292
|
+
for (const tier of API_ROUTE_TIERS) {
|
|
293
|
+
const routes = entries.filter((entry) => routeTier(entry !== null && typeof entry === "object" ? entry.access : undefined)
|
|
294
|
+
.tier === tier.tier);
|
|
295
|
+
if (routes.length === 0)
|
|
296
|
+
continue;
|
|
297
|
+
capabilities.push({
|
|
298
|
+
id: tier.id,
|
|
299
|
+
payload: {
|
|
300
|
+
count: routes.length,
|
|
301
|
+
details: routes.map(describeEntry).filter((detail) => detail !== null),
|
|
302
|
+
},
|
|
303
|
+
mediation: tier.mediation,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
const assertions = source.assertions !== null && typeof source.assertions === "object"
|
|
308
|
+
? source.assertions
|
|
309
|
+
: {};
|
|
310
|
+
for (const [key, id] of ASSERTION_ENTRIES) {
|
|
311
|
+
const declared = assertions[key];
|
|
312
|
+
if (declared === null || typeof declared !== "object")
|
|
313
|
+
continue;
|
|
314
|
+
const reason = declared.reason;
|
|
315
|
+
// An assertion without a readable reason is not consentable and not
|
|
316
|
+
// checkable, so it is dropped rather than rendered as a blank line.
|
|
317
|
+
// The SDK schema refuses it upstream; this guards a parsed artifact.
|
|
318
|
+
if (typeof reason !== "string" || !reason.trim())
|
|
319
|
+
continue;
|
|
320
|
+
capabilities.push({ id, payload: { count: 1, details: [reason] }, mediation: "promised" });
|
|
321
|
+
}
|
|
322
|
+
return capabilities;
|
|
323
|
+
}
|
|
324
|
+
export const CAPABILITY_LABELS = {
|
|
325
|
+
"storage.structured": {
|
|
326
|
+
operator: "Structured storage",
|
|
327
|
+
shopper: "Creates its own database tables",
|
|
328
|
+
},
|
|
329
|
+
"content.dataType": { operator: "Field types", shopper: "Adds field types" },
|
|
330
|
+
"content.documentType": { operator: "Document types", shopper: "Adds document types" },
|
|
331
|
+
"admin.section": { operator: "Admin sections", shopper: "Adds admin screens" },
|
|
332
|
+
"admin.railEntry": { operator: "Admin rail entries", shopper: "Adds screens to built-in sections" },
|
|
333
|
+
"admin.dashboardWidget": { operator: "Dashboard widgets", shopper: "Adds dashboard widgets" },
|
|
334
|
+
"admin.settingsPage": { operator: "Settings pages", shopper: "Adds a settings page" },
|
|
335
|
+
"admin.contentTreeAction": { operator: "Content tree actions", shopper: "Adds content tree actions" },
|
|
336
|
+
"admin.editorToolbarItem": { operator: "Editor toolbar items", shopper: "Adds editor toolbar buttons" },
|
|
337
|
+
"render.template": { operator: "Render templates", shopper: "Ships render templates" },
|
|
338
|
+
"render.asset": { operator: "Editable assets", shopper: "Ships editable assets" },
|
|
339
|
+
"theme.tokens": { operator: "Theme tokens", shopper: "Restyles the admin" },
|
|
340
|
+
"server.hook": { operator: "Lifecycle hooks", shopper: "Reacts to content changes" },
|
|
341
|
+
"server.scheduledTask": { operator: "Scheduled tasks", shopper: "Runs work on a schedule" },
|
|
342
|
+
"media.processor": { operator: "Media processors", shopper: "Processes uploaded media" },
|
|
343
|
+
"api.serializer": { operator: "Response extensions", shopper: "Extends content API responses" },
|
|
344
|
+
"api.route.admin": { operator: "Admin API routes", shopper: "Adds admin-only API routes" },
|
|
345
|
+
"api.route.apiKey": { operator: "API-key routes", shopper: "Adds API-key routes" },
|
|
346
|
+
"api.route.public": { operator: "Public API routes", shopper: "Adds routes anyone can call" },
|
|
347
|
+
"service.exposed": { operator: "Services for other plugins", shopper: "Offers services to other plugins" },
|
|
348
|
+
"bundle.plugin": { operator: "Bundled plugins", shopper: "Installs other plugins with it" },
|
|
349
|
+
"bundle.template": { operator: "Bundled starter", shopper: "Comes with a frontend starter" },
|
|
350
|
+
"network.external": { operator: "External network", shopper: "Reaches the network" },
|
|
351
|
+
"filesystem.access": { operator: "Filesystem access", shopper: "Reads or writes files" },
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* The heading a renderer puts in front of a capability's details.
|
|
355
|
+
*
|
|
356
|
+
* An id with no label prints as itself rather than being guessed at or
|
|
357
|
+
* humanised: the derivation is the only thing that mints ids, so an
|
|
358
|
+
* unlabelled one reaching a screen means this map has drifted from it, and
|
|
359
|
+
* showing the raw id says so out loud instead of inventing copy.
|
|
360
|
+
*/
|
|
361
|
+
export function capabilityLabel(id, audience) {
|
|
362
|
+
return CAPABILITY_LABELS[id]?.[audience] ?? id;
|
|
363
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { JSONSchema7 } from "json-schema";
|
|
3
|
+
import type { DataTypeValidateHook } from "./datatype-validation.js";
|
|
4
|
+
export interface DataTypePluginViews {
|
|
5
|
+
input: ComponentType;
|
|
6
|
+
readOnly: ComponentType;
|
|
7
|
+
settings: ComponentType;
|
|
8
|
+
preview?: ComponentType;
|
|
9
|
+
}
|
|
10
|
+
export interface DataTypePlugin {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
version: string;
|
|
15
|
+
type: "datatype";
|
|
16
|
+
schema: JSONSchema7;
|
|
17
|
+
settingsSchema: JSONSchema7;
|
|
18
|
+
defaultSettings: Record<string, unknown>;
|
|
19
|
+
views: DataTypePluginViews;
|
|
20
|
+
serialize: (value: unknown, settings: Record<string, unknown>) => unknown;
|
|
21
|
+
deserialize: (raw: unknown, settings: Record<string, unknown>) => unknown;
|
|
22
|
+
/** Datatype-intrinsic validation (S198). Pure, synchronous, runtime-only
|
|
23
|
+
* — never serialized into manifest.json (same as PluginHooks). */
|
|
24
|
+
validate?: DataTypeValidateHook;
|
|
25
|
+
/** Optional emptiness predicate for composite values, consulted by the
|
|
26
|
+
* `required` rule so a webmaster never needs to know the value shape. */
|
|
27
|
+
isEmpty?: (value: unknown) => boolean;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type DataTypeIssue = {
|
|
2
|
+
key: string;
|
|
3
|
+
params?: Record<string, unknown>;
|
|
4
|
+
path?: string;
|
|
5
|
+
} | {
|
|
6
|
+
message: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
};
|
|
9
|
+
export interface DataTypeValidateContext {
|
|
10
|
+
settings: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export type DataTypeValidateHook = (value: unknown, ctx: DataTypeValidateContext) => DataTypeIssue[] | undefined;
|
|
13
|
+
export interface DataTypeValidatorEntry {
|
|
14
|
+
/**
|
|
15
|
+
* The datatype's own `defaultSettings`. A DataTypeConfig stores `{}`
|
|
16
|
+
* until a webmaster opens the settings view and changes something, and
|
|
17
|
+
* the admin's resolver already substitutes these defaults in that case
|
|
18
|
+
* — so the hook has to see them too, or it judges a value against
|
|
19
|
+
* different settings than the input view was configured with.
|
|
20
|
+
*/
|
|
21
|
+
defaultSettings?: Record<string, unknown>;
|
|
22
|
+
validate?: DataTypeValidateHook;
|
|
23
|
+
isEmpty?: (value: unknown) => boolean;
|
|
24
|
+
}
|
|
25
|
+
export type DataTypeValidatorLookup = (datatypeId: string) => DataTypeValidatorEntry | undefined;
|
|
26
|
+
export declare const BUILT_IN_DATATYPE_VALIDATORS: Record<string, DataTypeValidatorEntry>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// The datatype validate hook (S198 spec §2). Deliberately React-free and
|
|
2
|
+
// dependency-free: the SERVER imports this module to build its validator
|
|
3
|
+
// lookup, and anything React-shaped here would drag the admin's UI graph
|
|
4
|
+
// into plugin artifacts (the S197 F5 lesson).
|
|
5
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
6
|
+
// A member reads as its string, as null (absent), or as MALFORMED when it
|
|
7
|
+
// is present but not a string at all. Keeping the two failure modes apart
|
|
8
|
+
// per side is what lets `validate` blame the side actually at fault: a
|
|
9
|
+
// whole-value collapse would report `{ start: "2026-01-01", end: 123 }`
|
|
10
|
+
// against `start`, pointing the form at the input the editor got right.
|
|
11
|
+
const MALFORMED = Symbol("malformed-date-range-member");
|
|
12
|
+
function readDateRange(value) {
|
|
13
|
+
if (typeof value !== "object" || value === null)
|
|
14
|
+
return null;
|
|
15
|
+
const candidate = value;
|
|
16
|
+
const read = (key) => {
|
|
17
|
+
const raw = candidate[key];
|
|
18
|
+
if (raw === null || raw === undefined || raw === "")
|
|
19
|
+
return null;
|
|
20
|
+
return typeof raw === "string" ? raw : MALFORMED;
|
|
21
|
+
};
|
|
22
|
+
return { start: read("start"), end: read("end") };
|
|
23
|
+
}
|
|
24
|
+
function isValidIsoDate(value) {
|
|
25
|
+
if (!ISO_DATE.test(value))
|
|
26
|
+
return false;
|
|
27
|
+
const parsed = new Date(`${value}T00:00:00Z`);
|
|
28
|
+
// Rejects real-looking but impossible dates (2026-02-31 rolls over).
|
|
29
|
+
return !Number.isNaN(parsed.getTime()) && parsed.toISOString().slice(0, 10) === value;
|
|
30
|
+
}
|
|
31
|
+
// Populated by Task 3 (date range). A plain record so the server can build
|
|
32
|
+
// its lookup with a single object read.
|
|
33
|
+
export const BUILT_IN_DATATYPE_VALIDATORS = {
|
|
34
|
+
"com.kardalum.daterange": {
|
|
35
|
+
// `required` asks this, not `validate` — Task 2 only calls `validate`
|
|
36
|
+
// once a value is present, so "empty" for a two-member composite has
|
|
37
|
+
// to be answered here: both members null (or a value that is not an
|
|
38
|
+
// object at all) is empty. A member that is present but malformed is
|
|
39
|
+
// NOT empty — it is a value the editor supplied and got wrong, so it
|
|
40
|
+
// must reach `validate` rather than be reported as a missing field.
|
|
41
|
+
isEmpty(value) {
|
|
42
|
+
const range = readDateRange(value);
|
|
43
|
+
return range === null || (range.start === null && range.end === null);
|
|
44
|
+
},
|
|
45
|
+
validate(value) {
|
|
46
|
+
const range = readDateRange(value);
|
|
47
|
+
if (range === null)
|
|
48
|
+
return [{ key: "dataTypes.dateRange.errors.invalidDate", path: "start" }];
|
|
49
|
+
const issues = [];
|
|
50
|
+
for (const side of ["start", "end"]) {
|
|
51
|
+
const member = range[side];
|
|
52
|
+
if (member === MALFORMED || (member !== null && !isValidIsoDate(member))) {
|
|
53
|
+
issues.push({ key: "dataTypes.dateRange.errors.invalidDate", path: side });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (issues.length > 0)
|
|
57
|
+
return issues;
|
|
58
|
+
const { start, end } = range;
|
|
59
|
+
if (start !== null && end === null) {
|
|
60
|
+
return [{ key: "dataTypes.dateRange.errors.bothOrNeither", path: "end" }];
|
|
61
|
+
}
|
|
62
|
+
if (start === null && end !== null) {
|
|
63
|
+
return [{ key: "dataTypes.dateRange.errors.bothOrNeither", path: "start" }];
|
|
64
|
+
}
|
|
65
|
+
// ISO YYYY-MM-DD strings compare lexicographically as dates.
|
|
66
|
+
if (start !== null && end !== null && end < start) {
|
|
67
|
+
return [{ key: "dataTypes.dateRange.errors.endBeforeStart", path: "end" }];
|
|
68
|
+
}
|
|
69
|
+
return [];
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
// S232. The Content List field holds no value: its table reads the
|
|
73
|
+
// page's children, which live in their own content rows. So it is
|
|
74
|
+
// always empty, and it never validates anything. Marking such a field
|
|
75
|
+
// `required` is a misconfiguration, and this is what makes that visible
|
|
76
|
+
// rather than letting the rule silently pass on a value that can never
|
|
77
|
+
// be filled in.
|
|
78
|
+
"com.kardalum.contentlist": {
|
|
79
|
+
isEmpty: () => true,
|
|
80
|
+
},
|
|
81
|
+
// S234a Task 4c item 3. The file upload field holds no value either: the
|
|
82
|
+
// bytes, filename and size live on the media row, never in `data`. So it
|
|
83
|
+
// is always empty, and it never validates anything. Marking such a field
|
|
84
|
+
// `required` is a misconfiguration, and this is what makes that visible
|
|
85
|
+
// rather than letting the rule silently pass on a value that can never
|
|
86
|
+
// be filled in.
|
|
87
|
+
"com.kardalum.fileupload": {
|
|
88
|
+
isEmpty: () => true,
|
|
89
|
+
},
|
|
90
|
+
// S234c Task 4. A crop field is the opposite case: it DOES hold a value,
|
|
91
|
+
// the rectangle it last cut as fractions of the source, so "empty" is a
|
|
92
|
+
// real question rather than a constant. It means "never cut", which is
|
|
93
|
+
// what lets a webmaster mark a crop `required` and have that mean "this
|
|
94
|
+
// crop must be cut" without knowing the value's internal shape.
|
|
95
|
+
//
|
|
96
|
+
// Only absence counts as empty. A value that is an object but not a
|
|
97
|
+
// rectangle is something a caller wrote and got wrong, and reporting
|
|
98
|
+
// that as a missing field would point the editor at the wrong problem:
|
|
99
|
+
// the same rule com.kardalum.daterange follows above.
|
|
100
|
+
"com.kardalum.crop": {
|
|
101
|
+
isEmpty: (value) => typeof value !== "object" || value === null,
|
|
102
|
+
},
|
|
103
|
+
// A thumbnail holds no value at all: it is automatic, cut whenever bytes
|
|
104
|
+
// arrive, and the rendition row is the record of it. So it is always
|
|
105
|
+
// empty, the same reasoning (and the same misconfiguration warning) as
|
|
106
|
+
// com.kardalum.fileupload above.
|
|
107
|
+
"com.kardalum.thumbnail": {
|
|
108
|
+
isEmpty: () => true,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { BUILT_IN_SETTINGS_SCHEMAS } from "./built-in-settings-schemas.js";
|
|
2
|
+
export { BUILT_IN_VALUE_SCHEMAS } from "./built-in-value-schemas.js";
|
|
3
|
+
export { BUILT_IN_SERIALIZERS, identitySerializer, type DataTypeSerializer, } from "./built-in-serializers.js";
|
|
4
|
+
export { RENDITION_INELIGIBLE_TYPES, isRenditionIneligible } from "./rendition-eligibility.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The `@kardalum/plugin-sdk/datatypes` subpath: server-safe DATA and
|
|
2
|
+
// pure predicates about built-in editors only. No React, no side-effect
|
|
3
|
+
// registration, same "no browser weight in the server process" boundary as
|
|
4
|
+
// ./manifest (Session 60). Exists so apps/server's Data Type routes can
|
|
5
|
+
// validate config.settings against a built-in editor's settingsSchema
|
|
6
|
+
// without importing built-ins.tsx (React/@kardalum/ui). Third-party and
|
|
7
|
+
// remote plugin settingsSchemas are NOT coverable here: Module Federation
|
|
8
|
+
// remotes only ever load in the browser, so the server has no way to see
|
|
9
|
+
// one.
|
|
10
|
+
export { BUILT_IN_SETTINGS_SCHEMAS } from "./built-in-settings-schemas.js";
|
|
11
|
+
export { BUILT_IN_VALUE_SCHEMAS } from "./built-in-value-schemas.js";
|
|
12
|
+
export { BUILT_IN_SERIALIZERS, identitySerializer, } from "./built-in-serializers.js";
|
|
13
|
+
// S234c fix wave: the "no GIF, no SVG" rule, read by the cut route so a
|
|
14
|
+
// signed-in caller cannot post a "crop" of a format the browser refuses to
|
|
15
|
+
// offer one for. The set is declared once (rendition-eligibility.ts) and
|
|
16
|
+
// the crop view re-exports the same module, so the tile and the route can
|
|
17
|
+
// never disagree about which formats are cuttable.
|
|
18
|
+
export { RENDITION_INELIGIBLE_TYPES, isRenditionIneligible } from "./rendition-eligibility.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DataTypePlugin } from "./data-type-plugin.js";
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when a plugin definition fails validation — catchable by the
|
|
4
|
+
* registry's install() (Session 62) and `kardalum plugin validate`
|
|
5
|
+
* (Month 7), which want to report rather than crash.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PluginDefinitionError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Validate a datatype plugin definition and hand it back. This is the
|
|
12
|
+
* one code path into the registry: built-ins construct their plugin
|
|
13
|
+
* objects through it (see built-ins.tsx), and external plugins do the
|
|
14
|
+
* same — so a missing required view fails LOUDLY at definition time,
|
|
15
|
+
* never silently at render time (plugin-sdk.md).
|
|
16
|
+
*
|
|
17
|
+
* Deliberately does NOT register: Module Federation remotes (Session 66)
|
|
18
|
+
* export the defined plugin object, and the HOST decides when it enters
|
|
19
|
+
* the registry (install/activate lifecycle) — a define-time side effect
|
|
20
|
+
* would take that control away. Pass the result to registerDataType.
|
|
21
|
+
*
|
|
22
|
+
* Returns the ORIGINAL object (not a parsed clone) — a plugin carries
|
|
23
|
+
* React components and closures whose identity should survive.
|
|
24
|
+
*/
|
|
25
|
+
export declare function definePlugin(plugin: DataTypePlugin): DataTypePlugin;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DataTypePluginSchema, formatIssues } from "./manifest-schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when a plugin definition fails validation — catchable by the
|
|
4
|
+
* registry's install() (Session 62) and `kardalum plugin validate`
|
|
5
|
+
* (Month 7), which want to report rather than crash.
|
|
6
|
+
*/
|
|
7
|
+
export class PluginDefinitionError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "PluginDefinitionError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const REQUIRED_VIEWS = ["input", "readOnly", "settings"];
|
|
14
|
+
/**
|
|
15
|
+
* Validate a datatype plugin definition and hand it back. This is the
|
|
16
|
+
* one code path into the registry: built-ins construct their plugin
|
|
17
|
+
* objects through it (see built-ins.tsx), and external plugins do the
|
|
18
|
+
* same — so a missing required view fails LOUDLY at definition time,
|
|
19
|
+
* never silently at render time (plugin-sdk.md).
|
|
20
|
+
*
|
|
21
|
+
* Deliberately does NOT register: Module Federation remotes (Session 66)
|
|
22
|
+
* export the defined plugin object, and the HOST decides when it enters
|
|
23
|
+
* the registry (install/activate lifecycle) — a define-time side effect
|
|
24
|
+
* would take that control away. Pass the result to registerDataType.
|
|
25
|
+
*
|
|
26
|
+
* Returns the ORIGINAL object (not a parsed clone) — a plugin carries
|
|
27
|
+
* React components and closures whose identity should survive.
|
|
28
|
+
*/
|
|
29
|
+
export function definePlugin(plugin) {
|
|
30
|
+
const id = typeof plugin === "object" && plugin !== null && typeof plugin.id === "string"
|
|
31
|
+
? plugin.id
|
|
32
|
+
: "(unknown id)";
|
|
33
|
+
// Required views first, with purpose-built messages — Zod's generic
|
|
34
|
+
// "expected custom, received undefined" doesn't tell a plugin author
|
|
35
|
+
// what to fix.
|
|
36
|
+
const views = typeof plugin === "object" && plugin !== null ? plugin.views : undefined;
|
|
37
|
+
for (const viewName of REQUIRED_VIEWS) {
|
|
38
|
+
if (!views || views[viewName] == null) {
|
|
39
|
+
throw new PluginDefinitionError(`definePlugin: datatype plugin "${id}" is missing required view "${viewName}" ` +
|
|
40
|
+
`(input, readOnly and settings are required; preview is optional)`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const result = DataTypePluginSchema.safeParse(plugin);
|
|
44
|
+
if (!result.success) {
|
|
45
|
+
throw new PluginDefinitionError(`definePlugin: datatype plugin "${id}" is invalid:\n` +
|
|
46
|
+
formatIssues(result.error.issues)
|
|
47
|
+
.map((line) => ` - ${line}`)
|
|
48
|
+
.join("\n"));
|
|
49
|
+
}
|
|
50
|
+
return plugin;
|
|
51
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { EntitlementError, ENTITLEMENT_FLOOR_TABLE, isEntitlementError, requireEntitlement, structuredStorageFloor, type EntitlementFloor, type RequireEntitlementOptions, } from "./entitlement.js";
|
|
2
|
+
export { LICENSE_VERDICT_PUBLIC_KEYS } from "./license-verdict-keys.js";
|
|
3
|
+
export { isLocalHost } from "./local-host.js";
|
|
4
|
+
export type { Entitlement, EntitlementErrorCode, EntitlementVerdict, LicenseVerdictEnvelope, PluginTaskContext, } from "./entitlement-types.js";
|
|
5
|
+
export type { TrustedKey } from "@kardalum/plugin-package";
|