@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
|
@@ -2,9 +2,19 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const PLAN_KEY_MAX = 64;
|
|
3
3
|
export declare const PLAN_NAME_MAX = 200;
|
|
4
4
|
export declare const PLAN_DESCRIPTION_MAX = 2000;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/** The minimum price of a paid plan (the operator's decision, 2026-11-13:
|
|
6
|
+
* a lower price leaves too little after the payment provider's fee) and a
|
|
7
|
+
* sanity cap. Every sentence that names either reads it from here. */
|
|
8
|
+
export declare const PLAN_MIN_PRICE_CENTS = 500;
|
|
7
9
|
export declare const PLAN_MAX_PRICE_CENTS = 1000000;
|
|
10
|
+
/** A plan price as a sentence names it: US dollars, two decimals and the
|
|
11
|
+
* thousands grouped ("$5.00", "$10,000.00"). Whole cents in, integer
|
|
12
|
+
* arithmetic only. */
|
|
13
|
+
export declare function planPriceText(cents: number): string;
|
|
14
|
+
/** The sentences that name the price limits, built from the constants. */
|
|
15
|
+
export declare const PLAN_PRICE_RANGE_MESSAGE: string;
|
|
16
|
+
export declare const PLAN_MIN_PRICE_MESSAGE: string;
|
|
17
|
+
export declare const PLAN_MAX_PRICE_MESSAGE: string;
|
|
8
18
|
export declare const PLAN_SHAPE_VALUES: readonly ["free", "one_time", "monthly", "yearly"];
|
|
9
19
|
export type PlanShapeValue = (typeof PLAN_SHAPE_VALUES)[number];
|
|
10
20
|
/**
|
|
@@ -13,7 +23,8 @@ export type PlanShapeValue = (typeof PLAN_SHAPE_VALUES)[number];
|
|
|
13
23
|
* scan with the length checked first, never a regex (untrusted text).
|
|
14
24
|
*/
|
|
15
25
|
export declare function isPlanKey(value: string): boolean;
|
|
16
|
-
/** S315 section 3a: a free plan costs 0, every other shape whole cents from
|
|
26
|
+
/** S315 section 3a: a free plan costs 0, every other shape whole cents from
|
|
27
|
+
* PLAN_MIN_PRICE_CENTS to PLAN_MAX_PRICE_CENTS. */
|
|
17
28
|
export declare function planPriceAgrees(shape: string, priceCents: number): boolean;
|
|
18
29
|
export declare const PlanKeySchema: z.ZodString;
|
|
19
30
|
export declare const PlanNameSchema: z.ZodString;
|
|
@@ -24,6 +35,18 @@ export declare const PlanShapeSchema: z.ZodEnum<{
|
|
|
24
35
|
monthly: "monthly";
|
|
25
36
|
yearly: "yearly";
|
|
26
37
|
}>;
|
|
38
|
+
/** S367c (licence terms `seats`): how many sites a plan holds; null is any number. */
|
|
39
|
+
export declare const PLAN_SEATS_MAX = 1000;
|
|
40
|
+
export declare const PlanSeatsSchema: z.ZodNullable<z.ZodNumber>;
|
|
41
|
+
/** The form's Sites field: the box "Any number of sites" wins; otherwise at
|
|
42
|
+
* most 4 characters, every one a digit, read digit by digit. */
|
|
43
|
+
export declare function readSeatsInput(raw: string, any: boolean): {
|
|
44
|
+
ok: true;
|
|
45
|
+
seats: number | null;
|
|
46
|
+
} | {
|
|
47
|
+
ok: false;
|
|
48
|
+
message: string;
|
|
49
|
+
};
|
|
27
50
|
export declare const PlanAddInputSchema: z.ZodObject<{
|
|
28
51
|
listingId: z.ZodString;
|
|
29
52
|
key: z.ZodString;
|
|
@@ -36,6 +59,7 @@ export declare const PlanAddInputSchema: z.ZodObject<{
|
|
|
36
59
|
yearly: "yearly";
|
|
37
60
|
}>;
|
|
38
61
|
priceCents: z.ZodNumber;
|
|
62
|
+
seats: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
39
63
|
}, z.core.$strict>;
|
|
40
64
|
export type PlanAddInput = z.infer<typeof PlanAddInputSchema>;
|
|
41
65
|
/** Name and description always; key, shape and price only while the plan was never held (D4, S315 D8). */
|
|
@@ -51,6 +75,7 @@ export declare const PlanEditInputSchema: z.ZodObject<{
|
|
|
51
75
|
yearly: "yearly";
|
|
52
76
|
}>>;
|
|
53
77
|
priceCents: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
79
|
}, z.core.$strict>;
|
|
55
80
|
export type PlanEditInput = z.infer<typeof PlanEditInputSchema>;
|
|
56
81
|
export declare const PlanRefInputSchema: z.ZodObject<{
|
|
@@ -6,9 +6,30 @@ import { z } from "zod";
|
|
|
6
6
|
export const PLAN_KEY_MAX = 64;
|
|
7
7
|
export const PLAN_NAME_MAX = 200;
|
|
8
8
|
export const PLAN_DESCRIPTION_MAX = 2000;
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/** The minimum price of a paid plan (the operator's decision, 2026-11-13:
|
|
10
|
+
* a lower price leaves too little after the payment provider's fee) and a
|
|
11
|
+
* sanity cap. Every sentence that names either reads it from here. */
|
|
12
|
+
export const PLAN_MIN_PRICE_CENTS = 500;
|
|
11
13
|
export const PLAN_MAX_PRICE_CENTS = 1_000_000;
|
|
14
|
+
/** A plan price as a sentence names it: US dollars, two decimals and the
|
|
15
|
+
* thousands grouped ("$5.00", "$10,000.00"). Whole cents in, integer
|
|
16
|
+
* arithmetic only. */
|
|
17
|
+
export function planPriceText(cents) {
|
|
18
|
+
const whole = Math.floor(cents / 100);
|
|
19
|
+
const rest = String(cents % 100).padStart(2, "0");
|
|
20
|
+
const digits = String(whole);
|
|
21
|
+
let grouped = "";
|
|
22
|
+
for (let i = 0; i < digits.length; i++) {
|
|
23
|
+
if (i > 0 && (digits.length - i) % 3 === 0)
|
|
24
|
+
grouped += ",";
|
|
25
|
+
grouped += digits[i];
|
|
26
|
+
}
|
|
27
|
+
return `$${grouped}.${rest}`;
|
|
28
|
+
}
|
|
29
|
+
/** The sentences that name the price limits, built from the constants. */
|
|
30
|
+
export const PLAN_PRICE_RANGE_MESSAGE = `A free plan costs 0; any other plan costs from ${planPriceText(PLAN_MIN_PRICE_CENTS)} to ${planPriceText(PLAN_MAX_PRICE_CENTS)}`;
|
|
31
|
+
export const PLAN_MIN_PRICE_MESSAGE = `A paid plan costs at least ${planPriceText(PLAN_MIN_PRICE_CENTS)}`;
|
|
32
|
+
export const PLAN_MAX_PRICE_MESSAGE = `Maximum price is ${planPriceText(PLAN_MAX_PRICE_CENTS)}`;
|
|
12
33
|
export const PLAN_SHAPE_VALUES = ["free", "one_time", "monthly", "yearly"];
|
|
13
34
|
/**
|
|
14
35
|
* A plan key: 1 to 64 characters, lowercase ASCII letters, digits and single
|
|
@@ -32,7 +53,8 @@ export function isPlanKey(value) {
|
|
|
32
53
|
}
|
|
33
54
|
return true;
|
|
34
55
|
}
|
|
35
|
-
/** S315 section 3a: a free plan costs 0, every other shape whole cents from
|
|
56
|
+
/** S315 section 3a: a free plan costs 0, every other shape whole cents from
|
|
57
|
+
* PLAN_MIN_PRICE_CENTS to PLAN_MAX_PRICE_CENTS. */
|
|
36
58
|
export function planPriceAgrees(shape, priceCents) {
|
|
37
59
|
if (!Number.isInteger(priceCents))
|
|
38
60
|
return false;
|
|
@@ -40,7 +62,6 @@ export function planPriceAgrees(shape, priceCents) {
|
|
|
40
62
|
return priceCents === 0;
|
|
41
63
|
return priceCents >= PLAN_MIN_PRICE_CENTS && priceCents <= PLAN_MAX_PRICE_CENTS;
|
|
42
64
|
}
|
|
43
|
-
const PRICE_SHAPE_MESSAGE = "A free plan costs 0; any other plan costs from $1.00 to $10,000.00";
|
|
44
65
|
// A listing or plan id is never validated beyond its length: a wrong one
|
|
45
66
|
// reads as "not found" from the owner-scoped query, like someone else's.
|
|
46
67
|
const RowIdSchema = z.string().min(1).max(64);
|
|
@@ -51,11 +72,36 @@ export const PlanKeySchema = z
|
|
|
51
72
|
export const PlanNameSchema = z.string().trim().min(1, "Give the plan a name").max(PLAN_NAME_MAX, `A plan name is at most ${PLAN_NAME_MAX} characters`);
|
|
52
73
|
export const PlanDescriptionSchema = z.string().trim().max(PLAN_DESCRIPTION_MAX, `A plan description is at most ${PLAN_DESCRIPTION_MAX} characters`);
|
|
53
74
|
export const PlanShapeSchema = z.enum(PLAN_SHAPE_VALUES, "Choose free, one-time, monthly or yearly");
|
|
54
|
-
const PlanCentsSchema = z.number().int().min(0).max(PLAN_MAX_PRICE_CENTS,
|
|
75
|
+
const PlanCentsSchema = z.number().int().min(0).max(PLAN_MAX_PRICE_CENTS, PLAN_MAX_PRICE_MESSAGE);
|
|
76
|
+
/** S367c (licence terms `seats`): how many sites a plan holds; null is any number. */
|
|
77
|
+
export const PLAN_SEATS_MAX = 1000;
|
|
78
|
+
export const PlanSeatsSchema = z
|
|
79
|
+
.number()
|
|
80
|
+
.int("A plan holds a whole number of sites")
|
|
81
|
+
.min(1, "A plan holds at least 1 site")
|
|
82
|
+
.max(PLAN_SEATS_MAX, `A plan holds at most ${PLAN_SEATS_MAX} sites, or any number`)
|
|
83
|
+
.nullable();
|
|
84
|
+
/** The form's Sites field: the box "Any number of sites" wins; otherwise at
|
|
85
|
+
* most 4 characters, every one a digit, read digit by digit. */
|
|
86
|
+
export function readSeatsInput(raw, any) {
|
|
87
|
+
if (any)
|
|
88
|
+
return { ok: true, seats: null };
|
|
89
|
+
const message = `Enter a number of sites from 1 to ${PLAN_SEATS_MAX}, or tick Any number of sites`;
|
|
90
|
+
if (raw.length < 1 || raw.length > 4)
|
|
91
|
+
return { ok: false, message };
|
|
92
|
+
let n = 0;
|
|
93
|
+
for (let i = 0; i < raw.length; i++) {
|
|
94
|
+
const c = raw.charCodeAt(i);
|
|
95
|
+
if (c < 48 || c > 57)
|
|
96
|
+
return { ok: false, message };
|
|
97
|
+
n = n * 10 + (c - 48);
|
|
98
|
+
}
|
|
99
|
+
return n >= 1 && n <= PLAN_SEATS_MAX ? { ok: true, seats: n } : { ok: false, message };
|
|
100
|
+
}
|
|
55
101
|
export const PlanAddInputSchema = z
|
|
56
|
-
.object({ listingId: RowIdSchema, key: PlanKeySchema, name: PlanNameSchema, description: PlanDescriptionSchema, shape: PlanShapeSchema, priceCents: PlanCentsSchema })
|
|
102
|
+
.object({ listingId: RowIdSchema, key: PlanKeySchema, name: PlanNameSchema, description: PlanDescriptionSchema, shape: PlanShapeSchema, priceCents: PlanCentsSchema, seats: PlanSeatsSchema.default(1) })
|
|
57
103
|
.strict()
|
|
58
|
-
.refine((input) => planPriceAgrees(input.shape, input.priceCents), { message:
|
|
104
|
+
.refine((input) => planPriceAgrees(input.shape, input.priceCents), { message: PLAN_PRICE_RANGE_MESSAGE, path: ["priceCents"] });
|
|
59
105
|
/** Name and description always; key, shape and price only while the plan was never held (D4, S315 D8). */
|
|
60
106
|
export const PlanEditInputSchema = z
|
|
61
107
|
.object({
|
|
@@ -65,6 +111,7 @@ export const PlanEditInputSchema = z
|
|
|
65
111
|
key: PlanKeySchema.optional(),
|
|
66
112
|
shape: PlanShapeSchema.optional(),
|
|
67
113
|
priceCents: PlanCentsSchema.optional(),
|
|
114
|
+
seats: PlanSeatsSchema.optional(),
|
|
68
115
|
})
|
|
69
116
|
.strict();
|
|
70
117
|
export const PlanRefInputSchema = z.object({ planId: RowIdSchema }).strict();
|
|
@@ -72,7 +119,7 @@ export const PlanMoveInputSchema = z.object({ planId: RowIdSchema, direction: z.
|
|
|
72
119
|
export const PlanPriceInputSchema = z
|
|
73
120
|
.object({
|
|
74
121
|
planId: RowIdSchema,
|
|
75
|
-
priceCents: z.number().int().min(PLAN_MIN_PRICE_CENTS,
|
|
122
|
+
priceCents: z.number().int().min(PLAN_MIN_PRICE_CENTS, PLAN_MIN_PRICE_MESSAGE).max(PLAN_MAX_PRICE_CENTS, PLAN_MAX_PRICE_MESSAGE),
|
|
76
123
|
})
|
|
77
124
|
.strict();
|
|
78
125
|
/** S321c (spec 3c): a price change's background notices as the plans page
|
|
@@ -4,6 +4,12 @@ export declare const PluginActionDeclarationSchema: z.ZodObject<{
|
|
|
4
4
|
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
5
5
|
en: z.ZodString;
|
|
6
6
|
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
7
|
+
offerTo: z.ZodOptional<z.ZodEnum<{
|
|
8
|
+
"content.read": "content.read";
|
|
9
|
+
"content.update": "content.update";
|
|
10
|
+
"content.publish": "content.publish";
|
|
11
|
+
"media.read": "media.read";
|
|
12
|
+
}>>;
|
|
7
13
|
}, z.core.$strip>;
|
|
8
14
|
export type PluginActionDeclaration = z.infer<typeof PluginActionDeclarationSchema>;
|
|
9
15
|
/** A role a plugin offers. Never applied unasked: the operator accepts it
|
|
@@ -22,3 +28,9 @@ export declare const OfferedRoleParamsSchema: z.ZodObject<{
|
|
|
22
28
|
roleId: z.ZodString;
|
|
23
29
|
}, z.core.$strip>;
|
|
24
30
|
export type OfferedRoleParams = z.infer<typeof OfferedRoleParamsSchema>;
|
|
31
|
+
/** M33 K29: the Apply route's path: the plugin and the action it offers. */
|
|
32
|
+
export declare const ActionOfferParamsSchema: z.ZodObject<{
|
|
33
|
+
pluginId: z.ZodString;
|
|
34
|
+
action: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type ActionOfferParams = z.infer<typeof ActionOfferParamsSchema>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ActionStringSchema } from "./action.schema.js";
|
|
3
3
|
import { PluginLabelSchema } from "./plugin-labels.js";
|
|
4
|
+
import { PLUGIN_ACTION_OFFER_TARGETS } from "./plugin-manifest-actions.js";
|
|
4
5
|
import { RoleIdSchema } from "./role.schema.js";
|
|
5
6
|
// S273: what a plugin declares about permissions. These two shapes are the
|
|
6
7
|
// one definition the SDK manifest schema, the marketplace listing and the
|
|
@@ -11,9 +12,15 @@ import { RoleIdSchema } from "./role.schema.js";
|
|
|
11
12
|
// (PluginLabelSchema, the shape a section's label has) or a plain string; the
|
|
12
13
|
// server stores one string per action and per role, the map resolved to the
|
|
13
14
|
// site's default language when the plugin is installed.
|
|
15
|
+
// M33 K29 (SEO 2.16 C7): `offerTo` offers the action to the roles that hold one core action
|
|
16
|
+
// (PLUGIN_ACTION_OFFER_TARGETS). Never applied unasked: a person who holds `roles.update` and the
|
|
17
|
+
// action accepts it at install or later from the installed plugins, and what it adds is ordinary
|
|
18
|
+
// grants, editable in Settings, Roles.
|
|
19
|
+
const OFFER_TARGETS_MESSAGE = `an action is offered to one of ${PLUGIN_ACTION_OFFER_TARGETS.map((target) => `"${target}"`).join(", ")}`;
|
|
14
20
|
export const PluginActionDeclarationSchema = z.object({
|
|
15
21
|
id: ActionStringSchema,
|
|
16
22
|
label: PluginLabelSchema,
|
|
23
|
+
offerTo: z.enum(PLUGIN_ACTION_OFFER_TARGETS, { error: OFFER_TARGETS_MESSAGE }).optional(),
|
|
17
24
|
});
|
|
18
25
|
/** A role a plugin offers. Never applied unasked: the operator accepts it
|
|
19
26
|
* on the install screen or later from the installed-plugins view, and the
|
|
@@ -27,3 +34,9 @@ export const OfferedRoleParamsSchema = z.object({
|
|
|
27
34
|
pluginId: z.string().min(1),
|
|
28
35
|
roleId: RoleIdSchema,
|
|
29
36
|
});
|
|
37
|
+
/** M33 K29: the Apply route's path: the plugin and the action it offers. */
|
|
38
|
+
export const ActionOfferParamsSchema = z.object({
|
|
39
|
+
pluginId: z.string().min(1).meta({ example: "com.example.words" }),
|
|
40
|
+
// A plugin offers only its own action, so the reference's example names one (never a core action).
|
|
41
|
+
action: ActionStringSchema.meta({ example: "com.example.words.panel.view" }),
|
|
42
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PluginCallerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
kind: z.ZodLiteral<"user">;
|
|
4
|
+
userId: z.ZodString;
|
|
5
|
+
name: z.ZodNullable<z.ZodString>;
|
|
6
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
7
|
+
kind: z.ZodLiteral<"key">;
|
|
8
|
+
keyId: z.ZodString;
|
|
9
|
+
keyName: z.ZodString;
|
|
10
|
+
}, z.core.$strict>], "kind">;
|
|
11
|
+
/** The caller a plugin route's context carries (`context.caller`), frozen. */
|
|
12
|
+
export type PluginCaller = Readonly<{
|
|
13
|
+
kind: "user";
|
|
14
|
+
userId: string;
|
|
15
|
+
name: string | null;
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
kind: "key";
|
|
18
|
+
keyId: string;
|
|
19
|
+
keyName: string;
|
|
20
|
+
}>;
|
|
21
|
+
/** `value` checked against PluginCallerSchema and frozen; throws on anything else, so a caller
|
|
22
|
+
* with a key the schema does not name (an email first) never reaches plugin code. */
|
|
23
|
+
export declare function pluginCaller(value: unknown): PluginCaller;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// M33 K5: who called a plugin's admin or API key route, as the core authenticated them, so a
|
|
3
|
+
// plugin can record who did an action in its own history without trusting a name the browser
|
|
4
|
+
// sends. A plugin may keep what it receives, so this carries the least that names the actor: a
|
|
5
|
+
// user's id and display name, or a key's id and name. Never an email, an address, a role, a token
|
|
6
|
+
// or a secret; the schema is strict, so a key the core did not mean to hand on is refused, not
|
|
7
|
+
// carried. A public route and a site route have no caller.
|
|
8
|
+
export const PluginCallerSchema = z.discriminatedUnion("kind", [
|
|
9
|
+
z.object({ kind: z.literal("user"), userId: z.string().min(1), name: z.string().nullable() }).strict(),
|
|
10
|
+
z.object({ kind: z.literal("key"), keyId: z.string().min(1), keyName: z.string() }).strict(),
|
|
11
|
+
]);
|
|
12
|
+
/** `value` checked against PluginCallerSchema and frozen; throws on anything else, so a caller
|
|
13
|
+
* with a key the schema does not name (an email first) never reaches plugin code. */
|
|
14
|
+
export function pluginCaller(value) {
|
|
15
|
+
return Object.freeze(PluginCallerSchema.parse(value));
|
|
16
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** D1: the most commands one plugin package declares. */
|
|
2
|
+
export declare const PLUGIN_CLI_COMMANDS_MAX = 10;
|
|
3
|
+
/** D1: a command's name, 1 to 32 characters. */
|
|
4
|
+
export declare const PLUGIN_CLI_COMMAND_NAME_MAX = 32;
|
|
5
|
+
/** D1: a command's summary, 1 to 120 printable characters. */
|
|
6
|
+
export declare const PLUGIN_CLI_SUMMARY_MAX = 120;
|
|
7
|
+
/** D2: the prefix, the plugin id's last segment cut at 32. */
|
|
8
|
+
export declare const PLUGIN_CLI_PREFIX_MAX = 32;
|
|
9
|
+
/** D1: the module path, 3 to 200 characters. */
|
|
10
|
+
export declare const PLUGIN_CLI_MODULE_MAX = 200;
|
|
11
|
+
/**
|
|
12
|
+
* D2: the prefixes no plugin may take. Every core command and noun today (`dev`, `plugin`, `mcp`
|
|
13
|
+
* and the CLI's fifteen nouns) and the words the core keeps for itself. After release a new core
|
|
14
|
+
* top-level command takes its name from this list only, so a core update never shadows an
|
|
15
|
+
* installed plugin's commands. The CLI pins its own commands and nouns against it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CLI_RESERVED_PREFIXES: readonly string[];
|
|
18
|
+
export interface PluginCliCommandDeclaration {
|
|
19
|
+
name: string;
|
|
20
|
+
summary: string;
|
|
21
|
+
}
|
|
22
|
+
export interface PluginCliDeclaration {
|
|
23
|
+
plugin: string;
|
|
24
|
+
module: string;
|
|
25
|
+
commands: PluginCliCommandDeclaration[];
|
|
26
|
+
}
|
|
27
|
+
export interface PluginCliDeclarationIssue {
|
|
28
|
+
path: (string | number)[];
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
export type PluginCliDeclarationCheck = {
|
|
32
|
+
ok: true;
|
|
33
|
+
declaration: PluginCliDeclaration;
|
|
34
|
+
prefix: string;
|
|
35
|
+
} | {
|
|
36
|
+
ok: false;
|
|
37
|
+
issues: PluginCliDeclarationIssue[];
|
|
38
|
+
};
|
|
39
|
+
/** M32 I3 (B13): a control or hidden character (isControl or isHidden): what redaction looks past. */
|
|
40
|
+
export declare function isControlOrHiddenCharCode(code: number): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* M32 I3 (B13): a code point redaction looks past. Everything `isControlOrHiddenCharCode` covers, plus the
|
|
43
|
+
* characters that render as nothing but are outside the plugin description rule: the soft hyphen (U+00AD),
|
|
44
|
+
* the combining grapheme joiner (U+034F), the Mongolian vowel separator
|
|
45
|
+
* (U+180E), the variation selectors (U+FE00 to U+FE0F), the Hangul filler (U+3164) and the tag characters
|
|
46
|
+
* (U+E0000 to U+E007F). Takes a code point, not a UTF-16 unit, so the tag characters are seen.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isRedactionSkippedCodePoint(codePoint: number): boolean;
|
|
49
|
+
/** Whether `text` holds a hidden character (`isHidden`): what a plugin's description may not. */
|
|
50
|
+
export declare function hasHiddenPluginCharacter(text: string): boolean;
|
|
51
|
+
/** D1: 1 to 32 lower-case letters, digits and "-", a letter first and no "-" last. */
|
|
52
|
+
export declare function isPluginCliCommandName(name: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* D1: 3 to 200 characters, "./" first, "/" as the only separator, no empty, "." or ".." segment,
|
|
55
|
+
* no "\", ":", "%", "?", "#" or control character, and a ".js" or ".mjs" ending (no "%", "?" or "#",
|
|
56
|
+
* because a module path read as a URL would decode, query or cut at them). So the module always names a
|
|
57
|
+
* file inside the package itself.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isPluginCliModulePath(path: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* D2: the plugin id's last segment, cut at 32 characters, any "-" the cut leaves last trimmed, so a
|
|
62
|
+
* prefix has a command name's shape. Empty only for an id that is not a manifest id.
|
|
63
|
+
*/
|
|
64
|
+
export declare function pluginCliPrefix(pluginId: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Text a plugin wrote, made safe for a terminal or a message: every control character (below
|
|
67
|
+
* 0x20, 0x7f, 0x80 to 0x9f) and every hidden character (`isHidden`) removed, so no escape sequence
|
|
68
|
+
* or reordering reaches the reader, and cut at `max` UTF-16 units without splitting a surrogate pair.
|
|
69
|
+
*/
|
|
70
|
+
export declare function cleanPluginText(text: string, max: number): string;
|
|
71
|
+
/**
|
|
72
|
+
* D1, D2: a package.json's `kardalum.cli` member. Strict: no key beyond `plugin`, `module` and
|
|
73
|
+
* `commands`, and none in a command beyond `name` and `summary`. A plugin whose prefix is
|
|
74
|
+
* reserved is refused.
|
|
75
|
+
*/
|
|
76
|
+
export declare function checkPluginCliDeclaration(value: unknown): PluginCliDeclarationCheck;
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { isPluginManifestId } from "./plugin-id-rules.js";
|
|
2
|
+
// M32 F3b (D1, D2): the commands a plugin package adds to the `kardalum` CLI, declared in its own
|
|
3
|
+
// package.json as `kardalum.cli`. The CLI's discovery and `kardalum plugin validate` read this one
|
|
4
|
+
// rule. Every check is a length cap followed by a character loop: no pattern ever meets an
|
|
5
|
+
// author's text, and a message names only values that passed their own check.
|
|
6
|
+
/** D1: the most commands one plugin package declares. */
|
|
7
|
+
export const PLUGIN_CLI_COMMANDS_MAX = 10;
|
|
8
|
+
/** D1: a command's name, 1 to 32 characters. */
|
|
9
|
+
export const PLUGIN_CLI_COMMAND_NAME_MAX = 32;
|
|
10
|
+
/** D1: a command's summary, 1 to 120 printable characters. */
|
|
11
|
+
export const PLUGIN_CLI_SUMMARY_MAX = 120;
|
|
12
|
+
/** D2: the prefix, the plugin id's last segment cut at 32. */
|
|
13
|
+
export const PLUGIN_CLI_PREFIX_MAX = 32;
|
|
14
|
+
/** D1: the module path, 3 to 200 characters. */
|
|
15
|
+
export const PLUGIN_CLI_MODULE_MAX = 200;
|
|
16
|
+
const PLUGIN_CLI_MODULE_MIN = 3;
|
|
17
|
+
/**
|
|
18
|
+
* D2: the prefixes no plugin may take. Every core command and noun today (`dev`, `plugin`, `mcp`
|
|
19
|
+
* and the CLI's fifteen nouns) and the words the core keeps for itself. After release a new core
|
|
20
|
+
* top-level command takes its name from this list only, so a core update never shadows an
|
|
21
|
+
* installed plugin's commands. The CLI pins its own commands and nouns against it.
|
|
22
|
+
*/
|
|
23
|
+
export const CLI_RESERVED_PREFIXES = Object.freeze([
|
|
24
|
+
// The core's commands and nouns.
|
|
25
|
+
"dev",
|
|
26
|
+
"plugin",
|
|
27
|
+
"mcp",
|
|
28
|
+
"profile",
|
|
29
|
+
"whoami",
|
|
30
|
+
"content",
|
|
31
|
+
"media",
|
|
32
|
+
"types",
|
|
33
|
+
"datatypes",
|
|
34
|
+
"templates",
|
|
35
|
+
"assets",
|
|
36
|
+
"plugins",
|
|
37
|
+
"snapshots",
|
|
38
|
+
"users",
|
|
39
|
+
"roles",
|
|
40
|
+
"settings",
|
|
41
|
+
"audit",
|
|
42
|
+
"completion",
|
|
43
|
+
// The words the core keeps.
|
|
44
|
+
"help",
|
|
45
|
+
"version",
|
|
46
|
+
"init",
|
|
47
|
+
"new",
|
|
48
|
+
"login",
|
|
49
|
+
"logout",
|
|
50
|
+
"config",
|
|
51
|
+
"site",
|
|
52
|
+
"sites",
|
|
53
|
+
"keys",
|
|
54
|
+
"forms",
|
|
55
|
+
"search",
|
|
56
|
+
"backup",
|
|
57
|
+
"restore",
|
|
58
|
+
"logs",
|
|
59
|
+
"jobs",
|
|
60
|
+
"status",
|
|
61
|
+
"doctor",
|
|
62
|
+
"upgrade",
|
|
63
|
+
"update",
|
|
64
|
+
"deploy",
|
|
65
|
+
"export",
|
|
66
|
+
"import",
|
|
67
|
+
"run",
|
|
68
|
+
"exec",
|
|
69
|
+
"x",
|
|
70
|
+
"kardalum",
|
|
71
|
+
"core",
|
|
72
|
+
].sort());
|
|
73
|
+
/** A C0 control character, DEL, or a C1 control character. */
|
|
74
|
+
function isControl(code) {
|
|
75
|
+
return code < 0x20 || code === 0x7f || (code >= 0x80 && code <= 0x9f);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A character that changes how text around it reads without showing itself: the zero-width
|
|
79
|
+
* characters and marks (U+200B to U+200F), the Arabic letter mark (U+061C), the bidi embeddings
|
|
80
|
+
* and overrides (U+202A to U+202E), the invisible operators (U+2060 to U+2064), the bidi isolates
|
|
81
|
+
* (U+2066 to U+2069) and the byte order mark (U+FEFF). A summary or a description holding one could show the reader other text
|
|
82
|
+
* than the one checked.
|
|
83
|
+
*/
|
|
84
|
+
function isHidden(code) {
|
|
85
|
+
return (code === 0x061c ||
|
|
86
|
+
(code >= 0x200b && code <= 0x200f) ||
|
|
87
|
+
(code >= 0x202a && code <= 0x202e) ||
|
|
88
|
+
(code >= 0x2060 && code <= 0x2064) ||
|
|
89
|
+
(code >= 0x2066 && code <= 0x2069) ||
|
|
90
|
+
code === 0xfeff);
|
|
91
|
+
}
|
|
92
|
+
/** M32 I3 (B13): a control or hidden character (isControl or isHidden): what redaction looks past. */
|
|
93
|
+
export function isControlOrHiddenCharCode(code) {
|
|
94
|
+
return isControl(code) || isHidden(code);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* M32 I3 (B13): a code point redaction looks past. Everything `isControlOrHiddenCharCode` covers, plus the
|
|
98
|
+
* characters that render as nothing but are outside the plugin description rule: the soft hyphen (U+00AD),
|
|
99
|
+
* the combining grapheme joiner (U+034F), the Mongolian vowel separator
|
|
100
|
+
* (U+180E), the variation selectors (U+FE00 to U+FE0F), the Hangul filler (U+3164) and the tag characters
|
|
101
|
+
* (U+E0000 to U+E007F). Takes a code point, not a UTF-16 unit, so the tag characters are seen.
|
|
102
|
+
*/
|
|
103
|
+
export function isRedactionSkippedCodePoint(codePoint) {
|
|
104
|
+
return (isControlOrHiddenCharCode(codePoint) ||
|
|
105
|
+
codePoint === 0x00ad ||
|
|
106
|
+
codePoint === 0x034f ||
|
|
107
|
+
codePoint === 0x061c ||
|
|
108
|
+
codePoint === 0x180e ||
|
|
109
|
+
(codePoint >= 0xfe00 && codePoint <= 0xfe0f) ||
|
|
110
|
+
codePoint === 0x3164 ||
|
|
111
|
+
(codePoint >= 0xe0000 && codePoint <= 0xe007f));
|
|
112
|
+
}
|
|
113
|
+
/** Whether `text` holds a hidden character (`isHidden`): what a plugin's description may not. */
|
|
114
|
+
export function hasHiddenPluginCharacter(text) {
|
|
115
|
+
for (let i = 0; i < text.length; i++)
|
|
116
|
+
if (isHidden(text.charCodeAt(i)))
|
|
117
|
+
return true;
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
function isHighSurrogate(code) {
|
|
121
|
+
return code >= 0xd800 && code <= 0xdbff;
|
|
122
|
+
}
|
|
123
|
+
/** `text` cut at `max` UTF-16 units, one less when the cut would split a surrogate pair. */
|
|
124
|
+
function cutAtCodePoint(text, max) {
|
|
125
|
+
if (text.length <= max)
|
|
126
|
+
return text;
|
|
127
|
+
const end = max > 0 && isHighSurrogate(text.charCodeAt(max - 1)) ? max - 1 : max;
|
|
128
|
+
return text.slice(0, end);
|
|
129
|
+
}
|
|
130
|
+
function isLowerLetter(code) {
|
|
131
|
+
return code >= 97 && code <= 122;
|
|
132
|
+
}
|
|
133
|
+
function isDigit(code) {
|
|
134
|
+
return code >= 48 && code <= 57;
|
|
135
|
+
}
|
|
136
|
+
/** D1: 1 to 32 lower-case letters, digits and "-", a letter first and no "-" last. */
|
|
137
|
+
export function isPluginCliCommandName(name) {
|
|
138
|
+
if (name.length === 0 || name.length > PLUGIN_CLI_COMMAND_NAME_MAX)
|
|
139
|
+
return false;
|
|
140
|
+
if (!isLowerLetter(name.charCodeAt(0)))
|
|
141
|
+
return false;
|
|
142
|
+
if (name.charCodeAt(name.length - 1) === 45)
|
|
143
|
+
return false;
|
|
144
|
+
for (let i = 1; i < name.length; i++) {
|
|
145
|
+
const code = name.charCodeAt(i);
|
|
146
|
+
if (!isLowerLetter(code) && !isDigit(code) && code !== 45)
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* D1: 3 to 200 characters, "./" first, "/" as the only separator, no empty, "." or ".." segment,
|
|
153
|
+
* no "\", ":", "%", "?", "#" or control character, and a ".js" or ".mjs" ending (no "%", "?" or "#",
|
|
154
|
+
* because a module path read as a URL would decode, query or cut at them). So the module always names a
|
|
155
|
+
* file inside the package itself.
|
|
156
|
+
*/
|
|
157
|
+
export function isPluginCliModulePath(path) {
|
|
158
|
+
if (path.length < PLUGIN_CLI_MODULE_MIN || path.length > PLUGIN_CLI_MODULE_MAX)
|
|
159
|
+
return false;
|
|
160
|
+
if (!path.startsWith("./"))
|
|
161
|
+
return false;
|
|
162
|
+
if (!path.endsWith(".js") && !path.endsWith(".mjs"))
|
|
163
|
+
return false;
|
|
164
|
+
let segmentStart = 2;
|
|
165
|
+
for (let i = 2; i <= path.length; i++) {
|
|
166
|
+
const code = i < path.length ? path.charCodeAt(i) : 47;
|
|
167
|
+
if (code === 92 || code === 58 || code === 37 || code === 63 || code === 35 || isControl(code))
|
|
168
|
+
return false;
|
|
169
|
+
if (code !== 47)
|
|
170
|
+
continue;
|
|
171
|
+
const length = i - segmentStart;
|
|
172
|
+
if (length === 0)
|
|
173
|
+
return false;
|
|
174
|
+
if (length === 1 && path.charCodeAt(segmentStart) === 46)
|
|
175
|
+
return false;
|
|
176
|
+
if (length === 2 && path.charCodeAt(segmentStart) === 46 && path.charCodeAt(segmentStart + 1) === 46)
|
|
177
|
+
return false;
|
|
178
|
+
segmentStart = i + 1;
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* D2: the plugin id's last segment, cut at 32 characters, any "-" the cut leaves last trimmed, so a
|
|
184
|
+
* prefix has a command name's shape. Empty only for an id that is not a manifest id.
|
|
185
|
+
*/
|
|
186
|
+
export function pluginCliPrefix(pluginId) {
|
|
187
|
+
const cut = cutAtCodePoint(pluginId.slice(pluginId.lastIndexOf(".") + 1), PLUGIN_CLI_PREFIX_MAX);
|
|
188
|
+
let end = cut.length;
|
|
189
|
+
while (end > 0 && cut.charCodeAt(end - 1) === 45)
|
|
190
|
+
end--;
|
|
191
|
+
return cut.slice(0, end);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Text a plugin wrote, made safe for a terminal or a message: every control character (below
|
|
195
|
+
* 0x20, 0x7f, 0x80 to 0x9f) and every hidden character (`isHidden`) removed, so no escape sequence
|
|
196
|
+
* or reordering reaches the reader, and cut at `max` UTF-16 units without splitting a surrogate pair.
|
|
197
|
+
*/
|
|
198
|
+
export function cleanPluginText(text, max) {
|
|
199
|
+
let out = "";
|
|
200
|
+
for (let i = 0; i < text.length && out.length < max; i++) {
|
|
201
|
+
const code = text.charCodeAt(i);
|
|
202
|
+
if (isControl(code) || isHidden(code))
|
|
203
|
+
continue;
|
|
204
|
+
if (isHighSurrogate(code) && i + 1 < text.length) {
|
|
205
|
+
const next = text.charCodeAt(i + 1);
|
|
206
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
207
|
+
if (out.length + 2 > max)
|
|
208
|
+
break;
|
|
209
|
+
out += text[i] + text[i + 1];
|
|
210
|
+
i++;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
out += text[i];
|
|
215
|
+
}
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
218
|
+
function hasNoControlOrHidden(text) {
|
|
219
|
+
for (let i = 0; i < text.length; i++) {
|
|
220
|
+
const code = text.charCodeAt(i);
|
|
221
|
+
if (isControl(code) || isHidden(code))
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
function isSummary(summary) {
|
|
227
|
+
return summary.length > 0 && summary.length <= PLUGIN_CLI_SUMMARY_MAX && summary.trim().length > 0 && hasNoControlOrHidden(summary);
|
|
228
|
+
}
|
|
229
|
+
const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
230
|
+
const DECLARATION_KEYS = new Set(["plugin", "module", "commands"]);
|
|
231
|
+
const COMMAND_KEYS = new Set(["name", "summary"]);
|
|
232
|
+
const RESERVED = new Set(CLI_RESERVED_PREFIXES);
|
|
233
|
+
/**
|
|
234
|
+
* D1, D2: a package.json's `kardalum.cli` member. Strict: no key beyond `plugin`, `module` and
|
|
235
|
+
* `commands`, and none in a command beyond `name` and `summary`. A plugin whose prefix is
|
|
236
|
+
* reserved is refused.
|
|
237
|
+
*/
|
|
238
|
+
export function checkPluginCliDeclaration(value) {
|
|
239
|
+
if (!isRecord(value)) {
|
|
240
|
+
return { ok: false, issues: [{ path: [], message: "kardalum.cli must be an object with plugin, module and commands" }] };
|
|
241
|
+
}
|
|
242
|
+
const issues = [];
|
|
243
|
+
for (const key of Object.keys(value)) {
|
|
244
|
+
if (!DECLARATION_KEYS.has(key)) {
|
|
245
|
+
issues.push({ path: [cleanPluginText(key, 64)], message: "kardalum.cli holds only plugin, module and commands" });
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const { plugin, module, commands } = value;
|
|
249
|
+
let prefix = "";
|
|
250
|
+
if (typeof plugin !== "string" || !isPluginManifestId(plugin)) {
|
|
251
|
+
issues.push({ path: ["plugin"], message: "plugin must be the plugin's manifest id, such as com.example.seo" });
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
prefix = pluginCliPrefix(plugin);
|
|
255
|
+
if (prefix === "") {
|
|
256
|
+
issues.push({ path: ["plugin"], message: "the plugin id's last segment gives no command prefix" });
|
|
257
|
+
}
|
|
258
|
+
else if (RESERVED.has(prefix)) {
|
|
259
|
+
issues.push({ path: ["plugin"], message: `the command prefix "${prefix}" is reserved for the CLI's own commands: it comes from the plugin id's last segment` });
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (typeof module !== "string" || !isPluginCliModulePath(module)) {
|
|
263
|
+
issues.push({
|
|
264
|
+
path: ["module"],
|
|
265
|
+
message: `module must be a path of ${PLUGIN_CLI_MODULE_MIN} to ${PLUGIN_CLI_MODULE_MAX} characters inside the package, starting with "./" and ending in ".js" or ".mjs"`,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
if (!Array.isArray(commands) || commands.length === 0 || commands.length > PLUGIN_CLI_COMMANDS_MAX) {
|
|
269
|
+
issues.push({ path: ["commands"], message: `commands must be a list of 1 to ${PLUGIN_CLI_COMMANDS_MAX} commands` });
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
const seen = new Map();
|
|
273
|
+
commands.forEach((command, index) => {
|
|
274
|
+
const at = ["commands", index];
|
|
275
|
+
if (!isRecord(command)) {
|
|
276
|
+
issues.push({ path: at, message: "a command must be an object with a name and a summary" });
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
for (const key of Object.keys(command)) {
|
|
280
|
+
if (!COMMAND_KEYS.has(key))
|
|
281
|
+
issues.push({ path: [...at, cleanPluginText(key, 64)], message: "a command holds only name and summary" });
|
|
282
|
+
}
|
|
283
|
+
const { name, summary } = command;
|
|
284
|
+
if (typeof name !== "string" || !isPluginCliCommandName(name)) {
|
|
285
|
+
issues.push({
|
|
286
|
+
path: [...at, "name"],
|
|
287
|
+
message: `name must be 1 to ${PLUGIN_CLI_COMMAND_NAME_MAX} lower-case letters, digits and "-", starting with a letter and not ending with "-"`,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
const earlier = seen.get(name);
|
|
292
|
+
if (earlier !== undefined) {
|
|
293
|
+
issues.push({ path: [...at, "name"], message: `the command name "${name}" is also commands.${earlier}'s: each command needs its own name` });
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
seen.set(name, index);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (typeof summary !== "string" || !isSummary(summary)) {
|
|
300
|
+
issues.push({ path: [...at, "summary"], message: `summary must be 1 to ${PLUGIN_CLI_SUMMARY_MAX} printable characters, with no control, zero-width or direction character` });
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
if (issues.length > 0)
|
|
305
|
+
return { ok: false, issues };
|
|
306
|
+
const checked = commands;
|
|
307
|
+
return {
|
|
308
|
+
ok: true,
|
|
309
|
+
declaration: {
|
|
310
|
+
plugin: plugin,
|
|
311
|
+
module: module,
|
|
312
|
+
commands: checked.map((command) => ({ name: command.name, summary: command.summary })),
|
|
313
|
+
},
|
|
314
|
+
prefix,
|
|
315
|
+
};
|
|
316
|
+
}
|