@cosmicdrift/kumiko-bundled-features 0.413.0 → 0.414.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/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 +11 -12
- 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.js +8 -1
- package/dist/billing-foundation/checkout-ledger.d.ts +15 -0
- package/dist/billing-foundation/checkout-ledger.js +32 -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 +22 -0
- package/dist/billing-foundation/events.js +38 -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 +1 -1
- package/dist/billing-foundation/handlers/process-event.write.d.ts +2 -2
- package/dist/billing-foundation/handlers/process-event.write.js +94 -12
- package/dist/billing-foundation/handlers/process-payment-event.write.d.ts +1 -2
- package/dist/billing-foundation/handlers/process-payment-event.write.js +29 -9
- 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 +1 -1
- 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 +87 -0
- package/dist/channel-whatsapp/events.js +70 -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 +127 -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 +185 -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/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 +4 -7
- 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 +41 -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/report-ingest-progress.d.ts +1 -1
- package/dist/document-ingest-foundation/report-ingest-progress.js +29 -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 +24 -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/helpdesk/entity.js +4 -1
- package/dist/helpdesk/feature.js +36 -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 +4 -5
- package/dist/helpdesk/handlers/report.write.js +3 -7
- package/dist/helpdesk/handlers/submit.write.js +4 -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 +121 -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 +7 -1
- package/dist/helpdesk/lib.js +29 -29
- 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 +1 -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 +1 -0
- package/dist/inbound-mail-foundation/content-refetch.js +15 -1
- package/dist/inbound-mail-foundation/entities.js +57 -15
- package/dist/inbound-mail-foundation/events.js +15 -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 +12 -7
- package/dist/inbound-mail-foundation/handlers/forget-message.write.d.ts +7 -0
- package/dist/inbound-mail-foundation/handlers/forget-message.write.js +54 -0
- 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/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/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 +106 -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/index.d.ts +6 -2
- package/dist/shared/index.js +6 -2
- 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 +2 -0
- package/dist/shared/send-best-effort.js +14 -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 +38 -2
- package/dist/step-dispatcher/feature.js +20 -2
- package/dist/step-dispatcher/mail-runner.js +0 -1
- package/dist/step-dispatcher/sweep-abandoned.d.ts +10 -0
- package/dist/step-dispatcher/sweep-abandoned.js +43 -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 +110 -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 +26 -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 +21 -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 +67 -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 +41 -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 +5 -5
- package/dist/tenant-inactivity/constants.js +1 -2
- package/dist/tenant-inactivity/handlers/keep-account.write.js +1 -2
- package/dist/tenant-inactivity/state-store.d.ts +1 -0
- package/dist/tenant-inactivity/state-store.js +9 -1
- package/dist/tenant-lifecycle/constants.d.ts +1 -0
- package/dist/tenant-lifecycle/constants.js +3 -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/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/submit.write.js +5 -18
- package/dist/waitlist/lib.js +2 -7
- 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 +4 -3
- 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/billing-foundation/changes.json +37 -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 +8 -0
- package/src/config/changes.json +12 -0
- package/src/crypto-shredding/changes.json +18 -0
- package/src/data-retention/changes.json +18 -0
- package/src/delivery/changes.json +6 -0
- package/src/documents/changes.json +18 -0
- package/src/file-provider-s3/changes.json +14 -0
- package/src/files/changes.json +7 -0
- package/src/helpdesk/changes.json +62 -0
- package/src/inbound-mail-foundation/changes.json +48 -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 +6 -0
- package/src/step-dispatcher/changes.json +12 -0
- package/src/subscription-mollie/changes.json +7 -0
- package/src/subscription-paddle/changes.json +13 -0
- package/src/subscription-stripe/changes.json +7 -0
- package/src/template-resolver/changes.json +36 -0
- package/src/tenant/changes.json +6 -0
- package/src/tenant-lifecycle/changes.json +18 -0
- package/src/tier-engine/changes.json +6 -0
- package/src/user/changes.json +6 -0
- package/src/waitlist/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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
-
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
3
|
import * as z from "zod";
|
|
4
|
+
import { acknowledgedSystemDb } from "../../shared/index.js";
|
|
5
5
|
import { tenantEntity, tenantTable } from "../schema/tenant.js";
|
|
6
6
|
const crud = createEventStoreExecutor(tenantTable, tenantEntity, { entityName: "tenant" });
|
|
7
7
|
export const listQuery = defineQueryHandler({
|
|
@@ -15,12 +15,7 @@ export const listQuery = defineQueryHandler({
|
|
|
15
15
|
access: { roles: ["SystemAdmin"] },
|
|
16
16
|
description: "Pages through every tenant on the platform with an optional search term, for a SystemAdmin browsing the tenant roster.",
|
|
17
17
|
handler: async (query, ctx) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
message: "tenant:query:list requires ctx.systemDb — is r.systemScope() still set on the tenant feature?",
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
const db = ctx.systemDb.acknowledgeCrossTenant("SystemAdmin lists tenants platform-wide");
|
|
24
|
-
return crud.list(query.payload, query.user, db); // @wrapper-known semantic-alias
|
|
18
|
+
const db = acknowledgedSystemDb(ctx, "tenant:query:list", "SystemAdmin lists tenants platform-wide");
|
|
19
|
+
return crud.list(query.payload, query.user, db);
|
|
25
20
|
},
|
|
26
21
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
-
import { access, definePagedQueryHandler, MAX_LIST_LIMIT, } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { access, definePagedQueryHandler, isUuid, MAX_LIST_LIMIT, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import { decryptStoredPii, mapWithConcurrency } from "../../shared/index.js";
|
|
@@ -61,10 +61,15 @@ export const memberDirectoryQuery = definePagedQueryHandler({
|
|
|
61
61
|
let users;
|
|
62
62
|
if (isSystemAdmin(query.user)) {
|
|
63
63
|
const db = ctx.systemDb.acknowledgeCrossTenant("SystemAdmin reference labels span every tenant, as user:query:user:list did");
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
// Audit actors can be non-uuid ("anonymous"); binding them to the uuid column would fail the query.
|
|
65
|
+
const uuidIds = ids?.filter(isUuid);
|
|
66
|
+
users =
|
|
67
|
+
uuidIds?.length === 0
|
|
68
|
+
? []
|
|
69
|
+
: await selectMany(db, userTable, uuidIds === undefined ? undefined : { id: uuidIds }, {
|
|
70
|
+
limit: scanLimit,
|
|
71
|
+
orderBy: { col: "id", direction: "asc" },
|
|
72
|
+
});
|
|
68
73
|
}
|
|
69
74
|
else {
|
|
70
75
|
const db = ctx.systemDb.assertTenantMatch(query.user.tenantId);
|
|
@@ -26,7 +26,7 @@ function createToggleTenantHandler(enable) {
|
|
|
26
26
|
const db = ctx.systemDb.acknowledgeCrossTenant("SystemAdmin enables/disables tenants platform-wide");
|
|
27
27
|
return crud.update({ id: event.payload.id, changes: { isEnabled: enable } }, event.user, db, {
|
|
28
28
|
skipOptimisticLock: true,
|
|
29
|
-
});
|
|
29
|
+
});
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { createEventStoreExecutor, createTenantDb, fetchOne, } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { createSystemUser } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { ConflictError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
|
+
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
4
5
|
import { parseRoles } from "@cosmicdrift/kumiko-framework/utils";
|
|
5
6
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
6
7
|
import { findForbiddenMembershipRole, reservedMembershipRoleError } from "./membership-roles.js";
|
|
7
8
|
import { tenantMembershipEntity, tenantMembershipsTable } from "./membership-table.js";
|
|
8
9
|
import { seedTenantMembership } from "./seeding.js";
|
|
9
10
|
import { TenantErrors } from "./web/constants.js";
|
|
11
|
+
const log = createFallbackLogger("invited-membership");
|
|
10
12
|
const membershipExecutor = createEventStoreExecutor(tenantMembershipsTable, tenantMembershipEntity, { entityName: "tenant-membership" });
|
|
11
13
|
const MEMBERSHIP_CREATED_VERSION = 1;
|
|
12
14
|
// 0 = the user has no membership in the tenant yet.
|
|
@@ -28,11 +30,17 @@ export async function grantInvitedMembershipRole(db, options) {
|
|
|
28
30
|
tenantId: options.tenantId,
|
|
29
31
|
});
|
|
30
32
|
if (!existing) {
|
|
31
|
-
await seedTenantMembership(db, {
|
|
33
|
+
const membership = await seedTenantMembership(db, {
|
|
32
34
|
userId: options.userId,
|
|
33
35
|
tenantId: options.tenantId,
|
|
34
36
|
roles: [options.role],
|
|
35
37
|
});
|
|
38
|
+
if (membership.rowMissing) {
|
|
39
|
+
log.warn("invited membership: stream exists but its row is missing", {
|
|
40
|
+
tenantId: options.tenantId,
|
|
41
|
+
userId: options.userId,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
36
44
|
return grantedMembership(false, [options.role]);
|
|
37
45
|
}
|
|
38
46
|
// A membership decision made after the invitation was issued wins over it.
|
package/dist/tenant/seeding.d.ts
CHANGED
|
@@ -55,7 +55,10 @@ export declare function seedTenant(db: DbRunner, options: SeedTenantOptions, hoo
|
|
|
55
55
|
* ConflictError on duplicates (duplicate calls no-op).
|
|
56
56
|
*
|
|
57
57
|
* Returns the membership-row id (existing on no-op, freshly minted on create).
|
|
58
|
+
* `rowMissing` marks a live stream whose projection row is gone: nothing is written, the
|
|
59
|
+
* membership is invisible until the projection is rebuilt.
|
|
58
60
|
*/
|
|
59
61
|
export declare function seedTenantMembership(db: DbRunner, options: SeedTenantMembershipOptions, hooks?: SeedTenantHooks): Promise<{
|
|
60
62
|
id: string;
|
|
63
|
+
rowMissing?: true;
|
|
61
64
|
}>;
|
package/dist/tenant/seeding.js
CHANGED
|
@@ -199,6 +199,8 @@ export async function seedTenant(db, options, hooks) {
|
|
|
199
199
|
* ConflictError on duplicates (duplicate calls no-op).
|
|
200
200
|
*
|
|
201
201
|
* Returns the membership-row id (existing on no-op, freshly minted on create).
|
|
202
|
+
* `rowMissing` marks a live stream whose projection row is gone: nothing is written, the
|
|
203
|
+
* membership is invisible until the projection is rebuilt.
|
|
202
204
|
*/
|
|
203
205
|
export async function seedTenantMembership(db, options,
|
|
204
206
|
// Optional, append-only — same rationale as seedTenant's hooks param
|
|
@@ -227,7 +229,7 @@ hooks) {
|
|
|
227
229
|
return { id: extractMembershipId(existing) };
|
|
228
230
|
const liveStreamId = await findLiveMembershipStreamId(db, pair);
|
|
229
231
|
if (liveStreamId)
|
|
230
|
-
return { id: liveStreamId };
|
|
232
|
+
return { id: liveStreamId, rowMissing: true };
|
|
231
233
|
// Keep by.id as audit actor, but force stream tenant to the membership tenant
|
|
232
234
|
// so a cross-tenant `by` override cannot diverge row tenant vs event stream.
|
|
233
235
|
const result = await executor.create({
|
|
@@ -17,11 +17,15 @@ export async function backfillTenantStreamTenants(deps) {
|
|
|
17
17
|
...(scanTenantIds && { scanTenantIds }),
|
|
18
18
|
...(onFirstCandidate && { onFirstCandidate }),
|
|
19
19
|
};
|
|
20
|
-
const searchCleanup = createSearchBucketCleanup(searchAdapter, TENANT_AGGREGATE
|
|
20
|
+
const searchCleanup = createSearchBucketCleanup(searchAdapter, TENANT_AGGREGATE, {
|
|
21
|
+
db,
|
|
22
|
+
registry,
|
|
23
|
+
});
|
|
21
24
|
const tenants = await backfillAggregateStreamTenants(db, {
|
|
22
25
|
aggregateType: TENANT_AGGREGATE,
|
|
23
26
|
target: { kind: "system" },
|
|
24
27
|
beforeMove: searchCleanup.beforeMove,
|
|
28
|
+
onMoveFailed: searchCleanup.onMoveFailed,
|
|
25
29
|
...scan,
|
|
26
30
|
});
|
|
27
31
|
const memberships = await backfillAggregateStreamTenants(db, {
|
package/dist/tenant/testing.js
CHANGED
|
@@ -35,5 +35,5 @@ export function updateInvitationViaEventStore(db, email, changes, tenantId) {
|
|
|
35
35
|
table: tenantInvitationsTable,
|
|
36
36
|
entity: tenantInvitationEntity,
|
|
37
37
|
entityName: "tenant-invitation",
|
|
38
|
-
}, { email }, changes, { tenantId });
|
|
38
|
+
}, { email, tenantId }, changes, { tenantId });
|
|
39
39
|
}
|
|
@@ -11,7 +11,7 @@ import { activityBase, decideInactivityAction, foldActivity, resetWarnings, } fr
|
|
|
11
11
|
import { signKeepAccountToken } from "./keep-token.js";
|
|
12
12
|
import { InactivityWarningNotificationType, inactivityMailTemplateLocale, } from "./mail-notifications.js";
|
|
13
13
|
import { resolveInactivityRule } from "./options.js";
|
|
14
|
-
import { loadInactivityState, loadNewestSessionActivity, saveInactivityState, } from "./state-store.js";
|
|
14
|
+
import { isInactivityCycleCurrent, loadInactivityState, loadNewestSessionActivity, saveInactivityState, } from "./state-store.js";
|
|
15
15
|
// Links outlive the deadline a little so a late click still counts as a reaction.
|
|
16
16
|
const KEEP_LINK_GRACE_MINUTES = 14 * 24 * 60;
|
|
17
17
|
const MS_PER_MINUTE = 60_000;
|
|
@@ -151,6 +151,9 @@ async function evaluate(ctx, options, tenantId, rule, stored, now) {
|
|
|
151
151
|
}
|
|
152
152
|
if (!ctx.registry)
|
|
153
153
|
throw new Error("tenant-inactivity: ctx.registry required");
|
|
154
|
+
// The probes and mails above are slow; a keep link redeemed meanwhile must not end in a deletion request.
|
|
155
|
+
if (stored !== null && !(await isInactivityCycleCurrent(ctx.db, stored.cycleId)))
|
|
156
|
+
return state;
|
|
154
157
|
const result = await requestTenantDestruction({
|
|
155
158
|
tenantId,
|
|
156
159
|
actor: ctx.systemUser,
|
|
@@ -167,10 +170,7 @@ async function evaluate(ctx, options, tenantId, rule, stored, now) {
|
|
|
167
170
|
return startNewCycle({ ...state, lastActivityAt: now });
|
|
168
171
|
}
|
|
169
172
|
export async function checkTenantInactivity(ctx, options) {
|
|
170
|
-
const tenantId = ctx.systemUser.tenantId
|
|
171
|
-
// skip: a job without a tenant scope has nothing to evaluate
|
|
172
|
-
if (tenantId === undefined)
|
|
173
|
-
return;
|
|
173
|
+
const tenantId = ctx.systemUser.tenantId;
|
|
174
174
|
const now = ctx.tz.now();
|
|
175
175
|
const tenant = await fetchOne(ctx.db.unsafeRaw(), tenantTable, { id: tenantId });
|
|
176
176
|
// skip: only active tenants are evaluated; others are already in a lifecycle step
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export const TENANT_INACTIVITY_FEATURE = "tenant-inactivity";
|
|
2
2
|
export const TENANT_INACTIVITY_STATE_ENTITY = "tenant-inactivity-state";
|
|
3
|
-
//
|
|
4
|
-
// reaches exactly the people who can open the keep-account link and read the state.
|
|
3
|
+
// Stays import-free for the client-safe subpath; a test ties it to TENANT_ACCOUNT_CLOSE_ROLES.
|
|
5
4
|
export const TENANT_KEEP_ACCOUNT_ROLES = ["TenantOwner", "TenantAdmin", "Admin"];
|
|
6
5
|
export const TenantInactivityJobs = {
|
|
7
6
|
check: `${TENANT_INACTIVITY_FEATURE}:job:check-inactive-tenants`,
|
|
@@ -2,7 +2,6 @@ import { fetchOne, updateMany } from "@cosmicdrift/kumiko-framework/db";
|
|
|
2
2
|
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
-
import { TENANT_KEEP_ACCOUNT_ROLES } from "../constants.js";
|
|
6
5
|
import { redeemKeepAccountToken } from "../keep-token.js";
|
|
7
6
|
import { tenantInactivityStateTable } from "../state-table.js";
|
|
8
7
|
const KEEP_ACCOUNT_ESCAPE_HATCH_REASON = "the anonymous link holder has no tenant scope; the tenant comes from the signed token and every statement filters by that tenantId";
|
|
@@ -11,7 +10,7 @@ export function createKeepAccountHandler(opts) {
|
|
|
11
10
|
name: "keep-account",
|
|
12
11
|
schema: z.object({ token: z.string().min(1) }),
|
|
13
12
|
access: {
|
|
14
|
-
roles: ["anonymous"
|
|
13
|
+
roles: ["anonymous"],
|
|
15
14
|
anySignedIn: true,
|
|
16
15
|
},
|
|
17
16
|
escapeHatch: { grants: ["unsafeRaw"], reason: KEEP_ACCOUNT_ESCAPE_HATCH_REASON },
|
|
@@ -7,4 +7,5 @@ export type StoredInactivityState = InactivityState & {
|
|
|
7
7
|
export declare function loadInactivityState(db: TenantDb): Promise<StoredInactivityState | null>;
|
|
8
8
|
export declare function isSameInactivityState(a: StoredInactivityState | null, b: StoredInactivityState): boolean;
|
|
9
9
|
export declare function saveInactivityState(db: TenantDb, previous: StoredInactivityState | null, next: StoredInactivityState): Promise<void>;
|
|
10
|
+
export declare function isInactivityCycleCurrent(db: TenantDb, cycleId: string): Promise<boolean>;
|
|
10
11
|
export declare function loadNewestSessionActivity(db: TenantDb): Promise<Temporal.Instant | null>;
|
|
@@ -40,9 +40,17 @@ export async function saveInactivityState(db, previous, next) {
|
|
|
40
40
|
await db.insertOne(tenantInactivityStateTable, { tenantId: db.tenantId, ...next });
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
|
|
43
|
+
// A redeemed keep link rotates cycleId while the run is busy; then this run lost and the next re-evaluates.
|
|
44
|
+
await db.updateMany(tenantInactivityStateTable, next, {
|
|
45
|
+
tenantId: db.tenantId,
|
|
46
|
+
cycleId: previous.cycleId,
|
|
47
|
+
});
|
|
44
48
|
}
|
|
45
49
|
}
|
|
50
|
+
export async function isInactivityCycleCurrent(db, cycleId) {
|
|
51
|
+
const row = await db.fetchOne(tenantInactivityStateTable, { tenantId: db.tenantId });
|
|
52
|
+
return !row || row.cycleId === cycleId;
|
|
53
|
+
}
|
|
46
54
|
// The sessions table keeps the activity marker; reading it here avoids a write per request.
|
|
47
55
|
export async function loadNewestSessionActivity(db) {
|
|
48
56
|
const [newest] = await db.selectMany(userSessionTable, { tenantId: db.tenantId, lastSeenAt: { gte: EPOCH } }, { limit: 1, orderBy: { col: "lastSeenAt", direction: "desc" } });
|
|
@@ -30,3 +30,4 @@ export type TenantDestructionStageName = (typeof TENANT_DESTRUCTION_STAGES)[numb
|
|
|
30
30
|
export declare const DESTRUCTION_STAGE_TICK_BUDGET_MS = 30000;
|
|
31
31
|
export declare const DESTRUCTION_STAGE_MIN_SLICE_MS = 2000;
|
|
32
32
|
export declare const DESTRUCTION_STAGE_MAX_PENDING_MS: number;
|
|
33
|
+
export declare const DESTRUCTION_STAGE_MAX_PENDING_TICK_GAP_MS: number;
|
|
@@ -48,3 +48,6 @@ export const DESTRUCTION_STAGE_MIN_SLICE_MS = 2_000;
|
|
|
48
48
|
// Sized for a queued app teardown (pod drain up to 330 s, database drop up to 180 s,
|
|
49
49
|
// two teardowns in parallel) with headroom for several apps per tenant.
|
|
50
50
|
export const DESTRUCTION_STAGE_MAX_PENDING_MS = 60 * 60_000;
|
|
51
|
+
// The pending window only counts time the sweep was actually ticking: a gap between two pending
|
|
52
|
+
// ticks longer than this (the app slept, the sweep does not wake it) adds just this much.
|
|
53
|
+
export const DESTRUCTION_STAGE_MAX_PENDING_TICK_GAP_MS = 10 * 60_000;
|
|
@@ -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 } 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 ctx.userEmailBeforeDelete.toLowerCase();
|
|
13
|
+
return (await decryptStoredPii(row.email, "email", piiDecryptReason)).toLowerCase();
|
|
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] },
|
|
@@ -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
|