@kardalum/plugin-sdk 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +211 -0
- package/README.md +19 -0
- package/dist/admin-section-registry.d.ts +16 -1
- package/dist/admin-section-registry.js +23 -0
- package/dist/built-in-editor-ids.d.ts +1 -1
- package/dist/built-in-editor-ids.js +2 -20
- package/dist/built-in-settings-schemas.d.ts +10 -0
- package/dist/built-in-settings-schemas.js +86 -0
- package/dist/built-in-value-schemas.js +35 -0
- package/dist/built-ins.js +38 -7
- package/dist/capabilities.d.ts +11 -1
- package/dist/capabilities.js +55 -3
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +22 -0
- package/dist/content-library.d.ts +85 -0
- package/dist/content-library.js +15 -0
- package/dist/content-picker/page-picker-sheet.d.ts +13 -0
- package/dist/content-picker/page-picker-sheet.js +105 -0
- package/dist/content-picker/page-tree.d.ts +25 -0
- package/dist/content-picker/page-tree.js +132 -0
- package/dist/data-type-plugin.d.ts +7 -1
- package/dist/datatype-validation.d.ts +4 -9
- package/dist/datatype-validation.js +139 -1
- package/dist/entitlement-entry.d.ts +1 -1
- package/dist/entitlement-entry.js +1 -1
- package/dist/entitlement-gate.d.ts +14 -0
- package/dist/entitlement-gate.js +64 -7
- package/dist/entitlement-plan.d.ts +6 -0
- package/dist/entitlement-plan.js +10 -0
- package/dist/entitlement-types.d.ts +36 -12
- package/dist/entitlement.d.ts +31 -4
- package/dist/entitlement.js +58 -17
- package/dist/hook-entry.d.ts +5 -0
- package/dist/hook-entry.js +30 -0
- package/dist/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +36 -4
- package/dist/index.js +50 -3
- package/dist/mail.d.ts +30 -0
- package/dist/mail.js +1 -0
- package/dist/manifest-entry.d.ts +29 -4
- package/dist/manifest-entry.js +39 -2
- package/dist/manifest-schema.d.ts +443 -29
- package/dist/manifest-schema.js +285 -23
- package/dist/manifest.d.ts +450 -51
- package/dist/manifest.js +1 -1
- package/dist/media/media-picker.js +31 -18
- package/dist/media/upload-error.d.ts +5 -1
- package/dist/media/upload-error.js +14 -2
- package/dist/media-library.d.ts +32 -0
- package/dist/media-library.js +15 -0
- package/dist/nested-field-host.d.ts +76 -0
- package/dist/nested-field-host.js +90 -0
- package/dist/notify.d.ts +12 -4
- package/dist/notify.js +1 -1
- package/dist/outbound.d.ts +47 -0
- package/dist/outbound.js +1 -0
- package/dist/plugin-context.d.ts +5 -0
- package/dist/plugin-screen-context.d.ts +112 -0
- package/dist/plugin-screen-context.js +26 -0
- package/dist/providers.d.ts +268 -0
- package/dist/providers.js +74 -0
- package/dist/read-all-pages.d.ts +5 -0
- package/dist/read-all-pages.js +3 -2
- package/dist/richtext/block-panel.js +11 -6
- package/dist/richtext/insert-menu.js +9 -6
- package/dist/richtext/style-listbox.js +6 -4
- package/dist/sdk-strings.d.ts +285 -0
- package/dist/sdk-strings.js +347 -0
- package/dist/sealing.d.ts +14 -0
- package/dist/sealing.js +1 -0
- package/dist/simple-storage-value-provider.js +24 -24
- package/dist/structured-storage-types.d.ts +309 -9
- package/dist/text-entry.d.ts +1 -0
- package/dist/text-entry.js +6 -0
- package/dist/tokens/tailwind-theme.css +5 -0
- package/dist/tokens/tokens.css +15 -3
- package/dist/tokens/tokens.json +8 -3
- package/dist/views/asset-view.js +4 -1
- package/dist/views/content-list-preview.js +3 -1
- package/dist/views/content-list-settings-view.js +11 -7
- package/dist/views/content-list-view.d.ts +5 -3
- package/dist/views/content-list-view.js +38 -34
- package/dist/views/content-picker-view.d.ts +3 -0
- package/dist/views/content-picker-view.js +143 -0
- package/dist/views/crop-view.d.ts +4 -6
- package/dist/views/crop-view.js +22 -13
- package/dist/views/date-range-view.js +4 -1
- package/dist/views/file-upload-view.d.ts +5 -7
- package/dist/views/file-upload-view.js +16 -7
- package/dist/views/group-view.d.ts +8 -0
- package/dist/views/group-view.js +123 -0
- package/dist/views/html-view.js +7 -6
- package/dist/views/image-view.js +37 -19
- package/dist/views/link-view.d.ts +3 -0
- package/dist/views/link-view.js +150 -0
- package/dist/views/options-list-view.d.ts +3 -0
- package/dist/views/options-list-view.js +104 -0
- package/dist/views/repeatable-list-view.d.ts +3 -0
- package/dist/views/repeatable-list-view.js +113 -0
- package/dist/views/rich-text-view.js +28 -13
- package/dist/views/suggest-key.d.ts +17 -0
- package/dist/views/suggest-key.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +215 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +179 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +7 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +126 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +115 -3
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +58 -11
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +57 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +137 -0
- package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +10 -5
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +7 -4
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +180 -15
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +41 -5
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +90 -5
- package/node_modules/@kardalum/api-schemas/dist/form-protection.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection.js +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +117 -41
- package/node_modules/@kardalum/api-schemas/dist/index.js +89 -26
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +224 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +404 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +312 -8
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +43 -3
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +13 -1
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +53 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +284 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +5 -5
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +1 -2
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +1 -2
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.js +177 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +258 -7
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +96 -5
- package/node_modules/@kardalum/api-schemas/dist/page-address.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/page-address.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.d.ts +34 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +28 -3
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +55 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.d.ts +76 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.js +316 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +42 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +74 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +26 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +26 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.d.ts +228 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +124 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.js +51 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.d.ts +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.js +21 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +38 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +237 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +205 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +29 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +32 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +120 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +335 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +242 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +16 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +34 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.js +139 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +22 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +31 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.js +150 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +310 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +430 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.d.ts +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.js +114 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +342 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +400 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +180 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +612 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +47 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +100 -12
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.d.ts +189 -0
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.js +164 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +82 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +497 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.d.ts +82 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +91 -1
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +90 -8
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +59 -1
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +110 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +34 -2
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +384 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +616 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +160 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +58 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +34 -3
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
- package/node_modules/@kardalum/api-schemas/package.json +1 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +6 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +5 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +15 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +12 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +8 -3
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +21 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +8 -2
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +355 -22
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +2 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.js +353 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.js +26 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +34 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.js +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +47 -5
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.d.ts +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +95 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +9 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.js +68 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +298 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +25 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +91 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +140 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +36 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +21 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +10 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +2 -1
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +75 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +123 -0
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +1 -2
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +6 -1
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +5 -4
- package/package.json +12 -2
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PluginLabelSchema, labelMapSchema, labelTextSchema, labelUnionError } from "./plugin-labels.js";
|
|
3
|
+
import { hasHiddenPluginCharacter } from "./plugin-cli-commands.js";
|
|
4
|
+
import { PLUGIN_ID_MAX, isPluginManifestId } from "./plugin-id-rules.js";
|
|
5
|
+
import { isPluginPublicFilePath } from "./plugin-site-extensions.js";
|
|
6
|
+
// M32 F4 (D1 to D3, D15, D16, D19, D24): the provider point. A plugin adds a choice beside a built-in
|
|
7
|
+
// the core always has (`core`); the site owner picks one per kind in Server settings. The SDK's
|
|
8
|
+
// manifest check, the server's registry and the admin read these rules from one place. Every
|
|
9
|
+
// checker caps the length first and then reads the text in one loop: no pattern meets an author's
|
|
10
|
+
// text, and no message quotes a value.
|
|
11
|
+
/** D1: the kinds of provider. F4b adds "signIn", H adds "mail". */
|
|
12
|
+
export const PROVIDER_KINDS = ["formProtection", "search", "mediaStore", "mail"];
|
|
13
|
+
/** D1: the `contributions` key each kind is declared under. */
|
|
14
|
+
export const PROVIDER_CONTRIBUTION_KEYS = Object.freeze({
|
|
15
|
+
formProtection: "protectionProviders",
|
|
16
|
+
search: "searchProviders",
|
|
17
|
+
mediaStore: "mediaStores",
|
|
18
|
+
mail: "mailSenders",
|
|
19
|
+
});
|
|
20
|
+
/** D1: per kind, the functions a provider entry must have and the ones it may have. */
|
|
21
|
+
export const PROVIDER_FUNCTIONS = Object.freeze({
|
|
22
|
+
formProtection: Object.freeze({ required: Object.freeze(["verify"]), optional: Object.freeze(["widget"]) }),
|
|
23
|
+
search: Object.freeze({ required: Object.freeze(["index", "remove", "query"]), optional: Object.freeze(["clear"]) }),
|
|
24
|
+
mediaStore: Object.freeze({ required: Object.freeze(["put", "open", "delete", "exists"]), optional: Object.freeze(["ready", "publicBaseUrl"]) }),
|
|
25
|
+
mail: Object.freeze({ required: Object.freeze(["send"]), optional: Object.freeze(["ready"]) }),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* M32 F4b (D43): sign-in is a table kind, not a choice kind: several sign-in providers are switched
|
|
29
|
+
* on at once, so it stays out of PROVIDER_KINDS (the kinds with one active choice) and the providers
|
|
30
|
+
* table derives every table kind from these lists instead.
|
|
31
|
+
*/
|
|
32
|
+
export const SIGN_IN_PROVIDER_KIND = "signIn";
|
|
33
|
+
export const PROVIDER_TABLE_KINDS = [...PROVIDER_KINDS, SIGN_IN_PROVIDER_KIND];
|
|
34
|
+
/** D43: the `contributions` key each table kind is declared under. */
|
|
35
|
+
export const PROVIDER_TABLE_CONTRIBUTION_KEYS = Object.freeze({
|
|
36
|
+
...PROVIDER_CONTRIBUTION_KEYS,
|
|
37
|
+
signIn: "signInProviders",
|
|
38
|
+
});
|
|
39
|
+
/** D43: per table kind, the functions an entry must have and may have; a sign-in entry's `profile` is for oauth2 only. */
|
|
40
|
+
export const PROVIDER_TABLE_FUNCTIONS = Object.freeze({
|
|
41
|
+
...PROVIDER_FUNCTIONS,
|
|
42
|
+
signIn: Object.freeze({ required: Object.freeze([]), optional: Object.freeze(["profile"]) }),
|
|
43
|
+
});
|
|
44
|
+
/** D2: the built-in provider's key, every kind's default and fallback. */
|
|
45
|
+
export const CORE_PROVIDER_KEY = "core";
|
|
46
|
+
/** D1: the most entries one plugin declares for one kind. */
|
|
47
|
+
export const PROVIDERS_PER_KIND_MAX = 3;
|
|
48
|
+
/** D1: a provider id, 1 to 40 characters. */
|
|
49
|
+
export const PROVIDER_ID_MAX = 40;
|
|
50
|
+
/** D1: a provider's label and description, shown to the site owner. */
|
|
51
|
+
export const PROVIDER_LABEL_MAX = 80;
|
|
52
|
+
export const PROVIDER_DESCRIPTION_MAX = 300;
|
|
53
|
+
/** A provider text as a label (a string, or a map with `en`), each text trimmed and 1 to `max`
|
|
54
|
+
* characters. A fresh instance each call, because the OpenAPI conversion drops a schema instance
|
|
55
|
+
* that a second union reuses (see pluginLabelMapSchema). */
|
|
56
|
+
function providerTextSchema(max) {
|
|
57
|
+
return z.union([labelTextSchema({ max, trim: true }), labelMapSchema({ max, trim: true })], { error: labelUnionError });
|
|
58
|
+
}
|
|
59
|
+
/** D1: a provider entry's label in the manifest schema, at the door's PROVIDER_LABEL_MAX. */
|
|
60
|
+
export function providerLabelSchema() {
|
|
61
|
+
return providerTextSchema(PROVIDER_LABEL_MAX);
|
|
62
|
+
}
|
|
63
|
+
/** D1: a provider entry's description in the manifest schema, at the door's PROVIDER_DESCRIPTION_MAX
|
|
64
|
+
* (a sign-in entry's own is signInDescriptionSchema, narrower). */
|
|
65
|
+
export function providerDescriptionSchema() {
|
|
66
|
+
return providerTextSchema(PROVIDER_DESCRIPTION_MAX);
|
|
67
|
+
}
|
|
68
|
+
/** The longest a stored choice may be: a provider key never comes near it (PLUGIN_ID_MAX + 1 + PROVIDER_ID_MAX). */
|
|
69
|
+
const PROVIDER_CHOICE_MAX = 200;
|
|
70
|
+
/** D15: a protection provider's form field prefix, 3 to 24 characters. */
|
|
71
|
+
export const PROTECTION_FIELD_PREFIX_MIN = 3;
|
|
72
|
+
export const PROTECTION_FIELD_PREFIX_MAX = 24;
|
|
73
|
+
/** D15: the most posted fields under the prefix a provider's `verify` gets, and their total size. */
|
|
74
|
+
export const PROTECTION_FIELDS_MAX = 8;
|
|
75
|
+
export const PROTECTION_FIELDS_BYTES_MAX = 8192;
|
|
76
|
+
/** D16: the most `data-*` attributes a widget's `<div>` carries. */
|
|
77
|
+
export const PROTECTION_WIDGET_DATA_MAX = 10;
|
|
78
|
+
/** M33 K50: the longest `fallbackText` a widget may answer, the visible sentence a visitor reads when its script does not run. */
|
|
79
|
+
export const PROTECTION_WIDGET_FALLBACK_MAX = 300;
|
|
80
|
+
/** D16: the longest widget class name, and the longest `data-*` value, a provider's widget may answer. */
|
|
81
|
+
export const PROTECTION_WIDGET_CLASS_MAX = 64;
|
|
82
|
+
export const PROTECTION_WIDGET_VALUE_MAX = 1000;
|
|
83
|
+
/**
|
|
84
|
+
* M33 K53: the words a form protection provider's refusal may tell the calling plugin (`verify`'s
|
|
85
|
+
* `tell`), so the plugin can show its visitor one fixed sentence. A closed list that only grows; no
|
|
86
|
+
* provider text ever reaches a visitor. `needsScript`: the send came without the check's script's answer.
|
|
87
|
+
* `expired` (D5): the answer was for a challenge whose time had run out, so a fresh send can pass.
|
|
88
|
+
* `unavailable` (D5): the provider could not check at all (its own service did not answer), and says so
|
|
89
|
+
* rather than throwing. A wrong or reused answer carries no word: a sender written to get past the check
|
|
90
|
+
* must learn nothing from its refusal. The core's own `provider_unavailable` (a throw, a timeout, a
|
|
91
|
+
* malformed answer) is the same case as `unavailable`, and a caller answers the two alike.
|
|
92
|
+
*/
|
|
93
|
+
export const PROTECTION_TELL_WORDS = ["needsScript", "expired", "unavailable"];
|
|
94
|
+
/** M33 K53: whether a value is exactly one listed tell word (compared as written, never by a lookup that a prototype name could pass). */
|
|
95
|
+
export function isProtectionTellWord(value) {
|
|
96
|
+
return typeof value === "string" && PROTECTION_TELL_WORDS.some((word) => word === value);
|
|
97
|
+
}
|
|
98
|
+
/** M33 K52: the longest script address `context.protectionWidget()` answers (the asset base and a public/ path). */
|
|
99
|
+
export const PROTECTION_WIDGET_SCRIPT_URL_MAX = 1024;
|
|
100
|
+
const WIDGET_DATA_NAME_MAX = 40;
|
|
101
|
+
/** D19: the most documents one `index` call gets. */
|
|
102
|
+
export const SEARCH_INDEX_BATCH = 100;
|
|
103
|
+
/** D19: the longest `nextCursor` a search provider may answer. */
|
|
104
|
+
export const SEARCH_PROVIDER_CURSOR_MAX = 512;
|
|
105
|
+
/** D23, D24: a provider's cursor is handed to the reader wrapped as `p.<pluginId>/<providerId>.<cursor>`. */
|
|
106
|
+
export const SEARCH_CURSOR_PREFIX = "p.";
|
|
107
|
+
/** D24: the longest wrapped cursor: the prefix, a provider key, ".", and the provider's own cursor. */
|
|
108
|
+
export const PROVIDER_SEARCH_CURSOR_MAX = SEARCH_CURSOR_PREFIX.length + PLUGIN_ID_MAX + 1 + PROVIDER_ID_MAX + 1 + SEARCH_PROVIDER_CURSOR_MAX;
|
|
109
|
+
/** D6: how long the core waits for each provider call, in milliseconds. */
|
|
110
|
+
export const PROVIDER_TIME_MS = Object.freeze({
|
|
111
|
+
protection: 3000,
|
|
112
|
+
searchQuery: 2000,
|
|
113
|
+
searchIndex: 10000,
|
|
114
|
+
mediaPut: 60000,
|
|
115
|
+
mediaOpen: 10000,
|
|
116
|
+
mediaDelete: 10000,
|
|
117
|
+
/** M32 F4e (E1): a media store's `publicBaseUrl`. */
|
|
118
|
+
mediaPublicBase: 2000,
|
|
119
|
+
/** M32 F4b (D33): an oauth2 sign-in provider's `profile`. */
|
|
120
|
+
signInProfile: 5000,
|
|
121
|
+
/** M32 H (H1): a mail sender's `send` and `ready`. */
|
|
122
|
+
mailSend: 30000,
|
|
123
|
+
mailReady: 2000,
|
|
124
|
+
});
|
|
125
|
+
/** M32 F4e (E1): the longest public base a media store may answer. */
|
|
126
|
+
export const STORE_PUBLIC_BASE_MAX = 1024;
|
|
127
|
+
/** M32 F4e (E1): the longest public address built from a base and a key. */
|
|
128
|
+
export const STORE_PUBLIC_URL_MAX = 2048;
|
|
129
|
+
/** M32 F4e (E1): how long the core remembers a store's public base. */
|
|
130
|
+
export const STORE_PUBLIC_BASE_MEMO_MS = 5_000;
|
|
131
|
+
/** The checked base without one trailing "/", or null: https only, no user or password, no query, no fragment, length first. Never throws. */
|
|
132
|
+
export function readStorePublicBase(value) {
|
|
133
|
+
try {
|
|
134
|
+
if (typeof value !== "string" || value.length === 0 || value.length > STORE_PUBLIC_BASE_MAX)
|
|
135
|
+
return null;
|
|
136
|
+
const url = new URL(value);
|
|
137
|
+
if (url.protocol !== "https:" || url.username !== "" || url.password !== "" || url.search !== "" || url.hash !== "")
|
|
138
|
+
return null;
|
|
139
|
+
if (value.includes("?") || value.includes("#"))
|
|
140
|
+
return null;
|
|
141
|
+
const text = url.toString();
|
|
142
|
+
const base = text.endsWith("/") ? text.slice(0, -1) : text;
|
|
143
|
+
return base.length > STORE_PUBLIC_BASE_MAX ? null : base;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/** base + "/" + each key segment encodeURIComponent'd, or null past STORE_PUBLIC_URL_MAX. */
|
|
150
|
+
export function storePublicUrl(base, key) {
|
|
151
|
+
try {
|
|
152
|
+
const url = `${base}/${key.split("/").map(encodeURIComponent).join("/")}`;
|
|
153
|
+
return url.length > STORE_PUBLIC_URL_MAX ? null : url;
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const HYPHEN = 45;
|
|
160
|
+
const UNDERSCORE = 95;
|
|
161
|
+
const DOT = 46;
|
|
162
|
+
const SLASH = 47;
|
|
163
|
+
/** A C0 control character, DEL, or a C1 control character. */
|
|
164
|
+
export function isControlCode(code) {
|
|
165
|
+
return code < 0x20 || code === 0x7f || (code >= 0x80 && code <= 0x9f);
|
|
166
|
+
}
|
|
167
|
+
function isLowerLetter(code) {
|
|
168
|
+
return code >= 97 && code <= 122;
|
|
169
|
+
}
|
|
170
|
+
function isDigit(code) {
|
|
171
|
+
return code >= 48 && code <= 57;
|
|
172
|
+
}
|
|
173
|
+
/** 1 to `max` characters: a-z first, then a-z, 0-9 and `extra`; `extra` last only when `extraLast`. The one loop every name rule here shares. */
|
|
174
|
+
export function isLowerToken(text, max, extra, extraLast) {
|
|
175
|
+
if (text.length === 0 || text.length > max)
|
|
176
|
+
return false;
|
|
177
|
+
if (!isLowerLetter(text.charCodeAt(0)))
|
|
178
|
+
return false;
|
|
179
|
+
if (!extraLast && text.charCodeAt(text.length - 1) === extra)
|
|
180
|
+
return false;
|
|
181
|
+
for (let i = 1; i < text.length; i++) {
|
|
182
|
+
const code = text.charCodeAt(i);
|
|
183
|
+
if (!isLowerLetter(code) && !isDigit(code) && code !== extra)
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
/** D1: a provider's id: a-z first, then a-z, 0-9 and "-", 1 to 40, no "-" last (the action id alphabet). */
|
|
189
|
+
export function isProviderId(id) {
|
|
190
|
+
return isLowerToken(id, PROVIDER_ID_MAX, HYPHEN, false);
|
|
191
|
+
}
|
|
192
|
+
/** D1: a provider's key, `<pluginId>/<id>`. */
|
|
193
|
+
export function providerKey(pluginId, id) {
|
|
194
|
+
return `${pluginId}/${id}`;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* D1: a key split into its plugin id and provider id, or null for `core` and for anything that is
|
|
198
|
+
* not one manifest id, one "/" and one provider id. The length is capped before anything else reads it.
|
|
199
|
+
*/
|
|
200
|
+
export function parseProviderKey(key) {
|
|
201
|
+
if (key.length === 0 || key.length > PLUGIN_ID_MAX + 1 + PROVIDER_ID_MAX)
|
|
202
|
+
return null;
|
|
203
|
+
const slash = key.indexOf("/");
|
|
204
|
+
if (slash <= 0 || key.indexOf("/", slash + 1) !== -1)
|
|
205
|
+
return null;
|
|
206
|
+
const pluginId = key.slice(0, slash);
|
|
207
|
+
const id = key.slice(slash + 1);
|
|
208
|
+
if (!isProviderId(id) || !isPluginManifestId(pluginId))
|
|
209
|
+
return null;
|
|
210
|
+
return { pluginId, id };
|
|
211
|
+
}
|
|
212
|
+
/** D3: a stored choice, `core` or a valid provider key. Whether that provider is attached is the server's check. */
|
|
213
|
+
export const ProviderChoiceSchema = z
|
|
214
|
+
.string()
|
|
215
|
+
.max(PROVIDER_CHOICE_MAX, { message: `A provider choice is at most ${PROVIDER_CHOICE_MAX} characters.` })
|
|
216
|
+
.refine((value) => value === CORE_PROVIDER_KEY || parseProviderKey(value) !== null, {
|
|
217
|
+
message: 'Choose "core" or a provider key such as "com.vendor.plugin/provider".',
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* D15: a protection provider's field prefix: 3 to 24 of a-z, 0-9 and "_", a letter first and "_"
|
|
221
|
+
* last, never starting "kp". `verify` gets every posted field under it, so a short prefix ("e",
|
|
222
|
+
* "n") would hand a provider the visitor's email or name from every form, and "kp" would hand it
|
|
223
|
+
* the built-in check's own fields (kp_website, kp_token).
|
|
224
|
+
*/
|
|
225
|
+
export function isProtectionFieldPrefix(prefix) {
|
|
226
|
+
if (prefix.length < PROTECTION_FIELD_PREFIX_MIN || !isLowerToken(prefix, PROTECTION_FIELD_PREFIX_MAX, UNDERSCORE, true))
|
|
227
|
+
return false;
|
|
228
|
+
if (prefix.charCodeAt(prefix.length - 1) !== UNDERSCORE)
|
|
229
|
+
return false;
|
|
230
|
+
return prefix.slice(0, 2).toLowerCase() !== "kp";
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* M33 K50: a widget's `fallbackText`, shown to every visitor of the public page: a string of 1 to
|
|
234
|
+
* PROTECTION_WIDGET_FALLBACK_MAX characters, not blank, with no control, direction or other hidden
|
|
235
|
+
* character and no lone surrogate (isProviderText), so the sentence cannot reorder the page's text.
|
|
236
|
+
* One linear scan; the length is checked first.
|
|
237
|
+
*/
|
|
238
|
+
export function isProtectionWidgetFallbackText(text) {
|
|
239
|
+
return typeof text === "string" && isProviderText(text, PROTECTION_WIDGET_FALLBACK_MAX);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* M33 K51: a protection provider's `widgetScript`: a file of the plugin's own `public/` folder by the
|
|
243
|
+
* one rule (isPluginPublicFilePath) whose name ends ".js" and is more than ".js". The core writes it
|
|
244
|
+
* as `<script src defer>` under the plugin's asset mount, so no origin and no other kind of file.
|
|
245
|
+
*/
|
|
246
|
+
export function isProtectionWidgetScript(path) {
|
|
247
|
+
if (typeof path !== "string" || !isPluginPublicFilePath(path) || !path.endsWith(".js"))
|
|
248
|
+
return false;
|
|
249
|
+
const nameStart = path.lastIndexOf("/") + 1;
|
|
250
|
+
return path.length - nameStart > 3;
|
|
251
|
+
}
|
|
252
|
+
/** D16: one CSS class name: 1 to PROTECTION_WIDGET_CLASS_MAX of a-z, A-Z, 0-9, "-" and "_". One linear scan, the length first. */
|
|
253
|
+
export function isProtectionWidgetClass(name) {
|
|
254
|
+
if (typeof name !== "string" || name.length === 0 || name.length > PROTECTION_WIDGET_CLASS_MAX)
|
|
255
|
+
return false;
|
|
256
|
+
for (let i = 0; i < name.length; i++) {
|
|
257
|
+
const code = name.charCodeAt(i);
|
|
258
|
+
const letter = (code >= 97 && code <= 122) || (code >= 65 && code <= 90);
|
|
259
|
+
const digit = code >= 48 && code <= 57;
|
|
260
|
+
if (!letter && !digit && code !== 45 && code !== 95)
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
/** D16: a widget attribute's name, written as `data-<name>`: a-z first, then a-z, 0-9 and "-", 1 to 40. */
|
|
266
|
+
export function isWidgetDataName(name) {
|
|
267
|
+
return isLowerToken(name, WIDGET_DATA_NAME_MAX, HYPHEN, true);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* M33 K52: what `context.protectionWidget()` answers a front end the site builds itself: the chosen
|
|
271
|
+
* provider's key, its field prefix, the widget's checked parts (the same ones `{% form_protection %}`
|
|
272
|
+
* writes) and its script's address, with `widget` and `script` null when the provider has none.
|
|
273
|
+
* The whole answer is `null` while the built-in check serves alone, so this schema is the non-null shape.
|
|
274
|
+
*/
|
|
275
|
+
export const ProtectionWidgetInfoSchema = z
|
|
276
|
+
.object({
|
|
277
|
+
provider: z
|
|
278
|
+
.string()
|
|
279
|
+
.max(PROVIDER_CHOICE_MAX)
|
|
280
|
+
.refine((key) => parseProviderKey(key) !== null, { message: "A provider key such as \"com.vendor.plugin/provider\"." }),
|
|
281
|
+
fieldPrefix: z.string().refine((prefix) => isProtectionFieldPrefix(prefix), { message: "A protection provider's field prefix." }),
|
|
282
|
+
widget: z
|
|
283
|
+
.object({
|
|
284
|
+
class: z.string().refine((name) => isProtectionWidgetClass(name), { message: "One CSS class name." }).optional(),
|
|
285
|
+
data: z
|
|
286
|
+
.record(z.string().refine((name) => isWidgetDataName(name), { message: "A data attribute name." }), z.string().max(PROTECTION_WIDGET_VALUE_MAX))
|
|
287
|
+
.refine((data) => Object.keys(data).length <= PROTECTION_WIDGET_DATA_MAX, { message: `At most ${PROTECTION_WIDGET_DATA_MAX} data attributes.` })
|
|
288
|
+
.optional(),
|
|
289
|
+
fallbackText: z.string().refine((text) => isProtectionWidgetFallbackText(text), { message: "A visible sentence of 1 to 300 characters." }).optional(),
|
|
290
|
+
})
|
|
291
|
+
.strict()
|
|
292
|
+
.nullable(),
|
|
293
|
+
script: z.string().min(1).max(PROTECTION_WIDGET_SCRIPT_URL_MAX).nullable(),
|
|
294
|
+
})
|
|
295
|
+
.strict();
|
|
296
|
+
/**
|
|
297
|
+
* A label or description a plugin wrote for a person to read (a provider's, a secret's): 1 to `max`
|
|
298
|
+
* UTF-16 units on its raw length, not blank, and no control character, hidden character
|
|
299
|
+
* (`hasHiddenPluginCharacter`) or lone surrogate, so what the reader sees is what was checked.
|
|
300
|
+
*/
|
|
301
|
+
export function isProviderText(text, max) {
|
|
302
|
+
if (text.length === 0 || text.length > max)
|
|
303
|
+
return false;
|
|
304
|
+
if (hasHiddenPluginCharacter(text))
|
|
305
|
+
return false;
|
|
306
|
+
let blank = true;
|
|
307
|
+
for (let i = 0; i < text.length; i++) {
|
|
308
|
+
const code = text.charCodeAt(i);
|
|
309
|
+
if (isControlCode(code))
|
|
310
|
+
return false;
|
|
311
|
+
if (code >= 0xd800 && code <= 0xdbff) {
|
|
312
|
+
const next = i + 1 < text.length ? text.charCodeAt(i + 1) : 0;
|
|
313
|
+
if (next < 0xdc00 || next > 0xdfff)
|
|
314
|
+
return false;
|
|
315
|
+
i++;
|
|
316
|
+
blank = false;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
if (code >= 0xdc00 && code <= 0xdfff)
|
|
320
|
+
return false;
|
|
321
|
+
if (code !== 0x20 && code !== 0xa0 && code !== 0x3000 && !(code >= 0x2000 && code <= 0x200a))
|
|
322
|
+
blank = false;
|
|
323
|
+
}
|
|
324
|
+
return !blank;
|
|
325
|
+
}
|
|
326
|
+
/** The first index of `code` in `text` from `from`, looking at most `span` characters, or -1. */
|
|
327
|
+
function indexWithin(text, code, from, span) {
|
|
328
|
+
const end = Math.min(text.length, from + span);
|
|
329
|
+
for (let i = from; i < end; i++)
|
|
330
|
+
if (text.charCodeAt(i) === code)
|
|
331
|
+
return i;
|
|
332
|
+
return -1;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* D23, D24: a wrapped search cursor split into the provider that issued it (its plugin id and
|
|
336
|
+
* provider id, the provider's whole key, so two plugins' providers of one id never share a cursor)
|
|
337
|
+
* and the provider's own cursor (1 to SEARCH_PROVIDER_CURSOR_MAX characters, no control
|
|
338
|
+
* character), or null. The length is capped before anything reads it, and each separator is looked
|
|
339
|
+
* for only as far as its part may reach. The search answers 400 cursor_expired when the key is not
|
|
340
|
+
* the current choice.
|
|
341
|
+
*/
|
|
342
|
+
export function parseProviderSearchCursor(value) {
|
|
343
|
+
if (value.length > PROVIDER_SEARCH_CURSOR_MAX || !value.startsWith(SEARCH_CURSOR_PREFIX))
|
|
344
|
+
return null;
|
|
345
|
+
const start = SEARCH_CURSOR_PREFIX.length;
|
|
346
|
+
const slash = indexWithin(value, SLASH, start, PLUGIN_ID_MAX + 1);
|
|
347
|
+
if (slash === -1)
|
|
348
|
+
return null;
|
|
349
|
+
const dot = indexWithin(value, DOT, slash + 1, PROVIDER_ID_MAX + 1);
|
|
350
|
+
if (dot === -1)
|
|
351
|
+
return null;
|
|
352
|
+
const pluginId = value.slice(start, slash);
|
|
353
|
+
const providerId = value.slice(slash + 1, dot);
|
|
354
|
+
const cursor = value.slice(dot + 1);
|
|
355
|
+
if (cursor.length === 0 || cursor.length > SEARCH_PROVIDER_CURSOR_MAX)
|
|
356
|
+
return null;
|
|
357
|
+
if (!isProviderId(providerId) || !isPluginManifestId(pluginId))
|
|
358
|
+
return null;
|
|
359
|
+
for (let i = 0; i < cursor.length; i++)
|
|
360
|
+
if (isControlCode(cursor.charCodeAt(i)))
|
|
361
|
+
return null;
|
|
362
|
+
return { pluginId, providerId, cursor };
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* D23: the reader's cursor for a provider's own `nextCursor`, `p.<pluginId>/<providerId>.<cursor>`,
|
|
366
|
+
* or null when the provider key or its cursor is not one `parseProviderSearchCursor` reads back
|
|
367
|
+
* (too long, empty, a control character), so a cursor the core hands out always parses.
|
|
368
|
+
*/
|
|
369
|
+
export function wrapProviderSearchCursor(key, cursor) {
|
|
370
|
+
const parsed = parseProviderKey(key);
|
|
371
|
+
if (parsed === null || typeof cursor !== "string" || cursor.length === 0 || cursor.length > SEARCH_PROVIDER_CURSOR_MAX)
|
|
372
|
+
return null;
|
|
373
|
+
const wrapped = `${SEARCH_CURSOR_PREFIX}${key}.${cursor}`;
|
|
374
|
+
const back = parseProviderSearchCursor(wrapped);
|
|
375
|
+
return back !== null && back.cursor === cursor && back.pluginId === parsed.pluginId && back.providerId === parsed.id ? wrapped : null;
|
|
376
|
+
}
|
|
377
|
+
/** D24: the code a search answers (400) for a wrapped cursor whose provider is not the one serving now. */
|
|
378
|
+
export const SEARCH_CURSOR_EXPIRED_CODE = "cursor_expired";
|
|
379
|
+
export const SearchCursorExpiredErrorSchema = z.object({
|
|
380
|
+
code: z.literal(SEARCH_CURSOR_EXPIRED_CODE),
|
|
381
|
+
message: z.string(),
|
|
382
|
+
});
|
|
383
|
+
/** D24: whether `value` is a wrapped provider search cursor (`parseProviderSearchCursor`). */
|
|
384
|
+
export function isProviderSearchCursor(value) {
|
|
385
|
+
return parseProviderSearchCursor(value) !== null;
|
|
386
|
+
}
|
|
387
|
+
/** One attached provider in the providers answer: its key, its plugin, its label and whether its plugin is switched on. */
|
|
388
|
+
export const ProviderEntrySchema = z.object({
|
|
389
|
+
key: z.string(),
|
|
390
|
+
pluginId: z.string(),
|
|
391
|
+
label: PluginLabelSchema,
|
|
392
|
+
available: z.boolean(),
|
|
393
|
+
});
|
|
394
|
+
/**
|
|
395
|
+
* M32 F4 (D4): one kind's state. `chosen` is the choice as stored (a provider key, or `core`);
|
|
396
|
+
* `active` is the key serving now, which is `core` when the chosen provider is no longer attached
|
|
397
|
+
* or its plugin is off; `fallsBack` is true then, so the screen can say the choice runs on the core.
|
|
398
|
+
*/
|
|
399
|
+
export const ProviderKindStateSchema = z.object({
|
|
400
|
+
chosen: z.string(),
|
|
401
|
+
active: z.string(),
|
|
402
|
+
fallsBack: z.boolean(),
|
|
403
|
+
entries: z.array(ProviderEntrySchema),
|
|
404
|
+
});
|
|
405
|
+
export const ProvidersResponseSchema = z.object({
|
|
406
|
+
kinds: z.object({
|
|
407
|
+
formProtection: ProviderKindStateSchema,
|
|
408
|
+
search: ProviderKindStateSchema,
|
|
409
|
+
mediaStore: ProviderKindStateSchema,
|
|
410
|
+
mail: ProviderKindStateSchema,
|
|
411
|
+
}),
|
|
412
|
+
});
|
|
413
|
+
/**
|
|
414
|
+
* M32 F4 (D22): a search index rebuild's progress, as the `server.searchRebuild` setting row holds
|
|
415
|
+
* it. `after` is the id of the last page sent (the walk goes by path, then id), null before the
|
|
416
|
+
* first batch; `count` the documents sent; `finishedAt` null while it runs or waits to be resumed.
|
|
417
|
+
*/
|
|
418
|
+
export const SearchRebuildProgressSchema = z.object({
|
|
419
|
+
provider: z.string().min(1),
|
|
420
|
+
after: z.string().uuid().nullable(),
|
|
421
|
+
/** The path `after` had when it was read; the walk goes on after (afterPath, after) by value, wherever the page is now. */
|
|
422
|
+
afterPath: z.string().min(1).nullable(),
|
|
423
|
+
count: z.number().int().nonnegative(),
|
|
424
|
+
startedAt: z.string().datetime(),
|
|
425
|
+
finishedAt: z.string().datetime().nullable(),
|
|
426
|
+
});
|
|
427
|
+
/** M32 F4 (D22): `GET` and `POST /providers/search/rebuild`: the rebuild's progress, null when none has run for the chosen provider. */
|
|
428
|
+
export const SearchRebuildResponseSchema = z.object({
|
|
429
|
+
rebuild: SearchRebuildProgressSchema.nullable(),
|
|
430
|
+
});
|
|
@@ -8,6 +8,10 @@ export declare const PluginReadOnlyNoticeSchema: z.ZodObject<{
|
|
|
8
8
|
message: z.ZodString;
|
|
9
9
|
renewUrl: z.ZodOptional<z.ZodString>;
|
|
10
10
|
lapsedAt: z.ZodOptional<z.ZodString>;
|
|
11
|
+
cause: z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
lapsed: "lapsed";
|
|
13
|
+
refunded: "refunded";
|
|
14
|
+
}>>;
|
|
11
15
|
}, z.core.$strip>;
|
|
12
16
|
export type PluginReadOnlyNotice = z.infer<typeof PluginReadOnlyNoticeSchema>;
|
|
13
17
|
export declare function isPluginReadOnlyNotice(value: unknown): value is PluginReadOnlyNotice;
|
|
@@ -17,6 +17,8 @@ export const PluginReadOnlyNoticeSchema = z.object({
|
|
|
17
17
|
renewUrl: z.string().optional(),
|
|
18
18
|
/** The lapsed term's end (ISO). */
|
|
19
19
|
lapsedAt: z.string().optional(),
|
|
20
|
+
/** M32 I6f: why it is read-only; absent reads as lapsed. */
|
|
21
|
+
cause: z.enum(["lapsed", "refunded"]).optional(),
|
|
20
22
|
});
|
|
21
23
|
export function isPluginReadOnlyNotice(value) {
|
|
22
24
|
return PluginReadOnlyNoticeSchema.safeParse(value).success;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The most kinds one plugin declares (at least one when the key is there). */
|
|
3
|
+
export declare const PLUGIN_SEALED_KINDS_MAX = 10;
|
|
4
|
+
/** A kind's id, 1 to 40 characters: the settings id rule. */
|
|
5
|
+
export declare const PLUGIN_SEALED_KIND_ID_MAX = 40;
|
|
6
|
+
/** The most UTF-8 bytes one value holds (at least one). */
|
|
7
|
+
export declare const PLUGIN_SEALED_VALUE_MAX_BYTES = 4096;
|
|
8
|
+
/** A record key, 1 to 200 printable ASCII characters (0x20 to 0x7e). */
|
|
9
|
+
export declare const PLUGIN_SEALED_RECORD_KEY_MAX = 200;
|
|
10
|
+
/** A kind's id: a letter, then letters, digits and "_", 1 to 40 (the settings id rule). */
|
|
11
|
+
export declare function isSealedValueKindId(value: string): boolean;
|
|
12
|
+
/** A value `seal` takes: a string of 1 to 4,096 UTF-8 bytes. A UTF-16 unit is at least one byte,
|
|
13
|
+
* so the length cap runs before the byte count. */
|
|
14
|
+
export declare function isSealableValue(value: string): boolean;
|
|
15
|
+
/** A record key `seal` and `open` take: 1 to 200 printable ASCII characters, by a linear scan. */
|
|
16
|
+
export declare function isSealedRecordKey(value: string): boolean;
|
|
17
|
+
export declare const PluginSealedValueKindSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
label: z.ZodPreprocess<z.ZodObject<{
|
|
20
|
+
en: z.ZodString;
|
|
21
|
+
}, z.core.$catchall<z.ZodString>>, unknown>;
|
|
22
|
+
leavesServer: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export type PluginSealedValueKind = z.infer<typeof PluginSealedValueKindSchema>;
|
|
25
|
+
/** `contributions.sealedValues`: 1 to 10 kinds, each id once. */
|
|
26
|
+
export declare const PluginSealedValuesSchema: z.ZodArray<z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
label: z.ZodPreprocess<z.ZodObject<{
|
|
29
|
+
en: z.ZodString;
|
|
30
|
+
}, z.core.$catchall<z.ZodString>>, unknown>;
|
|
31
|
+
leavesServer: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
/** Why `seal` or `open` refused (consolidation 3.7): a kind the manifest does not declare, an
|
|
34
|
+
* input outside the limits above, or a plugin that is no longer active. `open` answers null for a
|
|
35
|
+
* sealed text that does not open; it throws only for these. */
|
|
36
|
+
export declare const SEALING_REFUSAL_REASONS: readonly ["unknownKind", "invalid", "inactive"];
|
|
37
|
+
export type SealingRefusalReason = (typeof SEALING_REFUSAL_REASONS)[number];
|
|
38
|
+
/** What `context.sealing` throws. Its message names the reason and nothing else: never a value, a
|
|
39
|
+
* record key or a sealed text. */
|
|
40
|
+
export declare class SealingRefusedError extends Error {
|
|
41
|
+
readonly reason: SealingRefusalReason;
|
|
42
|
+
constructor(reason: SealingRefusalReason);
|
|
43
|
+
}
|
|
44
|
+
/** True for a SealingRefusedError from ANY copy of the SDK: read by name and reason. */
|
|
45
|
+
export declare function isSealingRefusedError(value: unknown): value is SealingRefusedError;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SlotLabelSchema } from "./plugin-labels.js";
|
|
3
|
+
import { fitsUtf8 } from "./plugin-secrets.js";
|
|
4
|
+
import { PLUGIN_SETTING_ID_MAX, isPluginSettingId } from "./plugin-settings.js";
|
|
5
|
+
// M33 K17 (Webhooks 2.11 C2, as consolidation 3.2 and 3.7 amend it): sealed values. A plugin
|
|
6
|
+
// declares the kinds of value it seals in `contributions.sealedValues` and gets `context.sealing`
|
|
7
|
+
// (`seal`, `open`) on its hook, route, site route, scheduled task and provider contexts. The host
|
|
8
|
+
// encrypts with a key derived per plugin and kind and stores nothing: the plugin keeps the sealed
|
|
9
|
+
// text in its own tables. A kind marked `leavesServer` is one whose sealed text the plugin hands to
|
|
10
|
+
// visitors (a token in a page), which the install screen says. Every check below caps the length
|
|
11
|
+
// first and reads the text in one loop, never with a pattern, and never throws.
|
|
12
|
+
/** The most kinds one plugin declares (at least one when the key is there). */
|
|
13
|
+
export const PLUGIN_SEALED_KINDS_MAX = 10;
|
|
14
|
+
/** A kind's id, 1 to 40 characters: the settings id rule. */
|
|
15
|
+
export const PLUGIN_SEALED_KIND_ID_MAX = PLUGIN_SETTING_ID_MAX;
|
|
16
|
+
/** The most UTF-8 bytes one value holds (at least one). */
|
|
17
|
+
export const PLUGIN_SEALED_VALUE_MAX_BYTES = 4096;
|
|
18
|
+
/** A record key, 1 to 200 printable ASCII characters (0x20 to 0x7e). */
|
|
19
|
+
export const PLUGIN_SEALED_RECORD_KEY_MAX = 200;
|
|
20
|
+
/** A kind's id: a letter, then letters, digits and "_", 1 to 40 (the settings id rule). */
|
|
21
|
+
export function isSealedValueKindId(value) {
|
|
22
|
+
try {
|
|
23
|
+
return isPluginSettingId(value);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** A value `seal` takes: a string of 1 to 4,096 UTF-8 bytes. A UTF-16 unit is at least one byte,
|
|
30
|
+
* so the length cap runs before the byte count. */
|
|
31
|
+
export function isSealableValue(value) {
|
|
32
|
+
try {
|
|
33
|
+
if (typeof value !== "string" || value.length === 0 || value.length > PLUGIN_SEALED_VALUE_MAX_BYTES)
|
|
34
|
+
return false;
|
|
35
|
+
return fitsUtf8(value, PLUGIN_SEALED_VALUE_MAX_BYTES);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** A record key `seal` and `open` take: 1 to 200 printable ASCII characters, by a linear scan. */
|
|
42
|
+
export function isSealedRecordKey(value) {
|
|
43
|
+
try {
|
|
44
|
+
if (typeof value !== "string" || value.length === 0 || value.length > PLUGIN_SEALED_RECORD_KEY_MAX)
|
|
45
|
+
return false;
|
|
46
|
+
for (let i = 0; i < value.length; i++) {
|
|
47
|
+
const code = value.charCodeAt(i);
|
|
48
|
+
if (code < 0x20 || code > 0x7e)
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export const PluginSealedValueKindSchema = z
|
|
58
|
+
.object({
|
|
59
|
+
id: z.string().refine((value) => isSealedValueKindId(value), {
|
|
60
|
+
message: `must be a letter, then letters, digits and "_", 1 to ${PLUGIN_SEALED_KIND_ID_MAX} characters`,
|
|
61
|
+
}),
|
|
62
|
+
label: SlotLabelSchema,
|
|
63
|
+
leavesServer: z.boolean().optional(),
|
|
64
|
+
})
|
|
65
|
+
.strict();
|
|
66
|
+
/** `contributions.sealedValues`: 1 to 10 kinds, each id once. */
|
|
67
|
+
export const PluginSealedValuesSchema = z
|
|
68
|
+
.array(PluginSealedValueKindSchema)
|
|
69
|
+
.min(1, { message: "must declare at least one kind (leave sealedValues out when the plugin seals nothing)" })
|
|
70
|
+
.max(PLUGIN_SEALED_KINDS_MAX, { message: `declares at most ${PLUGIN_SEALED_KINDS_MAX} kinds` })
|
|
71
|
+
.superRefine((kinds, ctx) => {
|
|
72
|
+
const ids = new Set();
|
|
73
|
+
kinds.forEach((kind, index) => {
|
|
74
|
+
if (ids.has(kind.id))
|
|
75
|
+
ctx.addIssue({ code: "custom", message: `sealedValues id "${kind.id}" is declared twice`, path: [index, "id"] });
|
|
76
|
+
ids.add(kind.id);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
/** Why `seal` or `open` refused (consolidation 3.7): a kind the manifest does not declare, an
|
|
80
|
+
* input outside the limits above, or a plugin that is no longer active. `open` answers null for a
|
|
81
|
+
* sealed text that does not open; it throws only for these. */
|
|
82
|
+
export const SEALING_REFUSAL_REASONS = ["unknownKind", "invalid", "inactive"];
|
|
83
|
+
/** What `context.sealing` throws. Its message names the reason and nothing else: never a value, a
|
|
84
|
+
* record key or a sealed text. */
|
|
85
|
+
export class SealingRefusedError extends Error {
|
|
86
|
+
reason;
|
|
87
|
+
constructor(reason) {
|
|
88
|
+
super(`sealing refused: ${reason}`);
|
|
89
|
+
this.name = "SealingRefusedError";
|
|
90
|
+
this.reason = reason;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** True for a SealingRefusedError from ANY copy of the SDK: read by name and reason. */
|
|
94
|
+
export function isSealingRefusedError(value) {
|
|
95
|
+
if (!(value instanceof Error) || value.name !== "SealingRefusedError")
|
|
96
|
+
return false;
|
|
97
|
+
const reason = value.reason;
|
|
98
|
+
return typeof reason === "string" && SEALING_REFUSAL_REASONS.includes(reason);
|
|
99
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type PluginLabel } from "./plugin-labels.js";
|
|
3
|
+
/** D10: the most secrets one plugin declares. */
|
|
4
|
+
export declare const PLUGIN_SECRETS_MAX = 10;
|
|
5
|
+
/** D10: a secret's name, 1 to 40 characters. */
|
|
6
|
+
export declare const PLUGIN_SECRET_NAME_MAX = 40;
|
|
7
|
+
/** D11: the most UTF-8 bytes a value holds. */
|
|
8
|
+
export declare const PLUGIN_SECRET_VALUE_MAX_BYTES = 4096;
|
|
9
|
+
/** D10: a secret's name: a-z first, then a-z, 0-9 and "_", 1 to 40. */
|
|
10
|
+
export declare function isPluginSecretName(name: string): boolean;
|
|
11
|
+
/** D10: one declared secret as the core reads it from a manifest. */
|
|
12
|
+
export interface DeclaredPluginSecret {
|
|
13
|
+
name: string;
|
|
14
|
+
label: PluginLabel;
|
|
15
|
+
description?: PluginLabel;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* D10, M32 F4d (D1): the secrets `contributions.secrets` declares, each judged by its whole
|
|
19
|
+
* declaration: a secret name's shape, a label that parses, a description that parses when given, the
|
|
20
|
+
* first of a name kept, at most PLUGIN_SECRETS_MAX read. One rule for the Secrets list, the plugin
|
|
21
|
+
* settings fields and the install questions, so none of them names a secret another leaves out.
|
|
22
|
+
* Reads plain data only: a getter that throws means no secrets.
|
|
23
|
+
*/
|
|
24
|
+
export declare function declaredPluginSecretsOf(contributions: unknown): DeclaredPluginSecret[];
|
|
25
|
+
/** Whether `text` encodes to at most `max` UTF-8 bytes, counted in one pass that stops past the cap. A lone surrogate counts as the three bytes of U+FFFD it encodes as. */
|
|
26
|
+
export declare function fitsUtf8(text: string, max: number): boolean;
|
|
27
|
+
/** D12: the body of `PUT .../secrets/:name`. A UTF-16 unit is at least one UTF-8 byte, so the length cap runs first. */
|
|
28
|
+
export declare const PluginSecretPutBodySchema: z.ZodObject<{
|
|
29
|
+
value: z.ZodString;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export type PluginSecretPutBody = z.infer<typeof PluginSecretPutBodySchema>;
|
|
32
|
+
/** D12: one declared secret as `GET .../secrets` answers it. `unreadable`: a stored row no longer decrypts (D11).
|
|
33
|
+
* Evidence 148: `label` and `description` are answered as declared (a string, or a language map the
|
|
34
|
+
* admin resolves in the signed-in person's language). */
|
|
35
|
+
export declare const PluginSecretRowSchema: z.ZodObject<{
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
38
|
+
en: z.ZodString;
|
|
39
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
40
|
+
description: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
41
|
+
en: z.ZodString;
|
|
42
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>>;
|
|
43
|
+
set: z.ZodBoolean;
|
|
44
|
+
updatedAt: z.ZodNullable<z.ZodString>;
|
|
45
|
+
unreadable: z.ZodBoolean;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
export type PluginSecretRow = z.infer<typeof PluginSecretRowSchema>;
|
|
48
|
+
export declare const PluginSecretListResponseSchema: z.ZodObject<{
|
|
49
|
+
items: z.ZodArray<z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
52
|
+
en: z.ZodString;
|
|
53
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
54
|
+
description: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
55
|
+
en: z.ZodString;
|
|
56
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>>;
|
|
57
|
+
set: z.ZodBoolean;
|
|
58
|
+
updatedAt: z.ZodNullable<z.ZodString>;
|
|
59
|
+
unreadable: z.ZodBoolean;
|
|
60
|
+
}, z.core.$strict>>;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
export type PluginSecretListResponse = z.infer<typeof PluginSecretListResponseSchema>;
|
|
63
|
+
/** D12: the path of `PUT` and `DELETE .../plugins/:pluginId/secrets/:name`. A name the manifest does not declare answers 404. */
|
|
64
|
+
export declare const PluginSecretParamsSchema: z.ZodObject<{
|
|
65
|
+
pluginId: z.ZodString;
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
}, z.core.$strict>;
|
|
68
|
+
export type PluginSecretParams = z.infer<typeof PluginSecretParamsSchema>;
|