@kardalum/plugin-sdk 0.18.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 +253 -0
- package/README.md +20 -1
- package/dist/admin-section-registry.d.ts +16 -1
- package/dist/admin-section-registry.js +23 -0
- package/dist/assets/asset-picker.js +3 -3
- package/dist/built-in-editor-ids.d.ts +1 -1
- package/dist/built-in-editor-ids.js +2 -20
- package/dist/built-in-serializers.js +1 -1
- package/dist/built-in-settings-schemas.d.ts +10 -0
- package/dist/built-in-settings-schemas.js +90 -4
- package/dist/built-in-value-schemas.js +35 -0
- package/dist/built-ins.js +48 -17
- 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 +9 -3
- package/dist/datatype-validation.d.ts +6 -11
- package/dist/datatype-validation.js +141 -3
- package/dist/define-plugin.d.ts +4 -4
- package/dist/define-plugin.js +5 -5
- 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 +38 -4
- package/dist/index.js +54 -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 +292 -24
- package/dist/manifest.d.ts +450 -51
- package/dist/manifest.js +1 -1
- package/dist/media/media-picker.js +33 -20
- 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-context.js +3 -3
- 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/register-built-ins.js +6 -6
- package/dist/registry.js +1 -1
- package/dist/richtext/block-panel.js +12 -7
- package/dist/richtext/extensions.js +7 -7
- package/dist/richtext/insert-menu.js +12 -9
- package/dist/richtext/style-listbox.js +7 -5
- package/dist/richtext/text-style-class.js +1 -1
- 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 +27 -27
- package/dist/structured-storage-types.d.ts +309 -9
- package/dist/structured-storage-types.js +2 -2
- 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/ui-entry.js +3 -3
- package/dist/views/asset-view.js +6 -3
- 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 +9 -6
- 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-code-editor.js +2 -2
- package/dist/views/html-view.js +12 -11
- package/dist/views/image-view.js +40 -22
- 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 +32 -16
- 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-error.schema.js +1 -1
- 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/asset-api.schema.js +1 -1
- 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/auth.schema.js +1 -1
- 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 +116 -3
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +71 -18
- 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-trash-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +1 -1
- 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 +9 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +4 -4
- 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 +267 -12
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +54 -8
- 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 +98 -13
- 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 +122 -43
- package/node_modules/@kardalum/api-schemas/dist/index.js +92 -27
- 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/listing-categories.schema.d.ts +46 -0
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.js +52 -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 +359 -8
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +85 -11
- 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 +22 -10
- 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 +9 -5
- 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-text.js +1 -0
- 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 +357 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +279 -0
- 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-registry-api.schema.js +1 -1
- 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 +50 -7
- 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/render-editing.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +1 -1
- 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 +289 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +205 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +121 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +51 -10
- 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/snapshot.schema.js +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-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +1 -1
- 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 +35 -4
- 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.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +8 -2
- 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/tailwind-theme.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/themes/light.js +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +15 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +4 -4
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +17 -8
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +8 -3
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/types.js +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 +27 -5
- 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/envelope.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/envelope.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +3 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +9 -9
- package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/hash.js +1 -1
- 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/plugin-package/dist/package-contract.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/package-contract.js +5 -5
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +8 -3
- package/node_modules/@kardalum/ui/dist/components/badge.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +49 -4
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +18 -5
- package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +4 -4
- package/node_modules/@kardalum/ui/dist/components/input.js +6 -1
- package/node_modules/@kardalum/ui/dist/components/property-field.js +3 -3
- package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/sheet.js +12 -7
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
- package/node_modules/@kardalum/ui/dist/components/toast.js +4 -3
- package/node_modules/@kardalum/ui/dist/components/tooltip.d.ts +27 -0
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +81 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +16 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +95 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.js +2 -2
- package/node_modules/@kardalum/ui/dist/index.d.ts +3 -1
- package/node_modules/@kardalum/ui/dist/index.js +3 -1
- package/node_modules/@kardalum/ui/dist/lib/menu-host.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/lib/menu-host.js +17 -0
- package/node_modules/@kardalum/ui/package.json +8 -6
- package/package.json +18 -7
|
@@ -16,9 +16,9 @@ export declare const ContentListColumnSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
16
16
|
url: "url";
|
|
17
17
|
id: "id";
|
|
18
18
|
name: "name";
|
|
19
|
+
updatedAt: "updatedAt";
|
|
19
20
|
publishedAt: "publishedAt";
|
|
20
21
|
status: "status";
|
|
21
|
-
updatedAt: "updatedAt";
|
|
22
22
|
}>;
|
|
23
23
|
}, z.core.$strict>, z.ZodObject<{
|
|
24
24
|
kind: z.ZodLiteral<"field">;
|
|
@@ -33,9 +33,9 @@ export declare const ContentListSettingsSchema: z.ZodObject<{
|
|
|
33
33
|
url: "url";
|
|
34
34
|
id: "id";
|
|
35
35
|
name: "name";
|
|
36
|
+
updatedAt: "updatedAt";
|
|
36
37
|
publishedAt: "publishedAt";
|
|
37
38
|
status: "status";
|
|
38
|
-
updatedAt: "updatedAt";
|
|
39
39
|
}>;
|
|
40
40
|
}, z.core.$strict>, z.ZodObject<{
|
|
41
41
|
kind: z.ZodLiteral<"field">;
|
|
@@ -156,3 +156,58 @@ export declare const ContentListResponseSchema: z.ZodObject<{
|
|
|
156
156
|
}, z.core.$strip>;
|
|
157
157
|
export type ContentListResponse = z.infer<typeof ContentListResponseSchema>;
|
|
158
158
|
export declare const CONTENT_LIST_DATA_TYPE_CONFIG: DataTypeConfig;
|
|
159
|
+
export declare const CONTENT_LIST_LIMIT_MAX = 50;
|
|
160
|
+
export declare const CONTENT_LIST_LIMIT_DEFAULT = 10;
|
|
161
|
+
export declare const CONTENT_LIST_SORT_MAX = 80;
|
|
162
|
+
/** A text sort compares the first 100 characters (code points) of the value. */
|
|
163
|
+
export declare const CONTENT_LIST_SORT_VALUE_MAX = 100;
|
|
164
|
+
export declare const CONTENT_LIST_MARKER_MAX = 1024;
|
|
165
|
+
/** A field sort runs only when its scope holds at most this many published pages (D7). */
|
|
166
|
+
export declare const CONTENT_LIST_FIELD_SORT_MAX = 5000;
|
|
167
|
+
export declare const CONTENT_LIST_FIELD_ID_MAX = 64;
|
|
168
|
+
export declare const TEMPLATE_SEARCH_TEXT_MAX = 200;
|
|
169
|
+
export declare const TEMPLATE_SEARCH_CURSOR_MAX = 512;
|
|
170
|
+
export declare const TEMPLATE_SEARCH_LIMIT_MAX = 20;
|
|
171
|
+
export declare const TEMPLATE_SEARCH_LIMIT_DEFAULT = 10;
|
|
172
|
+
export declare const TEMPLATE_SEARCHES_MAX = 2;
|
|
173
|
+
/** The longest document type name `{% list %}` and `{% search %}` read as `type:`. */
|
|
174
|
+
export declare const TEMPLATE_TYPE_NAME_MAX = 200;
|
|
175
|
+
export declare const ContentListArgsSchema: z.ZodObject<{
|
|
176
|
+
type: z.ZodOptional<z.ZodString>;
|
|
177
|
+
parent: z.ZodOptional<z.ZodUnknown>;
|
|
178
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
179
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
180
|
+
paged: z.ZodOptional<z.ZodBoolean>;
|
|
181
|
+
}, z.core.$strict>;
|
|
182
|
+
export type ContentListArgs = z.infer<typeof ContentListArgsSchema>;
|
|
183
|
+
export type ContentListDirection = "asc" | "desc";
|
|
184
|
+
export type ContentListSortKey = {
|
|
185
|
+
kind: "published";
|
|
186
|
+
} | {
|
|
187
|
+
kind: "order";
|
|
188
|
+
} | {
|
|
189
|
+
kind: "field";
|
|
190
|
+
field: string;
|
|
191
|
+
};
|
|
192
|
+
export interface ContentListSort {
|
|
193
|
+
key: ContentListSortKey;
|
|
194
|
+
direction: ContentListDirection;
|
|
195
|
+
/** "<key> <direction>": what a marker names, so a marker for another sort is ignored. */
|
|
196
|
+
canonical: string;
|
|
197
|
+
}
|
|
198
|
+
/** A field id's form (letters, digits, underscore, a letter first), at most 64 characters. */
|
|
199
|
+
export declare function isContentListFieldId(value: string): boolean;
|
|
200
|
+
/** D5: "<key>" or "<key> asc|desc". Null when it is anything else. */
|
|
201
|
+
export declare function parseContentListSort(raw: string | undefined): ContentListSort | null;
|
|
202
|
+
export type ContentListCursorValue = string | number | null;
|
|
203
|
+
export interface ContentListCursor {
|
|
204
|
+
sort: string;
|
|
205
|
+
value: ContentListCursorValue;
|
|
206
|
+
id: string;
|
|
207
|
+
}
|
|
208
|
+
/** D11: a non-empty string of at most 1024 base64url characters. One linear scan. */
|
|
209
|
+
export declare function isContentListMarker(raw: unknown): raw is string;
|
|
210
|
+
/** base64url of the UTF-8 JSON `[sort, value, id]`, without padding. */
|
|
211
|
+
export declare function encodeContentListCursor(cursor: ContentListCursor): string;
|
|
212
|
+
/** The marker's tuple, or null for anything that is not one this code minted the shape of. */
|
|
213
|
+
export declare function decodeContentListCursor(raw: unknown): ContentListCursor | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { THUMBNAIL_EDITOR_ID } from "./media-rendition.schema.js";
|
|
3
3
|
import { NodeAccessFlagsSchema } from "./node-access.schema.js";
|
|
4
|
+
import { UuidStringSchema } from "./uuid.schema.js";
|
|
4
5
|
// S232: past this many children, the tree stops rendering them as
|
|
5
6
|
// expandable rows and shows a hint to mark the type as a collection
|
|
6
7
|
// instead (see contentTree.collectionHint in the admin). Shared between
|
|
@@ -137,3 +138,139 @@ export const CONTENT_LIST_DATA_TYPE_CONFIG = {
|
|
|
137
138
|
editorId: CONTENT_LIST_EDITOR_ID,
|
|
138
139
|
settings: CONTENT_LIST_DEFAULT_SETTINGS,
|
|
139
140
|
};
|
|
141
|
+
// M32 E: the template list helper's shapes. The arguments come from a template, the marker
|
|
142
|
+
// from a visitor's query string; both are read here with length caps and linear scans, never
|
|
143
|
+
// with a pattern.
|
|
144
|
+
export const CONTENT_LIST_LIMIT_MAX = 50;
|
|
145
|
+
export const CONTENT_LIST_LIMIT_DEFAULT = 10;
|
|
146
|
+
export const CONTENT_LIST_SORT_MAX = 80;
|
|
147
|
+
/** A text sort compares the first 100 characters (code points) of the value. */
|
|
148
|
+
export const CONTENT_LIST_SORT_VALUE_MAX = 100;
|
|
149
|
+
export const CONTENT_LIST_MARKER_MAX = 1024;
|
|
150
|
+
/** A field sort runs only when its scope holds at most this many published pages (D7). */
|
|
151
|
+
export const CONTENT_LIST_FIELD_SORT_MAX = 5000;
|
|
152
|
+
export const CONTENT_LIST_FIELD_ID_MAX = 64;
|
|
153
|
+
// M32 F4e (E4): template site search. The text and the cursor come from a visitor's query string
|
|
154
|
+
// (`?q=`, `?search_after=`), read once each within these caps; the rest bound a render's searches.
|
|
155
|
+
export const TEMPLATE_SEARCH_TEXT_MAX = 200;
|
|
156
|
+
export const TEMPLATE_SEARCH_CURSOR_MAX = 512;
|
|
157
|
+
export const TEMPLATE_SEARCH_LIMIT_MAX = 20;
|
|
158
|
+
export const TEMPLATE_SEARCH_LIMIT_DEFAULT = 10;
|
|
159
|
+
export const TEMPLATE_SEARCHES_MAX = 2;
|
|
160
|
+
/** The longest document type name `{% list %}` and `{% search %}` read as `type:`. */
|
|
161
|
+
export const TEMPLATE_TYPE_NAME_MAX = 200;
|
|
162
|
+
export const ContentListArgsSchema = z
|
|
163
|
+
.object({
|
|
164
|
+
type: z.string().trim().min(1).max(TEMPLATE_TYPE_NAME_MAX).optional(),
|
|
165
|
+
parent: z.unknown().optional(),
|
|
166
|
+
sort: z.string().max(CONTENT_LIST_SORT_MAX).optional(),
|
|
167
|
+
limit: z.number().int().min(1).max(CONTENT_LIST_LIMIT_MAX).optional(),
|
|
168
|
+
paged: z.boolean().optional(),
|
|
169
|
+
})
|
|
170
|
+
.strict();
|
|
171
|
+
/** A field id's form (letters, digits, underscore, a letter first), at most 64 characters. */
|
|
172
|
+
export function isContentListFieldId(value) {
|
|
173
|
+
if (value.length === 0 || value.length > CONTENT_LIST_FIELD_ID_MAX)
|
|
174
|
+
return false;
|
|
175
|
+
for (let i = 0; i < value.length; i++) {
|
|
176
|
+
const c = value.charCodeAt(i);
|
|
177
|
+
const letter = (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
|
|
178
|
+
const digit = c >= 48 && c <= 57;
|
|
179
|
+
if (i === 0 ? !letter : !(letter || digit || c === 95))
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
/** D5: "<key>" or "<key> asc|desc". Null when it is anything else. */
|
|
185
|
+
export function parseContentListSort(raw) {
|
|
186
|
+
const text = (raw ?? "").trim();
|
|
187
|
+
if (text.length > CONTENT_LIST_SORT_MAX)
|
|
188
|
+
return null;
|
|
189
|
+
if (text === "")
|
|
190
|
+
return { key: { kind: "published" }, direction: "desc", canonical: "published desc" };
|
|
191
|
+
const space = text.indexOf(" ");
|
|
192
|
+
const word = space === -1 ? text : text.slice(0, space);
|
|
193
|
+
const rest = space === -1 ? "" : text.slice(space + 1).trim();
|
|
194
|
+
if (rest !== "" && rest !== "asc" && rest !== "desc")
|
|
195
|
+
return null;
|
|
196
|
+
let key;
|
|
197
|
+
if (word === "published")
|
|
198
|
+
key = { kind: "published" };
|
|
199
|
+
else if (word === "order")
|
|
200
|
+
key = { kind: "order" };
|
|
201
|
+
else if (isContentListFieldId(word))
|
|
202
|
+
key = { kind: "field", field: word };
|
|
203
|
+
else
|
|
204
|
+
return null;
|
|
205
|
+
const direction = rest === "" ? (key.kind === "published" ? "desc" : "asc") : rest;
|
|
206
|
+
return { key, direction, canonical: `${word} ${direction}` };
|
|
207
|
+
}
|
|
208
|
+
// A value of 100 code points is up to 200 UTF-16 units.
|
|
209
|
+
const CursorTupleSchema = z.tuple([
|
|
210
|
+
z.string().min(1).max(CONTENT_LIST_SORT_MAX),
|
|
211
|
+
z.union([z.string().max(CONTENT_LIST_SORT_VALUE_MAX * 2), z.number().finite(), z.null()]),
|
|
212
|
+
UuidStringSchema,
|
|
213
|
+
]);
|
|
214
|
+
/** D11: a non-empty string of at most 1024 base64url characters. One linear scan. */
|
|
215
|
+
export function isContentListMarker(raw) {
|
|
216
|
+
if (typeof raw !== "string" || raw.length === 0 || raw.length > CONTENT_LIST_MARKER_MAX)
|
|
217
|
+
return false;
|
|
218
|
+
for (let i = 0; i < raw.length; i++) {
|
|
219
|
+
const c = raw.charCodeAt(i);
|
|
220
|
+
const ok = (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c === 45 || c === 95;
|
|
221
|
+
if (!ok)
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
/** base64url of the UTF-8 JSON `[sort, value, id]`, without padding. */
|
|
227
|
+
export function encodeContentListCursor(cursor) {
|
|
228
|
+
const bytes = new TextEncoder().encode(JSON.stringify([cursor.sort, cursor.value, cursor.id]));
|
|
229
|
+
let binary = "";
|
|
230
|
+
for (const byte of bytes)
|
|
231
|
+
binary += String.fromCharCode(byte);
|
|
232
|
+
const b64 = btoa(binary);
|
|
233
|
+
let out = "";
|
|
234
|
+
for (let i = 0; i < b64.length; i++) {
|
|
235
|
+
const ch = b64[i];
|
|
236
|
+
if (ch === "=")
|
|
237
|
+
break;
|
|
238
|
+
out += ch === "+" ? "-" : ch === "/" ? "_" : ch;
|
|
239
|
+
}
|
|
240
|
+
return out;
|
|
241
|
+
}
|
|
242
|
+
/** The marker's tuple, or null for anything that is not one this code minted the shape of. */
|
|
243
|
+
export function decodeContentListCursor(raw) {
|
|
244
|
+
if (!isContentListMarker(raw))
|
|
245
|
+
return null;
|
|
246
|
+
let b64 = "";
|
|
247
|
+
for (let i = 0; i < raw.length; i++) {
|
|
248
|
+
const ch = raw[i];
|
|
249
|
+
b64 += ch === "-" ? "+" : ch === "_" ? "/" : ch;
|
|
250
|
+
}
|
|
251
|
+
while (b64.length % 4 !== 0)
|
|
252
|
+
b64 += "=";
|
|
253
|
+
let text;
|
|
254
|
+
try {
|
|
255
|
+
const binary = atob(b64);
|
|
256
|
+
const bytes = new Uint8Array(binary.length);
|
|
257
|
+
for (let i = 0; i < binary.length; i++)
|
|
258
|
+
bytes[i] = binary.charCodeAt(i);
|
|
259
|
+
text = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
let parsed;
|
|
265
|
+
try {
|
|
266
|
+
parsed = JSON.parse(text);
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
const result = CursorTupleSchema.safeParse(parsed);
|
|
272
|
+
if (!result.success)
|
|
273
|
+
return null;
|
|
274
|
+
const [sort, value, id] = result.data;
|
|
275
|
+
return { sort, value, id: id.toLowerCase() };
|
|
276
|
+
}
|
|
@@ -27,7 +27,7 @@ export declare const CONTENT_NAME_KEY = "_name";
|
|
|
27
27
|
* had no usable URL at all, and an Arabic-speaking editor had to invent a
|
|
28
28
|
* Latin name for every page they created. Unicode in a URL is a standard
|
|
29
29
|
* (RFC 3987), browsers display it natively and percent-encode it on the
|
|
30
|
-
* wire, and
|
|
30
|
+
* wire, and other systems have done this for years.
|
|
31
31
|
*
|
|
32
32
|
* So letters and digits of ANY script survive, and only what genuinely
|
|
33
33
|
* cannot sit in a path segment is replaced. `""` now comes back only for
|
|
@@ -47,7 +47,7 @@ const MAX_SLUG_LENGTH = 200;
|
|
|
47
47
|
* had no usable URL at all, and an Arabic-speaking editor had to invent a
|
|
48
48
|
* Latin name for every page they created. Unicode in a URL is a standard
|
|
49
49
|
* (RFC 3987), browsers display it natively and percent-encode it on the
|
|
50
|
-
* wire, and
|
|
50
|
+
* wire, and other systems have done this for years.
|
|
51
51
|
*
|
|
52
52
|
* So letters and digits of ANY script survive, and only what genuinely
|
|
53
53
|
* cannot sit in a path segment is replaced. `""` now comes back only for
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CONTENT_SEARCH_PAGE_SIZE = 50;
|
|
3
|
+
export declare const CONTENT_SEARCH_STATES: readonly ["draft", "published", "trashed"];
|
|
4
|
+
export declare const ContentSearchStateSchema: z.ZodEnum<{
|
|
5
|
+
published: "published";
|
|
6
|
+
draft: "draft";
|
|
7
|
+
trashed: "trashed";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ContentSearchQuerySchema: z.ZodObject<{
|
|
10
|
+
q: z.ZodOptional<z.ZodString>;
|
|
11
|
+
documentTypeId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
published: "published";
|
|
14
|
+
draft: "draft";
|
|
15
|
+
trashed: "trashed";
|
|
16
|
+
}>>;
|
|
17
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
19
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type ContentSearchQuery = z.infer<typeof ContentSearchQuerySchema>;
|
|
22
|
+
export declare const ContentSearchRowSchema: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
path: z.ZodString;
|
|
26
|
+
documentTypeId: z.ZodString;
|
|
27
|
+
state: z.ZodEnum<{
|
|
28
|
+
published: "published";
|
|
29
|
+
draft: "draft";
|
|
30
|
+
trashed: "trashed";
|
|
31
|
+
}>;
|
|
32
|
+
changes: z.ZodBoolean;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type ContentSearchRow = z.infer<typeof ContentSearchRowSchema>;
|
|
35
|
+
export declare const ContentSearchResponseSchema: z.ZodObject<{
|
|
36
|
+
items: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
path: z.ZodString;
|
|
40
|
+
documentTypeId: z.ZodString;
|
|
41
|
+
state: z.ZodEnum<{
|
|
42
|
+
published: "published";
|
|
43
|
+
draft: "draft";
|
|
44
|
+
trashed: "trashed";
|
|
45
|
+
}>;
|
|
46
|
+
changes: z.ZodBoolean;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type ContentSearchResponse = z.infer<typeof ContentSearchResponseSchema>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isTrashCursor } from "./trash-cursor.schema.js";
|
|
3
|
+
// M31.5 A (D3): GET /api/manage/v1/content/search, pages by name or address across
|
|
4
|
+
// the tree, drafts included, for the find_pages tool. `q` is matched as a
|
|
5
|
+
// case-insensitive substring of the display name and of the last path segment;
|
|
6
|
+
// `parentId` keeps the pages anywhere under that page; `state` is the default
|
|
7
|
+
// language's (published when its pointer has a publishedAt), and `trashed` lists
|
|
8
|
+
// the tops of trashed branches, as the trash list does. The route scans a bounded
|
|
9
|
+
// number of nodes per request, so a page may hold fewer than `limit` rows while
|
|
10
|
+
// `nextCursor` is not null: pass it back to go on.
|
|
11
|
+
export const CONTENT_SEARCH_PAGE_SIZE = 50;
|
|
12
|
+
export const CONTENT_SEARCH_STATES = ["draft", "published", "trashed"];
|
|
13
|
+
export const ContentSearchStateSchema = z.enum(CONTENT_SEARCH_STATES);
|
|
14
|
+
export const ContentSearchQuerySchema = z.object({
|
|
15
|
+
q: z.string().max(200).optional(),
|
|
16
|
+
documentTypeId: z.string().uuid().optional(),
|
|
17
|
+
state: ContentSearchStateSchema.optional(),
|
|
18
|
+
parentId: z.string().uuid().optional(),
|
|
19
|
+
cursor: z.string().min(1).max(300).optional(),
|
|
20
|
+
limit: z.coerce.number().int().min(1).max(CONTENT_SEARCH_PAGE_SIZE).default(CONTENT_SEARCH_PAGE_SIZE),
|
|
21
|
+
}).superRefine((query, ctx) => {
|
|
22
|
+
// A live search pages by node id; the trash list pages by `${deletedAt}|${id}`. A cursor of
|
|
23
|
+
// the wrong kind answers 400 here rather than reaching a keyset comparison (S314c2).
|
|
24
|
+
if (query.cursor === undefined)
|
|
25
|
+
return;
|
|
26
|
+
const valid = query.state === "trashed" ? isTrashCursor(query.cursor) : z.string().uuid().safeParse(query.cursor).success;
|
|
27
|
+
if (!valid)
|
|
28
|
+
ctx.addIssue({ code: "custom", path: ["cursor"], message: query.state === "trashed" ? "cursor must be a nextCursor the trashed search answered" : "cursor must be a nextCursor this search answered: a page id" });
|
|
29
|
+
});
|
|
30
|
+
export const ContentSearchRowSchema = z.object({
|
|
31
|
+
id: z.string().uuid(),
|
|
32
|
+
name: z.string(),
|
|
33
|
+
path: z.string(),
|
|
34
|
+
documentTypeId: z.string().uuid(),
|
|
35
|
+
state: ContentSearchStateSchema,
|
|
36
|
+
// A published page with a saved version newer than the one it serves.
|
|
37
|
+
changes: z.boolean(),
|
|
38
|
+
});
|
|
39
|
+
export const ContentSearchResponseSchema = z.object({
|
|
40
|
+
items: z.array(ContentSearchRowSchema),
|
|
41
|
+
nextCursor: z.string().nullable(),
|
|
42
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CONTENT_SUMMARIES_MAX = 50;
|
|
3
|
+
export declare const ContentSummariesQuerySchema: z.ZodObject<{
|
|
4
|
+
ids: z.ZodString;
|
|
5
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type ContentSummariesQuery = z.infer<typeof ContentSummariesQuerySchema>;
|
|
8
|
+
export declare const ContentSummarySchema: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
state: z.ZodEnum<{
|
|
11
|
+
live: "live";
|
|
12
|
+
trashed: "trashed";
|
|
13
|
+
missing: "missing";
|
|
14
|
+
}>;
|
|
15
|
+
published: z.ZodBoolean;
|
|
16
|
+
readable: z.ZodBoolean;
|
|
17
|
+
name: z.ZodNullable<z.ZodString>;
|
|
18
|
+
path: z.ZodNullable<z.ZodString>;
|
|
19
|
+
documentTypeId: z.ZodNullable<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type ContentSummary = z.infer<typeof ContentSummarySchema>;
|
|
22
|
+
export declare const ContentSummariesResponseSchema: z.ZodObject<{
|
|
23
|
+
items: z.ZodArray<z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
state: z.ZodEnum<{
|
|
26
|
+
live: "live";
|
|
27
|
+
trashed: "trashed";
|
|
28
|
+
missing: "missing";
|
|
29
|
+
}>;
|
|
30
|
+
published: z.ZodBoolean;
|
|
31
|
+
readable: z.ZodBoolean;
|
|
32
|
+
name: z.ZodNullable<z.ZodString>;
|
|
33
|
+
path: z.ZodNullable<z.ZodString>;
|
|
34
|
+
documentTypeId: z.ZodNullable<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type ContentSummariesResponse = z.infer<typeof ContentSummariesResponseSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// M32 C (D13): what the content editor reads to mark picked pages. One request per field, at most
|
|
3
|
+
// CONTENT_SUMMARIES_MAX ids, answered in the order asked.
|
|
4
|
+
export const CONTENT_SUMMARIES_MAX = 50;
|
|
5
|
+
export const ContentSummariesQuerySchema = z.object({
|
|
6
|
+
// Comma-separated uuids; split and checked by the route (a query string carries no array).
|
|
7
|
+
ids: z.string().min(1).max(CONTENT_SUMMARIES_MAX * 37),
|
|
8
|
+
locale: z.string().min(2).max(35).optional(),
|
|
9
|
+
});
|
|
10
|
+
export const ContentSummarySchema = z.object({
|
|
11
|
+
id: z.string().uuid(),
|
|
12
|
+
state: z.enum(["live", "trashed", "missing"]),
|
|
13
|
+
published: z.boolean(),
|
|
14
|
+
readable: z.boolean(),
|
|
15
|
+
name: z.string().nullable(),
|
|
16
|
+
path: z.string().nullable(),
|
|
17
|
+
documentTypeId: z.string().uuid().nullable(),
|
|
18
|
+
});
|
|
19
|
+
export const ContentSummariesResponseSchema = z.object({ items: z.array(ContentSummarySchema) });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
// S154 content trash. The DELETE is two-step like the structured-data
|
|
3
3
|
// uninstall gate: unconfirmed → 409 naming the blast radius (the count
|
|
4
|
-
// the confirm dialog renders), confirmed → trash. Trash is SOFT
|
|
5
|
-
// reversible via the restore route
|
|
4
|
+
// the confirm dialog renders), confirmed → trash. Trash is SOFT:
|
|
5
|
+
// reversible via the restore route, so this is a plain confirmation,
|
|
6
6
|
// not the snapshot-gate treatment.
|
|
7
7
|
//
|
|
8
8
|
// Fastify substitutes `null` for a genuinely absent body before handing it
|
|
9
|
-
// to the validator
|
|
9
|
+
// to the validator: a DELETE sent with no payload at all lands here as
|
|
10
10
|
// `null`, not `undefined`. `.nullish()` (not `.optional()`) is required so
|
|
11
11
|
// an absent body validates; `request.body?.confirm` in the route handler
|
|
12
12
|
// already tolerates both null and undefined.
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { TrashCursorSchema } from "./trash-cursor.schema.js";
|
|
3
3
|
import { NodeAccessFlagsSchema } from "./node-access.schema.js";
|
|
4
4
|
// S161: the trash browse surface. Separate from content-trash-api.schema.ts
|
|
5
|
-
// (S154's trash/restore confirmation bodies)
|
|
5
|
+
// (S154's trash/restore confirmation bodies); this file is the list route
|
|
6
6
|
// and the restore-blocked 409, added a session later.
|
|
7
7
|
export const ContentTrashListQuerySchema = z.object({
|
|
8
8
|
cursor: TrashCursorSchema.optional(),
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const UnpublishContentRequestSchema: z.ZodObject<{
|
|
3
|
+
culture: z.ZodOptional<z.ZodString>;
|
|
4
|
+
}, z.core.$strict>;
|
|
5
|
+
export type UnpublishContentRequest = z.infer<typeof UnpublishContentRequestSchema>;
|
|
6
|
+
export declare const UnpublishContentResponseSchema: z.ZodObject<{
|
|
7
|
+
node: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
10
|
+
path: z.ZodString;
|
|
11
|
+
depth: z.ZodNumber;
|
|
12
|
+
sortOrder: z.ZodNumber;
|
|
13
|
+
documentTypeId: z.ZodString;
|
|
14
|
+
publishedAt: z.ZodNullable<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
unpublished: z.ZodArray<z.ZodString>;
|
|
17
|
+
cultures: z.ZodArray<z.ZodObject<{
|
|
18
|
+
culture: z.ZodString;
|
|
19
|
+
currentVersion: z.ZodNumber;
|
|
20
|
+
publishedAt: z.ZodNullable<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type UnpublishContentResponse = z.infer<typeof UnpublishContentResponseSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { StoredCultureSchema } from "./content-api.schema.js";
|
|
3
|
+
import { ContentNodeSchema, NodeCultureSchema } from "./content.schema.js";
|
|
4
|
+
// M31.5 A (D4): POST /api/manage/v1/content/:id/unpublish. A culture takes that
|
|
5
|
+
// language off the site; none takes every published language off. The answer
|
|
6
|
+
// names the cultures that were published and are not now, and every pointer as
|
|
7
|
+
// it stands after: each keeps the version it served, with no publishedAt.
|
|
8
|
+
export const UnpublishContentRequestSchema = z.object({ culture: StoredCultureSchema.optional() }).strict();
|
|
9
|
+
export const UnpublishContentResponseSchema = z.object({
|
|
10
|
+
node: ContentNodeSchema,
|
|
11
|
+
unpublished: z.array(z.string()),
|
|
12
|
+
cultures: z.array(NodeCultureSchema),
|
|
13
|
+
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const NODE_BATCH_READ_MAX = 100;
|
|
3
|
+
export declare const PUBLISHED_VERSION_CULTURES_MAX = 2;
|
|
4
|
+
export declare const CULTURE_TAG_STORED_MAX = 35;
|
|
2
5
|
export declare const ContentNodeSchema: z.ZodObject<{
|
|
3
6
|
id: z.ZodString;
|
|
4
7
|
parentId: z.ZodNullable<z.ZodString>;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
// M32 I2 (A1): the most nodes one batch read by id answers.
|
|
3
|
+
export const NODE_BATCH_READ_MAX = 100;
|
|
4
|
+
// M32 L3: a published version read filtered by culture names at most two (a list page's asked and default
|
|
5
|
+
// language), so a page of NODE_BATCH_READ_MAX rows reads at most 200 versions in one query.
|
|
6
|
+
export const PUBLISHED_VERSION_CULTURES_MAX = 2;
|
|
7
|
+
// M32 L3: the longest language tag a page's language pointer stores, alike on every dialect. MySQL's
|
|
8
|
+
// content_node_cultures.culture is VARCHAR(35), the size RFC 5646 (section 4.4.1) asks every tag store to hold,
|
|
9
|
+
// so the adapters refuse a longer tag before any write and the site's language list refuses one too. A read
|
|
10
|
+
// filter takes up to CULTURE_TAG_MAX (64): a longer asked tag simply matches nothing stored.
|
|
11
|
+
export const CULTURE_TAG_STORED_MAX = 35;
|
|
2
12
|
export const ContentNodeSchema = z.object({
|
|
3
13
|
id: z.string().uuid(),
|
|
4
14
|
parentId: z.string().uuid().nullable(),
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CONTRACT_CANCEL_EMAIL_MAX = 254;
|
|
3
|
+
export declare const CONTRACT_CANCEL_REFERENCE_MAX = 64;
|
|
4
|
+
export declare const CONTRACT_CANCEL_REASON_MAX = 2000;
|
|
5
|
+
export declare const CANCELLATION_NOTE_MAX = 2000;
|
|
6
|
+
/** An invoice number as the invoices print it: "RE-", a 4-digit year, "-",
|
|
7
|
+
* then 1 to 8 digits. S367f (D12): the letters in either case, as a person
|
|
8
|
+
* types them; the match upper-cases (referenceForMatch). */
|
|
9
|
+
export declare function isInvoiceNumber(value: string): boolean;
|
|
10
|
+
/** A licence key's shape: the prefix and 40 lowercase hex characters. */
|
|
11
|
+
export declare function isLicenceKeyShape(value: string): boolean;
|
|
12
|
+
/** YYYY-MM-DD naming a real calendar day. */
|
|
13
|
+
export declare function isIsoDay(value: string): boolean;
|
|
14
|
+
export declare const ContractCancelInputSchema: z.ZodObject<{
|
|
15
|
+
email: z.ZodString;
|
|
16
|
+
reference: z.ZodString;
|
|
17
|
+
kind: z.ZodEnum<{
|
|
18
|
+
ordinary: "ordinary";
|
|
19
|
+
extraordinary: "extraordinary";
|
|
20
|
+
}>;
|
|
21
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
22
|
+
when: z.ZodEnum<{
|
|
23
|
+
date: "date";
|
|
24
|
+
earliest: "earliest";
|
|
25
|
+
}>;
|
|
26
|
+
date: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
export type ContractCancelInput = z.infer<typeof ContractCancelInputSchema>;
|
|
29
|
+
export declare const CancellationHandleInputSchema: z.ZodObject<{
|
|
30
|
+
requestId: z.ZodString;
|
|
31
|
+
note: z.ZodString;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export type CancellationHandleInput = z.infer<typeof CancellationHandleInputSchema>;
|
|
34
|
+
/** S367c fix wave (I1): "Carry out" on a waiting request, with the note the
|
|
35
|
+
* person records. The same fields as "Mark handled"; kept apart so either
|
|
36
|
+
* can change without the other. */
|
|
37
|
+
export declare const CancellationCarryOutInputSchema: z.ZodObject<{
|
|
38
|
+
requestId: z.ZodString;
|
|
39
|
+
note: z.ZodString;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
export type CancellationCarryOutInput = z.infer<typeof CancellationCarryOutInputSchema>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isPayoutEmail } from "./marketplace-payouts.schema.js";
|
|
3
|
+
// S367c (§ 312k BGB): the no-login cancel form and the operator's "Mark
|
|
4
|
+
// handled". Every check over what a visitor types is a character loop with
|
|
5
|
+
// the length capped first, never a pattern.
|
|
6
|
+
export const CONTRACT_CANCEL_EMAIL_MAX = 254;
|
|
7
|
+
export const CONTRACT_CANCEL_REFERENCE_MAX = 64;
|
|
8
|
+
export const CONTRACT_CANCEL_REASON_MAX = 2000;
|
|
9
|
+
export const CANCELLATION_NOTE_MAX = 2000;
|
|
10
|
+
const isDigit = (c) => c >= 48 && c <= 57;
|
|
11
|
+
/** An invoice number as the invoices print it: "RE-", a 4-digit year, "-",
|
|
12
|
+
* then 1 to 8 digits. S367f (D12): the letters in either case, as a person
|
|
13
|
+
* types them; the match upper-cases (referenceForMatch). */
|
|
14
|
+
export function isInvoiceNumber(value) {
|
|
15
|
+
if (value.length < 9 || value.length > 16)
|
|
16
|
+
return false;
|
|
17
|
+
const r = value.charCodeAt(0);
|
|
18
|
+
const e = value.charCodeAt(1);
|
|
19
|
+
if (!(r === 82 || r === 114) || !(e === 69 || e === 101) || value.charCodeAt(2) !== 45)
|
|
20
|
+
return false;
|
|
21
|
+
for (let i = 3; i < 7; i++)
|
|
22
|
+
if (!isDigit(value.charCodeAt(i)))
|
|
23
|
+
return false;
|
|
24
|
+
if (value.charCodeAt(7) !== 45)
|
|
25
|
+
return false;
|
|
26
|
+
for (let i = 8; i < value.length; i++)
|
|
27
|
+
if (!isDigit(value.charCodeAt(i)))
|
|
28
|
+
return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
const KEY_PREFIX = "vlic_";
|
|
32
|
+
const KEY_HEX = 40;
|
|
33
|
+
/** A licence key's shape: the prefix and 40 lowercase hex characters. */
|
|
34
|
+
export function isLicenceKeyShape(value) {
|
|
35
|
+
if (value.length !== KEY_PREFIX.length + KEY_HEX || !value.startsWith(KEY_PREFIX))
|
|
36
|
+
return false;
|
|
37
|
+
for (let i = KEY_PREFIX.length; i < value.length; i++) {
|
|
38
|
+
const c = value.charCodeAt(i);
|
|
39
|
+
if (!(isDigit(c) || (c >= 97 && c <= 102)))
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
/** YYYY-MM-DD naming a real calendar day. */
|
|
45
|
+
export function isIsoDay(value) {
|
|
46
|
+
if (value.length !== 10 || value.charCodeAt(4) !== 45 || value.charCodeAt(7) !== 45)
|
|
47
|
+
return false;
|
|
48
|
+
for (const i of [0, 1, 2, 3, 5, 6, 8, 9])
|
|
49
|
+
if (!isDigit(value.charCodeAt(i)))
|
|
50
|
+
return false;
|
|
51
|
+
const y = Number(value.slice(0, 4));
|
|
52
|
+
const m = Number(value.slice(5, 7));
|
|
53
|
+
const d = Number(value.slice(8, 10));
|
|
54
|
+
if (m < 1 || m > 12 || d < 1)
|
|
55
|
+
return false;
|
|
56
|
+
return d <= new Date(Date.UTC(y, m, 0)).getUTCDate();
|
|
57
|
+
}
|
|
58
|
+
const today = () => new Date().toISOString().slice(0, 10);
|
|
59
|
+
export const ContractCancelInputSchema = z
|
|
60
|
+
.object({
|
|
61
|
+
email: z.string().trim().toLowerCase().max(CONTRACT_CANCEL_EMAIL_MAX).refine(isPayoutEmail, "Enter an email address"),
|
|
62
|
+
reference: z.string().trim().max(CONTRACT_CANCEL_REFERENCE_MAX).refine((v) => isInvoiceNumber(v) || isLicenceKeyShape(v), "Enter an invoice number or a licence key"),
|
|
63
|
+
kind: z.enum(["ordinary", "extraordinary"]),
|
|
64
|
+
reason: z.string().trim().max(CONTRACT_CANCEL_REASON_MAX).optional(),
|
|
65
|
+
when: z.enum(["earliest", "date"]),
|
|
66
|
+
date: z.string().trim().max(10).optional(),
|
|
67
|
+
})
|
|
68
|
+
.strict()
|
|
69
|
+
.superRefine((input, ctx) => {
|
|
70
|
+
if (input.kind === "extraordinary" && !input.reason)
|
|
71
|
+
ctx.addIssue({ code: "custom", path: ["reason"], message: "Give the reason" });
|
|
72
|
+
if (input.when === "date") {
|
|
73
|
+
// ISO days compare as strings once both are real days.
|
|
74
|
+
if (!input.date || !isIsoDay(input.date) || input.date < today())
|
|
75
|
+
ctx.addIssue({ code: "custom", path: ["date"], message: "Choose a day from today on" });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
export const CancellationHandleInputSchema = z
|
|
79
|
+
.object({ requestId: z.string().uuid(), note: z.string().trim().min(1).max(CANCELLATION_NOTE_MAX) })
|
|
80
|
+
.strict();
|
|
81
|
+
/** S367c fix wave (I1): "Carry out" on a waiting request, with the note the
|
|
82
|
+
* person records. The same fields as "Mark handled"; kept apart so either
|
|
83
|
+
* can change without the other. */
|
|
84
|
+
export const CancellationCarryOutInputSchema = z
|
|
85
|
+
.object({ requestId: z.string().uuid(), note: z.string().trim().min(1).max(CANCELLATION_NOTE_MAX) })
|
|
86
|
+
.strict();
|