@cosmicdrift/kumiko-samples 0.377.0 → 0.379.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/package.json +1 -1
- package/packages/bundled-features/package.json +18 -17
- package/packages/bundled-features/src/account-security/feature.ts +2 -2
- package/packages/bundled-features/src/account-security/index.ts +8 -8
- package/packages/bundled-features/src/account-security/{constants.ts → web/constants.ts} +0 -2
- package/packages/bundled-features/src/account-security/{i18n.ts → web/i18n.ts} +0 -1
- package/packages/bundled-features/src/admin-shell/feature.ts +10 -9
- package/packages/bundled-features/src/admin-shell/index.ts +8 -8
- package/packages/bundled-features/src/admin-shell/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/admin-shell/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/admin-shell/web/default-translations.ts +10 -0
- package/packages/bundled-features/src/admin-shell/web/i18n.ts +51 -9
- package/packages/bundled-features/src/admin-shell/web/index.ts +0 -1
- package/packages/bundled-features/src/audit/changes.json +7 -0
- package/packages/bundled-features/src/audit/feature.ts +72 -64
- package/packages/bundled-features/src/audit/handlers/audit-events.ts +153 -0
- package/packages/bundled-features/src/audit/handlers/audit-system-db.ts +13 -0
- package/packages/bundled-features/src/audit/handlers/details-all-tenants.query.ts +26 -0
- package/packages/bundled-features/src/audit/handlers/details.query.ts +11 -39
- package/packages/bundled-features/src/audit/handlers/list-all-tenants.query.ts +47 -0
- package/packages/bundled-features/src/audit/handlers/list.query.ts +16 -123
- package/packages/bundled-features/src/audit/handlers/resolve-audit-tenant.ts +21 -7
- package/packages/bundled-features/src/audit/index.ts +1 -1
- package/packages/bundled-features/src/audit/run-escape-hatch-retention.ts +4 -4
- package/packages/bundled-features/src/audit/screens.ts +82 -0
- package/packages/bundled-features/src/audit/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/audit/{constants.ts → web/constants.ts} +11 -1
- package/packages/bundled-features/src/audit/web/default-translations.ts +7 -0
- package/packages/bundled-features/src/audit/web/i18n.ts +33 -7
- package/packages/bundled-features/src/audit/web/index.ts +0 -2
- package/packages/bundled-features/src/auth-email-password/bootstrap.ts +6 -6
- package/packages/bundled-features/src/auth-email-password/changes.json +6 -0
- package/packages/bundled-features/src/auth-email-password/errors.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/feature.ts +2 -2
- package/packages/bundled-features/src/auth-email-password/handlers/confirm-account-unlock.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/invite-accept-with-login.write.ts +4 -4
- package/packages/bundled-features/src/auth-email-password/handlers/invite-create.write.ts +3 -3
- package/packages/bundled-features/src/auth-email-password/handlers/invite-info.query.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/login.write.ts +38 -4
- package/packages/bundled-features/src/auth-email-password/handlers/request-account-unlock.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/request-email-verification.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/request-password-reset.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/reset-password.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/verify-email.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/index.ts +6 -1
- package/packages/bundled-features/src/auth-email-password/mail-notifications.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/signup-activation.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-client.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-form-logic.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/client-actions.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/client-plugin.ts +1 -2
- package/packages/bundled-features/src/auth-email-password/web/confirm-account-unlock-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/{constants.ts → web/constants.ts} +3 -6
- package/packages/bundled-features/src/auth-email-password/web/default-topbar-actions.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/{i18n.ts → web/i18n.ts} +3 -4
- package/packages/bundled-features/src/auth-email-password/web/index.ts +1 -2
- package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +2 -3
- package/packages/bundled-features/src/auth-email-password/web/login-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/{mail-i18n.ts → web/mail-i18n.ts} +0 -1
- package/packages/bundled-features/src/auth-email-password/web/request-account-unlock-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/reset-password-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/session-bootstrap-error.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/session.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/signup-complete-screen.tsx +2 -3
- package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/tenant-menu-items.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/use-shell-user.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/verify-email-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-mfa/changes.json +6 -0
- package/packages/bundled-features/src/auth-mfa/errors.ts +2 -2
- package/packages/bundled-features/src/auth-mfa/handlers/enable-confirm-preauth.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/enable-start-preauth.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/enable-start.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/verify.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/index.ts +8 -8
- package/packages/bundled-features/src/auth-mfa/mfa-status-checker.ts +4 -4
- package/packages/bundled-features/src/auth-mfa/screens.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/web/client-plugin.ts +0 -1
- package/packages/bundled-features/src/auth-mfa/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/auth-mfa/web/i18n.ts +0 -1
- package/packages/bundled-features/src/auth-mfa/web/index.ts +0 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-client.ts +0 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-disable-dialog.tsx +1 -2
- package/packages/bundled-features/src/auth-mfa/web/mfa-recovery-codes-reveal.tsx +0 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-regenerate-recovery-dialog.tsx +1 -2
- package/packages/bundled-features/src/auth-mfa/web/mfa-setup-preauth-screen.tsx +21 -23
- package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +0 -1
- package/packages/bundled-features/src/billing-foundation/changes.json +18 -0
- package/packages/bundled-features/src/billing-foundation/checkout-core.ts +3 -3
- package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-text.ts +2 -2
- package/packages/bundled-features/src/billing-foundation/consumer-protection/issue-confirmation.ts +11 -3
- package/packages/bundled-features/src/billing-foundation/consumer-protection/mail-notifications.ts +11 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/register-consent.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/register-termination.ts +12 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/stored-user-email.ts +12 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-mail.ts +6 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-notify.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-pages.ts +167 -28
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +102 -3
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-request.ts +43 -12
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +202 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-texts.ts +70 -0
- package/packages/bundled-features/src/billing-foundation/events.ts +20 -2
- package/packages/bundled-features/src/billing-foundation/feature.ts +5 -5
- package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +82 -9
- package/packages/bundled-features/src/billing-foundation/handlers/switch-plan.write.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/handlers/sync-subscription.write.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/index.ts +27 -27
- package/packages/bundled-features/src/billing-foundation/plan-catalog.ts +7 -7
- package/packages/bundled-features/src/billing-foundation/screens.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/subscription-tier-sync.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/types.ts +17 -3
- package/packages/bundled-features/src/billing-foundation/validate-options.ts +3 -3
- package/packages/bundled-features/src/billing-foundation/web/billing-contact-plan.tsx +1 -3
- package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +5 -7
- package/packages/bundled-features/src/billing-foundation/web/cancel-contract-dialog.tsx +1 -3
- package/packages/bundled-features/src/billing-foundation/web/checkout-consent-dialog.tsx +1 -3
- package/packages/bundled-features/src/billing-foundation/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/billing-foundation/{constants.ts → web/constants.ts} +37 -31
- package/packages/bundled-features/src/billing-foundation/{consumer-protection → web/consumer-protection}/consent-locale.ts +0 -1
- package/packages/bundled-features/src/billing-foundation/{contact-card.ts → web/contact-card.ts} +0 -2
- package/packages/bundled-features/src/billing-foundation/web/index.ts +14 -15
- package/packages/bundled-features/src/billing-foundation/web/localized-params.ts +0 -2
- package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +5 -2
- package/packages/bundled-features/src/cap-counter/changes.json +12 -0
- package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +9 -0
- package/packages/bundled-features/src/cap-overview/feature.ts +1 -1
- package/packages/bundled-features/src/cap-overview/handlers/caps-usage.query.ts +1 -1
- package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +2 -2
- package/packages/bundled-features/src/cap-overview/index.ts +9 -9
- package/packages/bundled-features/src/cap-overview/screens.ts +2 -2
- package/packages/bundled-features/src/cap-overview/web/cap-cards-panel.tsx +1 -2
- package/packages/bundled-features/src/cap-overview/web/cap-usage-bar.tsx +1 -2
- package/packages/bundled-features/src/cap-overview/web/cap-usage-cell.tsx +0 -2
- package/packages/bundled-features/src/cap-overview/web/client-plugin.tsx +3 -4
- package/packages/bundled-features/src/cap-overview/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/cap-overview/web/index.ts +0 -1
- package/packages/bundled-features/src/cap-overview/{usage-math.ts → web/usage-math.ts} +1 -2
- package/packages/bundled-features/src/compliance-profiles/feature.ts +5 -5
- package/packages/bundled-features/src/compliance-profiles/index.ts +6 -6
- package/packages/bundled-features/src/compliance-profiles/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/compliance-profiles/web/compliance-profile-catalog.tsx +1 -2
- package/packages/bundled-features/src/compliance-profiles/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/compliance-profiles/web/i18n.ts +0 -1
- package/packages/bundled-features/src/compliance-profiles/web/index.ts +0 -1
- package/packages/bundled-features/src/config/index.ts +6 -6
- package/packages/bundled-features/src/config/web/client-plugin.ts +1 -2
- package/packages/bundled-features/src/config/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/config/web/i18n.ts +1 -1
- package/packages/bundled-features/src/config/web/index.ts +1 -3
- package/packages/bundled-features/src/config/write-helpers.ts +1 -1
- package/packages/bundled-features/src/custom-fields/feature.ts +8 -8
- package/packages/bundled-features/src/custom-fields/handlers/clear-custom-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/define-tenant-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/delete-system-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/delete-tenant-field.write.ts +4 -4
- package/packages/bundled-features/src/custom-fields/handlers/set-custom-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/update-tenant-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/index.ts +8 -8
- package/packages/bundled-features/src/custom-fields/lib/value-schema.ts +1 -1
- package/packages/bundled-features/src/custom-fields/schemas.ts +1 -1
- package/packages/bundled-features/src/custom-fields/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/custom-fields/{constants.ts → web/constants.ts} +18 -19
- package/packages/bundled-features/src/custom-fields/web/custom-fields-form-section.tsx +1 -2
- package/packages/bundled-features/src/custom-fields/web/i18n.ts +0 -1
- package/packages/bundled-features/src/custom-fields/web/index.ts +2 -3
- package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +1 -2
- package/packages/bundled-features/src/delivery/address-opt-out.ts +1 -1
- package/packages/bundled-features/src/delivery/attempt-log-retention.ts +24 -8
- package/packages/bundled-features/src/delivery/changes.json +6 -0
- package/packages/bundled-features/src/delivery/constants.ts +2 -2
- package/packages/bundled-features/src/delivery/i18n.ts +1 -1
- package/packages/bundled-features/src/delivery/unsubscribe-page.ts +1 -1
- package/packages/bundled-features/src/delivery/web/client-plugin.tsx +6 -7
- package/packages/bundled-features/src/delivery/web/delivery-channel-cell.tsx +0 -1
- package/packages/bundled-features/src/delivery/web/delivery-error-cell.tsx +0 -1
- package/packages/bundled-features/src/delivery/web/delivery-status-cell.tsx +1 -2
- package/packages/bundled-features/src/delivery/web/delivery-time-cell.tsx +0 -1
- package/packages/bundled-features/src/delivery/web/delivery-type-cell.tsx +0 -1
- package/packages/bundled-features/src/delivery/web/index.ts +0 -1
- package/packages/bundled-features/src/delivery/{public-names.ts → web/public-names.ts} +0 -1
- package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
- package/packages/bundled-features/src/document-ingest-foundation/events.ts +4 -0
- package/packages/bundled-features/src/document-ingest-foundation/executor.ts +2 -1
- package/packages/bundled-features/src/document-ingest-foundation/feature.ts +18 -4
- package/packages/bundled-features/src/document-ingest-foundation/index.ts +1 -0
- package/packages/bundled-features/src/feature-toggles/feature.ts +7 -7
- package/packages/bundled-features/src/feature-toggles/handlers/list.query.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/handlers/registered.query.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/handlers/set.write.ts +3 -3
- package/packages/bundled-features/src/feature-toggles/index.ts +6 -6
- package/packages/bundled-features/src/feature-toggles/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/feature-toggles/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/feature-toggles/web/i18n.ts +0 -1
- package/packages/bundled-features/src/feature-toggles/web/index.ts +0 -1
- package/packages/bundled-features/src/files/changes.json +7 -0
- package/packages/bundled-features/src/folders/feature.ts +1 -1
- package/packages/bundled-features/src/folders/handlers/clear-folder.write.ts +1 -1
- package/packages/bundled-features/src/folders/handlers/delete-folder.write.ts +1 -1
- package/packages/bundled-features/src/folders/handlers/set-folder.write.ts +1 -1
- package/packages/bundled-features/src/folders/index.ts +8 -8
- package/packages/bundled-features/src/folders/web/client-plugin.tsx +1 -3
- package/packages/bundled-features/src/folders/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/folders/web/folder-manager.tsx +1 -2
- package/packages/bundled-features/src/folders/web/folder-section.tsx +1 -2
- package/packages/bundled-features/src/folders/web/i18n.ts +0 -1
- package/packages/bundled-features/src/folders/web/index.ts +1 -2
- package/packages/bundled-features/src/folders/web/tree.ts +0 -1
- package/packages/bundled-features/src/form-draft/changes.json +7 -0
- package/packages/bundled-features/src/form-draft/db/queries/cleanup.ts +25 -11
- package/packages/bundled-features/src/form-draft/decrypt-draft.ts +24 -0
- package/packages/bundled-features/src/form-draft/entity.ts +6 -9
- package/packages/bundled-features/src/form-draft/feature.ts +1 -1
- package/packages/bundled-features/src/form-draft/handlers/cleanup.job.ts +26 -5
- package/packages/bundled-features/src/form-draft/handlers/discard.write.ts +1 -1
- package/packages/bundled-features/src/form-draft/handlers/get.query.ts +6 -7
- package/packages/bundled-features/src/form-draft/handlers/list.query.ts +13 -7
- package/packages/bundled-features/src/form-draft/handlers/save.write.ts +5 -5
- package/packages/bundled-features/src/form-draft/index.ts +8 -8
- package/packages/bundled-features/src/form-draft/lookup.ts +10 -4
- package/packages/bundled-features/src/form-draft/schemas.ts +1 -1
- package/packages/bundled-features/src/form-draft/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/form-draft-user-data/hooks.ts +2 -2
- package/packages/bundled-features/src/inbound-mail-foundation/changes.json +6 -0
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/list-accounts.query.ts +11 -4
- package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +10 -10
- package/packages/bundled-features/src/jobs/feature.ts +7 -7
- package/packages/bundled-features/src/jobs/handlers/retry.write.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/trigger.write.ts +1 -1
- package/packages/bundled-features/src/jobs/index.ts +1 -1
- package/packages/bundled-features/src/jobs/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/jobs/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/jobs/web/default-translations.ts +7 -0
- package/packages/bundled-features/src/jobs/web/i18n.ts +53 -7
- package/packages/bundled-features/src/jobs/web/index.ts +0 -1
- package/packages/bundled-features/src/ledger/changes.json +7 -0
- package/packages/bundled-features/src/ledger/entity.ts +1 -1
- package/packages/bundled-features/src/ledger/feature.ts +1 -1
- package/packages/bundled-features/src/ledger/handlers/confirm-schedule-period.write.ts +2 -10
- package/packages/bundled-features/src/ledger/handlers/create-transaction.write.ts +1 -1
- package/packages/bundled-features/src/ledger/handlers/reports.query.ts +1 -1
- package/packages/bundled-features/src/ledger/handlers/reverse-transaction.write.ts +1 -1
- package/packages/bundled-features/src/ledger/index.ts +13 -13
- package/packages/bundled-features/src/ledger/recurring.ts +1 -1
- package/packages/bundled-features/src/ledger/reports.ts +1 -1
- package/packages/bundled-features/src/ledger/schemas.ts +1 -1
- package/packages/bundled-features/src/ledger/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/ledger/web/index.ts +11 -12
- package/packages/bundled-features/src/legal-pages/README.md +1 -1
- package/packages/bundled-features/src/legal-pages/feature.ts +5 -5
- package/packages/bundled-features/src/legal-pages/index.ts +11 -11
- package/packages/bundled-features/src/legal-pages/lib/boot-check.ts +1 -1
- package/packages/bundled-features/src/legal-pages/lib/validate-routes.ts +1 -1
- package/packages/bundled-features/src/legal-pages/web/client-plugin.ts +1 -2
- package/packages/bundled-features/src/legal-pages/{constants.ts → web/constants.ts} +6 -8
- package/packages/bundled-features/src/legal-pages/web/index.ts +0 -1
- package/packages/bundled-features/src/mail-foundation/changes.json +6 -0
- package/packages/bundled-features/src/mail-foundation/i18n.ts +3 -2
- package/packages/bundled-features/src/mail-transport-smtp/i18n.ts +1 -1
- package/packages/bundled-features/src/managed-pages/feature.ts +1 -1
- package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/managed-pages/web/default-translations.ts +17 -0
- package/packages/bundled-features/src/managed-pages/web/i18n.ts +59 -16
- package/packages/bundled-features/src/managed-pages/web/index.ts +1 -2
- package/packages/bundled-features/src/metrics/compute.ts +1 -1
- package/packages/bundled-features/src/metrics/feature.ts +6 -6
- package/packages/bundled-features/src/metrics/index.ts +8 -8
- package/packages/bundled-features/src/metrics/types.ts +1 -1
- package/packages/bundled-features/src/metrics/validate.ts +1 -1
- package/packages/bundled-features/src/metrics/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/metrics/window.ts +1 -1
- package/packages/bundled-features/src/notes-history/feature.ts +1 -1
- package/packages/bundled-features/src/notes-history/handlers/add-note.write.ts +1 -1
- package/packages/bundled-features/src/notes-history/index.ts +8 -8
- package/packages/bundled-features/src/notes-history/web/client-plugin.tsx +1 -3
- package/packages/bundled-features/src/notes-history/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/notes-history/web/i18n.ts +0 -1
- package/packages/bundled-features/src/notes-history/web/index.ts +2 -3
- package/packages/bundled-features/src/notes-history/web/notes-section.tsx +2 -3
- package/packages/bundled-features/src/personal-access-tokens/feature.ts +12 -10
- package/packages/bundled-features/src/personal-access-tokens/handlers/available-scopes.query.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/handlers/revoke.write.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/hash.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/i18n.ts +2 -2
- package/packages/bundled-features/src/personal-access-tokens/index.ts +5 -5
- package/packages/bundled-features/src/personal-access-tokens/resolver.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/schema/api-token.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/screens.ts +2 -2
- package/packages/bundled-features/src/personal-access-tokens/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/personal-access-tokens/{scopes.ts → web/scopes.ts} +0 -1
- package/packages/bundled-features/src/presets/changes.json +7 -0
- package/packages/bundled-features/src/presets/index.ts +0 -1
- package/packages/bundled-features/src/presets/security-baseline.ts +1 -1
- package/packages/bundled-features/src/renderer-foundation/types.ts +1 -1
- package/packages/bundled-features/src/secrets/feature.ts +1 -1
- package/packages/bundled-features/src/secrets/handlers/delete.write.ts +1 -1
- package/packages/bundled-features/src/secrets/handlers/list.query.ts +1 -1
- package/packages/bundled-features/src/secrets/handlers/set.write.ts +1 -1
- package/packages/bundled-features/src/secrets/i18n.ts +1 -1
- package/packages/bundled-features/src/secrets/index.ts +8 -8
- package/packages/bundled-features/src/secrets/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/secrets/write-gate.ts +1 -1
- package/packages/bundled-features/src/sessions/feature.ts +7 -4
- package/packages/bundled-features/src/sessions/{i18n.ts → web/i18n.ts} +0 -1
- package/packages/bundled-features/src/shared/index.ts +6 -1
- package/packages/bundled-features/src/shared/purge-files-reaching-subject.ts +10 -2
- package/packages/bundled-features/src/shared/web/translate-or-raw.ts +0 -1
- package/packages/bundled-features/src/subscription-stripe/feature.ts +2 -0
- package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +19 -0
- package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +1 -0
- package/packages/bundled-features/src/tags/changes.json +6 -0
- package/packages/bundled-features/src/tags/feature.ts +1 -1
- package/packages/bundled-features/src/tags/handlers/assign-tag.write.ts +11 -7
- package/packages/bundled-features/src/tags/handlers/create-tag.write.ts +1 -1
- package/packages/bundled-features/src/tags/handlers/delete-tag.write.ts +4 -1
- package/packages/bundled-features/src/tags/handlers/remove-tag.write.ts +1 -1
- package/packages/bundled-features/src/tags/handlers/update-tag.write.ts +1 -1
- package/packages/bundled-features/src/tags/index.ts +12 -12
- package/packages/bundled-features/src/tags/screens.ts +1 -1
- package/packages/bundled-features/src/tags/web/client-plugin.tsx +1 -3
- package/packages/bundled-features/src/tags/{constants.ts → web/constants.ts} +4 -1
- package/packages/bundled-features/src/tags/web/entity-tags.tsx +1 -2
- package/packages/bundled-features/src/tags/web/i18n.ts +2 -2
- package/packages/bundled-features/src/tags/web/index.ts +2 -3
- package/packages/bundled-features/src/tags/web/tag-chip.tsx +0 -1
- package/packages/bundled-features/src/tags/web/tag-filter.tsx +1 -2
- package/packages/bundled-features/src/tags/web/tag-manager.tsx +5 -4
- package/packages/bundled-features/src/tags/web/tag-picker.tsx +0 -1
- package/packages/bundled-features/src/tags/web/tag-section.tsx +1 -2
- package/packages/bundled-features/src/tags/web/tags-cell.tsx +1 -2
- package/packages/bundled-features/src/template-resolver/README.md +1 -1
- package/packages/bundled-features/src/template-resolver/api.ts +75 -28
- package/packages/bundled-features/src/template-resolver/changes.json +63 -0
- package/packages/bundled-features/src/template-resolver/compile-document-body.ts +62 -4
- package/packages/bundled-features/src/template-resolver/compile-steps-block.ts +2 -2
- package/packages/bundled-features/src/template-resolver/document-ops.ts +5 -5
- package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +39 -4
- package/packages/bundled-features/src/template-resolver/feature.ts +88 -38
- package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +6 -1
- package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +6 -2
- package/packages/bundled-features/src/template-resolver/handlers/collection-item.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/collection-list.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/collection-set.write.ts +20 -7
- package/packages/bundled-features/src/template-resolver/handlers/collection-shared.ts +0 -6
- package/packages/bundled-features/src/template-resolver/handlers/copy-locale.write.ts +69 -60
- package/packages/bundled-features/src/template-resolver/handlers/diff-to-system.query.ts +7 -1
- package/packages/bundled-features/src/template-resolver/handlers/discard-draft.write.ts +37 -14
- package/packages/bundled-features/src/template-resolver/handlers/document-base.ts +8 -2
- package/packages/bundled-features/src/template-resolver/handlers/document-blocks.query.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/export-bundle.query.ts +5 -2
- package/packages/bundled-features/src/template-resolver/handlers/find-by-id.query.ts +4 -2
- package/packages/bundled-features/src/template-resolver/handlers/import-bundle.write.ts +37 -28
- package/packages/bundled-features/src/template-resolver/handlers/layout-source.query.ts +10 -5
- package/packages/bundled-features/src/template-resolver/handlers/list.query.ts +5 -2
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +132 -70
- package/packages/bundled-features/src/template-resolver/handlers/patch-draft.write.ts +106 -97
- package/packages/bundled-features/src/template-resolver/handlers/reset-to-system.write.ts +62 -49
- package/packages/bundled-features/src/template-resolver/handlers/resource-link-pdf.write.ts +44 -29
- package/packages/bundled-features/src/template-resolver/handlers/resource-remove.write.ts +52 -36
- package/packages/bundled-features/src/template-resolver/handlers/resource-shared.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/resource-upload.write.ts +127 -107
- package/packages/bundled-features/src/template-resolver/handlers/send-test-shared.ts +38 -0
- package/packages/bundled-features/src/template-resolver/handlers/send-test-status.query.ts +31 -0
- package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +106 -112
- package/packages/bundled-features/src/template-resolver/handlers/set.write.ts +111 -104
- package/packages/bundled-features/src/template-resolver/handlers/shared.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/template-gates.ts +6 -6
- package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +56 -28
- package/packages/bundled-features/src/template-resolver/handlers/upsert-tenant.write.ts +38 -29
- package/packages/bundled-features/src/template-resolver/handlers/usage.query.ts +8 -2
- package/packages/bundled-features/src/template-resolver/handlers/validate.query.ts +4 -2
- package/packages/bundled-features/src/template-resolver/i18n.ts +25 -0
- package/packages/bundled-features/src/template-resolver/index.ts +68 -60
- package/packages/bundled-features/src/template-resolver/layout-appearance.ts +1 -1
- package/packages/bundled-features/src/template-resolver/layout-regions.ts +1 -1
- package/packages/bundled-features/src/template-resolver/seeding.ts +16 -7
- package/packages/bundled-features/src/template-resolver/store-template-resource.ts +2 -2
- package/packages/bundled-features/src/template-resolver/table.ts +1 -1
- package/packages/bundled-features/src/template-resolver/template-bundle.ts +2 -2
- package/packages/bundled-features/src/template-resolver/template-delivery-policy.ts +82 -0
- package/packages/bundled-features/src/template-resolver/template-draft.ts +1 -1
- package/packages/bundled-features/src/template-resolver/template-edit-policy.ts +91 -0
- package/packages/bundled-features/src/template-resolver/template-meta.ts +2 -2
- package/packages/bundled-features/src/template-resolver/template-preview.ts +22 -12
- package/packages/bundled-features/src/template-resolver/template-usage.ts +1 -1
- package/packages/bundled-features/src/template-resolver/template-validation.ts +33 -12
- package/packages/bundled-features/src/template-resolver/testing.ts +2 -2
- package/packages/bundled-features/src/template-resolver/user-content-table.ts +1 -1
- package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +4 -5
- package/packages/bundled-features/src/template-resolver/{constants.ts → web/constants.ts} +10 -10
- package/packages/bundled-features/src/template-resolver/{document-blocks.ts → web/document-blocks.ts} +3 -2
- package/packages/bundled-features/src/template-resolver/web/document-editor-extensions.ts +31 -3
- package/packages/bundled-features/src/template-resolver/web/document-editor.tsx +0 -1
- package/packages/bundled-features/src/template-resolver/web/document-images.ts +28 -0
- package/packages/bundled-features/src/template-resolver/{document-schema.ts → web/document-schema.ts} +5 -1
- package/packages/bundled-features/src/template-resolver/{document-steps.ts → web/document-steps.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +48 -11
- package/packages/bundled-features/src/template-resolver/web/document-toolbar-blocks.ts +4 -3
- package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -2
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +8 -1
- package/packages/bundled-features/src/template-resolver/web/index.ts +13 -14
- package/packages/bundled-features/src/template-resolver/{mail-constants.ts → web/mail-constants.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/{pdf-constants.ts → web/pdf-constants.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/web/placeholder-line-editor-lazy.tsx +0 -1
- package/packages/bundled-features/src/template-resolver/web/placeholder-line-editor.tsx +5 -4
- package/packages/bundled-features/src/template-resolver/{placeholder-text.ts → web/placeholder-text.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/{qualified-names.ts → web/qualified-names.ts} +2 -1
- package/packages/bundled-features/src/template-resolver/web/use-stable-by-key.ts +0 -1
- package/packages/bundled-features/src/tenant/handlers/add-member.write.ts +1 -1
- package/packages/bundled-features/src/tenant/index.ts +7 -7
- package/packages/bundled-features/src/tenant/invitation-table.ts +1 -1
- package/packages/bundled-features/src/tenant/invited-membership.ts +1 -1
- package/packages/bundled-features/src/tenant/last-tenant-admin.ts +1 -1
- package/packages/bundled-features/src/tenant/member-role-options.ts +1 -1
- package/packages/bundled-features/src/tenant/screens.ts +2 -2
- package/packages/bundled-features/src/tenant/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/tenant/{constants.ts → web/constants.ts} +3 -6
- package/packages/bundled-features/src/tenant/web/index.ts +0 -1
- package/packages/bundled-features/src/tenant/web/member-roles-cell.tsx +0 -1
- package/packages/bundled-features/src/tenant/web/member-status-cell.tsx +0 -1
- package/packages/bundled-features/src/tenant-lifecycle/stages.ts +2 -2
- package/packages/bundled-features/src/tier-engine/entity.ts +1 -1
- package/packages/bundled-features/src/tier-engine/feature.ts +7 -7
- package/packages/bundled-features/src/tier-engine/handlers/set-tenant-tier.write.ts +1 -1
- package/packages/bundled-features/src/tier-engine/index.ts +8 -8
- package/packages/bundled-features/src/tier-engine/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/tier-engine/{constants.ts → web/constants.ts} +2 -3
- package/packages/bundled-features/src/tier-engine/{i18n.ts → web/i18n.ts} +0 -1
- package/packages/bundled-features/src/tier-engine/web/index.ts +0 -1
- package/packages/bundled-features/src/user/handlers/create.write.ts +1 -1
- package/packages/bundled-features/src/user/handlers/update-roles.ts +1 -1
- package/packages/bundled-features/src/user/handlers/update.write.ts +1 -1
- package/packages/bundled-features/src/user/index.ts +1 -1
- package/packages/bundled-features/src/user/invited-global-roles.ts +1 -1
- package/packages/bundled-features/src/user/schema/user.ts +1 -1
- package/packages/bundled-features/src/user/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/user-data-rights/changes.json +14 -0
- package/packages/bundled-features/src/user-data-rights/env.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/feature.ts +9 -9
- package/packages/bundled-features/src/user-data-rights/index.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/lib/resolve-tenant-model.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/mail-notifications.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +0 -1
- package/packages/bundled-features/src/user-data-rights/{constants.ts → web/constants.ts} +11 -12
- package/packages/bundled-features/src/user-data-rights/web/default-translations.ts +91 -0
- package/packages/bundled-features/src/user-data-rights/web/i18n.ts +41 -91
- package/packages/bundled-features/src/user-data-rights/web/index.ts +1 -2
- package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -2
- package/packages/bundled-features/src/user-data-rights/web/public-deletion-gate.tsx +0 -1
- package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +0 -1
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/file-ref.userdata-hook.ts +10 -1
- package/packages/bundled-features/src/user-profile/feature.ts +2 -2
- package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +1 -1
- package/packages/bundled-features/src/user-profile/index.ts +3 -2
- package/packages/bundled-features/src/user-profile/web/client-plugin.ts +2 -3
- package/packages/bundled-features/src/user-profile/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/user-profile/{i18n.ts → web/i18n.ts} +0 -1
- package/packages/bundled-features/src/user-profile/web/profile-screen.tsx +2 -3
- package/packages/bundled-features/src/waitlist/changes.json +6 -0
- package/packages/bundled-features/src/waitlist/entity.ts +1 -1
- package/packages/bundled-features/src/waitlist/feature.ts +5 -5
- package/packages/bundled-features/src/waitlist/handlers/export-purge.write.ts +3 -3
- package/packages/bundled-features/src/waitlist/handlers/invite.write.ts +5 -1
- package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +1 -1
- package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +3 -3
- package/packages/bundled-features/src/waitlist/import.ts +1 -1
- package/packages/bundled-features/src/waitlist/index.ts +11 -11
- package/packages/bundled-features/src/waitlist/legacy-migrate.ts +1 -1
- package/packages/bundled-features/src/waitlist/link-on-signup.ts +1 -1
- package/packages/bundled-features/src/waitlist/mail.ts +7 -6
- package/packages/bundled-features/src/waitlist/payloads.ts +1 -1
- package/packages/bundled-features/src/waitlist/screens.ts +1 -1
- package/packages/bundled-features/src/waitlist/{constants.ts → web/constants.ts} +0 -1
- package/samples/apps/styleguide/src/features/content/web.tsx +0 -1
- package/samples/apps/ui-walkthrough/src/app/client.tsx +2 -0
- package/samples/apps/ui-walkthrough/src/app/help-action.tsx +37 -0
- package/samples/apps/ui-walkthrough/src/app/seed-rental.ts +17 -1
- package/samples/apps/ui-walkthrough/src/app/seed-templates.ts +13 -0
- package/samples/apps/ui-walkthrough/src/app/server.ts +2 -1
- package/samples/apps/ui-walkthrough/src/app/shell.tsx +6 -0
- package/samples/apps/ui-walkthrough/src/app/template-seed-data.ts +20 -0
- package/samples/apps/ui-walkthrough/src/features/billing/feature.ts +35 -7
- package/samples/apps/ui-walkthrough/src/features/billing/i18n.ts +6 -0
- package/samples/apps/ui-walkthrough/src/features/rental/entities.ts +27 -0
- package/samples/apps/ui-walkthrough/src/features/rental/feature.ts +120 -2
- package/samples/apps/ui-walkthrough/src/features/rental/i18n.ts +94 -0
- package/samples/apps/ui-walkthrough/src/features/rental/invoice-receive.ts +19 -0
- package/samples/apps/ui-walkthrough/src/features/rental/lease-support.ts +32 -1
- package/samples/apps/ui-walkthrough/src/features/rental/qualified-names.ts +5 -0
- package/samples/apps/ui-walkthrough/src/features/rental/receipts-upload.ts +70 -0
- package/samples/apps/ui-walkthrough/src/features/rental/screens.ts +156 -0
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/feature.ts +103 -0
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/i18n.ts +36 -0
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/index.ts +2 -0
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/seed.ts +21 -0
- package/samples/apps/ui-walkthrough/src/features/tasks/i18n.ts +8 -0
- package/samples/apps/ui-walkthrough/src/run-config.ts +43 -3
- package/samples/apps/use-all-bundled/e2e-billing-gallery/server.ts +1 -1
- package/samples/apps/use-all-bundled/feature-manifest.json +5 -5
- package/samples/apps/use-all-bundled/scripts/check-coverage.ts +1 -1
- package/samples/apps/use-all-bundled/src/app/dev-app-options.ts +3 -1
- package/samples/recipes/compose-stacks/README.md +1 -2
- package/samples/recipes/delivery-notifications/README.md +1 -1
- package/samples/recipes/embedded/README.md +8 -0
- package/samples/recipes/embedded/src/feature.ts +8 -0
- package/samples/recipes/embedded/src/handlers/invoice-receive.write.ts +37 -0
- package/samples/recipes/embedded/src/screens/invoice-receive.screen.ts +56 -0
- package/samples/recipes/legal-pages/README.md +2 -2
- package/samples/recipes/legal-pages/src/feature.ts +1 -1
- package/samples/recipes/reference-data/src/feature.ts +3 -7
- package/packages/bundled-features/src/admin-shell/i18n.ts +0 -54
- package/packages/bundled-features/src/audit/i18n.ts +0 -25
- package/packages/bundled-features/src/auth-mfa/web/qrcode-browser.d.ts +0 -11
- package/packages/bundled-features/src/jobs/i18n.ts +0 -55
- package/packages/bundled-features/src/managed-pages/i18n.ts +0 -63
- package/packages/bundled-features/src/presets/dsgvo-self-service.ts +0 -35
- package/packages/bundled-features/src/user-data-rights/i18n.ts +0 -44
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { isResourceImageContentType } from "../shared/index.ts";
|
|
1
2
|
export {
|
|
2
3
|
createTemplateResolverApi,
|
|
3
4
|
type ResolveRequest,
|
|
@@ -8,40 +9,11 @@ export {
|
|
|
8
9
|
} from "./api.ts";
|
|
9
10
|
export {
|
|
10
11
|
type CompileDocumentBodyOptions,
|
|
12
|
+
collectDocumentImageVariables,
|
|
11
13
|
collectDocumentResourceKeys,
|
|
12
14
|
compileDocumentBodyToHandlebars,
|
|
13
15
|
toResourceDataUri,
|
|
14
16
|
} from "./compile-document-body.ts";
|
|
15
|
-
export {
|
|
16
|
-
CONTENT_FORMATS,
|
|
17
|
-
type ContentFormat,
|
|
18
|
-
DEFAULT_MAIL_LAYOUT_SLUG,
|
|
19
|
-
DEFAULT_PDF_LAYOUT_SLUG,
|
|
20
|
-
DOCUMENT_HTML_KINDS,
|
|
21
|
-
type DocumentHtmlKind,
|
|
22
|
-
FALLBACK_LOCALE,
|
|
23
|
-
NON_RENDER_KINDS,
|
|
24
|
-
type NonRenderKind,
|
|
25
|
-
PDF_DEFAULT_MARGIN_MM,
|
|
26
|
-
PDF_FOOTER_MARGIN_MM,
|
|
27
|
-
PDF_HEADER_MARGIN_MM,
|
|
28
|
-
PDF_ORIENTATIONS,
|
|
29
|
-
PDF_PAGE_FORMATS,
|
|
30
|
-
type PdfOrientation,
|
|
31
|
-
type PdfPageFormat,
|
|
32
|
-
RENDER_KINDS,
|
|
33
|
-
type RenderKind,
|
|
34
|
-
SYSTEM_TENANT_ID,
|
|
35
|
-
TEMPLATE_KINDS,
|
|
36
|
-
TEMPLATE_SCOPES,
|
|
37
|
-
TEMPLATE_STATUSES,
|
|
38
|
-
TEXT_BLOCK_KIND,
|
|
39
|
-
type TemplateKind,
|
|
40
|
-
type TemplateScope,
|
|
41
|
-
type TemplateStatus,
|
|
42
|
-
UPSERT_KINDS,
|
|
43
|
-
type UpsertKind,
|
|
44
|
-
} from "./constants.ts";
|
|
45
17
|
export {
|
|
46
18
|
type DocumentViolation,
|
|
47
19
|
type DocumentViolationCode,
|
|
@@ -52,30 +24,7 @@ export {
|
|
|
52
24
|
sanitizeDocumentHtml,
|
|
53
25
|
sanitizeTemplateBody,
|
|
54
26
|
} from "./document-sanitizer.ts";
|
|
55
|
-
export {
|
|
56
|
-
DOCUMENT_CONDITION_ATTRIBUTE,
|
|
57
|
-
DOCUMENT_NODE_NAMES,
|
|
58
|
-
DOCUMENT_TEXT_ALIGNMENTS,
|
|
59
|
-
DocumentButton,
|
|
60
|
-
DocumentCondition,
|
|
61
|
-
DocumentDivider,
|
|
62
|
-
DocumentLink,
|
|
63
|
-
DocumentPageBreak,
|
|
64
|
-
DocumentResource,
|
|
65
|
-
DocumentTable,
|
|
66
|
-
DocumentTableCell,
|
|
67
|
-
DocumentTableHeader,
|
|
68
|
-
DocumentTableRow,
|
|
69
|
-
DocumentTextAlign,
|
|
70
|
-
type DocumentTextAlignment,
|
|
71
|
-
DocumentVariable,
|
|
72
|
-
documentExtensions,
|
|
73
|
-
isAllowedDocumentLinkHref,
|
|
74
|
-
isDocumentPlaceholderHref,
|
|
75
|
-
isDocumentReferenceName,
|
|
76
|
-
isDocumentResourceKey,
|
|
77
|
-
} from "./document-schema.ts";
|
|
78
|
-
export { createTemplateResolverFeature } from "./feature.ts";
|
|
27
|
+
export { createTemplateResolverFeature, type TemplateResolverOptions } from "./feature.ts";
|
|
79
28
|
export type { LayoutSourceResponse, LayoutSourceRow } from "./handlers/layout-source.query.ts";
|
|
80
29
|
export type {
|
|
81
30
|
OverviewKindGroup,
|
|
@@ -106,12 +55,6 @@ export {
|
|
|
106
55
|
templatePdfAttachmentLinkSchema,
|
|
107
56
|
} from "./linked-resources.ts";
|
|
108
57
|
export { prepareDocumentForPrint } from "./print-document.ts";
|
|
109
|
-
export {
|
|
110
|
-
TEMPLATE_RESOLVER_FEATURE,
|
|
111
|
-
TemplateResolverErrors,
|
|
112
|
-
TemplateResolverHandlers,
|
|
113
|
-
TemplateResolverQueries,
|
|
114
|
-
} from "./qualified-names.ts";
|
|
115
58
|
export { mapRecordToVariables } from "./record-mapping.ts";
|
|
116
59
|
export {
|
|
117
60
|
type PreparedTemplateImage,
|
|
@@ -126,6 +69,12 @@ export {
|
|
|
126
69
|
templateResourcesTable,
|
|
127
70
|
} from "./table.ts";
|
|
128
71
|
export { type TemplateBundle, templateBundleSchema } from "./template-bundle.ts";
|
|
72
|
+
export type { TemplateDeliveryPolicy } from "./template-delivery-policy.ts";
|
|
73
|
+
export {
|
|
74
|
+
type TemplateEditPolicy,
|
|
75
|
+
type TenantEditableTemplate,
|
|
76
|
+
templateEditAccess,
|
|
77
|
+
} from "./template-edit-policy.ts";
|
|
129
78
|
export {
|
|
130
79
|
isMailTemplateMeta,
|
|
131
80
|
type LayoutTemplateMeta,
|
|
@@ -162,3 +111,62 @@ export {
|
|
|
162
111
|
userContentEntriesTable,
|
|
163
112
|
userContentEntryEntity,
|
|
164
113
|
} from "./user-content-table.ts";
|
|
114
|
+
export {
|
|
115
|
+
CONTENT_FORMATS,
|
|
116
|
+
type ContentFormat,
|
|
117
|
+
DEFAULT_MAIL_LAYOUT_SLUG,
|
|
118
|
+
DEFAULT_PDF_LAYOUT_SLUG,
|
|
119
|
+
DOCUMENT_HTML_KINDS,
|
|
120
|
+
type DocumentHtmlKind,
|
|
121
|
+
FALLBACK_LOCALE,
|
|
122
|
+
NON_RENDER_KINDS,
|
|
123
|
+
type NonRenderKind,
|
|
124
|
+
PDF_DEFAULT_MARGIN_MM,
|
|
125
|
+
PDF_FOOTER_MARGIN_MM,
|
|
126
|
+
PDF_HEADER_MARGIN_MM,
|
|
127
|
+
PDF_ORIENTATIONS,
|
|
128
|
+
PDF_PAGE_FORMATS,
|
|
129
|
+
type PdfOrientation,
|
|
130
|
+
type PdfPageFormat,
|
|
131
|
+
RENDER_KINDS,
|
|
132
|
+
type RenderKind,
|
|
133
|
+
SYSTEM_TENANT_ID,
|
|
134
|
+
TEMPLATE_KINDS,
|
|
135
|
+
TEMPLATE_SCOPES,
|
|
136
|
+
TEMPLATE_STATUSES,
|
|
137
|
+
TEXT_BLOCK_KIND,
|
|
138
|
+
type TemplateKind,
|
|
139
|
+
type TemplateScope,
|
|
140
|
+
type TemplateStatus,
|
|
141
|
+
UPSERT_KINDS,
|
|
142
|
+
type UpsertKind,
|
|
143
|
+
} from "./web/constants.ts";
|
|
144
|
+
export {
|
|
145
|
+
DOCUMENT_CONDITION_ATTRIBUTE,
|
|
146
|
+
DOCUMENT_NODE_NAMES,
|
|
147
|
+
DOCUMENT_TEXT_ALIGNMENTS,
|
|
148
|
+
DocumentButton,
|
|
149
|
+
DocumentCondition,
|
|
150
|
+
DocumentDivider,
|
|
151
|
+
DocumentLink,
|
|
152
|
+
DocumentPageBreak,
|
|
153
|
+
DocumentResource,
|
|
154
|
+
DocumentTable,
|
|
155
|
+
DocumentTableCell,
|
|
156
|
+
DocumentTableHeader,
|
|
157
|
+
DocumentTableRow,
|
|
158
|
+
DocumentTextAlign,
|
|
159
|
+
type DocumentTextAlignment,
|
|
160
|
+
DocumentVariable,
|
|
161
|
+
documentExtensions,
|
|
162
|
+
isAllowedDocumentLinkHref,
|
|
163
|
+
isDocumentPlaceholderHref,
|
|
164
|
+
isDocumentReferenceName,
|
|
165
|
+
isDocumentResourceKey,
|
|
166
|
+
} from "./web/document-schema.ts";
|
|
167
|
+
export {
|
|
168
|
+
TEMPLATE_RESOLVER_FEATURE,
|
|
169
|
+
TemplateResolverErrors,
|
|
170
|
+
TemplateResolverHandlers,
|
|
171
|
+
TemplateResolverQueries,
|
|
172
|
+
} from "./web/qualified-names.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HEX_COLOR_PATTERN } from "./constants.ts";
|
|
2
1
|
import { type MailLayoutMeta, readMailLayoutMeta } from "./template-meta.ts";
|
|
2
|
+
import { HEX_COLOR_PATTERN } from "./web/constants.ts";
|
|
3
3
|
|
|
4
4
|
// Every value is a member of a closed set, so it can be written into MJML and inline styles as is.
|
|
5
5
|
export type MailLayoutAppearance = {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
// the renderer did not plan for.
|
|
5
5
|
|
|
6
6
|
import type { Element as ScanElement } from "happy-dom";
|
|
7
|
-
import type { ContentFormat } from "./constants.ts";
|
|
8
7
|
import {
|
|
9
8
|
type DocumentViolation,
|
|
10
9
|
type SanitizeBodyResult,
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
violation,
|
|
14
13
|
withParsedDocument,
|
|
15
14
|
} from "./document-sanitizer.ts";
|
|
15
|
+
import type { ContentFormat } from "./web/constants.ts";
|
|
16
16
|
|
|
17
17
|
const REGION_ATTRIBUTES = ["data-header", "data-content", "data-signature", "data-footer"] as const;
|
|
18
18
|
type RegionAttribute = (typeof REGION_ATTRIBUTES)[number];
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
import {
|
|
13
13
|
createTenantDb,
|
|
14
14
|
type DbConnection,
|
|
15
|
-
deleteMany,
|
|
16
|
-
type EntityTableMeta,
|
|
17
15
|
fetchOne,
|
|
18
16
|
type TenantDb,
|
|
19
17
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
@@ -25,21 +23,22 @@ import {
|
|
|
25
23
|
type TenantId,
|
|
26
24
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
27
25
|
import {
|
|
26
|
+
deleteRowsWithoutReplayableStream,
|
|
28
27
|
getStreamVersion,
|
|
29
28
|
getUnscopedStreamMaxVersionForSeed,
|
|
30
29
|
} from "@cosmicdrift/kumiko-framework/event-store";
|
|
31
30
|
import type { Dispatcher } from "@cosmicdrift/kumiko-framework/pipeline";
|
|
32
31
|
import { runEventStoreSeed, type SeedIfExists } from "@cosmicdrift/kumiko-framework/seeding";
|
|
33
32
|
import { isPlainObject } from "@cosmicdrift/kumiko-types/type-guards";
|
|
34
|
-
import { type ContentFormat, TEXT_BLOCK_KIND, type UpsertKind } from "./constants.ts";
|
|
35
33
|
import { executor } from "./handlers/shared.ts";
|
|
36
34
|
import { evaluateTemplateWrite } from "./handlers/template-gates.ts";
|
|
37
|
-
import { TEMPLATE_RESOLVER_FEATURE, TemplateResolverHandlers } from "./qualified-names.ts";
|
|
38
35
|
import { type TemplateResourceRow, templateResourcesTable } from "./table.ts";
|
|
39
36
|
import type { TemplateBundle } from "./template-bundle.ts";
|
|
40
37
|
import { activeStampChanges, servedStampChanges } from "./template-draft.ts";
|
|
41
38
|
import { templateSlugSchema } from "./template-meta.ts";
|
|
42
39
|
import { variablesFromSchema } from "./template-validation.ts";
|
|
40
|
+
import { type ContentFormat, TEXT_BLOCK_KIND, type UpsertKind } from "./web/constants.ts";
|
|
41
|
+
import { TEMPLATE_RESOLVER_FEATURE, TemplateResolverHandlers } from "./web/qualified-names.ts";
|
|
43
42
|
|
|
44
43
|
/** Drop projection orphans (no events anywhere) so boot seeds can recreate. */
|
|
45
44
|
async function resolveExistingForEventStoreSeed(
|
|
@@ -60,8 +59,7 @@ async function resolveExistingForEventStoreSeed(
|
|
|
60
59
|
`seed orphan check: projection ${id} has no events for tenant ${tenantId} but unscoped stream version is ${unscoped} — refusing delete/recreate to avoid wiping a live stream`,
|
|
61
60
|
);
|
|
62
61
|
}
|
|
63
|
-
|
|
64
|
-
await deleteMany(tdb, templateResourcesTable as EntityTableMeta, { id, tenantId });
|
|
62
|
+
await deleteRowsWithoutReplayableStream(tdb, { table: templateResourcesTable, ids: [id] });
|
|
65
63
|
return null;
|
|
66
64
|
}
|
|
67
65
|
return { id, version: streamVersion };
|
|
@@ -79,11 +77,21 @@ export type SeedSystemTemplateOptions = {
|
|
|
79
77
|
readonly linkedResources?: Record<string, string>;
|
|
80
78
|
readonly meta?: unknown;
|
|
81
79
|
readonly title?: string;
|
|
80
|
+
/** Translatable title for the overview and designer, stored in the title column; the client
|
|
81
|
+
* shows the translation and falls back to the key. Mutually exclusive with `title`. */
|
|
82
|
+
readonly titleI18nKey?: string;
|
|
82
83
|
readonly parentTemplateId?: string | null;
|
|
83
84
|
readonly by?: SessionUser;
|
|
84
85
|
readonly ifExists?: SeedIfExists;
|
|
85
86
|
};
|
|
86
87
|
|
|
88
|
+
function seedTitleColumn(opts: SeedSystemTemplateOptions, label: string): string | null {
|
|
89
|
+
if (opts.title !== undefined && opts.titleI18nKey !== undefined) {
|
|
90
|
+
throw new Error(`${label} rejected: set either title or titleI18nKey, not both`);
|
|
91
|
+
}
|
|
92
|
+
return opts.titleI18nKey ?? opts.title ?? null;
|
|
93
|
+
}
|
|
94
|
+
|
|
87
95
|
export async function seedSystemTemplate(
|
|
88
96
|
db: DbConnection,
|
|
89
97
|
opts: SeedSystemTemplateOptions,
|
|
@@ -95,6 +103,7 @@ export async function seedSystemTemplate(
|
|
|
95
103
|
const label = `seedSystemTemplate ${opts.slug}/${opts.kind}/${opts.locale}`;
|
|
96
104
|
const slug = templateSlugSchema.safeParse(opts.slug);
|
|
97
105
|
if (!slug.success) throw new Error(`${label} rejected: ${slug.error.issues[0]?.message}`);
|
|
106
|
+
const title = seedTitleColumn(opts, label);
|
|
98
107
|
const evaluated = evaluateTemplateWrite({
|
|
99
108
|
kind: opts.kind,
|
|
100
109
|
scope: "system",
|
|
@@ -139,7 +148,7 @@ export async function seedSystemTemplate(
|
|
|
139
148
|
variableSchema,
|
|
140
149
|
...(linkedResources !== undefined && { linkedResources }),
|
|
141
150
|
meta,
|
|
142
|
-
title
|
|
151
|
+
title,
|
|
143
152
|
folder: null,
|
|
144
153
|
scope: "system" as const,
|
|
145
154
|
parentTemplateId,
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
} from "@cosmicdrift/kumiko-framework/files";
|
|
22
22
|
import { fileContextForTenant } from "../file-foundation/index.ts";
|
|
23
23
|
import { extensionForResourceContentType, requireForTenant } from "../shared/index.ts";
|
|
24
|
-
import { ACTIVE_TEMPLATE_STATUS, SYSTEM_TENANT_ID } from "./constants.ts";
|
|
25
24
|
import {
|
|
26
25
|
DEFAULT_RESOURCE_MAX_BYTES,
|
|
27
26
|
MAX_FILE_ATTACHMENTS_PER_TEMPLATE,
|
|
@@ -34,10 +33,11 @@ import {
|
|
|
34
33
|
parseLinkedResourceEntries,
|
|
35
34
|
templatePdfAttachmentLinkSchema,
|
|
36
35
|
} from "./linked-resources.ts";
|
|
37
|
-
import { TemplateResolverErrors } from "./qualified-names.ts";
|
|
38
36
|
import { normalizeResourceImage } from "./resource-image.ts";
|
|
39
37
|
import { type TemplateResourceRow, templateResourcesTable } from "./table.ts";
|
|
40
38
|
import { readTemplateResource } from "./template-resources.ts";
|
|
39
|
+
import { ACTIVE_TEMPLATE_STATUS, SYSTEM_TENANT_ID } from "./web/constants.ts";
|
|
40
|
+
import { TemplateResolverErrors } from "./web/qualified-names.ts";
|
|
41
41
|
|
|
42
42
|
export async function readTemplateResourceMaxBytes(
|
|
43
43
|
config: ConfigAccessor | undefined,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import { CONTENT_FORMATS, UPSERT_KINDS } from "./constants.ts";
|
|
3
|
-
import { isDocumentResourceKey } from "./document-schema.ts";
|
|
4
2
|
import { templatePdfAttachmentLinkSchema } from "./linked-resources.ts";
|
|
5
3
|
import { templateSlugSchema } from "./template-meta.ts";
|
|
4
|
+
import { CONTENT_FORMATS, UPSERT_KINDS } from "./web/constants.ts";
|
|
5
|
+
import { isDocumentResourceKey } from "./web/document-schema.ts";
|
|
6
6
|
|
|
7
7
|
const MAX_RESOURCES = 20;
|
|
8
8
|
const MAX_LOCALES = 50;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Registry } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { isPlainObject, propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
3
|
+
import { isSystemAdmin } from "./template-draft.ts";
|
|
4
|
+
import { SYSTEM_TENANT_ID } from "./web/constants.ts";
|
|
5
|
+
import { TEMPLATE_RESOLVER_FEATURE } from "./web/qualified-names.ts";
|
|
6
|
+
|
|
7
|
+
type DeliveryTarget = { readonly kind: string; readonly slug: string };
|
|
8
|
+
|
|
9
|
+
// What decides whether a tenant row may be served. Independent of who reads: delivery must not
|
|
10
|
+
// change with the caller's roles, so this is not the edit policy.
|
|
11
|
+
export type TemplateDeliveryPolicy = {
|
|
12
|
+
readonly tenantEditable: readonly DeliveryTarget[];
|
|
13
|
+
/** Kinds of collections mounted with an explicit `access`; their tenant rows are edited by design. */
|
|
14
|
+
readonly collectionKinds: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const NOTHING_UNLOCKED: TemplateDeliveryPolicy = { tenantEditable: [], collectionKinds: [] };
|
|
18
|
+
|
|
19
|
+
export function isTenantOverrideServed(
|
|
20
|
+
policy: TemplateDeliveryPolicy,
|
|
21
|
+
target: DeliveryTarget,
|
|
22
|
+
): boolean {
|
|
23
|
+
return (
|
|
24
|
+
policy.collectionKinds.includes(target.kind) ||
|
|
25
|
+
policy.tenantEditable.some((entry) => entry.kind === target.kind && entry.slug === target.slug)
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Served only because its kind belongs to a collection with `access`, not because the template
|
|
30
|
+
// is listed in tenantEditable. For these a system row of the same slug must win.
|
|
31
|
+
export function isServedByCollectionOnly(
|
|
32
|
+
policy: TemplateDeliveryPolicy,
|
|
33
|
+
target: DeliveryTarget,
|
|
34
|
+
): boolean {
|
|
35
|
+
return (
|
|
36
|
+
policy.collectionKinds.includes(target.kind) &&
|
|
37
|
+
!policy.tenantEditable.some((entry) => entry.kind === target.kind && entry.slug === target.slug)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function isRowServed(
|
|
42
|
+
policy: TemplateDeliveryPolicy,
|
|
43
|
+
row: DeliveryTarget & { readonly tenantId: string },
|
|
44
|
+
): boolean {
|
|
45
|
+
return row.tenantId === SYSTEM_TENANT_ID || isTenantOverrideServed(policy, row);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// A SystemAdmin sees every stored row, so a locked override can still be reset; everyone else
|
|
49
|
+
// sees only what is delivered, which keeps a locked override out of the template-resolver queries for a TenantAdmin (the audit log keeps the history).
|
|
50
|
+
export function isRowServedTo(
|
|
51
|
+
policy: TemplateDeliveryPolicy,
|
|
52
|
+
user: { readonly roles: readonly string[] },
|
|
53
|
+
row: DeliveryTarget & { readonly tenantId: string },
|
|
54
|
+
): boolean {
|
|
55
|
+
return isSystemAdmin(user) || isRowServed(policy, row);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function isDeliveryTarget(value: unknown): value is DeliveryTarget {
|
|
59
|
+
return (
|
|
60
|
+
typeof propertyOf(value, "kind") === "string" && typeof propertyOf(value, "slug") === "string"
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function isTemplateDeliveryPolicy(value: unknown): value is TemplateDeliveryPolicy {
|
|
65
|
+
if (!isPlainObject(value)) return false;
|
|
66
|
+
const { tenantEditable, collectionKinds } = value;
|
|
67
|
+
return (
|
|
68
|
+
Array.isArray(tenantEditable) &&
|
|
69
|
+
tenantEditable.every(isDeliveryTarget) &&
|
|
70
|
+
Array.isArray(collectionKinds) &&
|
|
71
|
+
collectionKinds.every((kind) => typeof kind === "string")
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Fail closed: without the mounted feature (or its exports) no tenant row counts as unlocked.
|
|
76
|
+
export function deliveryPolicyOf(registry: Registry): TemplateDeliveryPolicy {
|
|
77
|
+
const exported = propertyOf(
|
|
78
|
+
propertyOf(registry.getFeature(TEMPLATE_RESOLVER_FEATURE), "exports"),
|
|
79
|
+
"deliveryPolicy",
|
|
80
|
+
);
|
|
81
|
+
return isTemplateDeliveryPolicy(exported) ? exported : NOTHING_UNLOCKED;
|
|
82
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
import { CONTENT_FORMATS, type ContentFormat } from "./constants.ts";
|
|
4
3
|
import type { TemplateResourceRow } from "./table.ts";
|
|
4
|
+
import { CONTENT_FORMATS, type ContentFormat } from "./web/constants.ts";
|
|
5
5
|
|
|
6
6
|
const templateDraftSchema = z.object({
|
|
7
7
|
content: z.string().nullable(),
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import {
|
|
3
|
+
type HandlerContext,
|
|
4
|
+
hasAccess,
|
|
5
|
+
type RoleAccessRule,
|
|
6
|
+
type SessionUser,
|
|
7
|
+
} from "@cosmicdrift/kumiko-framework/engine";
|
|
8
|
+
import {
|
|
9
|
+
AccessDeniedError,
|
|
10
|
+
type WriteFailure,
|
|
11
|
+
writeFailure,
|
|
12
|
+
} from "@cosmicdrift/kumiko-framework/errors";
|
|
13
|
+
import { type TemplateResourceRow, templateResourcesTable } from "./table.ts";
|
|
14
|
+
import { isSystemAdmin } from "./template-draft.ts";
|
|
15
|
+
import type { TemplateKind } from "./web/constants.ts";
|
|
16
|
+
import { TemplateResolverErrors } from "./web/qualified-names.ts";
|
|
17
|
+
|
|
18
|
+
export type TenantEditableTemplate = {
|
|
19
|
+
readonly kind: TemplateKind;
|
|
20
|
+
readonly slug: string;
|
|
21
|
+
readonly access: RoleAccessRule;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type TemplateEditPolicy = {
|
|
25
|
+
readonly tenantEditable: readonly TenantEditableTemplate[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type EditTarget = { readonly slug: string; readonly kind: string };
|
|
29
|
+
type EditUser = Pick<SessionUser, "roles">;
|
|
30
|
+
|
|
31
|
+
const SYSTEM_ADMIN_ROLE = "SystemAdmin";
|
|
32
|
+
|
|
33
|
+
export function templateEditAccess(entries: readonly TenantEditableTemplate[]): RoleAccessRule {
|
|
34
|
+
const roles = new Set<string>([SYSTEM_ADMIN_ROLE]);
|
|
35
|
+
for (const entry of entries) {
|
|
36
|
+
for (const role of entry.access.roles) roles.add(role);
|
|
37
|
+
}
|
|
38
|
+
return { roles: [...roles] };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function mayEditTemplate(
|
|
42
|
+
policy: TemplateEditPolicy,
|
|
43
|
+
user: EditUser,
|
|
44
|
+
target: EditTarget,
|
|
45
|
+
): boolean {
|
|
46
|
+
if (isSystemAdmin(user)) return true;
|
|
47
|
+
const entry = policy.tenantEditable.find(
|
|
48
|
+
(candidate) => candidate.slug === target.slug && candidate.kind === target.kind,
|
|
49
|
+
);
|
|
50
|
+
return entry !== undefined && hasAccess(user, entry.access);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function refuseTemplateEdit(
|
|
54
|
+
policy: TemplateEditPolicy,
|
|
55
|
+
user: EditUser,
|
|
56
|
+
target: EditTarget,
|
|
57
|
+
): WriteFailure | null {
|
|
58
|
+
if (mayEditTemplate(policy, user, target)) return null;
|
|
59
|
+
return writeFailure(
|
|
60
|
+
new AccessDeniedError({
|
|
61
|
+
i18nKey: "templateResolver.errors.templateNotTenantEditable",
|
|
62
|
+
details: { reason: TemplateResolverErrors.templateNotTenantEditable },
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Fail closed: a missing row gives a non-SystemAdmin the same refusal as a locked one,
|
|
68
|
+
// so the response never reveals whether an id exists. SystemAdmin keeps the 404.
|
|
69
|
+
export function refuseMissingTemplate(
|
|
70
|
+
policy: TemplateEditPolicy,
|
|
71
|
+
user: EditUser,
|
|
72
|
+
): WriteFailure | null {
|
|
73
|
+
return isSystemAdmin(user) ? null : refuseTemplateEdit(policy, user, { slug: "", kind: "" });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function refuseTemplateEditById(
|
|
77
|
+
db: HandlerContext["db"],
|
|
78
|
+
policy: TemplateEditPolicy,
|
|
79
|
+
user: EditUser,
|
|
80
|
+
tenantId: string,
|
|
81
|
+
templateId: string,
|
|
82
|
+
): Promise<WriteFailure | null> {
|
|
83
|
+
if (isSystemAdmin(user)) return null;
|
|
84
|
+
const row = await fetchOne<TemplateResourceRow>(db, templateResourcesTable, {
|
|
85
|
+
tenantId,
|
|
86
|
+
id: templateId,
|
|
87
|
+
});
|
|
88
|
+
return row === undefined
|
|
89
|
+
? refuseMissingTemplate(policy, user)
|
|
90
|
+
: refuseTemplateEdit(policy, user, row);
|
|
91
|
+
}
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
PDF_ORIENTATIONS,
|
|
5
5
|
PDF_PAGE_FORMATS,
|
|
6
6
|
type TemplateKind,
|
|
7
|
-
} from "./constants.ts";
|
|
8
|
-
import { MAIL_TONES, type MailTone } from "./mail-constants.ts";
|
|
7
|
+
} from "./web/constants.ts";
|
|
8
|
+
import { MAIL_TONES, type MailTone } from "./web/mail-constants.ts";
|
|
9
9
|
|
|
10
10
|
// One or more kebab segments joined by ":" — notification templates are seeded
|
|
11
11
|
// under their qualified name `feature:notify:name`.
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type SessionUser,
|
|
5
5
|
type TemplateListVariableDef,
|
|
6
6
|
type TemplateScalarVariableDef,
|
|
7
|
+
type TemplateVariableDef,
|
|
7
8
|
type TemplateVariables,
|
|
8
9
|
templateVariablesToZod,
|
|
9
10
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
@@ -29,13 +30,6 @@ import {
|
|
|
29
30
|
} from "../renderer-foundation/index.ts";
|
|
30
31
|
import { createTemplateResolverApi, TemplateNotFoundError, type TemplateResource } from "./api.ts";
|
|
31
32
|
import { collectDocumentResourceKeys } from "./compile-document-body.ts";
|
|
32
|
-
import {
|
|
33
|
-
DEFAULT_MAIL_LAYOUT_SLUG,
|
|
34
|
-
DEFAULT_PDF_LAYOUT_SLUG,
|
|
35
|
-
MAIL_PREVIEW_MAX_BYTES,
|
|
36
|
-
SYSTEM_TENANT_ID,
|
|
37
|
-
type TemplateScope,
|
|
38
|
-
} from "./constants.ts";
|
|
39
33
|
import { parseStoredJson } from "./handlers/template-gates.ts";
|
|
40
34
|
import { validateTemplateDraft } from "./handlers/validate.query.ts";
|
|
41
35
|
import {
|
|
@@ -46,8 +40,8 @@ import {
|
|
|
46
40
|
} from "./layout-regions.ts";
|
|
47
41
|
import { type LinkedResourceEntry, parseLinkedResourceEntries } from "./linked-resources.ts";
|
|
48
42
|
import { buildDisplayHtml } from "./preview-display-html.ts";
|
|
49
|
-
import { TemplateResolverErrors } from "./qualified-names.ts";
|
|
50
43
|
import { type TemplateResourceRow, templateResourcesTable } from "./table.ts";
|
|
44
|
+
import { deliveryPolicyOf, isRowServedTo } from "./template-delivery-policy.ts";
|
|
51
45
|
import {
|
|
52
46
|
isMailTemplateMeta,
|
|
53
47
|
type MailTemplateMeta,
|
|
@@ -55,6 +49,14 @@ import {
|
|
|
55
49
|
parseTemplateMeta,
|
|
56
50
|
readPdfTemplateMeta,
|
|
57
51
|
} from "./template-meta.ts";
|
|
52
|
+
import {
|
|
53
|
+
DEFAULT_MAIL_LAYOUT_SLUG,
|
|
54
|
+
DEFAULT_PDF_LAYOUT_SLUG,
|
|
55
|
+
MAIL_PREVIEW_MAX_BYTES,
|
|
56
|
+
SYSTEM_TENANT_ID,
|
|
57
|
+
type TemplateScope,
|
|
58
|
+
} from "./web/constants.ts";
|
|
59
|
+
import { TemplateResolverErrors } from "./web/qualified-names.ts";
|
|
58
60
|
|
|
59
61
|
const SAMPLE_LINK = "https://example.com";
|
|
60
62
|
const SAMPLE_DATE = "2026-01-15";
|
|
@@ -120,6 +122,12 @@ function sampleList(def: TemplateListVariableDef, labelText: LabelText): Record<
|
|
|
120
122
|
return rows;
|
|
121
123
|
}
|
|
122
124
|
|
|
125
|
+
function sampleValueFor(name: string, def: TemplateVariableDef, labelText: LabelText): unknown {
|
|
126
|
+
// An images variable has no sample: file ids are record data, never preview content.
|
|
127
|
+
if (def.type === "images") return [];
|
|
128
|
+
return def.type === "list" ? sampleList(def, labelText) : sampleScalar(name, def, labelText);
|
|
129
|
+
}
|
|
130
|
+
|
|
123
131
|
// Declared examples win; the fallbacks are deterministic so a preview never differs between calls.
|
|
124
132
|
export function sampleValuesFor(
|
|
125
133
|
variables: TemplateVariables,
|
|
@@ -127,8 +135,7 @@ export function sampleValuesFor(
|
|
|
127
135
|
): Record<string, unknown> {
|
|
128
136
|
const values: Record<string, unknown> = {};
|
|
129
137
|
for (const [name, def] of Object.entries(variables)) {
|
|
130
|
-
values[name] =
|
|
131
|
-
def.type === "list" ? sampleList(def, labelText) : sampleScalar(name, def, labelText);
|
|
138
|
+
values[name] = sampleValueFor(name, def, labelText);
|
|
132
139
|
}
|
|
133
140
|
return values;
|
|
134
141
|
}
|
|
@@ -228,7 +235,7 @@ async function loadStoredDraft(
|
|
|
228
235
|
input: TemplatePreviewInput,
|
|
229
236
|
): Promise<TemplateResource | null> {
|
|
230
237
|
try {
|
|
231
|
-
return await createTemplateResolverApi(ctx.db).resolveTemplate({
|
|
238
|
+
return await createTemplateResolverApi(ctx.db, ctx.registry).resolveTemplate({
|
|
232
239
|
tenantId: user.tenantId,
|
|
233
240
|
slug: input.slug,
|
|
234
241
|
kind: input.kind,
|
|
@@ -320,6 +327,9 @@ async function loadEditedRowResources(
|
|
|
320
327
|
{ limit: 1 },
|
|
321
328
|
);
|
|
322
329
|
const row = rows[0];
|
|
330
|
+
if (row !== undefined && !isRowServedTo(deliveryPolicyOf(ctx.registry), user, row)) {
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
323
333
|
return row === undefined ? undefined : parseLinkedResourceEntries(row.linkedResources);
|
|
324
334
|
}
|
|
325
335
|
|
|
@@ -329,7 +339,7 @@ async function resolvePdfLayout(
|
|
|
329
339
|
slug: string,
|
|
330
340
|
locale: string,
|
|
331
341
|
): Promise<PreviewLayout | null> {
|
|
332
|
-
const api = createTemplateResolverApi(ctx.db);
|
|
342
|
+
const api = createTemplateResolverApi(ctx.db, ctx.registry);
|
|
333
343
|
const find = async (tenantId: string): Promise<TemplateResource | null> => {
|
|
334
344
|
try {
|
|
335
345
|
return await api.resolveLayout({ tenantId, slug, kind: "pdf-layout", locale });
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
parseQn,
|
|
4
4
|
type Registry,
|
|
5
5
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
6
|
-
import { DEFAULT_MAIL_LAYOUT_SLUG, type TemplateKind } from "./constants.ts";
|
|
6
|
+
import { DEFAULT_MAIL_LAYOUT_SLUG, type TemplateKind } from "./web/constants.ts";
|
|
7
7
|
|
|
8
8
|
type UsageRole = "template" | "layout";
|
|
9
9
|
|