@cosmicdrift/kumiko-samples 0.413.1 → 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/package.json +1 -1
- package/packages/bundled-features/package.json +16 -1
- package/packages/bundled-features/src/admin-shell/changes.json +6 -0
- package/packages/bundled-features/src/admin-shell/feature.ts +8 -7
- package/packages/bundled-features/src/agent-tools/agent-doc-lint.ts +5 -1
- package/packages/bundled-features/src/agent-tools/agent-manifest.ts +36 -27
- package/packages/bundled-features/src/agent-tools/api-docs/collect-events.ts +8 -1
- package/packages/bundled-features/src/agent-tools/api-docs/collect.ts +3 -2
- package/packages/bundled-features/src/agent-tools/api-docs/generate.ts +6 -0
- package/packages/bundled-features/src/agent-tools/api-docs/index.ts +1 -0
- package/packages/bundled-features/src/agent-tools/api-docs/problems.ts +38 -1
- package/packages/bundled-features/src/agent-tools/api-docs/render-openapi.ts +1 -0
- package/packages/bundled-features/src/agent-tools/api-docs/resolve-config.ts +17 -0
- package/packages/bundled-features/src/agent-tools/api-docs/scope-slug-collisions.ts +17 -0
- package/packages/bundled-features/src/agent-tools/api-docs/translation-gaps.ts +42 -0
- package/packages/bundled-features/src/agent-tools/api-docs/webhook-example-problems.ts +30 -0
- package/packages/bundled-features/src/agent-tools/changes.json +12 -0
- package/packages/bundled-features/src/agent-tools/index.ts +1 -0
- package/packages/bundled-features/src/agent-tools/labels.ts +19 -6
- package/packages/bundled-features/src/agent-tools/tool-catalog.ts +18 -7
- package/packages/bundled-features/src/agent-tools/tool-dispatch.ts +14 -1
- package/packages/bundled-features/src/agent-tools/types.ts +4 -0
- package/packages/bundled-features/src/audit/event-classification.ts +6 -0
- package/packages/bundled-features/src/audit/web/i18n.ts +1 -0
- package/packages/bundled-features/src/auth-email-password/changes.json +18 -0
- package/packages/bundled-features/src/auth-email-password/errors.ts +0 -13
- package/packages/bundled-features/src/auth-email-password/handlers/invite-signup-complete.write.ts +147 -121
- package/packages/bundled-features/src/auth-email-password/handlers/login-options.query.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/request-account-unlock.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/request-email-verification.write.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/handlers/request-password-reset.write.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/handlers/self-registration-status.query.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/reset-token.ts +0 -2
- package/packages/bundled-features/src/auth-email-password/seeding.ts +39 -7
- package/packages/bundled-features/src/auth-email-password/unlock-token.ts +0 -2
- package/packages/bundled-features/src/auth-email-password/verification-token.ts +0 -2
- package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +2 -2
- package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +2 -2
- package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +5 -0
- package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +1 -6
- package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +1 -1
- package/packages/bundled-features/src/auth-email-password/web/return-path.ts +2 -1
- package/packages/bundled-features/src/auth-email-password/web/session.tsx +10 -12
- package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +1 -6
- package/packages/bundled-features/src/auth-email-password/web/static-account.ts +6 -1
- package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +1 -1
- package/packages/bundled-features/src/auth-email-password/web/token-confirm-screen.tsx +4 -5
- package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +1 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-code-or-recovery-field.tsx +17 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-disable-dialog.tsx +1 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-regenerate-recovery-dialog.tsx +1 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-setup-preauth-screen.tsx +1 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +16 -47
- package/packages/bundled-features/src/auth-mfa-user-data/index.ts +5 -6
- package/packages/bundled-features/src/billing-foundation/aggregate-id.ts +0 -4
- package/packages/bundled-features/src/billing-foundation/changes.json +37 -0
- package/packages/bundled-features/src/billing-foundation/checkout-core.ts +8 -1
- package/packages/bundled-features/src/billing-foundation/checkout-ledger.ts +59 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-gate.ts +2 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-text.ts +49 -2
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-open-cancels.ts +5 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-provider-timeout.ts +23 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +12 -7
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/events.ts +49 -10
- package/packages/bundled-features/src/billing-foundation/feature.ts +15 -1
- package/packages/bundled-features/src/billing-foundation/handlers/billing-plans.query.ts +47 -14
- package/packages/bundled-features/src/billing-foundation/handlers/create-checkout-session.write.ts +7 -1
- package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +124 -10
- package/packages/bundled-features/src/billing-foundation/handlers/process-payment-event.write.ts +33 -9
- package/packages/bundled-features/src/billing-foundation/handlers/record-checkout-opened.write.ts +25 -0
- package/packages/bundled-features/src/billing-foundation/handlers/start-plan-checkout.write.ts +7 -1
- package/packages/bundled-features/src/billing-foundation/handlers/switch-plan.write.ts +16 -4
- package/packages/bundled-features/src/billing-foundation/i18n.ts +3 -0
- package/packages/bundled-features/src/billing-foundation/pending-plan-switch.ts +80 -0
- package/packages/bundled-features/src/billing-foundation/scrub-raw-payload-headers.ts +50 -0
- package/packages/bundled-features/src/billing-foundation/types.ts +47 -30
- package/packages/bundled-features/src/billing-foundation/validate-options.ts +18 -0
- package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +10 -5
- package/packages/bundled-features/src/billing-foundation/web/cancel-contract-dialog.tsx +1 -1
- package/packages/bundled-features/src/billing-foundation/web/checkout-consent-dialog.tsx +1 -1
- package/packages/bundled-features/src/billing-foundation/web/constants.ts +5 -2
- package/packages/bundled-features/src/billing-foundation/web/plan-switch-confirm-dialog.tsx +1 -1
- package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +65 -17
- package/packages/bundled-features/src/cap-counter/aggregate-id.ts +0 -2
- package/packages/bundled-features/src/cap-counter/changes.json +6 -0
- package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +19 -4
- package/packages/bundled-features/src/cap-overview/changes.json +6 -0
- package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +22 -6
- package/packages/bundled-features/src/cap-overview/i18n.ts +1 -0
- package/packages/bundled-features/src/cap-overview/index.ts +1 -0
- package/packages/bundled-features/src/cap-overview/types.ts +11 -1
- package/packages/bundled-features/src/cap-overview/web/cap-cards-panel.tsx +6 -2
- package/packages/bundled-features/src/cap-overview/web/cap-usage-bar.tsx +10 -1
- package/packages/bundled-features/src/cap-overview/web/usage-math.ts +5 -0
- package/packages/bundled-features/src/channel-in-app/changes.json +6 -0
- package/packages/bundled-features/src/channel-in-app/handlers/read-state-by-keys.query.ts +2 -2
- package/packages/bundled-features/src/channel-whatsapp/aggregate-id.ts +29 -0
- package/packages/bundled-features/src/channel-whatsapp/changes.json +8 -0
- package/packages/bundled-features/src/channel-whatsapp/constants.ts +46 -0
- package/packages/bundled-features/src/channel-whatsapp/events.ts +93 -0
- package/packages/bundled-features/src/channel-whatsapp/feature.ts +72 -0
- package/packages/bundled-features/src/channel-whatsapp/graph-client.ts +398 -0
- package/packages/bundled-features/src/channel-whatsapp/in-memory-meta.ts +300 -0
- package/packages/bundled-features/src/channel-whatsapp/inbound-handlers.ts +189 -0
- package/packages/bundled-features/src/channel-whatsapp/index.ts +66 -0
- package/packages/bundled-features/src/channel-whatsapp/meta-signature.ts +26 -0
- package/packages/bundled-features/src/channel-whatsapp/options.ts +149 -0
- package/packages/bundled-features/src/channel-whatsapp/pii.ts +109 -0
- package/packages/bundled-features/src/channel-whatsapp/webhook-normalize.ts +226 -0
- package/packages/bundled-features/src/channel-whatsapp/webhook-routes.ts +185 -0
- package/packages/bundled-features/src/compliance-profiles/handlers/sub-processors.query.ts +1 -1
- package/packages/bundled-features/src/config/changes.json +12 -0
- package/packages/bundled-features/src/config/handlers/set.write.ts +7 -0
- package/packages/bundled-features/src/config/handlers/values.query.ts +8 -1
- package/packages/bundled-features/src/config/index.ts +1 -0
- package/packages/bundled-features/src/config/read-redaction.ts +6 -3
- package/packages/bundled-features/src/config/table.ts +1 -0
- package/packages/bundled-features/src/config/write-helpers.ts +3 -2
- package/packages/bundled-features/src/crypto-shredding/changes.json +18 -0
- package/packages/bundled-features/src/crypto-shredding/constants.ts +2 -0
- package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +38 -18
- package/packages/bundled-features/src/crypto-shredding/index.ts +4 -0
- package/packages/bundled-features/src/crypto-shredding/subject-forget-after-delete-hook.ts +49 -0
- package/packages/bundled-features/src/custom-fields/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/custom-fields/entity.ts +1 -0
- package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +0 -1
- package/packages/bundled-features/src/data-retention/changes.json +12 -0
- package/packages/bundled-features/src/data-retention/erase-notes-of-deleted-row.ts +23 -0
- package/packages/bundled-features/src/data-retention/feature.ts +1 -5
- package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +38 -18
- package/packages/bundled-features/src/data-retention/tenant-destruction-hold.ts +9 -0
- package/packages/bundled-features/src/delivery/attempt-log-factory.ts +11 -0
- package/packages/bundled-features/src/delivery/attempt-log.ts +3 -3
- package/packages/bundled-features/src/delivery/changes.json +6 -0
- package/packages/bundled-features/src/delivery/channel-context.ts +6 -3
- package/packages/bundled-features/src/delivery/db/queries/preferences.ts +0 -1
- package/packages/bundled-features/src/delivery/delivery-service.ts +3 -0
- package/packages/bundled-features/src/delivery/feature.ts +4 -13
- package/packages/bundled-features/src/delivery/handlers/opted-in-user-ids.query.ts +45 -0
- package/packages/bundled-features/src/delivery/handlers/preferences.query.ts +2 -20
- package/packages/bundled-features/src/delivery/handlers/resubscribe-user.write.ts +2 -25
- package/packages/bundled-features/src/delivery/handlers/unsubscribe-page-chrome.query.ts +2 -0
- package/packages/bundled-features/src/delivery/handlers/unsubscribe-user.write.ts +2 -27
- package/packages/bundled-features/src/delivery/index.ts +3 -1
- package/packages/bundled-features/src/delivery/options.ts +11 -0
- package/packages/bundled-features/src/delivery/preference-rows.ts +33 -0
- package/packages/bundled-features/src/delivery/set-preference-enabled.ts +40 -0
- package/packages/bundled-features/src/delivery/testing.ts +3 -1
- package/packages/bundled-features/src/delivery/types.ts +1 -0
- package/packages/bundled-features/src/delivery/unsubscribe-page.ts +7 -1
- package/packages/bundled-features/src/delivery/upsert-preference.ts +0 -1
- package/packages/bundled-features/src/delivery/web/public-names.ts +1 -0
- package/packages/bundled-features/src/derivatives-sharp/render.ts +9 -9
- package/packages/bundled-features/src/document-ingest-foundation/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/document-ingest-foundation/append-missing-extract-event.ts +37 -25
- package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +32 -14
- package/packages/bundled-features/src/documents/aggregate-id.ts +0 -2
- package/packages/bundled-features/src/documents/changes.json +18 -0
- package/packages/bundled-features/src/documents/constants.ts +10 -2
- package/packages/bundled-features/src/documents/ensure-link.ts +3 -4
- package/packages/bundled-features/src/documents/feature.ts +28 -6
- package/packages/bundled-features/src/documents/handlers/import.write.ts +2 -2
- package/packages/bundled-features/src/documents/queries/expiry-overview.query.ts +2 -1
- package/packages/bundled-features/src/documents/queries/for-record.query.ts +3 -4
- package/packages/bundled-features/src/documents/queries/list-page.ts +11 -3
- package/packages/bundled-features/src/documents/queries/overview.query.ts +2 -2
- package/packages/bundled-features/src/documents/screens.ts +8 -3
- package/packages/bundled-features/src/documents/tab.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/toggle-sync-signal.ts +6 -3
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant-by-file-ref.query.ts +1 -1
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +1 -1
- package/packages/bundled-features/src/file-foundation/probe.ts +9 -3
- package/packages/bundled-features/src/file-foundation/read-file-ref-content.ts +24 -11
- package/packages/bundled-features/src/file-provider-inmemory/feature.ts +1 -1
- package/packages/bundled-features/src/file-provider-s3/changes.json +14 -0
- package/packages/bundled-features/src/file-provider-s3/env-feature.ts +1 -1
- package/packages/bundled-features/src/file-provider-s3/env-named-feature.ts +1 -1
- package/packages/bundled-features/src/file-provider-s3/env-schema.ts +24 -7
- package/packages/bundled-features/src/file-provider-s3/feature.ts +1 -1
- package/packages/bundled-features/src/file-provider-s3/index.ts +7 -1
- package/packages/bundled-features/src/file-provider-s3/lib/env-helper.ts +21 -13
- package/packages/bundled-features/src/file-provider-s3/lib/s3-provider.ts +8 -1
- package/packages/bundled-features/src/files/changes.json +7 -0
- package/packages/bundled-features/src/folders/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/folders/web/folder-manager.tsx +6 -6
- package/packages/bundled-features/src/folders-user-data/index.ts +12 -14
- package/packages/bundled-features/src/helpdesk/changes.json +50 -0
- package/packages/bundled-features/src/helpdesk/entity.ts +4 -1
- package/packages/bundled-features/src/helpdesk/feature.ts +41 -0
- package/packages/bundled-features/src/helpdesk/handlers/access.ts +0 -10
- package/packages/bundled-features/src/helpdesk/handlers/attempts.ts +7 -14
- package/packages/bundled-features/src/helpdesk/handlers/challenge.query.ts +1 -2
- package/packages/bundled-features/src/helpdesk/handlers/reply.write.ts +2 -9
- package/packages/bundled-features/src/helpdesk/handlers/report.write.ts +2 -9
- package/packages/bundled-features/src/helpdesk/handlers/submit.write.ts +3 -11
- package/packages/bundled-features/src/helpdesk/index.ts +1 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-config.ts +61 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-erasure.ts +45 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-retention.ts +65 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-streams.ts +185 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-user-data.ts +84 -0
- package/packages/bundled-features/src/helpdesk/lib.ts +47 -34
- package/packages/bundled-features/src/helpdesk/user-data-hooks.ts +89 -48
- package/packages/bundled-features/src/helpdesk/web/constants.ts +0 -1
- package/packages/bundled-features/src/inbound-mail-foundation/account-health.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/account-poll.ts +5 -1
- package/packages/bundled-features/src/inbound-mail-foundation/aggregate-id.ts +0 -2
- package/packages/bundled-features/src/inbound-mail-foundation/changes.json +48 -0
- package/packages/bundled-features/src/inbound-mail-foundation/constants.ts +6 -0
- package/packages/bundled-features/src/inbound-mail-foundation/content-refetch.ts +15 -1
- package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +64 -15
- package/packages/bundled-features/src/inbound-mail-foundation/events.ts +15 -16
- package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +3 -1
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/account-address.ts +16 -2
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/attach-message-content.write.ts +10 -3
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/connect-account.write.ts +21 -8
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/forget-message.write.ts +73 -0
- package/packages/bundled-features/src/inbound-mail-foundation/i18n.ts +3 -0
- package/packages/bundled-features/src/inbound-mail-foundation/index.ts +1 -0
- package/packages/bundled-features/src/inbound-mail-foundation/oauth-access-token.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/outbound-mail.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/personal-address.ts +20 -0
- package/packages/bundled-features/src/inbound-mail-foundation/purge-messages.ts +54 -0
- package/packages/bundled-features/src/inbound-mail-foundation/quarantine.ts +15 -5
- package/packages/bundled-features/src/inbound-mail-foundation/retention-job.ts +1 -5
- package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +21 -34
- package/packages/bundled-features/src/inbound-mail-foundation/send-from-account.ts +9 -1
- package/packages/bundled-features/src/inbound-mail-foundation/supervisor-ingest.ts +7 -1
- package/packages/bundled-features/src/inbound-mail-foundation/sync-account-now.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/tenant-destroy-hook.ts +14 -17
- package/packages/bundled-features/src/inbound-mail-foundation/watch-supervisor.ts +1 -1
- package/packages/bundled-features/src/inbound-provider-imap/byte-budget.ts +80 -0
- package/packages/bundled-features/src/inbound-provider-imap/changes.json +13 -0
- package/packages/bundled-features/src/inbound-provider-imap/connect-mailbox.ts +8 -4
- package/packages/bundled-features/src/inbound-provider-imap/connect-my-mailbox.ts +23 -6
- package/packages/bundled-features/src/inbound-provider-imap/connect-target-rate-limit.ts +46 -0
- package/packages/bundled-features/src/inbound-provider-imap/download-batch.ts +47 -10
- package/packages/bundled-features/src/inbound-provider-imap/feature.ts +7 -4
- package/packages/bundled-features/src/inbound-provider-imap/fetch-content.ts +43 -29
- package/packages/bundled-features/src/inbound-provider-imap/i18n.ts +2 -2
- package/packages/bundled-features/src/inbound-provider-imap/parse-message.ts +14 -0
- package/packages/bundled-features/src/inbound-provider-imap/reconnect-mailbox.ts +5 -4
- package/packages/bundled-features/src/inbound-provider-imap/send-mail.ts +39 -7
- package/packages/bundled-features/src/inbound-provider-imap/smtp-client.ts +19 -4
- package/packages/bundled-features/src/inbound-provider-imap/watch-mailbox.ts +8 -23
- package/packages/bundled-features/src/inbound-provider-inmemory/feature.ts +1 -1
- package/packages/bundled-features/src/jobs/events.ts +10 -0
- package/packages/bundled-features/src/jobs/feature.ts +2 -0
- package/packages/bundled-features/src/jobs/handlers/consumer.write.ts +41 -16
- package/packages/bundled-features/src/jobs/web/constants.ts +4 -0
- package/packages/bundled-features/src/mail-foundation/changes.json +6 -0
- package/packages/bundled-features/src/mail-transport-inmemory/feature.ts +1 -1
- package/packages/bundled-features/src/mail-transport-smtp/feature.ts +3 -2
- package/packages/bundled-features/src/managed-pages/changes.json +12 -0
- package/packages/bundled-features/src/managed-pages/handlers/branding.query.ts +1 -1
- package/packages/bundled-features/src/managed-pages/handlers/by-slug.query.ts +1 -1
- package/packages/bundled-features/src/managed-pages/handlers/by-tenant-published.query.ts +1 -1
- package/packages/bundled-features/src/managed-pages/render-page-body.ts +18 -10
- package/packages/bundled-features/src/managed-pages/screens/page-screens.ts +18 -38
- package/packages/bundled-features/src/managed-pages/table.ts +1 -0
- package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +8 -6
- package/packages/bundled-features/src/managed-pages/web/constants.ts +8 -1
- package/packages/bundled-features/src/managed-pages/web/i18n.ts +11 -3
- package/packages/bundled-features/src/managed-pages/web/markdown-to-document.ts +1 -1
- package/packages/bundled-features/src/managed-pages/web/page-edit-draft.ts +108 -0
- package/packages/bundled-features/src/managed-pages/web/page-edit-screen.tsx +198 -0
- package/packages/bundled-features/src/managed-pages/web/page-settings-rail.tsx +117 -0
- package/packages/bundled-features/src/notes-history-user-data/index.ts +8 -14
- package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +5 -0
- package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +0 -1
- package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +31 -5
- package/packages/bundled-features/src/presence/changes.json +6 -0
- package/packages/bundled-features/src/presence/handlers/list.query.ts +28 -11
- package/packages/bundled-features/src/presence/room.ts +21 -7
- package/packages/bundled-features/src/presence/store.ts +79 -21
- package/packages/bundled-features/src/readiness/changes.json +25 -0
- package/packages/bundled-features/src/readiness/handlers/latest-summary.query.ts +11 -6
- package/packages/bundled-features/src/readiness/handlers/run-probes.write.ts +35 -5
- package/packages/bundled-features/src/readiness/handlers/run-tone.ts +3 -2
- package/packages/bundled-features/src/readiness/handlers/status.query.ts +15 -1
- package/packages/bundled-features/src/readiness/probe-context.ts +11 -10
- package/packages/bundled-features/src/readiness/screens.ts +4 -4
- package/packages/bundled-features/src/readiness/visible-results.ts +5 -3
- package/packages/bundled-features/src/renderer-foundation/api.ts +6 -13
- package/packages/bundled-features/src/renderer-foundation/types.ts +2 -2
- package/packages/bundled-features/src/secrets/changes.json +7 -0
- package/packages/bundled-features/src/secrets/db/queries/read.ts +18 -4
- package/packages/bundled-features/src/secrets/handlers/list.query.ts +8 -2
- package/packages/bundled-features/src/secrets/secret-scope.ts +2 -3
- package/packages/bundled-features/src/secrets/secrets-context.ts +6 -4
- package/packages/bundled-features/src/secrets/write-gate.ts +4 -2
- package/packages/bundled-features/src/seo/handlers/seo-config.query.ts +1 -1
- package/packages/bundled-features/src/shared/acknowledged-system-db.ts +20 -0
- package/packages/bundled-features/src/shared/assert-billing-live.ts +9 -2
- package/packages/bundled-features/src/shared/changes.json +6 -0
- package/packages/bundled-features/src/shared/index.ts +6 -1
- package/packages/bundled-features/src/shared/parent-visibility.ts +25 -1
- package/packages/bundled-features/src/shared/password-hashing.ts +0 -1
- package/packages/bundled-features/src/shared/price-env-shape.ts +1 -4
- package/packages/bundled-features/src/shared/register-user-data-hooks.ts +29 -0
- package/packages/bundled-features/src/shared/require-bootstrap-extension.ts +26 -0
- package/packages/bundled-features/src/shared/send-best-effort.ts +19 -0
- package/packages/bundled-features/src/shared/stream-tenant-backfill.ts +22 -1
- package/packages/bundled-features/src/shared/stream-tenant-derived-state.ts +31 -1
- package/packages/bundled-features/src/step-dispatcher/changes.json +12 -0
- package/packages/bundled-features/src/step-dispatcher/constants.ts +13 -0
- package/packages/bundled-features/src/step-dispatcher/deliver-dispatch-request.ts +47 -2
- package/packages/bundled-features/src/step-dispatcher/feature.ts +28 -1
- package/packages/bundled-features/src/step-dispatcher/mail-runner.ts +0 -1
- package/packages/bundled-features/src/step-dispatcher/sweep-abandoned.ts +57 -0
- package/packages/bundled-features/src/subscription-mollie/changes.json +7 -0
- package/packages/bundled-features/src/subscription-mollie/plugin-methods.ts +5 -3
- package/packages/bundled-features/src/subscription-mollie/verify-webhook.ts +5 -5
- package/packages/bundled-features/src/subscription-paddle/backfill-checkout-ledger.ts +159 -0
- package/packages/bundled-features/src/subscription-paddle/changes.json +13 -0
- package/packages/bundled-features/src/subscription-paddle/checkout-config.query.ts +1 -1
- package/packages/bundled-features/src/subscription-paddle/checkout-methods.ts +2 -8
- package/packages/bundled-features/src/subscription-paddle/constants.ts +1 -2
- package/packages/bundled-features/src/subscription-paddle/feature.ts +26 -24
- package/packages/bundled-features/src/subscription-paddle/ledger-backfill-marker.ts +70 -0
- package/packages/bundled-features/src/subscription-paddle/plan-switch-methods.ts +2 -8
- package/packages/bundled-features/src/subscription-paddle/redeliver-legacy-checkout.ts +36 -0
- package/packages/bundled-features/src/subscription-paddle/runtime.ts +13 -24
- package/packages/bundled-features/src/subscription-paddle/subscription-state.ts +1 -0
- package/packages/bundled-features/src/subscription-paddle/webhook-events.ts +68 -21
- package/packages/bundled-features/src/subscription-stripe/changes.json +7 -0
- package/packages/bundled-features/src/subscription-stripe/feature.ts +5 -0
- package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +6 -6
- package/packages/bundled-features/src/subscription-stripe/runtime.ts +8 -7
- package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +24 -6
- package/packages/bundled-features/src/tags/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/tags/web/tag-chip.tsx +4 -5
- package/packages/bundled-features/src/tags/web/tag-manager.tsx +2 -1
- package/packages/bundled-features/src/template-resolver/api.ts +6 -13
- package/packages/bundled-features/src/template-resolver/changes.json +36 -0
- package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +25 -0
- package/packages/bundled-features/src/template-resolver/feature.ts +2 -0
- package/packages/bundled-features/src/template-resolver/handlers/body-preview.query.ts +41 -0
- package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/collection-shared.ts +5 -11
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +3 -2
- package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +37 -8
- package/packages/bundled-features/src/template-resolver/linked-resources.ts +2 -5
- package/packages/bundled-features/src/template-resolver/seeding.ts +77 -0
- package/packages/bundled-features/src/template-resolver/table.ts +1 -0
- package/packages/bundled-features/src/template-resolver/template-draft.ts +2 -1
- package/packages/bundled-features/src/template-resolver/template-preview.ts +14 -3
- package/packages/bundled-features/src/template-resolver/testing.ts +0 -2
- package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +3 -0
- package/packages/bundled-features/src/template-resolver/web/collection-entry-create-form.tsx +33 -33
- package/packages/bundled-features/src/template-resolver/web/constants.ts +7 -0
- package/packages/bundled-features/src/template-resolver/web/content-tree-provider.ts +0 -1
- package/packages/bundled-features/src/template-resolver/web/content-workbench.tsx +142 -0
- package/packages/bundled-features/src/template-resolver/web/document-insert-model.ts +3 -8
- package/packages/bundled-features/src/template-resolver/web/document-link-policy.ts +58 -0
- package/packages/bundled-features/src/template-resolver/web/document-schema.ts +11 -57
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +2 -4
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +4 -5
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +2 -2
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +6 -3
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +2 -3
- package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -0
- package/packages/bundled-features/src/template-resolver/web/fill-document-variables.ts +24 -0
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +14 -0
- package/packages/bundled-features/src/template-resolver/web/index.ts +3 -0
- package/packages/bundled-features/src/template-resolver/web/preview-targets.ts +25 -0
- package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +1 -0
- package/packages/bundled-features/src/template-resolver/web/snippet-preview-renderer.tsx +24 -0
- package/packages/bundled-features/src/template-resolver/web/string-values.ts +7 -0
- package/packages/bundled-features/src/template-resolver/web/text-block-editor.tsx +38 -50
- package/packages/bundled-features/src/template-resolver/web/use-collection-entry-create.ts +7 -0
- package/packages/bundled-features/src/template-resolver/web/use-content-write.ts +1 -3
- package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +1 -2
- package/packages/bundled-features/src/template-resolver/web/use-text-block-editor.ts +28 -7
- package/packages/bundled-features/src/template-resolver/web/web-preview-renderer.tsx +126 -0
- package/packages/bundled-features/src/template-resolver-user-data/index.ts +11 -10
- package/packages/bundled-features/src/tenant/changes.json +6 -0
- package/packages/bundled-features/src/tenant/handlers/create.write.ts +7 -8
- package/packages/bundled-features/src/tenant/handlers/list.query.ts +7 -9
- package/packages/bundled-features/src/tenant/handlers/member-directory.query.ts +10 -4
- package/packages/bundled-features/src/tenant/handlers/toggle-enabled.write.ts +1 -1
- package/packages/bundled-features/src/tenant/invited-membership.ts +10 -1
- package/packages/bundled-features/src/tenant/seeding.ts +4 -2
- package/packages/bundled-features/src/tenant/stream-tenant-backfill.ts +5 -1
- package/packages/bundled-features/src/tenant/testing.ts +1 -1
- package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +4 -3
- package/packages/bundled-features/src/tenant-inactivity/constants.ts +1 -2
- package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +1 -2
- package/packages/bundled-features/src/tenant-inactivity/state-store.ts +10 -1
- package/packages/bundled-features/src/tenant-lifecycle/changes.json +18 -0
- package/packages/bundled-features/src/tenant-lifecycle/constants.ts +4 -0
- package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +43 -6
- package/packages/bundled-features/src/tenant-lifecycle/stages.ts +15 -2
- package/packages/bundled-features/src/tier-engine/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/tier-engine/changes.json +6 -0
- package/packages/bundled-features/src/tier-engine/feature.ts +8 -2
- package/packages/bundled-features/src/user/changes.json +6 -0
- package/packages/bundled-features/src/user/db/queries/stream-tenant-backfill.ts +2 -1
- package/packages/bundled-features/src/user/handlers/me.query.ts +3 -1
- package/packages/bundled-features/src/user/index.ts +1 -0
- package/packages/bundled-features/src/user/resolve-verified-user-email.ts +17 -0
- package/packages/bundled-features/src/user-data-rights/db/queries/export-jobs.ts +0 -1
- package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/run-export-jobs.ts +0 -2
- package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +3 -3
- package/packages/bundled-features/src/user-data-rights/schema/download-attempt.ts +3 -2
- package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +1 -1
- package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
- package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +1 -1
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/api-token.userdata-hook.ts +5 -5
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/hard-delete-own-rows-hook.ts +17 -0
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/in-app-message.userdata-hook.ts +5 -5
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/job-run.userdata-hook.ts +2 -1
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/user-session.userdata-hook.ts +5 -5
- package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +0 -1
- package/packages/bundled-features/src/waitlist/changes.json +6 -0
- package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +4 -28
- package/packages/bundled-features/src/waitlist/lib.ts +2 -7
- package/packages/bundled-features/src/waitlist/user-data-hooks.ts +6 -19
- package/packages/bundled-features/src/workflow-runner/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/workflow-runner/event-trigger.ts +6 -2
- package/packages/bundled-features/src/workflow-runner/feature.ts +1 -5
- package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +5 -4
- package/packages/bundled-features/src/workflow-runner/runner.ts +2 -0
- package/samples/apps/showcase/src/features/demos/web/pages/dialog.tsx +0 -1
- package/samples/apps/showcase/src/features/demos/web/pages/layout.tsx +1 -1
- package/samples/apps/showcase/src/features/demos/web/pages/sidebar-panel.tsx +0 -1
- package/samples/apps/styleguide/src/features/gallery/web/Gallery.tsx +1 -4
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/feature.ts +6 -2
- package/samples/apps/use-all-bundled/e2e-billing-gallery/gallery-features.ts +12 -14
- package/samples/apps/use-all-bundled/feature-manifest.json +60 -29
- package/samples/apps/use-all-bundled/playwright.billing-docs.config.ts +1 -1
- package/samples/apps/use-all-bundled/playwright.config.ts +1 -0
- package/samples/apps/use-all-bundled/src/app/seed.ts +1 -1
- package/samples/apps/use-all-bundled/src/run-config.ts +2 -1
- package/samples/recipes/auth-mfa/src/web/confirmation-code-step.tsx +32 -10
- package/samples/recipes/chat-channels/README.md +2 -0
- package/samples/recipes/currencies-global/src/entities/currency.ts +1 -0
- package/samples/recipes/managed-pages/README.md +5 -1
- package/samples/recipes/managed-pages/package.json +3 -2
- package/samples/recipes/managed-pages/src/web/branded-preview.tsx +21 -0
- package/samples/recipes/managed-pages/tsconfig.json +8 -0
- package/samples/recipes/pwa-shell/README.md +52 -0
- package/samples/recipes/pwa-shell/bin/server.ts +12 -0
- package/samples/recipes/pwa-shell/package.json +13 -0
- package/samples/recipes/pwa-shell/src/app.ts +34 -0
- package/samples/recipes/rate-limiting/README.md +3 -3
- package/samples/recipes/record-detail-layout/README.md +33 -0
- package/samples/recipes/record-detail-layout/src/feature.ts +525 -44
- package/samples/recipes/record-detail-layout/src/order-board.ts +521 -0
- package/packages/bundled-features/src/managed-pages/web/page-body-section.tsx +0 -72
- package/packages/bundled-features/src/subscription-paddle/tenant-binding.ts +0 -34
- package/packages/bundled-features/src/template-resolver/web/content-field.tsx +0 -61
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineWriteHandler } 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.ts";
|
|
5
5
|
import { tenantEntity, tenantTable } from "../schema/tenant.ts";
|
|
6
6
|
|
|
7
7
|
const crud = createEventStoreExecutor(tenantTable, tenantEntity, { entityName: "tenant" });
|
|
@@ -24,14 +24,13 @@ export const createWrite = defineWriteHandler({
|
|
|
24
24
|
access: { roles: ["system", "SystemAdmin"] },
|
|
25
25
|
description:
|
|
26
26
|
"Creates a new tenant from a key and display name, optionally under a caller-chosen id for seeds or external provisioning; use it when onboarding a new customer or workspace.",
|
|
27
|
+
// guard:dup-ok create and list handler bodies share only the acknowledgedSystemDb + crud call shape; different verbs
|
|
27
28
|
handler: async (event, ctx) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
const db = ctx.systemDb.acknowledgeCrossTenant("creating a tenant is inherently cross-tenant");
|
|
29
|
+
const db = acknowledgedSystemDb(
|
|
30
|
+
ctx,
|
|
31
|
+
"tenant:write:create",
|
|
32
|
+
"creating a tenant is inherently cross-tenant",
|
|
33
|
+
);
|
|
35
34
|
return crud.create(event.payload, event.user, db);
|
|
36
35
|
},
|
|
37
36
|
});
|
|
@@ -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.ts";
|
|
5
5
|
import { tenantEntity, tenantTable } from "../schema/tenant.ts";
|
|
6
6
|
|
|
7
7
|
const crud = createEventStoreExecutor(tenantTable, tenantEntity, { entityName: "tenant" });
|
|
@@ -18,13 +18,11 @@ export const listQuery = defineQueryHandler({
|
|
|
18
18
|
description:
|
|
19
19
|
"Pages through every tenant on the platform with an optional search term, for a SystemAdmin browsing the tenant roster.",
|
|
20
20
|
handler: async (query, ctx) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const db = ctx.systemDb.acknowledgeCrossTenant("SystemAdmin lists tenants platform-wide");
|
|
28
|
-
return crud.list(query.payload, query.user, db); // @wrapper-known semantic-alias
|
|
21
|
+
const db = acknowledgedSystemDb(
|
|
22
|
+
ctx,
|
|
23
|
+
"tenant:query:list",
|
|
24
|
+
"SystemAdmin lists tenants platform-wide",
|
|
25
|
+
);
|
|
26
|
+
return crud.list(query.payload, query.user, db);
|
|
29
27
|
},
|
|
30
28
|
});
|
|
@@ -3,6 +3,7 @@ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
|
3
3
|
import {
|
|
4
4
|
access,
|
|
5
5
|
definePagedQueryHandler,
|
|
6
|
+
isUuid,
|
|
6
7
|
MAX_LIST_LIMIT,
|
|
7
8
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
8
9
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
@@ -74,10 +75,15 @@ export const memberDirectoryQuery = definePagedQueryHandler({
|
|
|
74
75
|
const db = ctx.systemDb.acknowledgeCrossTenant(
|
|
75
76
|
"SystemAdmin reference labels span every tenant, as user:query:user:list did",
|
|
76
77
|
);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
// Audit actors can be non-uuid ("anonymous"); binding them to the uuid column would fail the query.
|
|
79
|
+
const uuidIds = ids?.filter(isUuid);
|
|
80
|
+
users =
|
|
81
|
+
uuidIds?.length === 0
|
|
82
|
+
? []
|
|
83
|
+
: await selectMany(db, userTable, uuidIds === undefined ? undefined : { id: uuidIds }, {
|
|
84
|
+
limit: scanLimit,
|
|
85
|
+
orderBy: { col: "id", direction: "asc" },
|
|
86
|
+
});
|
|
81
87
|
} else {
|
|
82
88
|
const db = ctx.systemDb.assertTenantMatch(query.user.tenantId);
|
|
83
89
|
const requestedIds = ids === undefined ? undefined : new Set(ids);
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
8
8
|
import { createSystemUser, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
9
9
|
import { ConflictError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
10
|
+
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
10
11
|
import { parseRoles } from "@cosmicdrift/kumiko-framework/utils";
|
|
11
12
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
12
13
|
import { findForbiddenMembershipRole, reservedMembershipRoleError } from "./membership-roles.ts";
|
|
@@ -14,6 +15,8 @@ import { tenantMembershipEntity, tenantMembershipsTable } from "./membership-tab
|
|
|
14
15
|
import { seedTenantMembership } from "./seeding.ts";
|
|
15
16
|
import { TenantErrors } from "./web/constants.ts";
|
|
16
17
|
|
|
18
|
+
const log = createFallbackLogger("invited-membership");
|
|
19
|
+
|
|
17
20
|
const membershipExecutor = createEventStoreExecutor(
|
|
18
21
|
tenantMembershipsTable,
|
|
19
22
|
tenantMembershipEntity,
|
|
@@ -67,11 +70,17 @@ export async function grantInvitedMembershipRole(db: DbRunner, options: InvitedM
|
|
|
67
70
|
tenantId: options.tenantId,
|
|
68
71
|
});
|
|
69
72
|
if (!existing) {
|
|
70
|
-
await seedTenantMembership(db, {
|
|
73
|
+
const membership = await seedTenantMembership(db, {
|
|
71
74
|
userId: options.userId,
|
|
72
75
|
tenantId: options.tenantId,
|
|
73
76
|
roles: [options.role],
|
|
74
77
|
});
|
|
78
|
+
if (membership.rowMissing) {
|
|
79
|
+
log.warn("invited membership: stream exists but its row is missing", {
|
|
80
|
+
tenantId: options.tenantId,
|
|
81
|
+
userId: options.userId,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
75
84
|
return grantedMembership(false, [options.role]);
|
|
76
85
|
}
|
|
77
86
|
|
|
@@ -306,6 +306,8 @@ export async function seedTenant(
|
|
|
306
306
|
* ConflictError on duplicates (duplicate calls no-op).
|
|
307
307
|
*
|
|
308
308
|
* Returns the membership-row id (existing on no-op, freshly minted on create).
|
|
309
|
+
* `rowMissing` marks a live stream whose projection row is gone: nothing is written, the
|
|
310
|
+
* membership is invisible until the projection is rebuilt.
|
|
309
311
|
*/
|
|
310
312
|
export async function seedTenantMembership(
|
|
311
313
|
db: DbRunner,
|
|
@@ -316,7 +318,7 @@ export async function seedTenantMembership(
|
|
|
316
318
|
// `allOf: "tenantMembership"`) for fixtures/self-signup that opt in.
|
|
317
319
|
// Omit to keep today's hook-less behavior.
|
|
318
320
|
hooks?: SeedTenantHooks,
|
|
319
|
-
): Promise<{ id: string }> {
|
|
321
|
+
): Promise<{ id: string; rowMissing?: true }> {
|
|
320
322
|
// Chokepoint: invite-accept (×3) + seedAdmin/provisionSignup all flow
|
|
321
323
|
// through here — reject reserved/global roles before they ever persist.
|
|
322
324
|
assertAssignableMembershipRoles(options.roles);
|
|
@@ -336,7 +338,7 @@ export async function seedTenantMembership(
|
|
|
336
338
|
const existing = await fetchOne(db, tenantMembershipsTable, pair);
|
|
337
339
|
if (existing) return { id: extractMembershipId(existing) };
|
|
338
340
|
const liveStreamId = await findLiveMembershipStreamId(db, pair);
|
|
339
|
-
if (liveStreamId) return { id: liveStreamId };
|
|
341
|
+
if (liveStreamId) return { id: liveStreamId, rowMissing: true };
|
|
340
342
|
|
|
341
343
|
// Keep by.id as audit actor, but force stream tenant to the membership tenant
|
|
342
344
|
// so a cross-tenant `by` override cannot diverge row tenant vs event stream.
|
|
@@ -64,12 +64,16 @@ export async function backfillTenantStreamTenants(
|
|
|
64
64
|
...(scanTenantIds && { scanTenantIds }),
|
|
65
65
|
...(onFirstCandidate && { onFirstCandidate }),
|
|
66
66
|
};
|
|
67
|
-
const searchCleanup = createSearchBucketCleanup(searchAdapter, TENANT_AGGREGATE
|
|
67
|
+
const searchCleanup = createSearchBucketCleanup(searchAdapter, TENANT_AGGREGATE, {
|
|
68
|
+
db,
|
|
69
|
+
registry,
|
|
70
|
+
});
|
|
68
71
|
|
|
69
72
|
const tenants = await backfillAggregateStreamTenants(db, {
|
|
70
73
|
aggregateType: TENANT_AGGREGATE,
|
|
71
74
|
target: { kind: "system" },
|
|
72
75
|
beforeMove: searchCleanup.beforeMove,
|
|
76
|
+
onMoveFailed: searchCleanup.onMoveFailed,
|
|
73
77
|
...scan,
|
|
74
78
|
});
|
|
75
79
|
const memberships = await backfillAggregateStreamTenants(db, {
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
} from "./mail-notifications.ts";
|
|
28
28
|
import { resolveInactivityRule, type TenantInactivityOptions } from "./options.ts";
|
|
29
29
|
import {
|
|
30
|
+
isInactivityCycleCurrent,
|
|
30
31
|
loadInactivityState,
|
|
31
32
|
loadNewestSessionActivity,
|
|
32
33
|
type StoredInactivityState,
|
|
@@ -219,6 +220,8 @@ async function evaluate(
|
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
if (!ctx.registry) throw new Error("tenant-inactivity: ctx.registry required");
|
|
223
|
+
// The probes and mails above are slow; a keep link redeemed meanwhile must not end in a deletion request.
|
|
224
|
+
if (stored !== null && !(await isInactivityCycleCurrent(ctx.db, stored.cycleId))) return state;
|
|
222
225
|
const result = await requestTenantDestruction({
|
|
223
226
|
tenantId,
|
|
224
227
|
actor: ctx.systemUser,
|
|
@@ -239,9 +242,7 @@ export async function checkTenantInactivity(
|
|
|
239
242
|
ctx: JobContext,
|
|
240
243
|
options: TenantInactivityOptions,
|
|
241
244
|
): Promise<void> {
|
|
242
|
-
const tenantId = ctx.systemUser.tenantId
|
|
243
|
-
// skip: a job without a tenant scope has nothing to evaluate
|
|
244
|
-
if (tenantId === undefined) return;
|
|
245
|
+
const tenantId = ctx.systemUser.tenantId;
|
|
245
246
|
const now = ctx.tz.now();
|
|
246
247
|
const tenant = await fetchOne<{ status: TenantLifecycleStatus }>(
|
|
247
248
|
ctx.db.unsafeRaw(),
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export const TENANT_INACTIVITY_FEATURE = "tenant-inactivity";
|
|
2
2
|
export const TENANT_INACTIVITY_STATE_ENTITY = "tenant-inactivity-state";
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
// reaches exactly the people who can open the keep-account link and read the state.
|
|
4
|
+
// Stays import-free for the client-safe subpath; a test ties it to TENANT_ACCOUNT_CLOSE_ROLES.
|
|
6
5
|
export const TENANT_KEEP_ACCOUNT_ROLES = ["TenantOwner", "TenantAdmin", "Admin"] as const;
|
|
7
6
|
|
|
8
7
|
export const TenantInactivityJobs = {
|
|
@@ -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.ts";
|
|
6
5
|
import { redeemKeepAccountToken } from "../keep-token.ts";
|
|
7
6
|
import { tenantInactivityStateTable } from "../state-table.ts";
|
|
8
7
|
|
|
@@ -14,7 +13,7 @@ export function createKeepAccountHandler(opts: { readonly keepAccountTokenSecret
|
|
|
14
13
|
name: "keep-account",
|
|
15
14
|
schema: z.object({ token: z.string().min(1) }),
|
|
16
15
|
access: {
|
|
17
|
-
roles: ["anonymous"
|
|
16
|
+
roles: ["anonymous"],
|
|
18
17
|
anySignedIn: true,
|
|
19
18
|
},
|
|
20
19
|
escapeHatch: { grants: ["unsafeRaw"], reason: KEEP_ACCOUNT_ESCAPE_HATCH_REASON },
|
|
@@ -56,10 +56,19 @@ export async function saveInactivityState(
|
|
|
56
56
|
if (previous === null) {
|
|
57
57
|
await db.insertOne(tenantInactivityStateTable, { tenantId: db.tenantId, ...next });
|
|
58
58
|
} else {
|
|
59
|
-
|
|
59
|
+
// A redeemed keep link rotates cycleId while the run is busy; then this run lost and the next re-evaluates.
|
|
60
|
+
await db.updateMany(tenantInactivityStateTable, next, {
|
|
61
|
+
tenantId: db.tenantId,
|
|
62
|
+
cycleId: previous.cycleId,
|
|
63
|
+
});
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
|
|
67
|
+
export async function isInactivityCycleCurrent(db: TenantDb, cycleId: string): Promise<boolean> {
|
|
68
|
+
const row = await db.fetchOne<StateRow>(tenantInactivityStateTable, { tenantId: db.tenantId });
|
|
69
|
+
return !row || row.cycleId === cycleId;
|
|
70
|
+
}
|
|
71
|
+
|
|
63
72
|
// The sessions table keeps the activity marker; reading it here avoids a write per request.
|
|
64
73
|
export async function loadNewestSessionActivity(db: TenantDb): Promise<Temporal.Instant | null> {
|
|
65
74
|
const [newest] = await db.selectMany<{ lastSeenAt: Temporal.Instant | null }>(
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.414.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "Destroy accumulator and subject-key erasure",
|
|
6
|
+
"detail": "The destroy accumulator reports a hook without progress as stuck even when another hook is pending; subject-key erasure no longer counts a destroying tenant as live, so two overlapping destructions with a shared member both erase the user key."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"version": "0.414.0",
|
|
10
|
+
"type": "fix",
|
|
11
|
+
"title": "Destruction anonymize converges",
|
|
12
|
+
"detail": "Tenant destruction anonymize stops when a pass makes no progress."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"version": "0.414.0",
|
|
16
|
+
"type": "fix",
|
|
17
|
+
"title": "review fixes for document links, termination revoke, inactivity keep race, retention hold release and destroy pending window",
|
|
18
|
+
"detail": "`ensureDocumentLink` keeps the lifecycle result of a newly created link, so postSave hooks and projections on the link entity run. `hasOtherOpenProviderCancel` ignores cancel declarations that already took effect, so revoking a new cancel resumes the subscription. The inactivity state is saved only while its cycleId is unchanged and the destruction request re-checks it, so a keep link redeemed during a job run is no longer overwritten. The destroyHeld retention purge also deletes rows whose reference field is NULL, so the tenant can be released. The pending window of a tenant destroy stage counts at most 10 minutes per gap between pending ticks (new `tickAt` on pending progressed events)."
|
|
19
|
+
},
|
|
2
20
|
{
|
|
3
21
|
"version": "0.408.0",
|
|
4
22
|
"type": "improvement",
|
|
@@ -75,3 +75,7 @@ export const DESTRUCTION_STAGE_MIN_SLICE_MS = 2_000;
|
|
|
75
75
|
// Sized for a queued app teardown (pod drain up to 330 s, database drop up to 180 s,
|
|
76
76
|
// two teardowns in parallel) with headroom for several apps per tenant.
|
|
77
77
|
export const DESTRUCTION_STAGE_MAX_PENDING_MS = 60 * 60_000;
|
|
78
|
+
|
|
79
|
+
// The pending window only counts time the sweep was actually ticking: a gap between two pending
|
|
80
|
+
// ticks longer than this (the app slept, the sweep does not wake it) adds just this much.
|
|
81
|
+
export const DESTRUCTION_STAGE_MAX_PENDING_TICK_GAP_MS = 10 * 60_000;
|
|
@@ -29,6 +29,7 @@ import type { TenantDestructionHoldProvider } from "../shared/index.ts";
|
|
|
29
29
|
import { type TenantLifecycleStatus, tenantEntity, tenantTable } from "../tenant/index.ts";
|
|
30
30
|
import {
|
|
31
31
|
DESTRUCTION_STAGE_MAX_PENDING_MS,
|
|
32
|
+
DESTRUCTION_STAGE_MAX_PENDING_TICK_GAP_MS,
|
|
32
33
|
DESTRUCTION_STAGE_MIN_SLICE_MS,
|
|
33
34
|
DESTRUCTION_STAGE_TICK_BUDGET_MS,
|
|
34
35
|
TENANT_AGGREGATE_TYPE,
|
|
@@ -126,16 +127,46 @@ function currentAttemptStartedAt(
|
|
|
126
127
|
return typeof startedAt === "string" ? getTemporal().Instant.from(startedAt) : started.createdAt;
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
function pendingTickInstants(
|
|
131
|
+
events: readonly StoredEvent[],
|
|
132
|
+
stageName: string,
|
|
133
|
+
): Temporal.Instant[] {
|
|
134
|
+
const startIndex = events.findLastIndex(
|
|
135
|
+
(event) =>
|
|
136
|
+
event.type === qualified(TENANT_DESTRUCTION_STAGE_STARTED_EVENT_SHORT) &&
|
|
137
|
+
event.payload["stage"] === stageName,
|
|
138
|
+
);
|
|
139
|
+
const startedAt = currentAttemptStartedAt(events, stageName);
|
|
140
|
+
if (startIndex < 0 || startedAt === undefined) return [];
|
|
141
|
+
const instants = [startedAt];
|
|
142
|
+
for (const event of events.slice(startIndex + 1)) {
|
|
143
|
+
const tickAt = event.payload["tickAt"];
|
|
144
|
+
const isPendingTick =
|
|
145
|
+
event.type === qualified(TENANT_DESTRUCTION_STAGE_PROGRESSED_EVENT_SHORT) &&
|
|
146
|
+
event.payload["stage"] === stageName &&
|
|
147
|
+
typeof tickAt === "string";
|
|
148
|
+
if (isPendingTick) instants.push(getTemporal().Instant.from(tickAt));
|
|
149
|
+
}
|
|
150
|
+
return instants;
|
|
151
|
+
}
|
|
152
|
+
|
|
129
153
|
function isPendingWindowOpen(
|
|
130
154
|
events: readonly StoredEvent[],
|
|
131
155
|
stageName: string,
|
|
132
156
|
now: Temporal.Instant,
|
|
133
157
|
): boolean {
|
|
134
|
-
const
|
|
135
|
-
return
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
)
|
|
158
|
+
const instants = pendingTickInstants(events, stageName);
|
|
159
|
+
if (instants.length === 0) return false;
|
|
160
|
+
let tickingMs = 0;
|
|
161
|
+
let previous = instants[0];
|
|
162
|
+
for (const instant of [...instants.slice(1), now]) {
|
|
163
|
+
if (previous !== undefined) {
|
|
164
|
+
const gapMs = instant.epochMilliseconds - previous.epochMilliseconds;
|
|
165
|
+
tickingMs += Math.min(gapMs, DESTRUCTION_STAGE_MAX_PENDING_TICK_GAP_MS);
|
|
166
|
+
}
|
|
167
|
+
previous = instant;
|
|
168
|
+
}
|
|
169
|
+
return tickingMs <= DESTRUCTION_STAGE_MAX_PENDING_MS;
|
|
139
170
|
}
|
|
140
171
|
|
|
141
172
|
function lastEventVersion(events: ReadonlyArray<{ version: number }>): number {
|
|
@@ -354,7 +385,13 @@ async function recordIdleStageTick(args: {
|
|
|
354
385
|
args.db,
|
|
355
386
|
args.tenantId,
|
|
356
387
|
qualified(TENANT_DESTRUCTION_STAGE_PROGRESSED_EVENT_SHORT),
|
|
357
|
-
{
|
|
388
|
+
{
|
|
389
|
+
stage: args.stage.name,
|
|
390
|
+
attempts: args.attempt,
|
|
391
|
+
processed: 0,
|
|
392
|
+
pending: true,
|
|
393
|
+
tickAt: args.now.toString(),
|
|
394
|
+
},
|
|
358
395
|
lastEventVersion(args.events),
|
|
359
396
|
);
|
|
360
397
|
return { done: false, pending: true };
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
holdBlockDeleteRowsForDestruction,
|
|
47
47
|
} from "../data-retention/index.ts";
|
|
48
48
|
import {
|
|
49
|
+
type TenantLifecycleStatus,
|
|
49
50
|
tenantEntity,
|
|
50
51
|
tenantMembershipEntity,
|
|
51
52
|
tenantMembershipsTable,
|
|
@@ -110,14 +111,17 @@ function newOutcomeAccumulator(): {
|
|
|
110
111
|
} {
|
|
111
112
|
let allDone = true;
|
|
112
113
|
let pending = false;
|
|
114
|
+
let stuck = false;
|
|
113
115
|
let processed = 0;
|
|
114
116
|
return {
|
|
115
117
|
add: (result) => {
|
|
116
118
|
if (result?.done === false) allDone = false;
|
|
117
119
|
if (result?.done === false && result.pending === true) pending = true;
|
|
120
|
+
if (result?.done === false && result.processed === 0 && result.pending !== true) stuck = true;
|
|
118
121
|
processed += result?.processed ?? 0;
|
|
119
122
|
},
|
|
120
|
-
|
|
123
|
+
// A genuinely stuck hook must not hide behind another hook's legitimate pending.
|
|
124
|
+
outcome: () => ({ done: allDone, processed, pending: pending && !stuck }),
|
|
121
125
|
};
|
|
122
126
|
}
|
|
123
127
|
|
|
@@ -196,6 +200,11 @@ async function runTenantDataHooks(
|
|
|
196
200
|
return total.outcome();
|
|
197
201
|
}
|
|
198
202
|
|
|
203
|
+
const IRREVERSIBLY_DESTROYED_STATUSES: ReadonlySet<string> = new Set<TenantLifecycleStatus>([
|
|
204
|
+
"destroying",
|
|
205
|
+
"destroyed",
|
|
206
|
+
]);
|
|
207
|
+
|
|
199
208
|
// A user key outlives the tenant while the user still belongs to another live tenant:
|
|
200
209
|
// erasing it would tombstone the key and break every later PII write for that user.
|
|
201
210
|
async function userIdsWithoutOtherLiveTenant(
|
|
@@ -214,8 +223,12 @@ async function userIdsWithoutOtherLiveTenant(
|
|
|
214
223
|
const otherTenants = await selectMany<{ id: string; status: string }>(ctx.db, tenantTable, {
|
|
215
224
|
id: { in: [...new Set(otherMemberships.map((membership) => membership.tenantId))] },
|
|
216
225
|
});
|
|
226
|
+
// A tenant already destroying is past the point of return: two overlapping destructions with a
|
|
227
|
+
// shared member must not each count the other as live, or the user key would never be erased.
|
|
217
228
|
const liveTenantIds = new Set(
|
|
218
|
-
otherTenants
|
|
229
|
+
otherTenants
|
|
230
|
+
.filter((tenant) => !IRREVERSIBLY_DESTROYED_STATUSES.has(tenant.status))
|
|
231
|
+
.map((tenant) => tenant.id),
|
|
219
232
|
);
|
|
220
233
|
const retainedUserIds = new Set(
|
|
221
234
|
otherMemberships
|
|
@@ -21,7 +21,6 @@ const TIER_ASSIGNMENT_NAMESPACE = "8e91d2fc-8b7a-4d3e-9f4a-1c5d6e7f8a9b";
|
|
|
21
21
|
* Standard CRUD handlers instead generate UUIDs via `gen_random_uuid()`.
|
|
22
22
|
* This utility is exported for use by the `stripe-sync` feature.
|
|
23
23
|
*/
|
|
24
|
-
// @wrapper-known uuid-domain
|
|
25
24
|
export function tierAssignmentAggregateId(tenantId: string): string {
|
|
26
25
|
return uuidv5(tenantId, TIER_ASSIGNMENT_NAMESPACE);
|
|
27
26
|
}
|
|
@@ -520,7 +520,8 @@ export function createTierEngineFeature<
|
|
|
520
520
|
}
|
|
521
521
|
alwaysOnHolder.set = computedAlwaysOn;
|
|
522
522
|
// One feature instance can serve several stacks in a process; rebuild state from this DB only.
|
|
523
|
-
//
|
|
523
|
+
// The cache is shared per instance, so this is safe only for sequential stack lifecycles
|
|
524
|
+
// (no request of an earlier stack still running): clear-then-refill would lock its tenants out.
|
|
524
525
|
cache.clear();
|
|
525
526
|
latestTicket.clear();
|
|
526
527
|
isBuilt = true;
|
|
@@ -529,10 +530,15 @@ export function createTierEngineFeature<
|
|
|
529
530
|
// have <100k tenants, so a single-pass scan is acceptable. The scaling
|
|
530
531
|
// path (lazy load + LRU) is planned once a real need arises.
|
|
531
532
|
type AssignmentRow = { tenantId: string; tier: string };
|
|
533
|
+
ticketCounter += 1;
|
|
534
|
+
const preloadTicket = ticketCounter;
|
|
532
535
|
const rows = await selectMany<AssignmentRow>(systemDb, tierAssignmentTable);
|
|
533
536
|
for (const row of rows) {
|
|
537
|
+
const tenantId = row.tenantId as TenantId;
|
|
538
|
+
// skip: a tier write committed while the snapshot was read; its cache entry is newer
|
|
539
|
+
if ((latestTicket.get(tenantId) ?? 0) > preloadTicket) continue;
|
|
534
540
|
cache.set(
|
|
535
|
-
|
|
541
|
+
tenantId,
|
|
536
542
|
mergeAlwaysOn(computedAlwaysOn, featuresForTier(tierMap, row.tier)),
|
|
537
543
|
);
|
|
538
544
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.414.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "user:me returns null for a caller id that is no uuid",
|
|
6
|
+
"detail": "An anonymous or system caller (id `anonymous`, `system`) reached `user:me` with an id that the uuid column rejects, so the query failed with a Postgres error and aborted the transaction. The handler now returns null for such callers without querying."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.368.0",
|
|
4
10
|
"type": "fix",
|
|
@@ -59,11 +59,12 @@ export async function backfillUserStreamTenantsWithDerivedState(deps: {
|
|
|
59
59
|
scanTenantIds,
|
|
60
60
|
onFirstCandidate,
|
|
61
61
|
} = deps;
|
|
62
|
-
const searchCleanup = createSearchBucketCleanup(searchAdapter, USER_AGGREGATE);
|
|
62
|
+
const searchCleanup = createSearchBucketCleanup(searchAdapter, USER_AGGREGATE, { db, registry });
|
|
63
63
|
const streams = await backfillAggregateStreamTenants(db, {
|
|
64
64
|
aggregateType: USER_AGGREGATE,
|
|
65
65
|
target: { kind: "system" },
|
|
66
66
|
beforeMove: searchCleanup.beforeMove,
|
|
67
|
+
onMoveFailed: searchCleanup.onMoveFailed,
|
|
67
68
|
...(scanTenantIds && { scanTenantIds }),
|
|
68
69
|
...(onFirstCandidate && { onFirstCandidate }),
|
|
69
70
|
});
|
|
@@ -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.ts";
|
|
@@ -34,6 +34,8 @@ export const meQuery = defineQueryHandler({
|
|
|
34
34
|
const db = ctx.systemDb.acknowledgeCrossTenant(
|
|
35
35
|
"user rows are tenant-agnostic identity records; self-lookup by id needs no tenant filter",
|
|
36
36
|
);
|
|
37
|
+
// Anonymous and system callers carry no uuid; querying the uuid column with one fails the tx.
|
|
38
|
+
if (!isUuid(query.user.id)) return null;
|
|
37
39
|
const row = await crud.detail({ id: query.user.id }, query.user, db);
|
|
38
40
|
// `timezone` on the row is only the stored override (often unset); clients
|
|
39
41
|
// need the effective zone (override, else tenant, else UTC) to compute "today".
|
|
@@ -12,6 +12,7 @@ export {
|
|
|
12
12
|
principalStatusPlugin,
|
|
13
13
|
} from "./principal-status.ts";
|
|
14
14
|
export { resolveUserDisplayNames } from "./resolve-display-names.ts";
|
|
15
|
+
export { resolveVerifiedUserEmail } from "./resolve-verified-user-email.ts";
|
|
15
16
|
export type { UserStatus } from "./schema/user.ts";
|
|
16
17
|
export {
|
|
17
18
|
USER_ANONYMIZED_DISPLAY_NAME,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { UserDataHookCtx } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { decryptStoredPii } from "../shared/index.ts";
|
|
3
|
+
import { userTable } from "./schema/user.ts";
|
|
4
|
+
|
|
5
|
+
// Only a verified owner may see or erase rows matched by email. Forget keeps emailVerified but has
|
|
6
|
+
// already rewritten the email, hence the pre-tx copy.
|
|
7
|
+
export async function resolveVerifiedUserEmail(
|
|
8
|
+
ctx: UserDataHookCtx,
|
|
9
|
+
piiDecryptReason: string,
|
|
10
|
+
): Promise<string | null> {
|
|
11
|
+
const row = await ctx.db.fetchOne<{ email: string; emailVerified: boolean }>(userTable, {
|
|
12
|
+
id: ctx.userId,
|
|
13
|
+
});
|
|
14
|
+
if (row?.emailVerified !== true) return null;
|
|
15
|
+
if (ctx.userEmailBeforeDelete) return ctx.userEmailBeforeDelete.toLowerCase();
|
|
16
|
+
return (await decryptStoredPii(row.email, "email", piiDecryptReason)).toLowerCase();
|
|
17
|
+
}
|
package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts
CHANGED
|
@@ -57,7 +57,7 @@ export function createConfirmDeletionByTokenHandler(opts: ConfirmDeletionByToken
|
|
|
57
57
|
name: "confirm-deletion-by-token",
|
|
58
58
|
schema: z.object({ token: z.string().min(1) }),
|
|
59
59
|
access: {
|
|
60
|
-
roles: ["anonymous"
|
|
60
|
+
roles: ["anonymous"],
|
|
61
61
|
anySignedIn: true,
|
|
62
62
|
},
|
|
63
63
|
escapeHatch: {
|
|
@@ -77,7 +77,7 @@ export const downloadByTokenQuery = defineQueryHandler({
|
|
|
77
77
|
}),
|
|
78
78
|
// public-intake: rejected attempts store the anonymous caller's IP in the audit row.
|
|
79
79
|
access: {
|
|
80
|
-
roles: ["anonymous"
|
|
80
|
+
roles: ["anonymous"],
|
|
81
81
|
personalData: "public-intake",
|
|
82
82
|
anySignedIn: true,
|
|
83
83
|
},
|
package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts
CHANGED
|
@@ -62,7 +62,7 @@ export function createRequestDeletionByEmailHandler(opts: RequestDeletionByEmail
|
|
|
62
62
|
name: "request-deletion-by-email",
|
|
63
63
|
schema: z.object({ email: z.email() }),
|
|
64
64
|
access: {
|
|
65
|
-
roles: ["anonymous"
|
|
65
|
+
roles: ["anonymous"],
|
|
66
66
|
anySignedIn: true,
|
|
67
67
|
},
|
|
68
68
|
description:
|
|
@@ -302,7 +302,6 @@ interface JobRow {
|
|
|
302
302
|
readonly requestedFromTenantId: TenantId;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
// @wrapper-known semantic-alias
|
|
306
305
|
async function fetchPendingJobs(db: DbRunner): Promise<readonly JobRow[]> {
|
|
307
306
|
return selectMany<JobRow>(
|
|
308
307
|
db,
|
|
@@ -725,7 +724,6 @@ function reportCleanupLastRun(metrics: MetricsHandle | undefined, now: Instant):
|
|
|
725
724
|
// `crud.update` requires a TenantDb for event-store stream lookup. Export jobs are tenant-agnostic
|
|
726
725
|
// (one job per userId), so system mode bypasses the automatic tenant filter while
|
|
727
726
|
// `requestedFromTenantId` preserves stream identity and keeps the stream counter consistent.
|
|
728
|
-
// @wrapper-known semantic-alias
|
|
729
727
|
function systemTenantDb(db: DbConnection, tenantId: TenantId) {
|
|
730
728
|
return createTenantDb({
|
|
731
729
|
db,
|
|
@@ -206,14 +206,14 @@ interface HookEntry {
|
|
|
206
206
|
// hook that nulls that column. See custom-fields wire-user-data-rights.ts.
|
|
207
207
|
const HOOK_ORDER_DEFAULT = EXT_USER_DATA_ORDER.DEFAULT;
|
|
208
208
|
|
|
209
|
+
// Secret-read audit discriminator, not a QN; the value must stay stable for the audit trail.
|
|
210
|
+
export const FORGET_CLEANUP_HANDLER_NAME = "user-data-rights:run-forget-cleanup" as const;
|
|
211
|
+
|
|
209
212
|
// Hook-reported reasons are external input (provider error messages can embed
|
|
210
213
|
// user-controlled filenames/emails) — strip newlines before a single-line
|
|
211
214
|
// console.warn so a crafted reason can't forge extra log lines, and cap the
|
|
212
215
|
// length against a log-flood. The unsanitized reason still lands in the
|
|
213
216
|
// returned `incomplete` entry untouched.
|
|
214
|
-
// Secret-read audit discriminator, not a QN; the value must stay stable for the audit trail.
|
|
215
|
-
export const FORGET_CLEANUP_HANDLER_NAME = "user-data-rights:run-forget-cleanup" as const;
|
|
216
|
-
|
|
217
217
|
export function sanitizeReasonForLog(reason: string): string {
|
|
218
218
|
return reason.replace(/[\r\n]+/g, " ").slice(0, 500);
|
|
219
219
|
}
|