@kardalum/plugin-sdk 0.19.0 → 0.20.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 +211 -0
- package/README.md +19 -0
- package/dist/admin-section-registry.d.ts +16 -1
- package/dist/admin-section-registry.js +23 -0
- package/dist/built-in-editor-ids.d.ts +1 -1
- package/dist/built-in-editor-ids.js +2 -20
- package/dist/built-in-settings-schemas.d.ts +10 -0
- package/dist/built-in-settings-schemas.js +86 -0
- package/dist/built-in-value-schemas.js +35 -0
- package/dist/built-ins.js +38 -7
- package/dist/capabilities.d.ts +11 -1
- package/dist/capabilities.js +55 -3
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +22 -0
- package/dist/content-library.d.ts +85 -0
- package/dist/content-library.js +15 -0
- package/dist/content-picker/page-picker-sheet.d.ts +13 -0
- package/dist/content-picker/page-picker-sheet.js +105 -0
- package/dist/content-picker/page-tree.d.ts +25 -0
- package/dist/content-picker/page-tree.js +132 -0
- package/dist/data-type-plugin.d.ts +7 -1
- package/dist/datatype-validation.d.ts +4 -9
- package/dist/datatype-validation.js +139 -1
- package/dist/entitlement-entry.d.ts +1 -1
- package/dist/entitlement-entry.js +1 -1
- package/dist/entitlement-gate.d.ts +14 -0
- package/dist/entitlement-gate.js +64 -7
- package/dist/entitlement-plan.d.ts +6 -0
- package/dist/entitlement-plan.js +10 -0
- package/dist/entitlement-types.d.ts +36 -12
- package/dist/entitlement.d.ts +31 -4
- package/dist/entitlement.js +58 -17
- package/dist/hook-entry.d.ts +5 -0
- package/dist/hook-entry.js +30 -0
- package/dist/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +36 -4
- package/dist/index.js +50 -3
- package/dist/mail.d.ts +30 -0
- package/dist/mail.js +1 -0
- package/dist/manifest-entry.d.ts +29 -4
- package/dist/manifest-entry.js +39 -2
- package/dist/manifest-schema.d.ts +443 -29
- package/dist/manifest-schema.js +285 -23
- package/dist/manifest.d.ts +450 -51
- package/dist/manifest.js +1 -1
- package/dist/media/media-picker.js +31 -18
- package/dist/media/upload-error.d.ts +5 -1
- package/dist/media/upload-error.js +14 -2
- package/dist/media-library.d.ts +32 -0
- package/dist/media-library.js +15 -0
- package/dist/nested-field-host.d.ts +76 -0
- package/dist/nested-field-host.js +90 -0
- package/dist/notify.d.ts +12 -4
- package/dist/notify.js +1 -1
- package/dist/outbound.d.ts +47 -0
- package/dist/outbound.js +1 -0
- package/dist/plugin-context.d.ts +5 -0
- package/dist/plugin-screen-context.d.ts +112 -0
- package/dist/plugin-screen-context.js +26 -0
- package/dist/providers.d.ts +268 -0
- package/dist/providers.js +74 -0
- package/dist/read-all-pages.d.ts +5 -0
- package/dist/read-all-pages.js +3 -2
- package/dist/richtext/block-panel.js +11 -6
- package/dist/richtext/insert-menu.js +9 -6
- package/dist/richtext/style-listbox.js +6 -4
- package/dist/sdk-strings.d.ts +285 -0
- package/dist/sdk-strings.js +347 -0
- package/dist/sealing.d.ts +14 -0
- package/dist/sealing.js +1 -0
- package/dist/simple-storage-value-provider.js +24 -24
- package/dist/structured-storage-types.d.ts +309 -9
- package/dist/text-entry.d.ts +1 -0
- package/dist/text-entry.js +6 -0
- package/dist/tokens/tailwind-theme.css +5 -0
- package/dist/tokens/tokens.css +15 -3
- package/dist/tokens/tokens.json +8 -3
- package/dist/views/asset-view.js +4 -1
- package/dist/views/content-list-preview.js +3 -1
- package/dist/views/content-list-settings-view.js +11 -7
- package/dist/views/content-list-view.d.ts +5 -3
- package/dist/views/content-list-view.js +38 -34
- package/dist/views/content-picker-view.d.ts +3 -0
- package/dist/views/content-picker-view.js +143 -0
- package/dist/views/crop-view.d.ts +4 -6
- package/dist/views/crop-view.js +22 -13
- package/dist/views/date-range-view.js +4 -1
- package/dist/views/file-upload-view.d.ts +5 -7
- package/dist/views/file-upload-view.js +16 -7
- package/dist/views/group-view.d.ts +8 -0
- package/dist/views/group-view.js +123 -0
- package/dist/views/html-view.js +7 -6
- package/dist/views/image-view.js +37 -19
- package/dist/views/link-view.d.ts +3 -0
- package/dist/views/link-view.js +150 -0
- package/dist/views/options-list-view.d.ts +3 -0
- package/dist/views/options-list-view.js +104 -0
- package/dist/views/repeatable-list-view.d.ts +3 -0
- package/dist/views/repeatable-list-view.js +113 -0
- package/dist/views/rich-text-view.js +28 -13
- package/dist/views/suggest-key.d.ts +17 -0
- package/dist/views/suggest-key.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +215 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +179 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +7 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +126 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +115 -3
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +58 -11
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +57 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +137 -0
- package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +10 -5
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +7 -4
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +180 -15
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +41 -5
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +90 -5
- package/node_modules/@kardalum/api-schemas/dist/form-protection.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection.js +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +117 -41
- package/node_modules/@kardalum/api-schemas/dist/index.js +89 -26
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +224 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +404 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +312 -8
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +43 -3
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +13 -1
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +53 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +284 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +5 -5
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +1 -2
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +1 -2
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.js +177 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +258 -7
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +96 -5
- package/node_modules/@kardalum/api-schemas/dist/page-address.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/page-address.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.d.ts +34 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +28 -3
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +55 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.d.ts +76 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.js +316 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +42 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +74 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +26 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +26 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.d.ts +228 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +124 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.js +51 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.d.ts +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.js +21 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +38 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +237 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +205 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +29 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +32 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +120 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +335 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +242 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +16 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +34 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.js +139 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +22 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +31 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.js +150 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +310 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +430 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.d.ts +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.js +114 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +342 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +400 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +180 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +612 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +47 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +100 -12
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.d.ts +189 -0
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.js +164 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +82 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +497 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.d.ts +82 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +91 -1
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +90 -8
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +59 -1
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +110 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +34 -2
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +384 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +616 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +160 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +58 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +34 -3
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
- package/node_modules/@kardalum/api-schemas/package.json +1 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +6 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +5 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +15 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +12 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +8 -3
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +21 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +8 -2
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +355 -22
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +2 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.js +353 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.js +26 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +34 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.js +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +47 -5
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.d.ts +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +95 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +9 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.js +68 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +298 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +25 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +91 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +140 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +36 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +21 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +10 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +2 -1
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +75 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +123 -0
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +1 -2
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +6 -1
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +5 -4
- package/package.json +12 -2
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PLUGIN_SETTING_DESCRIPTION_MAX, PluginLabelSchema, labelMapSchema, pluginDescriptionSchema, resolveLabel } from "./plugin-labels.js";
|
|
3
|
+
import { declaredPluginSecretsOf, isPluginSecretName } from "./plugin-secrets.js";
|
|
4
|
+
// M32 F4d (D1): the settings fields a plugin declares in `contributions.settings`. The core draws
|
|
5
|
+
// them, checks and stores the values, and hands them back through the plugin's context. Every
|
|
6
|
+
// rule and limit lives here; the SDK's manifest schema and the delivery check import them.
|
|
7
|
+
// An id and a choice value are checked by linear scans with a length cap first, never a regular
|
|
8
|
+
// expression on text a plugin author wrote.
|
|
9
|
+
/** D1: the most fields one plugin declares. */
|
|
10
|
+
export const PLUGIN_SETTINGS_FIELDS_MAX = 32;
|
|
11
|
+
/** D1: a field's id, 1 to 40 characters. */
|
|
12
|
+
export const PLUGIN_SETTING_ID_MAX = 40;
|
|
13
|
+
/** D1: the most a text field's `maxLength` may be set to. */
|
|
14
|
+
export const PLUGIN_SETTING_TEXT_MAX = 4096;
|
|
15
|
+
/** D1: a text field's `maxLength` when it names none. */
|
|
16
|
+
export const PLUGIN_SETTING_TEXT_DEFAULT_MAX = 1024;
|
|
17
|
+
/** D1: the most choices one choice field offers. */
|
|
18
|
+
export const PLUGIN_SETTING_CHOICES_MAX = 64;
|
|
19
|
+
/** D1: a choice value, 1 to 100 characters. */
|
|
20
|
+
export const PLUGIN_SETTING_CHOICE_VALUE_MAX = 100;
|
|
21
|
+
export { PLUGIN_SETTING_DESCRIPTION_MAX };
|
|
22
|
+
export const PLUGIN_SETTING_TYPES = ["text", "number", "onOff", "choice", "secret"];
|
|
23
|
+
function isAsciiLetter(code) {
|
|
24
|
+
return (code >= 65 && code <= 90) || (code >= 97 && code <= 122);
|
|
25
|
+
}
|
|
26
|
+
/** D1: a field's id: a letter first, then letters, digits and "_", 1 to 40. A linear scan. */
|
|
27
|
+
export function isPluginSettingId(value) {
|
|
28
|
+
if (typeof value !== "string" || value.length === 0 || value.length > PLUGIN_SETTING_ID_MAX)
|
|
29
|
+
return false;
|
|
30
|
+
if (!isAsciiLetter(value.charCodeAt(0)))
|
|
31
|
+
return false;
|
|
32
|
+
for (let i = 1; i < value.length; i++) {
|
|
33
|
+
const code = value.charCodeAt(i);
|
|
34
|
+
if (!isAsciiLetter(code) && !(code >= 48 && code <= 57) && code !== 95)
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
const idSchema = z.string().refine(isPluginSettingId, {
|
|
40
|
+
message: `must be 1 to ${PLUGIN_SETTING_ID_MAX} characters: a letter, then letters, digits and "_"`,
|
|
41
|
+
});
|
|
42
|
+
/** A field's description: a string or a language map with English, trimmed, each text at most
|
|
43
|
+
* PLUGIN_SETTING_DESCRIPTION_MAX characters (a label's rule at a longer cap). */
|
|
44
|
+
export const PluginSettingDescriptionSchema = pluginDescriptionSchema();
|
|
45
|
+
const base = {
|
|
46
|
+
id: idSchema,
|
|
47
|
+
label: PluginLabelSchema,
|
|
48
|
+
description: PluginSettingDescriptionSchema.optional(),
|
|
49
|
+
askAtInstall: z.boolean().optional(),
|
|
50
|
+
};
|
|
51
|
+
const choiceSchema = z
|
|
52
|
+
.object({
|
|
53
|
+
value: z.string().min(1).max(PLUGIN_SETTING_CHOICE_VALUE_MAX),
|
|
54
|
+
label: PluginLabelSchema,
|
|
55
|
+
})
|
|
56
|
+
.strict();
|
|
57
|
+
const finite = z.number().finite();
|
|
58
|
+
const textFieldSchema = z
|
|
59
|
+
.object({
|
|
60
|
+
...base,
|
|
61
|
+
type: z.literal("text"),
|
|
62
|
+
default: z.string().optional(),
|
|
63
|
+
maxLength: z.number().int().min(1).max(PLUGIN_SETTING_TEXT_MAX).optional(),
|
|
64
|
+
multiline: z.boolean().optional(),
|
|
65
|
+
})
|
|
66
|
+
.strict()
|
|
67
|
+
.superRefine((field, ctx) => {
|
|
68
|
+
const max = field.maxLength ?? PLUGIN_SETTING_TEXT_DEFAULT_MAX;
|
|
69
|
+
if (field.default !== undefined && field.default.length > max) {
|
|
70
|
+
ctx.addIssue({ code: "custom", path: ["default"], message: `default is longer than maxLength (${max})` });
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const numberFieldSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
...base,
|
|
76
|
+
type: z.literal("number"),
|
|
77
|
+
default: finite.optional(),
|
|
78
|
+
min: finite.optional(),
|
|
79
|
+
max: finite.optional(),
|
|
80
|
+
integer: z.boolean().optional(),
|
|
81
|
+
})
|
|
82
|
+
.strict()
|
|
83
|
+
.superRefine((field, ctx) => {
|
|
84
|
+
if (field.min !== undefined && field.max !== undefined && field.min > field.max) {
|
|
85
|
+
ctx.addIssue({ code: "custom", path: ["min"], message: "min is above max" });
|
|
86
|
+
}
|
|
87
|
+
const d = field.default;
|
|
88
|
+
if (d === undefined)
|
|
89
|
+
return;
|
|
90
|
+
if (field.min !== undefined && d < field.min)
|
|
91
|
+
ctx.addIssue({ code: "custom", path: ["default"], message: "default is below min" });
|
|
92
|
+
if (field.max !== undefined && d > field.max)
|
|
93
|
+
ctx.addIssue({ code: "custom", path: ["default"], message: "default is above max" });
|
|
94
|
+
if (field.integer === true && !Number.isInteger(d))
|
|
95
|
+
ctx.addIssue({ code: "custom", path: ["default"], message: "default is not a whole number" });
|
|
96
|
+
});
|
|
97
|
+
const onOffFieldSchema = z.object({ ...base, type: z.literal("onOff"), default: z.boolean().optional() }).strict();
|
|
98
|
+
const choiceFieldSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
...base,
|
|
101
|
+
type: z.literal("choice"),
|
|
102
|
+
default: z.string().optional(),
|
|
103
|
+
choices: z.array(choiceSchema).min(1).max(PLUGIN_SETTING_CHOICES_MAX),
|
|
104
|
+
})
|
|
105
|
+
.strict()
|
|
106
|
+
.superRefine((field, ctx) => {
|
|
107
|
+
const seen = new Set();
|
|
108
|
+
field.choices.forEach((choice, index) => {
|
|
109
|
+
if (seen.has(choice.value))
|
|
110
|
+
ctx.addIssue({ code: "custom", path: ["choices", index, "value"], message: `choice value "${choice.value}" is listed twice` });
|
|
111
|
+
seen.add(choice.value);
|
|
112
|
+
});
|
|
113
|
+
if (field.default !== undefined && !seen.has(field.default)) {
|
|
114
|
+
ctx.addIssue({ code: "custom", path: ["default"], message: "default is not one of the choices" });
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const secretFieldSchema = z
|
|
118
|
+
.object({
|
|
119
|
+
...base,
|
|
120
|
+
type: z.literal("secret"),
|
|
121
|
+
secret: z.string().refine(isPluginSecretName, { message: "must be a secret name (a-z first, then a-z, 0-9 and \"_\")" }),
|
|
122
|
+
})
|
|
123
|
+
.strict();
|
|
124
|
+
export const PluginSettingFieldSchema = z.discriminatedUnion("type", [
|
|
125
|
+
textFieldSchema,
|
|
126
|
+
numberFieldSchema,
|
|
127
|
+
onOffFieldSchema,
|
|
128
|
+
choiceFieldSchema,
|
|
129
|
+
secretFieldSchema,
|
|
130
|
+
]);
|
|
131
|
+
export const PluginSettingsDeclarationSchema = z.array(PluginSettingFieldSchema).max(PLUGIN_SETTINGS_FIELDS_MAX);
|
|
132
|
+
/**
|
|
133
|
+
* D1: the cross-field rules a single field cannot see: a unique id, a secret field naming a secret the
|
|
134
|
+
* plugin declares, and each secret named by at most one field. `path` is relative to the settings list.
|
|
135
|
+
*/
|
|
136
|
+
export function checkPluginSettingsDeclaration(fields, declaredSecretNames) {
|
|
137
|
+
const problems = [];
|
|
138
|
+
const declared = new Set(declaredSecretNames);
|
|
139
|
+
const ids = new Set();
|
|
140
|
+
const secretsUsed = new Set();
|
|
141
|
+
if (fields.length > PLUGIN_SETTINGS_FIELDS_MAX) {
|
|
142
|
+
problems.push({ path: "", message: `at most ${PLUGIN_SETTINGS_FIELDS_MAX} plugin settings fields` });
|
|
143
|
+
}
|
|
144
|
+
fields.forEach((field, index) => {
|
|
145
|
+
if (ids.has(field.id))
|
|
146
|
+
problems.push({ path: `${index}.id`, message: `plugin settings field id "${field.id}" is declared twice` });
|
|
147
|
+
ids.add(field.id);
|
|
148
|
+
if (field.type !== "secret")
|
|
149
|
+
return;
|
|
150
|
+
if (!declared.has(field.secret)) {
|
|
151
|
+
problems.push({ path: `${index}.secret`, message: `plugin settings field "${field.id}" names the secret "${field.secret}", which contributions.secrets does not declare` });
|
|
152
|
+
}
|
|
153
|
+
else if (secretsUsed.has(field.secret)) {
|
|
154
|
+
problems.push({ path: `${index}.secret`, message: `the secret "${field.secret}" is named by more than one plugin settings field` });
|
|
155
|
+
}
|
|
156
|
+
secretsUsed.add(field.secret);
|
|
157
|
+
});
|
|
158
|
+
return problems;
|
|
159
|
+
}
|
|
160
|
+
/** The zod rule for one non-secret field's value. */
|
|
161
|
+
function valueSchemaFor(field) {
|
|
162
|
+
switch (field.type) {
|
|
163
|
+
case "text":
|
|
164
|
+
return z.string().max(field.maxLength ?? PLUGIN_SETTING_TEXT_DEFAULT_MAX);
|
|
165
|
+
case "number": {
|
|
166
|
+
let rule = finite;
|
|
167
|
+
if (field.integer === true)
|
|
168
|
+
rule = rule.int();
|
|
169
|
+
if (field.min !== undefined)
|
|
170
|
+
rule = rule.min(field.min);
|
|
171
|
+
if (field.max !== undefined)
|
|
172
|
+
rule = rule.max(field.max);
|
|
173
|
+
return rule.nullable();
|
|
174
|
+
}
|
|
175
|
+
case "onOff":
|
|
176
|
+
return z.boolean();
|
|
177
|
+
case "choice": {
|
|
178
|
+
const allowed = new Set(field.choices.map((choice) => choice.value));
|
|
179
|
+
return z.string().refine((value) => allowed.has(value), { message: "is not one of the choices" }).nullable();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* D1: the schema of a settings write: an object of the declared non-secret fields (each optional),
|
|
185
|
+
* strict, so an unknown id and a secret's id are refused. `only` narrows the fields (the install
|
|
186
|
+
* dialog asks for those marked `askAtInstall`).
|
|
187
|
+
*/
|
|
188
|
+
export function pluginSettingsValuesSchema(fields, opts) {
|
|
189
|
+
const shape = {};
|
|
190
|
+
for (const field of fields) {
|
|
191
|
+
if (field.type === "secret")
|
|
192
|
+
continue;
|
|
193
|
+
if (opts?.only !== undefined && !opts.only(field))
|
|
194
|
+
continue;
|
|
195
|
+
shape[field.id] = valueSchemaFor(field).optional();
|
|
196
|
+
}
|
|
197
|
+
return z.object(shape).strict();
|
|
198
|
+
}
|
|
199
|
+
/** D1: a non-secret field's default: its declared one, else text "", number null, onOff false, choice null. */
|
|
200
|
+
export function pluginSettingDefault(field) {
|
|
201
|
+
switch (field.type) {
|
|
202
|
+
case "text":
|
|
203
|
+
return field.default ?? "";
|
|
204
|
+
case "number":
|
|
205
|
+
return field.default ?? null;
|
|
206
|
+
case "onOff":
|
|
207
|
+
return field.default ?? false;
|
|
208
|
+
case "choice":
|
|
209
|
+
return field.default ?? null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* D2: every declared non-secret field with its stored value when that still passes the field's rule,
|
|
214
|
+
* else its default. Never throws: `stored` may be anything, `null` included. It may be the registry
|
|
215
|
+
* column (`{ values, updatedAt }`) or the values map itself; a value is never an object, so the two
|
|
216
|
+
* cannot be confused.
|
|
217
|
+
*/
|
|
218
|
+
export function resolvePluginSettings(fields, stored) {
|
|
219
|
+
let values = {};
|
|
220
|
+
if (typeof stored === "object" && stored !== null && !Array.isArray(stored)) {
|
|
221
|
+
const inner = Object.hasOwn(stored, "values") ? stored.values : undefined;
|
|
222
|
+
if (typeof inner === "object" && inner !== null && !Array.isArray(inner))
|
|
223
|
+
values = inner;
|
|
224
|
+
else
|
|
225
|
+
values = stored;
|
|
226
|
+
}
|
|
227
|
+
const out = {};
|
|
228
|
+
for (const field of fields) {
|
|
229
|
+
if (field.type === "secret")
|
|
230
|
+
continue;
|
|
231
|
+
let value = pluginSettingDefault(field);
|
|
232
|
+
if (Object.hasOwn(values, field.id)) {
|
|
233
|
+
const parsed = valueSchemaFor(field).safeParse(values[field.id]);
|
|
234
|
+
if (parsed.success)
|
|
235
|
+
value = parsed.data;
|
|
236
|
+
}
|
|
237
|
+
out[field.id] = value;
|
|
238
|
+
}
|
|
239
|
+
return out;
|
|
240
|
+
}
|
|
241
|
+
// D4: the wire shapes of `GET` and `PUT /api/manage/v1/plugins/:pluginId/settings`.
|
|
242
|
+
const SettingValueSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
243
|
+
/** D4: one declared field as a screen draws it. Evidence 148: the Settings routes answer each label
|
|
244
|
+
* as declared (a string, or a language map the admin resolves in its own language); the install
|
|
245
|
+
* dialog and the setup wizard resolve them first. A secret field answers `set` and the secret's
|
|
246
|
+
* name, never a value. */
|
|
247
|
+
export const PluginSettingsFieldViewSchema = z
|
|
248
|
+
.object({
|
|
249
|
+
id: z.string(),
|
|
250
|
+
type: z.enum(PLUGIN_SETTING_TYPES),
|
|
251
|
+
label: PluginLabelSchema,
|
|
252
|
+
description: PluginSettingDescriptionSchema.nullable(),
|
|
253
|
+
askAtInstall: z.boolean(),
|
|
254
|
+
value: SettingValueSchema.optional(),
|
|
255
|
+
/** What "Reset to default" puts back. A secret field has none. */
|
|
256
|
+
default: SettingValueSchema.optional(),
|
|
257
|
+
set: z.boolean().optional(),
|
|
258
|
+
/** M32 I3 (B10): a non-secret field only: true when the plugin's row holds a stored value for it. */
|
|
259
|
+
stored: z.boolean().optional(),
|
|
260
|
+
secret: z.string().optional(),
|
|
261
|
+
choices: z.array(z.object({ value: z.string(), label: PluginLabelSchema }).strict()).optional(),
|
|
262
|
+
min: z.number().optional(),
|
|
263
|
+
max: z.number().optional(),
|
|
264
|
+
integer: z.boolean().optional(),
|
|
265
|
+
maxLength: z.number().int().optional(),
|
|
266
|
+
multiline: z.boolean().optional(),
|
|
267
|
+
})
|
|
268
|
+
.strict();
|
|
269
|
+
/**
|
|
270
|
+
* D4, D5: one declared field as a screen draws it, labels resolved to `language`, or kept as declared
|
|
271
|
+
* when `language` is null (evidence 148: the Settings routes, whose labels the admin resolves in the
|
|
272
|
+
* signed-in person's language, falling back as resolveLabel does). A non-secret field
|
|
273
|
+
* carries `value` (its default when `state` gives none) and `default`; a secret field its secret's
|
|
274
|
+
* name and `set`, never a value. The Settings routes, the setup wizard's starters and the install
|
|
275
|
+
* dialog all draw a field from this one shape.
|
|
276
|
+
*/
|
|
277
|
+
export function pluginSettingsFieldView(field, language, state = {}) {
|
|
278
|
+
const text = (label) => (language === null ? label : resolveLabel(label, language));
|
|
279
|
+
const base = {
|
|
280
|
+
id: field.id,
|
|
281
|
+
type: field.type,
|
|
282
|
+
label: text(field.label),
|
|
283
|
+
description: field.description === undefined ? null : text(field.description),
|
|
284
|
+
askAtInstall: field.askAtInstall === true,
|
|
285
|
+
};
|
|
286
|
+
if (field.type === "secret")
|
|
287
|
+
return { ...base, secret: field.secret, set: state.set === true };
|
|
288
|
+
const fallback = pluginSettingDefault(field);
|
|
289
|
+
const value = Object.hasOwn(state, "value") ? state.value : fallback;
|
|
290
|
+
const stored = state.stored === undefined ? {} : { stored: state.stored };
|
|
291
|
+
switch (field.type) {
|
|
292
|
+
case "text":
|
|
293
|
+
return { ...base, ...stored, value, default: fallback, maxLength: field.maxLength ?? PLUGIN_SETTING_TEXT_DEFAULT_MAX, multiline: field.multiline === true };
|
|
294
|
+
case "number":
|
|
295
|
+
return {
|
|
296
|
+
...base,
|
|
297
|
+
...stored,
|
|
298
|
+
value,
|
|
299
|
+
default: fallback,
|
|
300
|
+
...(field.min !== undefined ? { min: field.min } : {}),
|
|
301
|
+
...(field.max !== undefined ? { max: field.max } : {}),
|
|
302
|
+
integer: field.integer === true,
|
|
303
|
+
};
|
|
304
|
+
case "onOff":
|
|
305
|
+
return { ...base, ...stored, value, default: fallback };
|
|
306
|
+
case "choice":
|
|
307
|
+
return { ...base, ...stored, value, default: fallback, choices: field.choices.map((choice) => ({ value: choice.value, label: text(choice.label) })) };
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/** The outcomes a scheduled task run is recorded with. */
|
|
311
|
+
export const PLUGIN_TASK_RUN_OUTCOMES = ["ok", "failed", "timedOut", "skipped", "aborted"];
|
|
312
|
+
/** M32 I3 (B8): why a running task was aborted, stored as the run's message. */
|
|
313
|
+
export const PLUGIN_TASK_ABORT_REASONS = ["deactivated", "uninstalled", "updated"];
|
|
314
|
+
/** D13: one declared scheduled task on the Settings page (its last run is filled by the task runner).
|
|
315
|
+
* Evidence 148: `name` is the declared label (a string, or a language map the admin resolves), or
|
|
316
|
+
* the task's id when the label cannot be read. */
|
|
317
|
+
export const PluginSettingsTaskViewSchema = z
|
|
318
|
+
.object({
|
|
319
|
+
id: z.string(),
|
|
320
|
+
name: z.union([z.string(), labelMapSchema({ trim: true })]),
|
|
321
|
+
cron: z.string(),
|
|
322
|
+
lastRun: z
|
|
323
|
+
.object({ at: z.string(), outcome: z.enum(PLUGIN_TASK_RUN_OUTCOMES).nullable() })
|
|
324
|
+
.strict()
|
|
325
|
+
.nullable(),
|
|
326
|
+
})
|
|
327
|
+
.strict();
|
|
328
|
+
/** D4: the answer of both routes: the fields with their current values, when they were last saved, and the tasks. */
|
|
329
|
+
export const PluginSettingsResponseSchema = z
|
|
330
|
+
.object({
|
|
331
|
+
fields: z.array(PluginSettingsFieldViewSchema),
|
|
332
|
+
updatedAt: z.string().datetime().nullable(),
|
|
333
|
+
tasks: z.array(PluginSettingsTaskViewSchema),
|
|
334
|
+
})
|
|
335
|
+
.strict();
|
|
336
|
+
/** D4: the body of the `PUT`. Shape only: the field rules run in the route, against the declaration. */
|
|
337
|
+
export const PluginSettingsPutBodySchema = z
|
|
338
|
+
.object({
|
|
339
|
+
values: z
|
|
340
|
+
.record(z.string().max(PLUGIN_SETTING_ID_MAX), SettingValueSchema)
|
|
341
|
+
.refine((values) => Object.keys(values).length <= PLUGIN_SETTINGS_FIELDS_MAX, {
|
|
342
|
+
message: `at most ${PLUGIN_SETTINGS_FIELDS_MAX} plugin settings fields`,
|
|
343
|
+
}),
|
|
344
|
+
})
|
|
345
|
+
.strict();
|
|
346
|
+
/** D4: a refused `PUT`: what is wrong, keyed by field id. A value is never quoted. */
|
|
347
|
+
export const PluginSettingsErrorSchema = z
|
|
348
|
+
.object({
|
|
349
|
+
message: z.string(),
|
|
350
|
+
fieldErrors: z.record(z.string(), z.string()),
|
|
351
|
+
})
|
|
352
|
+
.strict();
|
|
353
|
+
/**
|
|
354
|
+
* D1: the settings fields `contributions` declares, each checked as the delivery check checks it:
|
|
355
|
+
* the field's own schema, the first of an id kept, a secret field kept only when it names a secret
|
|
356
|
+
* `declaredPluginSecretsOf` reads (its whole declaration judged) and no earlier field names, at most
|
|
357
|
+
* PLUGIN_SETTINGS_FIELDS_MAX read. A field that fails is left out, so it is never drawn, asked,
|
|
358
|
+
* written or read. The server's Settings page and the install questions both read this one list.
|
|
359
|
+
* Reads plain data only: a getter on `settings` that throws means no fields, one on `secrets` no
|
|
360
|
+
* secret fields.
|
|
361
|
+
*/
|
|
362
|
+
export function declaredSettingsFieldsOf(contributions) {
|
|
363
|
+
let entries;
|
|
364
|
+
let secrets;
|
|
365
|
+
try {
|
|
366
|
+
const list = contributions !== null && typeof contributions === "object" ? contributions.settings : undefined;
|
|
367
|
+
if (!Array.isArray(list))
|
|
368
|
+
return Object.freeze([]);
|
|
369
|
+
entries = list.slice(0, PLUGIN_SETTINGS_FIELDS_MAX);
|
|
370
|
+
secrets = new Set(declaredPluginSecretsOf(contributions).map((entry) => entry.name));
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
return Object.freeze([]);
|
|
374
|
+
}
|
|
375
|
+
const out = [];
|
|
376
|
+
const ids = new Set();
|
|
377
|
+
const secretsUsed = new Set();
|
|
378
|
+
for (const entry of entries) {
|
|
379
|
+
let parsed;
|
|
380
|
+
try {
|
|
381
|
+
parsed = PluginSettingFieldSchema.safeParse(entry);
|
|
382
|
+
}
|
|
383
|
+
catch {
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
if (!parsed.success)
|
|
387
|
+
continue;
|
|
388
|
+
const field = parsed.data;
|
|
389
|
+
if (ids.has(field.id))
|
|
390
|
+
continue;
|
|
391
|
+
if (field.type === "secret") {
|
|
392
|
+
if (!secrets.has(field.secret) || secretsUsed.has(field.secret))
|
|
393
|
+
continue;
|
|
394
|
+
secretsUsed.add(field.secret);
|
|
395
|
+
}
|
|
396
|
+
ids.add(field.id);
|
|
397
|
+
out.push(field);
|
|
398
|
+
}
|
|
399
|
+
return Object.freeze(out);
|
|
400
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PageHeadScriptOriginSchema, SITE_LOCATION_MAX } from "./plugin-https-origin.js";
|
|
3
|
+
export { PageHeadScriptOriginSchema, SITE_LOCATION_MAX };
|
|
4
|
+
export declare const SITE_ROUTE_METHODS: readonly ["GET", "POST"];
|
|
5
|
+
export type SiteRouteMethod = (typeof SITE_ROUTE_METHODS)[number];
|
|
6
|
+
export declare const SITE_ROUTES_MAX = 20;
|
|
7
|
+
export declare const SITE_ROUTE_PATH_MAX = 200;
|
|
8
|
+
export declare const SITE_ROUTE_SEGMENTS_MAX = 8;
|
|
9
|
+
export declare const SITE_ROUTE_SEGMENT_MAX = 100;
|
|
10
|
+
export declare const SITE_ROUTE_BODY_LIMIT_BYTES = 65536;
|
|
11
|
+
export declare const SITE_ROUTE_FORM_FIELDS_MAX = 200;
|
|
12
|
+
export declare const SITE_ROUTE_ANSWER_LIMIT_BYTES = 5242880;
|
|
13
|
+
export declare const SITE_FALLBACK_TIME_MS = 250;
|
|
14
|
+
export declare const SITE_REDIRECT_STATUSES: readonly [301, 302, 307, 308];
|
|
15
|
+
/** M33 K34: the longest a plugin may let a browser keep its fallback redirect, one day, in seconds. */
|
|
16
|
+
export declare const SITE_REDIRECT_MAX_AGE_MAX = 86400;
|
|
17
|
+
/** M33 K34: how long a 301 or 308 is kept when the plugin gives no `maxAgeSeconds`, one hour. */
|
|
18
|
+
export declare const SITE_REDIRECT_MAX_AGE_DEFAULT = 3600;
|
|
19
|
+
export declare const TEMPLATE_EXTENSIONS_MAX = 20;
|
|
20
|
+
export declare const TEMPLATE_NAME_MAX = 40;
|
|
21
|
+
export declare const TEMPLATE_CALL_TIME_MS = 250;
|
|
22
|
+
/** The time all of one render's plugin template calls may take together; half the render's own time limit. */
|
|
23
|
+
export declare const TEMPLATE_CALL_TIME_PER_RENDER_MS = 500;
|
|
24
|
+
export declare const TEMPLATE_CALLS_PER_RENDER_MAX = 2000;
|
|
25
|
+
export declare const TEMPLATE_DATA_DEPTH_MAX = 8;
|
|
26
|
+
export declare const TEMPLATE_DATA_VALUES_MAX = 10000;
|
|
27
|
+
export declare const TEMPLATE_DATA_TEXT_MAX_BYTES = 262144;
|
|
28
|
+
export declare const TEMPLATE_OUTPUT_LIMIT_BYTES = 65536;
|
|
29
|
+
export declare const PAGE_HEAD_ENTRIES_MAX = 20;
|
|
30
|
+
export declare const PAGE_HEAD_LIMIT_BYTES = 65536;
|
|
31
|
+
export declare const PAGE_HEAD_SCRIPT_ORIGINS_MAX = 10;
|
|
32
|
+
export declare const PAGE_HEAD_TIME_MS = 250;
|
|
33
|
+
export declare const PAGE_HEAD_CONTENT_MAX = 2000;
|
|
34
|
+
export declare const PAGE_HEAD_JSON_LD_MAX_BYTES = 32768;
|
|
35
|
+
export declare const PAGE_HEAD_ASSET_PATH_MAX = 500;
|
|
36
|
+
/** M33 K26 (SEO 2.16 C4): the `publicMediaUrl` reads one plugin's page head may make in one render; a fifth answers null. */
|
|
37
|
+
export declare const PAGE_HEAD_MEDIA_READS_MAX = 4;
|
|
38
|
+
/** M33 K27 (SEO 2.16 C5): the longest page title a plugin's title entry may give, in characters. */
|
|
39
|
+
export declare const PAGE_HEAD_TITLE_MAX = 300;
|
|
40
|
+
/** M33 K27: how much of a rendered page the core reads to find its <title> or </head>, in bytes. */
|
|
41
|
+
export declare const PAGE_TITLE_SCAN_BYTES = 65536;
|
|
42
|
+
export declare const PAGE_HEAD_LINK_RELS: readonly ["canonical", "alternate", "icon", "manifest", "preconnect", "dns-prefetch", "stylesheet"];
|
|
43
|
+
export declare const PUBLISHED_PAGES_LIMIT_DEFAULT = 100;
|
|
44
|
+
export declare const PUBLISHED_PAGES_LIMIT_MAX = 500;
|
|
45
|
+
export declare const PUBLISHED_PAGES_BATCHES_MAX = 5;
|
|
46
|
+
export declare const PAGE_ADDRESSES_TARGETS_MAX = 100;
|
|
47
|
+
export declare const RESERVED_TEMPLATE_WORDS: readonly string[];
|
|
48
|
+
/** M33 K71: the facts a template reads off `page` (and a listed page) ahead of a field of the same
|
|
49
|
+
* id, so a field with one of these ids is reached there only as `page.fields.<id>`. The renderer
|
|
50
|
+
* answers them by these names, and the document type editor warns on a field id among them. */
|
|
51
|
+
export declare const TEMPLATE_PAGE_FACTS: {
|
|
52
|
+
readonly children: "children";
|
|
53
|
+
readonly culture: "culture";
|
|
54
|
+
readonly parent: "parent";
|
|
55
|
+
readonly id: "id";
|
|
56
|
+
readonly url: "url";
|
|
57
|
+
readonly path: "path";
|
|
58
|
+
readonly type: "type";
|
|
59
|
+
readonly locale: "locale";
|
|
60
|
+
readonly publishedAt: "publishedAt";
|
|
61
|
+
readonly fields: "fields";
|
|
62
|
+
};
|
|
63
|
+
/** The tags Kardalum's engine adds to Liquid's own, each written with no block body. A parse-only
|
|
64
|
+
* engine (the CLI's templates check) knows them by name; the server's plugin-template-binding test
|
|
65
|
+
* pins the list against the engine. */
|
|
66
|
+
export declare const KARDALUM_TEMPLATE_TAGS: readonly string[];
|
|
67
|
+
/** A value a template filter or tag takes or gives back. */
|
|
68
|
+
export type TemplateData = string | number | boolean | null | TemplateData[] | {
|
|
69
|
+
[key: string]: TemplateData;
|
|
70
|
+
};
|
|
71
|
+
/** M32 F2 (D2, D3): why a declared site route path is refused, or null. */
|
|
72
|
+
export declare function siteRoutePathProblem(method: string, path: string): string | null;
|
|
73
|
+
/**
|
|
74
|
+
* M33 K33: the path a site fallback receives for an address: the address's path, percent-decoded, exactly as
|
|
75
|
+
* sent (a trailing slash stays). Null for an escape that does not decode and for a control character.
|
|
76
|
+
*/
|
|
77
|
+
export declare function fallbackPathOf(address: string): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* M33 K33: a location made of a stored target, the rest of a visitor's decoded path below a stored address and
|
|
80
|
+
* the visitor's query, or null. `rest` is split at "/" and every segment is percent-encoded; an empty, "." or ".."
|
|
81
|
+
* segment answers null. It goes before the stored target's own query and fragment, after one trailing "/" of the
|
|
82
|
+
* stored path is dropped. `query` is printable ASCII without "#" and is joined with "?" or "&". The result must
|
|
83
|
+
* pass `siteLocationProblem`. The scheme and host are never changed. Linear scans only.
|
|
84
|
+
*/
|
|
85
|
+
export declare function joinSiteLocation(stored: string, extra: {
|
|
86
|
+
rest?: string;
|
|
87
|
+
query?: string;
|
|
88
|
+
}): string | null;
|
|
89
|
+
/** M32 F2: why a redirect location (or a page head link) is refused, or null. A site path or an http(s) URL. */
|
|
90
|
+
export declare function siteLocationProblem(location: string): string | null;
|
|
91
|
+
/** M32 F2: a template filter or tag name as a plugin declares it (before its prefix). */
|
|
92
|
+
export declare function isTemplateExtensionName(value: string): boolean;
|
|
93
|
+
/** The plugin's template prefix: its id's last segment, "-" written "_". */
|
|
94
|
+
export declare function templatePrefixOf(pluginId: string): string;
|
|
95
|
+
/** The name a template uses for a plugin's filter or tag. */
|
|
96
|
+
export declare function templateNameOf(pluginId: string, name: string): string;
|
|
97
|
+
/** M32 F2 (D14): why a plugin id cannot carry template filters or tags, or null. */
|
|
98
|
+
export declare function templatePrefixProblem(pluginId: string): string | null;
|
|
99
|
+
/** M32 F2: one entry a plugin adds to a page's <head>. */
|
|
100
|
+
export declare const PageHeadEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
101
|
+
tag: z.ZodLiteral<"meta">;
|
|
102
|
+
name: z.ZodOptional<z.ZodString>;
|
|
103
|
+
property: z.ZodOptional<z.ZodString>;
|
|
104
|
+
content: z.ZodString;
|
|
105
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
106
|
+
tag: z.ZodLiteral<"link">;
|
|
107
|
+
rel: z.ZodEnum<{
|
|
108
|
+
canonical: "canonical";
|
|
109
|
+
icon: "icon";
|
|
110
|
+
alternate: "alternate";
|
|
111
|
+
manifest: "manifest";
|
|
112
|
+
preconnect: "preconnect";
|
|
113
|
+
"dns-prefetch": "dns-prefetch";
|
|
114
|
+
stylesheet: "stylesheet";
|
|
115
|
+
}>;
|
|
116
|
+
href: z.ZodString;
|
|
117
|
+
hreflang: z.ZodOptional<z.ZodString>;
|
|
118
|
+
type: z.ZodOptional<z.ZodString>;
|
|
119
|
+
media: z.ZodOptional<z.ZodString>;
|
|
120
|
+
crossorigin: z.ZodOptional<z.ZodLiteral<"anonymous">>;
|
|
121
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
122
|
+
tag: z.ZodLiteral<"script">;
|
|
123
|
+
src: z.ZodString;
|
|
124
|
+
async: z.ZodOptional<z.ZodBoolean>;
|
|
125
|
+
defer: z.ZodOptional<z.ZodBoolean>;
|
|
126
|
+
module: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
128
|
+
crossorigin: z.ZodOptional<z.ZodLiteral<"anonymous">>;
|
|
129
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
130
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
131
|
+
tag: z.ZodLiteral<"jsonLd">;
|
|
132
|
+
data: z.ZodUnknown;
|
|
133
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
134
|
+
tag: z.ZodLiteral<"title">;
|
|
135
|
+
text: z.ZodString;
|
|
136
|
+
}, z.core.$strict>], "tag">;
|
|
137
|
+
export type PageHeadEntry = z.infer<typeof PageHeadEntrySchema>;
|
|
138
|
+
/** M33 K48: the longest file path the rule accepts, in characters. */
|
|
139
|
+
export declare const PLUGIN_PUBLIC_FILE_PATH_MAX = 200;
|
|
140
|
+
/**
|
|
141
|
+
* M33 K48: the one rule for every manifest field that names a file in the plugin's `public/` folder
|
|
142
|
+
* (a head script, a provider's widget script, a sign-in mark). A path of 1 to 200 characters whose
|
|
143
|
+
* segments hold letters, digits, "-", "_" and "." only, with no empty, "." or ".." segment and no
|
|
144
|
+
* leading "/". "%", "?", "#" and "\" are outside the set, so no encoded dot segment and no query can
|
|
145
|
+
* change what the address names. One linear scan; the length is checked first.
|
|
146
|
+
*/
|
|
147
|
+
export declare function isPluginPublicFilePath(path: string): boolean;
|
|
148
|
+
/** M32 F2: a page head entry checked against the plugin that gave it. The reason never quotes the value.
|
|
149
|
+
* M33 K27: a title entry only from a plugin whose attached declaration says `setsTitle: true`. */
|
|
150
|
+
export declare function checkPageHeadEntry(entry: unknown, scope: {
|
|
151
|
+
pluginId: string;
|
|
152
|
+
scriptOrigins: readonly string[];
|
|
153
|
+
setsTitle?: boolean;
|
|
154
|
+
}): {
|
|
155
|
+
ok: true;
|
|
156
|
+
entry: PageHeadEntry;
|
|
157
|
+
} | {
|
|
158
|
+
ok: false;
|
|
159
|
+
reason: string;
|
|
160
|
+
};
|
|
161
|
+
/** M32 F2: what a plugin's site fallback answers for an address no page holds. */
|
|
162
|
+
export declare const SiteFallbackAnswerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
163
|
+
redirect: z.ZodObject<{
|
|
164
|
+
location: z.ZodString;
|
|
165
|
+
status: z.ZodLiteral<301 | 302 | 307 | 308>;
|
|
166
|
+
maxAgeSeconds: z.ZodOptional<z.ZodNumber>;
|
|
167
|
+
}, z.core.$strict>;
|
|
168
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
169
|
+
gone: z.ZodLiteral<true>;
|
|
170
|
+
}, z.core.$strict>]>;
|
|
171
|
+
export type SiteFallbackAnswer = z.infer<typeof SiteFallbackAnswerSchema>;
|
|
172
|
+
type Issue = {
|
|
173
|
+
path: (string | number)[];
|
|
174
|
+
message: string;
|
|
175
|
+
};
|
|
176
|
+
/** M32 F2: the site extension rules over a manifest (live or manifest.json), as `path: message` issues. */
|
|
177
|
+
export declare function checkSiteExtensionDeclarations(manifest: {
|
|
178
|
+
id?: unknown;
|
|
179
|
+
contributions?: unknown;
|
|
180
|
+
}): Issue[];
|