@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { CONTENT_LIST_FIELD_ID_MAX } from "./content-list.schema.js";
|
|
2
3
|
// SimpleStorageAPI's HTTP surface (Session 68): the SimpleStorageAPI
|
|
3
4
|
// interface is get(contentId, fieldId) / set(contentId, fieldId, value),
|
|
4
5
|
// with pluginId made explicit here as a required 3rd param: this is the
|
|
@@ -6,8 +7,43 @@ import { z } from "zod";
|
|
|
6
7
|
// (usePluginValue(), Session 70, resolves pluginId from React context and
|
|
7
8
|
// never asks a plugin author to pass it by hand).
|
|
8
9
|
// Matches FieldDefinition.id's shape (document-type.schema.ts), with the same
|
|
9
|
-
// stable key, just scoped to one plugin's stored value for that field.
|
|
10
|
-
|
|
10
|
+
// stable key, just scoped to one plugin's stored value for that field. M33 K30:
|
|
11
|
+
// and its cap (CONTENT_LIST_FIELD_ID_MAX, 64), the same on the server code's
|
|
12
|
+
// door (`context.simpleStorage`, which checks it with isContentListFieldId).
|
|
13
|
+
const FieldIdSchema = z.string().max(CONTENT_LIST_FIELD_ID_MAX, { abort: true }).regex(/^[a-zA-Z][a-zA-Z0-9_]*$/);
|
|
14
|
+
/** M33 K30: the most bytes a simple storage value takes, serialised as JSON (UTF-8), on both doors. */
|
|
15
|
+
export const SIMPLE_STORAGE_VALUE_MAX_BYTES = 65536;
|
|
16
|
+
/**
|
|
17
|
+
* M33 K30: a value's size as stored, the UTF-8 bytes of its JSON, or null when JSON cannot hold it
|
|
18
|
+
* (undefined, a function, a BigInt, a cycle). One linear pass over the serialised text.
|
|
19
|
+
*/
|
|
20
|
+
export function simpleStorageValueBytes(value) {
|
|
21
|
+
let text;
|
|
22
|
+
try {
|
|
23
|
+
text = JSON.stringify(value);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
if (typeof text !== "string")
|
|
29
|
+
return null;
|
|
30
|
+
let bytes = 0;
|
|
31
|
+
for (let i = 0; i < text.length; i++) {
|
|
32
|
+
const c = text.charCodeAt(i);
|
|
33
|
+
if (c < 0x80)
|
|
34
|
+
bytes += 1;
|
|
35
|
+
else if (c < 0x800)
|
|
36
|
+
bytes += 2;
|
|
37
|
+
else if (c >= 0xd800 && c <= 0xdbff && i + 1 < text.length && (text.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
|
|
38
|
+
// A surrogate pair is one character of four bytes.
|
|
39
|
+
bytes += 4;
|
|
40
|
+
i++;
|
|
41
|
+
}
|
|
42
|
+
else
|
|
43
|
+
bytes += 3;
|
|
44
|
+
}
|
|
45
|
+
return bytes;
|
|
46
|
+
}
|
|
11
47
|
// Deliberately NOT plugin-sdk's stricter reverse-DNS pluginIdSchema:
|
|
12
48
|
// plugin-sdk depends on api-schemas, not the reverse, so it can't be
|
|
13
49
|
// imported here without a cycle.
|
|
@@ -19,6 +55,13 @@ export const PluginStorageParamsSchema = z.object({
|
|
|
19
55
|
});
|
|
20
56
|
// `value` is z.unknown(), not a record: SimpleStorageAPI's value is
|
|
21
57
|
// untyped by design; a plugin can store a string, number, array, or
|
|
22
|
-
// object, not only key-value maps.
|
|
23
|
-
|
|
58
|
+
// object, not only key-value maps. M33 K30: at most SIMPLE_STORAGE_VALUE_MAX_BYTES
|
|
59
|
+
// serialised, as `context.simpleStorage.set` takes.
|
|
60
|
+
export const SetPluginFieldValueRequestSchema = z
|
|
61
|
+
.object({
|
|
62
|
+
value: z.unknown().refine((value) => (simpleStorageValueBytes(value) ?? 0) <= SIMPLE_STORAGE_VALUE_MAX_BYTES, {
|
|
63
|
+
message: `at most ${SIMPLE_STORAGE_VALUE_MAX_BYTES} bytes serialised as JSON`,
|
|
64
|
+
}),
|
|
65
|
+
})
|
|
66
|
+
.strict();
|
|
24
67
|
export const PluginFieldValueResponseSchema = z.object({ value: z.unknown() });
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** D10: the most scheduled tasks one plugin declares. */
|
|
2
|
+
export declare const PLUGIN_SCHEDULED_TASKS_MAX = 5;
|
|
3
|
+
/** D10: the longest cron expression, in characters. */
|
|
4
|
+
export declare const CRON_EXPRESSION_MAX = 100;
|
|
5
|
+
/** D9: a run is given this long (10 minutes) before its signal aborts and its slot is freed. The
|
|
6
|
+
* server's task runner reads it; a plugin imports it through `@kardalum/plugin-sdk/manifest`. */
|
|
7
|
+
export declare const PLUGIN_TASK_TIME_MS = 600000;
|
|
8
|
+
/** M33 (Sign-in fix wave, N3): how long one step of an install or update may run plugin code before
|
|
9
|
+
* the server stops waiting, refuses the package, undoes what the registration wrote and frees the
|
|
10
|
+
* plugin's install lock. The steps are the import of server/plugin.js and each hook the registration
|
|
11
|
+
* runs (a migration's `up`, `onInstall`, `onUpdate`, `onActivate`). It is the time a scheduled task
|
|
12
|
+
* run is given, the longest the core gives plugin code for one piece of work, so a migration that
|
|
13
|
+
* fits in a task run fits here, and no hook can hold the lock for ever. */
|
|
14
|
+
export declare const PLUGIN_INSTALL_STEP_TIME_MS = 600000;
|
|
15
|
+
/** A parsed standard 5-field cron rule (minute, hour, day of month, month, day of week), UTC.
|
|
16
|
+
* `weekdays` holds 0 to 6 with Sunday 0 (a written 7 is folded to 0). A day field that begins
|
|
17
|
+
* with `*` is not restricted. */
|
|
18
|
+
export interface CronRule {
|
|
19
|
+
minutes: ReadonlySet<number>;
|
|
20
|
+
hours: ReadonlySet<number>;
|
|
21
|
+
days: ReadonlySet<number>;
|
|
22
|
+
months: ReadonlySet<number>;
|
|
23
|
+
weekdays: ReadonlySet<number>;
|
|
24
|
+
daysRestricted: boolean;
|
|
25
|
+
weekdaysRestricted: boolean;
|
|
26
|
+
}
|
|
27
|
+
export type CronParseResult = {
|
|
28
|
+
ok: true;
|
|
29
|
+
rule: CronRule;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
position: number;
|
|
33
|
+
message: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Parses a standard 5-field cron expression. Linear in the (capped) length, no regular expression.
|
|
37
|
+
* The fields are separated by single spaces (two spaces in a row leave a field empty); month and
|
|
38
|
+
* weekday names and `?` are not supported.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseCronExpression(text: string): CronParseResult;
|
|
41
|
+
/** True when the rule fires in the UTC minute containing `at`. When both day fields are
|
|
42
|
+
* restricted either may match (the standard cron rule); otherwise both must. */
|
|
43
|
+
export declare function cronMatches(rule: CronRule, at: Date): boolean;
|
|
44
|
+
/** An English phrase for the generated reference (UTC). The admin builds its own localised phrase. */
|
|
45
|
+
export declare function describeCron(rule: CronRule): string;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// M32 F4d (D10, D11): a plugin's scheduled tasks. The rules and limits live here; the SDK's
|
|
2
|
+
// manifest schema and the server's runner import them. A cron expression is text a plugin author
|
|
3
|
+
// wrote, so it is read by one linear scan with the length cap checked first and no regular
|
|
4
|
+
// expression: the work is bounded by CRON_EXPRESSION_MAX for any input.
|
|
5
|
+
/** D10: the most scheduled tasks one plugin declares. */
|
|
6
|
+
export const PLUGIN_SCHEDULED_TASKS_MAX = 5;
|
|
7
|
+
/** D10: the longest cron expression, in characters. */
|
|
8
|
+
export const CRON_EXPRESSION_MAX = 100;
|
|
9
|
+
/** D9: a run is given this long (10 minutes) before its signal aborts and its slot is freed. The
|
|
10
|
+
* server's task runner reads it; a plugin imports it through `@kardalum/plugin-sdk/manifest`. */
|
|
11
|
+
export const PLUGIN_TASK_TIME_MS = 600_000;
|
|
12
|
+
/** M33 (Sign-in fix wave, N3): how long one step of an install or update may run plugin code before
|
|
13
|
+
* the server stops waiting, refuses the package, undoes what the registration wrote and frees the
|
|
14
|
+
* plugin's install lock. The steps are the import of server/plugin.js and each hook the registration
|
|
15
|
+
* runs (a migration's `up`, `onInstall`, `onUpdate`, `onActivate`). It is the time a scheduled task
|
|
16
|
+
* run is given, the longest the core gives plugin code for one piece of work, so a migration that
|
|
17
|
+
* fits in a task run fits here, and no hook can hold the lock for ever. */
|
|
18
|
+
export const PLUGIN_INSTALL_STEP_TIME_MS = PLUGIN_TASK_TIME_MS;
|
|
19
|
+
const FIELDS = [
|
|
20
|
+
{ name: "minute", min: 0, max: 59 },
|
|
21
|
+
{ name: "hour", min: 0, max: 23 },
|
|
22
|
+
{ name: "day of month", min: 1, max: 31 },
|
|
23
|
+
{ name: "month", min: 1, max: 12 },
|
|
24
|
+
{ name: "day of week", min: 0, max: 7 },
|
|
25
|
+
];
|
|
26
|
+
// Reads a run of ASCII digits from `from` (at most 3, so a long run is refused early).
|
|
27
|
+
function readNumber(text, from, stop) {
|
|
28
|
+
let i = from;
|
|
29
|
+
let value = 0;
|
|
30
|
+
while (i < stop) {
|
|
31
|
+
const c = text.charCodeAt(i);
|
|
32
|
+
if (c < 48 || c > 57)
|
|
33
|
+
break;
|
|
34
|
+
value = value * 10 + (c - 48);
|
|
35
|
+
i += 1;
|
|
36
|
+
if (i - from > 3)
|
|
37
|
+
return { error: "number is too long", at: from };
|
|
38
|
+
}
|
|
39
|
+
if (i === from)
|
|
40
|
+
return { error: "expected a number", at: from };
|
|
41
|
+
return { value, end: i };
|
|
42
|
+
}
|
|
43
|
+
function parseField(text, start, stop, spec) {
|
|
44
|
+
const values = new Set();
|
|
45
|
+
let i = start;
|
|
46
|
+
for (;;) {
|
|
47
|
+
// One item: (* | n | a-b) [/step]
|
|
48
|
+
let low;
|
|
49
|
+
let high;
|
|
50
|
+
let star = false;
|
|
51
|
+
if (i < stop && text.charCodeAt(i) === 42) {
|
|
52
|
+
low = spec.min;
|
|
53
|
+
high = spec.max;
|
|
54
|
+
star = true;
|
|
55
|
+
i += 1;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const first = readNumber(text, i, stop);
|
|
59
|
+
if ("error" in first)
|
|
60
|
+
return { position: first.at, message: `${spec.name}: ${first.error}` };
|
|
61
|
+
low = first.value;
|
|
62
|
+
high = first.value;
|
|
63
|
+
i = first.end;
|
|
64
|
+
if (i < stop && text.charCodeAt(i) === 45) {
|
|
65
|
+
const second = readNumber(text, i + 1, stop);
|
|
66
|
+
if ("error" in second)
|
|
67
|
+
return { position: second.at, message: `${spec.name}: ${second.error}` };
|
|
68
|
+
high = second.value;
|
|
69
|
+
i = second.end;
|
|
70
|
+
if (high < low)
|
|
71
|
+
return { position: i - 1, message: `${spec.name}: range runs backwards` };
|
|
72
|
+
}
|
|
73
|
+
if (low < spec.min || high > spec.max) {
|
|
74
|
+
return { position: start, message: `${spec.name} must be ${spec.min} to ${spec.max}` };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
let step = 1;
|
|
78
|
+
if (i < stop && text.charCodeAt(i) === 47) {
|
|
79
|
+
const s = readNumber(text, i + 1, stop);
|
|
80
|
+
if ("error" in s)
|
|
81
|
+
return { position: s.at, message: `${spec.name}: step ${s.error}` };
|
|
82
|
+
if (s.value < 1)
|
|
83
|
+
return { position: i + 1, message: `${spec.name}: step must be at least 1` };
|
|
84
|
+
step = s.value;
|
|
85
|
+
i = s.end;
|
|
86
|
+
// A bare number with a step runs to the end of the field (n/step).
|
|
87
|
+
if (!star && low === high)
|
|
88
|
+
high = spec.max;
|
|
89
|
+
}
|
|
90
|
+
for (let v = low; v <= high; v += step)
|
|
91
|
+
values.add(spec.name === "day of week" && v === 7 ? 0 : v);
|
|
92
|
+
if (i >= stop)
|
|
93
|
+
return { values };
|
|
94
|
+
if (text.charCodeAt(i) !== 44)
|
|
95
|
+
return { position: i, message: `${spec.name}: unexpected character` };
|
|
96
|
+
i += 1;
|
|
97
|
+
if (i >= stop)
|
|
98
|
+
return { position: i, message: `${spec.name}: empty item after comma` };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Parses a standard 5-field cron expression. Linear in the (capped) length, no regular expression.
|
|
103
|
+
* The fields are separated by single spaces (two spaces in a row leave a field empty); month and
|
|
104
|
+
* weekday names and `?` are not supported.
|
|
105
|
+
*/
|
|
106
|
+
export function parseCronExpression(text) {
|
|
107
|
+
if (typeof text !== "string")
|
|
108
|
+
return { ok: false, position: 0, message: "cron expression must be text" };
|
|
109
|
+
if (text.length > CRON_EXPRESSION_MAX) {
|
|
110
|
+
return { ok: false, position: CRON_EXPRESSION_MAX, message: `cron expression is longer than ${CRON_EXPRESSION_MAX} characters` };
|
|
111
|
+
}
|
|
112
|
+
const sets = [];
|
|
113
|
+
const starts = [];
|
|
114
|
+
let start = 0;
|
|
115
|
+
for (let f = 0; f < FIELDS.length; f += 1) {
|
|
116
|
+
starts.push(start);
|
|
117
|
+
let stop = start;
|
|
118
|
+
while (stop < text.length && text.charCodeAt(stop) !== 32)
|
|
119
|
+
stop += 1;
|
|
120
|
+
if (stop === start)
|
|
121
|
+
return { ok: false, position: start, message: `${FIELDS[f].name} field is empty` };
|
|
122
|
+
const parsed = parseField(text, start, stop, FIELDS[f]);
|
|
123
|
+
if (!("values" in parsed))
|
|
124
|
+
return { ok: false, position: parsed.position, message: parsed.message };
|
|
125
|
+
sets.push(parsed.values);
|
|
126
|
+
if (f < FIELDS.length - 1) {
|
|
127
|
+
if (stop >= text.length)
|
|
128
|
+
return { ok: false, position: stop, message: "a cron expression has five fields" };
|
|
129
|
+
start = stop + 1;
|
|
130
|
+
}
|
|
131
|
+
else if (stop < text.length) {
|
|
132
|
+
return { ok: false, position: stop, message: "a cron expression has five fields" };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
ok: true,
|
|
137
|
+
rule: {
|
|
138
|
+
minutes: sets[0],
|
|
139
|
+
hours: sets[1],
|
|
140
|
+
days: sets[2],
|
|
141
|
+
months: sets[3],
|
|
142
|
+
weekdays: sets[4],
|
|
143
|
+
daysRestricted: text.charCodeAt(starts[2]) !== 42,
|
|
144
|
+
weekdaysRestricted: text.charCodeAt(starts[4]) !== 42,
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/** True when the rule fires in the UTC minute containing `at`. When both day fields are
|
|
149
|
+
* restricted either may match (the standard cron rule); otherwise both must. */
|
|
150
|
+
export function cronMatches(rule, at) {
|
|
151
|
+
if (!rule.minutes.has(at.getUTCMinutes()))
|
|
152
|
+
return false;
|
|
153
|
+
if (!rule.hours.has(at.getUTCHours()))
|
|
154
|
+
return false;
|
|
155
|
+
if (!rule.months.has(at.getUTCMonth() + 1))
|
|
156
|
+
return false;
|
|
157
|
+
const dayOk = rule.days.has(at.getUTCDate());
|
|
158
|
+
const weekdayOk = rule.weekdays.has(at.getUTCDay());
|
|
159
|
+
if (rule.daysRestricted && rule.weekdaysRestricted)
|
|
160
|
+
return dayOk || weekdayOk;
|
|
161
|
+
return dayOk && weekdayOk;
|
|
162
|
+
}
|
|
163
|
+
const WEEKDAY_NAMES = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
164
|
+
const MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
165
|
+
function listOf(values, label) {
|
|
166
|
+
return [...values].sort((a, b) => a - b).map(label).join(", ");
|
|
167
|
+
}
|
|
168
|
+
function pad(n) {
|
|
169
|
+
return n < 10 ? `0${n}` : String(n);
|
|
170
|
+
}
|
|
171
|
+
/** An English phrase for the generated reference (UTC). The admin builds its own localised phrase. */
|
|
172
|
+
export function describeCron(rule) {
|
|
173
|
+
const parts = [];
|
|
174
|
+
if (rule.hours.size === 1 && rule.minutes.size === 1) {
|
|
175
|
+
parts.push(`at ${pad([...rule.hours][0])}:${pad([...rule.minutes][0])} UTC`);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
parts.push(rule.minutes.size === 60 ? "every minute" : `at minute ${listOf(rule.minutes, String)}`);
|
|
179
|
+
parts.push(rule.hours.size === 24 ? "of every hour" : `of hour ${listOf(rule.hours, String)} UTC`);
|
|
180
|
+
}
|
|
181
|
+
// The sets, not the star flags: "*/2" begins with a star yet runs on every other day. The flags
|
|
182
|
+
// only decide how two day fields join (cronMatches: either when both are restricted, else both).
|
|
183
|
+
// Two restricted fields match on either, so a full one ("1-31", "0-6") makes every day match.
|
|
184
|
+
const either = rule.daysRestricted && rule.weekdaysRestricted;
|
|
185
|
+
const everyDay = either && (rule.days.size === 31 || rule.weekdays.size === 7);
|
|
186
|
+
const someDays = !everyDay && rule.days.size < 31;
|
|
187
|
+
const someWeekdays = !everyDay && rule.weekdays.size < 7;
|
|
188
|
+
if (someDays)
|
|
189
|
+
parts.push(`on day ${listOf(rule.days, String)} of the month`);
|
|
190
|
+
if (someWeekdays) {
|
|
191
|
+
const join = !someDays ? "on " : either ? "or " : "and on ";
|
|
192
|
+
parts.push(`${join}${listOf(rule.weekdays, (n) => WEEKDAY_NAMES[n])}`);
|
|
193
|
+
}
|
|
194
|
+
if (rule.months.size < 12)
|
|
195
|
+
parts.push(`in ${listOf(rule.months, (n) => MONTH_NAMES[n - 1])}`);
|
|
196
|
+
return parts.join(" ");
|
|
197
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The CLDR plural categories, in the order a list or a message names them. */
|
|
2
|
+
export declare const PLURAL_CATEGORIES: readonly ["zero", "one", "two", "few", "many", "other"];
|
|
3
|
+
export type PluralCategory = (typeof PLURAL_CATEGORIES)[number];
|
|
4
|
+
/** The plural categories a language uses (M33 K37), in PLURAL_CATEGORIES'
|
|
5
|
+
* order: English `one` and `other`, Arabic all six. */
|
|
6
|
+
export declare function pluralCategories(language: string): PluralCategory[];
|
|
7
|
+
/** The plural category a count takes in a language (M33 K37): Arabic 0, 1,
|
|
8
|
+
* 2, 3, 11 and 100 are zero, one, two, few, many and other. */
|
|
9
|
+
export declare function pluralCategoryOf(count: number, language: string): PluralCategory;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** The CLDR plural categories, in the order a list or a message names them. */
|
|
2
|
+
export const PLURAL_CATEGORIES = ["zero", "one", "two", "few", "many", "other"];
|
|
3
|
+
/** A language's plural rules. A tag the runtime does not know (or cannot
|
|
4
|
+
* read) takes English's rules, never the machine's own language, so the CLI,
|
|
5
|
+
* the marketplace and the admin answer the same for it. */
|
|
6
|
+
function rulesOf(language) {
|
|
7
|
+
const known = rulesByLanguage.get(language);
|
|
8
|
+
if (known)
|
|
9
|
+
return known;
|
|
10
|
+
const rules = buildRules(language);
|
|
11
|
+
// A long-lived process (the marketplace) reads tags from uploaded files, so the cache stays bounded.
|
|
12
|
+
if (rulesByLanguage.size >= PLURAL_RULES_CACHED_MAX)
|
|
13
|
+
rulesByLanguage.clear();
|
|
14
|
+
rulesByLanguage.set(language, rules);
|
|
15
|
+
return rules;
|
|
16
|
+
}
|
|
17
|
+
/** One PluralRules per tag asked for: building one is the costly part of a plural lookup. */
|
|
18
|
+
const rulesByLanguage = new Map();
|
|
19
|
+
/** How many tags the cache holds before it starts over (far more than the languages a site uses). */
|
|
20
|
+
const PLURAL_RULES_CACHED_MAX = 256;
|
|
21
|
+
function buildRules(language) {
|
|
22
|
+
try {
|
|
23
|
+
if (Intl.PluralRules.supportedLocalesOf([language]).length > 0)
|
|
24
|
+
return new Intl.PluralRules(language);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// A malformed tag: English's rules below.
|
|
28
|
+
}
|
|
29
|
+
return new Intl.PluralRules("en");
|
|
30
|
+
}
|
|
31
|
+
/** The plural categories a language uses (M33 K37), in PLURAL_CATEGORIES'
|
|
32
|
+
* order: English `one` and `other`, Arabic all six. */
|
|
33
|
+
export function pluralCategories(language) {
|
|
34
|
+
const used = new Set(rulesOf(language).resolvedOptions().pluralCategories);
|
|
35
|
+
return PLURAL_CATEGORIES.filter((category) => used.has(category));
|
|
36
|
+
}
|
|
37
|
+
/** The plural category a count takes in a language (M33 K37): Arabic 0, 1,
|
|
38
|
+
* 2, 3, 11 and 100 are zero, one, two, few, many and other. */
|
|
39
|
+
export function pluralCategoryOf(count, language) {
|
|
40
|
+
return rulesOf(language).select(count);
|
|
41
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { isProviderSearchCursor } from "./plugin-providers.js";
|
|
2
3
|
export declare const PublicContentExtensionsSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3
4
|
export declare const PublicContentItemSchema: z.ZodObject<{
|
|
4
5
|
id: z.ZodString;
|
|
@@ -11,6 +12,12 @@ export declare const PublicContentItemSchema: z.ZodObject<{
|
|
|
11
12
|
url: z.ZodNullable<z.ZodString>;
|
|
12
13
|
}, z.core.$strip>;
|
|
13
14
|
export type PublicContentItem = z.infer<typeof PublicContentItemSchema>;
|
|
15
|
+
/**
|
|
16
|
+
* M32 L (access-2): the longest language tag a delivery read takes in `locale`. A language tag is far shorter; the
|
|
17
|
+
* cap keeps a list from writing an over-long tag into every row's `url`. CultureSchema itself carries no cap, since
|
|
18
|
+
* the management API reads it too.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CULTURE_TAG_MAX = 64;
|
|
14
21
|
export declare const PublicContentItemQuerySchema: z.ZodObject<{
|
|
15
22
|
locale: z.ZodOptional<z.ZodString>;
|
|
16
23
|
format: z.ZodOptional<z.ZodString>;
|
|
@@ -47,9 +54,22 @@ export declare const PublicContentByAddressResponseSchema: z.ZodObject<{
|
|
|
47
54
|
redirected: z.ZodBoolean;
|
|
48
55
|
}, z.core.$strip>;
|
|
49
56
|
export type PublicContentByAddressResponse = z.infer<typeof PublicContentByAddressResponseSchema>;
|
|
57
|
+
/** M32 L (L2): how many distinct field ids one content list request may name in `fields`. */
|
|
58
|
+
export declare const PUBLIC_LIST_FIELDS_MAX = 20;
|
|
59
|
+
/** M32 L (L2): the longest `fields` value read: every id at its longest, each with a comma and a space. */
|
|
60
|
+
export declare const PUBLIC_LIST_FIELDS_TEXT_MAX: number;
|
|
61
|
+
/**
|
|
62
|
+
* M32 L (L2): a content list's `fields` value as its distinct ids, in the order first named, or null when it is not
|
|
63
|
+
* one. Split on a literal comma (never a pattern), each entry trimmed and a blank entry dropped; every id is a field
|
|
64
|
+
* id's form (isContentListFieldId) or the page's name key `_name`; at least one id and at most
|
|
65
|
+
* PUBLIC_LIST_FIELDS_MAX distinct ones.
|
|
66
|
+
*/
|
|
67
|
+
export declare function parsePublicListFields(raw: string): string[] | null;
|
|
50
68
|
export declare const PublicContentListQuerySchema: z.ZodObject<{
|
|
51
69
|
cursor: z.ZodOptional<z.ZodString>;
|
|
52
70
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
71
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
72
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
53
73
|
}, z.core.$strip>;
|
|
54
74
|
export type PublicContentListQuery = z.infer<typeof PublicContentListQuerySchema>;
|
|
55
75
|
export declare const PublicContentNodeSummarySchema: z.ZodObject<{
|
|
@@ -61,6 +81,7 @@ export declare const PublicContentNodeSummarySchema: z.ZodObject<{
|
|
|
61
81
|
documentTypeId: z.ZodString;
|
|
62
82
|
publishedAt: z.ZodString;
|
|
63
83
|
url: z.ZodNullable<z.ZodString>;
|
|
84
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
64
85
|
}, z.core.$strip>;
|
|
65
86
|
export type PublicContentNodeSummary = z.infer<typeof PublicContentNodeSummarySchema>;
|
|
66
87
|
export declare const PublicContentListResponseSchema: z.ZodObject<{
|
|
@@ -73,6 +94,7 @@ export declare const PublicContentListResponseSchema: z.ZodObject<{
|
|
|
73
94
|
documentTypeId: z.ZodString;
|
|
74
95
|
publishedAt: z.ZodString;
|
|
75
96
|
url: z.ZodNullable<z.ZodString>;
|
|
97
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
76
98
|
}, z.core.$strip>>;
|
|
77
99
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
78
100
|
}, z.core.$strip>;
|
|
@@ -89,6 +111,7 @@ export type PublicSite = z.infer<typeof PublicSiteSchema>;
|
|
|
89
111
|
export declare const PublicSitesQuerySchema: z.ZodObject<{
|
|
90
112
|
cursor: z.ZodOptional<z.ZodString>;
|
|
91
113
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
114
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
92
115
|
}, z.core.$strip>;
|
|
93
116
|
export type PublicSitesQuery = z.infer<typeof PublicSitesQuerySchema>;
|
|
94
117
|
export declare const PublicSitesResponseSchema: z.ZodObject<{
|
|
@@ -103,12 +126,30 @@ export declare const PublicSitesResponseSchema: z.ZodObject<{
|
|
|
103
126
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
104
127
|
}, z.core.$strip>;
|
|
105
128
|
export type PublicSitesResponse = z.infer<typeof PublicSitesResponseSchema>;
|
|
129
|
+
export { isProviderSearchCursor };
|
|
130
|
+
export declare const PublicContentSearchResponseSchema: z.ZodObject<{
|
|
131
|
+
items: z.ZodArray<z.ZodObject<{
|
|
132
|
+
id: z.ZodString;
|
|
133
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
134
|
+
path: z.ZodString;
|
|
135
|
+
depth: z.ZodNumber;
|
|
136
|
+
sortOrder: z.ZodNumber;
|
|
137
|
+
documentTypeId: z.ZodString;
|
|
138
|
+
publishedAt: z.ZodString;
|
|
139
|
+
url: z.ZodNullable<z.ZodString>;
|
|
140
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
141
|
+
}, z.core.$strip>>;
|
|
142
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
export type PublicContentSearchResponse = z.infer<typeof PublicContentSearchResponseSchema>;
|
|
106
145
|
export declare const PublicContentSearchQuerySchema: z.ZodObject<{
|
|
107
146
|
documentTypeId: z.ZodOptional<z.ZodString>;
|
|
108
147
|
under: z.ZodOptional<z.ZodString>;
|
|
109
148
|
q: z.ZodOptional<z.ZodString>;
|
|
110
149
|
cursor: z.ZodOptional<z.ZodString>;
|
|
111
150
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
151
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
152
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
112
153
|
}, z.core.$strip>;
|
|
113
154
|
export type PublicContentSearchQuery = z.infer<typeof PublicContentSearchQuerySchema>;
|
|
114
155
|
export declare const PublicMediaFileSchema: z.ZodObject<{
|
|
@@ -2,6 +2,10 @@ import { z } from "zod";
|
|
|
2
2
|
import { ReadOnlyFieldSchema } from "./plugin-read-only.schema.js";
|
|
3
3
|
import { CultureSchema } from "./content-api.schema.js";
|
|
4
4
|
import { MediaVisibilitySchema } from "./media.schema.js";
|
|
5
|
+
import { PROVIDER_SEARCH_CURSOR_MAX, isProviderSearchCursor } from "./plugin-providers.js";
|
|
6
|
+
import { UuidStringSchema } from "./uuid.schema.js";
|
|
7
|
+
import { CONTENT_LIST_FIELD_ID_MAX, isContentListFieldId } from "./content-list.schema.js";
|
|
8
|
+
import { CONTENT_NAME_KEY } from "./content-path.js";
|
|
5
9
|
// Session 112: serializer-contribution output. Keyed by pluginId:
|
|
6
10
|
// structurally separate from core fields and `data`, so a contribution
|
|
7
11
|
// can never remove or overwrite either. Present only when at least one
|
|
@@ -31,7 +35,15 @@ export const PublicContentItemSchema = z.object({
|
|
|
31
35
|
// made from the domain the request named.
|
|
32
36
|
url: z.string().nullable(),
|
|
33
37
|
});
|
|
34
|
-
|
|
38
|
+
/**
|
|
39
|
+
* M32 L (access-2): the longest language tag a delivery read takes in `locale`. A language tag is far shorter; the
|
|
40
|
+
* cap keeps a list from writing an over-long tag into every row's `url`. CultureSchema itself carries no cap, since
|
|
41
|
+
* the management API reads it too.
|
|
42
|
+
*/
|
|
43
|
+
export const CULTURE_TAG_MAX = 64;
|
|
44
|
+
/** M32 L (access-2): `locale` on every content read of the delivery API: a language tag, at most CULTURE_TAG_MAX characters. */
|
|
45
|
+
const PublicCultureSchema = CultureSchema.max(CULTURE_TAG_MAX, `A language tag is at most ${CULTURE_TAG_MAX} characters.`);
|
|
46
|
+
// `locale` mirrors the backoffice contract (content-api.schema), capped at CULTURE_TAG_MAX.
|
|
35
47
|
// `previewToken` (Session 116) is a stateless signed token minted by
|
|
36
48
|
// POST /api/manage/v1/content/:id/preview-token; verified once per request against
|
|
37
49
|
// the FINAL resolved (post-locale) node id (see published-item.ts).
|
|
@@ -39,7 +51,7 @@ export const PublicContentItemQuerySchema = z.object({
|
|
|
39
51
|
// S230: validated as a language tag, identically to the backoffice
|
|
40
52
|
// route. It used to be any string of two or more characters, so a
|
|
41
53
|
// malformed locale reached the data layer instead of being refused.
|
|
42
|
-
locale:
|
|
54
|
+
locale: PublicCultureSchema.optional(),
|
|
43
55
|
format: z.string().regex(/^[a-z0-9.-]+:[a-z0-9-]+$/).optional(),
|
|
44
56
|
previewToken: z.string().optional(),
|
|
45
57
|
});
|
|
@@ -77,13 +89,55 @@ export const PublicContentByAddressQuerySchema = z.object({
|
|
|
77
89
|
// address asked is not the page's one address (a visitor would be sent on
|
|
78
90
|
// to it); `url` is that one address either way.
|
|
79
91
|
export const PublicContentByAddressResponseSchema = PublicContentItemSchema.extend({ redirected: z.boolean() });
|
|
92
|
+
/** M32 L (L2): how many distinct field ids one content list request may name in `fields`. */
|
|
93
|
+
export const PUBLIC_LIST_FIELDS_MAX = 20;
|
|
94
|
+
/** M32 L (L2): the longest `fields` value read: every id at its longest, each with a comma and a space. */
|
|
95
|
+
export const PUBLIC_LIST_FIELDS_TEXT_MAX = PUBLIC_LIST_FIELDS_MAX * (CONTENT_LIST_FIELD_ID_MAX + 2);
|
|
96
|
+
/**
|
|
97
|
+
* M32 L (L2): a content list's `fields` value as its distinct ids, in the order first named, or null when it is not
|
|
98
|
+
* one. Split on a literal comma (never a pattern), each entry trimmed and a blank entry dropped; every id is a field
|
|
99
|
+
* id's form (isContentListFieldId) or the page's name key `_name`; at least one id and at most
|
|
100
|
+
* PUBLIC_LIST_FIELDS_MAX distinct ones.
|
|
101
|
+
*/
|
|
102
|
+
export function parsePublicListFields(raw) {
|
|
103
|
+
if (raw.length > PUBLIC_LIST_FIELDS_TEXT_MAX)
|
|
104
|
+
return null;
|
|
105
|
+
const ids = [];
|
|
106
|
+
for (const entry of raw.split(",")) {
|
|
107
|
+
const id = entry.trim();
|
|
108
|
+
if (id === "")
|
|
109
|
+
continue;
|
|
110
|
+
if (id !== CONTENT_NAME_KEY && !isContentListFieldId(id))
|
|
111
|
+
return null;
|
|
112
|
+
if (ids.includes(id))
|
|
113
|
+
continue;
|
|
114
|
+
ids.push(id);
|
|
115
|
+
if (ids.length > PUBLIC_LIST_FIELDS_MAX)
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return ids.length === 0 ? null : ids;
|
|
119
|
+
}
|
|
120
|
+
const PUBLIC_LIST_FIELDS_MESSAGE = `Name 1 to ${PUBLIC_LIST_FIELDS_MAX} field ids separated by commas: each a field id (letters, digits and _, starting with a letter, at most ${CONTENT_LIST_FIELD_ID_MAX} characters) or _name; the whole value at most ${PUBLIC_LIST_FIELDS_TEXT_MAX} characters.`;
|
|
121
|
+
// M32 L (L2): a string, so the query string's one value; refined by the reader above, so a route's handler can
|
|
122
|
+
// call parsePublicListFields on a value the schema let through and never get null.
|
|
123
|
+
const PublicListFieldsSchema = z
|
|
124
|
+
.string()
|
|
125
|
+
.max(PUBLIC_LIST_FIELDS_TEXT_MAX, { message: PUBLIC_LIST_FIELDS_MESSAGE, abort: true })
|
|
126
|
+
.refine((value) => parsePublicListFields(value) !== null, { message: PUBLIC_LIST_FIELDS_MESSAGE })
|
|
127
|
+
.describe(`Field ids whose values each row then carries in \`fields\`, separated by commas: a document type field's id of at most ${CONTENT_LIST_FIELD_ID_MAX} characters, or \`_name\` for the page's name; 1 to ${PUBLIC_LIST_FIELDS_MAX}. Each value is what GET /api/v1/content/:id serves for the page in the same language; an id the page has no value for is left out of its row.`);
|
|
128
|
+
// M32 L (L5): the item routes' own language tag, so locale reads alike on every content endpoint.
|
|
129
|
+
const PublicListLocaleSchema = PublicCultureSchema.describe("The language of each row's `fields` and `url`, as `locale` on GET /api/v1/content/:id: an untranslated field falls back to the default language. Without it, the default language.");
|
|
80
130
|
export const PublicContentListQuerySchema = z.object({
|
|
81
131
|
cursor: z.string().uuid().optional(),
|
|
82
132
|
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
133
|
+
// M32 L (L2, L5): both optional, so a list asked without them answers as before.
|
|
134
|
+
fields: PublicListFieldsSchema.optional(),
|
|
135
|
+
locale: PublicListLocaleSchema.optional(),
|
|
83
136
|
});
|
|
84
|
-
// The tree-walk row:
|
|
85
|
-
//
|
|
86
|
-
// publishedAt is non-nullable by construction
|
|
137
|
+
// The tree-walk row: what a consumer needs to render navigation; field
|
|
138
|
+
// values only when the list is asked for them with `fields` (M32 L), else
|
|
139
|
+
// fetch the full item by id. publishedAt is non-nullable by construction
|
|
140
|
+
// (published-only surface).
|
|
87
141
|
export const PublicContentNodeSummarySchema = z.object({
|
|
88
142
|
id: z.string().uuid(),
|
|
89
143
|
parentId: z.string().uuid().nullable(),
|
|
@@ -92,10 +146,15 @@ export const PublicContentNodeSummarySchema = z.object({
|
|
|
92
146
|
sortOrder: z.number().int(),
|
|
93
147
|
documentTypeId: z.string().uuid(),
|
|
94
148
|
publishedAt: z.string().datetime(),
|
|
95
|
-
// S277e: the page's one address in
|
|
149
|
+
// S277e: the page's one address, in `locale` when a content list was
|
|
150
|
+
// asked with one (M32 L, L5), else in the default language, as on
|
|
96
151
|
// PublicContentItemSchema. `path` stays the stored path, which is what
|
|
97
152
|
// by-path takes; `url` is what a link to the page is made from.
|
|
98
153
|
url: z.string().nullable(),
|
|
154
|
+
// M32 L (L3): only on a row of a list asked with `fields`: each asked id the page's served data holds, in the
|
|
155
|
+
// order asked. A list asked without `fields` has no such member. The example is what a row of
|
|
156
|
+
// `?fields=title` carries, so the generated reference shows a filled row rather than an empty map.
|
|
157
|
+
fields: z.record(z.string(), z.unknown()).meta({ example: { title: "About us" } }).optional(),
|
|
99
158
|
});
|
|
100
159
|
export const PublicContentListResponseSchema = z.object({
|
|
101
160
|
items: z.array(PublicContentNodeSummarySchema),
|
|
@@ -104,8 +163,11 @@ export const PublicContentListResponseSchema = z.object({
|
|
|
104
163
|
// S277e: GET /api/v1/sites. Every published top-level page is a site.
|
|
105
164
|
// `path` is its stored path, `hostnames` its domains in order (the first
|
|
106
165
|
// is its address), `isDefault` whether it is the site a visitor gets on
|
|
107
|
-
// the default address, and `url` its home address in the
|
|
108
|
-
// language, as `url` on a content result
|
|
166
|
+
// the default address, and `url` its home address in the `locale` asked
|
|
167
|
+
// (absent, the default language), as `url` on a content result: null when
|
|
168
|
+
// the site is served in neither (M32 L3). `name` is the `_name` an item read
|
|
169
|
+
// of the site in that language answers, so read from a published version
|
|
170
|
+
// only, never a draft's (L3 fix wave and its follow-up).
|
|
109
171
|
export const PublicSiteSchema = z.object({
|
|
110
172
|
id: z.string().uuid(),
|
|
111
173
|
path: z.string(),
|
|
@@ -114,13 +176,35 @@ export const PublicSiteSchema = z.object({
|
|
|
114
176
|
isDefault: z.boolean(),
|
|
115
177
|
url: z.string().nullable(),
|
|
116
178
|
});
|
|
117
|
-
// Paged as every public list is: the cursor is the id of the last row of
|
|
118
|
-
// the
|
|
119
|
-
|
|
179
|
+
// Paged as every public list is: the cursor is the id of the last row of the page before. Its own object since
|
|
180
|
+
// M32 L (L1): a site row already carries its name and address, so the sites list takes no `fields`. M32 L3: it
|
|
181
|
+
// takes `locale`, the language of each site's `url` and `name`, read as on every content list.
|
|
182
|
+
export const PublicSitesQuerySchema = z.object({
|
|
183
|
+
cursor: z.string().uuid().optional(),
|
|
184
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
185
|
+
locale: PublicCultureSchema.describe("The language of each site's `url` (its home in that language, the default language's when the site lacks it) and `name` (the name an item read of the site in that language answers: the default language's published one, else that language's own published one). Without it, the default language.").optional(),
|
|
186
|
+
});
|
|
120
187
|
export const PublicSitesResponseSchema = z.object({
|
|
121
188
|
items: z.array(PublicSiteSchema),
|
|
122
189
|
nextCursor: z.string().nullable(),
|
|
123
190
|
});
|
|
191
|
+
// M32 F4 (D23, D24): a search provider's cursor reaches the reader wrapped as
|
|
192
|
+
// `p.<pluginId>/<providerId>.<cursor>` (plugin-providers.ts holds the rule).
|
|
193
|
+
export { isProviderSearchCursor };
|
|
194
|
+
const SEARCH_CURSOR_MESSAGE = "A cursor is the nextCursor of the page before.";
|
|
195
|
+
// A search cursor is the id of the last row of the page before (the core search) or a wrapped
|
|
196
|
+
// provider cursor (D24: widened from a uuid, pre-v1, no shim).
|
|
197
|
+
const PublicSearchCursorSchema = z
|
|
198
|
+
.string()
|
|
199
|
+
.max(PROVIDER_SEARCH_CURSOR_MAX, { message: SEARCH_CURSOR_MESSAGE })
|
|
200
|
+
.refine((value) => isProviderSearchCursor(value) || UuidStringSchema.safeParse(value).success, { message: SEARCH_CURSOR_MESSAGE })
|
|
201
|
+
.meta({ example: "f47ac10b-58cc-4372-a567-0e02b2c3d479" });
|
|
202
|
+
// GET /api/v1/content's page: its nextCursor is the core search's last id or a wrapped provider
|
|
203
|
+
// cursor (D23), so it is the search cursor's shape rather than a uuid.
|
|
204
|
+
export const PublicContentSearchResponseSchema = z.object({
|
|
205
|
+
items: z.array(PublicContentNodeSummarySchema),
|
|
206
|
+
nextCursor: PublicSearchCursorSchema.nullable(),
|
|
207
|
+
});
|
|
124
208
|
// GET /api/v1/content: combinable filters over the published surface.
|
|
125
209
|
// `under` is a published node's id; the server resolves it to a subtree
|
|
126
210
|
// path filter (strict descendants). q is a case-insensitive substring
|
|
@@ -129,8 +213,12 @@ export const PublicContentSearchQuerySchema = z.object({
|
|
|
129
213
|
documentTypeId: z.string().uuid().optional(),
|
|
130
214
|
under: z.string().uuid().optional(),
|
|
131
215
|
q: z.string().min(2).optional(),
|
|
132
|
-
cursor:
|
|
216
|
+
cursor: PublicSearchCursorSchema.optional(),
|
|
133
217
|
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
218
|
+
// M32 L (L2, L5): as on the other content lists; `locale` chooses the language of `fields` and `url` and does
|
|
219
|
+
// not change what `q` matches.
|
|
220
|
+
fields: PublicListFieldsSchema.optional(),
|
|
221
|
+
locale: PublicListLocaleSchema.optional(),
|
|
134
222
|
});
|
|
135
223
|
// Public media (Month 9, Session 105). downloadUrl is the stable app path
|
|
136
224
|
// (S186c §3) made ABSOLUTE (S186c Task 3, mandate 1: this surface is
|