@kardalum/plugin-sdk 0.20.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 +70 -0
- package/dist/admin-section-registry.d.ts +33 -1
- package/dist/admin-section-registry.js +67 -0
- package/dist/capabilities.js +46 -1
- package/dist/consent-entry.d.ts +11 -0
- package/dist/consent-entry.js +18 -0
- package/dist/content-library.d.ts +17 -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 +2 -0
- package/dist/content-picker/page-picker-sheet.js +1 -1
- package/dist/content-picker/page-picker.d.ts +18 -0
- package/dist/content-picker/page-picker.js +20 -0
- package/dist/datatype-validation.js +10 -2
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +2 -0
- package/dist/entitlement-types.d.ts +18 -1
- package/dist/host-entry.d.ts +7 -1
- package/dist/host-entry.js +14 -1
- package/dist/index.d.ts +35 -7
- package/dist/index.js +46 -5
- package/dist/mail.d.ts +6 -2
- package/dist/manifest-entry.d.ts +22 -4
- package/dist/manifest-entry.js +25 -1
- package/dist/manifest-schema.d.ts +570 -31
- package/dist/manifest-schema.js +240 -12
- package/dist/manifest.d.ts +757 -32
- package/dist/manifest.js +8 -4
- package/dist/plugin-context.d.ts +47 -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 +152 -11
- package/dist/plugin-screen-context.js +30 -0
- package/dist/providers.d.ts +47 -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 +27 -21
- 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 +38 -18
- 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/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 +59 -0
- package/dist/sdk-strings.js +64 -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/structured-storage-types.d.ts +124 -4
- 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 -1
- package/dist/text-entry.js +3 -2
- package/dist/tokens/system-dark.css +1 -0
- package/dist/tokens/tailwind-theme.css +2 -0
- package/dist/tokens/tokens.css +4 -0
- package/dist/tokens/tokens.json +5 -1
- 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/content-list-view.js +207 -8
- package/dist/views/content-picker-view.js +1 -1
- package/dist/views/rich-text-view.d.ts +2 -0
- package/dist/views/rich-text-view.js +182 -24
- 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 +127 -8
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +82 -7
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +11 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +18 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +80 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +41 -2
- 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/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 +50 -13
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +19 -10
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +37 -0
- 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/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 +52 -14
- package/node_modules/@kardalum/api-schemas/dist/index.js +53 -9
- 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/mail-rules.d.ts +4 -2
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +6 -1
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +178 -2
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +51 -2
- 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/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-content-access.d.ts +4 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +12 -2
- 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-docs-api.schema.d.ts +18 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +18 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +5 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +10 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +48 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +5 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +6 -4
- 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-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 +12 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +67 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +15 -0
- 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-management-api.schema.d.ts +80 -15
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +67 -23
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +10 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +33 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +2 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +7 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +43 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +36 -5
- 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-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 +10 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +10 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +171 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +406 -42
- 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-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-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/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 +303 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +61 -0
- 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 +66 -1
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +465 -7
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +15 -118
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +110 -0
- 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 +9 -2
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +7 -2
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +19 -0
- 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 +5 -3
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +3 -1
- 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/structured-fields.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +28 -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/user-api.schema.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +2 -0
- 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 +1 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +9 -1
- package/node_modules/@kardalum/design-tokens/dist/system-dark.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +4 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +6 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +5 -1
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +9 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +276 -19
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +23 -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/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.js +21 -8
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +23 -10
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +30 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +6 -2
- 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/providers.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +24 -6
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +15 -0
- 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 +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +14 -4
- 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.js +44 -11
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +7 -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 +4 -0
- package/node_modules/@kardalum/plugin-package/dist/index.js +5 -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/textarea.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/textarea.js +7 -0
- package/node_modules/@kardalum/ui/dist/index.d.ts +2 -0
- package/node_modules/@kardalum/ui/dist/index.js +2 -0
- package/package.json +15 -3
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ContributionIssue } from "./contribution-issues.js";
|
|
3
|
+
import { type PluginSettingField, type PluginSettingValue } from "./plugin-settings.js";
|
|
4
|
+
/** The actions `userAccess` may name. Never users.create (an account is a login) or users.delete. */
|
|
5
|
+
export declare const PLUGIN_USER_ACCESS_ACTIONS: readonly ["users.read", "users.update", "roles.read"];
|
|
6
|
+
export type PluginUserAccessAction = (typeof PLUGIN_USER_ACCESS_ACTIONS)[number];
|
|
7
|
+
export declare const PluginUserAccessSchema: z.ZodObject<{
|
|
8
|
+
actions: z.ZodArray<z.ZodEnum<{
|
|
9
|
+
"users.read": "users.read";
|
|
10
|
+
"users.update": "users.update";
|
|
11
|
+
"roles.read": "roles.read";
|
|
12
|
+
}>>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export type PluginUserAccess = z.infer<typeof PluginUserAccessSchema>;
|
|
15
|
+
type Issue = ContributionIssue;
|
|
16
|
+
export declare function checkUserAccessDeclarations(manifest: {
|
|
17
|
+
contributions?: unknown;
|
|
18
|
+
}): Issue[];
|
|
19
|
+
/** The actions a declaration holds. Parsed first: a malformed declaration holds nothing. */
|
|
20
|
+
export declare function userAccessActionsOf(value: unknown): Set<PluginUserAccessAction>;
|
|
21
|
+
/** The most account fields one plugin declares. */
|
|
22
|
+
export declare const PLUGIN_USER_FIELDS_MAX = 16;
|
|
23
|
+
export type PluginUserField = Exclude<PluginSettingField, {
|
|
24
|
+
type: "secret";
|
|
25
|
+
}>;
|
|
26
|
+
declare const pluginUserFieldsArraySchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"text">;
|
|
28
|
+
default: z.ZodOptional<z.ZodString>;
|
|
29
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
multiline: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
inViews: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
34
|
+
en: z.ZodString;
|
|
35
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
36
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
37
|
+
en: z.ZodString;
|
|
38
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>>;
|
|
39
|
+
askAtInstall: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
41
|
+
type: z.ZodLiteral<"number">;
|
|
42
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
integer: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
inViews: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
49
|
+
en: z.ZodString;
|
|
50
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
51
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
52
|
+
en: z.ZodString;
|
|
53
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>>;
|
|
54
|
+
askAtInstall: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"onOff">;
|
|
57
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
inViews: z.ZodOptional<z.ZodBoolean>;
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
61
|
+
en: z.ZodString;
|
|
62
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
63
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
64
|
+
en: z.ZodString;
|
|
65
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>>;
|
|
66
|
+
askAtInstall: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"choice">;
|
|
69
|
+
default: z.ZodOptional<z.ZodString>;
|
|
70
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
71
|
+
value: z.ZodString;
|
|
72
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
73
|
+
en: z.ZodString;
|
|
74
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
75
|
+
}, z.core.$strict>>;
|
|
76
|
+
inViews: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
79
|
+
en: z.ZodString;
|
|
80
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
81
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
82
|
+
en: z.ZodString;
|
|
83
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>>;
|
|
84
|
+
askAtInstall: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
86
|
+
type: z.ZodLiteral<"secret">;
|
|
87
|
+
secret: z.ZodString;
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
90
|
+
en: z.ZodString;
|
|
91
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
92
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
93
|
+
en: z.ZodString;
|
|
94
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>>;
|
|
95
|
+
askAtInstall: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
}, z.core.$strict>], "type">>;
|
|
97
|
+
/** The account field declaration, typed once here as PluginUserField[]: the superRefine above refuses
|
|
98
|
+
* a secret field at run time, which the inferred element type cannot say. The two stay together, and a
|
|
99
|
+
* test proves the refusal, so the type never names a member the schema lets through. */
|
|
100
|
+
export declare const PluginUserFieldsSchema: z.ZodType<PluginUserField[], z.input<typeof pluginUserFieldsArraySchema>>;
|
|
101
|
+
export declare function checkUserFieldsDeclarations(manifest: {
|
|
102
|
+
contributions?: unknown;
|
|
103
|
+
}): Issue[];
|
|
104
|
+
/** The manifest's account fields, or null when it declares none or declares them wrongly. */
|
|
105
|
+
export declare function userFieldsOf(manifest: {
|
|
106
|
+
contributions?: unknown;
|
|
107
|
+
} | undefined): PluginUserField[] | null;
|
|
108
|
+
/** The write schema: the declared fields, each optional, strict. */
|
|
109
|
+
export declare function userFieldValuesSchema(fields: readonly PluginUserField[]): z.ZodType<Record<string, PluginSettingValue>>;
|
|
110
|
+
/** The stored values that are declared now and still pass their field's rule; defaults are never added. */
|
|
111
|
+
export declare function keptUserFieldValues(fields: readonly PluginUserField[], stored: unknown): Record<string, PluginSettingValue>;
|
|
112
|
+
/** Every declared field with its stored value when that still passes, else its default. */
|
|
113
|
+
export declare function resolveUserFieldValues(fields: readonly PluginUserField[], stored: unknown): Record<string, PluginSettingValue>;
|
|
114
|
+
export declare const UserFieldsGroupSchema: z.ZodObject<{
|
|
115
|
+
pluginId: z.ZodString;
|
|
116
|
+
pluginName: z.ZodString;
|
|
117
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
type: z.ZodEnum<{
|
|
120
|
+
number: "number";
|
|
121
|
+
secret: "secret";
|
|
122
|
+
text: "text";
|
|
123
|
+
choice: "choice";
|
|
124
|
+
onOff: "onOff";
|
|
125
|
+
}>;
|
|
126
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
127
|
+
en: z.ZodString;
|
|
128
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
129
|
+
description: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
130
|
+
en: z.ZodString;
|
|
131
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>>;
|
|
132
|
+
askAtInstall: z.ZodBoolean;
|
|
133
|
+
inViews: z.ZodBoolean;
|
|
134
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
135
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
136
|
+
set: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
+
stored: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
secret: z.ZodOptional<z.ZodString>;
|
|
139
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
140
|
+
value: z.ZodString;
|
|
141
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
142
|
+
en: z.ZodString;
|
|
143
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
144
|
+
}, z.core.$strict>>>;
|
|
145
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
integer: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
149
|
+
multiline: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
}, z.core.$strict>>;
|
|
151
|
+
}, z.core.$strict>;
|
|
152
|
+
export type UserFieldsGroup = z.infer<typeof UserFieldsGroupSchema>;
|
|
153
|
+
export declare const UserFieldsResponseSchema: z.ZodObject<{
|
|
154
|
+
plugins: z.ZodArray<z.ZodObject<{
|
|
155
|
+
pluginId: z.ZodString;
|
|
156
|
+
pluginName: z.ZodString;
|
|
157
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
158
|
+
id: z.ZodString;
|
|
159
|
+
type: z.ZodEnum<{
|
|
160
|
+
number: "number";
|
|
161
|
+
secret: "secret";
|
|
162
|
+
text: "text";
|
|
163
|
+
choice: "choice";
|
|
164
|
+
onOff: "onOff";
|
|
165
|
+
}>;
|
|
166
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
167
|
+
en: z.ZodString;
|
|
168
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
169
|
+
description: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
170
|
+
en: z.ZodString;
|
|
171
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>>;
|
|
172
|
+
askAtInstall: z.ZodBoolean;
|
|
173
|
+
inViews: z.ZodBoolean;
|
|
174
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
175
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
176
|
+
set: z.ZodOptional<z.ZodBoolean>;
|
|
177
|
+
stored: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
secret: z.ZodOptional<z.ZodString>;
|
|
179
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
180
|
+
value: z.ZodString;
|
|
181
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
182
|
+
en: z.ZodString;
|
|
183
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
184
|
+
}, z.core.$strict>>>;
|
|
185
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
integer: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
189
|
+
multiline: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
}, z.core.$strict>>;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
}, z.core.$strict>;
|
|
193
|
+
export type UserFieldsResponse = z.infer<typeof UserFieldsResponseSchema>;
|
|
194
|
+
export declare const UserFieldsParamsSchema: z.ZodObject<{
|
|
195
|
+
id: z.ZodString;
|
|
196
|
+
pluginId: z.ZodString;
|
|
197
|
+
}, z.core.$strict>;
|
|
198
|
+
export declare const UpdateUserFieldsRequestSchema: z.ZodObject<{
|
|
199
|
+
values: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
200
|
+
}, z.core.$strict>;
|
|
201
|
+
export type UpdateUserFieldsRequest = z.infer<typeof UpdateUserFieldsRequestSchema>;
|
|
202
|
+
export declare const ASKABLE_ACTION_MAX = 256;
|
|
203
|
+
export declare function isAskableAction(pluginId: string, action: unknown): action is string;
|
|
204
|
+
export declare const PLUGIN_ROLE_REFUSED_CODE = "plugin_role_refused";
|
|
205
|
+
export declare const PLUGIN_ROLE_REFUSED_MESSAGE = "A plugin moves people only between the roles it offered and Editor, never to or from a role that manages the site";
|
|
206
|
+
export declare const PluginRoleRefusedSchema: z.ZodObject<{
|
|
207
|
+
code: z.ZodLiteral<"plugin_role_refused">;
|
|
208
|
+
message: z.ZodString;
|
|
209
|
+
}, z.core.$strict>;
|
|
210
|
+
export declare const PLUGIN_ACCOUNT_STATE_REFUSED_MESSAGE = "A plugin does not disable or enable accounts";
|
|
211
|
+
export declare const PLUGIN_USER_FIELDS_ROUTE_MESSAGE = "A plugin reads and writes its own account fields through context.userFields";
|
|
212
|
+
export declare const USER_FIELDS_SYSTEM_ACCOUNT_MESSAGE = "The system account has no account fields";
|
|
213
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { contributionIssuesAt, contributionOf } from "./contribution-issues.js";
|
|
3
|
+
import { isCoreAction } from "./core-actions.js";
|
|
4
|
+
import { PLUGIN_ID_MAX } from "./plugin-id-rules.js";
|
|
5
|
+
import { PLUGIN_SETTING_ID_MAX, PluginSettingFieldSchema, PluginSettingsFieldViewSchema, pluginSettingsValuesSchema, resolvePluginSettings, } from "./plugin-settings.js";
|
|
6
|
+
// M35 U1 (W6), experimental: what a plugin may do with the site's admin accounts. `userAccess`
|
|
7
|
+
// names core actions the plugin's subject holds at the management user routes; `userFields`
|
|
8
|
+
// declares account fields the core stores per person and plugin (user_plugin_fields), draws on the
|
|
9
|
+
// user details dialog and hands back through context.userFields. Every rule lives here; the SDK's
|
|
10
|
+
// manifest schema, the `user accounts` delivery check and the server read these.
|
|
11
|
+
/** The actions `userAccess` may name. Never users.create (an account is a login) or users.delete. */
|
|
12
|
+
export const PLUGIN_USER_ACCESS_ACTIONS = ["users.read", "users.update", "roles.read"];
|
|
13
|
+
export const PluginUserAccessSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
actions: z
|
|
16
|
+
.array(z.enum(PLUGIN_USER_ACCESS_ACTIONS))
|
|
17
|
+
.min(1, { error: "declares at least one action (leave userAccess out when the plugin reads no accounts)" })
|
|
18
|
+
.max(PLUGIN_USER_ACCESS_ACTIONS.length)
|
|
19
|
+
.refine((values) => new Set(values).size === values.length, { message: "names each action once" }),
|
|
20
|
+
})
|
|
21
|
+
.strict()
|
|
22
|
+
.superRefine((value, ctx) => {
|
|
23
|
+
if (value.actions.includes("users.update") && !value.actions.includes("users.read")) {
|
|
24
|
+
ctx.addIssue({ code: "custom", path: ["actions"], message: "a plugin that changes roles also declares users.read" });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const issuesAt = contributionIssuesAt;
|
|
28
|
+
export function checkUserAccessDeclarations(manifest) {
|
|
29
|
+
const value = contributionOf(manifest, "userAccess");
|
|
30
|
+
if (value === undefined)
|
|
31
|
+
return [];
|
|
32
|
+
const parsed = PluginUserAccessSchema.safeParse(value);
|
|
33
|
+
return parsed.success ? [] : issuesAt("userAccess", parsed.error);
|
|
34
|
+
}
|
|
35
|
+
/** The actions a declaration holds. Parsed first: a malformed declaration holds nothing. */
|
|
36
|
+
export function userAccessActionsOf(value) {
|
|
37
|
+
const parsed = PluginUserAccessSchema.safeParse(value);
|
|
38
|
+
return new Set(parsed.success ? parsed.data.actions : []);
|
|
39
|
+
}
|
|
40
|
+
/** The most account fields one plugin declares. */
|
|
41
|
+
export const PLUGIN_USER_FIELDS_MAX = 16;
|
|
42
|
+
const pluginUserFieldsArraySchema = z
|
|
43
|
+
.array(PluginSettingFieldSchema)
|
|
44
|
+
.max(PLUGIN_USER_FIELDS_MAX, { message: `at most ${PLUGIN_USER_FIELDS_MAX} account fields` })
|
|
45
|
+
.superRefine((fields, ctx) => {
|
|
46
|
+
const ids = new Set();
|
|
47
|
+
fields.forEach((field, index) => {
|
|
48
|
+
if (field.type === "secret")
|
|
49
|
+
ctx.addIssue({ code: "custom", path: [index, "type"], message: "an account field is never a secret" });
|
|
50
|
+
if (field.askAtInstall !== undefined)
|
|
51
|
+
ctx.addIssue({ code: "custom", path: [index, "askAtInstall"], message: "an account field is not asked at install" });
|
|
52
|
+
// M35 C3: inViews marks a plugin setting a view reads; a person's account field never reaches views.
|
|
53
|
+
if (field.inViews !== undefined)
|
|
54
|
+
ctx.addIssue({ code: "custom", path: [index, "inViews"], message: "an account field is not read by views" });
|
|
55
|
+
if (ids.has(field.id))
|
|
56
|
+
ctx.addIssue({ code: "custom", path: [index, "id"], message: `account field id "${field.id}" is declared twice` });
|
|
57
|
+
ids.add(field.id);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
/** The account field declaration, typed once here as PluginUserField[]: the superRefine above refuses
|
|
61
|
+
* a secret field at run time, which the inferred element type cannot say. The two stay together, and a
|
|
62
|
+
* test proves the refusal, so the type never names a member the schema lets through. */
|
|
63
|
+
export const PluginUserFieldsSchema = pluginUserFieldsArraySchema;
|
|
64
|
+
export function checkUserFieldsDeclarations(manifest) {
|
|
65
|
+
const value = contributionOf(manifest, "userFields");
|
|
66
|
+
if (value === undefined)
|
|
67
|
+
return [];
|
|
68
|
+
const parsed = PluginUserFieldsSchema.safeParse(value);
|
|
69
|
+
return parsed.success ? [] : issuesAt("userFields", parsed.error);
|
|
70
|
+
}
|
|
71
|
+
/** The manifest's account fields, or null when it declares none or declares them wrongly. */
|
|
72
|
+
export function userFieldsOf(manifest) {
|
|
73
|
+
const value = contributionOf(manifest, "userFields");
|
|
74
|
+
if (value === undefined)
|
|
75
|
+
return null;
|
|
76
|
+
const parsed = PluginUserFieldsSchema.safeParse(value);
|
|
77
|
+
return parsed.success ? parsed.data : null;
|
|
78
|
+
}
|
|
79
|
+
/** The write schema: the declared fields, each optional, strict. */
|
|
80
|
+
export function userFieldValuesSchema(fields) {
|
|
81
|
+
return pluginSettingsValuesSchema(fields);
|
|
82
|
+
}
|
|
83
|
+
/** The stored values that are declared now and still pass their field's rule; defaults are never added. */
|
|
84
|
+
export function keptUserFieldValues(fields, stored) {
|
|
85
|
+
if (stored === null || typeof stored !== "object" || Array.isArray(stored))
|
|
86
|
+
return {};
|
|
87
|
+
const out = {};
|
|
88
|
+
const record = stored;
|
|
89
|
+
for (const field of fields) {
|
|
90
|
+
if (!Object.hasOwn(record, field.id))
|
|
91
|
+
continue;
|
|
92
|
+
const parsed = userFieldValuesSchema([field]).safeParse({ [field.id]: record[field.id] });
|
|
93
|
+
if (parsed.success && Object.hasOwn(parsed.data, field.id))
|
|
94
|
+
out[field.id] = parsed.data[field.id];
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
/** Every declared field with its stored value when that still passes, else its default. */
|
|
99
|
+
export function resolveUserFieldValues(fields, stored) {
|
|
100
|
+
return resolvePluginSettings(fields, keptUserFieldValues(fields, stored));
|
|
101
|
+
}
|
|
102
|
+
// The wire shapes of GET /api/manage/v1/users/:id/fields and PUT /api/manage/v1/users/:id/fields/:pluginId.
|
|
103
|
+
const ValueSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
104
|
+
export const UserFieldsGroupSchema = z
|
|
105
|
+
.object({ pluginId: z.string(), pluginName: z.string(), fields: z.array(PluginSettingsFieldViewSchema) })
|
|
106
|
+
.strict();
|
|
107
|
+
export const UserFieldsResponseSchema = z.object({ plugins: z.array(UserFieldsGroupSchema) }).strict();
|
|
108
|
+
export const UserFieldsParamsSchema = z.object({ id: z.string().uuid(), pluginId: z.string().min(1).max(PLUGIN_ID_MAX) }).strict();
|
|
109
|
+
// The count cap runs after z.record has parsed every key. That parse is linear and bounded by the
|
|
110
|
+
// server's body limit (Fastify's default 1 MiB; the app sets no other), so an oversized body costs one
|
|
111
|
+
// linear pass before its 400, never more; a pre-check would put an unrepresentable schema in the reference.
|
|
112
|
+
export const UpdateUserFieldsRequestSchema = z
|
|
113
|
+
.object({ values: z.record(z.string().min(1).max(PLUGIN_SETTING_ID_MAX), ValueSchema) })
|
|
114
|
+
.strict()
|
|
115
|
+
.refine((body) => Object.keys(body.values).length <= PLUGIN_USER_FIELDS_MAX, { message: `at most ${PLUGIN_USER_FIELDS_MAX} values` });
|
|
116
|
+
// M35 U1 (W52, D3): the actions a plugin may ask about, from a view (usePluginCan) or a route
|
|
117
|
+
// (context.can): a core action, or one starting with the plugin's own id and a dot (every action a
|
|
118
|
+
// plugin declares starts so, and an undeclared one is held by nobody). One rule for both places.
|
|
119
|
+
export const ASKABLE_ACTION_MAX = 256;
|
|
120
|
+
export function isAskableAction(pluginId, action) {
|
|
121
|
+
if (typeof action !== "string" || action.length === 0 || action.length > ASKABLE_ACTION_MAX)
|
|
122
|
+
return false;
|
|
123
|
+
return isCoreAction(action) || action.startsWith(`${pluginId}.`);
|
|
124
|
+
}
|
|
125
|
+
// The refusals a plugin subject gets at the user routes (D2).
|
|
126
|
+
export const PLUGIN_ROLE_REFUSED_CODE = "plugin_role_refused";
|
|
127
|
+
export const PLUGIN_ROLE_REFUSED_MESSAGE = "A plugin moves people only between the roles it offered and Editor, never to or from a role that manages the site";
|
|
128
|
+
export const PluginRoleRefusedSchema = z.object({ code: z.literal(PLUGIN_ROLE_REFUSED_CODE), message: z.string() }).strict();
|
|
129
|
+
export const PLUGIN_ACCOUNT_STATE_REFUSED_MESSAGE = "A plugin does not disable or enable accounts";
|
|
130
|
+
export const PLUGIN_USER_FIELDS_ROUTE_MESSAGE = "A plugin reads and writes its own account fields through context.userFields";
|
|
131
|
+
export const USER_FIELDS_SYSTEM_ACCOUNT_MESSAGE = "The system account has no account fields";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type BuiltInRailSectionId } from "./plugin-id-rules.js";
|
|
3
|
+
import type { PluginSettingField } from "./plugin-settings.js";
|
|
4
|
+
/** The core screens a view may open (design section 4). */
|
|
5
|
+
export declare const NAVIGATE_CORE_SCREENS: readonly ["content", "media", "documentType", "dataType", "users", "plugins", "pluginSettings", "serverSettings"];
|
|
6
|
+
/** M35 C3 (W29): where `navigate` and `hrefFor` take the person. @experimental */
|
|
7
|
+
export type PluginNavigateTarget = {
|
|
8
|
+
section: string;
|
|
9
|
+
entry?: string;
|
|
10
|
+
item?: string;
|
|
11
|
+
plugin?: string;
|
|
12
|
+
} | {
|
|
13
|
+
builtIn: BuiltInRailSectionId;
|
|
14
|
+
entry: string;
|
|
15
|
+
item?: string;
|
|
16
|
+
plugin?: string;
|
|
17
|
+
} | {
|
|
18
|
+
core: "content" | "media";
|
|
19
|
+
id?: string;
|
|
20
|
+
} | {
|
|
21
|
+
core: "documentType" | "dataType";
|
|
22
|
+
id: string;
|
|
23
|
+
} | {
|
|
24
|
+
core: "users" | "plugins" | "serverSettings";
|
|
25
|
+
} | {
|
|
26
|
+
core: "pluginSettings";
|
|
27
|
+
plugin?: string;
|
|
28
|
+
} | {
|
|
29
|
+
docs: string | null;
|
|
30
|
+
};
|
|
31
|
+
/** The longest docs page slug a target names. */
|
|
32
|
+
export declare const PLUGIN_DOCS_SLUG_MAX = 100;
|
|
33
|
+
/** The most pages the SDK's PagePicker takes in one field. */
|
|
34
|
+
export declare const PAGE_PICKER_CHOICES_MAX = 100;
|
|
35
|
+
/** A uuid in its 36-character text form (any case), by position: no pattern. */
|
|
36
|
+
export declare function isUuidText(value: unknown): value is string;
|
|
37
|
+
/**
|
|
38
|
+
* A docs page slug: 1 to PLUGIN_DOCS_SLUG_MAX lower-case letters, digits and "-", starting with a letter or a
|
|
39
|
+
* digit, as the docs route's own slug does.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isDocsSlugText(value: unknown): value is string;
|
|
42
|
+
/** M35 C3 (W29): a target as plain data, or null when it is not exactly one known kind. */
|
|
43
|
+
export declare function readNavigateTarget(value: unknown): PluginNavigateTarget | null;
|
|
44
|
+
/** M35 C3 (W28): how long the admin keeps one plugin's view settings. */
|
|
45
|
+
export declare const PLUGIN_VIEW_SETTINGS_MEMO_MS = 5000;
|
|
46
|
+
/** The 403 of the view settings read. */
|
|
47
|
+
export declare const VIEW_SETTINGS_REFUSED_MESSAGE = "Only people who can open one of this plugin's views read its view settings";
|
|
48
|
+
/** M35 C3 (W28): the values of the fields a plugin marks inViews, by field id. @experimental */
|
|
49
|
+
export declare const PluginViewSettingsResponseSchema: z.ZodObject<{
|
|
50
|
+
values: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type PluginViewSettingsResponse = z.infer<typeof PluginViewSettingsResponseSchema>;
|
|
53
|
+
/** The declared non-secret fields marked inViews, in declaration order. */
|
|
54
|
+
export declare function viewSettingsFieldsOf(fields: readonly PluginSettingField[]): PluginSettingField[];
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isNotificationScreenItem } from "./notification.schema.js";
|
|
3
|
+
import { BUILT_IN_RAIL_SECTIONS, PLUGIN_ID_MAX, SLOT_ID_MAX } from "./plugin-id-rules.js";
|
|
4
|
+
// M35 C3 (W25, W28, W29, experimental): what a plugin's views read and where they may send the person.
|
|
5
|
+
// A navigation target is plain data a plugin's code hands the host; it is read here by linear checks
|
|
6
|
+
// only, and its ids are compared for equality with the host's registry, never parsed as an address.
|
|
7
|
+
/** The core screens a view may open (design section 4). */
|
|
8
|
+
export const NAVIGATE_CORE_SCREENS = ["content", "media", "documentType", "dataType", "users", "plugins", "pluginSettings", "serverSettings"];
|
|
9
|
+
/** The longest docs page slug a target names. */
|
|
10
|
+
export const PLUGIN_DOCS_SLUG_MAX = 100;
|
|
11
|
+
/** The most pages the SDK's PagePicker takes in one field. */
|
|
12
|
+
export const PAGE_PICKER_CHOICES_MAX = 100;
|
|
13
|
+
const HEX = (code) => (code >= 48 && code <= 57) || (code >= 97 && code <= 102) || (code >= 65 && code <= 70);
|
|
14
|
+
/** A uuid in its 36-character text form (any case), by position: no pattern. */
|
|
15
|
+
export function isUuidText(value) {
|
|
16
|
+
if (typeof value !== "string" || value.length !== 36)
|
|
17
|
+
return false;
|
|
18
|
+
for (let i = 0; i < 36; i++) {
|
|
19
|
+
const code = value.charCodeAt(i);
|
|
20
|
+
if (i === 8 || i === 13 || i === 18 || i === 23) {
|
|
21
|
+
if (code !== 45)
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
else if (!HEX(code))
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A docs page slug: 1 to PLUGIN_DOCS_SLUG_MAX lower-case letters, digits and "-", starting with a letter or a
|
|
31
|
+
* digit, as the docs route's own slug does.
|
|
32
|
+
*/
|
|
33
|
+
export function isDocsSlugText(value) {
|
|
34
|
+
if (typeof value !== "string" || value.length < 1 || value.length > PLUGIN_DOCS_SLUG_MAX)
|
|
35
|
+
return false;
|
|
36
|
+
for (let i = 0; i < value.length; i++) {
|
|
37
|
+
const code = value.charCodeAt(i);
|
|
38
|
+
const letterOrDigit = (code >= 97 && code <= 122) || (code >= 48 && code <= 57);
|
|
39
|
+
if (!letterOrDigit && (i === 0 || code !== 45))
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
const shortText = (value, max) => typeof value === "string" && value.length >= 1 && value.length <= max;
|
|
45
|
+
const RAIL_SECTIONS = new Set(BUILT_IN_RAIL_SECTIONS);
|
|
46
|
+
const CORE_SCREENS = new Set(NAVIGATE_CORE_SCREENS);
|
|
47
|
+
/** The most keys a target of any kind holds (`section`, `entry`, `item` and `plugin`). */
|
|
48
|
+
const NAVIGATE_TARGET_KEYS_MAX = 4;
|
|
49
|
+
/**
|
|
50
|
+
* The own enumerable keys and their values, or null when reading them throws (a getter, a Proxy) or there
|
|
51
|
+
* are more than NAVIGATE_TARGET_KEYS_MAX of them, answered before any value is read.
|
|
52
|
+
*/
|
|
53
|
+
function plainEntries(value) {
|
|
54
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
55
|
+
return null;
|
|
56
|
+
try {
|
|
57
|
+
const keys = Object.keys(value);
|
|
58
|
+
if (keys.length > NAVIGATE_TARGET_KEYS_MAX)
|
|
59
|
+
return null;
|
|
60
|
+
const out = new Map();
|
|
61
|
+
for (const key of keys)
|
|
62
|
+
out.set(key, value[key]);
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function only(entries, allowed) {
|
|
70
|
+
for (const key of entries.keys())
|
|
71
|
+
if (!allowed.includes(key))
|
|
72
|
+
return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
/** M35 C3 (W29): a target as plain data, or null when it is not exactly one known kind. */
|
|
76
|
+
export function readNavigateTarget(value) {
|
|
77
|
+
const entries = plainEntries(value);
|
|
78
|
+
if (entries === null)
|
|
79
|
+
return null;
|
|
80
|
+
const kinds = ["section", "builtIn", "core", "docs"].filter((key) => entries.has(key));
|
|
81
|
+
if (kinds.length !== 1)
|
|
82
|
+
return null;
|
|
83
|
+
const item = entries.get("item");
|
|
84
|
+
if (item !== undefined && !isNotificationScreenItem(item))
|
|
85
|
+
return null;
|
|
86
|
+
const plugin = entries.get("plugin");
|
|
87
|
+
if (plugin !== undefined && !shortText(plugin, PLUGIN_ID_MAX))
|
|
88
|
+
return null;
|
|
89
|
+
const entry = entries.get("entry");
|
|
90
|
+
const withExtras = (target) => ({
|
|
91
|
+
...target,
|
|
92
|
+
...(item !== undefined ? { item: item } : {}),
|
|
93
|
+
...(plugin !== undefined ? { plugin: plugin } : {}),
|
|
94
|
+
});
|
|
95
|
+
switch (kinds[0]) {
|
|
96
|
+
case "section": {
|
|
97
|
+
const section = entries.get("section");
|
|
98
|
+
if (!only(entries, ["section", "entry", "item", "plugin"]) || !shortText(section, SLOT_ID_MAX))
|
|
99
|
+
return null;
|
|
100
|
+
if (entry !== undefined && !shortText(entry, SLOT_ID_MAX))
|
|
101
|
+
return null;
|
|
102
|
+
return withExtras({ section, ...(entry !== undefined ? { entry: entry } : {}) });
|
|
103
|
+
}
|
|
104
|
+
case "builtIn": {
|
|
105
|
+
const builtIn = entries.get("builtIn");
|
|
106
|
+
if (!only(entries, ["builtIn", "entry", "item", "plugin"]) || typeof builtIn !== "string" || !RAIL_SECTIONS.has(builtIn) || !shortText(entry, SLOT_ID_MAX))
|
|
107
|
+
return null;
|
|
108
|
+
return withExtras({ builtIn: builtIn, entry });
|
|
109
|
+
}
|
|
110
|
+
case "core": {
|
|
111
|
+
const core = entries.get("core");
|
|
112
|
+
const id = entries.get("id");
|
|
113
|
+
if (typeof core !== "string" || !CORE_SCREENS.has(core))
|
|
114
|
+
return null;
|
|
115
|
+
if (core === "pluginSettings") {
|
|
116
|
+
if (!only(entries, ["core", "plugin"]))
|
|
117
|
+
return null;
|
|
118
|
+
return plugin === undefined ? { core } : { core, plugin: plugin };
|
|
119
|
+
}
|
|
120
|
+
if (!only(entries, ["core", "id"]))
|
|
121
|
+
return null;
|
|
122
|
+
if (core === "users" || core === "plugins" || core === "serverSettings")
|
|
123
|
+
return id === undefined ? { core } : null;
|
|
124
|
+
if (id !== undefined && !isUuidText(id))
|
|
125
|
+
return null;
|
|
126
|
+
const lower = typeof id === "string" ? id.toLowerCase() : undefined;
|
|
127
|
+
if (core === "documentType" || core === "dataType")
|
|
128
|
+
return lower === undefined ? null : { core, id: lower };
|
|
129
|
+
return lower === undefined ? { core: core } : { core: core, id: lower };
|
|
130
|
+
}
|
|
131
|
+
case "docs": {
|
|
132
|
+
const docs = entries.get("docs");
|
|
133
|
+
if (!only(entries, ["docs"]))
|
|
134
|
+
return null;
|
|
135
|
+
if (docs === null)
|
|
136
|
+
return { docs: null };
|
|
137
|
+
return isDocsSlugText(docs) ? { docs } : null;
|
|
138
|
+
}
|
|
139
|
+
default:
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** M35 C3 (W28): how long the admin keeps one plugin's view settings. */
|
|
144
|
+
export const PLUGIN_VIEW_SETTINGS_MEMO_MS = 5_000;
|
|
145
|
+
/** The 403 of the view settings read. */
|
|
146
|
+
export const VIEW_SETTINGS_REFUSED_MESSAGE = "Only people who can open one of this plugin's views read its view settings";
|
|
147
|
+
/** M35 C3 (W28): the values of the fields a plugin marks inViews, by field id. @experimental */
|
|
148
|
+
export const PluginViewSettingsResponseSchema = z.object({
|
|
149
|
+
values: z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()])),
|
|
150
|
+
});
|
|
151
|
+
/** The declared non-secret fields marked inViews, in declaration order. */
|
|
152
|
+
export function viewSettingsFieldsOf(fields) {
|
|
153
|
+
return fields.filter((field) => field.type !== "secret" && field.inViews === true);
|
|
154
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ContributionIssue } from "./contribution-issues.js";
|
|
3
|
+
export declare const PLUGIN_VISITOR_GROUPS_MAX = 20;
|
|
4
|
+
export declare const PLUGIN_VISITOR_ACCOUNT_SECTIONS_MAX = 3;
|
|
5
|
+
export declare const PLUGIN_VISITOR_POINT_ID_MAX = 40;
|
|
6
|
+
/** A declared group's or section's id: 1 to 40 of a-z, 0-9, "-" and "_", a letter first. A linear scan. */
|
|
7
|
+
export declare function isPluginVisitorPointId(value: unknown): value is string;
|
|
8
|
+
export declare const PluginVisitorIdentitySchema: z.ZodObject<{
|
|
9
|
+
email: z.ZodOptional<z.ZodLiteral<true>>;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export type PluginVisitorIdentity = z.infer<typeof PluginVisitorIdentitySchema>;
|
|
12
|
+
export declare const PluginVisitorGroupsSchema: z.ZodArray<z.ZodObject<{
|
|
13
|
+
id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
14
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
15
|
+
en: z.ZodString;
|
|
16
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
17
|
+
}, z.core.$strict>>;
|
|
18
|
+
export declare const PluginVisitorAccountSectionsSchema: z.ZodArray<z.ZodObject<{
|
|
19
|
+
id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
20
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
21
|
+
en: z.ZodString;
|
|
22
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
23
|
+
partial: z.ZodString;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
export declare const PluginVisitorDataSchema: z.ZodObject<{}, z.core.$strip>;
|
|
26
|
+
export declare function pluginVisitorGroupKey(pluginId: string, id: string): string;
|
|
27
|
+
export declare const VISITOR_POINTS_WITHOUT_DATA_WARNING = "declares visitorIdentity without visitorData: if it keeps anything by visitor id, declare visitorData so an account's export and deletion reach it";
|
|
28
|
+
type Issue = ContributionIssue;
|
|
29
|
+
/** The most `templates` entries read for a section's partial: a section naming a partial past it is refused (the safe side). */
|
|
30
|
+
export declare const VISITOR_SECTION_PARTIAL_SCAN_MAX = 2000;
|
|
31
|
+
/** The issues of a manifest's visitor point declarations, in order: each declared key against its schema,
|
|
32
|
+
* a point declared without visitorIdentity, an id declared twice, a section naming a partial the plugin
|
|
33
|
+
* does not ship. A manifest that declares none has none. */
|
|
34
|
+
export declare function checkVisitorPointDeclarations(manifest: {
|
|
35
|
+
contributions?: unknown;
|
|
36
|
+
}): Issue[];
|
|
37
|
+
export {};
|