@kardalum/plugin-sdk 0.19.0 → 0.21.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 +281 -0
- package/README.md +19 -0
- package/dist/admin-section-registry.d.ts +48 -1
- package/dist/admin-section-registry.js +90 -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 +101 -4
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +22 -0
- package/dist/consent-entry.d.ts +11 -0
- package/dist/consent-entry.js +18 -0
- package/dist/content-library.d.ts +102 -0
- package/dist/content-library.js +15 -0
- package/dist/content-list-extensions.d.ts +50 -0
- package/dist/content-list-extensions.js +11 -0
- package/dist/content-picker/page-picker-sheet.d.ts +15 -0
- package/dist/content-picker/page-picker-sheet.js +105 -0
- package/dist/content-picker/page-picker.d.ts +18 -0
- package/dist/content-picker/page-picker.js +20 -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 +147 -1
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +2 -0
- 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 +53 -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 +7 -1
- package/dist/host-entry.js +14 -1
- package/dist/index.d.ts +67 -7
- package/dist/index.js +94 -6
- package/dist/mail.d.ts +34 -0
- package/dist/mail.js +1 -0
- package/dist/manifest-entry.d.ts +47 -4
- package/dist/manifest-entry.js +63 -2
- package/dist/manifest-schema.d.ts +993 -40
- package/dist/manifest-schema.js +516 -26
- package/dist/manifest.d.ts +1186 -62
- package/dist/manifest.js +8 -4
- 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 +52 -0
- package/dist/plugin-context.js +27 -0
- package/dist/plugin-permissions.d.ts +18 -0
- package/dist/plugin-permissions.js +25 -0
- package/dist/plugin-screen-context.d.ts +262 -9
- package/dist/plugin-screen-context.js +56 -0
- package/dist/providers.d.ts +313 -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/render-page.d.ts +15 -0
- package/dist/render-page.js +20 -0
- package/dist/richtext/block-panel.d.ts +12 -1
- package/dist/richtext/block-panel.js +36 -25
- package/dist/richtext/button-view.d.ts +11 -0
- package/dist/richtext/button-view.js +45 -0
- package/dist/richtext/content-guard.d.ts +4 -0
- package/dist/richtext/content-guard.js +27 -0
- package/dist/richtext/editor-handle.d.ts +34 -0
- package/dist/richtext/editor-handle.js +225 -0
- package/dist/richtext/extensions.d.ts +6 -0
- package/dist/richtext/extensions.js +16 -0
- package/dist/richtext/insert-menu.d.ts +6 -1
- package/dist/richtext/insert-menu.js +45 -22
- package/dist/richtext/item-attributes.d.ts +6 -0
- package/dist/richtext/item-attributes.js +19 -0
- package/dist/richtext/item-panel.d.ts +25 -0
- package/dist/richtext/item-panel.js +118 -0
- package/dist/richtext/item-view.d.ts +58 -0
- package/dist/richtext/item-view.js +172 -0
- package/dist/richtext/mark-form.d.ts +10 -0
- package/dist/richtext/mark-form.js +38 -0
- package/dist/richtext/paste-choice.d.ts +9 -0
- package/dist/richtext/paste-choice.js +13 -0
- package/dist/richtext/plugin-items.d.ts +72 -0
- package/dist/richtext/plugin-items.js +562 -0
- package/dist/richtext/plugin-mark-tooltips.d.ts +5 -0
- package/dist/richtext/plugin-mark-tooltips.js +44 -0
- package/dist/richtext/plugin-toolbar.d.ts +57 -0
- package/dist/richtext/plugin-toolbar.js +186 -0
- package/dist/richtext/rich-item-icons.d.ts +5 -0
- package/dist/richtext/rich-item-icons.js +42 -0
- package/dist/richtext/rich-items.d.ts +42 -0
- package/dist/richtext/rich-items.js +68 -0
- package/dist/richtext/rich-text-view-host.d.ts +24 -0
- package/dist/richtext/rich-text-view-host.js +11 -0
- package/dist/richtext/style-listbox.js +6 -4
- package/dist/richtext/toolbar-button.d.ts +16 -0
- package/dist/richtext/toolbar-button.js +9 -0
- package/dist/richtext/url-paste.d.ts +20 -0
- package/dist/richtext/url-paste.js +82 -0
- package/dist/richtext-html-entry.d.ts +5 -0
- package/dist/richtext-html-entry.js +11 -0
- package/dist/sdk-strings.d.ts +344 -0
- package/dist/sdk-strings.js +411 -0
- package/dist/sealing.d.ts +14 -0
- package/dist/sealing.js +1 -0
- package/dist/service-contract.d.ts +17 -0
- package/dist/service-contract.js +39 -0
- package/dist/services.d.ts +114 -0
- package/dist/services.js +1 -0
- package/dist/simple-storage-value-provider.js +24 -24
- package/dist/structured-storage-types.d.ts +429 -9
- package/dist/tailwind.js +10 -5
- package/dist/template-reads.d.ts +16 -0
- package/dist/template-reads.js +21 -0
- package/dist/testing-entry.d.ts +38 -0
- package/dist/testing-entry.js +173 -0
- package/dist/text-entry.d.ts +1 -0
- package/dist/text-entry.js +7 -0
- package/dist/tokens/system-dark.css +1 -0
- package/dist/tokens/tailwind-theme.css +7 -0
- package/dist/tokens/tokens.css +19 -3
- package/dist/tokens/tokens.json +13 -4
- package/dist/uploads.d.ts +43 -0
- package/dist/uploads.js +1 -0
- package/dist/user-library.d.ts +51 -0
- package/dist/user-library.js +15 -0
- package/dist/view-helpers.d.ts +18 -0
- package/dist/view-helpers.js +64 -0
- 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 +243 -40
- 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.d.ts +2 -0
- package/dist/views/rich-text-view.js +208 -35
- package/dist/views/suggest-key.d.ts +17 -0
- package/dist/views/suggest-key.js +55 -0
- package/dist/views/unreadable-rich-text.d.ts +17 -0
- package/dist/views/unreadable-rich-text.js +40 -0
- package/dist/visitors.d.ts +81 -0
- package/dist/visitors.js +1 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.js +39 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +334 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +254 -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 +11 -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 +8 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +144 -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 +137 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +178 -2
- 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-reads.schema.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.js +234 -0
- 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/contribution-issues.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/contribution-issues.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +55 -13
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +22 -10
- 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 +257 -15
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +78 -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/experimental-points.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/experimental-points.js +250 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.d.ts +29 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.js +31 -0
- 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/html-scan.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/html-scan.js +122 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.d.ts +48 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.js +381 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +162 -48
- package/node_modules/@kardalum/api-schemas/dist/index.js +137 -30
- 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/json-depth.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/json-depth.js +20 -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 +226 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +409 -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 +490 -10
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +53 -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 +38 -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 +5 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +8 -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 +60 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +333 -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/page-audience.schema.d.ts +87 -0
- package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.js +44 -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-admin-slots.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.js +61 -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 +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +84 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.d.ts +136 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.js +254 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.js +66 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.js +173 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.js +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.js +68 -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 +44 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +44 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +16 -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 +34 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +126 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.d.ts +24 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.js +53 -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-guards.d.ts +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-guards.js +118 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +119 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +216 -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 +46 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +41 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +304 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +220 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.d.ts +138 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.js +110 -0
- 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 +408 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +307 -23
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +23 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +61 -3
- 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 +23 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -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 +346 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +461 -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-rich-text.d.ts +638 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.js +533 -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-service-call.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.js +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.d.ts +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.js +123 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.d.ts +209 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.js +372 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.js +204 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +352 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +409 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +347 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +976 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.js +149 -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-styles.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-styles.js +13 -0
- 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/plugin-uploads.d.ts +96 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.js +185 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.d.ts +54 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.js +124 -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-cache.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/render-cache.js +263 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +307 -4
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.js +108 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +71 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +540 -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 +394 -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 +201 -1
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +36 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +97 -8
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +64 -1
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +136 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +53 -2
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.d.ts +724 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.js +408 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +386 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +618 -0
- package/node_modules/@kardalum/api-schemas/dist/site-consent.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/site-consent.js +122 -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 +70 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +188 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +33 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +26 -1
- 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 +72 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +36 -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/dist/visitor-accounts.d.ts +482 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.d.ts +109 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.js +62 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +15 -1
- package/node_modules/@kardalum/design-tokens/dist/system-dark.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +7 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +19 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +18 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +13 -4
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +5 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +38 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +17 -2
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +625 -35
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -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/contract-fingerprint.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.js +39 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.d.ts +23 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.js +351 -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/bundle.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
- 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 +47 -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 +40 -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/icons.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +76 -6
- 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 +99 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +6 -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 +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +316 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +40 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.js +173 -0
- 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 +150 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.js +35 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.js +71 -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 +69 -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 +17 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.js +36 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.js +33 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +8 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +7 -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/plugin-package/dist/public-suffix.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/public-suffix.js +23 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.js +28 -0
- package/node_modules/@kardalum/plugin-package/package.json +4 -0
- package/node_modules/@kardalum/ui/dist/components/select.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/select.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/textarea.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/textarea.js +7 -0
- 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/node_modules/@kardalum/ui/dist/index.d.ts +2 -0
- package/node_modules/@kardalum/ui/dist/index.js +2 -0
- package/package.json +25 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Where a public request goes: the site's own addresses, the delivery API (`/api/v1/`) or public media (`/media/`). */
|
|
3
|
+
export declare const SITE_REQUEST_SURFACES: readonly ["site", "delivery", "media"];
|
|
4
|
+
export type SiteRequestSurface = (typeof SITE_REQUEST_SURFACES)[number];
|
|
5
|
+
/** The request guards asked a request, in plugin id order; a fifth is skipped and logged. */
|
|
6
|
+
export declare const REQUEST_GUARDS_MAX = 4;
|
|
7
|
+
/** How long the core waits for one guard, in milliseconds. */
|
|
8
|
+
export declare const REQUEST_GUARD_TIME_MS = 50;
|
|
9
|
+
/** How long the core waits for all guards of one request together, counted on the plugins' calls only. */
|
|
10
|
+
export declare const REQUEST_GUARD_TIME_PER_REQUEST_MS = 100;
|
|
11
|
+
/** The statuses a guard may block with. */
|
|
12
|
+
export declare const REQUEST_GUARD_BLOCK_STATUSES: readonly [403, 404, 410, 429, 451, 503];
|
|
13
|
+
export type RequestGuardBlockStatus = (typeof REQUEST_GUARD_BLOCK_STATUSES)[number];
|
|
14
|
+
/** The longest text a block shows, in characters; written escaped. */
|
|
15
|
+
export declare const REQUEST_GUARD_MESSAGE_MAX = 300;
|
|
16
|
+
/** The longest wait a 429 or 503 block asks for, one day, in seconds. */
|
|
17
|
+
export declare const REQUEST_GUARD_RETRY_AFTER_MAX = 86400;
|
|
18
|
+
/** The plugins asked for headers of one response, in plugin id order; a fifth is skipped and logged. */
|
|
19
|
+
export declare const RESPONSE_HEADER_PLUGINS_MAX = 4;
|
|
20
|
+
/** How long the core waits for one plugin's headers, in milliseconds. */
|
|
21
|
+
export declare const RESPONSE_HEADERS_TIME_MS = 50;
|
|
22
|
+
/** How long the core waits for every plugin's headers of one response together, counted on the plugins' calls only. */
|
|
23
|
+
export declare const RESPONSE_HEADERS_TIME_PER_RESPONSE_MS = 100;
|
|
24
|
+
/** The header names one plugin's answer gives at most; more refuses the whole answer. */
|
|
25
|
+
export declare const RESPONSE_HEADERS_PER_PLUGIN_MAX = 8;
|
|
26
|
+
/** The longest header value, in characters (printable ASCII, so bytes too). */
|
|
27
|
+
export declare const RESPONSE_HEADER_VALUE_MAX = 4096;
|
|
28
|
+
/** The bytes of plugin headers one response carries at most (name, ": ", value and line end each). */
|
|
29
|
+
export declare const RESPONSE_HEADERS_BYTES_MAX = 16384;
|
|
30
|
+
/** The longest name the core reads before it compares it with the list. */
|
|
31
|
+
export declare const RESPONSE_HEADER_NAME_MAX = 64;
|
|
32
|
+
/** The only headers a plugin may add to a public answer, in the spelling the core writes. Never a
|
|
33
|
+
* cookie (consent, 35-P5), caching (35-P4's `pageCache`, whose headers the core writes for a rendered page),
|
|
34
|
+
* the type, length or location of an answer, or the core's CORS. After 1.0 the list only grows. */
|
|
35
|
+
export declare const RESPONSE_HEADER_NAMES: readonly ["Content-Security-Policy", "Content-Security-Policy-Report-Only", "Strict-Transport-Security", "Permissions-Policy", "Referrer-Policy", "X-Frame-Options", "Cross-Origin-Opener-Policy", "Cross-Origin-Embedder-Policy", "Cross-Origin-Resource-Policy", "Origin-Agent-Cluster", "X-Permitted-Cross-Domain-Policies", "X-DNS-Prefetch-Control", "X-Robots-Tag", "Reporting-Endpoints"];
|
|
36
|
+
export type ResponseHeaderName = (typeof RESPONSE_HEADER_NAMES)[number];
|
|
37
|
+
/** The listed name a plugin's key means, in the list's spelling, or null. The length is checked first. */
|
|
38
|
+
export declare function responseHeaderNameOf(name: string): ResponseHeaderName | null;
|
|
39
|
+
/** Why a header value is refused, or null: 1 to RESPONSE_HEADER_VALUE_MAX characters, each printable
|
|
40
|
+
* ASCII or tab, so no line break can start a second header. The reason never quotes the value. */
|
|
41
|
+
export declare function responseHeaderValueProblem(value: string): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* A response headers answer read without trusting it: a plain object (prototype Object or none) of at
|
|
44
|
+
* most RESPONSE_HEADERS_PER_PLUGIN_MAX keys. Each entry is kept in the list's spelling when its name is
|
|
45
|
+
* listed, given once (in any case) and its value is a string the value rule takes; every other entry is
|
|
46
|
+
* counted as refused. A getter is the plugin's code: a throw while reading refuses the whole answer.
|
|
47
|
+
*/
|
|
48
|
+
export declare function readResponseHeadersAnswer(raw: unknown): {
|
|
49
|
+
ok: true;
|
|
50
|
+
headers: Array<[ResponseHeaderName, string]>;
|
|
51
|
+
refused: number;
|
|
52
|
+
} | {
|
|
53
|
+
ok: false;
|
|
54
|
+
};
|
|
55
|
+
/** What a request guard answers instead of `null`: a block the core writes, or a redirect checked like a site fallback's. */
|
|
56
|
+
export declare const RequestGuardAnswerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
57
|
+
block: z.ZodObject<{
|
|
58
|
+
status: z.ZodLiteral<429 | 403 | 404 | 410 | 451 | 503>;
|
|
59
|
+
message: z.ZodOptional<z.ZodString>;
|
|
60
|
+
retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
63
|
+
redirect: z.ZodObject<{
|
|
64
|
+
location: z.ZodString;
|
|
65
|
+
status: z.ZodLiteral<301 | 302 | 307 | 308>;
|
|
66
|
+
maxAgeSeconds: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
}, z.core.$strict>;
|
|
68
|
+
}, z.core.$strict>]>;
|
|
69
|
+
export type RequestGuardAnswer = z.infer<typeof RequestGuardAnswerSchema>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SiteRedirectAnswerSchema } from "./plugin-site-extensions.js";
|
|
3
|
+
import { hasNoControlCharacter } from "./strict-url.js";
|
|
4
|
+
// M35 P2 (W2): the rules and limits of what a plugin does with a public request before anything
|
|
5
|
+
// answers it (`requestGuard`) and with every public answer's headers (`responseHeaders`). Both run
|
|
6
|
+
// for the site's own addresses, public media and the delivery API only (the server's
|
|
7
|
+
// site-request-surface.ts), never for the admin, sign-in or the management API. Every character
|
|
8
|
+
// rule is one loop over a length-capped string, never a pattern match.
|
|
9
|
+
/** Where a public request goes: the site's own addresses, the delivery API (`/api/v1/`) or public media (`/media/`). */
|
|
10
|
+
export const SITE_REQUEST_SURFACES = ["site", "delivery", "media"];
|
|
11
|
+
/** The request guards asked a request, in plugin id order; a fifth is skipped and logged. */
|
|
12
|
+
export const REQUEST_GUARDS_MAX = 4;
|
|
13
|
+
/** How long the core waits for one guard, in milliseconds. */
|
|
14
|
+
export const REQUEST_GUARD_TIME_MS = 50;
|
|
15
|
+
/** How long the core waits for all guards of one request together, counted on the plugins' calls only. */
|
|
16
|
+
export const REQUEST_GUARD_TIME_PER_REQUEST_MS = 100;
|
|
17
|
+
/** The statuses a guard may block with. */
|
|
18
|
+
export const REQUEST_GUARD_BLOCK_STATUSES = [403, 404, 410, 429, 451, 503];
|
|
19
|
+
/** The longest text a block shows, in characters; written escaped. */
|
|
20
|
+
export const REQUEST_GUARD_MESSAGE_MAX = 300;
|
|
21
|
+
/** The longest wait a 429 or 503 block asks for, one day, in seconds. */
|
|
22
|
+
export const REQUEST_GUARD_RETRY_AFTER_MAX = 86_400;
|
|
23
|
+
/** The plugins asked for headers of one response, in plugin id order; a fifth is skipped and logged. */
|
|
24
|
+
export const RESPONSE_HEADER_PLUGINS_MAX = 4;
|
|
25
|
+
/** How long the core waits for one plugin's headers, in milliseconds. */
|
|
26
|
+
export const RESPONSE_HEADERS_TIME_MS = 50;
|
|
27
|
+
/** How long the core waits for every plugin's headers of one response together, counted on the plugins' calls only. */
|
|
28
|
+
export const RESPONSE_HEADERS_TIME_PER_RESPONSE_MS = 100;
|
|
29
|
+
/** The header names one plugin's answer gives at most; more refuses the whole answer. */
|
|
30
|
+
export const RESPONSE_HEADERS_PER_PLUGIN_MAX = 8;
|
|
31
|
+
/** The longest header value, in characters (printable ASCII, so bytes too). */
|
|
32
|
+
export const RESPONSE_HEADER_VALUE_MAX = 4_096;
|
|
33
|
+
/** The bytes of plugin headers one response carries at most (name, ": ", value and line end each). */
|
|
34
|
+
export const RESPONSE_HEADERS_BYTES_MAX = 16_384;
|
|
35
|
+
/** The longest name the core reads before it compares it with the list. */
|
|
36
|
+
export const RESPONSE_HEADER_NAME_MAX = 64;
|
|
37
|
+
/** The only headers a plugin may add to a public answer, in the spelling the core writes. Never a
|
|
38
|
+
* cookie (consent, 35-P5), caching (35-P4's `pageCache`, whose headers the core writes for a rendered page),
|
|
39
|
+
* the type, length or location of an answer, or the core's CORS. After 1.0 the list only grows. */
|
|
40
|
+
export const RESPONSE_HEADER_NAMES = [
|
|
41
|
+
"Content-Security-Policy",
|
|
42
|
+
"Content-Security-Policy-Report-Only",
|
|
43
|
+
"Strict-Transport-Security",
|
|
44
|
+
"Permissions-Policy",
|
|
45
|
+
"Referrer-Policy",
|
|
46
|
+
"X-Frame-Options",
|
|
47
|
+
"Cross-Origin-Opener-Policy",
|
|
48
|
+
"Cross-Origin-Embedder-Policy",
|
|
49
|
+
"Cross-Origin-Resource-Policy",
|
|
50
|
+
"Origin-Agent-Cluster",
|
|
51
|
+
"X-Permitted-Cross-Domain-Policies",
|
|
52
|
+
"X-DNS-Prefetch-Control",
|
|
53
|
+
"X-Robots-Tag",
|
|
54
|
+
"Reporting-Endpoints",
|
|
55
|
+
];
|
|
56
|
+
/** ASCII lower case, one loop; any other character stays as it is (and so matches no listed name). */
|
|
57
|
+
function asciiLower(value) {
|
|
58
|
+
let out = "";
|
|
59
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
60
|
+
const code = value.charCodeAt(index);
|
|
61
|
+
out += code >= 0x41 && code <= 0x5a ? String.fromCharCode(code + 0x20) : value[index];
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
const NAMES_BY_LOWER = new Map(RESPONSE_HEADER_NAMES.map((name) => [asciiLower(name), name]));
|
|
66
|
+
/** The listed name a plugin's key means, in the list's spelling, or null. The length is checked first. */
|
|
67
|
+
export function responseHeaderNameOf(name) {
|
|
68
|
+
if (typeof name !== "string" || name.length === 0 || name.length > RESPONSE_HEADER_NAME_MAX)
|
|
69
|
+
return null;
|
|
70
|
+
return NAMES_BY_LOWER.get(asciiLower(name)) ?? null;
|
|
71
|
+
}
|
|
72
|
+
/** Why a header value is refused, or null: 1 to RESPONSE_HEADER_VALUE_MAX characters, each printable
|
|
73
|
+
* ASCII or tab, so no line break can start a second header. The reason never quotes the value. */
|
|
74
|
+
export function responseHeaderValueProblem(value) {
|
|
75
|
+
if (typeof value !== "string")
|
|
76
|
+
return "is not a string";
|
|
77
|
+
if (value.length === 0)
|
|
78
|
+
return "is empty";
|
|
79
|
+
if (value.length > RESPONSE_HEADER_VALUE_MAX)
|
|
80
|
+
return `is more than ${RESPONSE_HEADER_VALUE_MAX} characters`;
|
|
81
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
82
|
+
const code = value.charCodeAt(index);
|
|
83
|
+
if (code !== 0x09 && (code < 0x20 || code > 0x7e))
|
|
84
|
+
return "holds a character that is not printable ASCII";
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A response headers answer read without trusting it: a plain object (prototype Object or none) of at
|
|
90
|
+
* most RESPONSE_HEADERS_PER_PLUGIN_MAX keys. Each entry is kept in the list's spelling when its name is
|
|
91
|
+
* listed, given once (in any case) and its value is a string the value rule takes; every other entry is
|
|
92
|
+
* counted as refused. A getter is the plugin's code: a throw while reading refuses the whole answer.
|
|
93
|
+
*/
|
|
94
|
+
export function readResponseHeadersAnswer(raw) {
|
|
95
|
+
if (raw === null || typeof raw !== "object")
|
|
96
|
+
return { ok: false };
|
|
97
|
+
let keys;
|
|
98
|
+
try {
|
|
99
|
+
// Inside the try: Array.isArray throws on a revoked Proxy.
|
|
100
|
+
if (Array.isArray(raw))
|
|
101
|
+
return { ok: false };
|
|
102
|
+
const prototype = Object.getPrototypeOf(raw);
|
|
103
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
104
|
+
return { ok: false };
|
|
105
|
+
keys = Object.keys(raw);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return { ok: false };
|
|
109
|
+
}
|
|
110
|
+
if (keys.length > RESPONSE_HEADERS_PER_PLUGIN_MAX)
|
|
111
|
+
return { ok: false };
|
|
112
|
+
const headers = [];
|
|
113
|
+
const seen = new Set();
|
|
114
|
+
let refused = 0;
|
|
115
|
+
for (const key of keys) {
|
|
116
|
+
let value;
|
|
117
|
+
try {
|
|
118
|
+
value = raw[key];
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return { ok: false };
|
|
122
|
+
}
|
|
123
|
+
const name = responseHeaderNameOf(key);
|
|
124
|
+
if (name === null || seen.has(name) || typeof value !== "string" || responseHeaderValueProblem(value) !== null) {
|
|
125
|
+
refused += 1;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
seen.add(name);
|
|
129
|
+
headers.push([name, value]);
|
|
130
|
+
}
|
|
131
|
+
return { ok: true, headers, refused };
|
|
132
|
+
}
|
|
133
|
+
const guardMessage = z
|
|
134
|
+
.string()
|
|
135
|
+
.min(1)
|
|
136
|
+
.max(REQUEST_GUARD_MESSAGE_MAX)
|
|
137
|
+
.refine(hasNoControlCharacter, { message: "holds no control character" });
|
|
138
|
+
const guardBlock = z
|
|
139
|
+
.strictObject({
|
|
140
|
+
status: z.literal(REQUEST_GUARD_BLOCK_STATUSES),
|
|
141
|
+
message: guardMessage.optional(),
|
|
142
|
+
retryAfterSeconds: z.number().int().min(1).max(REQUEST_GUARD_RETRY_AFTER_MAX).optional(),
|
|
143
|
+
})
|
|
144
|
+
.refine((block) => block.retryAfterSeconds === undefined || block.status === 429 || block.status === 503, {
|
|
145
|
+
message: "retryAfterSeconds is only for a 429 or 503 block",
|
|
146
|
+
path: ["retryAfterSeconds"],
|
|
147
|
+
});
|
|
148
|
+
/** What a request guard answers instead of `null`: a block the core writes, or a redirect checked like a site fallback's. */
|
|
149
|
+
export const RequestGuardAnswerSchema = z.union([z.strictObject({ block: guardBlock }), SiteRedirectAnswerSchema]);
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** M33 K30: the most bytes a simple storage value takes, serialised as JSON (UTF-8), on both doors. */
|
|
3
|
+
export declare const SIMPLE_STORAGE_VALUE_MAX_BYTES = 65536;
|
|
4
|
+
/**
|
|
5
|
+
* M33 K30: a value's size as stored, the UTF-8 bytes of its JSON, or null when JSON cannot hold it
|
|
6
|
+
* (undefined, a function, a BigInt, a cycle). One linear pass over the serialised text.
|
|
7
|
+
*/
|
|
8
|
+
export declare function simpleStorageValueBytes(value: unknown): number | null;
|
|
2
9
|
export declare const PluginStorageParamsSchema: z.ZodObject<{
|
|
3
10
|
pluginId: z.ZodString;
|
|
4
11
|
contentId: z.ZodString;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { CONTENT_LIST_FIELD_ID_MAX } from "./content-list.schema.js";
|
|
2
3
|
// SimpleStorageAPI's HTTP surface (Session 68): the SimpleStorageAPI
|
|
3
4
|
// interface is get(contentId, fieldId) / set(contentId, fieldId, value),
|
|
4
5
|
// with pluginId made explicit here as a required 3rd param: this is the
|
|
@@ -6,8 +7,43 @@ import { z } from "zod";
|
|
|
6
7
|
// (usePluginValue(), Session 70, resolves pluginId from React context and
|
|
7
8
|
// never asks a plugin author to pass it by hand).
|
|
8
9
|
// Matches FieldDefinition.id's shape (document-type.schema.ts), with the same
|
|
9
|
-
// stable key, just scoped to one plugin's stored value for that field.
|
|
10
|
-
|
|
10
|
+
// stable key, just scoped to one plugin's stored value for that field. M33 K30:
|
|
11
|
+
// and its cap (CONTENT_LIST_FIELD_ID_MAX, 64), the same on the server code's
|
|
12
|
+
// door (`context.simpleStorage`, which checks it with isContentListFieldId).
|
|
13
|
+
const FieldIdSchema = z.string().max(CONTENT_LIST_FIELD_ID_MAX, { abort: true }).regex(/^[a-zA-Z][a-zA-Z0-9_]*$/);
|
|
14
|
+
/** M33 K30: the most bytes a simple storage value takes, serialised as JSON (UTF-8), on both doors. */
|
|
15
|
+
export const SIMPLE_STORAGE_VALUE_MAX_BYTES = 65536;
|
|
16
|
+
/**
|
|
17
|
+
* M33 K30: a value's size as stored, the UTF-8 bytes of its JSON, or null when JSON cannot hold it
|
|
18
|
+
* (undefined, a function, a BigInt, a cycle). One linear pass over the serialised text.
|
|
19
|
+
*/
|
|
20
|
+
export function simpleStorageValueBytes(value) {
|
|
21
|
+
let text;
|
|
22
|
+
try {
|
|
23
|
+
text = JSON.stringify(value);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
if (typeof text !== "string")
|
|
29
|
+
return null;
|
|
30
|
+
let bytes = 0;
|
|
31
|
+
for (let i = 0; i < text.length; i++) {
|
|
32
|
+
const c = text.charCodeAt(i);
|
|
33
|
+
if (c < 0x80)
|
|
34
|
+
bytes += 1;
|
|
35
|
+
else if (c < 0x800)
|
|
36
|
+
bytes += 2;
|
|
37
|
+
else if (c >= 0xd800 && c <= 0xdbff && i + 1 < text.length && (text.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
|
|
38
|
+
// A surrogate pair is one character of four bytes.
|
|
39
|
+
bytes += 4;
|
|
40
|
+
i++;
|
|
41
|
+
}
|
|
42
|
+
else
|
|
43
|
+
bytes += 3;
|
|
44
|
+
}
|
|
45
|
+
return bytes;
|
|
46
|
+
}
|
|
11
47
|
// Deliberately NOT plugin-sdk's stricter reverse-DNS pluginIdSchema:
|
|
12
48
|
// plugin-sdk depends on api-schemas, not the reverse, so it can't be
|
|
13
49
|
// imported here without a cycle.
|
|
@@ -19,6 +55,13 @@ export const PluginStorageParamsSchema = z.object({
|
|
|
19
55
|
});
|
|
20
56
|
// `value` is z.unknown(), not a record: SimpleStorageAPI's value is
|
|
21
57
|
// untyped by design; a plugin can store a string, number, array, or
|
|
22
|
-
// object, not only key-value maps.
|
|
23
|
-
|
|
58
|
+
// object, not only key-value maps. M33 K30: at most SIMPLE_STORAGE_VALUE_MAX_BYTES
|
|
59
|
+
// serialised, as `context.simpleStorage.set` takes.
|
|
60
|
+
export const SetPluginFieldValueRequestSchema = z
|
|
61
|
+
.object({
|
|
62
|
+
value: z.unknown().refine((value) => (simpleStorageValueBytes(value) ?? 0) <= SIMPLE_STORAGE_VALUE_MAX_BYTES, {
|
|
63
|
+
message: `at most ${SIMPLE_STORAGE_VALUE_MAX_BYTES} bytes serialised as JSON`,
|
|
64
|
+
}),
|
|
65
|
+
})
|
|
66
|
+
.strict();
|
|
24
67
|
export const PluginFieldValueResponseSchema = z.object({ value: z.unknown() });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The admin's layer for every plugin stylesheet. */
|
|
2
|
+
export declare const PLUGIN_STYLES_LAYER = "plugins";
|
|
3
|
+
/** The plugin's own sub-layer: the id with each "." written "_" (an id holds no "_", so two ids never
|
|
4
|
+
* share a layer, and the name is one CSS identifier per dot-separated part). */
|
|
5
|
+
export declare function pluginStylesLayerName(pluginId: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// M35 C3 (design D3): the cascade layer a plugin's stylesheet sits in. The admin declares
|
|
2
|
+
// `@layer properties, theme, base, plugins, components, utilities;` first in its stylesheet, so a plugin's
|
|
3
|
+
// rules beat the admin's base reset and lose to its components and utilities where both set a property,
|
|
4
|
+
// and never touch the design token variables (unlayered); Tailwind's theme variables are kept by the check's
|
|
5
|
+
// refusal of `:root` and global rules. `kardalum plugin build` wraps each stylesheet in the plugin's own sub-layer; the
|
|
6
|
+
// "admin styles" delivery check refuses one that is not.
|
|
7
|
+
/** The admin's layer for every plugin stylesheet. */
|
|
8
|
+
export const PLUGIN_STYLES_LAYER = "plugins";
|
|
9
|
+
/** The plugin's own sub-layer: the id with each "." written "_" (an id holds no "_", so two ids never
|
|
10
|
+
* share a layer, and the name is one CSS identifier per dot-separated part). */
|
|
11
|
+
export function pluginStylesLayerName(pluginId) {
|
|
12
|
+
return `${PLUGIN_STYLES_LAYER}.${pluginId.split(".").join("_")}`;
|
|
13
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** D10: the most scheduled tasks one plugin declares. */
|
|
2
|
+
export declare const PLUGIN_SCHEDULED_TASKS_MAX = 5;
|
|
3
|
+
/** D10: the longest cron expression, in characters. */
|
|
4
|
+
export declare const CRON_EXPRESSION_MAX = 100;
|
|
5
|
+
/** D9: a run is given this long (10 minutes) before its signal aborts and its slot is freed. The
|
|
6
|
+
* server's task runner reads it; a plugin imports it through `@kardalum/plugin-sdk/manifest`. */
|
|
7
|
+
export declare const PLUGIN_TASK_TIME_MS = 600000;
|
|
8
|
+
/** M33 (Sign-in fix wave, N3): how long one step of an install or update may run plugin code before
|
|
9
|
+
* the server stops waiting, refuses the package, undoes what the registration wrote and frees the
|
|
10
|
+
* plugin's install lock. The steps are the import of server/plugin.js and each hook the registration
|
|
11
|
+
* runs (a migration's `up`, `onInstall`, `onUpdate`, `onActivate`). It is the time a scheduled task
|
|
12
|
+
* run is given, the longest the core gives plugin code for one piece of work, so a migration that
|
|
13
|
+
* fits in a task run fits here, and no hook can hold the lock for ever. */
|
|
14
|
+
export declare const PLUGIN_INSTALL_STEP_TIME_MS = 600000;
|
|
15
|
+
/** A parsed standard 5-field cron rule (minute, hour, day of month, month, day of week), UTC.
|
|
16
|
+
* `weekdays` holds 0 to 6 with Sunday 0 (a written 7 is folded to 0). A day field that begins
|
|
17
|
+
* with `*` is not restricted. */
|
|
18
|
+
export interface CronRule {
|
|
19
|
+
minutes: ReadonlySet<number>;
|
|
20
|
+
hours: ReadonlySet<number>;
|
|
21
|
+
days: ReadonlySet<number>;
|
|
22
|
+
months: ReadonlySet<number>;
|
|
23
|
+
weekdays: ReadonlySet<number>;
|
|
24
|
+
daysRestricted: boolean;
|
|
25
|
+
weekdaysRestricted: boolean;
|
|
26
|
+
}
|
|
27
|
+
export type CronParseResult = {
|
|
28
|
+
ok: true;
|
|
29
|
+
rule: CronRule;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
position: number;
|
|
33
|
+
message: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Parses a standard 5-field cron expression. Linear in the (capped) length, no regular expression.
|
|
37
|
+
* The fields are separated by single spaces (two spaces in a row leave a field empty); month and
|
|
38
|
+
* weekday names and `?` are not supported.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseCronExpression(text: string): CronParseResult;
|
|
41
|
+
/** True when the rule fires in the UTC minute containing `at`. When both day fields are
|
|
42
|
+
* restricted either may match (the standard cron rule); otherwise both must. */
|
|
43
|
+
export declare function cronMatches(rule: CronRule, at: Date): boolean;
|
|
44
|
+
/** An English phrase for the generated reference (UTC). The admin builds its own localised phrase. */
|
|
45
|
+
export declare function describeCron(rule: CronRule): string;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// M32 F4d (D10, D11): a plugin's scheduled tasks. The rules and limits live here; the SDK's
|
|
2
|
+
// manifest schema and the server's runner import them. A cron expression is text a plugin author
|
|
3
|
+
// wrote, so it is read by one linear scan with the length cap checked first and no regular
|
|
4
|
+
// expression: the work is bounded by CRON_EXPRESSION_MAX for any input.
|
|
5
|
+
/** D10: the most scheduled tasks one plugin declares. */
|
|
6
|
+
export const PLUGIN_SCHEDULED_TASKS_MAX = 5;
|
|
7
|
+
/** D10: the longest cron expression, in characters. */
|
|
8
|
+
export const CRON_EXPRESSION_MAX = 100;
|
|
9
|
+
/** D9: a run is given this long (10 minutes) before its signal aborts and its slot is freed. The
|
|
10
|
+
* server's task runner reads it; a plugin imports it through `@kardalum/plugin-sdk/manifest`. */
|
|
11
|
+
export const PLUGIN_TASK_TIME_MS = 600_000;
|
|
12
|
+
/** M33 (Sign-in fix wave, N3): how long one step of an install or update may run plugin code before
|
|
13
|
+
* the server stops waiting, refuses the package, undoes what the registration wrote and frees the
|
|
14
|
+
* plugin's install lock. The steps are the import of server/plugin.js and each hook the registration
|
|
15
|
+
* runs (a migration's `up`, `onInstall`, `onUpdate`, `onActivate`). It is the time a scheduled task
|
|
16
|
+
* run is given, the longest the core gives plugin code for one piece of work, so a migration that
|
|
17
|
+
* fits in a task run fits here, and no hook can hold the lock for ever. */
|
|
18
|
+
export const PLUGIN_INSTALL_STEP_TIME_MS = PLUGIN_TASK_TIME_MS;
|
|
19
|
+
const FIELDS = [
|
|
20
|
+
{ name: "minute", min: 0, max: 59 },
|
|
21
|
+
{ name: "hour", min: 0, max: 23 },
|
|
22
|
+
{ name: "day of month", min: 1, max: 31 },
|
|
23
|
+
{ name: "month", min: 1, max: 12 },
|
|
24
|
+
{ name: "day of week", min: 0, max: 7 },
|
|
25
|
+
];
|
|
26
|
+
// Reads a run of ASCII digits from `from` (at most 3, so a long run is refused early).
|
|
27
|
+
function readNumber(text, from, stop) {
|
|
28
|
+
let i = from;
|
|
29
|
+
let value = 0;
|
|
30
|
+
while (i < stop) {
|
|
31
|
+
const c = text.charCodeAt(i);
|
|
32
|
+
if (c < 48 || c > 57)
|
|
33
|
+
break;
|
|
34
|
+
value = value * 10 + (c - 48);
|
|
35
|
+
i += 1;
|
|
36
|
+
if (i - from > 3)
|
|
37
|
+
return { error: "number is too long", at: from };
|
|
38
|
+
}
|
|
39
|
+
if (i === from)
|
|
40
|
+
return { error: "expected a number", at: from };
|
|
41
|
+
return { value, end: i };
|
|
42
|
+
}
|
|
43
|
+
function parseField(text, start, stop, spec) {
|
|
44
|
+
const values = new Set();
|
|
45
|
+
let i = start;
|
|
46
|
+
for (;;) {
|
|
47
|
+
// One item: (* | n | a-b) [/step]
|
|
48
|
+
let low;
|
|
49
|
+
let high;
|
|
50
|
+
let star = false;
|
|
51
|
+
if (i < stop && text.charCodeAt(i) === 42) {
|
|
52
|
+
low = spec.min;
|
|
53
|
+
high = spec.max;
|
|
54
|
+
star = true;
|
|
55
|
+
i += 1;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const first = readNumber(text, i, stop);
|
|
59
|
+
if ("error" in first)
|
|
60
|
+
return { position: first.at, message: `${spec.name}: ${first.error}` };
|
|
61
|
+
low = first.value;
|
|
62
|
+
high = first.value;
|
|
63
|
+
i = first.end;
|
|
64
|
+
if (i < stop && text.charCodeAt(i) === 45) {
|
|
65
|
+
const second = readNumber(text, i + 1, stop);
|
|
66
|
+
if ("error" in second)
|
|
67
|
+
return { position: second.at, message: `${spec.name}: ${second.error}` };
|
|
68
|
+
high = second.value;
|
|
69
|
+
i = second.end;
|
|
70
|
+
if (high < low)
|
|
71
|
+
return { position: i - 1, message: `${spec.name}: range runs backwards` };
|
|
72
|
+
}
|
|
73
|
+
if (low < spec.min || high > spec.max) {
|
|
74
|
+
return { position: start, message: `${spec.name} must be ${spec.min} to ${spec.max}` };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
let step = 1;
|
|
78
|
+
if (i < stop && text.charCodeAt(i) === 47) {
|
|
79
|
+
const s = readNumber(text, i + 1, stop);
|
|
80
|
+
if ("error" in s)
|
|
81
|
+
return { position: s.at, message: `${spec.name}: step ${s.error}` };
|
|
82
|
+
if (s.value < 1)
|
|
83
|
+
return { position: i + 1, message: `${spec.name}: step must be at least 1` };
|
|
84
|
+
step = s.value;
|
|
85
|
+
i = s.end;
|
|
86
|
+
// A bare number with a step runs to the end of the field (n/step).
|
|
87
|
+
if (!star && low === high)
|
|
88
|
+
high = spec.max;
|
|
89
|
+
}
|
|
90
|
+
for (let v = low; v <= high; v += step)
|
|
91
|
+
values.add(spec.name === "day of week" && v === 7 ? 0 : v);
|
|
92
|
+
if (i >= stop)
|
|
93
|
+
return { values };
|
|
94
|
+
if (text.charCodeAt(i) !== 44)
|
|
95
|
+
return { position: i, message: `${spec.name}: unexpected character` };
|
|
96
|
+
i += 1;
|
|
97
|
+
if (i >= stop)
|
|
98
|
+
return { position: i, message: `${spec.name}: empty item after comma` };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Parses a standard 5-field cron expression. Linear in the (capped) length, no regular expression.
|
|
103
|
+
* The fields are separated by single spaces (two spaces in a row leave a field empty); month and
|
|
104
|
+
* weekday names and `?` are not supported.
|
|
105
|
+
*/
|
|
106
|
+
export function parseCronExpression(text) {
|
|
107
|
+
if (typeof text !== "string")
|
|
108
|
+
return { ok: false, position: 0, message: "cron expression must be text" };
|
|
109
|
+
if (text.length > CRON_EXPRESSION_MAX) {
|
|
110
|
+
return { ok: false, position: CRON_EXPRESSION_MAX, message: `cron expression is longer than ${CRON_EXPRESSION_MAX} characters` };
|
|
111
|
+
}
|
|
112
|
+
const sets = [];
|
|
113
|
+
const starts = [];
|
|
114
|
+
let start = 0;
|
|
115
|
+
for (let f = 0; f < FIELDS.length; f += 1) {
|
|
116
|
+
starts.push(start);
|
|
117
|
+
let stop = start;
|
|
118
|
+
while (stop < text.length && text.charCodeAt(stop) !== 32)
|
|
119
|
+
stop += 1;
|
|
120
|
+
if (stop === start)
|
|
121
|
+
return { ok: false, position: start, message: `${FIELDS[f].name} field is empty` };
|
|
122
|
+
const parsed = parseField(text, start, stop, FIELDS[f]);
|
|
123
|
+
if (!("values" in parsed))
|
|
124
|
+
return { ok: false, position: parsed.position, message: parsed.message };
|
|
125
|
+
sets.push(parsed.values);
|
|
126
|
+
if (f < FIELDS.length - 1) {
|
|
127
|
+
if (stop >= text.length)
|
|
128
|
+
return { ok: false, position: stop, message: "a cron expression has five fields" };
|
|
129
|
+
start = stop + 1;
|
|
130
|
+
}
|
|
131
|
+
else if (stop < text.length) {
|
|
132
|
+
return { ok: false, position: stop, message: "a cron expression has five fields" };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
ok: true,
|
|
137
|
+
rule: {
|
|
138
|
+
minutes: sets[0],
|
|
139
|
+
hours: sets[1],
|
|
140
|
+
days: sets[2],
|
|
141
|
+
months: sets[3],
|
|
142
|
+
weekdays: sets[4],
|
|
143
|
+
daysRestricted: text.charCodeAt(starts[2]) !== 42,
|
|
144
|
+
weekdaysRestricted: text.charCodeAt(starts[4]) !== 42,
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/** True when the rule fires in the UTC minute containing `at`. When both day fields are
|
|
149
|
+
* restricted either may match (the standard cron rule); otherwise both must. */
|
|
150
|
+
export function cronMatches(rule, at) {
|
|
151
|
+
if (!rule.minutes.has(at.getUTCMinutes()))
|
|
152
|
+
return false;
|
|
153
|
+
if (!rule.hours.has(at.getUTCHours()))
|
|
154
|
+
return false;
|
|
155
|
+
if (!rule.months.has(at.getUTCMonth() + 1))
|
|
156
|
+
return false;
|
|
157
|
+
const dayOk = rule.days.has(at.getUTCDate());
|
|
158
|
+
const weekdayOk = rule.weekdays.has(at.getUTCDay());
|
|
159
|
+
if (rule.daysRestricted && rule.weekdaysRestricted)
|
|
160
|
+
return dayOk || weekdayOk;
|
|
161
|
+
return dayOk && weekdayOk;
|
|
162
|
+
}
|
|
163
|
+
const WEEKDAY_NAMES = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
164
|
+
const MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
165
|
+
function listOf(values, label) {
|
|
166
|
+
return [...values].sort((a, b) => a - b).map(label).join(", ");
|
|
167
|
+
}
|
|
168
|
+
function pad(n) {
|
|
169
|
+
return n < 10 ? `0${n}` : String(n);
|
|
170
|
+
}
|
|
171
|
+
/** An English phrase for the generated reference (UTC). The admin builds its own localised phrase. */
|
|
172
|
+
export function describeCron(rule) {
|
|
173
|
+
const parts = [];
|
|
174
|
+
if (rule.hours.size === 1 && rule.minutes.size === 1) {
|
|
175
|
+
parts.push(`at ${pad([...rule.hours][0])}:${pad([...rule.minutes][0])} UTC`);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
parts.push(rule.minutes.size === 60 ? "every minute" : `at minute ${listOf(rule.minutes, String)}`);
|
|
179
|
+
parts.push(rule.hours.size === 24 ? "of every hour" : `of hour ${listOf(rule.hours, String)} UTC`);
|
|
180
|
+
}
|
|
181
|
+
// The sets, not the star flags: "*/2" begins with a star yet runs on every other day. The flags
|
|
182
|
+
// only decide how two day fields join (cronMatches: either when both are restricted, else both).
|
|
183
|
+
// Two restricted fields match on either, so a full one ("1-31", "0-6") makes every day match.
|
|
184
|
+
const either = rule.daysRestricted && rule.weekdaysRestricted;
|
|
185
|
+
const everyDay = either && (rule.days.size === 31 || rule.weekdays.size === 7);
|
|
186
|
+
const someDays = !everyDay && rule.days.size < 31;
|
|
187
|
+
const someWeekdays = !everyDay && rule.weekdays.size < 7;
|
|
188
|
+
if (someDays)
|
|
189
|
+
parts.push(`on day ${listOf(rule.days, String)} of the month`);
|
|
190
|
+
if (someWeekdays) {
|
|
191
|
+
const join = !someDays ? "on " : either ? "or " : "and on ";
|
|
192
|
+
parts.push(`${join}${listOf(rule.weekdays, (n) => WEEKDAY_NAMES[n])}`);
|
|
193
|
+
}
|
|
194
|
+
if (rule.months.size < 12)
|
|
195
|
+
parts.push(`in ${listOf(rule.months, (n) => MONTH_NAMES[n - 1])}`);
|
|
196
|
+
return parts.join(" ");
|
|
197
|
+
}
|