@kardalum/plugin-sdk 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +281 -0
- package/README.md +19 -0
- package/dist/admin-section-registry.d.ts +48 -1
- package/dist/admin-section-registry.js +90 -0
- package/dist/built-in-editor-ids.d.ts +1 -1
- package/dist/built-in-editor-ids.js +2 -20
- package/dist/built-in-settings-schemas.d.ts +10 -0
- package/dist/built-in-settings-schemas.js +86 -0
- package/dist/built-in-value-schemas.js +35 -0
- package/dist/built-ins.js +38 -7
- package/dist/capabilities.d.ts +11 -1
- package/dist/capabilities.js +101 -4
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +22 -0
- package/dist/consent-entry.d.ts +11 -0
- package/dist/consent-entry.js +18 -0
- package/dist/content-library.d.ts +102 -0
- package/dist/content-library.js +15 -0
- package/dist/content-list-extensions.d.ts +50 -0
- package/dist/content-list-extensions.js +11 -0
- package/dist/content-picker/page-picker-sheet.d.ts +15 -0
- package/dist/content-picker/page-picker-sheet.js +105 -0
- package/dist/content-picker/page-picker.d.ts +18 -0
- package/dist/content-picker/page-picker.js +20 -0
- package/dist/content-picker/page-tree.d.ts +25 -0
- package/dist/content-picker/page-tree.js +132 -0
- package/dist/data-type-plugin.d.ts +7 -1
- package/dist/datatype-validation.d.ts +4 -9
- package/dist/datatype-validation.js +147 -1
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +2 -0
- package/dist/entitlement-entry.d.ts +1 -1
- package/dist/entitlement-entry.js +1 -1
- package/dist/entitlement-gate.d.ts +14 -0
- package/dist/entitlement-gate.js +64 -7
- package/dist/entitlement-plan.d.ts +6 -0
- package/dist/entitlement-plan.js +10 -0
- package/dist/entitlement-types.d.ts +53 -12
- package/dist/entitlement.d.ts +31 -4
- package/dist/entitlement.js +58 -17
- package/dist/hook-entry.d.ts +5 -0
- package/dist/hook-entry.js +30 -0
- package/dist/host-entry.d.ts +7 -1
- package/dist/host-entry.js +14 -1
- package/dist/index.d.ts +67 -7
- package/dist/index.js +94 -6
- package/dist/mail.d.ts +34 -0
- package/dist/mail.js +1 -0
- package/dist/manifest-entry.d.ts +47 -4
- package/dist/manifest-entry.js +63 -2
- package/dist/manifest-schema.d.ts +993 -40
- package/dist/manifest-schema.js +516 -26
- package/dist/manifest.d.ts +1186 -62
- package/dist/manifest.js +8 -4
- package/dist/media/media-picker.js +31 -18
- package/dist/media/upload-error.d.ts +5 -1
- package/dist/media/upload-error.js +14 -2
- package/dist/media-library.d.ts +32 -0
- package/dist/media-library.js +15 -0
- package/dist/nested-field-host.d.ts +76 -0
- package/dist/nested-field-host.js +90 -0
- package/dist/notify.d.ts +12 -4
- package/dist/notify.js +1 -1
- package/dist/outbound.d.ts +47 -0
- package/dist/outbound.js +1 -0
- package/dist/plugin-context.d.ts +52 -0
- package/dist/plugin-context.js +27 -0
- package/dist/plugin-permissions.d.ts +18 -0
- package/dist/plugin-permissions.js +25 -0
- package/dist/plugin-screen-context.d.ts +262 -9
- package/dist/plugin-screen-context.js +56 -0
- package/dist/providers.d.ts +313 -0
- package/dist/providers.js +74 -0
- package/dist/read-all-pages.d.ts +5 -0
- package/dist/read-all-pages.js +3 -2
- package/dist/render-page.d.ts +15 -0
- package/dist/render-page.js +20 -0
- package/dist/richtext/block-panel.d.ts +12 -1
- package/dist/richtext/block-panel.js +36 -25
- package/dist/richtext/button-view.d.ts +11 -0
- package/dist/richtext/button-view.js +45 -0
- package/dist/richtext/content-guard.d.ts +4 -0
- package/dist/richtext/content-guard.js +27 -0
- package/dist/richtext/editor-handle.d.ts +34 -0
- package/dist/richtext/editor-handle.js +225 -0
- package/dist/richtext/extensions.d.ts +6 -0
- package/dist/richtext/extensions.js +16 -0
- package/dist/richtext/insert-menu.d.ts +6 -1
- package/dist/richtext/insert-menu.js +45 -22
- package/dist/richtext/item-attributes.d.ts +6 -0
- package/dist/richtext/item-attributes.js +19 -0
- package/dist/richtext/item-panel.d.ts +25 -0
- package/dist/richtext/item-panel.js +118 -0
- package/dist/richtext/item-view.d.ts +58 -0
- package/dist/richtext/item-view.js +172 -0
- package/dist/richtext/mark-form.d.ts +10 -0
- package/dist/richtext/mark-form.js +38 -0
- package/dist/richtext/paste-choice.d.ts +9 -0
- package/dist/richtext/paste-choice.js +13 -0
- package/dist/richtext/plugin-items.d.ts +72 -0
- package/dist/richtext/plugin-items.js +562 -0
- package/dist/richtext/plugin-mark-tooltips.d.ts +5 -0
- package/dist/richtext/plugin-mark-tooltips.js +44 -0
- package/dist/richtext/plugin-toolbar.d.ts +57 -0
- package/dist/richtext/plugin-toolbar.js +186 -0
- package/dist/richtext/rich-item-icons.d.ts +5 -0
- package/dist/richtext/rich-item-icons.js +42 -0
- package/dist/richtext/rich-items.d.ts +42 -0
- package/dist/richtext/rich-items.js +68 -0
- package/dist/richtext/rich-text-view-host.d.ts +24 -0
- package/dist/richtext/rich-text-view-host.js +11 -0
- package/dist/richtext/style-listbox.js +6 -4
- package/dist/richtext/toolbar-button.d.ts +16 -0
- package/dist/richtext/toolbar-button.js +9 -0
- package/dist/richtext/url-paste.d.ts +20 -0
- package/dist/richtext/url-paste.js +82 -0
- package/dist/richtext-html-entry.d.ts +5 -0
- package/dist/richtext-html-entry.js +11 -0
- package/dist/sdk-strings.d.ts +344 -0
- package/dist/sdk-strings.js +411 -0
- package/dist/sealing.d.ts +14 -0
- package/dist/sealing.js +1 -0
- package/dist/service-contract.d.ts +17 -0
- package/dist/service-contract.js +39 -0
- package/dist/services.d.ts +114 -0
- package/dist/services.js +1 -0
- package/dist/simple-storage-value-provider.js +24 -24
- package/dist/structured-storage-types.d.ts +429 -9
- package/dist/tailwind.js +10 -5
- package/dist/template-reads.d.ts +16 -0
- package/dist/template-reads.js +21 -0
- package/dist/testing-entry.d.ts +38 -0
- package/dist/testing-entry.js +173 -0
- package/dist/text-entry.d.ts +1 -0
- package/dist/text-entry.js +7 -0
- package/dist/tokens/system-dark.css +1 -0
- package/dist/tokens/tailwind-theme.css +7 -0
- package/dist/tokens/tokens.css +19 -3
- package/dist/tokens/tokens.json +13 -4
- package/dist/uploads.d.ts +43 -0
- package/dist/uploads.js +1 -0
- package/dist/user-library.d.ts +51 -0
- package/dist/user-library.js +15 -0
- package/dist/view-helpers.d.ts +18 -0
- package/dist/view-helpers.js +64 -0
- package/dist/views/asset-view.js +4 -1
- package/dist/views/content-list-preview.js +3 -1
- package/dist/views/content-list-settings-view.js +11 -7
- package/dist/views/content-list-view.d.ts +5 -3
- package/dist/views/content-list-view.js +243 -40
- package/dist/views/content-picker-view.d.ts +3 -0
- package/dist/views/content-picker-view.js +143 -0
- package/dist/views/crop-view.d.ts +4 -6
- package/dist/views/crop-view.js +22 -13
- package/dist/views/date-range-view.js +4 -1
- package/dist/views/file-upload-view.d.ts +5 -7
- package/dist/views/file-upload-view.js +16 -7
- package/dist/views/group-view.d.ts +8 -0
- package/dist/views/group-view.js +123 -0
- package/dist/views/html-view.js +7 -6
- package/dist/views/image-view.js +37 -19
- package/dist/views/link-view.d.ts +3 -0
- package/dist/views/link-view.js +150 -0
- package/dist/views/options-list-view.d.ts +3 -0
- package/dist/views/options-list-view.js +104 -0
- package/dist/views/repeatable-list-view.d.ts +3 -0
- package/dist/views/repeatable-list-view.js +113 -0
- package/dist/views/rich-text-view.d.ts +2 -0
- package/dist/views/rich-text-view.js +208 -35
- package/dist/views/suggest-key.d.ts +17 -0
- package/dist/views/suggest-key.js +55 -0
- package/dist/views/unreadable-rich-text.d.ts +17 -0
- package/dist/views/unreadable-rich-text.js +40 -0
- package/dist/visitors.d.ts +81 -0
- package/dist/visitors.js +1 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.js +39 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +334 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +254 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +11 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +144 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +115 -3
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +58 -11
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +137 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +178 -2
- package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.js +234 -0
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/contribution-issues.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/contribution-issues.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +55 -13
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +22 -10
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +257 -15
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +78 -5
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +90 -5
- package/node_modules/@kardalum/api-schemas/dist/experimental-points.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/experimental-points.js +250 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.d.ts +29 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection.js +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/html-scan.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/html-scan.js +122 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.d.ts +48 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.js +381 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +162 -48
- package/node_modules/@kardalum/api-schemas/dist/index.js +137 -30
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/json-depth.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/json-depth.js +20 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +226 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +409 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +490 -10
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +53 -3
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +38 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +13 -1
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +60 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +333 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +5 -5
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +1 -2
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +1 -2
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.js +177 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +258 -7
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +96 -5
- package/node_modules/@kardalum/api-schemas/dist/page-address.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/page-address.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.d.ts +87 -0
- package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.js +44 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.d.ts +34 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +28 -3
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +55 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.d.ts +76 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.js +316 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +84 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.d.ts +136 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.js +254 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.js +66 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.js +173 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.js +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.js +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +44 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +44 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +16 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.d.ts +228 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +34 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +126 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.d.ts +24 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.js +51 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.d.ts +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-guards.d.ts +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-guards.js +118 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +119 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +216 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.js +21 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +46 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +41 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +304 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +220 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.d.ts +138 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.js +110 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +29 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +32 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +120 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +408 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +307 -23
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +23 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +61 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.js +139 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +23 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.js +150 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +346 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +461 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.d.ts +638 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.js +533 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.d.ts +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.js +114 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.js +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.d.ts +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.js +123 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.d.ts +209 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.js +372 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.js +204 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +352 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +409 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +347 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +976 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.js +149 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +47 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-styles.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-styles.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.d.ts +96 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.js +185 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.d.ts +54 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.js +124 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +100 -12
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.d.ts +189 -0
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.js +164 -0
- package/node_modules/@kardalum/api-schemas/dist/render-cache.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/render-cache.js +263 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +307 -4
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.js +108 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +71 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +540 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +394 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.d.ts +82 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +201 -1
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +36 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +97 -8
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +64 -1
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +136 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +53 -2
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.d.ts +724 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.js +408 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +386 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +618 -0
- package/node_modules/@kardalum/api-schemas/dist/site-consent.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/site-consent.js +122 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +188 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +33 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +26 -1
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +72 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +36 -3
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
- package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.d.ts +482 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.d.ts +109 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.js +62 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +15 -1
- package/node_modules/@kardalum/design-tokens/dist/system-dark.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +7 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +19 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +18 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +13 -4
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +5 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +38 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +17 -2
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +625 -35
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.js +353 -0
- package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.js +39 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.d.ts +23 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.js +351 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.js +26 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +47 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +40 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.js +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +76 -6
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.d.ts +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +99 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +9 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.js +68 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +316 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +40 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.js +173 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +91 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +150 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.js +35 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.js +71 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +69 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +21 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.js +36 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.js +33 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +8 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +7 -1
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +75 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +123 -0
- package/node_modules/@kardalum/plugin-package/dist/public-suffix.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/public-suffix.js +23 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.js +28 -0
- package/node_modules/@kardalum/plugin-package/package.json +4 -0
- package/node_modules/@kardalum/ui/dist/components/select.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/select.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/textarea.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/textarea.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +1 -2
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +6 -1
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +5 -4
- package/node_modules/@kardalum/ui/dist/index.d.ts +2 -0
- package/node_modules/@kardalum/ui/dist/index.js +2 -0
- package/package.json +25 -3
|
@@ -0,0 +1,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>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PluginLabelSchema, pluginDescriptionSchema } from "./plugin-labels.js";
|
|
3
|
+
import { isLowerToken } from "./plugin-providers.js";
|
|
4
|
+
// M32 F4 (D10 to D12): the secrets a plugin declares in `contributions.secrets`, which a person
|
|
5
|
+
// enters in the admin and only the plugin's server code reads. A value never appears in an answer:
|
|
6
|
+
// the list says whether each secret is set, never what it holds, and no message quotes a value.
|
|
7
|
+
/** D10: the most secrets one plugin declares. */
|
|
8
|
+
export const PLUGIN_SECRETS_MAX = 10;
|
|
9
|
+
/** D10: a secret's name, 1 to 40 characters. */
|
|
10
|
+
export const PLUGIN_SECRET_NAME_MAX = 40;
|
|
11
|
+
/** D11: the most UTF-8 bytes a value holds. */
|
|
12
|
+
export const PLUGIN_SECRET_VALUE_MAX_BYTES = 4096;
|
|
13
|
+
/** D10: a secret's name: a-z first, then a-z, 0-9 and "_", 1 to 40. */
|
|
14
|
+
export function isPluginSecretName(name) {
|
|
15
|
+
return isLowerToken(name, PLUGIN_SECRET_NAME_MAX, 95, true);
|
|
16
|
+
}
|
|
17
|
+
function readOwnField(value, key) {
|
|
18
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value[key] : undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* D10, M32 F4d (D1): the secrets `contributions.secrets` declares, each judged by its whole
|
|
22
|
+
* declaration: a secret name's shape, a label that parses, a description that parses when given, the
|
|
23
|
+
* first of a name kept, at most PLUGIN_SECRETS_MAX read. One rule for the Secrets list, the plugin
|
|
24
|
+
* settings fields and the install questions, so none of them names a secret another leaves out.
|
|
25
|
+
* Reads plain data only: a getter that throws means no secrets.
|
|
26
|
+
*/
|
|
27
|
+
export function declaredPluginSecretsOf(contributions) {
|
|
28
|
+
const out = [];
|
|
29
|
+
try {
|
|
30
|
+
const list = readOwnField(contributions, "secrets");
|
|
31
|
+
if (!Array.isArray(list))
|
|
32
|
+
return out;
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
for (const entry of list.slice(0, PLUGIN_SECRETS_MAX)) {
|
|
35
|
+
const name = readOwnField(entry, "name");
|
|
36
|
+
if (typeof name !== "string" || !isPluginSecretName(name) || seen.has(name))
|
|
37
|
+
continue;
|
|
38
|
+
const label = PluginLabelSchema.safeParse(readOwnField(entry, "label"));
|
|
39
|
+
if (!label.success)
|
|
40
|
+
continue;
|
|
41
|
+
const rawDescription = readOwnField(entry, "description");
|
|
42
|
+
const description = rawDescription === undefined ? undefined : pluginDescriptionSchema().safeParse(rawDescription);
|
|
43
|
+
if (description !== undefined && !description.success)
|
|
44
|
+
continue;
|
|
45
|
+
seen.add(name);
|
|
46
|
+
out.push({ name, label: label.data, ...(description?.success ? { description: description.data } : {}) });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/** 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. */
|
|
55
|
+
export function fitsUtf8(text, max) {
|
|
56
|
+
let bytes = 0;
|
|
57
|
+
for (let i = 0; i < text.length && bytes <= max; i++) {
|
|
58
|
+
const code = text.charCodeAt(i);
|
|
59
|
+
if (code < 0x80)
|
|
60
|
+
bytes += 1;
|
|
61
|
+
else if (code < 0x800)
|
|
62
|
+
bytes += 2;
|
|
63
|
+
else if (code >= 0xd800 && code <= 0xdbff && i + 1 < text.length) {
|
|
64
|
+
const next = text.charCodeAt(i + 1);
|
|
65
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
66
|
+
bytes += 4;
|
|
67
|
+
i++;
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
bytes += 3;
|
|
71
|
+
}
|
|
72
|
+
else
|
|
73
|
+
bytes += 3;
|
|
74
|
+
}
|
|
75
|
+
return bytes <= max;
|
|
76
|
+
}
|
|
77
|
+
/** Whether `text` holds something besides spaces, tabs and line breaks. */
|
|
78
|
+
function hasContent(text) {
|
|
79
|
+
for (let i = 0; i < text.length; i++) {
|
|
80
|
+
const code = text.charCodeAt(i);
|
|
81
|
+
if (code !== 0x20 && code !== 0x09 && code !== 0x0a && code !== 0x0d)
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
/** D12: the body of `PUT .../secrets/:name`. A UTF-16 unit is at least one UTF-8 byte, so the length cap runs first. */
|
|
87
|
+
export const PluginSecretPutBodySchema = z
|
|
88
|
+
.object({
|
|
89
|
+
value: z
|
|
90
|
+
.string()
|
|
91
|
+
.min(1, { message: "Enter a value." })
|
|
92
|
+
.max(PLUGIN_SECRET_VALUE_MAX_BYTES, { message: `A secret is at most ${PLUGIN_SECRET_VALUE_MAX_BYTES} bytes.` })
|
|
93
|
+
.refine(hasContent, { message: "Enter a value." })
|
|
94
|
+
.refine((value) => fitsUtf8(value, PLUGIN_SECRET_VALUE_MAX_BYTES), {
|
|
95
|
+
message: `A secret is at most ${PLUGIN_SECRET_VALUE_MAX_BYTES} bytes.`,
|
|
96
|
+
}),
|
|
97
|
+
})
|
|
98
|
+
.strict();
|
|
99
|
+
/** D12: one declared secret as `GET .../secrets` answers it. `unreadable`: a stored row no longer decrypts (D11).
|
|
100
|
+
* Evidence 148: `label` and `description` are answered as declared (a string, or a language map the
|
|
101
|
+
* admin resolves in the signed-in person's language). */
|
|
102
|
+
export const PluginSecretRowSchema = z
|
|
103
|
+
.object({
|
|
104
|
+
name: z.string(),
|
|
105
|
+
label: PluginLabelSchema,
|
|
106
|
+
description: pluginDescriptionSchema().nullable(),
|
|
107
|
+
set: z.boolean(),
|
|
108
|
+
updatedAt: z.string().datetime().nullable(),
|
|
109
|
+
unreadable: z.boolean(),
|
|
110
|
+
})
|
|
111
|
+
.strict();
|
|
112
|
+
export const PluginSecretListResponseSchema = z.object({ items: z.array(PluginSecretRowSchema) }).strict();
|
|
113
|
+
/** D12: the path of `PUT` and `DELETE .../plugins/:pluginId/secrets/:name`. A name the manifest does not declare answers 404. */
|
|
114
|
+
export const PluginSecretParamsSchema = z.object({ pluginId: z.string().min(1), name: z.string().min(1).max(PLUGIN_SECRET_NAME_MAX) }).strict();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ContractSchema } from "./plugin-contract-schema.js";
|
|
2
|
+
import type { ServiceMethod } from "./plugin-service-declarations.js";
|
|
3
|
+
export type CopiedValue = {
|
|
4
|
+
ok: true;
|
|
5
|
+
value: unknown;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
why: "size" | "shape";
|
|
9
|
+
problem: string;
|
|
10
|
+
};
|
|
11
|
+
/** The value as checked JSON: measured in UTF-8, parsed back (plain data only), only the declared properties kept. */
|
|
12
|
+
export declare function copyContractValue(schema: ContractSchema, value: unknown): CopiedValue;
|
|
13
|
+
export type ProviderAnswer = {
|
|
14
|
+
ok: true;
|
|
15
|
+
value: unknown;
|
|
16
|
+
} | {
|
|
17
|
+
ok: false;
|
|
18
|
+
reason: "refused";
|
|
19
|
+
code: string;
|
|
20
|
+
} | {
|
|
21
|
+
ok: false;
|
|
22
|
+
reason: "invalidAnswer";
|
|
23
|
+
cause: "thrown";
|
|
24
|
+
thrown: unknown;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
reason: "invalidAnswer";
|
|
28
|
+
cause: "refusal";
|
|
29
|
+
} | {
|
|
30
|
+
ok: false;
|
|
31
|
+
reason: "invalidAnswer";
|
|
32
|
+
cause: "shape";
|
|
33
|
+
problem: string;
|
|
34
|
+
};
|
|
35
|
+
/** A provider's answer: a declared refusal, or a value checked against the owner's output schema. A throw while reading it is the answer breaking the contract. */
|
|
36
|
+
export declare function readProviderAnswer(method: ServiceMethod, answer: unknown): ProviderAnswer;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { checkContractValue } from "./plugin-contract-schema.js";
|
|
2
|
+
import { SERVICE_PAYLOAD_BYTES_MAX, readRefusalAnswer } from "./plugin-services.js";
|
|
3
|
+
/** The value as checked JSON: measured in UTF-8, parsed back (plain data only), only the declared properties kept. */
|
|
4
|
+
export function copyContractValue(schema, value) {
|
|
5
|
+
let text;
|
|
6
|
+
try {
|
|
7
|
+
text = JSON.stringify(value);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return { ok: false, why: "shape", problem: "it is not plain data" };
|
|
11
|
+
}
|
|
12
|
+
if (text === undefined)
|
|
13
|
+
return { ok: false, why: "shape", problem: "it is not plain data" };
|
|
14
|
+
if (new TextEncoder().encode(text).byteLength > SERVICE_PAYLOAD_BYTES_MAX)
|
|
15
|
+
return { ok: false, why: "size", problem: `it is over ${SERVICE_PAYLOAD_BYTES_MAX} bytes` };
|
|
16
|
+
const checked = checkContractValue(schema, JSON.parse(text));
|
|
17
|
+
return checked.ok ? { ok: true, value: checked.value } : { ok: false, why: "shape", problem: checked.problem };
|
|
18
|
+
}
|
|
19
|
+
/** A provider's answer: a declared refusal, or a value checked against the owner's output schema. A throw while reading it is the answer breaking the contract. */
|
|
20
|
+
export function readProviderAnswer(method, answer) {
|
|
21
|
+
let code;
|
|
22
|
+
try {
|
|
23
|
+
code = readRefusalAnswer(answer);
|
|
24
|
+
}
|
|
25
|
+
catch (thrown) {
|
|
26
|
+
return { ok: false, reason: "invalidAnswer", cause: "thrown", thrown };
|
|
27
|
+
}
|
|
28
|
+
if (code !== null)
|
|
29
|
+
return method.refusals.includes(code) ? { ok: false, reason: "refused", code } : { ok: false, reason: "invalidAnswer", cause: "refusal" };
|
|
30
|
+
const copied = copyContractValue(method.output, answer);
|
|
31
|
+
return copied.ok ? { ok: true, value: copied.value } : { ok: false, reason: "invalidAnswer", cause: "shape", problem: copied.problem };
|
|
32
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ServiceSummary } from "./plugin-service-declarations.js";
|
|
3
|
+
export declare const INSTALL_MAX_CONNECTION_ANSWERS = 60;
|
|
4
|
+
export declare const ServiceConnectionKeySchema: z.ZodObject<{
|
|
5
|
+
consumer: z.ZodString;
|
|
6
|
+
provider: z.ZodString;
|
|
7
|
+
contract: z.ZodString;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type ServiceConnectionKey = z.infer<typeof ServiceConnectionKeySchema>;
|
|
10
|
+
export declare function connectionKey(key: ServiceConnectionKey): string;
|
|
11
|
+
export declare const ConnectionLineSchema: z.ZodObject<{
|
|
12
|
+
consumer: z.ZodString;
|
|
13
|
+
provider: z.ZodString;
|
|
14
|
+
contract: z.ZodString;
|
|
15
|
+
version: z.ZodString;
|
|
16
|
+
ownerId: z.ZodString;
|
|
17
|
+
contractLabel: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
18
|
+
providerLabel: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
19
|
+
role: z.ZodEnum<{
|
|
20
|
+
provider: "provider";
|
|
21
|
+
consumer: "consumer";
|
|
22
|
+
}>;
|
|
23
|
+
otherPluginId: z.ZodString;
|
|
24
|
+
otherPluginName: z.ZodString;
|
|
25
|
+
readsPersonal: z.ZodBoolean;
|
|
26
|
+
personalFields: z.ZodArray<z.ZodString>;
|
|
27
|
+
sendsPersonal: z.ZodBoolean;
|
|
28
|
+
required: z.ZodBoolean;
|
|
29
|
+
defaultGranted: z.ZodBoolean;
|
|
30
|
+
mustTick: z.ZodBoolean;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type ConnectionLine = z.infer<typeof ConnectionLineSchema>;
|
|
33
|
+
type Party = {
|
|
34
|
+
pluginId: string;
|
|
35
|
+
name: string;
|
|
36
|
+
summary: ServiceSummary;
|
|
37
|
+
};
|
|
38
|
+
/** Plan decision 6. `self` is the plugin being installed (or whose Connections are shown). */
|
|
39
|
+
export declare function connectionsFor(self: Party, others: ReadonlyArray<Party>): ConnectionLine[];
|
|
40
|
+
/** `POST /api/manage/v1/plugins/connections/preview`: the lines a plugin about to be installed would have. */
|
|
41
|
+
export declare const ConnectionsPreviewRequestSchema: z.ZodObject<{
|
|
42
|
+
pluginId: z.ZodString;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
services: z.ZodObject<{
|
|
45
|
+
contracts: z.ZodArray<z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
version: z.ZodString;
|
|
48
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
49
|
+
readsPersonal: z.ZodBoolean;
|
|
50
|
+
personalOutput: z.ZodArray<z.ZodString>;
|
|
51
|
+
sendsPersonal: z.ZodBoolean;
|
|
52
|
+
writes: z.ZodBoolean;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
offers: z.ZodArray<z.ZodObject<{
|
|
55
|
+
contract: z.ZodString;
|
|
56
|
+
version: z.ZodString;
|
|
57
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
uses: z.ZodArray<z.ZodObject<{
|
|
60
|
+
contract: z.ZodString;
|
|
61
|
+
range: z.ZodString;
|
|
62
|
+
optional: z.ZodBoolean;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
events: z.ZodArray<z.ZodObject<{
|
|
65
|
+
name: z.ZodString;
|
|
66
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
listens: z.ZodArray<z.ZodString>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
}, z.core.$strict>;
|
|
71
|
+
export declare const ConnectionsPreviewResponseSchema: z.ZodObject<{
|
|
72
|
+
connections: z.ZodArray<z.ZodObject<{
|
|
73
|
+
consumer: z.ZodString;
|
|
74
|
+
provider: z.ZodString;
|
|
75
|
+
contract: z.ZodString;
|
|
76
|
+
version: z.ZodString;
|
|
77
|
+
ownerId: z.ZodString;
|
|
78
|
+
contractLabel: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
79
|
+
providerLabel: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
80
|
+
role: z.ZodEnum<{
|
|
81
|
+
provider: "provider";
|
|
82
|
+
consumer: "consumer";
|
|
83
|
+
}>;
|
|
84
|
+
otherPluginId: z.ZodString;
|
|
85
|
+
otherPluginName: z.ZodString;
|
|
86
|
+
readsPersonal: z.ZodBoolean;
|
|
87
|
+
personalFields: z.ZodArray<z.ZodString>;
|
|
88
|
+
sendsPersonal: z.ZodBoolean;
|
|
89
|
+
required: z.ZodBoolean;
|
|
90
|
+
defaultGranted: z.ZodBoolean;
|
|
91
|
+
mustTick: z.ZodBoolean;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
/** One line of `GET /api/manage/v1/plugins/:pluginId/connections`, with what is true now. */
|
|
95
|
+
export declare const PluginConnectionSchema: z.ZodObject<{
|
|
96
|
+
consumer: z.ZodString;
|
|
97
|
+
provider: z.ZodString;
|
|
98
|
+
contract: z.ZodString;
|
|
99
|
+
version: z.ZodString;
|
|
100
|
+
ownerId: z.ZodString;
|
|
101
|
+
contractLabel: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
102
|
+
providerLabel: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
103
|
+
role: z.ZodEnum<{
|
|
104
|
+
provider: "provider";
|
|
105
|
+
consumer: "consumer";
|
|
106
|
+
}>;
|
|
107
|
+
otherPluginId: z.ZodString;
|
|
108
|
+
otherPluginName: z.ZodString;
|
|
109
|
+
readsPersonal: z.ZodBoolean;
|
|
110
|
+
personalFields: z.ZodArray<z.ZodString>;
|
|
111
|
+
sendsPersonal: z.ZodBoolean;
|
|
112
|
+
required: z.ZodBoolean;
|
|
113
|
+
defaultGranted: z.ZodBoolean;
|
|
114
|
+
mustTick: z.ZodBoolean;
|
|
115
|
+
granted: z.ZodBoolean;
|
|
116
|
+
grantedBy: z.ZodNullable<z.ZodObject<{
|
|
117
|
+
id: z.ZodNullable<z.ZodString>;
|
|
118
|
+
name: z.ZodNullable<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
grantedAt: z.ZodNullable<z.ZodString>;
|
|
121
|
+
state: z.ZodEnum<{
|
|
122
|
+
ready: "ready";
|
|
123
|
+
off: "off";
|
|
124
|
+
incompatible: "incompatible";
|
|
125
|
+
unlicensed: "unlicensed";
|
|
126
|
+
}>;
|
|
127
|
+
calls24h: z.ZodNumber;
|
|
128
|
+
failures24h: z.ZodNumber;
|
|
129
|
+
revocable: z.ZodBoolean;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
export type PluginConnection = z.infer<typeof PluginConnectionSchema>;
|
|
132
|
+
export declare const PluginConnectionsResponseSchema: z.ZodObject<{
|
|
133
|
+
connections: z.ZodArray<z.ZodObject<{
|
|
134
|
+
consumer: z.ZodString;
|
|
135
|
+
provider: z.ZodString;
|
|
136
|
+
contract: z.ZodString;
|
|
137
|
+
version: z.ZodString;
|
|
138
|
+
ownerId: z.ZodString;
|
|
139
|
+
contractLabel: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
140
|
+
providerLabel: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
141
|
+
role: z.ZodEnum<{
|
|
142
|
+
provider: "provider";
|
|
143
|
+
consumer: "consumer";
|
|
144
|
+
}>;
|
|
145
|
+
otherPluginId: z.ZodString;
|
|
146
|
+
otherPluginName: z.ZodString;
|
|
147
|
+
readsPersonal: z.ZodBoolean;
|
|
148
|
+
personalFields: z.ZodArray<z.ZodString>;
|
|
149
|
+
sendsPersonal: z.ZodBoolean;
|
|
150
|
+
required: z.ZodBoolean;
|
|
151
|
+
defaultGranted: z.ZodBoolean;
|
|
152
|
+
mustTick: z.ZodBoolean;
|
|
153
|
+
granted: z.ZodBoolean;
|
|
154
|
+
grantedBy: z.ZodNullable<z.ZodObject<{
|
|
155
|
+
id: z.ZodNullable<z.ZodString>;
|
|
156
|
+
name: z.ZodNullable<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>>;
|
|
158
|
+
grantedAt: z.ZodNullable<z.ZodString>;
|
|
159
|
+
state: z.ZodEnum<{
|
|
160
|
+
ready: "ready";
|
|
161
|
+
off: "off";
|
|
162
|
+
incompatible: "incompatible";
|
|
163
|
+
unlicensed: "unlicensed";
|
|
164
|
+
}>;
|
|
165
|
+
calls24h: z.ZodNumber;
|
|
166
|
+
failures24h: z.ZodNumber;
|
|
167
|
+
revocable: z.ZodBoolean;
|
|
168
|
+
}, z.core.$strip>>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
/** `PUT /api/manage/v1/plugins/:pluginId/connections`: approve or revoke one line. */
|
|
171
|
+
export declare const PutPluginConnectionRequestSchema: z.ZodObject<{
|
|
172
|
+
consumer: z.ZodString;
|
|
173
|
+
provider: z.ZodString;
|
|
174
|
+
contract: z.ZodString;
|
|
175
|
+
granted: z.ZodBoolean;
|
|
176
|
+
}, z.core.$strict>;
|
|
177
|
+
/** Design 4.9, plan decision 11: the 409 of a switch-off or uninstall another plugin's work needs. */
|
|
178
|
+
export declare const PLUGIN_NEEDED_BY_CODE: "needed_by";
|
|
179
|
+
export declare const PluginNeededBySchema: z.ZodObject<{
|
|
180
|
+
message: z.ZodString;
|
|
181
|
+
code: z.ZodLiteral<"needed_by">;
|
|
182
|
+
plugins: z.ZodArray<z.ZodObject<{
|
|
183
|
+
pluginId: z.ZodString;
|
|
184
|
+
name: z.ZodString;
|
|
185
|
+
because: z.ZodEnum<{
|
|
186
|
+
contract: "contract";
|
|
187
|
+
dependency: "dependency";
|
|
188
|
+
}>;
|
|
189
|
+
contracts: z.ZodArray<z.ZodString>;
|
|
190
|
+
}, z.core.$strip>>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
export type PluginNeededBy = z.infer<typeof PluginNeededBySchema>;
|
|
193
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isPluginManifestId } from "./plugin-id-rules.js";
|
|
3
|
+
import { contractRangeAllows, parseContractId, parseContractRange, parseContractVersion } from "./plugin-services.js";
|
|
4
|
+
import { ServiceSummarySchema } from "./plugin-service-declarations.js";
|
|
5
|
+
// M35 B1a (W16, design 4.6 with the operator's addition to decision 2): the connections a plugin has
|
|
6
|
+
// with the others, as one line each (consumer, provider, contract), with whether it is ticked by
|
|
7
|
+
// default, required, and must be ticked on purpose. The install screen, the install itself and the
|
|
8
|
+
// Connections panel read the same lines.
|
|
9
|
+
export const INSTALL_MAX_CONNECTION_ANSWERS = 60;
|
|
10
|
+
// The examples are what the reference pages show; a refined string has no example of its own.
|
|
11
|
+
const pluginIdField = z
|
|
12
|
+
.string()
|
|
13
|
+
.refine((value) => isPluginManifestId(value), { message: "a plugin id" })
|
|
14
|
+
.meta({ example: "com.example.shop" });
|
|
15
|
+
const contractIdField = z
|
|
16
|
+
.string()
|
|
17
|
+
.refine((value) => parseContractId(value) !== null, { message: "a contract id <owner plugin id>/<contract name>" })
|
|
18
|
+
.meta({ example: "com.example.shop/payment-method" });
|
|
19
|
+
export const ServiceConnectionKeySchema = z.object({ consumer: pluginIdField, provider: pluginIdField, contract: contractIdField }).strict();
|
|
20
|
+
export function connectionKey(key) {
|
|
21
|
+
return `${key.consumer}|${key.provider}|${key.contract}`;
|
|
22
|
+
}
|
|
23
|
+
const labelField = z.union([z.string(), z.record(z.string(), z.string())]);
|
|
24
|
+
export const ConnectionLineSchema = z.object({
|
|
25
|
+
consumer: z.string(),
|
|
26
|
+
provider: z.string(),
|
|
27
|
+
contract: z.string(),
|
|
28
|
+
/** The provider's offered version. */
|
|
29
|
+
version: z.string(),
|
|
30
|
+
ownerId: z.string(),
|
|
31
|
+
contractLabel: labelField,
|
|
32
|
+
/** The provider's own name for its offer. */
|
|
33
|
+
providerLabel: labelField,
|
|
34
|
+
/** The plugin this line was computed for: its role in the line. */
|
|
35
|
+
role: z.enum(["consumer", "provider"]),
|
|
36
|
+
otherPluginId: z.string(),
|
|
37
|
+
otherPluginName: z.string(),
|
|
38
|
+
readsPersonal: z.boolean(),
|
|
39
|
+
personalFields: z.array(z.string()),
|
|
40
|
+
sendsPersonal: z.boolean(),
|
|
41
|
+
required: z.boolean(),
|
|
42
|
+
defaultGranted: z.boolean(),
|
|
43
|
+
mustTick: z.boolean(),
|
|
44
|
+
});
|
|
45
|
+
/** Plan decision 6. `self` is the plugin being installed (or whose Connections are shown). */
|
|
46
|
+
export function connectionsFor(self, others) {
|
|
47
|
+
const everyone = [self, ...others.filter((other) => other.pluginId !== self.pluginId)];
|
|
48
|
+
const ownerContract = (contract, major) => {
|
|
49
|
+
const id = parseContractId(contract);
|
|
50
|
+
if (id === null)
|
|
51
|
+
return undefined;
|
|
52
|
+
const owner = everyone.find((party) => party.pluginId === id.ownerId);
|
|
53
|
+
return owner?.summary.contracts.find((entry) => entry.name === id.name && parseContractVersion(entry.version)?.major === major);
|
|
54
|
+
};
|
|
55
|
+
const lines = [];
|
|
56
|
+
const add = (consumer, provider, use, offer, role) => {
|
|
57
|
+
if (consumer.pluginId === provider.pluginId || !contractRangeAllows(use.range, offer.version))
|
|
58
|
+
return;
|
|
59
|
+
const major = parseContractRange(use.range).major;
|
|
60
|
+
const owned = ownerContract(offer.contract, major);
|
|
61
|
+
if (owned === undefined)
|
|
62
|
+
return;
|
|
63
|
+
const ownerId = parseContractId(offer.contract).ownerId;
|
|
64
|
+
const required = role === "consumer" && !use.optional;
|
|
65
|
+
const defaultGranted = !owned.readsPersonal || (role === "provider" && ownerId === consumer.pluginId);
|
|
66
|
+
const other = role === "consumer" ? provider : consumer;
|
|
67
|
+
lines.push({
|
|
68
|
+
consumer: consumer.pluginId,
|
|
69
|
+
provider: provider.pluginId,
|
|
70
|
+
contract: offer.contract,
|
|
71
|
+
version: offer.version,
|
|
72
|
+
ownerId,
|
|
73
|
+
contractLabel: owned.label,
|
|
74
|
+
providerLabel: offer.label,
|
|
75
|
+
role,
|
|
76
|
+
otherPluginId: other.pluginId,
|
|
77
|
+
otherPluginName: other.name,
|
|
78
|
+
readsPersonal: owned.readsPersonal,
|
|
79
|
+
personalFields: [...owned.personalOutput],
|
|
80
|
+
sendsPersonal: owned.sendsPersonal,
|
|
81
|
+
required,
|
|
82
|
+
defaultGranted,
|
|
83
|
+
mustTick: required && !defaultGranted,
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
for (const other of everyone.slice(1)) {
|
|
87
|
+
for (const use of self.summary.uses)
|
|
88
|
+
for (const offer of other.summary.offers)
|
|
89
|
+
if (offer.contract === use.contract)
|
|
90
|
+
add(self, other, use, offer, "consumer");
|
|
91
|
+
for (const offer of self.summary.offers)
|
|
92
|
+
for (const use of other.summary.uses)
|
|
93
|
+
if (use.contract === offer.contract)
|
|
94
|
+
add(other, self, use, offer, "provider");
|
|
95
|
+
}
|
|
96
|
+
return lines.sort((a, b) => (a.otherPluginId < b.otherPluginId ? -1 : a.otherPluginId > b.otherPluginId ? 1 : a.contract < b.contract ? -1 : a.contract > b.contract ? 1 : 0));
|
|
97
|
+
}
|
|
98
|
+
/** `POST /api/manage/v1/plugins/connections/preview`: the lines a plugin about to be installed would have. */
|
|
99
|
+
export const ConnectionsPreviewRequestSchema = z.object({ pluginId: pluginIdField, name: z.string().min(1).max(200), services: ServiceSummarySchema }).strict();
|
|
100
|
+
export const ConnectionsPreviewResponseSchema = z.object({ connections: z.array(ConnectionLineSchema) });
|
|
101
|
+
/** One line of `GET /api/manage/v1/plugins/:pluginId/connections`, with what is true now. */
|
|
102
|
+
export const PluginConnectionSchema = ConnectionLineSchema.extend({
|
|
103
|
+
granted: z.boolean(),
|
|
104
|
+
grantedBy: z.object({ id: z.string().nullable(), name: z.string().nullable() }).nullable(),
|
|
105
|
+
grantedAt: z.string().nullable(),
|
|
106
|
+
/** The other plugin's state for this line. */
|
|
107
|
+
state: z.enum(["ready", "off", "incompatible", "unlicensed"]),
|
|
108
|
+
/** This server's own counts of the last 24 hours (plan decision 10). */
|
|
109
|
+
calls24h: z.number().int().nonnegative(),
|
|
110
|
+
failures24h: z.number().int().nonnegative(),
|
|
111
|
+
/** False for a required line while its consumer is switched on (the operator's addition to decision 2). */
|
|
112
|
+
revocable: z.boolean(),
|
|
113
|
+
});
|
|
114
|
+
export const PluginConnectionsResponseSchema = z.object({ connections: z.array(PluginConnectionSchema) });
|
|
115
|
+
/** `PUT /api/manage/v1/plugins/:pluginId/connections`: approve or revoke one line. */
|
|
116
|
+
export const PutPluginConnectionRequestSchema = ServiceConnectionKeySchema.extend({ granted: z.boolean() }).strict();
|
|
117
|
+
/** Design 4.9, plan decision 11: the 409 of a switch-off or uninstall another plugin's work needs. */
|
|
118
|
+
export const PLUGIN_NEEDED_BY_CODE = "needed_by";
|
|
119
|
+
export const PluginNeededBySchema = z.object({
|
|
120
|
+
message: z.string(),
|
|
121
|
+
code: z.literal(PLUGIN_NEEDED_BY_CODE),
|
|
122
|
+
plugins: z.array(z.object({ pluginId: z.string(), name: z.string(), because: z.enum(["dependency", "contract"]), contracts: z.array(z.string()) })),
|
|
123
|
+
});
|