@cosmicdrift/kumiko-bundled-features 0.378.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/dist/account-security/feature.js +2 -2
- package/dist/account-security/index.d.ts +2 -2
- package/dist/account-security/index.js +2 -2
- package/dist/account-security/{constants.js → web/constants.js} +0 -1
- package/dist/account-security/{i18n.js → web/i18n.js} +0 -1
- package/dist/admin-shell/feature.js +4 -3
- package/dist/admin-shell/index.d.ts +2 -2
- package/dist/admin-shell/index.js +2 -2
- package/dist/admin-shell/web/client-plugin.js +2 -3
- package/dist/admin-shell/{constants.js → web/constants.js} +0 -1
- package/dist/admin-shell/web/default-translations.d.ts +2 -0
- package/dist/admin-shell/web/default-translations.js +4 -0
- package/dist/admin-shell/web/i18n.d.ts +5 -2
- package/dist/admin-shell/web/i18n.js +50 -5
- package/dist/admin-shell/web/index.js +0 -1
- package/dist/audit/feature.js +58 -59
- package/dist/audit/handlers/audit-events.d.ts +102 -0
- package/dist/audit/handlers/audit-events.js +112 -0
- package/dist/audit/handlers/audit-system-db.d.ts +1 -0
- package/dist/audit/handlers/audit-system-db.js +9 -0
- package/dist/audit/handlers/details-all-tenants.query.d.ts +15 -0
- package/dist/audit/handlers/details-all-tenants.query.js +20 -0
- package/dist/audit/handlers/details.query.d.ts +2 -1
- package/dist/audit/handlers/details.query.js +8 -24
- package/dist/audit/handlers/list-all-tenants.query.d.ts +41 -0
- package/dist/audit/handlers/list-all-tenants.query.js +32 -0
- package/dist/audit/handlers/list.query.d.ts +2 -1
- package/dist/audit/handlers/list.query.js +9 -99
- package/dist/audit/handlers/resolve-audit-tenant.d.ts +3 -1
- package/dist/audit/handlers/resolve-audit-tenant.js +21 -7
- package/dist/audit/index.d.ts +1 -1
- package/dist/audit/index.js +1 -1
- package/dist/audit/run-escape-hatch-retention.js +1 -1
- package/dist/audit/screens.d.ts +65 -0
- package/dist/audit/screens.js +73 -0
- package/dist/audit/web/client-plugin.js +2 -3
- package/dist/audit/{constants.d.ts → web/constants.d.ts} +8 -0
- package/dist/audit/{constants.js → web/constants.js} +8 -1
- package/dist/audit/web/default-translations.d.ts +2 -0
- package/dist/audit/web/default-translations.js +3 -0
- package/dist/audit/web/i18n.d.ts +5 -2
- package/dist/audit/web/i18n.js +31 -4
- package/dist/audit/web/index.js +0 -1
- package/dist/auth-email-password/bootstrap.d.ts +1 -1
- package/dist/auth-email-password/bootstrap.js +4 -4
- package/dist/auth-email-password/errors.js +1 -1
- package/dist/auth-email-password/feature.js +2 -2
- package/dist/auth-email-password/handlers/confirm-account-unlock.write.js +1 -1
- package/dist/auth-email-password/handlers/invite-accept-with-login.write.js +1 -1
- package/dist/auth-email-password/handlers/invite-create.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/invite-create.write.js +3 -3
- package/dist/auth-email-password/handlers/invite-info.query.js +1 -1
- package/dist/auth-email-password/handlers/login.write.d.ts +1 -0
- package/dist/auth-email-password/handlers/login.write.js +26 -1
- package/dist/auth-email-password/handlers/request-account-unlock.write.js +1 -1
- package/dist/auth-email-password/handlers/request-email-verification.write.js +1 -1
- package/dist/auth-email-password/handlers/request-password-reset.write.js +1 -1
- package/dist/auth-email-password/handlers/reset-password.write.js +1 -1
- package/dist/auth-email-password/handlers/verify-email.write.js +1 -1
- package/dist/auth-email-password/index.d.ts +1 -1
- package/dist/auth-email-password/index.js +1 -1
- package/dist/auth-email-password/mail-notifications.js +1 -1
- package/dist/auth-email-password/signup-activation.js +1 -1
- package/dist/auth-email-password/web/auth-client.js +0 -1
- package/dist/auth-email-password/web/auth-form-logic.js +0 -1
- package/dist/auth-email-password/web/auth-form-primitives.js +0 -1
- package/dist/auth-email-password/web/auth-gate.js +0 -1
- package/dist/auth-email-password/web/auth-redirect.js +0 -1
- package/dist/auth-email-password/web/client-actions.js +0 -1
- package/dist/auth-email-password/web/client-plugin.js +1 -2
- package/dist/auth-email-password/web/confirm-account-unlock-screen.js +0 -1
- package/dist/auth-email-password/{constants.js → web/constants.js} +3 -6
- package/dist/auth-email-password/web/default-topbar-actions.js +0 -1
- package/dist/auth-email-password/web/forgot-password-screen.js +0 -1
- package/dist/auth-email-password/{i18n.js → web/i18n.js} +3 -4
- package/dist/auth-email-password/web/index.d.ts +1 -1
- package/dist/auth-email-password/web/index.js +1 -2
- package/dist/auth-email-password/web/invite-accept-screen.d.ts +2 -2
- package/dist/auth-email-password/web/invite-accept-screen.js +0 -1
- package/dist/auth-email-password/web/login-screen.js +0 -1
- package/dist/auth-email-password/{mail-i18n.js → web/mail-i18n.js} +0 -1
- package/dist/auth-email-password/web/request-account-unlock-screen.js +0 -1
- package/dist/auth-email-password/web/reset-password-screen.js +0 -1
- package/dist/auth-email-password/web/session-bootstrap-error.js +0 -1
- package/dist/auth-email-password/web/session.js +0 -1
- package/dist/auth-email-password/web/signup-complete-screen.d.ts +2 -2
- package/dist/auth-email-password/web/signup-complete-screen.js +0 -1
- package/dist/auth-email-password/web/signup-screen.js +0 -1
- package/dist/auth-email-password/web/tenant-menu-items.js +0 -1
- package/dist/auth-email-password/web/tenant-switcher.js +0 -1
- package/dist/auth-email-password/web/use-shell-user.js +0 -1
- package/dist/auth-email-password/web/user-menu.js +0 -1
- package/dist/auth-email-password/web/verify-email-screen.js +0 -1
- package/dist/auth-mfa/errors.d.ts +1 -1
- package/dist/auth-mfa/errors.js +2 -2
- package/dist/auth-mfa/handlers/enable-confirm-preauth.write.js +1 -1
- package/dist/auth-mfa/handlers/enable-start-preauth.write.js +1 -1
- package/dist/auth-mfa/handlers/enable-start.write.js +1 -1
- package/dist/auth-mfa/handlers/verify.write.js +1 -1
- package/dist/auth-mfa/index.d.ts +1 -1
- package/dist/auth-mfa/index.js +1 -1
- package/dist/auth-mfa/mfa-status-checker.js +1 -1
- package/dist/auth-mfa/screens.js +1 -1
- package/dist/auth-mfa/web/client-plugin.js +0 -1
- package/dist/auth-mfa/{constants.js → web/constants.js} +0 -1
- package/dist/auth-mfa/web/i18n.js +0 -1
- package/dist/auth-mfa/web/index.js +0 -1
- package/dist/auth-mfa/web/mfa-client.js +0 -1
- package/dist/auth-mfa/web/mfa-disable-dialog.js +1 -2
- package/dist/auth-mfa/web/mfa-recovery-codes-reveal.js +0 -1
- package/dist/auth-mfa/web/mfa-regenerate-recovery-dialog.js +1 -2
- package/dist/auth-mfa/web/mfa-setup-preauth-screen.js +11 -18
- package/dist/auth-mfa/web/mfa-verify-screen.js +0 -1
- package/dist/billing-foundation/checkout-core.js +1 -1
- package/dist/billing-foundation/consumer-protection/consent-text.d.ts +2 -2
- package/dist/billing-foundation/consumer-protection/consent-text.js +1 -1
- package/dist/billing-foundation/consumer-protection/issue-confirmation.js +7 -3
- package/dist/billing-foundation/consumer-protection/mail-notifications.js +3 -1
- package/dist/billing-foundation/consumer-protection/register-consent.js +1 -1
- package/dist/billing-foundation/consumer-protection/register-termination.js +8 -2
- package/dist/billing-foundation/consumer-protection/stored-user-email.d.ts +1 -0
- package/dist/billing-foundation/consumer-protection/stored-user-email.js +8 -0
- package/dist/billing-foundation/consumer-protection/termination-mail.d.ts +5 -1
- package/dist/billing-foundation/consumer-protection/termination-mail.js +3 -1
- package/dist/billing-foundation/consumer-protection/termination-notify.js +1 -1
- package/dist/billing-foundation/consumer-protection/termination-pages.js +109 -15
- package/dist/billing-foundation/consumer-protection/termination-record.d.ts +8 -1
- package/dist/billing-foundation/consumer-protection/termination-record.js +76 -3
- package/dist/billing-foundation/consumer-protection/termination-request.js +33 -6
- package/dist/billing-foundation/consumer-protection/termination-revoke.d.ts +28 -0
- package/dist/billing-foundation/consumer-protection/termination-revoke.js +149 -0
- package/dist/billing-foundation/consumer-protection/termination-texts.d.ts +17 -1
- package/dist/billing-foundation/consumer-protection/termination-texts.js +39 -0
- package/dist/billing-foundation/events.d.ts +9 -0
- package/dist/billing-foundation/events.js +14 -2
- package/dist/billing-foundation/feature.js +1 -1
- package/dist/billing-foundation/handlers/process-event.write.d.ts +5 -1
- package/dist/billing-foundation/handlers/process-event.write.js +57 -3
- package/dist/billing-foundation/handlers/switch-plan.write.js +1 -1
- package/dist/billing-foundation/handlers/sync-subscription.write.js +1 -1
- package/dist/billing-foundation/index.d.ts +2 -2
- package/dist/billing-foundation/index.js +2 -2
- package/dist/billing-foundation/plan-catalog.js +1 -1
- package/dist/billing-foundation/screens.js +1 -1
- package/dist/billing-foundation/subscription-tier-sync.js +1 -1
- package/dist/billing-foundation/types.d.ts +14 -2
- package/dist/billing-foundation/types.js +1 -1
- package/dist/billing-foundation/validate-options.js +3 -3
- package/dist/billing-foundation/web/billing-contact-plan.js +1 -2
- package/dist/billing-foundation/web/billing-plans-panel.js +1 -2
- package/dist/billing-foundation/web/cancel-contract-dialog.js +1 -2
- package/dist/billing-foundation/web/checkout-consent-dialog.js +1 -2
- package/dist/billing-foundation/web/client-plugin.js +1 -1
- package/dist/billing-foundation/{constants.d.ts → web/constants.d.ts} +21 -14
- package/dist/billing-foundation/{constants.js → web/constants.js} +35 -31
- package/dist/billing-foundation/{consumer-protection → web/consumer-protection}/consent-locale.js +0 -1
- package/dist/billing-foundation/{contact-card.js → web/contact-card.js} +0 -1
- package/dist/billing-foundation/web/index.d.ts +2 -2
- package/dist/billing-foundation/web/index.js +2 -3
- package/dist/billing-foundation/web/localized-params.js +0 -1
- package/dist/billing-foundation/webhook-handler.js +4 -1
- package/dist/cap-overview/feature.js +1 -1
- package/dist/cap-overview/handlers/caps-usage.query.js +1 -1
- package/dist/cap-overview/handlers/tenant-caps-list.query.js +2 -2
- package/dist/cap-overview/index.d.ts +2 -2
- package/dist/cap-overview/index.js +2 -2
- package/dist/cap-overview/screens.js +1 -1
- package/dist/cap-overview/web/cap-cards-panel.js +1 -1
- package/dist/cap-overview/web/cap-usage-bar.js +1 -2
- package/dist/cap-overview/web/client-plugin.js +1 -1
- package/dist/cap-overview/{constants.js → web/constants.js} +0 -1
- package/dist/cap-overview/web/index.js +0 -1
- package/dist/cap-overview/{usage-math.d.ts → web/usage-math.d.ts} +1 -1
- package/dist/compliance-profiles/feature.js +1 -1
- package/dist/compliance-profiles/index.d.ts +1 -1
- package/dist/compliance-profiles/index.js +1 -1
- package/dist/compliance-profiles/web/client-plugin.js +1 -2
- package/dist/compliance-profiles/web/compliance-profile-catalog.js +1 -2
- package/dist/compliance-profiles/{constants.js → web/constants.js} +0 -1
- package/dist/compliance-profiles/web/index.js +0 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/web/client-plugin.d.ts +1 -1
- package/dist/config/web/client-plugin.js +1 -2
- package/dist/config/{constants.js → web/constants.js} +0 -1
- package/dist/config/web/i18n.js +0 -1
- package/dist/config/web/index.d.ts +1 -1
- package/dist/config/web/index.js +1 -2
- package/dist/config/write-helpers.js +1 -1
- package/dist/custom-fields/feature.js +1 -1
- package/dist/custom-fields/handlers/clear-custom-field.write.js +1 -1
- package/dist/custom-fields/handlers/define-tenant-field.write.js +1 -1
- package/dist/custom-fields/handlers/delete-system-field.write.js +1 -1
- package/dist/custom-fields/handlers/delete-tenant-field.write.js +1 -1
- package/dist/custom-fields/handlers/set-custom-field.write.js +1 -1
- package/dist/custom-fields/handlers/update-tenant-field.write.js +1 -1
- package/dist/custom-fields/index.d.ts +1 -1
- package/dist/custom-fields/index.js +1 -1
- package/dist/custom-fields/lib/value-schema.js +1 -1
- package/dist/custom-fields/schemas.js +1 -1
- package/dist/custom-fields/web/client-plugin.js +1 -2
- package/dist/custom-fields/{constants.js → web/constants.js} +18 -19
- package/dist/custom-fields/web/custom-fields-form-section.js +1 -2
- package/dist/custom-fields/web/i18n.js +0 -1
- package/dist/custom-fields/web/index.d.ts +1 -1
- package/dist/custom-fields/web/index.js +1 -2
- package/dist/custom-fields/wire-for-entity.js +1 -1
- package/dist/delivery/address-opt-out.js +1 -1
- package/dist/delivery/attempt-log-retention.js +21 -3
- package/dist/delivery/constants.d.ts +1 -1
- package/dist/delivery/constants.js +2 -2
- package/dist/delivery/i18n.js +1 -1
- package/dist/delivery/unsubscribe-page.js +1 -1
- package/dist/delivery/web/client-plugin.js +1 -1
- package/dist/delivery/web/delivery-channel-cell.js +0 -1
- package/dist/delivery/web/delivery-error-cell.js +0 -1
- package/dist/delivery/web/delivery-status-cell.js +1 -2
- package/dist/delivery/web/delivery-time-cell.js +0 -1
- package/dist/delivery/web/delivery-type-cell.js +0 -1
- package/dist/delivery/web/index.js +0 -1
- package/dist/delivery/{public-names.js → web/public-names.js} +0 -1
- package/dist/document-ingest-foundation/events.d.ts +1 -0
- package/dist/document-ingest-foundation/events.js +3 -0
- package/dist/document-ingest-foundation/executor.js +2 -1
- package/dist/document-ingest-foundation/feature.js +16 -5
- package/dist/document-ingest-foundation/index.d.ts +1 -1
- package/dist/document-ingest-foundation/index.js +1 -1
- package/dist/feature-toggles/feature.d.ts +1 -1
- package/dist/feature-toggles/feature.js +2 -2
- package/dist/feature-toggles/handlers/list.query.js +1 -1
- package/dist/feature-toggles/handlers/registered.query.js +1 -1
- package/dist/feature-toggles/handlers/set.write.js +1 -1
- package/dist/feature-toggles/index.d.ts +1 -1
- package/dist/feature-toggles/index.js +1 -1
- package/dist/feature-toggles/web/client-plugin.js +1 -2
- package/dist/feature-toggles/{constants.js → web/constants.js} +0 -1
- package/dist/feature-toggles/web/index.js +0 -1
- package/dist/folders/feature.js +1 -1
- package/dist/folders/handlers/clear-folder.write.js +1 -1
- package/dist/folders/handlers/delete-folder.write.js +1 -1
- package/dist/folders/handlers/set-folder.write.js +1 -1
- package/dist/folders/index.d.ts +1 -1
- package/dist/folders/index.js +1 -1
- package/dist/folders/web/client-plugin.js +1 -2
- package/dist/folders/{constants.js → web/constants.js} +0 -1
- package/dist/folders/web/folder-manager.js +1 -2
- package/dist/folders/web/folder-section.js +1 -2
- package/dist/folders/web/i18n.js +0 -1
- package/dist/folders/web/index.d.ts +1 -1
- package/dist/folders/web/index.js +1 -2
- package/dist/folders/web/tree.js +0 -1
- package/dist/form-draft/db/queries/cleanup.d.ts +3 -2
- package/dist/form-draft/db/queries/cleanup.js +18 -9
- package/dist/form-draft/decrypt-draft.d.ts +2 -0
- package/dist/form-draft/decrypt-draft.js +19 -0
- package/dist/form-draft/entity.js +6 -9
- package/dist/form-draft/feature.js +1 -1
- package/dist/form-draft/handlers/cleanup.job.d.ts +1 -0
- package/dist/form-draft/handlers/cleanup.job.js +17 -4
- package/dist/form-draft/handlers/discard.write.js +1 -1
- package/dist/form-draft/handlers/get.query.js +6 -7
- package/dist/form-draft/handlers/list.query.js +11 -7
- package/dist/form-draft/handlers/save.write.js +1 -1
- package/dist/form-draft/index.d.ts +1 -1
- package/dist/form-draft/index.js +1 -1
- package/dist/form-draft/lookup.d.ts +2 -2
- package/dist/form-draft/lookup.js +7 -2
- package/dist/form-draft/schemas.js +1 -1
- package/dist/form-draft/{constants.js → web/constants.js} +0 -1
- package/dist/form-draft-user-data/hooks.js +2 -2
- package/dist/inbound-mail-foundation/retention-sweep.js +7 -5
- package/dist/jobs/feature.js +2 -2
- package/dist/jobs/handlers/retry.write.js +1 -1
- package/dist/jobs/handlers/trigger.write.js +1 -1
- package/dist/jobs/index.d.ts +1 -1
- package/dist/jobs/index.js +1 -1
- package/dist/jobs/web/client-plugin.js +2 -3
- package/dist/jobs/{constants.js → web/constants.js} +0 -1
- package/dist/jobs/web/default-translations.d.ts +2 -0
- package/dist/jobs/web/default-translations.js +3 -0
- package/dist/jobs/web/i18n.d.ts +5 -2
- package/dist/jobs/web/i18n.js +51 -4
- package/dist/jobs/web/index.js +0 -1
- package/dist/ledger/entity.d.ts +1 -1
- package/dist/ledger/entity.js +1 -1
- package/dist/ledger/feature.js +1 -1
- package/dist/ledger/handlers/confirm-schedule-period.write.js +2 -5
- package/dist/ledger/handlers/create-transaction.write.js +1 -1
- package/dist/ledger/handlers/reports.query.js +1 -1
- package/dist/ledger/handlers/reverse-transaction.write.js +1 -1
- package/dist/ledger/index.d.ts +1 -1
- package/dist/ledger/index.js +1 -1
- package/dist/ledger/recurring.d.ts +1 -1
- package/dist/ledger/reports.d.ts +1 -1
- package/dist/ledger/schemas.js +1 -1
- package/dist/ledger/{constants.js → web/constants.js} +0 -1
- package/dist/ledger/web/index.d.ts +1 -1
- package/dist/ledger/web/index.js +1 -2
- package/dist/legal-pages/feature.d.ts +1 -1
- package/dist/legal-pages/feature.js +1 -1
- package/dist/legal-pages/index.d.ts +1 -1
- package/dist/legal-pages/index.js +1 -1
- package/dist/legal-pages/lib/boot-check.d.ts +1 -1
- package/dist/legal-pages/lib/boot-check.js +1 -1
- package/dist/legal-pages/lib/validate-routes.d.ts +1 -1
- package/dist/legal-pages/web/client-plugin.js +1 -2
- package/dist/legal-pages/{constants.js → web/constants.js} +6 -8
- package/dist/legal-pages/web/index.js +0 -1
- package/dist/managed-pages/feature.js +1 -1
- package/dist/managed-pages/web/client-plugin.js +1 -2
- package/dist/managed-pages/web/default-translations.d.ts +2 -0
- package/dist/managed-pages/web/default-translations.js +11 -0
- package/dist/managed-pages/web/i18n.d.ts +5 -2
- package/dist/managed-pages/web/i18n.js +53 -12
- package/dist/managed-pages/web/index.d.ts +1 -1
- package/dist/managed-pages/web/index.js +1 -2
- package/dist/metrics/compute.d.ts +1 -1
- package/dist/metrics/compute.js +1 -1
- package/dist/metrics/feature.js +1 -1
- package/dist/metrics/index.d.ts +1 -1
- package/dist/metrics/index.js +1 -1
- package/dist/metrics/types.d.ts +1 -1
- package/dist/metrics/validate.js +1 -1
- package/dist/metrics/{constants.js → web/constants.js} +0 -1
- package/dist/metrics/window.d.ts +1 -1
- package/dist/notes-history/feature.js +1 -1
- package/dist/notes-history/handlers/add-note.write.js +1 -1
- package/dist/notes-history/index.d.ts +1 -1
- package/dist/notes-history/index.js +1 -1
- package/dist/notes-history/web/client-plugin.js +1 -2
- package/dist/notes-history/{constants.js → web/constants.js} +0 -1
- package/dist/notes-history/web/i18n.js +0 -1
- package/dist/notes-history/web/index.d.ts +1 -1
- package/dist/notes-history/web/index.js +1 -2
- package/dist/notes-history/web/notes-section.js +2 -3
- package/dist/personal-access-tokens/feature.d.ts +2 -2
- package/dist/personal-access-tokens/feature.js +6 -4
- package/dist/personal-access-tokens/handlers/available-scopes.query.d.ts +1 -1
- package/dist/personal-access-tokens/handlers/create.write.js +1 -1
- package/dist/personal-access-tokens/handlers/revoke.write.js +1 -1
- package/dist/personal-access-tokens/hash.js +1 -1
- package/dist/personal-access-tokens/i18n.d.ts +1 -1
- package/dist/personal-access-tokens/i18n.js +1 -1
- package/dist/personal-access-tokens/index.d.ts +5 -5
- package/dist/personal-access-tokens/index.js +3 -3
- package/dist/personal-access-tokens/resolver.d.ts +1 -1
- package/dist/personal-access-tokens/resolver.js +1 -1
- package/dist/personal-access-tokens/schema/api-token.js +1 -1
- package/dist/personal-access-tokens/screens.d.ts +1 -1
- package/dist/personal-access-tokens/screens.js +1 -1
- package/dist/personal-access-tokens/{constants.js → web/constants.js} +0 -1
- package/dist/presets/index.d.ts +0 -1
- package/dist/presets/index.js +0 -1
- package/dist/presets/security-baseline.d.ts +1 -1
- package/dist/presets/security-baseline.js +1 -1
- package/dist/secrets/feature.js +1 -1
- package/dist/secrets/handlers/delete.write.js +1 -1
- package/dist/secrets/handlers/list.query.js +1 -1
- package/dist/secrets/handlers/set.write.js +1 -1
- package/dist/secrets/i18n.js +1 -1
- package/dist/secrets/index.d.ts +1 -1
- package/dist/secrets/index.js +1 -1
- package/dist/secrets/{constants.js → web/constants.js} +0 -1
- package/dist/secrets/write-gate.js +1 -1
- package/dist/sessions/feature.js +7 -4
- package/dist/sessions/{i18n.js → web/i18n.js} +0 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/purge-files-reaching-subject.js +7 -3
- package/dist/subscription-stripe/feature.js +2 -1
- package/dist/subscription-stripe/plugin-methods.d.ts +3 -0
- package/dist/subscription-stripe/plugin-methods.js +14 -0
- package/dist/subscription-stripe/verify-webhook.js +1 -0
- package/dist/tags/feature.js +1 -1
- package/dist/tags/handlers/assign-tag.write.js +11 -7
- package/dist/tags/handlers/create-tag.write.js +1 -1
- package/dist/tags/handlers/delete-tag.write.js +4 -1
- package/dist/tags/handlers/remove-tag.write.js +1 -1
- package/dist/tags/handlers/update-tag.write.js +1 -1
- package/dist/tags/index.d.ts +1 -1
- package/dist/tags/index.js +1 -1
- package/dist/tags/screens.js +1 -1
- package/dist/tags/web/client-plugin.js +1 -2
- package/dist/tags/{constants.d.ts → web/constants.d.ts} +1 -0
- package/dist/tags/{constants.js → web/constants.js} +3 -1
- package/dist/tags/web/entity-tags.js +1 -2
- package/dist/tags/web/i18n.js +2 -2
- package/dist/tags/web/index.d.ts +1 -1
- package/dist/tags/web/index.js +1 -2
- package/dist/tags/web/tag-filter.js +1 -2
- package/dist/tags/web/tag-manager.js +5 -4
- package/dist/tags/web/tag-picker.js +0 -1
- package/dist/tags/web/tag-section.js +1 -2
- package/dist/tags/web/tags-cell.js +1 -2
- package/dist/template-resolver/api.d.ts +21 -23
- package/dist/template-resolver/api.js +34 -6
- package/dist/template-resolver/compile-document-body.js +1 -1
- package/dist/template-resolver/compile-steps-block.js +2 -2
- package/dist/template-resolver/document-ops.d.ts +1 -1
- package/dist/template-resolver/document-ops.js +3 -3
- package/dist/template-resolver/document-sanitizer.d.ts +1 -1
- package/dist/template-resolver/document-sanitizer.js +3 -3
- package/dist/template-resolver/feature.d.ts +2 -0
- package/dist/template-resolver/feature.js +12 -4
- package/dist/template-resolver/handlers/by-slug.query.js +6 -1
- package/dist/template-resolver/handlers/by-tenant.query.js +6 -2
- package/dist/template-resolver/handlers/collection-item.query.js +1 -1
- package/dist/template-resolver/handlers/collection-list.query.js +1 -1
- package/dist/template-resolver/handlers/collection-set.write.d.ts +2 -1
- package/dist/template-resolver/handlers/collection-set.write.js +14 -2
- package/dist/template-resolver/handlers/copy-locale.write.js +2 -2
- package/dist/template-resolver/handlers/diff-to-system.query.js +5 -1
- package/dist/template-resolver/handlers/discard-draft.write.js +1 -1
- package/dist/template-resolver/handlers/document-base.d.ts +1 -1
- package/dist/template-resolver/handlers/document-base.js +6 -1
- package/dist/template-resolver/handlers/document-blocks.query.d.ts +1 -1
- package/dist/template-resolver/handlers/document-blocks.query.js +2 -2
- package/dist/template-resolver/handlers/export-bundle.query.js +5 -2
- package/dist/template-resolver/handlers/find-by-id.query.js +4 -2
- package/dist/template-resolver/handlers/layout-source.query.js +5 -5
- package/dist/template-resolver/handlers/list.query.js +5 -2
- package/dist/template-resolver/handlers/overview.query.d.ts +10 -2
- package/dist/template-resolver/handlers/overview.query.js +44 -12
- package/dist/template-resolver/handlers/patch-draft.write.js +1 -1
- package/dist/template-resolver/handlers/resource-shared.js +1 -1
- package/dist/template-resolver/handlers/resource-upload.write.js +1 -1
- package/dist/template-resolver/handlers/send-test.write.js +2 -2
- package/dist/template-resolver/handlers/set.write.js +1 -1
- package/dist/template-resolver/handlers/shared.js +1 -1
- package/dist/template-resolver/handlers/template-gates.d.ts +1 -1
- package/dist/template-resolver/handlers/template-gates.js +1 -1
- package/dist/template-resolver/handlers/template-write.d.ts +1 -1
- package/dist/template-resolver/handlers/template-write.js +1 -1
- package/dist/template-resolver/handlers/usage.query.js +3 -2
- package/dist/template-resolver/handlers/validate.query.d.ts +1 -1
- package/dist/template-resolver/handlers/validate.query.js +3 -1
- package/dist/template-resolver/i18n.d.ts +3 -0
- package/dist/template-resolver/i18n.js +24 -0
- package/dist/template-resolver/index.d.ts +4 -3
- package/dist/template-resolver/index.js +3 -3
- package/dist/template-resolver/layout-appearance.js +1 -1
- package/dist/template-resolver/layout-regions.d.ts +1 -1
- package/dist/template-resolver/seeding.d.ts +4 -1
- package/dist/template-resolver/seeding.js +13 -7
- package/dist/template-resolver/store-template-resource.js +2 -2
- package/dist/template-resolver/table.js +1 -1
- package/dist/template-resolver/template-bundle.js +2 -2
- package/dist/template-resolver/template-delivery-policy.d.ts +22 -0
- package/dist/template-resolver/template-delivery-policy.js +40 -0
- package/dist/template-resolver/template-draft.d.ts +1 -1
- package/dist/template-resolver/template-draft.js +1 -1
- package/dist/template-resolver/template-edit-policy.d.ts +1 -1
- package/dist/template-resolver/template-edit-policy.js +1 -1
- package/dist/template-resolver/template-meta.d.ts +2 -2
- package/dist/template-resolver/template-meta.js +2 -2
- package/dist/template-resolver/template-preview.d.ts +1 -1
- package/dist/template-resolver/template-preview.js +8 -4
- package/dist/template-resolver/template-usage.d.ts +1 -1
- package/dist/template-resolver/template-usage.js +1 -1
- package/dist/template-resolver/template-validation.js +1 -1
- package/dist/template-resolver/testing.js +1 -1
- package/dist/template-resolver/user-content-table.js +1 -1
- package/dist/template-resolver/web/client-plugin.js +1 -2
- package/dist/template-resolver/{constants.d.ts → web/constants.d.ts} +1 -1
- package/dist/template-resolver/{constants.js → web/constants.js} +7 -10
- package/dist/template-resolver/web/document-editor-extensions.js +2 -2
- package/dist/template-resolver/web/document-editor.js +0 -1
- package/dist/template-resolver/{document-images.js → web/document-images.js} +0 -1
- package/dist/template-resolver/{document-schema.js → web/document-schema.js} +0 -1
- package/dist/template-resolver/{document-steps.js → web/document-steps.js} +0 -1
- package/dist/template-resolver/web/document-tiptap-editor.js +2 -3
- package/dist/template-resolver/web/document-toolbar-blocks.d.ts +2 -2
- package/dist/template-resolver/web/document-toolbar-blocks.js +1 -1
- package/dist/template-resolver/web/editor-handle.js +1 -1
- package/dist/template-resolver/web/i18n.js +1 -1
- package/dist/template-resolver/web/index.d.ts +3 -3
- package/dist/template-resolver/web/index.js +3 -4
- package/dist/template-resolver/{mail-constants.js → web/mail-constants.js} +0 -1
- package/dist/template-resolver/{pdf-constants.js → web/pdf-constants.js} +0 -1
- package/dist/template-resolver/web/placeholder-line-editor-lazy.js +0 -1
- package/dist/template-resolver/web/placeholder-line-editor.js +6 -4
- package/dist/template-resolver/{qualified-names.js → web/qualified-names.js} +0 -1
- package/dist/template-resolver/web/use-stable-by-key.js +0 -1
- package/dist/tenant/handlers/add-member.write.js +1 -1
- package/dist/tenant/index.d.ts +1 -1
- package/dist/tenant/index.js +1 -1
- package/dist/tenant/invitation-table.js +1 -1
- package/dist/tenant/invited-membership.js +1 -1
- package/dist/tenant/last-tenant-admin.js +1 -1
- package/dist/tenant/member-role-options.js +1 -1
- package/dist/tenant/screens.js +1 -1
- package/dist/tenant/web/client-plugin.js +1 -2
- package/dist/tenant/{constants.js → web/constants.js} +3 -6
- package/dist/tenant/web/index.js +0 -1
- package/dist/tenant/web/member-roles-cell.js +0 -1
- package/dist/tenant/web/member-status-cell.js +0 -1
- package/dist/tenant-lifecycle/stages.js +2 -3
- package/dist/tier-engine/entity.d.ts +1 -1
- package/dist/tier-engine/entity.js +1 -1
- package/dist/tier-engine/feature.js +2 -2
- package/dist/tier-engine/handlers/set-tenant-tier.write.js +1 -1
- package/dist/tier-engine/index.d.ts +1 -1
- package/dist/tier-engine/index.js +1 -1
- package/dist/tier-engine/web/client-plugin.js +2 -3
- package/dist/tier-engine/{constants.js → web/constants.js} +2 -3
- package/dist/tier-engine/{i18n.js → web/i18n.js} +0 -1
- package/dist/tier-engine/web/index.js +0 -1
- package/dist/user/handlers/create.write.js +1 -1
- package/dist/user/handlers/update-roles.js +1 -1
- package/dist/user/handlers/update.write.js +1 -1
- package/dist/user/index.d.ts +1 -1
- package/dist/user/index.js +1 -1
- package/dist/user/invited-global-roles.d.ts +1 -1
- package/dist/user/invited-global-roles.js +1 -1
- package/dist/user/schema/user.js +1 -1
- package/dist/user/{constants.js → web/constants.js} +0 -1
- package/dist/user-data-rights/env.js +1 -1
- package/dist/user-data-rights/feature.js +3 -3
- package/dist/user-data-rights/index.d.ts +1 -1
- package/dist/user-data-rights/index.js +1 -1
- package/dist/user-data-rights/lib/resolve-tenant-model.js +1 -1
- package/dist/user-data-rights/mail-notifications.js +1 -1
- package/dist/user-data-rights/web/client-plugin.js +2 -3
- package/dist/user-data-rights/web/confirm-deletion-screen.js +0 -1
- package/dist/user-data-rights/{constants.js → web/constants.js} +11 -12
- package/dist/user-data-rights/web/default-translations.d.ts +2 -0
- package/dist/user-data-rights/web/default-translations.js +59 -0
- package/dist/user-data-rights/web/i18n.d.ts +5 -2
- package/dist/user-data-rights/web/i18n.js +37 -59
- package/dist/user-data-rights/web/index.d.ts +1 -1
- package/dist/user-data-rights/web/index.js +1 -2
- package/dist/user-data-rights/web/privacy-center-screen.js +1 -2
- package/dist/user-data-rights/web/request-deletion-screen.js +0 -1
- package/dist/user-data-rights-defaults/hooks/file-ref.userdata-hook.js +6 -1
- package/dist/user-profile/feature.js +1 -1
- package/dist/user-profile/handlers/change-email.write.js +1 -1
- package/dist/user-profile/index.d.ts +1 -1
- package/dist/user-profile/index.js +1 -1
- package/dist/user-profile/web/client-plugin.js +2 -3
- package/dist/user-profile/{constants.js → web/constants.js} +0 -1
- package/dist/user-profile/{i18n.js → web/i18n.js} +0 -1
- package/dist/user-profile/web/profile-screen.js +2 -3
- package/dist/waitlist/entity.js +1 -1
- package/dist/waitlist/feature.js +1 -1
- package/dist/waitlist/handlers/export-purge.write.js +1 -1
- package/dist/waitlist/handlers/invite.write.js +1 -1
- package/dist/waitlist/handlers/reject.write.js +1 -1
- package/dist/waitlist/handlers/submit.write.js +4 -3
- package/dist/waitlist/import.d.ts +1 -1
- package/dist/waitlist/index.d.ts +1 -1
- package/dist/waitlist/index.js +1 -1
- package/dist/waitlist/legacy-migrate.js +1 -1
- package/dist/waitlist/link-on-signup.js +1 -1
- package/dist/waitlist/mail.d.ts +0 -1
- package/dist/waitlist/mail.js +6 -4
- package/dist/waitlist/payloads.js +1 -1
- package/dist/waitlist/screens.js +1 -1
- package/dist/waitlist/{constants.js → web/constants.js} +0 -1
- package/kumiko-es-tables.json +102 -0
- package/package.json +30 -29
- package/src/audit/changes.json +7 -0
- package/src/auth-email-password/changes.json +6 -0
- package/src/auth-mfa/changes.json +6 -0
- package/src/billing-foundation/changes.json +18 -0
- package/src/delivery/changes.json +6 -0
- package/src/document-ingest-foundation/changes.json +6 -0
- package/src/files/changes.json +7 -0
- package/src/form-draft/changes.json +7 -0
- package/src/ledger/changes.json +7 -0
- package/src/presets/changes.json +7 -0
- package/src/tags/changes.json +6 -0
- package/src/template-resolver/changes.json +43 -0
- package/src/user-data-rights/changes.json +14 -0
- package/src/waitlist/changes.json +6 -0
- package/dist/admin-shell/i18n.d.ts +0 -5
- package/dist/admin-shell/i18n.js +0 -51
- package/dist/audit/i18n.d.ts +0 -5
- package/dist/audit/i18n.js +0 -22
- package/dist/jobs/i18n.d.ts +0 -5
- package/dist/jobs/i18n.js +0 -52
- package/dist/managed-pages/i18n.d.ts +0 -5
- package/dist/managed-pages/i18n.js +0 -55
- package/dist/presets/dsgvo-self-service.d.ts +0 -10
- package/dist/presets/dsgvo-self-service.js +0 -24
- package/dist/user-data-rights/i18n.d.ts +0 -5
- package/dist/user-data-rights/i18n.js +0 -39
- /package/dist/account-security/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/account-security/{i18n.d.ts → web/i18n.d.ts} +0 -0
- /package/dist/admin-shell/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/auth-email-password/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/auth-email-password/{i18n.d.ts → web/i18n.d.ts} +0 -0
- /package/dist/auth-email-password/{mail-i18n.d.ts → web/mail-i18n.d.ts} +0 -0
- /package/dist/auth-mfa/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/billing-foundation/{consumer-protection → web/consumer-protection}/consent-locale.d.ts +0 -0
- /package/dist/billing-foundation/{contact-card.d.ts → web/contact-card.d.ts} +0 -0
- /package/dist/cap-overview/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/cap-overview/{usage-math.js → web/usage-math.js} +0 -0
- /package/dist/compliance-profiles/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/config/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/custom-fields/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/delivery/{public-names.d.ts → web/public-names.d.ts} +0 -0
- /package/dist/feature-toggles/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/folders/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/form-draft/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/jobs/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/ledger/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/legal-pages/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/metrics/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/notes-history/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/personal-access-tokens/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/personal-access-tokens/{scopes.d.ts → web/scopes.d.ts} +0 -0
- /package/dist/personal-access-tokens/{scopes.js → web/scopes.js} +0 -0
- /package/dist/secrets/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/sessions/{i18n.d.ts → web/i18n.d.ts} +0 -0
- /package/dist/template-resolver/{document-blocks.d.ts → web/document-blocks.d.ts} +0 -0
- /package/dist/template-resolver/{document-blocks.js → web/document-blocks.js} +0 -0
- /package/dist/template-resolver/{document-images.d.ts → web/document-images.d.ts} +0 -0
- /package/dist/template-resolver/{document-schema.d.ts → web/document-schema.d.ts} +0 -0
- /package/dist/template-resolver/{document-steps.d.ts → web/document-steps.d.ts} +0 -0
- /package/dist/template-resolver/{mail-constants.d.ts → web/mail-constants.d.ts} +0 -0
- /package/dist/template-resolver/{pdf-constants.d.ts → web/pdf-constants.d.ts} +0 -0
- /package/dist/template-resolver/{placeholder-text.d.ts → web/placeholder-text.d.ts} +0 -0
- /package/dist/template-resolver/{placeholder-text.js → web/placeholder-text.js} +0 -0
- /package/dist/template-resolver/{qualified-names.d.ts → web/qualified-names.d.ts} +0 -0
- /package/dist/tenant/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/tier-engine/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/tier-engine/{i18n.d.ts → web/i18n.d.ts} +0 -0
- /package/dist/user/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/user-data-rights/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/user-profile/{constants.d.ts → web/constants.d.ts} +0 -0
- /package/dist/user-profile/{i18n.d.ts → web/i18n.d.ts} +0 -0
- /package/dist/waitlist/{constants.d.ts → web/constants.d.ts} +0 -0
|
@@ -3,10 +3,12 @@ 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.js";
|
|
6
7
|
import { isFileAttachmentEntry, isPdfAttachmentLink, parseLinkedResourceEntries, } from "../linked-resources.js";
|
|
7
|
-
import { TemplateResolverErrors } from "../qualified-names.js";
|
|
8
8
|
import { templateResourcesTable } from "../table.js";
|
|
9
|
+
import { deliveryPolicyOf } from "../template-delivery-policy.js";
|
|
9
10
|
import { readTemplateResource } from "../template-resources.js";
|
|
11
|
+
import { TemplateResolverErrors } from "../web/qualified-names.js";
|
|
10
12
|
import { kindSchema, templateSlugSchema } from "./shared.js";
|
|
11
13
|
import { parseStoredJson, storedRecord } from "./template-gates.js";
|
|
12
14
|
// The files live in the system tenant's key space; readTemplateResource only
|
|
@@ -77,7 +79,8 @@ export const exportBundleQuery = defineQueryHandler({
|
|
|
77
79
|
const found = await selectMany(ctx.db, templateResourcesTable, scope === "system"
|
|
78
80
|
? { tenantId: SYSTEM_TENANT_ID, slug, kind, scope: "system", status: "active" }
|
|
79
81
|
: { tenantId: query.user.tenantId, slug, kind, scope: "tenant" });
|
|
80
|
-
const
|
|
82
|
+
const policy = deliveryPolicyOf(ctx.registry);
|
|
83
|
+
const rows = (await filterDeliveredTo(ctx.db, policy, query.user, found))
|
|
81
84
|
.filter((row) => row.status !== "archived")
|
|
82
85
|
.sort((a, b) => a.locale.localeCompare(b.locale));
|
|
83
86
|
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 { templateResourcesTable } from "../table.js";
|
|
5
|
+
import { deliveryPolicyOf, isRowServedTo } from "../template-delivery-policy.js";
|
|
5
6
|
import { draftViewerTenantId, isHiddenSystemDraft, toWorkingRow } from "../template-draft.js";
|
|
6
7
|
import { isSystemOnlyTemplateHiddenFrom } from "../template-system-only.js";
|
|
7
8
|
// Admin-Lookup für UI-Edit-Flow. Returnt das raw Template inkl. draft/
|
|
@@ -13,14 +14,15 @@ export const findByIdQuery = defineQueryHandler({
|
|
|
13
14
|
name: "find-by-id",
|
|
14
15
|
schema: z.object({ id: z.string().min(1) }),
|
|
15
16
|
access: { roles: ["TenantAdmin", "SystemAdmin", "User"] },
|
|
16
|
-
description: "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.",
|
|
17
|
+
description: "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.",
|
|
17
18
|
handler: async (query, ctx) => {
|
|
18
19
|
const stored = await fetchOne(ctx.db, templateResourcesTable, {
|
|
19
20
|
id: query.payload.id,
|
|
20
21
|
});
|
|
21
22
|
if (!stored ||
|
|
22
23
|
isHiddenSystemDraft(query.user, stored) ||
|
|
23
|
-
isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, stored)
|
|
24
|
+
isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, stored) ||
|
|
25
|
+
!isRowServedTo(deliveryPolicyOf(ctx.registry), query.user, stored)) {
|
|
24
26
|
return null;
|
|
25
27
|
}
|
|
26
28
|
const row = toWorkingRow(stored, draftViewerTenantId(query.user, stored));
|
|
@@ -1,11 +1,13 @@
|
|
|
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.js";
|
|
5
5
|
import { readLayoutRegions } from "../layout-regions.js";
|
|
6
6
|
import { templateResourcesTable } from "../table.js";
|
|
7
|
+
import { deliveryPolicyOf } from "../template-delivery-policy.js";
|
|
7
8
|
import { draftViewerTenantId, isHiddenSystemDraft, toWorkingRow, } from "../template-draft.js";
|
|
8
9
|
import { readMailLayoutMeta } from "../template-meta.js";
|
|
10
|
+
import { FALLBACK_LOCALE } from "../web/constants.js";
|
|
9
11
|
import { localeSchema, templateSlugSchema } from "./shared.js";
|
|
10
12
|
import { parseStoredJson } from "./template-gates.js";
|
|
11
13
|
const EMPTY_REGIONS = { header: "", signature: "", footer: "" };
|
|
@@ -77,10 +79,8 @@ export const layoutSourceQuery = defineQueryHandler({
|
|
|
77
79
|
handler: async (query, ctx) => {
|
|
78
80
|
const { kind, slug, locale } = query.payload;
|
|
79
81
|
const isSystemAdmin = query.user.roles.includes("SystemAdmin");
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
slug,
|
|
83
|
-
});
|
|
82
|
+
const policy = deliveryPolicyOf(ctx.registry);
|
|
83
|
+
const rows = await filterDeliveredTo(ctx.db, policy, query.user, await selectMany(ctx.db, templateResourcesTable, { kind, slug }));
|
|
84
84
|
const { tenantRow, systemRow } = pickEditedRows(rows, query.user, locale);
|
|
85
85
|
return buildLayoutSource({ kind, locale, isSystemAdmin, tenantRow, systemRow });
|
|
86
86
|
},
|
|
@@ -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.js";
|
|
5
4
|
import { templateResourcesTable } from "../table.js";
|
|
5
|
+
import { deliveryPolicyOf, isRowServedTo } from "../template-delivery-policy.js";
|
|
6
6
|
import { isHiddenSystemDraft } from "../template-draft.js";
|
|
7
7
|
import { isSystemOnlyTemplateHiddenFrom } from "../template-system-only.js";
|
|
8
|
+
import { TEMPLATE_KINDS, TEMPLATE_STATUSES } from "../web/constants.js";
|
|
8
9
|
// ctx.db is tenant-scoped even for SystemAdmin: every caller sees its own
|
|
9
10
|
// tenant's rows plus the system defaults, never another tenant's rows.
|
|
10
11
|
export const listQuery = defineQueryHandler({
|
|
@@ -39,9 +40,11 @@ export const listQuery = defineQueryHandler({
|
|
|
39
40
|
const rows = (await selectMany(ctx.db, templateResourcesTable, where, {
|
|
40
41
|
limit: 500,
|
|
41
42
|
}));
|
|
43
|
+
const deliveryPolicy = deliveryPolicyOf(ctx.registry);
|
|
42
44
|
return rows
|
|
43
45
|
.filter((row) => !isHiddenSystemDraft(query.user, row) &&
|
|
44
|
-
!isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, row)
|
|
46
|
+
!isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, row) &&
|
|
47
|
+
isRowServedTo(deliveryPolicy, query.user, row))
|
|
45
48
|
.map((row) => ({
|
|
46
49
|
id: String(row.id),
|
|
47
50
|
tenantId: row.tenantId,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import { type TemplateStatus } from "../constants.ts";
|
|
3
2
|
import { type TemplateResourceRow } from "../table.ts";
|
|
3
|
+
import { type TemplateDeliveryPolicy } from "../template-delivery-policy.ts";
|
|
4
4
|
import { type TemplateEditPolicy } from "../template-edit-policy.ts";
|
|
5
5
|
import { type EffectiveMailLayoutSlugs } from "../template-usage.ts";
|
|
6
|
+
import { type TemplateStatus } from "../web/constants.ts";
|
|
6
7
|
declare const OVERVIEW_KINDS: readonly ["mail", "document-pdf", "mail-layout", "pdf-layout"];
|
|
7
8
|
type OverviewKind = (typeof OVERVIEW_KINDS)[number];
|
|
8
9
|
export type OverviewOrigin = "tenant" | "system";
|
|
@@ -27,6 +28,13 @@ export type OverviewRow = {
|
|
|
27
28
|
readonly activeSince: string | null;
|
|
28
29
|
readonly systemVersion: number | null;
|
|
29
30
|
readonly layoutSlug: string | null;
|
|
31
|
+
/** SystemAdmin only: a tenant override is stored but not delivered because the template is not unlocked for tenants. */
|
|
32
|
+
readonly lockedOverride: boolean;
|
|
33
|
+
readonly lockedOverrideI18nKey: string | null;
|
|
34
|
+
/** 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. */
|
|
35
|
+
readonly lockedOverrideId: string | null;
|
|
36
|
+
/** False when a locked override has no system version to fall back to, so a reset would be refused. */
|
|
37
|
+
readonly canResetLockedOverride: boolean;
|
|
30
38
|
readonly modifiedAt: string;
|
|
31
39
|
readonly usedBy: readonly OverviewUsage[];
|
|
32
40
|
readonly usedByCount: number;
|
|
@@ -38,7 +46,7 @@ export type OverviewResponse = {
|
|
|
38
46
|
/** True when the tenant has more template rows than the overview reads; rows and total are then incomplete. */
|
|
39
47
|
readonly truncated: boolean;
|
|
40
48
|
};
|
|
41
|
-
export declare function effectiveMailLayoutSlugs(rows: readonly TemplateResourceRow[]): EffectiveMailLayoutSlugs;
|
|
49
|
+
export declare function effectiveMailLayoutSlugs(rows: readonly TemplateResourceRow[], policy: TemplateDeliveryPolicy): EffectiveMailLayoutSlugs;
|
|
42
50
|
export declare function makeOverviewQuery(policy: TemplateEditPolicy): import("@cosmicdrift/kumiko-types/define-handler").QueryHandlerDefinition<"overview", z.ZodObject<{
|
|
43
51
|
search: z.ZodOptional<z.ZodString>;
|
|
44
52
|
filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1,15 +1,17 @@
|
|
|
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 } from "../constants.js";
|
|
5
4
|
import { templateResourcesTable } from "../table.js";
|
|
5
|
+
import { deliveryPolicyOf, isTenantOverrideServed, } from "../template-delivery-policy.js";
|
|
6
6
|
import { activeSinceOf, activeVersionOf, draftViewerTenantId, isHiddenSystemDraft, parseTemplateDraft, servedVersionOf, } from "../template-draft.js";
|
|
7
7
|
import { mayEditTemplate } from "../template-edit-policy.js";
|
|
8
8
|
import { isSystemOnlyTemplateHiddenFrom } from "../template-system-only.js";
|
|
9
9
|
import { collectTemplateUsage } from "../template-usage.js";
|
|
10
|
+
import { DEFAULT_MAIL_LAYOUT_SLUG, FALLBACK_LOCALE, } from "../web/constants.js";
|
|
10
11
|
import { storedRecord } from "./template-gates.js";
|
|
11
12
|
const OVERVIEW_KINDS = ["mail", "document-pdf", "mail-layout", "pdf-layout"];
|
|
12
13
|
const OVERVIEW_ROW_LIMIT = 5000;
|
|
14
|
+
const LOCKED_OVERRIDE_I18N_KEY = "templateResolver.overview.lockedOverride";
|
|
13
15
|
const SORT_FIELDS = ["title", "slug", "kind", "origin", "status", "modifiedAt"];
|
|
14
16
|
const KIND_GROUP = {
|
|
15
17
|
mail: "mail",
|
|
@@ -31,20 +33,41 @@ function preferredRow(rows) {
|
|
|
31
33
|
return (rows.find((row) => row.locale === FALLBACK_LOCALE) ??
|
|
32
34
|
[...rows].sort((a, b) => a.locale.localeCompare(b.locale))[0]);
|
|
33
35
|
}
|
|
34
|
-
|
|
36
|
+
// A tenant row of a template that is not unlocked is not delivered, so the system version is the effective one.
|
|
37
|
+
function effectiveRowsOf(rows, policy) {
|
|
35
38
|
const tenantRows = rows.filter((row) => row.scope === "tenant");
|
|
36
39
|
const systemRows = rows.filter((row) => row.scope === "system");
|
|
37
40
|
const live = (list) => list.filter((row) => row.status !== "archived");
|
|
38
41
|
const liveTenant = live(tenantRows);
|
|
42
|
+
const tenantServed = tenantRows.every((row) => isTenantOverrideServed(policy, row));
|
|
43
|
+
if (!tenantServed && liveTenant.length > 0) {
|
|
44
|
+
const liveSystem = live(systemRows);
|
|
45
|
+
if (systemRows.length === 0)
|
|
46
|
+
return { origin: "tenant", rows: liveTenant, lockedOverride: true, lockedOverrideId: null };
|
|
47
|
+
const lockedRow = preferredRow(liveTenant);
|
|
48
|
+
return {
|
|
49
|
+
origin: "system",
|
|
50
|
+
rows: liveSystem.length > 0 ? liveSystem : systemRows,
|
|
51
|
+
lockedOverride: true,
|
|
52
|
+
lockedOverrideId: lockedRow === undefined ? null : String(lockedRow.id),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
39
55
|
if (liveTenant.length > 0)
|
|
40
|
-
return { origin: "tenant", rows: liveTenant };
|
|
56
|
+
return { origin: "tenant", rows: liveTenant, lockedOverride: false, lockedOverrideId: null };
|
|
41
57
|
if (systemRows.length > 0) {
|
|
42
58
|
const liveSystem = live(systemRows);
|
|
43
|
-
return {
|
|
59
|
+
return {
|
|
60
|
+
origin: "system",
|
|
61
|
+
rows: liveSystem.length > 0 ? liveSystem : systemRows,
|
|
62
|
+
lockedOverride: false,
|
|
63
|
+
lockedOverrideId: null,
|
|
64
|
+
};
|
|
44
65
|
}
|
|
45
|
-
return tenantRows.length > 0
|
|
66
|
+
return tenantRows.length > 0
|
|
67
|
+
? { origin: "tenant", rows: tenantRows, lockedOverride: false, lockedOverrideId: null }
|
|
68
|
+
: null;
|
|
46
69
|
}
|
|
47
|
-
export function effectiveMailLayoutSlugs(rows) {
|
|
70
|
+
export function effectiveMailLayoutSlugs(rows, policy) {
|
|
48
71
|
const byLocale = new Map();
|
|
49
72
|
for (const row of rows) {
|
|
50
73
|
if (row.kind !== "mail")
|
|
@@ -54,7 +77,11 @@ export function effectiveMailLayoutSlugs(rows) {
|
|
|
54
77
|
}
|
|
55
78
|
const bySlug = new Map();
|
|
56
79
|
for (const group of byLocale.values()) {
|
|
57
|
-
const
|
|
80
|
+
const effectiveRows = effectiveRowsOf(group, policy);
|
|
81
|
+
// A locked tenant row without a system row is not delivered, so it names no layout.
|
|
82
|
+
if (effectiveRows?.lockedOverride && effectiveRows.origin === "tenant")
|
|
83
|
+
continue;
|
|
84
|
+
const effective = effectiveRows?.rows[0];
|
|
58
85
|
// All-archived: the renderer falls back to the code-registered template.
|
|
59
86
|
if (effective === undefined || effective.status === "archived")
|
|
60
87
|
continue;
|
|
@@ -105,11 +132,11 @@ function versionFieldsOf(user, preferred, groupRows) {
|
|
|
105
132
|
systemVersion: systemSameLocale === undefined ? null : activeVersionOf(systemSameLocale),
|
|
106
133
|
};
|
|
107
134
|
}
|
|
108
|
-
function buildDrafts(groups, user) {
|
|
135
|
+
function buildDrafts(groups, user, policy) {
|
|
109
136
|
const layoutSlugByDocument = new Map();
|
|
110
137
|
const drafts = [];
|
|
111
138
|
for (const [id, groupRows] of groups) {
|
|
112
|
-
const effective = effectiveRowsOf(groupRows);
|
|
139
|
+
const effective = effectiveRowsOf(groupRows, policy);
|
|
113
140
|
const preferred = effective === null ? undefined : preferredRow(effective.rows);
|
|
114
141
|
if (effective === null || preferred === undefined)
|
|
115
142
|
continue;
|
|
@@ -131,6 +158,10 @@ function buildDrafts(groups, user) {
|
|
|
131
158
|
status: preferred.status,
|
|
132
159
|
...versionFieldsOf(user, preferred, groupRows),
|
|
133
160
|
layoutSlug,
|
|
161
|
+
lockedOverride: effective.lockedOverride,
|
|
162
|
+
lockedOverrideI18nKey: effective.lockedOverride ? LOCKED_OVERRIDE_I18N_KEY : null,
|
|
163
|
+
lockedOverrideId: effective.lockedOverrideId,
|
|
164
|
+
canResetLockedOverride: effective.lockedOverrideId !== null,
|
|
134
165
|
modifiedAt: modifiedAtOf(preferred),
|
|
135
166
|
});
|
|
136
167
|
}
|
|
@@ -186,7 +217,7 @@ export function makeOverviewQuery(policy) {
|
|
|
186
217
|
totalCount: z.boolean().optional(),
|
|
187
218
|
}),
|
|
188
219
|
access: { roles: ["TenantAdmin", "SystemAdmin"] },
|
|
189
|
-
description: "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.",
|
|
220
|
+
description: "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.",
|
|
190
221
|
handler: async (query, ctx) => {
|
|
191
222
|
const payload = query.payload;
|
|
192
223
|
const fetchedRows = await selectMany(ctx.db, templateResourcesTable, { kind: { in: [...OVERVIEW_KINDS] } }, { orderBy: { col: "id", direction: "asc" }, limit: OVERVIEW_ROW_LIMIT + 1 });
|
|
@@ -200,8 +231,9 @@ export function makeOverviewQuery(policy) {
|
|
|
200
231
|
const visibleRows = rows.filter((row) => !isHiddenSystemDraft(query.user, row) &&
|
|
201
232
|
!isSystemOnlyTemplateHiddenFrom(query.user, ctx.registry, row) &&
|
|
202
233
|
mayEditTemplate(policy, query.user, row));
|
|
203
|
-
const
|
|
204
|
-
const
|
|
234
|
+
const deliveryPolicy = deliveryPolicyOf(ctx.registry);
|
|
235
|
+
const { drafts, layoutSlugByDocument } = buildDrafts(groupBySlugAndKind(visibleRows), query.user, deliveryPolicy);
|
|
236
|
+
const effectiveLayouts = effectiveMailLayoutSlugs(visibleRows, deliveryPolicy);
|
|
205
237
|
const overviewRows = drafts.map((draft) => withUsage(draft, layoutSlugByDocument, ctx.registry, effectiveLayouts));
|
|
206
238
|
const filtered = filterRows(overviewRows, payload.search, payload.filters ?? [], payload.layoutSlug);
|
|
207
239
|
const sortField = payload.sort !== undefined && isSortField(payload.sort) ? payload.sort : "modifiedAt";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { NotFoundError, ValidationError, VersionConflictError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
3
|
import * as z from "zod";
|
|
4
|
-
import { DOCUMENT_HTML_KINDS } from "../constants.js";
|
|
5
4
|
import { applyDocumentOps, documentOpsSchema } from "../document-ops.js";
|
|
6
5
|
import { parseDocumentJson, serializeDocumentJson } from "../document-sanitizer.js";
|
|
7
6
|
import { refuseTemplateEdit, templateEditAccess, } from "../template-edit-policy.js";
|
|
8
7
|
import { resolveTemplateVariables } from "../template-validation.js";
|
|
8
|
+
import { DOCUMENT_HTML_KINDS } from "../web/constants.js";
|
|
9
9
|
import { loadDocumentBase } from "./document-base.js";
|
|
10
10
|
import { localeSchema, templateSlugSchema } from "./shared.js";
|
|
11
11
|
import { writeTemplateRow } from "./template-write.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import { isDocumentResourceKey } from "../document-schema.js";
|
|
2
|
+
import { isDocumentResourceKey } from "../web/document-schema.js";
|
|
3
3
|
export const RESOURCE_MAX_BYTES_CONFIG_KEY = "template-resolver:config:resource-max-bytes";
|
|
4
4
|
export const DEFAULT_RESOURCE_MAX_BYTES = 2 * 1024 * 1024;
|
|
5
5
|
export const resourceKeySchema = z.string().min(1).max(64).refine(isDocumentResourceKey, {
|
|
@@ -3,9 +3,9 @@ import { NotFoundError, UnprocessableError, writeFailure, } from "@cosmicdrift/k
|
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { FileRefTooLargeError, fileContextForTenant, readFileRefContent, } from "../../file-foundation/index.js";
|
|
5
5
|
import { attachmentFileNameSchema } from "../../shared/index.js";
|
|
6
|
-
import { TemplateResolverErrors } from "../qualified-names.js";
|
|
7
6
|
import { prepareTemplateAttachmentBeforeTransaction, prepareTemplateResourceBeforeTransaction, readTemplateResourceMaxBytes, storePreparedTemplateAttachment, storePreparedTemplateResource, } from "../store-template-resource.js";
|
|
8
7
|
import { refuseTemplateEditById, templateEditAccess, } from "../template-edit-policy.js";
|
|
8
|
+
import { TemplateResolverErrors } from "../web/qualified-names.js";
|
|
9
9
|
import { RESOURCE_PURPOSES, resourceKeySchema, resourceTargetTenantId } from "./resource-shared.js";
|
|
10
10
|
function attachmentTargetOf(input) {
|
|
11
11
|
const { templateId, key, fileName } = input;
|
|
@@ -1,10 +1,10 @@
|
|
|
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.js";
|
|
5
|
-
import { TemplateResolverErrors } from "../qualified-names.js";
|
|
6
4
|
import { refuseTemplateEdit, templateEditAccess, } from "../template-edit-policy.js";
|
|
7
5
|
import { renderTemplatePreview } from "../template-preview.js";
|
|
6
|
+
import { TEST_MAIL_SUBJECT_PREFIX } from "../web/constants.js";
|
|
7
|
+
import { TemplateResolverErrors } from "../web/qualified-names.js";
|
|
8
8
|
import { emailChannelOf, resolveTestMailAddress, testMailChannelContext, } from "./send-test-shared.js";
|
|
9
9
|
import { localeSchema, templateSlugSchema } from "./shared.js";
|
|
10
10
|
const TEST_MAIL_RATE_LIMIT = { limit: 10, windowSeconds: 3600 };
|
|
@@ -3,10 +3,10 @@ import { defineWriteHandler, SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-frame
|
|
|
3
3
|
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import { requireForTenant } from "../../shared/index.js";
|
|
6
|
-
import { TEMPLATE_KINDS, TEXT_BLOCK_KIND, UPSERT_KINDS } from "../constants.js";
|
|
7
6
|
import { templateResourcesTable } from "../table.js";
|
|
8
7
|
import { refuseTemplateEdit, templateEditAccess, } from "../template-edit-policy.js";
|
|
9
8
|
import { resolveTemplateVariables } from "../template-validation.js";
|
|
9
|
+
import { TEMPLATE_KINDS, TEXT_BLOCK_KIND, UPSERT_KINDS } from "../web/constants.js";
|
|
10
10
|
import { contentFormatSchema, executor, folderSchema, localeSchema, slugSchema } from "./shared.js";
|
|
11
11
|
import { parseStoredJson, storedRecord } from "./template-gates.js";
|
|
12
12
|
import { gateTemplateWrite } from "./template-write.js";
|
|
@@ -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.js";
|
|
4
3
|
import { templateResourceEntity, templateResourcesTable } from "../table.js";
|
|
5
4
|
import { templateSlugSchema } from "../template-meta.js";
|
|
5
|
+
import { CONTENT_FORMATS, TEMPLATE_STATUSES, UPSERT_KINDS } from "../web/constants.js";
|
|
6
6
|
// One executor per bundle, shared by all four handlers for create/update via
|
|
7
7
|
// event store + optimistic lock.
|
|
8
8
|
export const executor = createEventStoreExecutor(templateResourcesTable, templateResourceEntity, {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Registry, TemplateVariables } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import type { FieldIssue } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
|
-
import { type ContentFormat, type TemplateKind } from "../constants.ts";
|
|
4
3
|
import { type TemplateWriteScope } from "../layout-regions.ts";
|
|
5
4
|
import type { TemplateResourceRow } from "../table.ts";
|
|
6
5
|
import { type TemplateValidation } from "../template-validation.ts";
|
|
6
|
+
import { type ContentFormat, type TemplateKind } from "../web/constants.ts";
|
|
7
7
|
export declare function placeholderIssues(validation: TemplateValidation, opts: {
|
|
8
8
|
readonly requireAllRequired: boolean;
|
|
9
9
|
}): FieldIssue[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
2
|
-
import { CONTENT_FORMATS, TEMPLATE_KINDS, } from "../constants.js";
|
|
3
2
|
import { documentViolationsToFieldIssues } from "../document-sanitizer.js";
|
|
4
3
|
import { sanitizeTemplateWriteBody } from "../layout-regions.js";
|
|
5
4
|
import { imageResourceKeysOf } from "../linked-resources.js";
|
|
6
5
|
import { parseTemplateMeta } from "../template-meta.js";
|
|
7
6
|
import { resolveTemplateVariables, validateTemplatePlaceholders, } from "../template-validation.js";
|
|
7
|
+
import { CONTENT_FORMATS, TEMPLATE_KINDS, } from "../web/constants.js";
|
|
8
8
|
const PLACEHOLDER_VALIDATED_KINDS = new Set([
|
|
9
9
|
"mail",
|
|
10
10
|
"document-pdf",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type HandlerContext, type Registry, type SessionUser, type TemplateVariables, type TenantId, type WriteResult } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { type WriteFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
|
-
import type { ContentFormat, TemplateKind } from "../constants.ts";
|
|
4
3
|
import type { TemplateWriteScope } from "../layout-regions.ts";
|
|
5
4
|
import type { TemplateValidation } from "../template-validation.ts";
|
|
5
|
+
import type { ContentFormat, TemplateKind } from "../web/constants.ts";
|
|
6
6
|
import { type TemplateWriteInput, type TemplateWriteResult } from "./template-gates.ts";
|
|
7
7
|
export type TemplateRowPayload = {
|
|
8
8
|
readonly slug: string;
|
|
@@ -2,10 +2,10 @@ import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
|
2
2
|
import { SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { AccessDeniedError, ValidationError, VersionConflictError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import { requireForTenant } from "../../shared/index.js";
|
|
5
|
-
import { TemplateResolverErrors } from "../qualified-names.js";
|
|
6
5
|
import { templateResourcesTable } from "../table.js";
|
|
7
6
|
import { activationChanges, serializeTemplateDraft } from "../template-draft.js";
|
|
8
7
|
import { isSystemOnlyTemplate } from "../template-system-only.js";
|
|
8
|
+
import { TemplateResolverErrors } from "../web/qualified-names.js";
|
|
9
9
|
import { executor } from "./shared.js";
|
|
10
10
|
import { evaluateTemplateWrite, } from "./template-gates.js";
|
|
11
11
|
// The tenant-scope-under-system-tenant ban lives here so no write path can
|
|
@@ -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.js";
|
|
5
4
|
import { templateResourcesTable } from "../table.js";
|
|
5
|
+
import { deliveryPolicyOf } from "../template-delivery-policy.js";
|
|
6
6
|
import { templateSlugSchema } from "../template-meta.js";
|
|
7
7
|
import { collectTemplateUsage } from "../template-usage.js";
|
|
8
|
+
import { TEMPLATE_KINDS } from "../web/constants.js";
|
|
8
9
|
import { effectiveMailLayoutSlugs } from "./overview.query.js";
|
|
9
10
|
const MAIL_ROW_LIMIT = 5000;
|
|
10
11
|
export const usageQuery = defineQueryHandler({
|
|
@@ -18,7 +19,7 @@ export const usageQuery = defineQueryHandler({
|
|
|
18
19
|
return { usedBy: collectTemplateUsage(ctx.registry, slug, kind) };
|
|
19
20
|
const mailRows = await selectMany(ctx.db, templateResourcesTable, { kind: "mail" }, { limit: MAIL_ROW_LIMIT });
|
|
20
21
|
return {
|
|
21
|
-
usedBy: collectTemplateUsage(ctx.registry, slug, kind, effectiveMailLayoutSlugs(mailRows)),
|
|
22
|
+
usedBy: collectTemplateUsage(ctx.registry, slug, kind, effectiveMailLayoutSlugs(mailRows, deliveryPolicyOf(ctx.registry))),
|
|
22
23
|
};
|
|
23
24
|
},
|
|
24
25
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type HandlerContext, type SessionUser } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
import type { ContentFormat, UpsertKind } from "../constants.ts";
|
|
4
3
|
import type { TemplateWriteScope } from "../layout-regions.ts";
|
|
4
|
+
import type { ContentFormat, UpsertKind } from "../web/constants.ts";
|
|
5
5
|
type TemplateDraftInput = {
|
|
6
6
|
readonly slug: string;
|
|
7
7
|
readonly kind: UpsertKind;
|
|
@@ -3,6 +3,7 @@ import { defineQueryHandler, SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-frame
|
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { imageResourceKeysOf } from "../linked-resources.js";
|
|
5
5
|
import { templateResourcesTable } from "../table.js";
|
|
6
|
+
import { deliveryPolicyOf, isRowServedTo } from "../template-delivery-policy.js";
|
|
6
7
|
import { isSystemAdmin } from "../template-draft.js";
|
|
7
8
|
import { resolveTemplateVariables, systemPlaceholdersFor } from "../template-validation.js";
|
|
8
9
|
import { contentFormatSchema, kindSchema, localeSchema, templateSlugSchema } from "./shared.js";
|
|
@@ -29,7 +30,8 @@ export async function knownResourceKeysFor(ctx, user, where) {
|
|
|
29
30
|
scope: "system",
|
|
30
31
|
locale,
|
|
31
32
|
})),
|
|
32
|
-
...(scope === "tenant"
|
|
33
|
+
...(scope === "tenant" &&
|
|
34
|
+
isRowServedTo(deliveryPolicyOf(ctx.registry), user, { tenantId: user.tenantId, kind, slug })
|
|
33
35
|
? await knownResourceKeys(ctx.db, { tenantId: user.tenantId, slug, kind, scope, locale })
|
|
34
36
|
: []),
|
|
35
37
|
];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { handlerTitleKey } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { TemplateResolverHandlers as H } from "./web/qualified-names.js";
|
|
3
|
+
// The AI assistant and its approval prompts name a handler by its title key; without
|
|
4
|
+
// one the user reads the raw handler name. de/es/fr/it live in the locale packages.
|
|
5
|
+
export const TEMPLATE_RESOLVER_I18N = {
|
|
6
|
+
[handlerTitleKey(H.upsertSystem)]: { en: "Save system template" },
|
|
7
|
+
[handlerTitleKey(H.upsertTenant)]: { en: "Save template" },
|
|
8
|
+
[handlerTitleKey(H.publish)]: { en: "Publish template" },
|
|
9
|
+
[handlerTitleKey(H.archive)]: { en: "Archive template" },
|
|
10
|
+
[handlerTitleKey(H.publishSystem)]: { en: "Publish system template" },
|
|
11
|
+
[handlerTitleKey(H.archiveSystem)]: { en: "Archive system template" },
|
|
12
|
+
[handlerTitleKey(H.discardDraft)]: { en: "Discard draft" },
|
|
13
|
+
[handlerTitleKey(H.discardDraftSystem)]: { en: "Discard system template draft" },
|
|
14
|
+
[handlerTitleKey(H.resetToSystem)]: { en: "Reset to system template" },
|
|
15
|
+
[handlerTitleKey(H.set)]: { en: "Save text" },
|
|
16
|
+
[handlerTitleKey(H.importBundle)]: { en: "Import template" },
|
|
17
|
+
[handlerTitleKey(H.importBundleSystem)]: { en: "Import system template" },
|
|
18
|
+
[handlerTitleKey(H.copyLocale)]: { en: "Copy template to another language" },
|
|
19
|
+
[handlerTitleKey(H.resourceUpload)]: { en: "Upload image or attachment" },
|
|
20
|
+
[handlerTitleKey(H.resourceRemove)]: { en: "Remove image or attachment" },
|
|
21
|
+
[handlerTitleKey(H.resourceLinkPdf)]: { en: "Attach PDF template" },
|
|
22
|
+
[handlerTitleKey(H.sendTest)]: { en: "Send test mail" },
|
|
23
|
+
[handlerTitleKey(H.patchDraft)]: { en: "Edit template draft" },
|
|
24
|
+
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export { isResourceImageContentType } from "../shared/index.ts";
|
|
2
2
|
export { createTemplateResolverApi, type ResolveRequest, requireTemplateResolver, TemplateNotFoundError, type TemplateResolverApi, type TemplateResource, } from "./api.ts";
|
|
3
3
|
export { type CompileDocumentBodyOptions, collectDocumentImageVariables, collectDocumentResourceKeys, compileDocumentBodyToHandlebars, toResourceDataUri, } from "./compile-document-body.ts";
|
|
4
|
-
export { CONTENT_FORMATS, type ContentFormat, DEFAULT_MAIL_LAYOUT_SLUG, DEFAULT_PDF_LAYOUT_SLUG, DOCUMENT_HTML_KINDS, type DocumentHtmlKind, FALLBACK_LOCALE, NON_RENDER_KINDS, type NonRenderKind, PDF_DEFAULT_MARGIN_MM, PDF_FOOTER_MARGIN_MM, PDF_HEADER_MARGIN_MM, PDF_ORIENTATIONS, PDF_PAGE_FORMATS, type PdfOrientation, type PdfPageFormat, RENDER_KINDS, type RenderKind, SYSTEM_TENANT_ID, TEMPLATE_KINDS, TEMPLATE_SCOPES, TEMPLATE_STATUSES, TEXT_BLOCK_KIND, type TemplateKind, type TemplateScope, type TemplateStatus, UPSERT_KINDS, type UpsertKind, } from "./constants.ts";
|
|
5
4
|
export { type DocumentViolation, type DocumentViolationCode, documentViolationsToFieldIssues, flattenParagraphsToLineBreaks, type SanitizeBodyResult, type SanitizeHtmlResult, sanitizeDocumentHtml, sanitizeTemplateBody, } from "./document-sanitizer.ts";
|
|
6
|
-
export { DOCUMENT_CONDITION_ATTRIBUTE, DOCUMENT_NODE_NAMES, DOCUMENT_TEXT_ALIGNMENTS, DocumentButton, DocumentCondition, DocumentDivider, DocumentLink, DocumentPageBreak, DocumentResource, DocumentTable, DocumentTableCell, DocumentTableHeader, DocumentTableRow, DocumentTextAlign, type DocumentTextAlignment, DocumentVariable, documentExtensions, isAllowedDocumentLinkHref, isDocumentPlaceholderHref, isDocumentReferenceName, isDocumentResourceKey, } from "./document-schema.ts";
|
|
7
5
|
export { createTemplateResolverFeature, type TemplateResolverOptions } from "./feature.ts";
|
|
8
6
|
export type { LayoutSourceResponse, LayoutSourceRow } from "./handlers/layout-source.query.ts";
|
|
9
7
|
export type { OverviewKindGroup, OverviewOrigin, OverviewResponse, OverviewRow, OverviewUsage, } from "./handlers/overview.query.ts";
|
|
@@ -12,11 +10,11 @@ export { isHexColor, type MailLayoutAppearance, mailLayoutAppearance, } from "./
|
|
|
12
10
|
export { type LayoutRegions, readLayoutRegions, type SanitizeLayoutResult, sanitizeLayoutHtml, } from "./layout-regions.ts";
|
|
13
11
|
export { fileAttachmentsOf, imageLinksOf, type LinkedResourceEntry, parseLinkedResourceEntries, pdfAttachmentLinksOf, type TemplatePdfAttachmentLink, templatePdfAttachmentLinkSchema, } from "./linked-resources.ts";
|
|
14
12
|
export { prepareDocumentForPrint } from "./print-document.ts";
|
|
15
|
-
export { TEMPLATE_RESOLVER_FEATURE, TemplateResolverErrors, TemplateResolverHandlers, TemplateResolverQueries, } from "./qualified-names.ts";
|
|
16
13
|
export { mapRecordToVariables } from "./record-mapping.ts";
|
|
17
14
|
export { type PreparedTemplateImage, prepareTemplateResourceBeforeTransaction, readTemplateResourceMaxBytes, type StoredTemplateResource, storePreparedTemplateResource, } from "./store-template-resource.ts";
|
|
18
15
|
export { type TemplateResourceRow, templateResourceEntity, templateResourcesTable, } from "./table.ts";
|
|
19
16
|
export { type TemplateBundle, templateBundleSchema } from "./template-bundle.ts";
|
|
17
|
+
export type { TemplateDeliveryPolicy } from "./template-delivery-policy.ts";
|
|
20
18
|
export { type TemplateEditPolicy, type TenantEditableTemplate, templateEditAccess, } from "./template-edit-policy.ts";
|
|
21
19
|
export { isMailTemplateMeta, type LayoutTemplateMeta, MAIL_CATEGORIES, MAIL_TONES, type MailCategory, type MailLayoutMeta, type MailTemplateMeta, type MailTone, type PdfTemplateMeta, parseTemplateMeta, pdfAttachmentFileNamePatternSchema, readMailLayoutMeta, readPdfTemplateMeta, type TemplateMeta, type TemplateMetaIssue, type TemplateMetaResult, templateSlugSchema, } from "./template-meta.ts";
|
|
22
20
|
export { type DocumentDraftOutcome, evaluateDocumentDraft } from "./template-preview.ts";
|
|
@@ -25,3 +23,6 @@ export { isSystemOnlyTemplate } from "./template-system-only.ts";
|
|
|
25
23
|
export { collectTemplateUsage, type TemplateUsageEntry } from "./template-usage.ts";
|
|
26
24
|
export { hasPlaceholderProblems, resolveTemplateVariables, SYSTEM_PLACEHOLDERS, systemPlaceholdersFor, type TemplateValidation, validateTemplatePlaceholders, } from "./template-validation.ts";
|
|
27
25
|
export { type UserContentEntryRow, userContentEntriesTable, userContentEntryEntity, } from "./user-content-table.ts";
|
|
26
|
+
export { CONTENT_FORMATS, type ContentFormat, DEFAULT_MAIL_LAYOUT_SLUG, DEFAULT_PDF_LAYOUT_SLUG, DOCUMENT_HTML_KINDS, type DocumentHtmlKind, FALLBACK_LOCALE, NON_RENDER_KINDS, type NonRenderKind, PDF_DEFAULT_MARGIN_MM, PDF_FOOTER_MARGIN_MM, PDF_HEADER_MARGIN_MM, PDF_ORIENTATIONS, PDF_PAGE_FORMATS, type PdfOrientation, type PdfPageFormat, RENDER_KINDS, type RenderKind, SYSTEM_TENANT_ID, TEMPLATE_KINDS, TEMPLATE_SCOPES, TEMPLATE_STATUSES, TEXT_BLOCK_KIND, type TemplateKind, type TemplateScope, type TemplateStatus, UPSERT_KINDS, type UpsertKind, } from "./web/constants.ts";
|
|
27
|
+
export { DOCUMENT_CONDITION_ATTRIBUTE, DOCUMENT_NODE_NAMES, DOCUMENT_TEXT_ALIGNMENTS, DocumentButton, DocumentCondition, DocumentDivider, DocumentLink, DocumentPageBreak, DocumentResource, DocumentTable, DocumentTableCell, DocumentTableHeader, DocumentTableRow, DocumentTextAlign, type DocumentTextAlignment, DocumentVariable, documentExtensions, isAllowedDocumentLinkHref, isDocumentPlaceholderHref, isDocumentReferenceName, isDocumentResourceKey, } from "./web/document-schema.ts";
|
|
28
|
+
export { TEMPLATE_RESOLVER_FEATURE, TemplateResolverErrors, TemplateResolverHandlers, TemplateResolverQueries, } from "./web/qualified-names.ts";
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
export { isResourceImageContentType } from "../shared/index.js";
|
|
2
2
|
export { createTemplateResolverApi, requireTemplateResolver, TemplateNotFoundError, } from "./api.js";
|
|
3
3
|
export { collectDocumentImageVariables, collectDocumentResourceKeys, compileDocumentBodyToHandlebars, toResourceDataUri, } from "./compile-document-body.js";
|
|
4
|
-
export { CONTENT_FORMATS, DEFAULT_MAIL_LAYOUT_SLUG, DEFAULT_PDF_LAYOUT_SLUG, DOCUMENT_HTML_KINDS, FALLBACK_LOCALE, NON_RENDER_KINDS, PDF_DEFAULT_MARGIN_MM, PDF_FOOTER_MARGIN_MM, PDF_HEADER_MARGIN_MM, PDF_ORIENTATIONS, PDF_PAGE_FORMATS, RENDER_KINDS, SYSTEM_TENANT_ID, TEMPLATE_KINDS, TEMPLATE_SCOPES, TEMPLATE_STATUSES, TEXT_BLOCK_KIND, UPSERT_KINDS, } from "./constants.js";
|
|
5
4
|
export { documentViolationsToFieldIssues, flattenParagraphsToLineBreaks, sanitizeDocumentHtml, sanitizeTemplateBody, } from "./document-sanitizer.js";
|
|
6
|
-
export { DOCUMENT_CONDITION_ATTRIBUTE, DOCUMENT_NODE_NAMES, DOCUMENT_TEXT_ALIGNMENTS, DocumentButton, DocumentCondition, DocumentDivider, DocumentLink, DocumentPageBreak, DocumentResource, DocumentTable, DocumentTableCell, DocumentTableHeader, DocumentTableRow, DocumentTextAlign, DocumentVariable, documentExtensions, isAllowedDocumentLinkHref, isDocumentPlaceholderHref, isDocumentReferenceName, isDocumentResourceKey, } from "./document-schema.js";
|
|
7
5
|
export { createTemplateResolverFeature } from "./feature.js";
|
|
8
6
|
export { localeSchema } from "./handlers/shared.js";
|
|
9
7
|
export { isHexColor, mailLayoutAppearance, } from "./layout-appearance.js";
|
|
10
8
|
export { readLayoutRegions, sanitizeLayoutHtml, } from "./layout-regions.js";
|
|
11
9
|
export { fileAttachmentsOf, imageLinksOf, parseLinkedResourceEntries, pdfAttachmentLinksOf, templatePdfAttachmentLinkSchema, } from "./linked-resources.js";
|
|
12
10
|
export { prepareDocumentForPrint } from "./print-document.js";
|
|
13
|
-
export { TEMPLATE_RESOLVER_FEATURE, TemplateResolverErrors, TemplateResolverHandlers, TemplateResolverQueries, } from "./qualified-names.js";
|
|
14
11
|
export { mapRecordToVariables } from "./record-mapping.js";
|
|
15
12
|
export { prepareTemplateResourceBeforeTransaction, readTemplateResourceMaxBytes, storePreparedTemplateResource, } from "./store-template-resource.js";
|
|
16
13
|
export { templateResourceEntity, templateResourcesTable, } from "./table.js";
|
|
@@ -23,3 +20,6 @@ export { isSystemOnlyTemplate } from "./template-system-only.js";
|
|
|
23
20
|
export { collectTemplateUsage } from "./template-usage.js";
|
|
24
21
|
export { hasPlaceholderProblems, resolveTemplateVariables, SYSTEM_PLACEHOLDERS, systemPlaceholdersFor, validateTemplatePlaceholders, } from "./template-validation.js";
|
|
25
22
|
export { userContentEntriesTable, userContentEntryEntity, } from "./user-content-table.js";
|
|
23
|
+
export { CONTENT_FORMATS, DEFAULT_MAIL_LAYOUT_SLUG, DEFAULT_PDF_LAYOUT_SLUG, DOCUMENT_HTML_KINDS, FALLBACK_LOCALE, NON_RENDER_KINDS, PDF_DEFAULT_MARGIN_MM, PDF_FOOTER_MARGIN_MM, PDF_HEADER_MARGIN_MM, PDF_ORIENTATIONS, PDF_PAGE_FORMATS, RENDER_KINDS, SYSTEM_TENANT_ID, TEMPLATE_KINDS, TEMPLATE_SCOPES, TEMPLATE_STATUSES, TEXT_BLOCK_KIND, UPSERT_KINDS, } from "./web/constants.js";
|
|
24
|
+
export { DOCUMENT_CONDITION_ATTRIBUTE, DOCUMENT_NODE_NAMES, DOCUMENT_TEXT_ALIGNMENTS, DocumentButton, DocumentCondition, DocumentDivider, DocumentLink, DocumentPageBreak, DocumentResource, DocumentTable, DocumentTableCell, DocumentTableHeader, DocumentTableRow, DocumentTextAlign, DocumentVariable, documentExtensions, isAllowedDocumentLinkHref, isDocumentPlaceholderHref, isDocumentReferenceName, isDocumentResourceKey, } from "./web/document-schema.js";
|
|
25
|
+
export { TEMPLATE_RESOLVER_FEATURE, TemplateResolverErrors, TemplateResolverHandlers, TemplateResolverQueries, } from "./web/qualified-names.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HEX_COLOR_PATTERN } from "./constants.js";
|
|
2
1
|
import { readMailLayoutMeta } from "./template-meta.js";
|
|
2
|
+
import { HEX_COLOR_PATTERN } from "./web/constants.js";
|
|
3
3
|
const FONT_FAMILIES = {
|
|
4
4
|
sans: "Arial, Helvetica, sans-serif",
|
|
5
5
|
serif: "Georgia, 'Times New Roman', serif",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ContentFormat } from "./constants.ts";
|
|
2
1
|
import { type DocumentViolation, type SanitizeBodyResult } from "./document-sanitizer.ts";
|
|
2
|
+
import type { ContentFormat } from "./web/constants.ts";
|
|
3
3
|
export type LayoutRegions = {
|
|
4
4
|
readonly header: string;
|
|
5
5
|
readonly signature: string;
|
|
@@ -2,8 +2,8 @@ import { type DbConnection } from "@cosmicdrift/kumiko-framework/db";
|
|
|
2
2
|
import { type Registry, type SessionUser, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import type { Dispatcher } from "@cosmicdrift/kumiko-framework/pipeline";
|
|
4
4
|
import { type SeedIfExists } from "@cosmicdrift/kumiko-framework/seeding";
|
|
5
|
-
import { type ContentFormat, type UpsertKind } from "./constants.ts";
|
|
6
5
|
import type { TemplateBundle } from "./template-bundle.ts";
|
|
6
|
+
import { type ContentFormat, type UpsertKind } from "./web/constants.ts";
|
|
7
7
|
export type SeedSystemTemplateOptions = {
|
|
8
8
|
readonly slug: string;
|
|
9
9
|
readonly kind: UpsertKind;
|
|
@@ -16,6 +16,9 @@ export type SeedSystemTemplateOptions = {
|
|
|
16
16
|
readonly linkedResources?: Record<string, string>;
|
|
17
17
|
readonly meta?: unknown;
|
|
18
18
|
readonly title?: string;
|
|
19
|
+
/** Translatable title for the overview and designer, stored in the title column; the client
|
|
20
|
+
* shows the translation and falls back to the key. Mutually exclusive with `title`. */
|
|
21
|
+
readonly titleI18nKey?: string;
|
|
19
22
|
readonly parentTemplateId?: string | null;
|
|
20
23
|
readonly by?: SessionUser;
|
|
21
24
|
readonly ifExists?: SeedIfExists;
|