@cosmicdrift/kumiko-samples 0.378.0 → 0.380.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-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 +0 -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/global-feature-state-table.ts +14 -13
- 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/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/job-run-table.ts +4 -3
- 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/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 +3 -3
- 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/schema/user-session.ts +2 -3
- 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 +43 -0
- package/packages/bundled-features/src/template-resolver/compile-document-body.ts +1 -1
- 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 +4 -4
- package/packages/bundled-features/src/template-resolver/feature.ts +13 -4
- 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 +19 -2
- package/packages/bundled-features/src/template-resolver/handlers/copy-locale.write.ts +2 -2
- 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 +1 -1
- 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/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 +68 -10
- package/packages/bundled-features/src/template-resolver/handlers/patch-draft.write.ts +1 -1
- 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 +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/set.write.ts +1 -1
- 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/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 +60 -59
- 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 +2 -2
- package/packages/bundled-features/src/template-resolver/template-meta.ts +2 -2
- package/packages/bundled-features/src/template-resolver/template-preview.ts +14 -10
- package/packages/bundled-features/src/template-resolver/template-usage.ts +1 -1
- package/packages/bundled-features/src/template-resolver/template-validation.ts +2 -2
- 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} +7 -10
- package/packages/bundled-features/src/template-resolver/{document-blocks.ts → web/document-blocks.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/web/document-editor-extensions.ts +2 -3
- package/packages/bundled-features/src/template-resolver/web/document-editor.tsx +0 -1
- package/packages/bundled-features/src/template-resolver/{document-images.ts → web/document-images.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/{document-schema.ts → web/document-schema.ts} +0 -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 +6 -7
- package/packages/bundled-features/src/template-resolver/web/document-toolbar-blocks.ts +2 -3
- package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -2
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +2 -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} +0 -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/seed-rental.ts +17 -1
- package/samples/apps/ui-walkthrough/src/app/seed-templates.ts +11 -0
- package/samples/apps/ui-walkthrough/src/app/server.ts +2 -1
- 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 +61 -7
- package/samples/apps/ui-walkthrough/src/features/rental/i18n.ts +48 -24
- package/samples/apps/ui-walkthrough/src/features/rental/invoice-receive.ts +0 -1
- package/samples/apps/ui-walkthrough/src/features/rental/lease-support.ts +17 -1
- package/samples/apps/ui-walkthrough/src/features/rental/qualified-names.ts +3 -0
- package/samples/apps/ui-walkthrough/src/features/rental/receipts-upload.ts +70 -0
- package/samples/apps/ui-walkthrough/src/features/rental/screens.ts +90 -13
- package/samples/apps/ui-walkthrough/src/features/rental/web/index.ts +0 -2
- 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/run-config.ts +11 -0
- package/samples/apps/use-all-bundled/e2e-billing-gallery/server.ts +1 -1
- package/samples/apps/use-all-bundled/feature-manifest.json +4 -4
- 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/embedded/README.md +5 -5
- package/samples/recipes/embedded/src/handlers/invoice-receive.write.ts +0 -1
- package/samples/recipes/embedded/src/screens/invoice-receive.screen.ts +9 -12
- 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
- package/samples/apps/ui-walkthrough/src/features/rental/web/upload-standard-layout.tsx +0 -61
|
@@ -5,10 +5,11 @@ import {
|
|
|
5
5
|
SYSTEM_TENANT_ID,
|
|
6
6
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
7
7
|
import { isPlainObject } from "@cosmicdrift/kumiko-types/type-guards";
|
|
8
|
-
import type { DocumentHtmlKind } from "../constants.ts";
|
|
9
8
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
9
|
+
import { deliveryPolicyOf, isRowServedTo } from "../template-delivery-policy.ts";
|
|
10
10
|
import { isHiddenSystemDraft, toWorkingRow } from "../template-draft.ts";
|
|
11
11
|
import { isSystemOnlyTemplateHiddenFrom } from "../template-system-only.ts";
|
|
12
|
+
import type { DocumentHtmlKind } from "../web/constants.ts";
|
|
12
13
|
import { parseStoredJson } from "./template-gates.ts";
|
|
13
14
|
|
|
14
15
|
export type DocumentBase = {
|
|
@@ -45,7 +46,12 @@ export async function loadDocumentBase(
|
|
|
45
46
|
tenantId: user.tenantId,
|
|
46
47
|
...where,
|
|
47
48
|
});
|
|
48
|
-
|
|
49
|
+
// A locked override is neither shown nor edited by a non-SystemAdmin; the served system default is.
|
|
50
|
+
const ownIsVisible =
|
|
51
|
+
own !== undefined &&
|
|
52
|
+
!isSystemOnlyTemplateHiddenFrom(user, ctx.registry, own) &&
|
|
53
|
+
isRowServedTo(deliveryPolicyOf(ctx.registry), user, own);
|
|
54
|
+
if (own !== undefined && ownIsVisible) {
|
|
49
55
|
const working = toWorkingRow(own, user.tenantId);
|
|
50
56
|
return {
|
|
51
57
|
rowId: String(own.id),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { NotFoundError } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
3
|
import * as z from "zod";
|
|
4
|
-
import { DOCUMENT_HTML_KINDS } from "../constants.ts";
|
|
5
|
-
import { documentBlocksForKind } from "../document-blocks.ts";
|
|
6
4
|
import { documentBlocksOf } from "../document-ops.ts";
|
|
7
5
|
import { parseDocumentJson } from "../document-sanitizer.ts";
|
|
8
6
|
import { resolveTemplateVariables } from "../template-validation.ts";
|
|
7
|
+
import { DOCUMENT_HTML_KINDS } from "../web/constants.ts";
|
|
8
|
+
import { documentBlocksForKind } from "../web/document-blocks.ts";
|
|
9
9
|
import { loadDocumentBase } from "./document-base.ts";
|
|
10
10
|
import { localeSchema, templateSlugSchema } from "./shared.ts";
|
|
11
11
|
import { knownResourceKeysFor } from "./validate.query.ts";
|
|
@@ -3,16 +3,18 @@ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
|
3
3
|
import { defineQueryHandler, SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
|
|
4
4
|
import { NotFoundError, ValidationError } from "@cosmicdrift/kumiko-framework/errors";
|
|
5
5
|
import * as z from "zod";
|
|
6
|
+
import { filterDeliveredTo } from "../api.ts";
|
|
6
7
|
import {
|
|
7
8
|
isFileAttachmentEntry,
|
|
8
9
|
isPdfAttachmentLink,
|
|
9
10
|
type LinkedResourceEntry,
|
|
10
11
|
parseLinkedResourceEntries,
|
|
11
12
|
} from "../linked-resources.ts";
|
|
12
|
-
import { TemplateResolverErrors } from "../qualified-names.ts";
|
|
13
13
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
14
14
|
import type { TemplateBundle } from "../template-bundle.ts";
|
|
15
|
+
import { deliveryPolicyOf } from "../template-delivery-policy.ts";
|
|
15
16
|
import { readTemplateResource } from "../template-resources.ts";
|
|
17
|
+
import { TemplateResolverErrors } from "../web/qualified-names.ts";
|
|
16
18
|
import { kindSchema, templateSlugSchema } from "./shared.ts";
|
|
17
19
|
import { parseStoredJson, storedRecord } from "./template-gates.ts";
|
|
18
20
|
|
|
@@ -94,7 +96,8 @@ export const exportBundleQuery = defineQueryHandler({
|
|
|
94
96
|
? { tenantId: SYSTEM_TENANT_ID, slug, kind, scope: "system", status: "active" }
|
|
95
97
|
: { tenantId: query.user.tenantId, slug, kind, scope: "tenant" },
|
|
96
98
|
);
|
|
97
|
-
const
|
|
99
|
+
const policy = deliveryPolicyOf(ctx.registry);
|
|
100
|
+
const rows = (await filterDeliveredTo(ctx.db, policy, query.user, found))
|
|
98
101
|
.filter((row) => row.status !== "archived")
|
|
99
102
|
.sort((a, b) => a.locale.localeCompare(b.locale));
|
|
100
103
|
const first = rows[0];
|
|
@@ -2,6 +2,7 @@ import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
|
2
2
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
5
|
+
import { deliveryPolicyOf, isRowServedTo } from "../template-delivery-policy.ts";
|
|
5
6
|
import { draftViewerTenantId, isHiddenSystemDraft, toWorkingRow } from "../template-draft.ts";
|
|
6
7
|
import { isSystemOnlyTemplateHiddenFrom } from "../template-system-only.ts";
|
|
7
8
|
|
|
@@ -15,7 +16,7 @@ export const findByIdQuery = defineQueryHandler({
|
|
|
15
16
|
schema: z.object({ id: z.string().min(1) }),
|
|
16
17
|
access: { roles: ["TenantAdmin", "SystemAdmin", "User"] },
|
|
17
18
|
description:
|
|
18
|
-
"Reads the version of one template resource an editor works on, by row id: the open draft if there is one (status draft), else the stored version, with content, variable schema and scope, but only when it belongs to the caller's tenant or is a served system default (a never-served system draft is visible to a SystemAdmin only); `active` is the version number and since-time the resolver serves, null when none is served. Use it to load a template into the admin editor.",
|
|
19
|
+
"Reads the version of one template resource an editor works on, by row id: the open draft if there is one (status draft), else the stored version, with content, variable schema and scope, but only when it belongs to the caller's tenant or is a served system default (an override of a template that is not tenantEditable is not delivered and is visible to a SystemAdmin only) (a never-served system draft is visible to a SystemAdmin only); `active` is the version number and since-time the resolver serves, null when none is served. Use it to load a template into the admin editor.",
|
|
19
20
|
handler: async (query, ctx) => {
|
|
20
21
|
const stored = await fetchOne<TemplateResourceRow>(ctx.db, templateResourcesTable, {
|
|
21
22
|
id: query.payload.id,
|
|
@@ -23,7 +24,8 @@ export const findByIdQuery = defineQueryHandler({
|
|
|
23
24
|
if (
|
|
24
25
|
!stored ||
|
|
25
26
|
isHiddenSystemDraft(query.user, stored) ||
|
|
26
|
-
isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, stored)
|
|
27
|
+
isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, stored) ||
|
|
28
|
+
!isRowServedTo(deliveryPolicyOf(ctx.registry), query.user, stored)
|
|
27
29
|
) {
|
|
28
30
|
return null;
|
|
29
31
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import * as z from "zod";
|
|
4
|
-
import {
|
|
4
|
+
import { filterDeliveredTo } from "../api.ts";
|
|
5
5
|
import { type LayoutRegions, readLayoutRegions } from "../layout-regions.ts";
|
|
6
6
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
7
|
+
import { deliveryPolicyOf } from "../template-delivery-policy.ts";
|
|
7
8
|
import {
|
|
8
9
|
type ActiveInfo,
|
|
9
10
|
draftViewerTenantId,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
type WorkingRow,
|
|
13
14
|
} from "../template-draft.ts";
|
|
14
15
|
import { type MailLayoutMeta, readMailLayoutMeta } from "../template-meta.ts";
|
|
16
|
+
import { FALLBACK_LOCALE } from "../web/constants.ts";
|
|
15
17
|
import { localeSchema, templateSlugSchema } from "./shared.ts";
|
|
16
18
|
import { parseStoredJson } from "./template-gates.ts";
|
|
17
19
|
|
|
@@ -141,10 +143,13 @@ export const layoutSourceQuery = defineQueryHandler({
|
|
|
141
143
|
handler: async (query, ctx): Promise<LayoutSourceResponse> => {
|
|
142
144
|
const { kind, slug, locale } = query.payload;
|
|
143
145
|
const isSystemAdmin = query.user.roles.includes("SystemAdmin");
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
const policy = deliveryPolicyOf(ctx.registry);
|
|
147
|
+
const rows = await filterDeliveredTo(
|
|
148
|
+
ctx.db,
|
|
149
|
+
policy,
|
|
150
|
+
query.user,
|
|
151
|
+
await selectMany<TemplateResourceRow>(ctx.db, templateResourcesTable, { kind, slug }),
|
|
152
|
+
);
|
|
148
153
|
const { tenantRow, systemRow } = pickEditedRows(rows, query.user, locale);
|
|
149
154
|
return buildLayoutSource({ kind, locale, isSystemAdmin, tenantRow, systemRow });
|
|
150
155
|
},
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import * as z from "zod";
|
|
4
|
-
import { TEMPLATE_KINDS, TEMPLATE_STATUSES } from "../constants.ts";
|
|
5
4
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
5
|
+
import { deliveryPolicyOf, isRowServedTo } from "../template-delivery-policy.ts";
|
|
6
6
|
import { isHiddenSystemDraft } from "../template-draft.ts";
|
|
7
7
|
import { isSystemOnlyTemplateHiddenFrom } from "../template-system-only.ts";
|
|
8
|
+
import { TEMPLATE_KINDS, TEMPLATE_STATUSES } from "../web/constants.ts";
|
|
8
9
|
|
|
9
10
|
// ctx.db is tenant-scoped even for SystemAdmin: every caller sees its own
|
|
10
11
|
// tenant's rows plus the system defaults, never another tenant's rows.
|
|
@@ -45,11 +46,13 @@ export const listQuery = defineQueryHandler({
|
|
|
45
46
|
limit: 500,
|
|
46
47
|
})) as TemplateResourceRow[];
|
|
47
48
|
|
|
49
|
+
const deliveryPolicy = deliveryPolicyOf(ctx.registry);
|
|
48
50
|
return rows
|
|
49
51
|
.filter(
|
|
50
52
|
(row) =>
|
|
51
53
|
!isHiddenSystemDraft(query.user, row) &&
|
|
52
|
-
!isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, row)
|
|
54
|
+
!isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, row) &&
|
|
55
|
+
isRowServedTo(deliveryPolicy, query.user, row),
|
|
53
56
|
)
|
|
54
57
|
.map((row) => ({
|
|
55
58
|
id: String(row.id),
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import * as z from "zod";
|
|
4
|
-
import { DEFAULT_MAIL_LAYOUT_SLUG, FALLBACK_LOCALE, type TemplateStatus } from "../constants.ts";
|
|
5
4
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
5
|
+
import {
|
|
6
|
+
deliveryPolicyOf,
|
|
7
|
+
isTenantOverrideServed,
|
|
8
|
+
type TemplateDeliveryPolicy,
|
|
9
|
+
} from "../template-delivery-policy.ts";
|
|
6
10
|
import {
|
|
7
11
|
activeSinceOf,
|
|
8
12
|
activeVersionOf,
|
|
@@ -14,12 +18,18 @@ import {
|
|
|
14
18
|
import { mayEditTemplate, type TemplateEditPolicy } from "../template-edit-policy.ts";
|
|
15
19
|
import { isSystemOnlyTemplateHiddenFrom } from "../template-system-only.ts";
|
|
16
20
|
import { collectTemplateUsage, type EffectiveMailLayoutSlugs } from "../template-usage.ts";
|
|
21
|
+
import {
|
|
22
|
+
DEFAULT_MAIL_LAYOUT_SLUG,
|
|
23
|
+
FALLBACK_LOCALE,
|
|
24
|
+
type TemplateStatus,
|
|
25
|
+
} from "../web/constants.ts";
|
|
17
26
|
import { storedRecord } from "./template-gates.ts";
|
|
18
27
|
|
|
19
28
|
const OVERVIEW_KINDS = ["mail", "document-pdf", "mail-layout", "pdf-layout"] as const;
|
|
20
29
|
type OverviewKind = (typeof OVERVIEW_KINDS)[number];
|
|
21
30
|
|
|
22
31
|
const OVERVIEW_ROW_LIMIT = 5000;
|
|
32
|
+
const LOCKED_OVERRIDE_I18N_KEY = "templateResolver.overview.lockedOverride";
|
|
23
33
|
|
|
24
34
|
export type OverviewOrigin = "tenant" | "system";
|
|
25
35
|
export type OverviewKindGroup = "mail" | "pdf" | "layout";
|
|
@@ -45,6 +55,13 @@ export type OverviewRow = {
|
|
|
45
55
|
readonly activeSince: string | null;
|
|
46
56
|
readonly systemVersion: number | null;
|
|
47
57
|
readonly layoutSlug: string | null;
|
|
58
|
+
/** SystemAdmin only: a tenant override is stored but not delivered because the template is not unlocked for tenants. */
|
|
59
|
+
readonly lockedOverride: boolean;
|
|
60
|
+
readonly lockedOverrideI18nKey: string | null;
|
|
61
|
+
/** Tenant row a reset acts on (resetToSystem takes a row id, the overview row is a slug group); set only while a system version exists to fall back to. */
|
|
62
|
+
readonly lockedOverrideId: string | null;
|
|
63
|
+
/** False when a locked override has no system version to fall back to, so a reset would be refused. */
|
|
64
|
+
readonly canResetLockedOverride: boolean;
|
|
48
65
|
readonly modifiedAt: string;
|
|
49
66
|
readonly usedBy: readonly OverviewUsage[];
|
|
50
67
|
readonly usedByCount: number;
|
|
@@ -88,23 +105,54 @@ function preferredRow(rows: readonly TemplateResourceRow[]): TemplateResourceRow
|
|
|
88
105
|
);
|
|
89
106
|
}
|
|
90
107
|
|
|
91
|
-
type EffectiveRows = {
|
|
108
|
+
type EffectiveRows = {
|
|
109
|
+
readonly origin: OverviewOrigin;
|
|
110
|
+
readonly rows: TemplateResourceRow[];
|
|
111
|
+
readonly lockedOverride: boolean;
|
|
112
|
+
readonly lockedOverrideId: string | null;
|
|
113
|
+
};
|
|
92
114
|
|
|
93
|
-
|
|
115
|
+
// A tenant row of a template that is not unlocked is not delivered, so the system version is the effective one.
|
|
116
|
+
function effectiveRowsOf(
|
|
117
|
+
rows: readonly TemplateResourceRow[],
|
|
118
|
+
policy: TemplateDeliveryPolicy,
|
|
119
|
+
): EffectiveRows | null {
|
|
94
120
|
const tenantRows = rows.filter((row) => row.scope === "tenant");
|
|
95
121
|
const systemRows = rows.filter((row) => row.scope === "system");
|
|
96
122
|
const live = (list: TemplateResourceRow[]) => list.filter((row) => row.status !== "archived");
|
|
97
123
|
const liveTenant = live(tenantRows);
|
|
98
|
-
|
|
124
|
+
const tenantServed = tenantRows.every((row) => isTenantOverrideServed(policy, row));
|
|
125
|
+
if (!tenantServed && liveTenant.length > 0) {
|
|
126
|
+
const liveSystem = live(systemRows);
|
|
127
|
+
if (systemRows.length === 0)
|
|
128
|
+
return { origin: "tenant", rows: liveTenant, lockedOverride: true, lockedOverrideId: null };
|
|
129
|
+
const lockedRow = preferredRow(liveTenant);
|
|
130
|
+
return {
|
|
131
|
+
origin: "system",
|
|
132
|
+
rows: liveSystem.length > 0 ? liveSystem : systemRows,
|
|
133
|
+
lockedOverride: true,
|
|
134
|
+
lockedOverrideId: lockedRow === undefined ? null : String(lockedRow.id),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (liveTenant.length > 0)
|
|
138
|
+
return { origin: "tenant", rows: liveTenant, lockedOverride: false, lockedOverrideId: null };
|
|
99
139
|
if (systemRows.length > 0) {
|
|
100
140
|
const liveSystem = live(systemRows);
|
|
101
|
-
return {
|
|
141
|
+
return {
|
|
142
|
+
origin: "system",
|
|
143
|
+
rows: liveSystem.length > 0 ? liveSystem : systemRows,
|
|
144
|
+
lockedOverride: false,
|
|
145
|
+
lockedOverrideId: null,
|
|
146
|
+
};
|
|
102
147
|
}
|
|
103
|
-
return tenantRows.length > 0
|
|
148
|
+
return tenantRows.length > 0
|
|
149
|
+
? { origin: "tenant", rows: tenantRows, lockedOverride: false, lockedOverrideId: null }
|
|
150
|
+
: null;
|
|
104
151
|
}
|
|
105
152
|
|
|
106
153
|
export function effectiveMailLayoutSlugs(
|
|
107
154
|
rows: readonly TemplateResourceRow[],
|
|
155
|
+
policy: TemplateDeliveryPolicy,
|
|
108
156
|
): EffectiveMailLayoutSlugs {
|
|
109
157
|
const byLocale = new Map<string, TemplateResourceRow[]>();
|
|
110
158
|
for (const row of rows) {
|
|
@@ -114,7 +162,10 @@ export function effectiveMailLayoutSlugs(
|
|
|
114
162
|
}
|
|
115
163
|
const bySlug = new Map<string, Map<string, string>>();
|
|
116
164
|
for (const group of byLocale.values()) {
|
|
117
|
-
const
|
|
165
|
+
const effectiveRows = effectiveRowsOf(group, policy);
|
|
166
|
+
// A locked tenant row without a system row is not delivered, so it names no layout.
|
|
167
|
+
if (effectiveRows?.lockedOverride && effectiveRows.origin === "tenant") continue;
|
|
168
|
+
const effective = effectiveRows?.rows[0];
|
|
118
169
|
// All-archived: the renderer falls back to the code-registered template.
|
|
119
170
|
if (effective === undefined || effective.status === "archived") continue;
|
|
120
171
|
const locales = bySlug.get(effective.slug) ?? new Map<string, string>();
|
|
@@ -191,6 +242,7 @@ function versionFieldsOf(
|
|
|
191
242
|
function buildDrafts(
|
|
192
243
|
groups: ReadonlyMap<string, readonly TemplateResourceRow[]>,
|
|
193
244
|
user: { readonly tenantId: string; readonly roles: readonly string[] },
|
|
245
|
+
policy: TemplateDeliveryPolicy,
|
|
194
246
|
): {
|
|
195
247
|
readonly drafts: OverviewDraft[];
|
|
196
248
|
readonly layoutSlugByDocument: Map<string, string>;
|
|
@@ -198,7 +250,7 @@ function buildDrafts(
|
|
|
198
250
|
const layoutSlugByDocument = new Map<string, string>();
|
|
199
251
|
const drafts: OverviewDraft[] = [];
|
|
200
252
|
for (const [id, groupRows] of groups) {
|
|
201
|
-
const effective = effectiveRowsOf(groupRows);
|
|
253
|
+
const effective = effectiveRowsOf(groupRows, policy);
|
|
202
254
|
const preferred = effective === null ? undefined : preferredRow(effective.rows);
|
|
203
255
|
if (effective === null || preferred === undefined) continue;
|
|
204
256
|
if (!isOverviewKind(preferred.kind) || !isTemplateStatus(preferred.status)) continue;
|
|
@@ -218,6 +270,10 @@ function buildDrafts(
|
|
|
218
270
|
status: preferred.status,
|
|
219
271
|
...versionFieldsOf(user, preferred, groupRows),
|
|
220
272
|
layoutSlug,
|
|
273
|
+
lockedOverride: effective.lockedOverride,
|
|
274
|
+
lockedOverrideI18nKey: effective.lockedOverride ? LOCKED_OVERRIDE_I18N_KEY : null,
|
|
275
|
+
lockedOverrideId: effective.lockedOverrideId,
|
|
276
|
+
canResetLockedOverride: effective.lockedOverrideId !== null,
|
|
221
277
|
modifiedAt: modifiedAtOf(preferred),
|
|
222
278
|
});
|
|
223
279
|
}
|
|
@@ -287,7 +343,7 @@ export function makeOverviewQuery(policy: TemplateEditPolicy) {
|
|
|
287
343
|
}),
|
|
288
344
|
access: { roles: ["TenantAdmin", "SystemAdmin"] },
|
|
289
345
|
description:
|
|
290
|
-
"Lists mail, PDF and layout templates as one row per slug and kind for the caller's tenant (optionally only the mails and PDFs using one layout slug): where the effective version comes from (own override or system), its locales, status and version (the served one; `draftVersion` is set when an unpublished draft waits beside it, `activeSince` says since when the served version applies), the system version it overrides, the layout it uses and which notifications or templates use it; templates of notifications registered with `systemOnly` are listed for SystemAdmins only, and a TenantAdmin sees only the templates the app lists in tenantEditable; use it to browse and filter all templates at a glance.",
|
|
346
|
+
"Lists mail, PDF and layout templates as one row per slug and kind for the caller's tenant (optionally only the mails and PDFs using one layout slug): where the effective version comes from (own override or system), its locales, status and version (the served one; `draftVersion` is set when an unpublished draft waits beside it, `activeSince` says since when the served version applies), the system version it overrides, the layout it uses and which notifications or templates use it; templates of notifications registered with `systemOnly` are listed for SystemAdmins only, and a TenantAdmin sees only the templates the app lists in tenantEditable; a tenant override of a template that is not listed is not delivered, so the row shows the system version with `lockedOverride` true (SystemAdmin only); use it to browse and filter all templates at a glance.",
|
|
291
347
|
handler: async (query, ctx) => {
|
|
292
348
|
const payload = query.payload;
|
|
293
349
|
const fetchedRows = await selectMany<TemplateResourceRow>(
|
|
@@ -310,11 +366,13 @@ export function makeOverviewQuery(policy: TemplateEditPolicy) {
|
|
|
310
366
|
!isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, row) &&
|
|
311
367
|
mayEditTemplate(policy, query.user, row),
|
|
312
368
|
);
|
|
369
|
+
const deliveryPolicy = deliveryPolicyOf(ctx.registry);
|
|
313
370
|
const { drafts, layoutSlugByDocument } = buildDrafts(
|
|
314
371
|
groupBySlugAndKind(visibleRows),
|
|
315
372
|
query.user,
|
|
373
|
+
deliveryPolicy,
|
|
316
374
|
);
|
|
317
|
-
const effectiveLayouts = effectiveMailLayoutSlugs(visibleRows);
|
|
375
|
+
const effectiveLayouts = effectiveMailLayoutSlugs(visibleRows, deliveryPolicy);
|
|
318
376
|
const overviewRows = drafts.map((draft) =>
|
|
319
377
|
withUsage(draft, layoutSlugByDocument, ctx.registry, effectiveLayouts),
|
|
320
378
|
);
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
writeFailure,
|
|
8
8
|
} from "@cosmicdrift/kumiko-framework/errors";
|
|
9
9
|
import * as z from "zod";
|
|
10
|
-
import { DOCUMENT_HTML_KINDS } from "../constants.ts";
|
|
11
10
|
import { applyDocumentOps, documentOpsSchema } from "../document-ops.ts";
|
|
12
11
|
import { parseDocumentJson, serializeDocumentJson } from "../document-sanitizer.ts";
|
|
13
12
|
import {
|
|
@@ -16,6 +15,7 @@ import {
|
|
|
16
15
|
templateEditAccess,
|
|
17
16
|
} from "../template-edit-policy.ts";
|
|
18
17
|
import { resolveTemplateVariables } from "../template-validation.ts";
|
|
18
|
+
import { DOCUMENT_HTML_KINDS } from "../web/constants.ts";
|
|
19
19
|
import { loadDocumentBase } from "./document-base.ts";
|
|
20
20
|
import { localeSchema, templateSlugSchema } from "./shared.ts";
|
|
21
21
|
import { writeTemplateRow } from "./template-write.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
import { isDocumentResourceKey } from "../document-schema.ts";
|
|
3
|
+
import { isDocumentResourceKey } from "../web/document-schema.ts";
|
|
4
4
|
|
|
5
5
|
export const RESOURCE_MAX_BYTES_CONFIG_KEY = "template-resolver:config:resource-max-bytes";
|
|
6
6
|
export const DEFAULT_RESOURCE_MAX_BYTES = 2 * 1024 * 1024;
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
readFileRefContent,
|
|
16
16
|
} from "../../file-foundation/index.ts";
|
|
17
17
|
import { attachmentFileNameSchema } from "../../shared/index.ts";
|
|
18
|
-
import { TemplateResolverErrors } from "../qualified-names.ts";
|
|
19
18
|
import {
|
|
20
19
|
type PreparedTemplateFile,
|
|
21
20
|
prepareTemplateAttachmentBeforeTransaction,
|
|
@@ -31,6 +30,7 @@ import {
|
|
|
31
30
|
type TemplateEditPolicy,
|
|
32
31
|
templateEditAccess,
|
|
33
32
|
} from "../template-edit-policy.ts";
|
|
33
|
+
import { TemplateResolverErrors } from "../web/qualified-names.ts";
|
|
34
34
|
import { RESOURCE_PURPOSES, resourceKeySchema, resourceTargetTenantId } from "./resource-shared.ts";
|
|
35
35
|
|
|
36
36
|
type AttachmentTarget = {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
3
|
import * as z from "zod";
|
|
4
|
-
import { TEST_MAIL_SUBJECT_PREFIX } from "../constants.ts";
|
|
5
|
-
import { TemplateResolverErrors } from "../qualified-names.ts";
|
|
6
4
|
import {
|
|
7
5
|
refuseTemplateEdit,
|
|
8
6
|
type TemplateEditPolicy,
|
|
9
7
|
templateEditAccess,
|
|
10
8
|
} from "../template-edit-policy.ts";
|
|
11
9
|
import { renderTemplatePreview } from "../template-preview.ts";
|
|
10
|
+
import { TEST_MAIL_SUBJECT_PREFIX } from "../web/constants.ts";
|
|
11
|
+
import { TemplateResolverErrors } from "../web/qualified-names.ts";
|
|
12
12
|
import {
|
|
13
13
|
emailChannelOf,
|
|
14
14
|
resolveTestMailAddress,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
8
8
|
import * as z from "zod";
|
|
9
9
|
import { requireForTenant } from "../../shared/index.ts";
|
|
10
|
-
import { TEMPLATE_KINDS, TEXT_BLOCK_KIND, UPSERT_KINDS } from "../constants.ts";
|
|
11
10
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
12
11
|
import {
|
|
13
12
|
refuseTemplateEdit,
|
|
@@ -15,6 +14,7 @@ import {
|
|
|
15
14
|
templateEditAccess,
|
|
16
15
|
} from "../template-edit-policy.ts";
|
|
17
16
|
import { resolveTemplateVariables } from "../template-validation.ts";
|
|
17
|
+
import { TEMPLATE_KINDS, TEXT_BLOCK_KIND, UPSERT_KINDS } from "../web/constants.ts";
|
|
18
18
|
import { contentFormatSchema, executor, folderSchema, localeSchema, slugSchema } from "./shared.ts";
|
|
19
19
|
import { parseStoredJson, storedRecord } from "./template-gates.ts";
|
|
20
20
|
import { gateTemplateWrite } from "./template-write.ts";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
import { CONTENT_FORMATS, TEMPLATE_STATUSES, UPSERT_KINDS } from "../constants.ts";
|
|
4
3
|
import { templateResourceEntity, templateResourcesTable } from "../table.ts";
|
|
5
4
|
import { templateSlugSchema } from "../template-meta.ts";
|
|
5
|
+
import { CONTENT_FORMATS, TEMPLATE_STATUSES, UPSERT_KINDS } from "../web/constants.ts";
|
|
6
6
|
|
|
7
7
|
// One executor per bundle, shared by all four handlers for create/update via
|
|
8
8
|
// event store + optimistic lock.
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { Registry, TemplateVariables } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import type { FieldIssue } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
3
|
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
4
|
-
import {
|
|
5
|
-
CONTENT_FORMATS,
|
|
6
|
-
type ContentFormat,
|
|
7
|
-
TEMPLATE_KINDS,
|
|
8
|
-
type TemplateKind,
|
|
9
|
-
} from "../constants.ts";
|
|
10
4
|
import { documentViolationsToFieldIssues } from "../document-sanitizer.ts";
|
|
11
5
|
import { sanitizeTemplateWriteBody, type TemplateWriteScope } from "../layout-regions.ts";
|
|
12
6
|
import { imageResourceKeysOf } from "../linked-resources.ts";
|
|
@@ -17,6 +11,12 @@ import {
|
|
|
17
11
|
type TemplateValidation,
|
|
18
12
|
validateTemplatePlaceholders,
|
|
19
13
|
} from "../template-validation.ts";
|
|
14
|
+
import {
|
|
15
|
+
CONTENT_FORMATS,
|
|
16
|
+
type ContentFormat,
|
|
17
|
+
TEMPLATE_KINDS,
|
|
18
|
+
type TemplateKind,
|
|
19
|
+
} from "../web/constants.ts";
|
|
20
20
|
|
|
21
21
|
const PLACEHOLDER_VALIDATED_KINDS: ReadonlySet<TemplateKind> = new Set([
|
|
22
22
|
"mail",
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
writeFailure,
|
|
17
17
|
} from "@cosmicdrift/kumiko-framework/errors";
|
|
18
18
|
import { requireForTenant } from "../../shared/index.ts";
|
|
19
|
-
import type { ContentFormat, TemplateKind } from "../constants.ts";
|
|
20
19
|
import type { TemplateWriteScope } from "../layout-regions.ts";
|
|
21
|
-
import { TemplateResolverErrors } from "../qualified-names.ts";
|
|
22
20
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
23
21
|
import { activationChanges, serializeTemplateDraft } from "../template-draft.ts";
|
|
24
22
|
import { isSystemOnlyTemplate } from "../template-system-only.ts";
|
|
25
23
|
import type { TemplateValidation } from "../template-validation.ts";
|
|
24
|
+
import type { ContentFormat, TemplateKind } from "../web/constants.ts";
|
|
25
|
+
import { TemplateResolverErrors } from "../web/qualified-names.ts";
|
|
26
26
|
import { executor } from "./shared.ts";
|
|
27
27
|
import {
|
|
28
28
|
evaluateTemplateWrite,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import * as z from "zod";
|
|
4
|
-
import { TEMPLATE_KINDS } from "../constants.ts";
|
|
5
4
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
5
|
+
import { deliveryPolicyOf } from "../template-delivery-policy.ts";
|
|
6
6
|
import { templateSlugSchema } from "../template-meta.ts";
|
|
7
7
|
import { collectTemplateUsage } from "../template-usage.ts";
|
|
8
|
+
import { TEMPLATE_KINDS } from "../web/constants.ts";
|
|
8
9
|
import { effectiveMailLayoutSlugs } from "./overview.query.ts";
|
|
9
10
|
|
|
10
11
|
const MAIL_ROW_LIMIT = 5000;
|
|
@@ -25,7 +26,12 @@ export const usageQuery = defineQueryHandler({
|
|
|
25
26
|
{ limit: MAIL_ROW_LIMIT },
|
|
26
27
|
);
|
|
27
28
|
return {
|
|
28
|
-
usedBy: collectTemplateUsage(
|
|
29
|
+
usedBy: collectTemplateUsage(
|
|
30
|
+
ctx.registry,
|
|
31
|
+
slug,
|
|
32
|
+
kind,
|
|
33
|
+
effectiveMailLayoutSlugs(mailRows, deliveryPolicyOf(ctx.registry)),
|
|
34
|
+
),
|
|
29
35
|
};
|
|
30
36
|
},
|
|
31
37
|
});
|
|
@@ -6,12 +6,13 @@ import {
|
|
|
6
6
|
SYSTEM_TENANT_ID,
|
|
7
7
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
8
8
|
import * as z from "zod";
|
|
9
|
-
import type { ContentFormat, UpsertKind } from "../constants.ts";
|
|
10
9
|
import type { TemplateWriteScope } from "../layout-regions.ts";
|
|
11
10
|
import { imageResourceKeysOf } from "../linked-resources.ts";
|
|
12
11
|
import { type TemplateResourceRow, templateResourcesTable } from "../table.ts";
|
|
12
|
+
import { deliveryPolicyOf, isRowServedTo } from "../template-delivery-policy.ts";
|
|
13
13
|
import { isSystemAdmin } from "../template-draft.ts";
|
|
14
14
|
import { resolveTemplateVariables, systemPlaceholdersFor } from "../template-validation.ts";
|
|
15
|
+
import type { ContentFormat, UpsertKind } from "../web/constants.ts";
|
|
15
16
|
import { contentFormatSchema, kindSchema, localeSchema, templateSlugSchema } from "./shared.ts";
|
|
16
17
|
import { evaluateTemplateWrite } from "./template-gates.ts";
|
|
17
18
|
|
|
@@ -67,7 +68,8 @@ export async function knownResourceKeysFor(
|
|
|
67
68
|
scope: "system",
|
|
68
69
|
locale,
|
|
69
70
|
})),
|
|
70
|
-
...(scope === "tenant"
|
|
71
|
+
...(scope === "tenant" &&
|
|
72
|
+
isRowServedTo(deliveryPolicyOf(ctx.registry), user, { tenantId: user.tenantId, kind, slug })
|
|
71
73
|
? await knownResourceKeys(ctx.db, { tenantId: user.tenantId, slug, kind, scope, locale })
|
|
72
74
|
: []),
|
|
73
75
|
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { handlerTitleKey } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { TemplateResolverHandlers as H } from "./web/qualified-names.ts";
|
|
3
|
+
|
|
4
|
+
// The AI assistant and its approval prompts name a handler by its title key; without
|
|
5
|
+
// one the user reads the raw handler name. de/es/fr/it live in the locale packages.
|
|
6
|
+
export const TEMPLATE_RESOLVER_I18N: Readonly<Record<string, { readonly en: string }>> = {
|
|
7
|
+
[handlerTitleKey(H.upsertSystem)]: { en: "Save system template" },
|
|
8
|
+
[handlerTitleKey(H.upsertTenant)]: { en: "Save template" },
|
|
9
|
+
[handlerTitleKey(H.publish)]: { en: "Publish template" },
|
|
10
|
+
[handlerTitleKey(H.archive)]: { en: "Archive template" },
|
|
11
|
+
[handlerTitleKey(H.publishSystem)]: { en: "Publish system template" },
|
|
12
|
+
[handlerTitleKey(H.archiveSystem)]: { en: "Archive system template" },
|
|
13
|
+
[handlerTitleKey(H.discardDraft)]: { en: "Discard draft" },
|
|
14
|
+
[handlerTitleKey(H.discardDraftSystem)]: { en: "Discard system template draft" },
|
|
15
|
+
[handlerTitleKey(H.resetToSystem)]: { en: "Reset to system template" },
|
|
16
|
+
[handlerTitleKey(H.set)]: { en: "Save text" },
|
|
17
|
+
[handlerTitleKey(H.importBundle)]: { en: "Import template" },
|
|
18
|
+
[handlerTitleKey(H.importBundleSystem)]: { en: "Import system template" },
|
|
19
|
+
[handlerTitleKey(H.copyLocale)]: { en: "Copy template to another language" },
|
|
20
|
+
[handlerTitleKey(H.resourceUpload)]: { en: "Upload image or attachment" },
|
|
21
|
+
[handlerTitleKey(H.resourceRemove)]: { en: "Remove image or attachment" },
|
|
22
|
+
[handlerTitleKey(H.resourceLinkPdf)]: { en: "Attach PDF template" },
|
|
23
|
+
[handlerTitleKey(H.sendTest)]: { en: "Send test mail" },
|
|
24
|
+
[handlerTitleKey(H.patchDraft)]: { en: "Edit template draft" },
|
|
25
|
+
};
|