@cosmicdrift/kumiko-bundled-features 0.413.1 → 0.415.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.js +2 -2
- package/dist/agent-tools/agent-doc-lint.js +2 -1
- package/dist/agent-tools/agent-manifest.js +33 -25
- package/dist/agent-tools/api-docs/collect-events.js +4 -1
- package/dist/agent-tools/api-docs/collect.js +3 -3
- package/dist/agent-tools/api-docs/generate.js +4 -1
- package/dist/agent-tools/api-docs/index.d.ts +1 -0
- package/dist/agent-tools/api-docs/index.js +1 -0
- package/dist/agent-tools/api-docs/problems.d.ts +21 -0
- package/dist/agent-tools/api-docs/problems.js +11 -1
- package/dist/agent-tools/api-docs/render-openapi.js +2 -0
- package/dist/agent-tools/api-docs/resolve-config.d.ts +9 -0
- package/dist/agent-tools/api-docs/resolve-config.js +11 -0
- package/dist/agent-tools/api-docs/scope-slug-collisions.d.ts +4 -0
- package/dist/agent-tools/api-docs/scope-slug-collisions.js +10 -0
- package/dist/agent-tools/api-docs/translation-gaps.d.ts +4 -0
- package/dist/agent-tools/api-docs/translation-gaps.js +29 -0
- package/dist/agent-tools/api-docs/webhook-example-problems.d.ts +6 -0
- package/dist/agent-tools/api-docs/webhook-example-problems.js +25 -0
- package/dist/agent-tools/index.d.ts +1 -1
- package/dist/agent-tools/index.js +1 -1
- package/dist/agent-tools/labels.d.ts +3 -2
- package/dist/agent-tools/labels.js +21 -4
- package/dist/agent-tools/tool-catalog.d.ts +5 -5
- package/dist/agent-tools/tool-catalog.js +12 -10
- package/dist/agent-tools/tool-dispatch.js +11 -1
- package/dist/agent-tools/types.d.ts +4 -0
- package/dist/audit/event-classification.js +6 -0
- package/dist/audit/web/i18n.js +1 -0
- package/dist/auth-email-password/errors.js +0 -13
- package/dist/auth-email-password/handlers/invite-signup-complete.write.js +101 -84
- package/dist/auth-email-password/handlers/login-options.query.js +1 -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 +0 -1
- package/dist/auth-email-password/handlers/request-password-reset.write.js +0 -1
- package/dist/auth-email-password/handlers/self-registration-status.query.js +1 -1
- package/dist/auth-email-password/reset-token.js +0 -2
- package/dist/auth-email-password/seeding.js +34 -8
- package/dist/auth-email-password/signup-token-store.d.ts +2 -2
- package/dist/auth-email-password/signup-token-store.js +2 -4
- package/dist/auth-email-password/unlock-token.js +0 -2
- package/dist/auth-email-password/verification-token.js +0 -2
- package/dist/auth-email-password/web/auth-form-primitives.js +2 -2
- package/dist/auth-email-password/web/auth-gate.js +2 -2
- package/dist/auth-email-password/web/auth-redirect.d.ts +1 -0
- package/dist/auth-email-password/web/auth-redirect.js +4 -0
- package/dist/auth-email-password/web/forgot-password-screen.js +1 -5
- package/dist/auth-email-password/web/invite-accept-screen.js +1 -1
- package/dist/auth-email-password/web/return-path.d.ts +2 -1
- package/dist/auth-email-password/web/return-path.js +2 -1
- package/dist/auth-email-password/web/session.js +13 -13
- package/dist/auth-email-password/web/signup-screen.js +1 -5
- package/dist/auth-email-password/web/static-account.js +6 -2
- package/dist/auth-email-password/web/token-confirm-screen.js +4 -5
- package/dist/auth-mfa/web/mfa-code-or-recovery-field.d.ts +6 -1
- package/dist/auth-mfa/web/mfa-code-or-recovery-field.js +4 -2
- package/dist/auth-mfa/web/mfa-disable-dialog.js +1 -1
- package/dist/auth-mfa/web/mfa-regenerate-recovery-dialog.js +1 -1
- package/dist/auth-mfa/web/mfa-setup-preauth-screen.js +1 -1
- package/dist/auth-mfa/web/mfa-verify-screen.js +7 -11
- package/dist/auth-mfa-user-data/index.js +5 -6
- package/dist/billing-foundation/aggregate-id.js +0 -4
- package/dist/billing-foundation/checkout-core.d.ts +2 -0
- package/dist/billing-foundation/checkout-core.js +17 -1
- package/dist/billing-foundation/checkout-ledger.d.ts +22 -0
- package/dist/billing-foundation/checkout-ledger.js +38 -0
- package/dist/billing-foundation/consumer-protection/consent-gate.d.ts +1 -1
- package/dist/billing-foundation/consumer-protection/consent-gate.js +2 -2
- package/dist/billing-foundation/consumer-protection/consent-text.d.ts +6 -2
- package/dist/billing-foundation/consumer-protection/consent-text.js +29 -3
- package/dist/billing-foundation/consumer-protection/termination-open-cancels.d.ts +2 -1
- package/dist/billing-foundation/consumer-protection/termination-open-cancels.js +5 -1
- package/dist/billing-foundation/consumer-protection/termination-provider-timeout.d.ts +2 -0
- package/dist/billing-foundation/consumer-protection/termination-provider-timeout.js +17 -0
- package/dist/billing-foundation/consumer-protection/termination-record.js +5 -4
- package/dist/billing-foundation/consumer-protection/termination-revoke.js +1 -1
- package/dist/billing-foundation/events.d.ts +23 -0
- package/dist/billing-foundation/events.js +39 -10
- package/dist/billing-foundation/feature.js +12 -1
- package/dist/billing-foundation/handlers/billing-plans.query.js +25 -15
- package/dist/billing-foundation/handlers/create-checkout-session.write.js +3 -2
- package/dist/billing-foundation/handlers/process-event.write.d.ts +4 -2
- package/dist/billing-foundation/handlers/process-event.write.js +132 -25
- package/dist/billing-foundation/handlers/process-payment-event.write.d.ts +1 -2
- package/dist/billing-foundation/handlers/process-payment-event.write.js +31 -11
- package/dist/billing-foundation/handlers/record-checkout-opened.write.d.ts +2 -0
- package/dist/billing-foundation/handlers/record-checkout-opened.write.js +22 -0
- package/dist/billing-foundation/handlers/start-plan-checkout.write.js +3 -2
- package/dist/billing-foundation/handlers/switch-plan.write.js +10 -4
- package/dist/billing-foundation/i18n.js +3 -0
- package/dist/billing-foundation/pending-plan-switch.d.ts +12 -0
- package/dist/billing-foundation/pending-plan-switch.js +57 -0
- package/dist/billing-foundation/scrub-raw-payload-headers.d.ts +4 -0
- package/dist/billing-foundation/scrub-raw-payload-headers.js +33 -0
- package/dist/billing-foundation/types.d.ts +40 -24
- package/dist/billing-foundation/validate-options.js +14 -0
- package/dist/billing-foundation/web/billing-plans-panel.js +8 -3
- package/dist/billing-foundation/web/cancel-contract-dialog.js +1 -1
- package/dist/billing-foundation/web/checkout-consent-dialog.js +1 -1
- package/dist/billing-foundation/web/constants.d.ts +3 -0
- package/dist/billing-foundation/web/constants.js +5 -2
- package/dist/billing-foundation/web/plan-switch-confirm-dialog.js +1 -1
- package/dist/billing-foundation/webhook-handler.js +53 -11
- package/dist/cap-counter/aggregate-id.js +0 -2
- package/dist/cap-counter/stock-cap-guard.d.ts +1 -0
- package/dist/cap-counter/stock-cap-guard.js +18 -4
- package/dist/cap-overview/handlers/tenant-caps-list.query.js +18 -4
- package/dist/cap-overview/i18n.js +1 -0
- package/dist/cap-overview/index.d.ts +1 -1
- package/dist/cap-overview/types.d.ts +4 -0
- package/dist/cap-overview/web/cap-cards-panel.js +6 -2
- package/dist/cap-overview/web/cap-usage-bar.js +6 -1
- package/dist/cap-overview/web/usage-math.d.ts +1 -0
- package/dist/cap-overview/web/usage-math.js +4 -0
- package/dist/channel-in-app/handlers/read-state-by-keys.query.js +2 -2
- package/dist/channel-whatsapp/aggregate-id.d.ts +8 -0
- package/dist/channel-whatsapp/aggregate-id.js +18 -0
- package/dist/channel-whatsapp/constants.d.ts +25 -0
- package/dist/channel-whatsapp/constants.js +36 -0
- package/dist/channel-whatsapp/events.d.ts +90 -0
- package/dist/channel-whatsapp/events.js +71 -0
- package/dist/channel-whatsapp/feature.d.ts +3 -0
- package/dist/channel-whatsapp/feature.js +56 -0
- package/dist/channel-whatsapp/graph-client.d.ts +85 -0
- package/dist/channel-whatsapp/graph-client.js +272 -0
- package/dist/channel-whatsapp/in-memory-meta.d.ts +83 -0
- package/dist/channel-whatsapp/in-memory-meta.js +181 -0
- package/dist/channel-whatsapp/inbound-handlers.d.ts +39 -0
- package/dist/channel-whatsapp/inbound-handlers.js +148 -0
- package/dist/channel-whatsapp/index.d.ts +10 -0
- package/dist/channel-whatsapp/index.js +10 -0
- package/dist/channel-whatsapp/meta-signature.d.ts +5 -0
- package/dist/channel-whatsapp/meta-signature.js +19 -0
- package/dist/channel-whatsapp/options.d.ts +32 -0
- package/dist/channel-whatsapp/options.js +83 -0
- package/dist/channel-whatsapp/pii.d.ts +32 -0
- package/dist/channel-whatsapp/pii.js +61 -0
- package/dist/channel-whatsapp/webhook-normalize.d.ts +7 -0
- package/dist/channel-whatsapp/webhook-normalize.js +200 -0
- package/dist/channel-whatsapp/webhook-routes.d.ts +10 -0
- package/dist/channel-whatsapp/webhook-routes.js +118 -0
- package/dist/compliance-profiles/handlers/set-profile.write.js +2 -0
- package/dist/compliance-profiles/handlers/sub-processors.query.js +1 -1
- package/dist/config/handlers/set.write.js +7 -0
- package/dist/config/handlers/values.query.js +8 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/read-redaction.d.ts +1 -0
- package/dist/config/read-redaction.js +5 -2
- package/dist/config/table.js +1 -0
- package/dist/config/write-helpers.js +3 -2
- package/dist/crypto-shredding/constants.d.ts +1 -0
- package/dist/crypto-shredding/constants.js +1 -0
- package/dist/crypto-shredding/handlers/forget-subject.write.js +34 -13
- package/dist/crypto-shredding/index.d.ts +1 -0
- package/dist/crypto-shredding/index.js +1 -0
- package/dist/crypto-shredding/subject-forget-after-delete-hook.d.ts +12 -0
- package/dist/crypto-shredding/subject-forget-after-delete-hook.js +38 -0
- package/dist/custom-fields/aggregate-id.js +0 -1
- package/dist/custom-fields/entity.js +1 -0
- package/dist/custom-fields/wire-for-entity.js +0 -1
- package/dist/data-retention/erase-notes-of-deleted-row.d.ts +9 -0
- package/dist/data-retention/erase-notes-of-deleted-row.js +15 -0
- package/dist/data-retention/feature.js +2 -5
- package/dist/data-retention/run-retention-cleanup.d.ts +1 -0
- package/dist/data-retention/run-retention-cleanup.js +39 -19
- package/dist/data-retention/tenant-destruction-hold.js +7 -0
- package/dist/delivery/attempt-log-factory.d.ts +3 -0
- package/dist/delivery/attempt-log-factory.js +5 -0
- package/dist/delivery/attempt-log.d.ts +2 -2
- package/dist/delivery/channel-context.d.ts +1 -1
- package/dist/delivery/channel-context.js +5 -2
- package/dist/delivery/db/queries/preferences.js +0 -1
- package/dist/delivery/delivery-service.js +3 -0
- package/dist/delivery/feature.d.ts +1 -4
- package/dist/delivery/feature.js +3 -1
- package/dist/delivery/handlers/attempts-by-keys.query.d.ts +1 -1
- package/dist/delivery/handlers/opted-in-user-ids.query.d.ts +7 -0
- package/dist/delivery/handlers/opted-in-user-ids.query.js +50 -0
- package/dist/delivery/handlers/preferences.query.js +2 -20
- package/dist/delivery/handlers/resubscribe-user.write.d.ts +2 -2
- package/dist/delivery/handlers/resubscribe-user.write.js +2 -24
- package/dist/delivery/handlers/unsubscribe-page-chrome.query.js +2 -0
- package/dist/delivery/handlers/unsubscribe-user.write.d.ts +2 -2
- package/dist/delivery/handlers/unsubscribe-user.write.js +2 -26
- package/dist/delivery/index.d.ts +3 -1
- package/dist/delivery/index.js +1 -0
- package/dist/delivery/options.d.ts +4 -0
- package/dist/delivery/options.js +1 -0
- package/dist/delivery/preference-rows.d.ts +9 -0
- package/dist/delivery/preference-rows.js +22 -0
- package/dist/delivery/set-preference-enabled.d.ts +17 -0
- package/dist/delivery/set-preference-enabled.js +26 -0
- package/dist/delivery/tables.d.ts +2 -2
- package/dist/delivery/testing.d.ts +1 -1
- package/dist/delivery/testing.js +3 -1
- package/dist/delivery/types.d.ts +1 -0
- package/dist/delivery/unsubscribe-page.js +5 -1
- package/dist/delivery/upsert-preference.js +0 -1
- package/dist/delivery/web/public-names.d.ts +1 -0
- package/dist/delivery/web/public-names.js +1 -0
- package/dist/derivatives-sharp/render.js +9 -9
- package/dist/document-ingest-foundation/aggregate-id.js +0 -1
- package/dist/document-ingest-foundation/append-missing-extract-event.d.ts +0 -1
- package/dist/document-ingest-foundation/append-missing-extract-event.js +32 -21
- package/dist/document-ingest-foundation/feature.js +1 -0
- package/dist/document-ingest-foundation/report-ingest-progress.d.ts +1 -1
- package/dist/document-ingest-foundation/report-ingest-progress.js +32 -13
- package/dist/documents/aggregate-id.js +0 -2
- package/dist/documents/constants.d.ts +6 -0
- package/dist/documents/constants.js +8 -2
- package/dist/documents/ensure-link.d.ts +5 -8
- package/dist/documents/ensure-link.js +4 -2
- package/dist/documents/feature.d.ts +3 -1
- package/dist/documents/feature.js +29 -5
- package/dist/documents/handlers/import.write.js +2 -2
- package/dist/documents/queries/expiry-overview.query.js +2 -1
- package/dist/documents/queries/for-record.query.js +3 -4
- package/dist/documents/queries/list-page.js +11 -3
- package/dist/documents/queries/overview.query.js +2 -2
- package/dist/documents/screens.js +3 -3
- package/dist/documents/tab.js +1 -1
- package/dist/feature-toggles/toggle-sync-signal.d.ts +2 -2
- package/dist/feature-toggles/toggle-sync-signal.js +3 -2
- package/dist/file-derivatives/handlers/public-variant-by-file-ref.query.js +1 -1
- package/dist/file-derivatives/handlers/public-variant.query.js +1 -1
- package/dist/file-foundation/probe.js +9 -3
- package/dist/file-foundation/read-file-ref-content.js +23 -11
- package/dist/file-provider-inmemory/feature.js +1 -1
- package/dist/file-provider-s3/env-feature.js +1 -1
- package/dist/file-provider-s3/env-named-feature.js +1 -1
- package/dist/file-provider-s3/env-schema.d.ts +10 -1
- package/dist/file-provider-s3/env-schema.js +20 -7
- package/dist/file-provider-s3/feature.js +1 -1
- package/dist/file-provider-s3/index.d.ts +1 -1
- package/dist/file-provider-s3/index.js +1 -1
- package/dist/file-provider-s3/lib/env-helper.d.ts +3 -2
- package/dist/file-provider-s3/lib/env-helper.js +13 -12
- package/dist/file-provider-s3/lib/s3-provider.js +10 -2
- package/dist/folders/aggregate-id.js +0 -1
- package/dist/folders/web/folder-manager.js +1 -1
- package/dist/folders-user-data/index.js +12 -14
- package/dist/form-draft/feature.js +1 -0
- package/dist/helpdesk/entity.js +4 -1
- package/dist/helpdesk/feature.js +37 -0
- package/dist/helpdesk/handlers/access.d.ts +0 -1
- package/dist/helpdesk/handlers/access.js +0 -3
- package/dist/helpdesk/handlers/attempts.js +7 -13
- package/dist/helpdesk/handlers/challenge.query.js +1 -2
- package/dist/helpdesk/handlers/reply.write.js +7 -8
- package/dist/helpdesk/handlers/report.write.js +4 -7
- package/dist/helpdesk/handlers/submit.write.js +5 -9
- package/dist/helpdesk/index.d.ts +1 -1
- package/dist/helpdesk/index.js +1 -1
- package/dist/helpdesk/legacy-contact-config.d.ts +3 -0
- package/dist/helpdesk/legacy-contact-config.js +57 -0
- package/dist/helpdesk/legacy-contact-erasure.d.ts +9 -0
- package/dist/helpdesk/legacy-contact-erasure.js +19 -0
- package/dist/helpdesk/legacy-contact-retention.d.ts +2 -0
- package/dist/helpdesk/legacy-contact-retention.js +53 -0
- package/dist/helpdesk/legacy-contact-streams.d.ts +20 -0
- package/dist/helpdesk/legacy-contact-streams.js +124 -0
- package/dist/helpdesk/legacy-contact-user-data.d.ts +5 -0
- package/dist/helpdesk/legacy-contact-user-data.js +62 -0
- package/dist/helpdesk/lib.d.ts +8 -2
- package/dist/helpdesk/lib.js +32 -32
- package/dist/helpdesk/user-data-hooks.d.ts +10 -1
- package/dist/helpdesk/user-data-hooks.js +47 -36
- package/dist/helpdesk/web/constants.d.ts +0 -1
- package/dist/helpdesk/web/constants.js +0 -1
- package/dist/inbound-mail-foundation/account-health.js +1 -1
- package/dist/inbound-mail-foundation/account-poll.js +3 -1
- package/dist/inbound-mail-foundation/aggregate-id.js +0 -2
- package/dist/inbound-mail-foundation/constants.d.ts +6 -0
- package/dist/inbound-mail-foundation/constants.js +6 -0
- package/dist/inbound-mail-foundation/content-refetch.d.ts +4 -0
- package/dist/inbound-mail-foundation/content-refetch.js +13 -3
- package/dist/inbound-mail-foundation/entities.js +58 -15
- package/dist/inbound-mail-foundation/events.js +16 -16
- package/dist/inbound-mail-foundation/feature.js +3 -1
- package/dist/inbound-mail-foundation/handlers/account-address.d.ts +2 -2
- package/dist/inbound-mail-foundation/handlers/account-address.js +10 -2
- package/dist/inbound-mail-foundation/handlers/attach-message-content.write.js +8 -3
- package/dist/inbound-mail-foundation/handlers/connect-account.write.js +14 -8
- package/dist/inbound-mail-foundation/handlers/forget-message.write.d.ts +7 -0
- package/dist/inbound-mail-foundation/handlers/forget-message.write.js +58 -0
- package/dist/inbound-mail-foundation/handlers/ingest-message-schema.js +12 -5
- package/dist/inbound-mail-foundation/i18n.js +3 -0
- package/dist/inbound-mail-foundation/index.d.ts +1 -0
- package/dist/inbound-mail-foundation/index.js +1 -0
- package/dist/inbound-mail-foundation/normalize-inbound-message.d.ts +6 -0
- package/dist/inbound-mail-foundation/normalize-inbound-message.js +21 -8
- package/dist/inbound-mail-foundation/oauth-access-token.js +1 -1
- package/dist/inbound-mail-foundation/outbound-mail.d.ts +2 -0
- package/dist/inbound-mail-foundation/personal-address.d.ts +1 -0
- package/dist/inbound-mail-foundation/personal-address.js +16 -0
- package/dist/inbound-mail-foundation/purge-messages.d.ts +20 -0
- package/dist/inbound-mail-foundation/purge-messages.js +33 -0
- package/dist/inbound-mail-foundation/quarantine.d.ts +3 -2
- package/dist/inbound-mail-foundation/quarantine.js +9 -5
- package/dist/inbound-mail-foundation/retention-job.js +1 -5
- package/dist/inbound-mail-foundation/retention-sweep.js +17 -28
- package/dist/inbound-mail-foundation/sanitize-inbound-html.d.ts +0 -1
- package/dist/inbound-mail-foundation/sanitize-inbound-html.js +2 -4
- package/dist/inbound-mail-foundation/send-from-account.js +9 -1
- package/dist/inbound-mail-foundation/supervisor-ingest.js +4 -1
- package/dist/inbound-mail-foundation/sync-account-now.js +1 -1
- package/dist/inbound-mail-foundation/tenant-destroy-hook.js +3 -6
- package/dist/inbound-mail-foundation/watch-supervisor.js +1 -1
- package/dist/inbound-provider-imap/byte-budget.d.ts +14 -0
- package/dist/inbound-provider-imap/byte-budget.js +53 -0
- package/dist/inbound-provider-imap/connect-mailbox.d.ts +2 -4
- package/dist/inbound-provider-imap/connect-mailbox.js +8 -3
- package/dist/inbound-provider-imap/connect-my-mailbox.d.ts +1 -1
- package/dist/inbound-provider-imap/connect-my-mailbox.js +15 -4
- package/dist/inbound-provider-imap/connect-target-rate-limit.d.ts +3 -0
- package/dist/inbound-provider-imap/connect-target-rate-limit.js +37 -0
- package/dist/inbound-provider-imap/download-batch.d.ts +10 -0
- package/dist/inbound-provider-imap/download-batch.js +21 -6
- package/dist/inbound-provider-imap/feature.js +7 -4
- package/dist/inbound-provider-imap/fetch-content.js +35 -30
- package/dist/inbound-provider-imap/i18n.js +2 -2
- package/dist/inbound-provider-imap/parse-message.d.ts +7 -0
- package/dist/inbound-provider-imap/parse-message.js +8 -0
- package/dist/inbound-provider-imap/reconnect-mailbox.js +5 -4
- package/dist/inbound-provider-imap/send-mail.d.ts +2 -0
- package/dist/inbound-provider-imap/send-mail.js +32 -6
- package/dist/inbound-provider-imap/smtp-client.d.ts +9 -2
- package/dist/inbound-provider-imap/smtp-client.js +15 -3
- package/dist/inbound-provider-imap/watch-mailbox.js +3 -24
- package/dist/inbound-provider-inmemory/feature.js +1 -1
- package/dist/jobs/events.d.ts +13 -0
- package/dist/jobs/events.js +8 -0
- package/dist/jobs/feature.js +2 -0
- package/dist/jobs/handlers/consumer.write.js +31 -20
- package/dist/jobs/web/constants.d.ts +3 -0
- package/dist/jobs/web/constants.js +3 -0
- package/dist/mail-transport-inmemory/feature.js +1 -1
- package/dist/mail-transport-smtp/feature.js +3 -2
- package/dist/managed-pages/handlers/branding.query.js +1 -1
- package/dist/managed-pages/handlers/by-slug.query.js +1 -1
- package/dist/managed-pages/handlers/by-tenant-published.query.js +1 -1
- package/dist/managed-pages/render-page-body.d.ts +2 -0
- package/dist/managed-pages/render-page-body.js +12 -8
- package/dist/managed-pages/screens/page-screens.d.ts +3 -2
- package/dist/managed-pages/screens/page-screens.js +14 -33
- package/dist/managed-pages/table.js +1 -0
- package/dist/managed-pages/web/client-plugin.js +8 -6
- package/dist/managed-pages/web/constants.d.ts +5 -1
- package/dist/managed-pages/web/constants.js +6 -1
- package/dist/managed-pages/web/i18n.js +11 -3
- package/dist/managed-pages/web/markdown-to-document.js +1 -1
- package/dist/managed-pages/web/page-edit-draft.d.ts +32 -0
- package/dist/managed-pages/web/page-edit-draft.js +76 -0
- package/dist/managed-pages/web/page-edit-screen.d.ts +2 -0
- package/dist/managed-pages/web/page-edit-screen.js +113 -0
- package/dist/managed-pages/web/page-settings-rail.d.ts +11 -0
- package/dist/managed-pages/web/page-settings-rail.js +14 -0
- package/dist/notes-history-user-data/index.js +8 -14
- package/dist/personal-access-tokens/boot-rules.d.ts +5 -0
- package/dist/personal-access-tokens/boot-rules.js +5 -0
- package/dist/personal-access-tokens/handlers/create.write.js +0 -1
- package/dist/personal-access-tokens/scope-events-check.js +26 -6
- package/dist/presence/handlers/list.query.js +18 -8
- package/dist/presence/room.d.ts +2 -0
- package/dist/presence/room.js +8 -5
- package/dist/presence/store.d.ts +2 -0
- package/dist/presence/store.js +62 -26
- package/dist/readiness/handlers/latest-summary.query.js +10 -6
- package/dist/readiness/handlers/run-probes.write.js +24 -4
- package/dist/readiness/handlers/run-tone.js +3 -2
- package/dist/readiness/handlers/status.query.js +11 -3
- package/dist/readiness/probe-context.js +7 -10
- package/dist/readiness/screens.js +4 -4
- package/dist/readiness/visible-results.d.ts +1 -1
- package/dist/readiness/visible-results.js +5 -2
- package/dist/renderer-foundation/api.js +6 -12
- package/dist/renderer-foundation/types.d.ts +2 -2
- package/dist/secrets/db/queries/read.d.ts +2 -1
- package/dist/secrets/db/queries/read.js +10 -1
- package/dist/secrets/handlers/list.query.js +4 -2
- package/dist/secrets/secret-scope.d.ts +0 -1
- package/dist/secrets/secret-scope.js +2 -2
- package/dist/secrets/secrets-context.js +4 -4
- package/dist/secrets/table.d.ts +1 -1
- package/dist/secrets/write-gate.js +4 -2
- package/dist/seo/handlers/seo-config.query.js +1 -1
- package/dist/shared/acknowledged-system-db.d.ts +5 -0
- package/dist/shared/acknowledged-system-db.js +9 -0
- package/dist/shared/assert-billing-live.d.ts +1 -0
- package/dist/shared/assert-billing-live.js +5 -2
- package/dist/shared/hmac-signature.js +4 -2
- package/dist/shared/index.d.ts +7 -2
- package/dist/shared/index.js +7 -2
- package/dist/shared/normalize-email.d.ts +1 -0
- package/dist/shared/normalize-email.js +3 -0
- package/dist/shared/parent-visibility.d.ts +1 -0
- package/dist/shared/parent-visibility.js +16 -1
- package/dist/shared/password-hashing.js +0 -1
- package/dist/shared/price-env-shape.js +1 -1
- package/dist/shared/register-user-data-hooks.d.ts +11 -0
- package/dist/shared/register-user-data-hooks.js +11 -0
- package/dist/shared/require-bootstrap-extension.d.ts +9 -0
- package/dist/shared/require-bootstrap-extension.js +16 -0
- package/dist/shared/send-best-effort.d.ts +3 -0
- package/dist/shared/send-best-effort.js +19 -0
- package/dist/shared/stream-tenant-backfill.d.ts +1 -0
- package/dist/shared/stream-tenant-backfill.js +17 -1
- package/dist/shared/stream-tenant-derived-state.d.ts +5 -1
- package/dist/shared/stream-tenant-derived-state.js +19 -2
- package/dist/step-dispatcher/constants.d.ts +4 -0
- package/dist/step-dispatcher/constants.js +11 -0
- package/dist/step-dispatcher/deliver-dispatch-request.d.ts +1 -0
- package/dist/step-dispatcher/deliver-dispatch-request.js +41 -3
- package/dist/step-dispatcher/feature.js +31 -2
- package/dist/step-dispatcher/mail-runner.js +0 -1
- package/dist/step-dispatcher/sweep-abandoned.d.ts +11 -0
- package/dist/step-dispatcher/sweep-abandoned.js +46 -0
- package/dist/subscription-mollie/plugin-methods.d.ts +1 -0
- package/dist/subscription-mollie/plugin-methods.js +1 -2
- package/dist/subscription-mollie/verify-webhook.js +5 -5
- package/dist/subscription-paddle/backfill-checkout-ledger.d.ts +9 -0
- package/dist/subscription-paddle/backfill-checkout-ledger.js +112 -0
- package/dist/subscription-paddle/checkout-config.query.js +1 -1
- package/dist/subscription-paddle/checkout-methods.js +2 -8
- package/dist/subscription-paddle/constants.d.ts +0 -1
- package/dist/subscription-paddle/constants.js +1 -2
- package/dist/subscription-paddle/feature.d.ts +0 -4
- package/dist/subscription-paddle/feature.js +21 -20
- package/dist/subscription-paddle/ledger-backfill-marker.d.ts +17 -0
- package/dist/subscription-paddle/ledger-backfill-marker.js +53 -0
- package/dist/subscription-paddle/plan-switch-methods.js +2 -8
- package/dist/subscription-paddle/redeliver-legacy-checkout.d.ts +11 -0
- package/dist/subscription-paddle/redeliver-legacy-checkout.js +43 -0
- package/dist/subscription-paddle/runtime.d.ts +3 -5
- package/dist/subscription-paddle/runtime.js +4 -7
- package/dist/subscription-paddle/subscription-state.d.ts +1 -0
- package/dist/subscription-paddle/subscription-state.js +1 -0
- package/dist/subscription-paddle/webhook-events.d.ts +4 -0
- package/dist/subscription-paddle/webhook-events.js +40 -22
- package/dist/subscription-stripe/feature.d.ts +4 -0
- package/dist/subscription-stripe/feature.js +1 -0
- package/dist/subscription-stripe/plugin-methods.d.ts +1 -0
- package/dist/subscription-stripe/plugin-methods.js +2 -5
- package/dist/subscription-stripe/runtime.d.ts +2 -1
- package/dist/subscription-stripe/runtime.js +5 -7
- package/dist/subscription-stripe/verify-webhook.js +31 -6
- package/dist/tags/aggregate-id.js +0 -1
- package/dist/tags/web/tag-chip.js +0 -1
- package/dist/tags/web/tag-manager.js +3 -1
- package/dist/template-resolver/api.js +6 -12
- package/dist/template-resolver/document-sanitizer.d.ts +1 -1
- package/dist/template-resolver/document-sanitizer.js +18 -0
- package/dist/template-resolver/feature.d.ts +1 -0
- package/dist/template-resolver/feature.js +2 -0
- package/dist/template-resolver/handlers/body-preview.query.d.ts +11 -0
- package/dist/template-resolver/handlers/body-preview.query.js +41 -0
- package/dist/template-resolver/handlers/by-slug.query.js +1 -1
- package/dist/template-resolver/handlers/by-tenant.query.js +1 -1
- package/dist/template-resolver/handlers/collection-shared.js +5 -8
- package/dist/template-resolver/handlers/overview.query.d.ts +1 -0
- package/dist/template-resolver/handlers/overview.query.js +2 -1
- package/dist/template-resolver/handlers/send-test.write.js +27 -8
- package/dist/template-resolver/linked-resources.js +2 -6
- package/dist/template-resolver/seeding.js +92 -1
- package/dist/template-resolver/table.js +1 -0
- package/dist/template-resolver/template-draft.js +2 -1
- package/dist/template-resolver/template-preview.js +12 -3
- package/dist/template-resolver/testing.js +0 -2
- package/dist/template-resolver/web/client-plugin.js +3 -0
- package/dist/template-resolver/web/collection-entry-create-form.js +19 -9
- package/dist/template-resolver/web/constants.d.ts +2 -0
- package/dist/template-resolver/web/constants.js +2 -0
- package/dist/template-resolver/web/content-tree-provider.js +0 -1
- package/dist/template-resolver/web/content-workbench.d.ts +22 -0
- package/dist/template-resolver/web/content-workbench.js +32 -0
- package/dist/template-resolver/web/document-insert-model.d.ts +2 -4
- package/dist/template-resolver/web/document-insert-model.js +1 -2
- package/dist/template-resolver/web/document-link-policy.d.ts +3 -0
- package/dist/template-resolver/web/document-link-policy.js +53 -0
- package/dist/template-resolver/web/document-schema.d.ts +2 -4
- package/dist/template-resolver/web/document-schema.js +2 -53
- package/dist/template-resolver/web/document-tiptap-context.d.ts +2 -5
- package/dist/template-resolver/web/document-tiptap-context.js +2 -2
- package/dist/template-resolver/web/document-tiptap-editor.js +2 -2
- package/dist/template-resolver/web/document-tiptap-helpers.d.ts +7 -4
- package/dist/template-resolver/web/document-tiptap-toolbar-groups.js +3 -3
- package/dist/template-resolver/web/editor-handle.js +1 -0
- package/dist/template-resolver/web/fill-document-variables.d.ts +1 -0
- package/dist/template-resolver/web/fill-document-variables.js +22 -0
- package/dist/template-resolver/web/i18n.js +10 -0
- package/dist/template-resolver/web/index.d.ts +3 -0
- package/dist/template-resolver/web/index.js +2 -0
- package/dist/template-resolver/web/preview-targets.d.ts +5 -0
- package/dist/template-resolver/web/preview-targets.js +21 -0
- package/dist/template-resolver/web/qualified-names.d.ts +1 -0
- package/dist/template-resolver/web/qualified-names.js +1 -0
- package/dist/template-resolver/web/snippet-preview-renderer.d.ts +2 -0
- package/dist/template-resolver/web/snippet-preview-renderer.js +15 -0
- package/dist/template-resolver/web/string-values.d.ts +1 -0
- package/dist/template-resolver/web/string-values.js +8 -0
- package/dist/template-resolver/web/text-block-editor.js +18 -11
- package/dist/template-resolver/web/use-collection-entry-create.d.ts +1 -0
- package/dist/template-resolver/web/use-collection-entry-create.js +6 -0
- package/dist/template-resolver/web/use-document-tiptap-model.d.ts +2 -6
- package/dist/template-resolver/web/use-text-block-editor.d.ts +3 -0
- package/dist/template-resolver/web/use-text-block-editor.js +26 -5
- package/dist/template-resolver/web/web-preview-renderer.d.ts +12 -0
- package/dist/template-resolver/web/web-preview-renderer.js +45 -0
- package/dist/template-resolver-user-data/index.js +11 -10
- package/dist/tenant/handlers/create.write.js +3 -7
- package/dist/tenant/handlers/list.query.js +3 -8
- package/dist/tenant/handlers/member-directory.query.js +10 -5
- package/dist/tenant/handlers/toggle-enabled.write.js +1 -1
- package/dist/tenant/invited-membership.js +9 -1
- package/dist/tenant/seeding.d.ts +3 -0
- package/dist/tenant/seeding.js +3 -1
- package/dist/tenant/stream-tenant-backfill.js +5 -1
- package/dist/tenant/testing.js +1 -1
- package/dist/tenant-inactivity/check-inactive-tenants.js +29 -18
- package/dist/tenant-inactivity/constants.js +1 -2
- package/dist/tenant-inactivity/handlers/keep-account.write.js +8 -2
- package/dist/tenant-inactivity/state-store.d.ts +3 -1
- package/dist/tenant-inactivity/state-store.js +16 -1
- package/dist/tenant-lifecycle/constants.d.ts +1 -0
- package/dist/tenant-lifecycle/constants.js +3 -0
- package/dist/tenant-lifecycle/feature.js +1 -0
- package/dist/tenant-lifecycle/run-tenant-destroy.js +38 -5
- package/dist/tenant-lifecycle/stages.js +14 -2
- package/dist/tier-engine/aggregate-id.js +0 -1
- package/dist/tier-engine/feature.js +9 -2
- package/dist/user/db/queries/stream-tenant-backfill.js +2 -1
- package/dist/user/handlers/me.query.js +4 -1
- package/dist/user/index.d.ts +1 -0
- package/dist/user/index.js +1 -0
- package/dist/user/resolve-verified-user-email.d.ts +2 -0
- package/dist/user/resolve-verified-user-email.js +14 -0
- package/dist/user-data-rights/db/queries/export-jobs.js +0 -1
- package/dist/user-data-rights/feature.js +1 -0
- package/dist/user-data-rights/handlers/confirm-deletion-by-token.write.js +1 -1
- package/dist/user-data-rights/handlers/download-by-token.query.js +1 -1
- package/dist/user-data-rights/handlers/request-deletion-by-email.write.js +1 -1
- package/dist/user-data-rights/run-export-jobs.js +0 -2
- package/dist/user-data-rights/run-forget-cleanup.js +2 -2
- package/dist/user-data-rights/schema/download-attempt.js +3 -2
- package/dist/user-data-rights/web/confirm-deletion-screen.js +2 -2
- package/dist/user-data-rights/web/privacy-center-screen.js +1 -1
- package/dist/user-data-rights/web/request-deletion-screen.js +2 -2
- package/dist/user-data-rights-defaults/hooks/api-token.userdata-hook.js +5 -6
- package/dist/user-data-rights-defaults/hooks/hard-delete-own-rows-hook.d.ts +7 -0
- package/dist/user-data-rights-defaults/hooks/hard-delete-own-rows-hook.js +11 -0
- package/dist/user-data-rights-defaults/hooks/in-app-message.userdata-hook.js +5 -6
- package/dist/user-data-rights-defaults/hooks/job-run.userdata-hook.js +2 -1
- package/dist/user-data-rights-defaults/hooks/user-session.userdata-hook.js +5 -6
- package/dist/user-profile/handlers/change-email.write.js +0 -1
- package/dist/waitlist/handlers/reject.write.js +2 -1
- package/dist/waitlist/handlers/submit.write.js +6 -19
- package/dist/waitlist/import.js +2 -1
- package/dist/waitlist/lib.d.ts +0 -1
- package/dist/waitlist/lib.js +2 -10
- package/dist/waitlist/link-on-signup.js +2 -2
- package/dist/waitlist/user-data-hooks.js +6 -20
- package/dist/workflow-runner/aggregate-id.js +0 -1
- package/dist/workflow-runner/event-trigger.js +6 -2
- package/dist/workflow-runner/feature.js +1 -5
- package/dist/workflow-runner/handlers/resume-run.write.js +6 -4
- package/dist/workflow-runner/runner.d.ts +1 -0
- package/package.json +35 -11
- package/src/admin-shell/changes.json +6 -0
- package/src/agent-tools/changes.json +12 -0
- package/src/auth-email-password/changes.json +18 -0
- package/src/auth-mfa/changes.json +6 -0
- package/src/billing-foundation/changes.json +61 -0
- package/src/cap-counter/changes.json +6 -0
- package/src/cap-overview/changes.json +6 -0
- package/src/channel-in-app/changes.json +6 -0
- package/src/channel-whatsapp/changes.json +32 -0
- package/src/compliance-profiles/changes.json +5 -0
- package/src/config/changes.json +12 -0
- package/src/crypto-shredding/changes.json +18 -0
- package/src/data-retention/changes.json +12 -0
- package/src/delivery/changes.json +12 -0
- package/src/document-ingest-foundation/changes.json +6 -0
- package/src/documents/changes.json +24 -0
- package/src/file-provider-s3/changes.json +14 -0
- package/src/files/changes.json +7 -0
- package/src/helpdesk/changes.json +56 -0
- package/src/inbound-mail-foundation/changes.json +54 -0
- package/src/inbound-provider-imap/changes.json +13 -0
- package/src/mail-foundation/changes.json +6 -0
- package/src/managed-pages/changes.json +12 -0
- package/src/presence/changes.json +6 -0
- package/src/readiness/changes.json +25 -0
- package/src/secrets/changes.json +7 -0
- package/src/shared/changes.json +12 -0
- package/src/step-dispatcher/changes.json +18 -0
- package/src/subscription-mollie/changes.json +7 -0
- package/src/subscription-paddle/changes.json +19 -0
- package/src/subscription-stripe/changes.json +13 -0
- package/src/template-resolver/changes.json +48 -0
- package/src/tenant/changes.json +6 -0
- package/src/tenant-inactivity/changes.json +6 -0
- package/src/tenant-lifecycle/changes.json +24 -0
- package/src/tier-engine/changes.json +6 -0
- package/src/user/changes.json +6 -0
- package/src/waitlist/changes.json +6 -0
- package/src/workflow-runner/changes.json +6 -0
- package/dist/managed-pages/web/page-body-section.d.ts +0 -3
- package/dist/managed-pages/web/page-body-section.js +0 -40
- package/dist/subscription-paddle/tenant-binding.d.ts +0 -8
- package/dist/subscription-paddle/tenant-binding.js +0 -26
- package/dist/template-resolver/web/content-field.d.ts +0 -9
- package/dist/template-resolver/web/content-field.js +0 -14
|
@@ -4,7 +4,7 @@ import { append, loadAggregate, VersionConflictError, } from "@cosmicdrift/kumik
|
|
|
4
4
|
import { getTemporal } from "@cosmicdrift/kumiko-framework/time";
|
|
5
5
|
import { tenantHasBlockDeleteRows } from "../data-retention/index.js";
|
|
6
6
|
import { tenantEntity, tenantTable } from "../tenant/index.js";
|
|
7
|
-
import { DESTRUCTION_STAGE_MAX_PENDING_MS, DESTRUCTION_STAGE_MIN_SLICE_MS, DESTRUCTION_STAGE_TICK_BUDGET_MS, TENANT_AGGREGATE_TYPE, TENANT_DESTRUCTION_COMPLETED_EVENT_QN, TENANT_DESTRUCTION_FAILED_EVENT_QN, TENANT_DESTRUCTION_STAGE_ABANDONED_EVENT_SHORT, TENANT_DESTRUCTION_STAGE_FAILED_EVENT_SHORT, TENANT_DESTRUCTION_STAGE_PROGRESSED_EVENT_SHORT, TENANT_DESTRUCTION_STAGE_STARTED_EVENT_SHORT, TENANT_DESTRUCTION_STAGE_SUCCEEDED_EVENT_SHORT, TENANT_DESTRUCTION_STARTED_EVENT_SHORT, } from "./constants.js";
|
|
7
|
+
import { DESTRUCTION_STAGE_MAX_PENDING_MS, DESTRUCTION_STAGE_MAX_PENDING_TICK_GAP_MS, DESTRUCTION_STAGE_MIN_SLICE_MS, DESTRUCTION_STAGE_TICK_BUDGET_MS, TENANT_AGGREGATE_TYPE, TENANT_DESTRUCTION_COMPLETED_EVENT_QN, TENANT_DESTRUCTION_FAILED_EVENT_QN, TENANT_DESTRUCTION_STAGE_ABANDONED_EVENT_SHORT, TENANT_DESTRUCTION_STAGE_FAILED_EVENT_SHORT, TENANT_DESTRUCTION_STAGE_PROGRESSED_EVENT_SHORT, TENANT_DESTRUCTION_STAGE_STARTED_EVENT_SHORT, TENANT_DESTRUCTION_STAGE_SUCCEEDED_EVENT_SHORT, TENANT_DESTRUCTION_STARTED_EVENT_SHORT, } from "./constants.js";
|
|
8
8
|
import { invalidateTenantLifecycleGate, TEARDOWN_GATE_SETTLE_MS } from "./lifecycle-gate.js";
|
|
9
9
|
import { isDestructionPipelineComplete, pickNextStage, } from "./stages.js";
|
|
10
10
|
const tenantCrud = createEventStoreExecutor(tenantTable, tenantEntity, { entityName: "tenant" });
|
|
@@ -54,10 +54,37 @@ function currentAttemptStartedAt(events, stageName) {
|
|
|
54
54
|
const startedAt = started.payload["startedAt"];
|
|
55
55
|
return typeof startedAt === "string" ? getTemporal().Instant.from(startedAt) : started.createdAt;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function pendingTickInstants(events, stageName) {
|
|
58
|
+
const startIndex = events.findLastIndex((event) => event.type === qualified(TENANT_DESTRUCTION_STAGE_STARTED_EVENT_SHORT) &&
|
|
59
|
+
event.payload["stage"] === stageName);
|
|
58
60
|
const startedAt = currentAttemptStartedAt(events, stageName);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
if (startIndex < 0 || startedAt === undefined)
|
|
62
|
+
return [];
|
|
63
|
+
const instants = [startedAt];
|
|
64
|
+
for (const event of events.slice(startIndex + 1)) {
|
|
65
|
+
const tickAt = event.payload["tickAt"];
|
|
66
|
+
const isPendingTick = event.type === qualified(TENANT_DESTRUCTION_STAGE_PROGRESSED_EVENT_SHORT) &&
|
|
67
|
+
event.payload["stage"] === stageName &&
|
|
68
|
+
typeof tickAt === "string";
|
|
69
|
+
if (isPendingTick)
|
|
70
|
+
instants.push(getTemporal().Instant.from(tickAt));
|
|
71
|
+
}
|
|
72
|
+
return instants;
|
|
73
|
+
}
|
|
74
|
+
function isPendingWindowOpen(events, stageName, now) {
|
|
75
|
+
const instants = pendingTickInstants(events, stageName);
|
|
76
|
+
if (instants.length === 0)
|
|
77
|
+
return false;
|
|
78
|
+
let tickingMs = 0;
|
|
79
|
+
let previous = instants[0];
|
|
80
|
+
for (const instant of [...instants.slice(1), now]) {
|
|
81
|
+
if (previous !== undefined) {
|
|
82
|
+
const gapMs = instant.epochMilliseconds - previous.epochMilliseconds;
|
|
83
|
+
tickingMs += Math.min(gapMs, DESTRUCTION_STAGE_MAX_PENDING_TICK_GAP_MS);
|
|
84
|
+
}
|
|
85
|
+
previous = instant;
|
|
86
|
+
}
|
|
87
|
+
return tickingMs <= DESTRUCTION_STAGE_MAX_PENDING_MS;
|
|
61
88
|
}
|
|
62
89
|
function lastEventVersion(events) {
|
|
63
90
|
const last = events.at(-1);
|
|
@@ -171,7 +198,13 @@ async function recordFailedStageAttempt(args) {
|
|
|
171
198
|
// pending window would never close.
|
|
172
199
|
async function recordIdleStageTick(args) {
|
|
173
200
|
if (args.pending && isPendingWindowOpen(args.events, args.stage.name, args.now)) {
|
|
174
|
-
await appendTenantStageEvent(args.db, args.tenantId, qualified(TENANT_DESTRUCTION_STAGE_PROGRESSED_EVENT_SHORT), {
|
|
201
|
+
await appendTenantStageEvent(args.db, args.tenantId, qualified(TENANT_DESTRUCTION_STAGE_PROGRESSED_EVENT_SHORT), {
|
|
202
|
+
stage: args.stage.name,
|
|
203
|
+
attempts: args.attempt,
|
|
204
|
+
processed: 0,
|
|
205
|
+
pending: true,
|
|
206
|
+
tickAt: args.now.toString(),
|
|
207
|
+
}, lastEventVersion(args.events));
|
|
175
208
|
return { done: false, pending: true };
|
|
176
209
|
}
|
|
177
210
|
return await recordFailedStageAttempt({
|
|
@@ -20,6 +20,7 @@ const tenantMembershipCrud = createEventStoreExecutor(tenantMembershipsTable, te
|
|
|
20
20
|
function newOutcomeAccumulator() {
|
|
21
21
|
let allDone = true;
|
|
22
22
|
let pending = false;
|
|
23
|
+
let stuck = false;
|
|
23
24
|
let processed = 0;
|
|
24
25
|
return {
|
|
25
26
|
add: (result) => {
|
|
@@ -27,9 +28,12 @@ function newOutcomeAccumulator() {
|
|
|
27
28
|
allDone = false;
|
|
28
29
|
if (result?.done === false && result.pending === true)
|
|
29
30
|
pending = true;
|
|
31
|
+
if (result?.done === false && result.processed === 0 && result.pending !== true)
|
|
32
|
+
stuck = true;
|
|
30
33
|
processed += result?.processed ?? 0;
|
|
31
34
|
},
|
|
32
|
-
|
|
35
|
+
// A genuinely stuck hook must not hide behind another hook's legitimate pending.
|
|
36
|
+
outcome: () => ({ done: allDone, processed, pending: pending && !stuck }),
|
|
33
37
|
};
|
|
34
38
|
}
|
|
35
39
|
async function runExtensionDestroyHooks(registry, extensionName, ctx) {
|
|
@@ -94,6 +98,10 @@ async function runTenantDataHooks(ctx, phase) {
|
|
|
94
98
|
}
|
|
95
99
|
return total.outcome();
|
|
96
100
|
}
|
|
101
|
+
const IRREVERSIBLY_DESTROYED_STATUSES = new Set([
|
|
102
|
+
"destroying",
|
|
103
|
+
"destroyed",
|
|
104
|
+
]);
|
|
97
105
|
// A user key outlives the tenant while the user still belongs to another live tenant:
|
|
98
106
|
// erasing it would tombstone the key and break every later PII write for that user.
|
|
99
107
|
async function userIdsWithoutOtherLiveTenant(ctx, userIds) {
|
|
@@ -109,7 +117,11 @@ async function userIdsWithoutOtherLiveTenant(ctx, userIds) {
|
|
|
109
117
|
const otherTenants = await selectMany(ctx.db, tenantTable, {
|
|
110
118
|
id: { in: [...new Set(otherMemberships.map((membership) => membership.tenantId))] },
|
|
111
119
|
});
|
|
112
|
-
|
|
120
|
+
// A tenant already destroying is past the point of return: two overlapping destructions with a
|
|
121
|
+
// shared member must not each count the other as live, or the user key would never be erased.
|
|
122
|
+
const liveTenantIds = new Set(otherTenants
|
|
123
|
+
.filter((tenant) => !IRREVERSIBLY_DESTROYED_STATUSES.has(tenant.status))
|
|
124
|
+
.map((tenant) => tenant.id));
|
|
113
125
|
const retainedUserIds = new Set(otherMemberships
|
|
114
126
|
.filter((membership) => liveTenantIds.has(membership.tenantId))
|
|
115
127
|
.map((membership) => membership.userId));
|
|
@@ -19,7 +19,6 @@ const TIER_ASSIGNMENT_NAMESPACE = "8e91d2fc-8b7a-4d3e-9f4a-1c5d6e7f8a9b";
|
|
|
19
19
|
* Standard CRUD handlers instead generate UUIDs via `gen_random_uuid()`.
|
|
20
20
|
* This utility is exported for use by the `stripe-sync` feature.
|
|
21
21
|
*/
|
|
22
|
-
// @wrapper-known uuid-domain
|
|
23
22
|
export function tierAssignmentAggregateId(tenantId) {
|
|
24
23
|
return uuidv5(tenantId, TIER_ASSIGNMENT_NAMESPACE);
|
|
25
24
|
}
|
|
@@ -402,13 +402,20 @@ export function createTierEngineFeature(opts = {}) {
|
|
|
402
402
|
}
|
|
403
403
|
alwaysOnHolder.set = computedAlwaysOn;
|
|
404
404
|
// One feature instance can serve several stacks in a process; rebuild state from this DB only.
|
|
405
|
-
//
|
|
405
|
+
// The cache is shared per instance, so this is safe only for sequential stack lifecycles
|
|
406
|
+
// (no request of an earlier stack still running): clear-then-refill would lock its tenants out.
|
|
406
407
|
cache.clear();
|
|
407
408
|
latestTicket.clear();
|
|
408
409
|
isBuilt = true;
|
|
410
|
+
ticketCounter += 1;
|
|
411
|
+
const preloadTicket = ticketCounter;
|
|
409
412
|
const rows = await selectMany(systemDb, tierAssignmentTable);
|
|
410
413
|
for (const row of rows) {
|
|
411
|
-
|
|
414
|
+
const tenantId = row.tenantId;
|
|
415
|
+
// skip: a tier write committed while the snapshot was read; its cache entry is newer
|
|
416
|
+
if ((latestTicket.get(tenantId) ?? 0) > preloadTicket)
|
|
417
|
+
continue;
|
|
418
|
+
cache.set(tenantId, mergeAlwaysOn(computedAlwaysOn, featuresForTier(tierMap, row.tier)));
|
|
412
419
|
}
|
|
413
420
|
// Read first, then set — never clear-then-refill: a cache miss falls back
|
|
414
421
|
// to the default tier, which would lock paying tenants out meanwhile.
|
|
@@ -15,11 +15,12 @@ export function backfillUserStreamTenants(db, options = {}) {
|
|
|
15
15
|
}
|
|
16
16
|
export async function backfillUserStreamTenantsWithDerivedState(deps) {
|
|
17
17
|
const { db, registry, searchAdapter, derived = "if-moved", scanTenantIds, onFirstCandidate, } = deps;
|
|
18
|
-
const searchCleanup = createSearchBucketCleanup(searchAdapter, USER_AGGREGATE);
|
|
18
|
+
const searchCleanup = createSearchBucketCleanup(searchAdapter, USER_AGGREGATE, { db, registry });
|
|
19
19
|
const streams = await backfillAggregateStreamTenants(db, {
|
|
20
20
|
aggregateType: USER_AGGREGATE,
|
|
21
21
|
target: { kind: "system" },
|
|
22
22
|
beforeMove: searchCleanup.beforeMove,
|
|
23
|
+
onMoveFailed: searchCleanup.onMoveFailed,
|
|
23
24
|
...(scanTenantIds && { scanTenantIds }),
|
|
24
25
|
...(onFirstCandidate && { onFirstCandidate }),
|
|
25
26
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
-
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { defineQueryHandler, isUuid } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import { userEntity, userTable } from "../schema/user.js";
|
|
@@ -27,6 +27,9 @@ export const meQuery = defineQueryHandler({
|
|
|
27
27
|
throw new InternalError({ message: "user:me requires r.systemScope()" });
|
|
28
28
|
}
|
|
29
29
|
const db = ctx.systemDb.acknowledgeCrossTenant("user rows are tenant-agnostic identity records; self-lookup by id needs no tenant filter");
|
|
30
|
+
// Anonymous and system callers carry no uuid; querying the uuid column with one fails the tx.
|
|
31
|
+
if (!isUuid(query.user.id))
|
|
32
|
+
return null;
|
|
30
33
|
const row = await crud.detail({ id: query.user.id }, query.user, db);
|
|
31
34
|
// `timezone` on the row is only the stored override (often unset); clients
|
|
32
35
|
// need the effective zone (override, else tenant, else UTC) to compute "today".
|
package/dist/user/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { backfillUserStreamTenants, backfillUserStreamTenantsWithDerivedState, t
|
|
|
3
3
|
export { createUserFeature } from "./feature.ts";
|
|
4
4
|
export { isPrincipalBlocked, isPrincipalRowBlocked, principalStatusPlugin, } from "./principal-status.ts";
|
|
5
5
|
export { resolveUserDisplayNames } from "./resolve-display-names.ts";
|
|
6
|
+
export { resolveVerifiedUserEmail } from "./resolve-verified-user-email.ts";
|
|
6
7
|
export type { UserStatus } from "./schema/user.ts";
|
|
7
8
|
export { USER_ANONYMIZED_DISPLAY_NAME, USER_ANONYMIZED_EMAIL_DOMAIN, USER_ANONYMIZED_EMAIL_PREFIX, USER_DELETED_DISPLAY_NAME, USER_DELETED_EMAIL_PREFIX, USER_STATUS, userEntity, userTable, } from "./schema/user.ts";
|
|
8
9
|
export { USER_FEATURE, UserErrors, UserHandlers, UserQueries } from "./web/constants.ts";
|
package/dist/user/index.js
CHANGED
|
@@ -3,5 +3,6 @@ export { backfillUserStreamTenants, backfillUserStreamTenantsWithDerivedState, }
|
|
|
3
3
|
export { createUserFeature } from "./feature.js";
|
|
4
4
|
export { isPrincipalBlocked, isPrincipalRowBlocked, principalStatusPlugin, } from "./principal-status.js";
|
|
5
5
|
export { resolveUserDisplayNames } from "./resolve-display-names.js";
|
|
6
|
+
export { resolveVerifiedUserEmail } from "./resolve-verified-user-email.js";
|
|
6
7
|
export { USER_ANONYMIZED_DISPLAY_NAME, USER_ANONYMIZED_EMAIL_DOMAIN, USER_ANONYMIZED_EMAIL_PREFIX, USER_DELETED_DISPLAY_NAME, USER_DELETED_EMAIL_PREFIX, USER_STATUS, userEntity, userTable, } from "./schema/user.js";
|
|
7
8
|
export { USER_FEATURE, UserErrors, UserHandlers, UserQueries } from "./web/constants.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { decryptStoredPii, normalizeEmail } from "../shared/index.js";
|
|
2
|
+
import { userTable } from "./schema/user.js";
|
|
3
|
+
// Only a verified owner may see or erase rows matched by email. Forget keeps emailVerified but has
|
|
4
|
+
// already rewritten the email, hence the pre-tx copy.
|
|
5
|
+
export async function resolveVerifiedUserEmail(ctx, piiDecryptReason) {
|
|
6
|
+
const row = await ctx.db.fetchOne(userTable, {
|
|
7
|
+
id: ctx.userId,
|
|
8
|
+
});
|
|
9
|
+
if (row?.emailVerified !== true)
|
|
10
|
+
return null;
|
|
11
|
+
if (ctx.userEmailBeforeDelete)
|
|
12
|
+
return normalizeEmail(ctx.userEmailBeforeDelete);
|
|
13
|
+
return normalizeEmail(await decryptStoredPii(row.email, "email", piiDecryptReason));
|
|
14
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { exportJobsTable } from "../../schema/export-job.js";
|
|
3
|
-
// @wrapper-known semantic-alias
|
|
4
3
|
export async function selectExportJobsForStorageCleanup(db, doneStatus, failedStatus) {
|
|
5
4
|
return selectMany(db, exportJobsTable, {
|
|
6
5
|
status: { in: [doneStatus, failedStatus] },
|
|
@@ -512,6 +512,7 @@ export function createUserDataRightsFeature(opts = {}) {
|
|
|
512
512
|
r.job({
|
|
513
513
|
name: "run-forget-cleanup",
|
|
514
514
|
trigger: { maintenance: true },
|
|
515
|
+
irreversibleWithoutEntryHandler: "high-risk-or-cron-pipeline",
|
|
515
516
|
concurrency: "skip",
|
|
516
517
|
escapeHatch: { reason: RUN_FORGET_CLEANUP_REASON },
|
|
517
518
|
handler: async (_payload, ctx) => {
|
|
@@ -48,7 +48,7 @@ export function createConfirmDeletionByTokenHandler(opts = {}) {
|
|
|
48
48
|
name: "confirm-deletion-by-token",
|
|
49
49
|
schema: z.object({ token: z.string().min(1) }),
|
|
50
50
|
access: {
|
|
51
|
-
roles: ["anonymous"
|
|
51
|
+
roles: ["anonymous"],
|
|
52
52
|
anySignedIn: true,
|
|
53
53
|
},
|
|
54
54
|
escapeHatch: {
|
|
@@ -49,7 +49,7 @@ export const downloadByTokenQuery = defineQueryHandler({
|
|
|
49
49
|
}),
|
|
50
50
|
// public-intake: rejected attempts store the anonymous caller's IP in the audit row.
|
|
51
51
|
access: {
|
|
52
|
-
roles: ["anonymous"
|
|
52
|
+
roles: ["anonymous"],
|
|
53
53
|
personalData: "public-intake",
|
|
54
54
|
anySignedIn: true,
|
|
55
55
|
},
|
|
@@ -30,7 +30,7 @@ export function createRequestDeletionByEmailHandler(opts = {}) {
|
|
|
30
30
|
name: "request-deletion-by-email",
|
|
31
31
|
schema: z.object({ email: z.email() }),
|
|
32
32
|
access: {
|
|
33
|
-
roles: ["anonymous"
|
|
33
|
+
roles: ["anonymous"],
|
|
34
34
|
anySignedIn: true,
|
|
35
35
|
},
|
|
36
36
|
description: "Mails an account-deletion verification link to the given address, for a user who wants to be erased but can no longer log in; it answers identically whether or not the address belongs to an active account and never returns the link.",
|
|
@@ -144,7 +144,6 @@ export async function runExportJobs(args) {
|
|
|
144
144
|
tokenByJobId,
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
// @wrapper-known semantic-alias
|
|
148
147
|
async function fetchPendingJobs(db) {
|
|
149
148
|
return selectMany(db, exportJobsTable, { status: EXPORT_JOB_STATUS.Pending }, {
|
|
150
149
|
orderBy: { col: "requestedAt", direction: "asc" },
|
|
@@ -460,7 +459,6 @@ function reportCleanupLastRun(metrics, now) {
|
|
|
460
459
|
// `crud.update` requires a TenantDb for event-store stream lookup. Export jobs are tenant-agnostic
|
|
461
460
|
// (one job per userId), so system mode bypasses the automatic tenant filter while
|
|
462
461
|
// `requestedFromTenantId` preserves stream identity and keeps the stream counter consistent.
|
|
463
|
-
// @wrapper-known semantic-alias
|
|
464
462
|
function systemTenantDb(db, tenantId) {
|
|
465
463
|
return createTenantDb({
|
|
466
464
|
db,
|
|
@@ -43,13 +43,13 @@ import { updateUserLifecycle } from "./lib/update-user-lifecycle.js";
|
|
|
43
43
|
// owner column it doesn't own must register a lower order so it runs BEFORE any
|
|
44
44
|
// hook that nulls that column. See custom-fields wire-user-data-rights.ts.
|
|
45
45
|
const HOOK_ORDER_DEFAULT = EXT_USER_DATA_ORDER.DEFAULT;
|
|
46
|
+
// Secret-read audit discriminator, not a QN; the value must stay stable for the audit trail.
|
|
47
|
+
export const FORGET_CLEANUP_HANDLER_NAME = "user-data-rights:run-forget-cleanup";
|
|
46
48
|
// Hook-reported reasons are external input (provider error messages can embed
|
|
47
49
|
// user-controlled filenames/emails) — strip newlines before a single-line
|
|
48
50
|
// console.warn so a crafted reason can't forge extra log lines, and cap the
|
|
49
51
|
// length against a log-flood. The unsanitized reason still lands in the
|
|
50
52
|
// returned `incomplete` entry untouched.
|
|
51
|
-
// Secret-read audit discriminator, not a QN; the value must stay stable for the audit trail.
|
|
52
|
-
export const FORGET_CLEANUP_HANDLER_NAME = "user-data-rights:run-forget-cleanup";
|
|
53
53
|
export function sanitizeReasonForLog(reason) {
|
|
54
54
|
return reason.replace(/[\r\n]+/g, " ").slice(0, 500);
|
|
55
55
|
}
|
|
@@ -29,8 +29,9 @@ export const downloadAttemptEntity = createEntity({
|
|
|
29
29
|
jobId: createTextField({ personal: false, reason: "technical_reference" }),
|
|
30
30
|
// User ID for the authenticated job path; NULL for anonymous token-path requests.
|
|
31
31
|
attemptedByUserId: createTextField({ personal: false, reason: "pseudonymous_fk" }),
|
|
32
|
-
//
|
|
33
|
-
//
|
|
32
|
+
// Token-path rows stay on the tenant key even when the job owner is known: ip and user agent
|
|
33
|
+
// come from whoever holds the link, possibly someone other than the owner, and they expire by
|
|
34
|
+
// retention. find "exact" on ip because list-download-attempts filters by IP.
|
|
34
35
|
ip: createTextField({
|
|
35
36
|
maxLength: 64,
|
|
36
37
|
personal: { of: "attemptedByUserId", whenAbsent: "tenant" },
|
|
@@ -32,9 +32,9 @@ export function ConfirmAccountDeletionScreen({ title, }) {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
return (_jsx(Card
|
|
35
|
-
//
|
|
35
|
+
// biome-ignore lint/plugin: narrow centered confirmation card, not a screen container
|
|
36
36
|
, {
|
|
37
|
-
//
|
|
37
|
+
// biome-ignore lint/plugin: narrow centered confirmation card, not a screen container
|
|
38
38
|
className: "w-full max-w-sm mx-auto", options: { padded: false }, slots: {
|
|
39
39
|
header: (_jsx("div", { className: "flex flex-col space-y-1.5 p-6 pb-4", children: _jsx("h1", { className: "text-xl font-semibold tracking-tight", children: title ?? t("userDataRights.deletion.confirm.title") }) })),
|
|
40
40
|
}, children: _jsx("div", { className: "p-6 pt-0 flex flex-col gap-4", children: phase === "success" ? (_jsxs(Banner, { variant: "info", children: [_jsx("p", { className: "font-medium text-foreground", children: t("userDataRights.deletion.confirm.successTitle") }), _jsx("p", { className: "mt-1", children: t("userDataRights.deletion.confirm.successBody") })] })) : phase === "missing" ? (_jsx(Banner, { variant: "error", children: t("userDataRights.deletion.confirm.missingToken") })) : (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm text-muted-foreground", children: t("userDataRights.deletion.confirm.intro") }), phase === "invalid" && (_jsx(Banner, { variant: "error", children: t("userDataRights.deletion.confirm.invalidToken") })), phase === "error" && (_jsx(Banner, { variant: "error", children: t("userDataRights.deletion.confirm.error") })), _jsx(Button, { type: "button", variant: "danger", loading: phase === "submitting", disabled: phase === "submitting", onClick: () => void doConfirm(), children: phase === "submitting"
|
|
@@ -73,7 +73,7 @@ export function ExportSection() {
|
|
|
73
73
|
const failed = job?.status === EXPORT_JOB_STATUS.Failed;
|
|
74
74
|
// While the job is running: poll until Done/Failed, then auto-stop.
|
|
75
75
|
const refetch = statusQuery.refetch;
|
|
76
|
-
//
|
|
76
|
+
// biome-ignore lint/plugin: not yet converted to the framework hook set
|
|
77
77
|
useEffect(() => {
|
|
78
78
|
if (!inProgress || !refetch)
|
|
79
79
|
return;
|
|
@@ -41,9 +41,9 @@ export function RequestAccountDeletionScreen({ title, }) {
|
|
|
41
41
|
void doSubmit();
|
|
42
42
|
};
|
|
43
43
|
return (_jsx(Card
|
|
44
|
-
//
|
|
44
|
+
// biome-ignore lint/plugin: narrow centered confirmation card, not a screen container
|
|
45
45
|
, {
|
|
46
|
-
//
|
|
46
|
+
// biome-ignore lint/plugin: narrow centered confirmation card, not a screen container
|
|
47
47
|
className: "w-full max-w-sm mx-auto", options: { padded: false }, slots: {
|
|
48
48
|
header: (_jsx("div", { className: "flex flex-col space-y-1.5 p-6 pb-4", children: _jsx("h1", { className: "text-xl font-semibold tracking-tight", children: title ?? t("userDataRights.deletion.request.title") }) })),
|
|
49
49
|
}, children: done ? (_jsx("div", { className: "p-6 pt-0", children: _jsxs(Banner, { variant: "info", children: [_jsx("p", { className: "font-medium text-foreground", children: t("userDataRights.deletion.request.successTitle") }), _jsx("p", { className: "mt-1", children: t("userDataRights.deletion.request.successBody") })] }) })) : (_jsxs("div", { className: "p-6 pt-0 flex flex-col gap-4", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: t("userDataRights.deletion.request.intro") }), _jsx(Form, { chromeless: true, onSubmit: onSubmit, children: _jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(Field, { id: "delete-email", label: t("userDataRights.deletion.request.email"), required: true, children: _jsx(Input, { kind: "text", id: "delete-email", name: "delete-email", value: email, onChange: setEmail, disabled: submitting, required: true }) }), error !== null && _jsx(Banner, { variant: "error", children: error }), _jsx(Button, { type: "submit", loading: submitting, disabled: submitting, children: submitting
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { apiTokenTable } from "../../personal-access-tokens/index.js";
|
|
2
2
|
import { featureMounted } from "./feature-mounted.js";
|
|
3
|
+
import { hardDeleteOwnRowsDeleteHook } from "./hard-delete-own-rows-hook.js";
|
|
3
4
|
// userData-Hooks for personal-access-tokens rows. Same shape as user-session:
|
|
4
5
|
// unmanaged direct-write store (no event stream, rebuild-safe DELETE), and a
|
|
5
6
|
// token without its user is worthless — both strategies hard-delete. Deleting
|
|
@@ -27,9 +28,7 @@ export const apiTokenExportHook = async (ctx) => {
|
|
|
27
28
|
})),
|
|
28
29
|
};
|
|
29
30
|
};
|
|
30
|
-
export const apiTokenDeleteHook =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
await ctx.db.deleteMany(apiTokenTable, { userId: ctx.userId, tenantId: ctx.tenantId });
|
|
35
|
-
};
|
|
31
|
+
export const apiTokenDeleteHook = hardDeleteOwnRowsDeleteHook({
|
|
32
|
+
featureName: "personal-access-tokens",
|
|
33
|
+
table: apiTokenTable,
|
|
34
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UserDataDeleteHook, UserDataHookCtx } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
type OwnRowsTable = Parameters<UserDataHookCtx["db"]["deleteMany"]>[0];
|
|
3
|
+
export declare function hardDeleteOwnRowsDeleteHook(source: {
|
|
4
|
+
readonly featureName: string;
|
|
5
|
+
readonly table: OwnRowsTable;
|
|
6
|
+
}): UserDataDeleteHook;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { featureMounted } from "./feature-mounted.js";
|
|
2
|
+
// Unmanaged direct-write stores (no event stream): a direct DELETE is rebuild-safe.
|
|
3
|
+
export function hardDeleteOwnRowsDeleteHook(source) {
|
|
4
|
+
const { featureName, table } = source;
|
|
5
|
+
return async (ctx) => {
|
|
6
|
+
// skip: source feature not mounted — its table doesn't exist, nothing to erase.
|
|
7
|
+
if (!featureMounted(ctx, featureName))
|
|
8
|
+
return;
|
|
9
|
+
await ctx.db.deleteMany(table, { userId: ctx.userId, tenantId: ctx.tenantId });
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { inAppMessagesTable } from "../../channel-in-app/index.js";
|
|
2
2
|
import { featureMounted } from "./feature-mounted.js";
|
|
3
|
+
import { hardDeleteOwnRowsDeleteHook } from "./hard-delete-own-rows-hook.js";
|
|
3
4
|
// userData-Hooks for channel-in-app's in_app_messages. Plain SQL table (no
|
|
4
5
|
// r.entity, no event stream — see channel-in-app/tables.ts), written by
|
|
5
6
|
// direct INSERT in the channel adapter, so a direct DELETE is rebuild-safe.
|
|
@@ -28,9 +29,7 @@ export const inAppMessageExportHook = async (ctx) => {
|
|
|
28
29
|
})),
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
|
-
export const inAppMessageDeleteHook =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
await ctx.db.deleteMany(inAppMessagesTable, { userId: ctx.userId, tenantId: ctx.tenantId });
|
|
36
|
-
};
|
|
32
|
+
export const inAppMessageDeleteHook = hardDeleteOwnRowsDeleteHook({
|
|
33
|
+
featureName: "channel-in-app",
|
|
34
|
+
table: inAppMessagesTable,
|
|
35
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { systemTenantReadDb } from "@cosmicdrift/kumiko-framework/internal/row-level-security";
|
|
1
2
|
import { jobRunsTable } from "../../jobs/index.js";
|
|
2
3
|
import { featureMounted } from "./feature-mounted.js";
|
|
3
4
|
// userData-Hooks for the jobs run log.
|
|
@@ -8,7 +9,7 @@ import { featureMounted } from "./feature-mounted.js";
|
|
|
8
9
|
export const jobRunExportHook = async (ctx) => {
|
|
9
10
|
if (!featureMounted(ctx, "jobs"))
|
|
10
11
|
return null;
|
|
11
|
-
const rows = await ctx.db.selectMany(jobRunsTable, {
|
|
12
|
+
const rows = await systemTenantReadDb(ctx.db).selectMany(jobRunsTable, {
|
|
12
13
|
triggeredById: ctx.userId,
|
|
13
14
|
});
|
|
14
15
|
if (rows.length === 0)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { userSessionTable } from "../../sessions/index.js";
|
|
2
2
|
import { featureMounted } from "./feature-mounted.js";
|
|
3
|
+
import { hardDeleteOwnRowsDeleteHook } from "./hard-delete-own-rows-hook.js";
|
|
3
4
|
// userData-Hooks for the sessions feature's user-session rows (ip, userAgent).
|
|
4
5
|
//
|
|
5
6
|
// user-session is an unmanaged direct-write store (no event stream, excluded
|
|
@@ -32,9 +33,7 @@ export const userSessionExportHook = async (ctx) => {
|
|
|
32
33
|
})),
|
|
33
34
|
};
|
|
34
35
|
};
|
|
35
|
-
export const userSessionDeleteHook =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await ctx.db.deleteMany(userSessionTable, { userId: ctx.userId, tenantId: ctx.tenantId });
|
|
40
|
-
};
|
|
36
|
+
export const userSessionDeleteHook = hardDeleteOwnRowsDeleteHook({
|
|
37
|
+
featureName: "sessions",
|
|
38
|
+
table: userSessionTable,
|
|
39
|
+
});
|
|
@@ -8,7 +8,6 @@ import { UserProfileErrors } from "../web/constants.js";
|
|
|
8
8
|
// Same failure shape as auth-email-password (anti-enumeration):
|
|
9
9
|
// its errors.ts is not part of the feature barrel, but the reason code
|
|
10
10
|
// and i18nKey are stable public API.
|
|
11
|
-
// @wrapper-known error-helper
|
|
12
11
|
function invalidCredentials() {
|
|
13
12
|
return unprocessable(AuthErrors.invalidCredentials, "auth.errors.invalidCredentials");
|
|
14
13
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { createSystemUser, defineWriteHandler, parseTenantId, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { InternalError, NotFoundError, UnprocessableError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
|
+
import { normalizeEmail } from "../../shared/index.js";
|
|
4
5
|
import { cancelPendingInvitation, INVITATION_STATUS, tenantInvitationsTable, } from "../../tenant/index.js";
|
|
5
6
|
import { isOpenWaitlistStatus } from "../entity.js";
|
|
6
|
-
import { adminAccess, isTenantMember,
|
|
7
|
+
import { adminAccess, isTenantMember, platformActor, waitlistDb, waitlistExecutor, } from "../lib.js";
|
|
7
8
|
import { WaitlistIdSchema } from "../payloads.js";
|
|
8
9
|
import { WAITLIST_STATUS, WaitlistErrors } from "../web/constants.js";
|
|
9
10
|
// An invited entry already has a live invitation link; rejecting must kill it,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { acquireNamespacedAdvisoryLock, createSystemDbView, createTenantDb, runInSavepointIfSupported, } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
-
import {
|
|
2
|
+
import { defineWriteHandler, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
5
|
-
import { normalizeEmail,
|
|
5
|
+
import { normalizeEmail, sendBestEffort } from "../../shared/index.js";
|
|
6
|
+
import { platformActor, waitlistDb, waitlistExecutor } from "../lib.js";
|
|
6
7
|
import { resolveWaitlistMailLocale, waitlistAdminNoticeVariables, waitlistConfirmationVariables, } from "../mail.js";
|
|
7
8
|
import { DEFAULT_SUBMIT_EMAIL_RATE_LIMITS, DEFAULT_SUBMIT_RATE_LIMIT, } from "../options.js";
|
|
8
9
|
import { WaitlistSubmitSchema } from "../payloads.js";
|
|
@@ -11,7 +12,6 @@ import { WAITLIST_NOTIFICATION_TYPES, WAITLIST_STATUS } from "../web/constants.j
|
|
|
11
12
|
// framework's other fixed advisory-lock keys.
|
|
12
13
|
const SUBMIT_LOCK_NAMESPACE = 0x776c7374;
|
|
13
14
|
const SUBMIT_LOCK_REASON = "takes the per-email advisory lock so parallel submits cannot both pass the duplicate check and wraps the admin-recipient resolver in a savepoint so a failing statement cannot abort the submit transaction; TenantDb has neither API";
|
|
14
|
-
const SUBMIT_ROLES = access.roles(...access.anonymous, ...access.authenticated, "Member", "TenantAdmin");
|
|
15
15
|
const OPEN_STATUSES = [WAITLIST_STATUS.Pending, WAITLIST_STATUS.Invited];
|
|
16
16
|
// Identical body for new, duplicate and honeypot submits so the response does not
|
|
17
17
|
// state whether the email is already on the list. Timing still differs: only the
|
|
@@ -63,25 +63,12 @@ async function resolveAdminRecipient(opts, ctx, systemDb, tenantId) {
|
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
async function sendBestEffort(ctx, label, send) {
|
|
67
|
-
try {
|
|
68
|
-
if (!ctx.notify) {
|
|
69
|
-
throw new InternalError({ message: "ctx.notify unavailable — mount the delivery feature" });
|
|
70
|
-
}
|
|
71
|
-
await send(ctx.notify);
|
|
72
|
-
}
|
|
73
|
-
catch (err) {
|
|
74
|
-
ctx.obs.log?.warn(`[waitlist:submit] ${label} mail failed`, {
|
|
75
|
-
error: err instanceof Error ? err.message : String(err),
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
66
|
export function createSubmitHandler(opts) {
|
|
80
67
|
const emailRateLimits = opts.emailRateLimits ?? DEFAULT_SUBMIT_EMAIL_RATE_LIMITS;
|
|
81
68
|
return defineWriteHandler({
|
|
82
69
|
name: "submit",
|
|
83
70
|
schema: WaitlistSubmitSchema,
|
|
84
|
-
access: { roles:
|
|
71
|
+
access: { roles: ["anonymous"], personalData: "public-intake", anySignedIn: true },
|
|
85
72
|
rateLimit: opts.rateLimit ?? DEFAULT_SUBMIT_RATE_LIMIT,
|
|
86
73
|
// An empty array means "disabled"; boot validation rejects an empty additionalRateLimits.
|
|
87
74
|
...(emailRateLimits.length > 0 && { additionalRateLimits: emailRateLimits }),
|
|
@@ -111,7 +98,7 @@ export function createSubmitHandler(opts) {
|
|
|
111
98
|
}, platformActor(), waitlistDb(ctx));
|
|
112
99
|
if (!created.isSuccess)
|
|
113
100
|
return created;
|
|
114
|
-
await sendBestEffort(ctx, "confirmation", (notify) => notify(WAITLIST_NOTIFICATION_TYPES.confirmation, {
|
|
101
|
+
await sendBestEffort(ctx, "[waitlist:submit] confirmation mail failed", (notify) => notify(WAITLIST_NOTIFICATION_TYPES.confirmation, {
|
|
115
102
|
route: { email },
|
|
116
103
|
data: waitlistConfirmationVariables({
|
|
117
104
|
locale: payload.locale,
|
|
@@ -120,7 +107,7 @@ export function createSubmitHandler(opts) {
|
|
|
120
107
|
priority: "normal",
|
|
121
108
|
locale: resolveWaitlistMailLocale(payload.locale),
|
|
122
109
|
}));
|
|
123
|
-
await sendBestEffort(ctx, "admin notice", async (notify) => {
|
|
110
|
+
await sendBestEffort(ctx, "[waitlist:submit] admin notice mail failed", async (notify) => {
|
|
124
111
|
// skip: no admin recipient configured
|
|
125
112
|
if (!adminRecipient)
|
|
126
113
|
return;
|
package/dist/waitlist/import.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
|
-
import { normalizeEmail
|
|
3
|
+
import { normalizeEmail } from "../shared/index.js";
|
|
4
|
+
import { platformActor, waitlistExecutor } from "./lib.js";
|
|
4
5
|
import { WAITLIST_FIELD_LIMITS } from "./web/constants.js";
|
|
5
6
|
// RFC 4122 name-based UUID (v5 layout, fixed namespace) so a re-run finds the entry
|
|
6
7
|
// it created before without matching on encrypted personal data.
|
package/dist/waitlist/lib.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ export declare const waitlistExecutor: import("@cosmicdrift/kumiko-types/event-s
|
|
|
28
28
|
readonly status: string;
|
|
29
29
|
readonly submittedAt: Temporal.Instant;
|
|
30
30
|
}>;
|
|
31
|
-
export declare function normalizeEmail(email: string): string;
|
|
32
31
|
export declare function waitlistDb(ctx: Pick<AppContext, "systemDb">): TenantDb;
|
|
33
32
|
export declare function platformActor(): SessionUser;
|
|
34
33
|
export declare function isTenantMember(db: TenantDb, email: string, tenantId: TenantId): Promise<boolean>;
|
package/dist/waitlist/lib.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createEventStoreExecutor, fetchOne, } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { access, createSystemUser, SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
-
import {
|
|
3
|
+
import { acknowledgedSystemDb, normalizeEmail } from "../shared/index.js";
|
|
4
4
|
import { tenantMembershipsTable } from "../tenant/index.js";
|
|
5
5
|
import { userTable } from "../user/index.js";
|
|
6
6
|
import { waitlistEntryEntity, waitlistEntryTable } from "./entity.js";
|
|
@@ -9,16 +9,8 @@ export const adminAccess = { roles: access.systemAdmin };
|
|
|
9
9
|
export const waitlistExecutor = createEventStoreExecutor(waitlistEntryTable, waitlistEntryEntity, {
|
|
10
10
|
entityName: "waitlistEntry",
|
|
11
11
|
});
|
|
12
|
-
export function normalizeEmail(email) {
|
|
13
|
-
return email.toLowerCase();
|
|
14
|
-
}
|
|
15
12
|
export function waitlistDb(ctx) {
|
|
16
|
-
|
|
17
|
-
throw new InternalError({
|
|
18
|
-
message: "waitlist requires ctx.systemDb — is r.systemScope() set on the feature?",
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return ctx.systemDb.acknowledgeCrossTenant(WAITLIST_CROSS_TENANT_REASON);
|
|
13
|
+
return acknowledgedSystemDb(ctx, "waitlist", WAITLIST_CROSS_TENANT_REASON);
|
|
22
14
|
}
|
|
23
15
|
// Entries are systemStream rows, so every write targets the system tenant's stream.
|
|
24
16
|
export function platformActor() {
|
|
@@ -2,10 +2,10 @@ import { createTenantDb, entityEventName, fetchOne, selectMany, } from "@cosmicd
|
|
|
2
2
|
import { SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { parseRoles } from "@cosmicdrift/kumiko-framework/utils";
|
|
4
4
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
5
|
-
import { decryptStoredPii } from "../shared/index.js";
|
|
5
|
+
import { decryptStoredPii, normalizeEmail } from "../shared/index.js";
|
|
6
6
|
import { tenantMembershipsTable } from "../tenant/index.js";
|
|
7
7
|
import { userTable } from "../user/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { platformActor, waitlistExecutor } from "./lib.js";
|
|
9
9
|
import { DEFAULT_OWN_TENANT_INVITE_ROLE, WAITLIST_STATUS } from "./web/constants.js";
|
|
10
10
|
const PII_DECRYPT_REASON = "waitlist:link-on-signup";
|
|
11
11
|
export const WAITLIST_MEMBERSHIP_CREATED_EVENT = entityEventName("tenant-membership", "created");
|