@cosmicdrift/kumiko-bundled-features 0.362.0 → 0.364.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/admin-shell/feature.d.ts +3 -0
- package/dist/admin-shell/feature.js +6 -1
- package/dist/agent-tools/agent-manifest.js +2 -1
- package/dist/agent-tools/filter-ops.d.ts +1 -1
- package/dist/agent-tools/filter-ops.js +1 -3
- package/dist/agent-tools/tool-dispatch.js +2 -1
- package/dist/audit/handlers/list.query.js +9 -5
- package/dist/auth-email-password/bootstrap.d.ts +8 -5
- package/dist/auth-email-password/bootstrap.js +12 -4
- package/dist/auth-email-password/email-rate-limits.d.ts +4 -0
- package/dist/auth-email-password/email-rate-limits.js +13 -0
- package/dist/auth-email-password/email-templates.d.ts +4 -26
- package/dist/auth-email-password/email-templates.js +9 -101
- package/dist/auth-email-password/feature.js +24 -6
- package/dist/auth-email-password/handlers/change-password.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/change-password.write.js +6 -2
- package/dist/auth-email-password/handlers/confirm-account-unlock.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/invite-accept-with-login.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/invite-accept.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/invite-create.write.d.ts +2 -2
- package/dist/auth-email-password/handlers/invite-create.write.js +4 -4
- package/dist/auth-email-password/handlers/invite-signup-complete.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/login.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/logout.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/logout.write.js +6 -2
- package/dist/auth-email-password/handlers/request-account-unlock.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/request-account-unlock.write.js +2 -4
- package/dist/auth-email-password/handlers/request-email-verification.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/request-email-verification.write.js +2 -4
- package/dist/auth-email-password/handlers/request-password-reset.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/request-password-reset.write.js +2 -4
- package/dist/auth-email-password/handlers/reset-password.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/signup-confirm.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/signup-confirm.write.js +3 -4
- package/dist/auth-email-password/handlers/signup-request.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/signup-request.write.js +2 -1
- package/dist/auth-email-password/handlers/switch-tenant-mfa-gate.write.d.ts +1 -1
- package/dist/auth-email-password/handlers/token-request-handler.d.ts +2 -3
- package/dist/auth-email-password/handlers/token-request-handler.js +2 -2
- package/dist/auth-email-password/handlers/verify-email.write.d.ts +1 -1
- package/dist/auth-email-password/index.d.ts +2 -2
- package/dist/auth-email-password/index.js +1 -1
- package/dist/auth-email-password/magic-link-mail.d.ts +3 -2
- package/dist/auth-email-password/magic-link-mail.js +19 -14
- package/dist/auth-email-password/mail-notifications.d.ts +32 -0
- package/dist/auth-email-password/mail-notifications.js +116 -0
- package/dist/auth-email-password/signup-activation.d.ts +1 -1
- package/dist/auth-email-password/signup-activation.js +2 -3
- package/dist/auth-email-password/web/auth-gate.js +16 -4
- package/dist/auth-foundation/types.js +2 -8
- package/dist/auth-mfa/feature.js +4 -4
- package/dist/auth-mfa/handlers/disable.write.d.ts +1 -1
- package/dist/auth-mfa/handlers/enable-confirm-preauth.write.d.ts +1 -1
- package/dist/auth-mfa/handlers/enable-confirm.write.d.ts +1 -1
- package/dist/auth-mfa/handlers/enable-start-preauth.write.d.ts +1 -1
- package/dist/auth-mfa/handlers/enable-start.write.d.ts +1 -1
- package/dist/auth-mfa/handlers/regenerate-recovery.write.d.ts +1 -1
- package/dist/auth-mfa/handlers/verify.write.d.ts +1 -1
- package/dist/auth-mfa/hmac-token-codec.js +4 -4
- package/dist/auth-mfa/mfa-challenge-token.js +3 -3
- package/dist/auth-mfa/mfa-preauth-setup-token.js +3 -3
- package/dist/auth-mfa/mfa-setup-token.js +8 -8
- package/dist/billing-foundation/constants.d.ts +3 -3
- package/dist/billing-foundation/constants.js +5 -4
- package/dist/billing-foundation/consumer-protection/confirmation-mail.d.ts +32 -14
- package/dist/billing-foundation/consumer-protection/confirmation-mail.js +74 -32
- package/dist/billing-foundation/consumer-protection/consent-gate.d.ts +3 -0
- package/dist/billing-foundation/consumer-protection/consent-gate.js +21 -2
- package/dist/billing-foundation/consumer-protection/issue-confirmation.js +3 -3
- package/dist/billing-foundation/consumer-protection/mail-notifications.d.ts +8 -0
- package/dist/billing-foundation/consumer-protection/mail-notifications.js +95 -0
- package/dist/billing-foundation/consumer-protection/register-consent.js +2 -0
- package/dist/billing-foundation/consumer-protection/register-termination.js +11 -1
- package/dist/billing-foundation/consumer-protection/termination-mail.d.ts +25 -13
- package/dist/billing-foundation/consumer-protection/termination-mail.js +11 -23
- package/dist/billing-foundation/consumer-protection/termination-notify.js +2 -2
- package/dist/billing-foundation/consumer-protection/termination-pages.js +1 -3
- package/dist/billing-foundation/consumer-protection/termination-receipt-limit.d.ts +6 -0
- package/dist/billing-foundation/consumer-protection/termination-receipt-limit.js +34 -0
- package/dist/billing-foundation/consumer-protection/termination-record.d.ts +2 -0
- package/dist/billing-foundation/consumer-protection/termination-record.js +7 -1
- package/dist/billing-foundation/consumer-protection/termination-request.js +31 -21
- package/dist/billing-foundation/consumer-protection/termination-texts.d.ts +1 -1
- package/dist/billing-foundation/consumer-protection/termination-texts.js +6 -0
- package/dist/billing-foundation/consumer-protection/withdrawal-period.d.ts +10 -0
- package/dist/billing-foundation/consumer-protection/withdrawal-period.js +26 -0
- package/dist/billing-foundation/handlers/create-checkout-session.write.js +11 -5
- package/dist/billing-foundation/handlers/process-event.write.js +12 -8
- package/dist/billing-foundation/handlers/process-payment-event.write.js +1 -1
- package/dist/billing-foundation/i18n.js +3 -0
- package/dist/billing-foundation/subscription-tier-sync.d.ts +7 -1
- package/dist/billing-foundation/subscription-tier-sync.js +16 -9
- package/dist/billing-foundation/types.d.ts +7 -2
- package/dist/cap-counter/calendar-cap-usage-reservation.js +2 -0
- package/dist/cap-counter/enforce-cap.d.ts +18 -1
- package/dist/cap-counter/enforce-cap.js +49 -6
- package/dist/cap-counter/index.d.ts +1 -1
- package/dist/cap-counter/index.js +1 -1
- package/dist/cap-counter/with-cap-enforcement.d.ts +2 -0
- package/dist/cap-overview/handlers/tenant-caps-list.query.js +2 -1
- package/dist/cap-overview/web/cap-usage-cell.js +5 -4
- package/dist/channel-email/email-channel.d.ts +2 -2
- package/dist/channel-email/email-channel.js +101 -26
- package/dist/channel-email/feature.js +3 -3
- package/dist/channel-email/index.d.ts +1 -1
- package/dist/channel-email/index.js +1 -1
- package/dist/channel-email/pii-guard.js +10 -0
- package/dist/channel-email/smtp-transport.js +13 -0
- package/dist/channel-email/types.d.ts +8 -0
- package/dist/channel-in-app/handlers/mark-all-read.write.d.ts +1 -1
- package/dist/channel-in-app/handlers/mark-read.write.d.ts +1 -1
- package/dist/compliance-profiles/handlers/set-profile.write.d.ts +1 -1
- package/dist/config/handlers/reset.write.d.ts +1 -1
- package/dist/config/handlers/set.write.d.ts +1 -1
- package/dist/config/handlers/set.write.js +3 -4
- package/dist/config/resolver.d.ts +1 -0
- package/dist/config/resolver.js +11 -14
- package/dist/config/write-helpers.d.ts +2 -0
- package/dist/config/write-helpers.js +19 -0
- package/dist/crypto-shredding/handlers/forget-subject.write.d.ts +1 -1
- package/dist/crypto-shredding/handlers/forget-subject.write.js +29 -19
- package/dist/custom-fields/handlers/update-tenant-field.write.js +0 -1
- package/dist/custom-fields/lib/value-schema.js +10 -11
- package/dist/custom-fields/wire-user-data-rights.js +7 -6
- package/dist/data-retention/index.d.ts +1 -0
- package/dist/data-retention/index.js +1 -0
- package/dist/data-retention/run-retention-cleanup.js +6 -6
- package/dist/delivery/attachment-ref.d.ts +41 -0
- package/dist/delivery/attachment-ref.js +78 -0
- package/dist/delivery/channel-context.d.ts +8 -4
- package/dist/delivery/channel-context.js +94 -2
- package/dist/delivery/constants.d.ts +1 -0
- package/dist/delivery/constants.js +1 -0
- package/dist/delivery/delivery-service.d.ts +4 -1
- package/dist/delivery/delivery-service.js +38 -32
- package/dist/delivery/feature.js +1 -1
- package/dist/delivery/handlers/resubscribe-address.write.d.ts +1 -1
- package/dist/delivery/handlers/resubscribe-user.write.d.ts +1 -1
- package/dist/delivery/handlers/set-preference.write.d.ts +1 -1
- package/dist/delivery/handlers/unsubscribe-address.write.d.ts +1 -1
- package/dist/delivery/handlers/unsubscribe-user.write.d.ts +1 -1
- package/dist/delivery/index.d.ts +5 -2
- package/dist/delivery/index.js +4 -1
- package/dist/delivery/jobs.js +66 -14
- package/dist/delivery/notify-factory.js +4 -1
- package/dist/delivery/testing.d.ts +4 -1
- package/dist/delivery/types.d.ts +26 -14
- package/dist/delivery/unsubscribe.js +4 -1
- package/dist/derivatives-sharp/render.js +1 -18
- package/dist/document-ingest-foundation/pages.js +4 -4
- package/dist/feature-toggles/handlers/set.write.d.ts +1 -1
- package/dist/feature-toggles/toggle-sync-signal.js +4 -4
- package/dist/file-derivatives/handlers/public-variant.query.js +1 -1
- package/dist/file-foundation/index.d.ts +1 -0
- package/dist/file-foundation/index.js +1 -0
- package/dist/file-foundation/read-file-ref-content.d.ts +27 -0
- package/dist/file-foundation/read-file-ref-content.js +51 -0
- package/dist/files-tenant-data/hooks.js +4 -0
- package/dist/folders/web/folder-manager.js +3 -2
- package/dist/form-draft/db/queries/cleanup.js +4 -4
- package/dist/form-draft/db/queries/draft-count.js +2 -2
- package/dist/form-draft/db/queries/owned-file-refs.js +2 -2
- package/dist/form-draft/handlers/discard.write.d.ts +1 -1
- package/dist/form-draft/handlers/save.write.d.ts +1 -1
- package/dist/form-draft/release-file-refs.js +3 -2
- package/dist/inbound-mail-foundation/handlers/connect-account.write.js +1 -1
- package/dist/inbound-mail-foundation/handlers/ingest-message.write.js +6 -6
- package/dist/inbound-mail-foundation/handlers/scope-visibility.d.ts +1 -1
- package/dist/inbound-mail-foundation/oauth-access-token.js +8 -3
- package/dist/inbound-mail-foundation/oauth-state.js +7 -7
- package/dist/inbound-mail-foundation/types.js +4 -4
- package/dist/inbound-mail-foundation/watch-supervisor.js +24 -13
- package/dist/inbound-provider-imap/imap-client.js +4 -3
- package/dist/jobs/db/queries/stale-run-sweep.d.ts +1 -1
- package/dist/jobs/db/queries/stale-run-sweep.js +12 -5
- package/dist/jobs/feature.js +5 -3
- package/dist/jobs/handlers/list.query.js +3 -1
- package/dist/jobs/handlers/retry.write.d.ts +1 -1
- package/dist/jobs/handlers/stale-run-sweep.job.d.ts +1 -1
- package/dist/jobs/handlers/stale-run-sweep.job.js +2 -2
- package/dist/jobs/handlers/trigger.write.d.ts +1 -1
- package/dist/jobs/job-run-logger.js +32 -10
- package/dist/jobs/tenant-job-run-table.js +3 -2
- package/dist/ledger/entity.js +3 -1
- package/dist/ledger/recurring.js +1 -3
- package/dist/managed-pages/branding.d.ts +2 -0
- package/dist/managed-pages/branding.js +24 -2
- package/dist/managed-pages/feature.js +1 -0
- package/dist/managed-pages/handlers/set.write.d.ts +1 -1
- package/dist/managed-pages/i18n.js +1 -0
- package/dist/managed-pages/screens/branding-screen.js +8 -1
- package/dist/page-render/branding.d.ts +1 -0
- package/dist/page-render/branding.js +1 -0
- package/dist/page-render/markdown.js +1 -1
- package/dist/personal-access-tokens/feature.js +1 -1
- package/dist/personal-access-tokens/handlers/create.write.d.ts +1 -1
- package/dist/personal-access-tokens/handlers/list.query.js +2 -1
- package/dist/personal-access-tokens/handlers/revoke.write.d.ts +1 -1
- package/dist/personal-access-tokens/revoke-for-user.js +2 -1
- package/dist/renderer-foundation/api.d.ts +13 -13
- package/dist/renderer-foundation/api.js +1 -1
- package/dist/renderer-foundation/constants.js +2 -4
- package/dist/renderer-foundation/feature.js +7 -7
- package/dist/renderer-foundation/index.d.ts +2 -1
- package/dist/renderer-foundation/index.js +1 -0
- package/dist/renderer-foundation/types.d.ts +94 -32
- package/dist/renderer-pdf/feature.js +7 -1
- package/dist/renderer-pdf/render-table-pdf.d.ts +27 -33
- package/dist/renderer-pdf/render-table-pdf.js +95 -34
- package/dist/secrets/feature.js +4 -3
- package/dist/secrets/handlers/delete.write.d.ts +1 -1
- package/dist/secrets/handlers/set.write.d.ts +1 -1
- package/dist/secrets/secrets-context.js +15 -3
- package/dist/sessions/db/queries/cleanup.js +2 -2
- package/dist/sessions/feature.js +1 -1
- package/dist/sessions/handlers/list.query.js +2 -1
- package/dist/sessions/handlers/revoke-all-for-user.write.d.ts +1 -1
- package/dist/sessions/handlers/revoke-all-others.write.d.ts +1 -1
- package/dist/sessions/handlers/revoke.write.d.ts +1 -1
- package/dist/shared/attachment-file-name.d.ts +3 -0
- package/dist/shared/attachment-file-name.js +35 -0
- package/dist/shared/chunked-entity-migration.d.ts +1 -0
- package/dist/shared/chunked-entity-migration.js +1 -1
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.js +3 -0
- package/dist/shared/is-tenant-db.js +1 -1
- package/dist/shared/mail-template-body.d.ts +7 -0
- package/dist/shared/mail-template-body.js +27 -0
- package/dist/shared/sharp-input-limits.d.ts +6 -0
- package/dist/shared/sharp-input-limits.js +22 -0
- package/dist/shared/signup-handover.js +2 -2
- package/dist/subscription-stripe/plugin-methods.js +18 -8
- package/dist/subscription-stripe/verify-webhook.d.ts +1 -1
- package/dist/tags/handlers/assign-tag.write.js +3 -1
- package/dist/tags/web/tag-chip.js +2 -0
- package/dist/template-resolver/api.d.ts +30 -2
- package/dist/template-resolver/api.js +42 -6
- package/dist/template-resolver/compile-document-body.d.ts +12 -0
- package/dist/template-resolver/compile-document-body.js +205 -0
- package/dist/template-resolver/constants.d.ts +13 -4
- package/dist/template-resolver/constants.js +32 -10
- package/dist/template-resolver/document-sanitizer.d.ts +32 -0
- package/dist/template-resolver/document-sanitizer.js +201 -0
- package/dist/template-resolver/document-schema.d.ts +21 -0
- package/dist/template-resolver/document-schema.js +316 -0
- package/dist/template-resolver/feature.d.ts +20 -0
- package/dist/template-resolver/feature.js +53 -6
- package/dist/template-resolver/handlers/bundle-import.d.ts +20 -0
- package/dist/template-resolver/handlers/bundle-import.js +147 -0
- package/dist/template-resolver/handlers/collection-set.write.d.ts +1 -1
- package/dist/template-resolver/handlers/collection-set.write.js +25 -2
- package/dist/template-resolver/handlers/copy-locale.write.d.ts +19 -0
- package/dist/template-resolver/handlers/copy-locale.write.js +134 -0
- package/dist/template-resolver/handlers/diff-to-system.query.d.ts +22 -0
- package/dist/template-resolver/handlers/diff-to-system.query.js +30 -0
- package/dist/template-resolver/handlers/discard-draft.write.d.ts +13 -0
- package/dist/template-resolver/handlers/discard-draft.write.js +37 -0
- package/dist/template-resolver/handlers/export-bundle.query.d.ts +35 -0
- package/dist/template-resolver/handlers/export-bundle.query.js +118 -0
- package/dist/template-resolver/handlers/find-by-id.query.d.ts +2 -0
- package/dist/template-resolver/handlers/find-by-id.query.js +9 -6
- package/dist/template-resolver/handlers/import-bundle-system.write.d.ts +39 -0
- package/dist/template-resolver/handlers/import-bundle-system.write.js +36 -0
- package/dist/template-resolver/handlers/import-bundle.write.d.ts +40 -0
- package/dist/template-resolver/handlers/import-bundle.write.js +19 -0
- package/dist/template-resolver/handlers/layout-source.query.d.ts +31 -0
- package/dist/template-resolver/handlers/layout-source.query.js +87 -0
- package/dist/template-resolver/handlers/list.query.d.ts +4 -1
- package/dist/template-resolver/handlers/list.query.js +9 -8
- package/dist/template-resolver/handlers/override-diff.d.ts +20 -0
- package/dist/template-resolver/handlers/override-diff.js +41 -0
- package/dist/template-resolver/handlers/overview.query.d.ts +65 -0
- package/dist/template-resolver/handlers/overview.query.js +205 -0
- package/dist/template-resolver/handlers/preview.query.d.ts +12 -0
- package/dist/template-resolver/handlers/preview.query.js +24 -0
- package/dist/template-resolver/handlers/reset-to-system.write.d.ts +8 -0
- package/dist/template-resolver/handlers/reset-to-system.write.js +50 -0
- package/dist/template-resolver/handlers/resource-link-pdf.write.d.ts +8 -0
- package/dist/template-resolver/handlers/resource-link-pdf.write.js +32 -0
- package/dist/template-resolver/handlers/resource-remove.write.d.ts +9 -0
- package/dist/template-resolver/handlers/resource-remove.write.js +44 -0
- package/dist/template-resolver/handlers/resource-shared.d.ts +9 -0
- package/dist/template-resolver/handlers/resource-shared.js +14 -0
- package/dist/template-resolver/handlers/resource-upload.write.d.ts +13 -0
- package/dist/template-resolver/handlers/resource-upload.write.js +98 -0
- package/dist/template-resolver/handlers/send-test.write.d.ts +13 -0
- package/dist/template-resolver/handlers/send-test.write.js +108 -0
- package/dist/template-resolver/handlers/set.write.d.ts +5 -2
- package/dist/template-resolver/handlers/set.write.js +25 -3
- package/dist/template-resolver/handlers/shared.d.ts +9 -5
- package/dist/template-resolver/handlers/shared.js +6 -2
- package/dist/template-resolver/handlers/template-gates.d.ts +36 -0
- package/dist/template-resolver/handlers/template-gates.js +142 -0
- package/dist/template-resolver/handlers/template-write.d.ts +45 -0
- package/dist/template-resolver/handlers/template-write.js +141 -0
- package/dist/template-resolver/handlers/tenant-overrides.query.d.ts +49 -0
- package/dist/template-resolver/handlers/tenant-overrides.query.js +112 -0
- package/dist/template-resolver/handlers/toggle-status.write.d.ts +27 -2
- package/dist/template-resolver/handlers/toggle-status.write.js +47 -15
- package/dist/template-resolver/handlers/upsert-system.write.d.ts +5 -8
- package/dist/template-resolver/handlers/upsert-system.write.js +14 -59
- package/dist/template-resolver/handlers/upsert-tenant.write.d.ts +5 -8
- package/dist/template-resolver/handlers/upsert-tenant.write.js +11 -62
- package/dist/template-resolver/handlers/usage.query.d.ts +17 -0
- package/dist/template-resolver/handlers/usage.query.js +24 -0
- package/dist/template-resolver/handlers/validate.query.d.ts +74 -0
- package/dist/template-resolver/handlers/validate.query.js +80 -0
- package/dist/template-resolver/index.d.ts +19 -1
- package/dist/template-resolver/index.js +17 -1
- package/dist/template-resolver/layout-appearance.d.ts +10 -0
- package/dist/template-resolver/layout-appearance.js +26 -0
- package/dist/template-resolver/layout-regions.d.ts +23 -0
- package/dist/template-resolver/layout-regions.js +125 -0
- package/dist/template-resolver/linked-resources.d.ts +17 -0
- package/dist/template-resolver/linked-resources.js +75 -0
- package/dist/template-resolver/pdf-constants.d.ts +7 -0
- package/dist/template-resolver/pdf-constants.js +8 -0
- package/dist/template-resolver/preview-display-html.d.ts +7 -0
- package/dist/template-resolver/preview-display-html.js +27 -0
- package/dist/template-resolver/print-document.d.ts +1 -0
- package/dist/template-resolver/print-document.js +55 -0
- package/dist/template-resolver/qualified-names.d.ts +34 -0
- package/dist/template-resolver/qualified-names.js +34 -0
- package/dist/template-resolver/record-mapping.d.ts +2 -0
- package/dist/template-resolver/record-mapping.js +21 -0
- package/dist/template-resolver/resource-image.d.ts +15 -0
- package/dist/template-resolver/resource-image.js +34 -0
- package/dist/template-resolver/seeding.d.ts +14 -1
- package/dist/template-resolver/seeding.js +125 -18
- package/dist/template-resolver/store-template-resource.d.ts +64 -0
- package/dist/template-resolver/store-template-resource.js +264 -0
- package/dist/template-resolver/table.d.ts +150 -8
- package/dist/template-resolver/table.js +20 -2
- package/dist/template-resolver/template-bundle.d.ts +36 -0
- package/dist/template-resolver/template-bundle.js +60 -0
- package/dist/template-resolver/template-diff.d.ts +7 -0
- package/dist/template-resolver/template-diff.js +68 -0
- package/dist/template-resolver/template-draft.d.ts +51 -0
- package/dist/template-resolver/template-draft.js +72 -0
- package/dist/template-resolver/template-meta.d.ts +85 -0
- package/dist/template-resolver/template-meta.js +145 -0
- package/dist/template-resolver/template-preview.d.ts +103 -0
- package/dist/template-resolver/template-preview.js +418 -0
- package/dist/template-resolver/template-resources.d.ts +19 -0
- package/dist/template-resolver/template-resources.js +73 -0
- package/dist/template-resolver/template-usage.d.ts +16 -0
- package/dist/template-resolver/template-usage.js +35 -0
- package/dist/template-resolver/template-validation.d.ts +22 -0
- package/dist/template-resolver/template-validation.js +173 -0
- package/dist/template-resolver/testing.js +5 -5
- package/dist/template-resolver/user-content-table.d.ts +14 -8
- package/dist/template-resolver/web/client-plugin.d.ts +1 -0
- package/dist/template-resolver/web/client-plugin.js +12 -7
- package/dist/template-resolver/web/document-editor-extensions.d.ts +18 -0
- package/dist/template-resolver/web/document-editor-extensions.js +145 -0
- package/dist/template-resolver/web/document-editor.d.ts +4 -0
- package/dist/template-resolver/web/document-editor.js +17 -0
- package/dist/template-resolver/web/document-tiptap-editor.d.ts +3 -0
- package/dist/template-resolver/web/document-tiptap-editor.js +492 -0
- package/dist/template-resolver/web/document-toolbar-blocks.d.ts +41 -0
- package/dist/template-resolver/web/document-toolbar-blocks.js +19 -0
- package/dist/template-resolver/web/editor-handle.d.ts +3 -0
- package/dist/template-resolver/web/editor-handle.js +24 -0
- package/dist/template-resolver/web/i18n.js +91 -0
- package/dist/template-resolver/web/index.d.ts +5 -0
- package/dist/template-resolver/web/index.js +5 -0
- package/dist/template-resolver/web/placeholder-line-editor-lazy.d.ts +4 -0
- package/dist/template-resolver/web/placeholder-line-editor-lazy.js +16 -0
- package/dist/template-resolver/web/placeholder-line-editor.d.ts +17 -0
- package/dist/template-resolver/web/placeholder-line-editor.js +94 -0
- package/dist/template-resolver/web/placeholder-text.d.ts +4 -0
- package/dist/template-resolver/web/placeholder-text.js +34 -0
- package/dist/template-resolver/web/use-stable-by-key.d.ts +1 -0
- package/dist/template-resolver/web/use-stable-by-key.js +13 -0
- package/dist/tenant/handlers/add-member.write.d.ts +1 -1
- package/dist/tenant/handlers/cancel-invitation.write.d.ts +1 -1
- package/dist/tenant/handlers/create.write.d.ts +1 -1
- package/dist/tenant/handlers/remove-member.write.d.ts +1 -1
- package/dist/tenant/handlers/team-list.query.js +3 -2
- package/dist/tenant/handlers/toggle-enabled.write.d.ts +2 -2
- package/dist/tenant/handlers/update-member-roles.write.d.ts +1 -1
- package/dist/tenant/handlers/update.write.d.ts +1 -1
- package/dist/tenant/seeding.js +31 -6
- package/dist/tenant-handover/handlers/claim.write.d.ts +1 -1
- package/dist/tenant-lifecycle/handlers/cancel-destruction.write.d.ts +2 -2
- package/dist/tenant-lifecycle/handlers/cancel-destruction.write.js +2 -1
- package/dist/tenant-lifecycle/handlers/request-destruction.write.d.ts +1 -1
- package/dist/tier-engine/feature.js +9 -3
- package/dist/tier-engine/handlers/set-tenant-tier.write.d.ts +1 -1
- package/dist/user/db/queries/stream-tenant-backfill.js +4 -4
- package/dist/user/handlers/create.write.d.ts +1 -1
- package/dist/user/handlers/detail.query.js +2 -1
- package/dist/user/handlers/update.write.d.ts +1 -1
- package/dist/user/resolve-display-names.js +5 -9
- package/dist/user/seeding.js +20 -1
- package/dist/user-data-rights/db/queries/forget-cleanup.d.ts +2 -2
- package/dist/user-data-rights/email-templates.d.ts +1 -29
- package/dist/user-data-rights/email-templates.js +5 -106
- package/dist/user-data-rights/feature.js +53 -35
- package/dist/user-data-rights/handlers/cancel-deletion.write.d.ts +2 -2
- package/dist/user-data-rights/handlers/cancel-deletion.write.js +2 -1
- package/dist/user-data-rights/handlers/confirm-deletion-by-token.write.d.ts +1 -1
- package/dist/user-data-rights/handlers/lift-restriction.write.d.ts +1 -1
- package/dist/user-data-rights/handlers/request-deletion-by-email.write.d.ts +1 -1
- package/dist/user-data-rights/handlers/request-deletion.write.d.ts +1 -1
- package/dist/user-data-rights/handlers/request-deletion.write.js +5 -7
- package/dist/user-data-rights/handlers/request-export.write.d.ts +1 -1
- package/dist/user-data-rights/handlers/restrict-account.write.d.ts +1 -1
- package/dist/user-data-rights/handlers/run-forget-cleanup.write.d.ts +1 -1
- package/dist/user-data-rights/lib/default-mailers.d.ts +15 -7
- package/dist/user-data-rights/lib/default-mailers.js +100 -48
- package/dist/user-data-rights/lib/update-user-lifecycle.js +1 -1
- package/dist/user-data-rights/mail-notifications.d.ts +13 -0
- package/dist/user-data-rights/mail-notifications.js +118 -0
- package/dist/user-data-rights/web/privacy-center-screen.js +2 -1
- package/dist/user-profile/handlers/change-email.write.d.ts +1 -1
- package/dist/user-profile/web/profile-screen.js +2 -1
- package/dist/waitlist/feature.js +10 -0
- package/dist/waitlist/handlers/invite.write.d.ts +1 -1
- package/dist/waitlist/handlers/reject.write.d.ts +1 -1
- package/dist/waitlist/handlers/submit.write.d.ts +1 -1
- package/dist/waitlist/handlers/submit.write.js +3 -4
- package/dist/waitlist/mail.d.ts +19 -6
- package/dist/waitlist/mail.js +50 -14
- package/dist/waitlist/options.js +1 -1
- package/dist/workflow-runner/event-trigger.js +2 -2
- package/dist/workflow-runner/handlers/resume-run.write.js +7 -2
- package/package.json +37 -17
- package/src/admin-shell/changes.json +6 -0
- package/src/audit/changes.json +6 -0
- package/src/auth-email-password/changes.json +51 -0
- package/src/billing-foundation/changes.json +43 -0
- package/src/cap-counter/changes.json +6 -0
- package/src/channel-email/changes.json +19 -0
- package/src/config/changes.json +6 -0
- package/src/crypto-shredding/changes.json +6 -0
- package/src/custom-fields/changes.json +6 -0
- package/src/data-retention/changes.json +6 -0
- package/src/delivery/changes.json +66 -0
- package/src/file-foundation/changes.json +6 -0
- package/src/files-tenant-data/changes.json +6 -0
- package/src/inbound-mail-foundation/changes.json +6 -0
- package/src/jobs/changes.json +19 -0
- package/src/ledger/changes.json +7 -0
- package/src/managed-pages/changes.json +6 -0
- package/src/renderer-foundation/changes.json +39 -0
- package/src/renderer-pdf/changes.json +12 -0
- package/src/secrets/changes.json +6 -0
- package/src/shared/changes.json +6 -0
- package/src/subscription-stripe/changes.json +6 -0
- package/src/template-resolver/changes.json +186 -0
- package/src/tier-engine/changes.json +6 -0
- package/src/user/changes.json +6 -0
- package/src/user-data-rights/changes.json +13 -0
- package/src/user-profile/changes.json +1 -1
- package/src/waitlist/changes.json +7 -0
- package/src/workflow-runner/changes.json +6 -0
- package/dist/renderer-simple/feature.d.ts +0 -10
- package/dist/renderer-simple/feature.js +0 -42
- package/dist/renderer-simple/index.d.ts +0 -3
- package/dist/renderer-simple/index.js +0 -2
- package/dist/renderer-simple/mail-blocks.d.ts +0 -21
- package/dist/renderer-simple/mail-blocks.js +0 -107
- package/dist/renderer-simple/resolve-variables.d.ts +0 -7
- package/dist/renderer-simple/resolve-variables.js +0 -47
- package/dist/renderer-simple/simple-renderer.d.ts +0 -24
- package/dist/renderer-simple/simple-renderer.js +0 -200
- package/src/renderer-simple/changes.json +0 -27
|
@@ -1,55 +1,82 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Registry, TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
1
|
+
import type { DbRunner, TenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import type { ConfigAccessor, Registry, TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
import type { FileContext } from "@cosmicdrift/kumiko-framework/files";
|
|
4
|
+
import type { LinkedResourceEntry, MailTemplateMeta, PdfPageFormat, PdfTemplateMeta, TemplateScope } from "../template-resolver/index.js";
|
|
3
5
|
import { type ContentFormat, RENDERER_EXTENSION, type RenderKind } from "./constants.js";
|
|
4
6
|
export type RenderRequest = {
|
|
5
|
-
kind: "
|
|
6
|
-
payload:
|
|
7
|
-
} | {
|
|
8
|
-
kind: "mail-html";
|
|
9
|
-
payload: MailHtmlPayload;
|
|
7
|
+
kind: "mail";
|
|
8
|
+
payload: MailPayload;
|
|
10
9
|
} | {
|
|
11
10
|
kind: "document-pdf";
|
|
12
|
-
payload:
|
|
11
|
+
payload: DocumentPdfPayload;
|
|
13
12
|
options?: PdfOptions;
|
|
14
13
|
} | {
|
|
15
14
|
kind: "image-snapshot";
|
|
16
15
|
payload: DocumentPayload;
|
|
17
16
|
options?: ImageOptions;
|
|
18
17
|
};
|
|
19
|
-
export type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
18
|
+
export type RenderedTemplateRef = {
|
|
19
|
+
readonly templateId: string;
|
|
20
|
+
readonly templateVersion: number;
|
|
21
|
+
readonly scope: TemplateScope;
|
|
22
|
+
};
|
|
23
|
+
export type RenderProvenance = {
|
|
24
|
+
readonly template?: RenderedTemplateRef;
|
|
25
|
+
readonly layout?: RenderedTemplateRef;
|
|
26
|
+
};
|
|
27
|
+
export type InlineAttachmentRef = {
|
|
28
|
+
readonly kind: "inline";
|
|
29
|
+
readonly cid: string;
|
|
30
|
+
readonly fileRefId: string;
|
|
31
|
+
};
|
|
32
|
+
export type FileAttachmentRef = {
|
|
33
|
+
readonly kind: "file";
|
|
34
|
+
readonly fileRefId: string;
|
|
35
|
+
readonly fileName: string;
|
|
36
|
+
};
|
|
37
|
+
export type RenderedPdfAttachmentRef = {
|
|
38
|
+
readonly kind: "rendered-pdf";
|
|
39
|
+
readonly templateSlug: string;
|
|
40
|
+
readonly variables: Readonly<Record<string, unknown>>;
|
|
41
|
+
readonly fileName: string;
|
|
42
|
+
readonly locale?: string;
|
|
43
|
+
};
|
|
44
|
+
export type MailAttachmentRef = InlineAttachmentRef | FileAttachmentRef | RenderedPdfAttachmentRef;
|
|
45
|
+
export type RenderResponse = ({
|
|
46
|
+
kind: "mail";
|
|
47
|
+
subject: string;
|
|
25
48
|
html: string;
|
|
26
49
|
text: string;
|
|
50
|
+
previewText?: string;
|
|
51
|
+
fromName?: string;
|
|
52
|
+
replyTo?: string;
|
|
53
|
+
attachments?: readonly MailAttachmentRef[];
|
|
27
54
|
} | {
|
|
28
55
|
kind: "document-pdf";
|
|
29
56
|
pdfBytes: Uint8Array;
|
|
30
57
|
pageCount: number;
|
|
31
58
|
sizeBytes: number;
|
|
59
|
+
fileName: string;
|
|
32
60
|
} | {
|
|
33
61
|
kind: "image-snapshot";
|
|
34
62
|
imageBytes: Uint8Array;
|
|
35
63
|
format: "png" | "jpg";
|
|
36
64
|
width: number;
|
|
37
65
|
height: number;
|
|
66
|
+
}) & RenderProvenance;
|
|
67
|
+
export type MailDraft = {
|
|
68
|
+
readonly content: string;
|
|
69
|
+
readonly meta: MailTemplateMeta;
|
|
70
|
+
readonly variableSchema?: Readonly<Record<string, unknown>>;
|
|
71
|
+
/** Images and attachments of the row being edited; absent means those of the stored template. */
|
|
72
|
+
readonly linkedResources?: Readonly<Record<string, LinkedResourceEntry>>;
|
|
38
73
|
};
|
|
39
|
-
export type
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
42
|
-
readonly
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
};
|
|
46
|
-
export type MailHtmlPayload = {
|
|
47
|
-
readonly template?: string;
|
|
48
|
-
readonly content?: string;
|
|
49
|
-
readonly contentFormat?: ContentFormat;
|
|
50
|
-
readonly variables?: Readonly<Record<string, unknown>>;
|
|
51
|
-
readonly locale?: string;
|
|
52
|
-
readonly subject?: string;
|
|
74
|
+
export type MailPayload = {
|
|
75
|
+
readonly slug: string;
|
|
76
|
+
readonly locale: string;
|
|
77
|
+
readonly variables: Readonly<Record<string, unknown>>;
|
|
78
|
+
readonly unsubscribeUrl?: string;
|
|
79
|
+
readonly draft?: MailDraft;
|
|
53
80
|
};
|
|
54
81
|
export type DocumentPayload = {
|
|
55
82
|
readonly template?: string;
|
|
@@ -58,8 +85,35 @@ export type DocumentPayload = {
|
|
|
58
85
|
readonly variables?: Readonly<Record<string, unknown>>;
|
|
59
86
|
readonly locale?: string;
|
|
60
87
|
};
|
|
88
|
+
export type DocumentPdfPayload = {
|
|
89
|
+
readonly slug: string;
|
|
90
|
+
readonly locale: string;
|
|
91
|
+
readonly variables: Readonly<Record<string, unknown>>;
|
|
92
|
+
};
|
|
93
|
+
export type DocumentPdfDraft = {
|
|
94
|
+
readonly content: string;
|
|
95
|
+
readonly meta: PdfTemplateMeta | null;
|
|
96
|
+
readonly variableSchema?: Readonly<Record<string, unknown>>;
|
|
97
|
+
};
|
|
98
|
+
export type DocumentPreviewRequest = DocumentPdfPayload & {
|
|
99
|
+
readonly draft?: DocumentPdfDraft;
|
|
100
|
+
};
|
|
101
|
+
export type DocumentPreview = {
|
|
102
|
+
readonly title: string;
|
|
103
|
+
readonly fileName: string;
|
|
104
|
+
readonly bodyHtml: string;
|
|
105
|
+
readonly layout: {
|
|
106
|
+
readonly slug: string;
|
|
107
|
+
readonly scope: TemplateScope;
|
|
108
|
+
readonly headerHtml: string;
|
|
109
|
+
readonly signatureHtml: string;
|
|
110
|
+
readonly footerHtml: string;
|
|
111
|
+
} | null;
|
|
112
|
+
/** Image keys the body or the layout asks for that no file is linked to. */
|
|
113
|
+
readonly missingResourceKeys: readonly string[];
|
|
114
|
+
};
|
|
61
115
|
export type PdfOptions = {
|
|
62
|
-
readonly format?:
|
|
116
|
+
readonly format?: PdfPageFormat;
|
|
63
117
|
readonly marginMm?: {
|
|
64
118
|
top?: number;
|
|
65
119
|
right?: number;
|
|
@@ -70,6 +124,7 @@ export type PdfOptions = {
|
|
|
70
124
|
readonly footerTemplate?: string;
|
|
71
125
|
readonly printBackground?: boolean;
|
|
72
126
|
readonly displayHeaderFooter?: boolean;
|
|
127
|
+
readonly landscape?: boolean;
|
|
73
128
|
};
|
|
74
129
|
export type ImageOptions = {
|
|
75
130
|
readonly width?: number;
|
|
@@ -78,18 +133,25 @@ export type ImageOptions = {
|
|
|
78
133
|
readonly quality?: number;
|
|
79
134
|
};
|
|
80
135
|
export type RendererContext = {
|
|
81
|
-
readonly db:
|
|
136
|
+
readonly db: DbRunner | TenantDb;
|
|
82
137
|
readonly registry: Registry;
|
|
83
138
|
readonly tenantId: TenantId;
|
|
139
|
+
/** Tenant-scoped config for plugins that read the tenant currency or
|
|
140
|
+
* branding; plugins fall back to request defaults when absent. */
|
|
141
|
+
readonly config?: ConfigAccessor;
|
|
142
|
+
/** Only plugins that embed resource bytes (PDF) need it; without it images are dropped. */
|
|
143
|
+
readonly filesForTenant?: (tenantId: string) => FileContext | undefined;
|
|
84
144
|
};
|
|
85
145
|
export type RendererPlugin = {
|
|
86
146
|
readonly name: string;
|
|
87
147
|
readonly kinds: ReadonlyArray<RenderKind>;
|
|
88
148
|
render(req: RenderRequest, ctx: RendererContext): Promise<RenderResponse>;
|
|
149
|
+
/** Optional: plugins that print documents offer a preview that never reaches the print service. */
|
|
150
|
+
previewDocument?(req: DocumentPreviewRequest, ctx: RendererContext): Promise<DocumentPreview>;
|
|
89
151
|
};
|
|
90
152
|
export declare class RendererError extends Error {
|
|
91
|
-
readonly code: "no_plugin_for_kind" | "invalid_payload" | "other";
|
|
92
|
-
constructor(message: string, code: "no_plugin_for_kind" | "invalid_payload" | "other");
|
|
153
|
+
readonly code: "no_plugin_for_kind" | "invalid_payload" | "unavailable" | "other";
|
|
154
|
+
constructor(message: string, code: "no_plugin_for_kind" | "invalid_payload" | "unavailable" | "other");
|
|
93
155
|
}
|
|
94
156
|
export type RendererRegistrationPlugin = Omit<RendererPlugin, "name">;
|
|
95
157
|
export declare function isRendererRegistrationPlugin(o: unknown): o is RendererRegistrationPlugin;
|
|
@@ -13,7 +13,13 @@ export async function renderTablePdfRequest(req) {
|
|
|
13
13
|
...(req.options?.format && { format: req.options.format }),
|
|
14
14
|
...(req.options?.marginMm && { marginMm: req.options.marginMm }),
|
|
15
15
|
});
|
|
16
|
-
return {
|
|
16
|
+
return {
|
|
17
|
+
kind: "document-pdf",
|
|
18
|
+
pdfBytes,
|
|
19
|
+
pageCount,
|
|
20
|
+
sizeBytes: pdfBytes.byteLength,
|
|
21
|
+
fileName: `${req.payload.slug}.pdf`,
|
|
22
|
+
};
|
|
17
23
|
}
|
|
18
24
|
export function createRendererPdfFeature() {
|
|
19
25
|
return defineFeature("renderer-pdf", (r) => {
|
|
@@ -1,54 +1,48 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
|
|
2
|
+
import type { PdfPageFormat } from "../template-resolver/index.js";
|
|
3
|
+
declare const pdfTableColumnSchema: z.ZodReadonly<z.ZodObject<{
|
|
4
|
+
header: z.ZodString;
|
|
5
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
left: "left";
|
|
8
|
+
right: "right";
|
|
9
|
+
}>>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
export declare const pdfTableDocumentSchema: z.ZodReadonly<z.ZodObject<{
|
|
3
12
|
title: z.ZodString;
|
|
4
13
|
subtitle: z.ZodOptional<z.ZodString>;
|
|
5
|
-
meta: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
14
|
+
meta: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
6
15
|
label: z.ZodString;
|
|
7
16
|
value: z.ZodString;
|
|
8
|
-
}, z.core.$strip
|
|
9
|
-
columns: z.ZodArray<z.ZodObject<{
|
|
17
|
+
}, z.core.$strip>>>>>;
|
|
18
|
+
columns: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
10
19
|
header: z.ZodString;
|
|
11
20
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
12
21
|
align: z.ZodOptional<z.ZodEnum<{
|
|
13
22
|
left: "left";
|
|
14
23
|
right: "right";
|
|
15
24
|
}>>;
|
|
16
|
-
}, z.core.$strip
|
|
17
|
-
rows: z.ZodArray<z.ZodArray<z.ZodString
|
|
25
|
+
}, z.core.$strip>>>>;
|
|
26
|
+
rows: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodArray<z.ZodString>>>>;
|
|
18
27
|
emptyText: z.ZodOptional<z.ZodString>;
|
|
19
28
|
footerText: z.ZodOptional<z.ZodString>;
|
|
20
29
|
pageLabel: z.ZodOptional<z.ZodString>;
|
|
21
|
-
}, z.core.$strip
|
|
22
|
-
export type PdfTableColumn =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
readonly meta?: readonly {
|
|
31
|
-
readonly label: string;
|
|
32
|
-
readonly value: string;
|
|
33
|
-
}[];
|
|
34
|
-
readonly columns: readonly PdfTableColumn[];
|
|
35
|
-
readonly rows: readonly (readonly string[])[];
|
|
36
|
-
readonly emptyText?: string;
|
|
37
|
-
readonly footerText?: string;
|
|
38
|
-
/** Template with `{page}` and `{pages}`; default `"{page} / {pages}"`. */
|
|
39
|
-
readonly pageLabel?: string;
|
|
40
|
-
};
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
export type PdfTableColumn = z.infer<typeof pdfTableColumnSchema>;
|
|
32
|
+
export type PdfTableDocument = z.infer<typeof pdfTableDocumentSchema>;
|
|
33
|
+
declare const marginMmSchema: z.ZodReadonly<z.ZodObject<{
|
|
34
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
right: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
bottom: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
left: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
}, z.core.$strip>>;
|
|
41
39
|
export type PdfTableOptions = {
|
|
42
|
-
readonly format?:
|
|
43
|
-
readonly marginMm?:
|
|
44
|
-
readonly top?: number;
|
|
45
|
-
readonly right?: number;
|
|
46
|
-
readonly bottom?: number;
|
|
47
|
-
readonly left?: number;
|
|
48
|
-
};
|
|
40
|
+
readonly format?: PdfPageFormat;
|
|
41
|
+
readonly marginMm?: z.input<typeof marginMmSchema>;
|
|
49
42
|
};
|
|
50
43
|
export type PdfTableResult = {
|
|
51
44
|
readonly pdfBytes: Uint8Array;
|
|
52
45
|
readonly pageCount: number;
|
|
53
46
|
};
|
|
54
47
|
export declare function renderTablePdf(doc: PdfTableDocument, options?: PdfTableOptions): Promise<PdfTableResult>;
|
|
48
|
+
export {};
|
|
@@ -1,22 +1,44 @@
|
|
|
1
1
|
import { PDFDocument, rgb, StandardFonts } from "pdf-lib";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { RendererError } from "../renderer-foundation/index.js";
|
|
4
|
-
|
|
4
|
+
// Upper bounds keep a hostile or runaway payload from exhausting memory and CPU in layout.
|
|
5
|
+
const PDF_TABLE_MAX_ROWS = 10_000;
|
|
6
|
+
const PDF_TABLE_MAX_COLUMNS = 30;
|
|
7
|
+
const PDF_TABLE_MAX_CELL_LENGTH = 5_000;
|
|
8
|
+
const pdfTableColumnSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
header: z.string(),
|
|
11
|
+
weight: z.number().positive().optional(),
|
|
12
|
+
align: z.enum(["left", "right"]).optional(),
|
|
13
|
+
})
|
|
14
|
+
.readonly();
|
|
15
|
+
export const pdfTableDocumentSchema = z
|
|
16
|
+
.object({
|
|
5
17
|
title: z.string(),
|
|
6
18
|
subtitle: z.string().optional(),
|
|
7
|
-
meta: z
|
|
8
|
-
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.
|
|
15
|
-
|
|
19
|
+
meta: z
|
|
20
|
+
.array(z.object({ label: z.string(), value: z.string() }).readonly())
|
|
21
|
+
.readonly()
|
|
22
|
+
.optional(),
|
|
23
|
+
columns: z.array(pdfTableColumnSchema).min(1).max(PDF_TABLE_MAX_COLUMNS).readonly(),
|
|
24
|
+
rows: z
|
|
25
|
+
.array(z.array(z.string().max(PDF_TABLE_MAX_CELL_LENGTH)).readonly())
|
|
26
|
+
.max(PDF_TABLE_MAX_ROWS)
|
|
27
|
+
.readonly(),
|
|
16
28
|
emptyText: z.string().optional(),
|
|
17
29
|
footerText: z.string().optional(),
|
|
30
|
+
// Template with `{page}` and `{pages}`; default `"{page} / {pages}"`.
|
|
18
31
|
pageLabel: z.string().optional(),
|
|
19
|
-
})
|
|
32
|
+
})
|
|
33
|
+
.readonly();
|
|
34
|
+
const marginMmSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
top: z.number().nonnegative().optional(),
|
|
37
|
+
right: z.number().nonnegative().optional(),
|
|
38
|
+
bottom: z.number().nonnegative().optional(),
|
|
39
|
+
left: z.number().nonnegative().optional(),
|
|
40
|
+
})
|
|
41
|
+
.readonly();
|
|
20
42
|
const POINTS_PER_MM = 72 / 25.4;
|
|
21
43
|
const PAGE_SIZE_POINTS = {
|
|
22
44
|
A4: { width: 595.28, height: 841.89 },
|
|
@@ -31,6 +53,7 @@ const LINE_HEIGHT_FACTOR = 1.3;
|
|
|
31
53
|
const CELL_PADDING_X = 4;
|
|
32
54
|
const CELL_PADDING_Y = 3;
|
|
33
55
|
const FOOTER_RESERVE = 16;
|
|
56
|
+
const MIN_COLUMN_WIDTH = 20;
|
|
34
57
|
const META_LABEL_GAP = 10;
|
|
35
58
|
const BLOCK_GAP = 10;
|
|
36
59
|
const REPLACEMENT_CHAR = "?";
|
|
@@ -46,7 +69,7 @@ function createEncodableText(font) {
|
|
|
46
69
|
const supported = new Set(font.getCharacterSet());
|
|
47
70
|
return (text) => {
|
|
48
71
|
let result = "";
|
|
49
|
-
for (const char of text.replace(/\t/g, " ")) {
|
|
72
|
+
for (const char of text.replace(/\r\n?/g, "\n").replace(/\t/g, " ")) {
|
|
50
73
|
const codePoint = char.codePointAt(0) ?? 0;
|
|
51
74
|
result += codePoint === 0x0a || supported.has(codePoint) ? char : REPLACEMENT_CHAR;
|
|
52
75
|
}
|
|
@@ -111,25 +134,22 @@ function assertRowShape(doc) {
|
|
|
111
134
|
}
|
|
112
135
|
});
|
|
113
136
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
137
|
+
function resolveTableLayout(doc, options, fonts, clean) {
|
|
138
|
+
const marginMm = marginMmSchema.safeParse(options?.marginMm ?? {});
|
|
139
|
+
if (!marginMm.success) {
|
|
140
|
+
throw new RendererError("margins must be non-negative numbers", "invalid_payload");
|
|
117
141
|
}
|
|
118
|
-
assertRowShape(doc);
|
|
119
|
-
const pdf = await PDFDocument.create({ updateMetadata: false });
|
|
120
|
-
const fonts = {
|
|
121
|
-
regular: await pdf.embedFont(StandardFonts.Helvetica),
|
|
122
|
-
bold: await pdf.embedFont(StandardFonts.HelveticaBold),
|
|
123
|
-
};
|
|
124
|
-
const clean = createEncodableText(fonts.regular);
|
|
125
142
|
const pageSize = PAGE_SIZE_POINTS[options?.format ?? "A4"];
|
|
126
143
|
const margin = {
|
|
127
|
-
top: (
|
|
128
|
-
right: (
|
|
129
|
-
bottom: (
|
|
130
|
-
left: (
|
|
144
|
+
top: (marginMm.data.top ?? DEFAULT_MARGIN_MM.top) * POINTS_PER_MM,
|
|
145
|
+
right: (marginMm.data.right ?? DEFAULT_MARGIN_MM.right) * POINTS_PER_MM,
|
|
146
|
+
bottom: (marginMm.data.bottom ?? DEFAULT_MARGIN_MM.bottom) * POINTS_PER_MM,
|
|
147
|
+
left: (marginMm.data.left ?? DEFAULT_MARGIN_MM.left) * POINTS_PER_MM,
|
|
131
148
|
};
|
|
132
149
|
const contentWidth = pageSize.width - margin.left - margin.right;
|
|
150
|
+
if (contentWidth < MIN_COLUMN_WIDTH * doc.columns.length) {
|
|
151
|
+
throw new RendererError("margins leave no room for table columns", "invalid_payload");
|
|
152
|
+
}
|
|
133
153
|
const contentBottom = margin.bottom + FOOTER_RESERVE;
|
|
134
154
|
const columnWidths = resolveColumnWidths(doc.columns, contentWidth);
|
|
135
155
|
const bodyLineHeight = lineHeightFor(BODY_SIZE);
|
|
@@ -139,6 +159,33 @@ export async function renderTablePdf(doc, options) {
|
|
|
139
159
|
}
|
|
140
160
|
const headerLines = doc.columns.map((column, index) => wrapText(clean(column.header), fonts.bold, BODY_SIZE, (columnWidths[index] ?? contentWidth) - 2 * CELL_PADDING_X));
|
|
141
161
|
const headerHeight = Math.max(...headerLines.map((lines) => lines.length)) * bodyLineHeight + 2 * CELL_PADDING_Y;
|
|
162
|
+
// A header this tall would leave every continuation page without room for a row.
|
|
163
|
+
if (rowSpaceOnEmptyPage - headerHeight < bodyLineHeight + 2 * CELL_PADDING_Y) {
|
|
164
|
+
throw new RendererError("table header leaves no room for rows", "invalid_payload");
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
pageSize,
|
|
168
|
+
margin,
|
|
169
|
+
contentWidth,
|
|
170
|
+
contentBottom,
|
|
171
|
+
columnWidths,
|
|
172
|
+
bodyLineHeight,
|
|
173
|
+
headerLines,
|
|
174
|
+
headerHeight,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export async function renderTablePdf(doc, options) {
|
|
178
|
+
if (doc.columns.length === 0) {
|
|
179
|
+
throw new RendererError("table needs at least one column", "invalid_payload");
|
|
180
|
+
}
|
|
181
|
+
assertRowShape(doc);
|
|
182
|
+
const pdf = await PDFDocument.create({ updateMetadata: false });
|
|
183
|
+
const fonts = {
|
|
184
|
+
regular: await pdf.embedFont(StandardFonts.Helvetica),
|
|
185
|
+
bold: await pdf.embedFont(StandardFonts.HelveticaBold),
|
|
186
|
+
};
|
|
187
|
+
const clean = createEncodableText(fonts.regular);
|
|
188
|
+
const { pageSize, margin, contentWidth, contentBottom, columnWidths, bodyLineHeight, headerLines, headerHeight, } = resolveTableLayout(doc, options, fonts, clean);
|
|
142
189
|
let page = pdf.addPage([pageSize.width, pageSize.height]);
|
|
143
190
|
let cursorY = pageSize.height - margin.top;
|
|
144
191
|
function drawLines(lines, font, size, left, width, topY, align, color = TEXT_COLOR) {
|
|
@@ -154,14 +201,27 @@ export async function renderTablePdf(doc, options) {
|
|
|
154
201
|
});
|
|
155
202
|
});
|
|
156
203
|
}
|
|
204
|
+
function startBlankPage() {
|
|
205
|
+
page = pdf.addPage([pageSize.width, pageSize.height]);
|
|
206
|
+
cursorY = pageSize.height - margin.top;
|
|
207
|
+
}
|
|
208
|
+
function ensureRoom(height) {
|
|
209
|
+
if (cursorY - height < contentBottom)
|
|
210
|
+
startBlankPage();
|
|
211
|
+
}
|
|
212
|
+
// Line by line, so a block taller than one page continues on the next.
|
|
213
|
+
function flowLines(lines, font, size, left, width, color = TEXT_COLOR) {
|
|
214
|
+
const lineHeight = lineHeightFor(size);
|
|
215
|
+
for (const line of lines) {
|
|
216
|
+
ensureRoom(lineHeight);
|
|
217
|
+
drawLines([line], font, size, left, width, cursorY, "left", color);
|
|
218
|
+
cursorY -= lineHeight;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
157
221
|
function drawIntroBlock() {
|
|
158
|
-
|
|
159
|
-
drawLines(titleLines, fonts.bold, TITLE_SIZE, margin.left, contentWidth, cursorY, "left");
|
|
160
|
-
cursorY -= titleLines.length * lineHeightFor(TITLE_SIZE);
|
|
222
|
+
flowLines(wrapText(clean(doc.title), fonts.bold, TITLE_SIZE, contentWidth), fonts.bold, TITLE_SIZE, margin.left, contentWidth);
|
|
161
223
|
if (doc.subtitle !== undefined) {
|
|
162
|
-
|
|
163
|
-
drawLines(subtitleLines, fonts.regular, SUBTITLE_SIZE, margin.left, contentWidth, cursorY, "left", MUTED_COLOR);
|
|
164
|
-
cursorY -= subtitleLines.length * lineHeightFor(SUBTITLE_SIZE);
|
|
224
|
+
flowLines(wrapText(clean(doc.subtitle), fonts.regular, SUBTITLE_SIZE, contentWidth), fonts.regular, SUBTITLE_SIZE, margin.left, contentWidth, MUTED_COLOR);
|
|
165
225
|
}
|
|
166
226
|
const meta = doc.meta ?? [];
|
|
167
227
|
if (meta.length > 0) {
|
|
@@ -171,9 +231,9 @@ export async function renderTablePdf(doc, options) {
|
|
|
171
231
|
META_LABEL_GAP;
|
|
172
232
|
meta.forEach((entry, index) => {
|
|
173
233
|
const valueLines = wrapText(clean(entry.value), fonts.regular, BODY_SIZE, contentWidth - labelWidth);
|
|
234
|
+
ensureRoom(bodyLineHeight);
|
|
174
235
|
drawLines([labels[index] ?? ""], fonts.bold, BODY_SIZE, margin.left, labelWidth, cursorY, "left");
|
|
175
|
-
|
|
176
|
-
cursorY -= valueLines.length * bodyLineHeight;
|
|
236
|
+
flowLines(valueLines, fonts.regular, BODY_SIZE, margin.left + labelWidth, contentWidth - labelWidth);
|
|
177
237
|
});
|
|
178
238
|
}
|
|
179
239
|
cursorY -= BLOCK_GAP;
|
|
@@ -235,6 +295,7 @@ export async function renderTablePdf(doc, options) {
|
|
|
235
295
|
}
|
|
236
296
|
}
|
|
237
297
|
drawIntroBlock();
|
|
298
|
+
ensureRoom(headerHeight + bodyLineHeight + 2 * CELL_PADDING_Y);
|
|
238
299
|
drawTableHeader();
|
|
239
300
|
if (doc.rows.length === 0 && doc.emptyText !== undefined) {
|
|
240
301
|
drawRow([
|
package/dist/secrets/feature.js
CHANGED
|
@@ -60,20 +60,21 @@ export function requireSecretsContext(ctx, handlerName) {
|
|
|
60
60
|
"createSecretsContext({db, masterKeyProvider, registry}) via extraContext.secrets at boot.",
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
const raw = ctx.secrets;
|
|
64
63
|
const userId = ctx._userId;
|
|
65
64
|
if (!userId) {
|
|
66
65
|
throw new InternalError({
|
|
67
66
|
message: `[${handlerName}] ctx._userId missing — cannot audit secret reads without a caller identity.`,
|
|
68
67
|
});
|
|
69
68
|
}
|
|
70
|
-
|
|
69
|
+
const withAudit = (raw) => ({
|
|
70
|
+
withRunner: (runner) => withAudit(raw.withRunner(runner)),
|
|
71
71
|
get: (tenantId, key, overrideAudit) => raw.get(tenantId, key, overrideAudit ?? { userId, handlerName }),
|
|
72
72
|
// No audit injection: has() is metadata-only and never logs a read.
|
|
73
73
|
has: raw.has.bind(raw),
|
|
74
74
|
set: raw.set.bind(raw),
|
|
75
75
|
delete: raw.delete.bind(raw),
|
|
76
|
-
};
|
|
76
|
+
});
|
|
77
|
+
return withAudit(ctx.secrets);
|
|
77
78
|
}
|
|
78
79
|
function resolveSecretsAccess(opts) {
|
|
79
80
|
if (opts.access !== undefined && opts.roles !== undefined) {
|
|
@@ -4,4 +4,4 @@ export declare function createDeleteHandler(access?: AccessRule): import("@cosmi
|
|
|
4
4
|
key: z.ZodString;
|
|
5
5
|
}, z.core.$strip>, {
|
|
6
6
|
key: string;
|
|
7
|
-
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap>;
|
|
7
|
+
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined>;
|
|
@@ -8,4 +8,4 @@ export declare function createSetHandler(access?: AccessRule): import("@cosmicdr
|
|
|
8
8
|
}, z.core.$strip>, {
|
|
9
9
|
key: string;
|
|
10
10
|
redactedPreview: string;
|
|
11
|
-
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap>;
|
|
11
|
+
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined>;
|
|
@@ -44,12 +44,21 @@ function resolveKey(keyOrHandle) {
|
|
|
44
44
|
return typeof keyOrHandle === "string" ? keyOrHandle : keyOrHandle.name;
|
|
45
45
|
}
|
|
46
46
|
export function createSecretsContext(opts) {
|
|
47
|
-
const {
|
|
47
|
+
const { masterKeyProvider } = opts;
|
|
48
48
|
const provider = withDekCache(masterKeyProvider, opts.dekCache ?? createDekCache());
|
|
49
|
+
return buildSecretsContext(opts, provider, opts.db, false);
|
|
50
|
+
}
|
|
51
|
+
// `runnerIsTransaction`: the runner is a caller-owned transaction, so audited reads join it
|
|
52
|
+
// instead of opening a second connection (which would deadlock a small pool).
|
|
53
|
+
function buildSecretsContext(opts, provider, db, runnerIsTransaction) {
|
|
54
|
+
const { masterKeyProvider } = opts;
|
|
49
55
|
async function lookup(tenantId, key) {
|
|
50
56
|
return fetchOne(db, tenantSecretsTable, { tenantId, key });
|
|
51
57
|
}
|
|
52
58
|
return {
|
|
59
|
+
withRunner(runner) {
|
|
60
|
+
return buildSecretsContext(opts, provider, runner, true);
|
|
61
|
+
},
|
|
53
62
|
async get(tenantId, keyOrHandle, auditCtx) {
|
|
54
63
|
const key = resolveKey(keyOrHandle);
|
|
55
64
|
// Atomic audit + read: a decrypt that "escaped" the audit trail
|
|
@@ -65,7 +74,7 @@ export function createSecretsContext(opts) {
|
|
|
65
74
|
const plaintext = await decryptValue(decodeStoredEnvelope(existing.envelope), provider);
|
|
66
75
|
return createSecret(plaintext);
|
|
67
76
|
}
|
|
68
|
-
const
|
|
77
|
+
const readAndAudit = async (tx) => {
|
|
69
78
|
// Inline select inside the TX via raw client — fetchOne's connection
|
|
70
79
|
// type doesn't widen to the transaction object cleanly.
|
|
71
80
|
const envelope = await selectTenantSecretEnvelope(tx, tenantId, key);
|
|
@@ -99,7 +108,10 @@ export function createSecretsContext(opts) {
|
|
|
99
108
|
metadata,
|
|
100
109
|
});
|
|
101
110
|
return pt;
|
|
102
|
-
}
|
|
111
|
+
};
|
|
112
|
+
const plaintext = runnerIsTransaction
|
|
113
|
+
? await readAndAudit(db)
|
|
114
|
+
: await transaction(db, readAndAudit);
|
|
103
115
|
if (plaintext === undefined)
|
|
104
116
|
return undefined;
|
|
105
117
|
// Brand the plaintext only after audit committed. The response
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { asRawClient } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
2
|
export async function deleteStaleSessionsBatch(db, olderThanDays, batchSize) {
|
|
3
|
-
const rows =
|
|
3
|
+
const rows = await asRawClient(db).unsafe(`DELETE FROM "store_user_sessions"
|
|
4
4
|
WHERE "id" IN (
|
|
5
5
|
SELECT "id" FROM "store_user_sessions"
|
|
6
6
|
WHERE "expires_at" < now() - ($1::int * interval '1 day')
|
|
7
7
|
OR "revoked_at" < now() - ($1::int * interval '1 day')
|
|
8
8
|
LIMIT $2
|
|
9
9
|
)
|
|
10
|
-
RETURNING "id"`, [olderThanDays, batchSize])
|
|
10
|
+
RETURNING "id"`, [olderThanDays, batchSize]);
|
|
11
11
|
return rows.length;
|
|
12
12
|
}
|
package/dist/sessions/feature.js
CHANGED
|
@@ -24,7 +24,7 @@ export function bindAutoRevokeFromFeature(feature) {
|
|
|
24
24
|
if (exports && typeof exports === "object" && "bindAutoRevokeOnPasswordChange" in exports) {
|
|
25
25
|
const { bindAutoRevokeOnPasswordChange } = exports;
|
|
26
26
|
if (typeof bindAutoRevokeOnPasswordChange === "function") {
|
|
27
|
-
// @cast-boundary exports
|
|
27
|
+
// @cast-boundary feature-exports — feature.exports is untyped by design
|
|
28
28
|
return bindAutoRevokeOnPasswordChange;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
2
|
import { access, definePagedQueryHandler, MAX_LIST_LIMIT, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
3
4
|
import * as z from "zod";
|
|
4
5
|
import { decryptStoredPii } from "../../shared/index.js";
|
|
5
6
|
import { userSessionTable } from "../schema/user-session.js";
|
|
@@ -10,7 +11,7 @@ import { userSessionTable } from "../schema/user-session.js";
|
|
|
10
11
|
// non-exposed column.
|
|
11
12
|
const SORTABLE_COLUMNS = ["id", "userId", "createdAt", "expiresAt", "revokedAt"];
|
|
12
13
|
function isSortableColumn(value) {
|
|
13
|
-
return SORTABLE_COLUMNS
|
|
14
|
+
return isOneOf(SORTABLE_COLUMNS, value);
|
|
14
15
|
}
|
|
15
16
|
// Admin view of every session in the active tenant. ctx.db (TenantDb)
|
|
16
17
|
// applies tenant-scoping automatically on selects from tables with a
|
|
@@ -6,4 +6,4 @@ export declare const revokeAllForUserWrite: import("@cosmicdrift/kumiko-types/de
|
|
|
6
6
|
}, z.core.$strip>, {
|
|
7
7
|
count: number;
|
|
8
8
|
userId: string;
|
|
9
|
-
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap>;
|
|
9
|
+
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
export declare const revokeAllOthersWrite: import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"user-session:revoke-all-others", z.ZodObject<{}, z.core.$strip>, {
|
|
3
3
|
count: number;
|
|
4
|
-
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap>;
|
|
4
|
+
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined>;
|
|
@@ -3,4 +3,4 @@ export declare const revokeWrite: import("@cosmicdrift/kumiko-types/define-handl
|
|
|
3
3
|
id: z.ZodUUID;
|
|
4
4
|
}, z.core.$strip>, {
|
|
5
5
|
id: string;
|
|
6
|
-
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap>;
|
|
6
|
+
}, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined>;
|