@cosmicdrift/kumiko-bundled-features 0.406.0 → 0.410.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-security/feature.js +9 -1
- package/dist/admin-shell/feature.d.ts +3 -0
- package/dist/admin-shell/feature.js +1 -1
- package/dist/agent-tools/agent-manifest.js +1 -0
- package/dist/agent-tools/tool-catalog.js +1 -0
- package/dist/agent-tools/types.d.ts +4 -1
- package/dist/audit/event-classification.js +1 -0
- package/dist/auth-email-password/bootstrap.js +1 -0
- package/dist/auth-email-password/errors.js +16 -41
- package/dist/auth-email-password/handlers/login-options.query.js +1 -1
- package/dist/auth-email-password/handlers/self-registration-status.query.js +1 -1
- package/dist/auth-email-password/web/auth-client.d.ts +8 -32
- package/dist/auth-email-password/web/auth-client.js +18 -52
- package/dist/auth-email-password/web/auth-redirect.js +2 -2
- package/dist/auth-email-password/web/confirm-account-unlock-screen.d.ts +2 -2
- package/dist/auth-email-password/web/confirm-account-unlock-screen.js +14 -35
- package/dist/auth-email-password/web/index.d.ts +1 -0
- package/dist/auth-email-password/web/index.js +1 -0
- package/dist/auth-email-password/web/read-path-param.d.ts +1 -0
- package/dist/auth-email-password/web/read-path-param.js +4 -0
- package/dist/auth-email-password/web/return-path.js +2 -2
- package/dist/auth-email-password/web/token-confirm-screen.d.ts +20 -0
- package/dist/auth-email-password/web/token-confirm-screen.js +38 -0
- package/dist/auth-email-password/web/verify-email-screen.d.ts +2 -2
- package/dist/auth-email-password/web/verify-email-screen.js +14 -37
- package/dist/auth-foundation/boot-checks.js +24 -12
- package/dist/auth-foundation/boot-rules.d.ts +27 -0
- package/dist/auth-foundation/boot-rules.js +27 -0
- package/dist/auth-mfa/errors.d.ts +1 -1
- package/dist/auth-mfa/errors.js +11 -24
- package/dist/auth-mfa/feature-exports.js +6 -45
- package/dist/auth-mfa/feature.js +7 -18
- package/dist/auth-mfa/web/mfa-client.js +11 -25
- package/dist/billing-foundation/consumer-protection/termination-notify.js +1 -0
- package/dist/billing-foundation/web/plan-price.js +7 -8
- package/dist/cap-counter/stock-cap-guard.js +1 -0
- package/dist/channel-in-app/constants.d.ts +1 -0
- package/dist/channel-in-app/feature.js +2 -0
- package/dist/channel-in-app/handlers/read-state-by-keys.query.d.ts +9 -0
- package/dist/channel-in-app/handlers/read-state-by-keys.query.js +21 -0
- package/dist/channel-in-app/in-app-channel.js +1 -0
- package/dist/channel-in-app/tables.js +5 -1
- package/dist/compliance-profiles/handlers/sub-processors.query.js +4 -1
- package/dist/contact/challenge.d.ts +14 -0
- package/dist/contact/challenge.js +30 -0
- package/dist/contact/client/contact-client-source.d.ts +1 -0
- package/dist/contact/client/contact-client-source.js +203 -0
- package/dist/contact/client/contact-website-client.d.ts +26 -0
- package/dist/contact/client/contact-website-client.js +1 -0
- package/dist/contact/client/index.d.ts +2 -0
- package/dist/contact/client/index.js +1 -0
- package/dist/contact/entity.d.ts +777 -0
- package/dist/contact/entity.js +145 -0
- package/dist/contact/feature.d.ts +3 -0
- package/dist/contact/feature.js +134 -0
- package/dist/contact/handlers/access.d.ts +7 -0
- package/dist/contact/handlers/access.js +9 -0
- package/dist/contact/handlers/attempts.d.ts +14 -0
- package/dist/contact/handlers/attempts.js +54 -0
- package/dist/contact/handlers/challenge.query.d.ts +9 -0
- package/dist/contact/handlers/challenge.query.js +35 -0
- package/dist/contact/handlers/forward-request.write.d.ts +9 -0
- package/dist/contact/handlers/forward-request.write.js +61 -0
- package/dist/contact/handlers/mark-done.write.d.ts +7 -0
- package/dist/contact/handlers/mark-done.write.js +30 -0
- package/dist/contact/handlers/notify-reporter-in-app.write.d.ts +10 -0
- package/dist/contact/handlers/notify-reporter-in-app.write.js +36 -0
- package/dist/contact/handlers/open-count.d.ts +2 -0
- package/dist/contact/handlers/open-count.js +11 -0
- package/dist/contact/handlers/open-count.query.d.ts +3 -0
- package/dist/contact/handlers/open-count.query.js +13 -0
- package/dist/contact/handlers/replies.query.d.ts +11 -0
- package/dist/contact/handlers/replies.query.js +28 -0
- package/dist/contact/handlers/reply.write.d.ts +12 -0
- package/dist/contact/handlers/reply.write.js +118 -0
- package/dist/contact/handlers/report.write.d.ts +16 -0
- package/dist/contact/handlers/report.write.js +90 -0
- package/dist/contact/handlers/request-delivery.query.d.ts +16 -0
- package/dist/contact/handlers/request-delivery.query.js +85 -0
- package/dist/contact/handlers/request-detail.query.d.ts +41 -0
- package/dist/contact/handlers/request-detail.query.js +32 -0
- package/dist/contact/handlers/request-list.query.d.ts +2 -0
- package/dist/contact/handlers/request-list.query.js +9 -0
- package/dist/contact/handlers/send-reply-mail.write.d.ts +8 -0
- package/dist/contact/handlers/send-reply-mail.write.js +82 -0
- package/dist/contact/handlers/send-test.write.d.ts +5 -0
- package/dist/contact/handlers/send-test.write.js +36 -0
- package/dist/contact/handlers/submit.write.d.ts +20 -0
- package/dist/contact/handlers/submit.write.js +137 -0
- package/dist/contact/handlers/take-over-uploads.d.ts +9 -0
- package/dist/contact/handlers/take-over-uploads.js +33 -0
- package/dist/contact/i18n.d.ts +6 -0
- package/dist/contact/i18n.js +189 -0
- package/dist/contact/index.d.ts +5 -0
- package/dist/contact/index.js +4 -0
- package/dist/contact/lib.d.ts +101 -0
- package/dist/contact/lib.js +109 -0
- package/dist/contact/mail.d.ts +91 -0
- package/dist/contact/mail.js +279 -0
- package/dist/contact/options.d.ts +51 -0
- package/dist/contact/options.js +32 -0
- package/dist/contact/panels.d.ts +2 -0
- package/dist/contact/panels.js +21 -0
- package/dist/contact/payloads.d.ts +56 -0
- package/dist/contact/payloads.js +82 -0
- package/dist/contact/pow.d.ts +6 -0
- package/dist/contact/pow.js +19 -0
- package/dist/contact/screens.d.ts +5 -0
- package/dist/contact/screens.js +465 -0
- package/dist/contact/subject.d.ts +1 -0
- package/dist/contact/subject.js +13 -0
- package/dist/contact/user-agent.d.ts +1 -0
- package/dist/contact/user-agent.js +35 -0
- package/dist/contact/user-data-hooks.d.ts +3 -0
- package/dist/contact/user-data-hooks.js +129 -0
- package/dist/contact/web/constants.d.ts +127 -0
- package/dist/contact/web/constants.js +126 -0
- package/dist/contact/web/index.d.ts +1 -0
- package/dist/contact/web/index.js +1 -0
- package/dist/crypto-shredding/handlers/forget-subject.write.js +5 -13
- package/dist/data-retention/feature.js +16 -2
- package/dist/data-retention/index.d.ts +1 -0
- package/dist/data-retention/index.js +1 -0
- package/dist/data-retention/run-retention-cleanup.d.ts +14 -2
- package/dist/data-retention/run-retention-cleanup.js +102 -36
- package/dist/data-retention/tenant-destruction-hold.d.ts +23 -0
- package/dist/data-retention/tenant-destruction-hold.js +132 -0
- package/dist/delivery/address-opt-out.js +1 -0
- package/dist/delivery/channel-context.d.ts +1 -1
- package/dist/delivery/channel-context.js +2 -1
- package/dist/delivery/delivery-service.js +18 -8
- package/dist/delivery/events.d.ts +1 -0
- package/dist/delivery/events.js +2 -0
- package/dist/delivery/feature.js +3 -0
- package/dist/delivery/handlers/attempts-by-keys.query.d.ts +15 -0
- package/dist/delivery/handlers/attempts-by-keys.query.js +35 -0
- package/dist/delivery/handlers/log.query.d.ts +1 -0
- package/dist/delivery/handlers/log.query.js +1 -1
- package/dist/delivery/jobs.js +5 -2
- package/dist/delivery/tables.js +12 -2
- package/dist/delivery/types.d.ts +2 -0
- package/dist/delivery/unsubscribe-page.js +2 -0
- package/dist/delivery/web/delivery-channel-cell.js +1 -1
- package/dist/delivery/web/delivery-error-cell.js +1 -1
- package/dist/delivery/web/delivery-status-cell.js +1 -1
- package/dist/delivery/web/delivery-time-cell.js +3 -2
- package/dist/delivery/web/delivery-type-cell.js +1 -1
- package/dist/delivery/web/public-names.d.ts +1 -0
- package/dist/delivery/web/public-names.js +1 -0
- package/dist/document-ingest-foundation/boot-checks.js +19 -11
- package/dist/document-ingest-foundation/boot-rules.d.ts +17 -0
- package/dist/document-ingest-foundation/boot-rules.js +17 -0
- package/dist/document-ingest-foundation/events.d.ts +8 -0
- package/dist/document-ingest-foundation/events.js +12 -0
- package/dist/document-ingest-foundation/feature.js +30 -2
- package/dist/document-ingest-foundation/index.d.ts +3 -1
- package/dist/document-ingest-foundation/index.js +3 -1
- package/dist/document-ingest-foundation/report-ingest-progress.d.ts +14 -0
- package/dist/document-ingest-foundation/report-ingest-progress.js +20 -0
- package/dist/document-ingest-foundation/tables.d.ts +3 -0
- package/dist/document-ingest-foundation/tables.js +26 -0
- 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/files-tenant-data/hooks.js +4 -1
- package/dist/folders/web/folder-manager.js +3 -10
- package/dist/folders/web/folder-section.js +1 -1
- package/dist/form-draft-user-data/index.js +4 -1
- package/dist/inbound-mail-foundation/entities.d.ts +3 -0
- package/dist/inbound-mail-foundation/entities.js +2 -0
- package/dist/inbound-mail-foundation/events.d.ts +2 -0
- package/dist/inbound-mail-foundation/events.js +2 -0
- package/dist/inbound-mail-foundation/feature.js +6 -6
- package/dist/inbound-mail-foundation/handlers/attach-message-content.write.js +3 -1
- package/dist/inbound-mail-foundation/handlers/ingest-message.write.js +5 -0
- package/dist/inbound-mail-foundation/handlers/list-messages.query.js +4 -2
- package/dist/inbound-mail-foundation/handlers/message-content.d.ts +1 -0
- package/dist/inbound-mail-foundation/handlers/message-content.js +8 -0
- package/dist/inbound-mail-foundation/handlers/message-content.query.d.ts +2 -0
- package/dist/inbound-mail-foundation/handlers/message-content.query.js +1 -0
- package/dist/inbound-mail-foundation/projection.d.ts +3 -0
- package/dist/inbound-mail-foundation/projection.js +2 -0
- package/dist/inbound-mail-foundation/sanitize-inbound-html.d.ts +2 -0
- package/dist/inbound-mail-foundation/sanitize-inbound-html.js +135 -0
- package/dist/inbound-mail-foundation/types.js +1 -0
- package/dist/jobs/job-run-logger.js +16 -20
- package/dist/ledger/handlers/reports.query.js +25 -27
- package/dist/ledger/recurring.js +1 -0
- 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/notes-history/web/notes-section.js +3 -2
- package/dist/personal-access-tokens/feature.js +5 -18
- package/dist/personal-access-tokens/handlers/create.write.js +2 -5
- package/dist/secrets/handlers/delete.write.d.ts +4 -0
- package/dist/secrets/handlers/delete.write.js +9 -4
- package/dist/secrets/handlers/list.query.d.ts +6 -1
- package/dist/secrets/handlers/list.query.js +7 -3
- package/dist/secrets/handlers/set.write.d.ts +4 -0
- package/dist/secrets/handlers/set.write.js +10 -4
- package/dist/secrets/secret-scope.d.ts +17 -0
- package/dist/secrets/secret-scope.js +18 -0
- package/dist/seo/handlers/seo-config.query.js +1 -1
- package/dist/sessions/feature.d.ts +3 -0
- package/dist/sessions/feature.js +13 -19
- package/dist/sessions/handlers/last-activity-probe.query.d.ts +7 -0
- package/dist/sessions/handlers/last-activity-probe.query.js +40 -0
- package/dist/sessions/handlers/last-activity-probe.route.d.ts +2 -0
- package/dist/sessions/handlers/last-activity-probe.route.js +30 -0
- package/dist/sessions/screens.js +1 -0
- package/dist/sessions/session-callbacks.d.ts +2 -0
- package/dist/sessions/session-callbacks.js +9 -7
- package/dist/sessions/web/i18n.js +4 -1
- package/dist/shared/assert-billing-live.d.ts +2 -0
- package/dist/shared/assert-billing-live.js +7 -0
- package/dist/shared/collect-extension-options.d.ts +1 -0
- package/dist/shared/collect-extension-options.js +8 -0
- package/dist/shared/index.d.ts +7 -1
- package/dist/shared/index.js +7 -1
- package/dist/shared/late-bound-slot.d.ts +5 -0
- package/dist/shared/late-bound-slot.js +13 -0
- package/dist/shared/mail-locale-templates.d.ts +1 -0
- package/dist/shared/mail-locale-templates.js +1 -1
- package/dist/shared/price-env-shape.d.ts +11 -0
- package/dist/shared/price-env-shape.js +15 -0
- package/dist/shared/purge-row-file-refs.d.ts +1 -0
- package/dist/shared/purge-row-file-refs.js +1 -1
- package/dist/shared/read-feature-export-fn.d.ts +2 -0
- package/dist/shared/read-feature-export-fn.js +11 -0
- package/dist/shared/signup-handover.js +3 -5
- package/dist/shared/tenant-destruction-hold.d.ts +23 -0
- package/dist/shared/tenant-destruction-hold.js +15 -0
- package/dist/shared/unprocessable.d.ts +4 -0
- package/dist/shared/unprocessable.js +4 -0
- package/dist/shared/web/index.d.ts +3 -0
- package/dist/shared/web/index.js +3 -0
- package/dist/subscription-paddle/checkout-config.query.js +1 -1
- package/dist/subscription-paddle/feature.d.ts +1 -5
- package/dist/subscription-paddle/feature.js +7 -9
- package/dist/subscription-paddle/runtime.js +3 -7
- package/dist/subscription-stripe/feature.d.ts +1 -5
- package/dist/subscription-stripe/feature.js +7 -9
- package/dist/subscription-stripe/runtime.js +3 -7
- package/dist/tags/entity.js +1 -0
- package/dist/tags/web/tag-chip.d.ts +7 -0
- package/dist/tags/web/tag-chip.js +4 -0
- package/dist/tags/web/tag-filter.js +2 -5
- package/dist/tags/web/tag-manager.js +1 -1
- package/dist/tags/web/tag-section.js +3 -6
- package/dist/tags/web/tags-cell.js +2 -5
- package/dist/template-resolver/compile-document-body.js +12 -17
- package/dist/template-resolver/handlers/by-slug.query.js +1 -1
- package/dist/template-resolver/handlers/by-tenant.query.js +4 -2
- package/dist/template-resolver/handlers/discard-draft.write.js +1 -0
- package/dist/template-resolver/handlers/overview.query.js +3 -1
- package/dist/template-resolver/handlers/send-test.write.js +2 -4
- package/dist/template-resolver/handlers/toggle-status.write.js +3 -0
- package/dist/template-resolver/linked-resources.js +6 -5
- package/dist/template-resolver/store-template-resource.js +5 -10
- package/dist/template-resolver/web/document-images.js +6 -6
- package/dist/template-resolver/web/document-insert-fields.js +22 -4
- package/dist/template-resolver/web/document-schema.js +11 -12
- package/dist/template-resolver/web/tiptap-attribute-parse-rule.d.ts +15 -0
- package/dist/template-resolver/web/tiptap-attribute-parse-rule.js +11 -0
- package/dist/tenant/i18n.js +3 -0
- package/dist/tenant/schema/tenant.d.ts +9 -7
- package/dist/tenant/schema/tenant.js +1 -0
- package/dist/tenant/web/member-roles-cell.js +1 -1
- package/dist/tenant/web/member-status-cell.js +1 -1
- package/dist/tenant-inactivity/check-inactive-tenants.d.ts +3 -0
- package/dist/tenant-inactivity/check-inactive-tenants.js +184 -0
- package/dist/tenant-inactivity/constants.d.ts +10 -0
- package/dist/tenant-inactivity/constants.js +10 -0
- package/dist/tenant-inactivity/email-templates.d.ts +3 -0
- package/dist/tenant-inactivity/email-templates.js +16 -0
- package/dist/tenant-inactivity/feature.d.ts +8 -0
- package/dist/tenant-inactivity/feature.js +45 -0
- package/dist/tenant-inactivity/handlers/inactivity-state.query.d.ts +11 -0
- package/dist/tenant-inactivity/handlers/inactivity-state.query.js +45 -0
- package/dist/tenant-inactivity/handlers/keep-account.write.d.ts +8 -0
- package/dist/tenant-inactivity/handlers/keep-account.write.js +51 -0
- package/dist/tenant-inactivity/inactivity-plan.d.ts +51 -0
- package/dist/tenant-inactivity/inactivity-plan.js +113 -0
- package/dist/tenant-inactivity/index.d.ts +5 -0
- package/dist/tenant-inactivity/index.js +3 -0
- package/dist/tenant-inactivity/keep-token.d.ts +16 -0
- package/dist/tenant-inactivity/keep-token.js +24 -0
- package/dist/tenant-inactivity/mail-notifications.d.ts +4 -0
- package/dist/tenant-inactivity/mail-notifications.js +42 -0
- package/dist/tenant-inactivity/options.d.ts +27 -0
- package/dist/tenant-inactivity/options.js +5 -0
- package/dist/tenant-inactivity/remote-activity.d.ts +15 -0
- package/dist/tenant-inactivity/remote-activity.js +24 -0
- package/dist/tenant-inactivity/state-store.d.ts +10 -0
- package/dist/tenant-inactivity/state-store.js +50 -0
- package/dist/tenant-inactivity/state-table.d.ts +109 -0
- package/dist/tenant-inactivity/state-table.js +38 -0
- package/dist/tenant-lifecycle/boot-checks.js +8 -3
- package/dist/tenant-lifecycle/boot-rules.d.ts +12 -0
- package/dist/tenant-lifecycle/boot-rules.js +12 -0
- package/dist/tenant-lifecycle/feature.js +17 -2
- package/dist/tenant-lifecycle/handlers/request-destruction.write.js +11 -67
- package/dist/tenant-lifecycle/index.d.ts +1 -0
- package/dist/tenant-lifecycle/index.js +1 -0
- package/dist/tenant-lifecycle/request-tenant-destruction.d.ts +20 -0
- package/dist/tenant-lifecycle/request-tenant-destruction.js +66 -0
- package/dist/tenant-lifecycle/retention-config-destroy-hooks.d.ts +5 -0
- package/dist/tenant-lifecycle/retention-config-destroy-hooks.js +29 -0
- package/dist/tenant-lifecycle/run-tenant-destroy.d.ts +3 -0
- package/dist/tenant-lifecycle/run-tenant-destroy.js +43 -5
- package/dist/tenant-lifecycle/stages.d.ts +2 -0
- package/dist/tenant-lifecycle/stages.js +23 -2
- package/dist/tenant-lifecycle/testing.js +1 -1
- package/dist/tier-engine/caps-for-tier-from-map.d.ts +5 -0
- package/dist/tier-engine/caps-for-tier-from-map.js +12 -0
- package/dist/tier-engine/compose-app.d.ts +0 -22
- package/dist/tier-engine/compose-app.js +9 -16
- package/dist/tier-engine/index.d.ts +1 -0
- package/dist/tier-engine/index.js +1 -0
- package/dist/user/handlers/detail.query.d.ts +1 -1
- package/dist/user-data-rights/feature.js +2 -0
- package/dist/user-data-rights/handlers/confirm-deletion-by-token.write.js +4 -1
- package/dist/user-data-rights/handlers/download-by-token.query.js +1 -0
- package/dist/user-data-rights/handlers/request-deletion-by-email.write.js +4 -1
- package/dist/user-data-rights/run-forget-cleanup.js +2 -0
- package/dist/user-data-rights/web/privacy-center-screen.js +1 -1
- package/dist/user-data-rights/zip-path.js +1 -0
- package/dist/user-data-rights-defaults/hooks/config-value.userdata-hook.d.ts +1 -1
- package/dist/user-data-rights-defaults/hooks/config-value.userdata-hook.js +7 -20
- package/dist/user-data-rights-defaults/hooks/delivery-attempt.userdata-hook.js +3 -1
- package/dist/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.d.ts +10 -0
- package/dist/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.js +26 -0
- package/dist/user-data-rights-defaults/hooks/notification-preference.userdata-hook.d.ts +1 -1
- package/dist/user-data-rights-defaults/hooks/notification-preference.userdata-hook.js +7 -20
- package/dist/user-profile/handlers/change-email.write.js +2 -4
- package/dist/user-profile/web/profile-screen.js +2 -3
- package/dist/waitlist/handlers/submit.write.js +1 -2
- package/kumiko-es-tables.json +12 -0
- package/package.json +54 -12
- package/src/admin-shell/changes.json +6 -0
- package/src/agent-tools/changes.json +6 -0
- package/src/channel-in-app/changes.json +7 -0
- package/src/contact/changes.json +33 -0
- package/src/data-retention/changes.json +6 -0
- package/src/delivery/changes.json +7 -0
- package/src/document-ingest-foundation/changes.json +6 -0
- package/src/files-tenant-data/changes.json +6 -0
- package/src/inbound-mail-foundation/changes.json +13 -0
- package/src/secrets/changes.json +6 -0
- package/src/sessions/changes.json +6 -0
- package/src/tenant-inactivity/changes.json +8 -0
- package/src/tenant-lifecycle/changes.json +18 -0
- package/src/tier-engine/changes.json +6 -0
- package/src/waitlist/changes.json +6 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export declare const CONTACT_FEATURE: "contact";
|
|
2
|
+
export declare const CONTACT_KIND: {
|
|
3
|
+
readonly Question: "question";
|
|
4
|
+
readonly Contact: "contact";
|
|
5
|
+
readonly Bug: "bug";
|
|
6
|
+
readonly Wish: "wish";
|
|
7
|
+
};
|
|
8
|
+
export type ContactKind = (typeof CONTACT_KIND)[keyof typeof CONTACT_KIND];
|
|
9
|
+
export declare const CONTACT_WEBSITE_KINDS: readonly ["question", "contact", "bug"];
|
|
10
|
+
export declare const CONTACT_ADMIN_KINDS: readonly ["question", "bug", "wish"];
|
|
11
|
+
export declare const CONTACT_STATUS: {
|
|
12
|
+
readonly Open: "open";
|
|
13
|
+
readonly Answered: "answered";
|
|
14
|
+
readonly Done: "done";
|
|
15
|
+
};
|
|
16
|
+
export type ContactStatus = (typeof CONTACT_STATUS)[keyof typeof CONTACT_STATUS];
|
|
17
|
+
export declare const CONTACT_SOURCE: {
|
|
18
|
+
readonly Website: "website";
|
|
19
|
+
readonly Admin: "admin";
|
|
20
|
+
};
|
|
21
|
+
export type ContactSource = (typeof CONTACT_SOURCE)[keyof typeof CONTACT_SOURCE];
|
|
22
|
+
export declare const CONTACT_REPLY_CHANNELS: {
|
|
23
|
+
readonly Email: "email";
|
|
24
|
+
readonly EmailAndInApp: "email+inApp";
|
|
25
|
+
};
|
|
26
|
+
export type ContactReplyChannels = (typeof CONTACT_REPLY_CHANNELS)[keyof typeof CONTACT_REPLY_CHANNELS];
|
|
27
|
+
export declare const CONTACT_ORIGIN: {
|
|
28
|
+
readonly Website: "website";
|
|
29
|
+
readonly AdminReport: "admin-report";
|
|
30
|
+
};
|
|
31
|
+
export type ContactOrigin = (typeof CONTACT_ORIGIN)[keyof typeof CONTACT_ORIGIN];
|
|
32
|
+
export declare const CONTACT_DELIVERY_CHANNEL: {
|
|
33
|
+
readonly Email: "email";
|
|
34
|
+
readonly Telegram: "telegram";
|
|
35
|
+
readonly ReplyEmail: "reply-email";
|
|
36
|
+
readonly ReplyInApp: "reply-in-app";
|
|
37
|
+
};
|
|
38
|
+
export type ContactDeliveryChannel = (typeof CONTACT_DELIVERY_CHANNEL)[keyof typeof CONTACT_DELIVERY_CHANNEL];
|
|
39
|
+
export declare const CONTACT_DELIVERY_STATUS: {
|
|
40
|
+
readonly Pending: "pending";
|
|
41
|
+
readonly Delivered: "delivered";
|
|
42
|
+
readonly Failed: "failed";
|
|
43
|
+
readonly Skipped: "skipped";
|
|
44
|
+
readonly Read: "read";
|
|
45
|
+
};
|
|
46
|
+
export type ContactDeliveryStatus = (typeof CONTACT_DELIVERY_STATUS)[keyof typeof CONTACT_DELIVERY_STATUS];
|
|
47
|
+
export type ContactPhoneMode = "off" | "optional" | "required";
|
|
48
|
+
export declare const ContactHandlers: {
|
|
49
|
+
readonly submit: "contact:write:submit";
|
|
50
|
+
readonly report: "contact:write:report";
|
|
51
|
+
readonly reply: "contact:write:reply";
|
|
52
|
+
readonly markDone: "contact:write:mark-done";
|
|
53
|
+
readonly sendTest: "contact:write:send-test";
|
|
54
|
+
readonly forwardRequest: "contact:write:forward-request";
|
|
55
|
+
readonly sendReplyMail: "contact:write:send-reply-mail";
|
|
56
|
+
readonly notifyReporterInApp: "contact:write:notify-reporter-in-app";
|
|
57
|
+
};
|
|
58
|
+
export declare const ContactQueries: {
|
|
59
|
+
readonly challenge: "contact:query:challenge";
|
|
60
|
+
readonly openCount: "contact:query:open-count";
|
|
61
|
+
readonly requestDetail: "contact:query:request-detail";
|
|
62
|
+
readonly replies: "contact:query:replies";
|
|
63
|
+
readonly requestDelivery: "contact:query:request-delivery";
|
|
64
|
+
readonly requestList: "contact:query:contact-request:list";
|
|
65
|
+
};
|
|
66
|
+
export declare const ContactScreens: {
|
|
67
|
+
readonly requestList: "contact:screen:request-list";
|
|
68
|
+
readonly requestDetail: "contact:screen:request-detail";
|
|
69
|
+
readonly report: "contact:screen:report";
|
|
70
|
+
readonly reply: "contact:screen:reply";
|
|
71
|
+
readonly replyMail: "contact:screen:reply-mail";
|
|
72
|
+
readonly forwarding: "contact:screen:forwarding";
|
|
73
|
+
};
|
|
74
|
+
export declare const CONTACT_UPLOAD_FIELD: "fileIds";
|
|
75
|
+
export declare const ContactConfigKeys: {
|
|
76
|
+
readonly replyTo: "contact:config:reply-to";
|
|
77
|
+
readonly telegramChat: "contact:config:telegram-chat";
|
|
78
|
+
};
|
|
79
|
+
export declare const ContactErrors: {
|
|
80
|
+
readonly telegramChatMissing: "telegram_chat_missing";
|
|
81
|
+
readonly telegramTestFailed: "telegram_test_failed";
|
|
82
|
+
readonly notFound: "contact_request_not_found";
|
|
83
|
+
readonly phoneNotAllowed: "contact_phone_not_allowed";
|
|
84
|
+
readonly phoneRequired: "contact_phone_required";
|
|
85
|
+
readonly reporterEmailMissing: "contact_reporter_email_missing";
|
|
86
|
+
readonly attachmentNotFound: "contact_attachment_not_found";
|
|
87
|
+
};
|
|
88
|
+
export declare const CONTACT_NOTIFICATION_TYPES: {
|
|
89
|
+
readonly newRequest: "contact:notify:new-request";
|
|
90
|
+
readonly confirmation: "contact:notify:confirmation";
|
|
91
|
+
readonly acknowledgement: "contact:notify:acknowledgement";
|
|
92
|
+
readonly reply: "contact:notify:reply";
|
|
93
|
+
readonly replyInApp: "contact:notify:reply-in-app";
|
|
94
|
+
readonly test: "contact:notify:test";
|
|
95
|
+
};
|
|
96
|
+
export declare const CONTACT_CLIENT_PATH: "/contact/client.js";
|
|
97
|
+
export declare const CONTACT_FIELD_LIMITS: {
|
|
98
|
+
readonly name: 120;
|
|
99
|
+
readonly email: 254;
|
|
100
|
+
readonly phone: 40;
|
|
101
|
+
readonly subject: 200;
|
|
102
|
+
readonly message: 5000;
|
|
103
|
+
readonly locale: 35;
|
|
104
|
+
readonly honeypot: 500;
|
|
105
|
+
readonly page: 300;
|
|
106
|
+
readonly challenge: 64;
|
|
107
|
+
readonly nonce: 32;
|
|
108
|
+
};
|
|
109
|
+
export declare const CONTACT_MAX_FILES = 5;
|
|
110
|
+
export declare const CONTACT_SUBJECT_MAX_CHARS = 80;
|
|
111
|
+
export declare const CONTACT_POW_BITS: {
|
|
112
|
+
readonly min: 8;
|
|
113
|
+
readonly max: 26;
|
|
114
|
+
readonly default: 19;
|
|
115
|
+
};
|
|
116
|
+
export declare const CONTACT_DEFAULT_MIN_SUBMIT_SECONDS = 3;
|
|
117
|
+
export declare const CONTACT_DEFAULT_CHALLENGE_TTL_MINUTES = 30;
|
|
118
|
+
export declare const CONTACT_CHALLENGE_REDIS_PREFIX: "contact:challenge:";
|
|
119
|
+
export declare const CONTACT_REQUEST_ENTITY: "contact-request";
|
|
120
|
+
export declare const CONTACT_REPLY_ENTITY: "contact-reply";
|
|
121
|
+
export declare const contactIdempotencyKeys: {
|
|
122
|
+
readonly admins: (requestId: string) => string;
|
|
123
|
+
readonly telegram: (requestId: string) => string;
|
|
124
|
+
readonly confirmation: (requestId: string) => string;
|
|
125
|
+
readonly reply: (replyId: string) => string;
|
|
126
|
+
readonly replyInApp: (replyId: string) => string;
|
|
127
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Pure string constants, safe for browser code (see waitlist/web/constants.ts).
|
|
2
|
+
export const CONTACT_FEATURE = "contact";
|
|
3
|
+
export const CONTACT_KIND = {
|
|
4
|
+
Question: "question",
|
|
5
|
+
Contact: "contact",
|
|
6
|
+
Bug: "bug",
|
|
7
|
+
Wish: "wish",
|
|
8
|
+
};
|
|
9
|
+
export const CONTACT_WEBSITE_KINDS = [
|
|
10
|
+
CONTACT_KIND.Question,
|
|
11
|
+
CONTACT_KIND.Contact,
|
|
12
|
+
CONTACT_KIND.Bug,
|
|
13
|
+
];
|
|
14
|
+
export const CONTACT_ADMIN_KINDS = [
|
|
15
|
+
CONTACT_KIND.Question,
|
|
16
|
+
CONTACT_KIND.Bug,
|
|
17
|
+
CONTACT_KIND.Wish,
|
|
18
|
+
];
|
|
19
|
+
export const CONTACT_STATUS = {
|
|
20
|
+
Open: "open",
|
|
21
|
+
Answered: "answered",
|
|
22
|
+
Done: "done",
|
|
23
|
+
};
|
|
24
|
+
export const CONTACT_SOURCE = {
|
|
25
|
+
Website: "website",
|
|
26
|
+
Admin: "admin",
|
|
27
|
+
};
|
|
28
|
+
export const CONTACT_REPLY_CHANNELS = {
|
|
29
|
+
Email: "email",
|
|
30
|
+
EmailAndInApp: "email+inApp",
|
|
31
|
+
};
|
|
32
|
+
export const CONTACT_ORIGIN = {
|
|
33
|
+
Website: "website",
|
|
34
|
+
AdminReport: "admin-report",
|
|
35
|
+
};
|
|
36
|
+
export const CONTACT_DELIVERY_CHANNEL = {
|
|
37
|
+
Email: "email",
|
|
38
|
+
Telegram: "telegram",
|
|
39
|
+
ReplyEmail: "reply-email",
|
|
40
|
+
ReplyInApp: "reply-in-app",
|
|
41
|
+
};
|
|
42
|
+
export const CONTACT_DELIVERY_STATUS = {
|
|
43
|
+
Pending: "pending",
|
|
44
|
+
Delivered: "delivered",
|
|
45
|
+
Failed: "failed",
|
|
46
|
+
Skipped: "skipped",
|
|
47
|
+
Read: "read",
|
|
48
|
+
};
|
|
49
|
+
export const ContactHandlers = {
|
|
50
|
+
submit: "contact:write:submit",
|
|
51
|
+
report: "contact:write:report",
|
|
52
|
+
reply: "contact:write:reply",
|
|
53
|
+
markDone: "contact:write:mark-done",
|
|
54
|
+
sendTest: "contact:write:send-test",
|
|
55
|
+
forwardRequest: "contact:write:forward-request",
|
|
56
|
+
sendReplyMail: "contact:write:send-reply-mail",
|
|
57
|
+
notifyReporterInApp: "contact:write:notify-reporter-in-app",
|
|
58
|
+
};
|
|
59
|
+
export const ContactQueries = {
|
|
60
|
+
challenge: "contact:query:challenge",
|
|
61
|
+
openCount: "contact:query:open-count",
|
|
62
|
+
requestDetail: "contact:query:request-detail",
|
|
63
|
+
replies: "contact:query:replies",
|
|
64
|
+
requestDelivery: "contact:query:request-delivery",
|
|
65
|
+
// Entity-convention list QN: entityList screens resolve their query by this shape.
|
|
66
|
+
requestList: "contact:query:contact-request:list",
|
|
67
|
+
};
|
|
68
|
+
export const ContactScreens = {
|
|
69
|
+
requestList: "contact:screen:request-list",
|
|
70
|
+
requestDetail: "contact:screen:request-detail",
|
|
71
|
+
report: "contact:screen:report",
|
|
72
|
+
reply: "contact:screen:reply",
|
|
73
|
+
replyMail: "contact:screen:reply-mail",
|
|
74
|
+
forwarding: "contact:screen:forwarding",
|
|
75
|
+
};
|
|
76
|
+
// Files field of both upload forms (report, reply); the uploads are pending under the screen QN.
|
|
77
|
+
export const CONTACT_UPLOAD_FIELD = "fileIds";
|
|
78
|
+
export const ContactConfigKeys = {
|
|
79
|
+
replyTo: "contact:config:reply-to",
|
|
80
|
+
telegramChat: "contact:config:telegram-chat",
|
|
81
|
+
};
|
|
82
|
+
export const ContactErrors = {
|
|
83
|
+
telegramChatMissing: "telegram_chat_missing",
|
|
84
|
+
telegramTestFailed: "telegram_test_failed",
|
|
85
|
+
notFound: "contact_request_not_found",
|
|
86
|
+
phoneNotAllowed: "contact_phone_not_allowed",
|
|
87
|
+
phoneRequired: "contact_phone_required",
|
|
88
|
+
reporterEmailMissing: "contact_reporter_email_missing",
|
|
89
|
+
attachmentNotFound: "contact_attachment_not_found",
|
|
90
|
+
};
|
|
91
|
+
export const CONTACT_NOTIFICATION_TYPES = {
|
|
92
|
+
newRequest: "contact:notify:new-request",
|
|
93
|
+
confirmation: "contact:notify:confirmation",
|
|
94
|
+
acknowledgement: "contact:notify:acknowledgement",
|
|
95
|
+
reply: "contact:notify:reply",
|
|
96
|
+
replyInApp: "contact:notify:reply-in-app",
|
|
97
|
+
test: "contact:notify:test",
|
|
98
|
+
};
|
|
99
|
+
export const CONTACT_CLIENT_PATH = "/contact/client.js";
|
|
100
|
+
export const CONTACT_FIELD_LIMITS = {
|
|
101
|
+
name: 120,
|
|
102
|
+
email: 254,
|
|
103
|
+
phone: 40,
|
|
104
|
+
subject: 200,
|
|
105
|
+
message: 5000,
|
|
106
|
+
locale: 35,
|
|
107
|
+
honeypot: 500,
|
|
108
|
+
page: 300,
|
|
109
|
+
challenge: 64,
|
|
110
|
+
nonce: 32,
|
|
111
|
+
};
|
|
112
|
+
export const CONTACT_MAX_FILES = 5;
|
|
113
|
+
export const CONTACT_SUBJECT_MAX_CHARS = 80;
|
|
114
|
+
export const CONTACT_POW_BITS = { min: 8, max: 26, default: 19 };
|
|
115
|
+
export const CONTACT_DEFAULT_MIN_SUBMIT_SECONDS = 3;
|
|
116
|
+
export const CONTACT_DEFAULT_CHALLENGE_TTL_MINUTES = 30;
|
|
117
|
+
export const CONTACT_CHALLENGE_REDIS_PREFIX = "contact:challenge:";
|
|
118
|
+
export const CONTACT_REQUEST_ENTITY = "contact-request";
|
|
119
|
+
export const CONTACT_REPLY_ENTITY = "contact-reply";
|
|
120
|
+
export const contactIdempotencyKeys = {
|
|
121
|
+
admins: (requestId) => `contact:request:${requestId}:admins`,
|
|
122
|
+
telegram: (requestId) => `contact:request:${requestId}:telegram`,
|
|
123
|
+
confirmation: (requestId) => `contact:request:${requestId}:confirmation`,
|
|
124
|
+
reply: (replyId) => `contact:reply:${replyId}`,
|
|
125
|
+
replyInApp: (replyId) => `contact:reply:${replyId}:in-app`,
|
|
126
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CONTACT_ADMIN_KINDS, CONTACT_CLIENT_PATH, CONTACT_DELIVERY_CHANNEL, CONTACT_DELIVERY_STATUS, CONTACT_FEATURE, CONTACT_FIELD_LIMITS, CONTACT_KIND, CONTACT_NOTIFICATION_TYPES, CONTACT_ORIGIN, CONTACT_REPLY_CHANNELS, CONTACT_SOURCE, CONTACT_STATUS, CONTACT_SUBJECT_MAX_CHARS, CONTACT_WEBSITE_KINDS, ContactConfigKeys, type ContactDeliveryChannel, type ContactDeliveryStatus, ContactErrors, ContactHandlers, type ContactKind, type ContactOrigin, type ContactPhoneMode, ContactQueries, type ContactReplyChannels, ContactScreens, type ContactSource, type ContactStatus, } from "./constants.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CONTACT_ADMIN_KINDS, CONTACT_CLIENT_PATH, CONTACT_DELIVERY_CHANNEL, CONTACT_DELIVERY_STATUS, CONTACT_FEATURE, CONTACT_FIELD_LIMITS, CONTACT_KIND, CONTACT_NOTIFICATION_TYPES, CONTACT_ORIGIN, CONTACT_REPLY_CHANNELS, CONTACT_SOURCE, CONTACT_STATUS, CONTACT_SUBJECT_MAX_CHARS, CONTACT_WEBSITE_KINDS, ContactConfigKeys, ContactErrors, ContactHandlers, ContactQueries, ContactScreens, } from "./constants.js";
|
|
@@ -2,7 +2,7 @@ import { requestContext } from "@cosmicdrift/kumiko-framework/api";
|
|
|
2
2
|
import { ROLES } from "@cosmicdrift/kumiko-framework/auth";
|
|
3
3
|
import { computeBlindIndex, configuredBlindIndexKey, configuredPiiSubjectKms, subjectIdSchema, subjectIdToKey, } from "@cosmicdrift/kumiko-framework/crypto";
|
|
4
4
|
import { fetchOne, nullBlindIndexesForSubject, recordEventsOwnedExclusivelyByTenant, recordRowExistsInTenant, recordRowOwningTenantId, runInSavepointIfSupported, runnerCanBeginTransaction, subjectRowExistsInTenant, transaction, WritePurposes, } from "@cosmicdrift/kumiko-framework/db";
|
|
5
|
-
import { defineWriteHandler, parseTenantId, } from "@cosmicdrift/kumiko-framework/engine";
|
|
5
|
+
import { defineWriteHandler, findEntity, parseTenantId, } from "@cosmicdrift/kumiko-framework/engine";
|
|
6
6
|
import { AccessDeniedError, InternalError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
|
|
7
7
|
import { appendDomainEventCore, assertIrreversibleOperationAllowed, } from "@cosmicdrift/kumiko-framework/pipeline";
|
|
8
8
|
import { purgeSearchDocumentsForSubject } from "@cosmicdrift/kumiko-framework/search";
|
|
@@ -53,16 +53,6 @@ function subjectAggregateId(raw) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
// The record subject names its own entity — resolve it against the registry
|
|
57
|
-
// instead of trusting the payload straight into resolveTableName/SQL.
|
|
58
|
-
function findRegisteredEntity(features, entityName) {
|
|
59
|
-
for (const feature of features.values()) {
|
|
60
|
-
const entity = feature.entities?.[entityName];
|
|
61
|
-
if (entity)
|
|
62
|
-
return entity;
|
|
63
|
-
}
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
56
|
// Tenant-scope guard: DataProtectionOfficer is a tenant-scoped role,
|
|
67
57
|
// but the handler otherwise erases ANY subject cross-tenant on a raw
|
|
68
58
|
// (un-scoped) client — a Tenant-A DPO who learns a Tenant-B subject id
|
|
@@ -81,7 +71,9 @@ async function resolveTenantScopeDenial(db, features, user, raw) {
|
|
|
81
71
|
// feature there is no tenant concept to enforce.
|
|
82
72
|
if (!features.has("tenant"))
|
|
83
73
|
return undefined;
|
|
84
|
-
|
|
74
|
+
// The record subject names its own entity — resolve it against the registry
|
|
75
|
+
// instead of trusting the payload straight into resolveTableName/SQL.
|
|
76
|
+
const entity = findEntity(features, raw.entity);
|
|
85
77
|
const rowInTenant = entity !== undefined &&
|
|
86
78
|
(await recordRowExistsInTenant(db, features, raw.entity, raw.id, user.tenantId));
|
|
87
79
|
if (rowInTenant)
|
|
@@ -126,7 +118,7 @@ getRunner) {
|
|
|
126
118
|
return undefined;
|
|
127
119
|
const features = ctx.registry.features;
|
|
128
120
|
const deny = () => writeFailure(new AccessDeniedError({ details: { reason: TARGET_RECORD_RETENTION_BLOCK_DELETE } }));
|
|
129
|
-
const entity =
|
|
121
|
+
const entity = findEntity(features, raw.entity);
|
|
130
122
|
if (entity?.retention?.strategy === "blockDelete")
|
|
131
123
|
return deny();
|
|
132
124
|
if (!features.has("data-retention"))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineFeature } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { findTenantDestructionHoldProvider } from "../shared/index.js";
|
|
2
3
|
import { policyForQuery } from "./handlers/policy-for.query.js";
|
|
3
4
|
import { resolveTenantRetentionPreset } from "./resolve-tenant-preset.js";
|
|
4
5
|
import { runRetentionCleanup } from "./run-retention-cleanup.js";
|
|
@@ -56,21 +57,34 @@ export function createDataRetentionFeature() {
|
|
|
56
57
|
// skip: cron fired without a perTenant fan-out tenant — nothing scoped
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
const T = (await import("@cosmicdrift/kumiko-framework/time")).getTemporal();
|
|
60
60
|
const cleanupDb = ctx.db.unsafeRaw(); // @cast-boundary db-operator — jobs never run inside a DbTx
|
|
61
61
|
const tenantPreset = await resolveTenantRetentionPreset({
|
|
62
62
|
db: cleanupDb,
|
|
63
63
|
registry: ctx.registry,
|
|
64
64
|
tenantId,
|
|
65
65
|
});
|
|
66
|
+
const now = ctx.tz.now();
|
|
67
|
+
const destructionHold = findTenantDestructionHoldProvider(ctx.registry);
|
|
68
|
+
const parked = destructionHold
|
|
69
|
+
? await destructionHold.isParked({ db: cleanupDb, tenantId })
|
|
70
|
+
: false;
|
|
66
71
|
const result = await runRetentionCleanup({
|
|
67
72
|
db: cleanupDb,
|
|
68
73
|
registry: ctx.registry,
|
|
69
74
|
tenantId,
|
|
70
75
|
preloadedTenantPreset: tenantPreset,
|
|
71
|
-
now
|
|
76
|
+
now,
|
|
77
|
+
purgeExpiredBlockDelete: parked,
|
|
72
78
|
files: ctx.services.files,
|
|
73
79
|
});
|
|
80
|
+
if (destructionHold && parked) {
|
|
81
|
+
await destructionHold.releaseIfFree({
|
|
82
|
+
db: cleanupDb,
|
|
83
|
+
registry: ctx.registry,
|
|
84
|
+
tenantId,
|
|
85
|
+
now,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
74
88
|
if (result.skipped.length > 0) {
|
|
75
89
|
// biome-ignore lint/suspicious/noConsole: operator-visibility for skipped entities
|
|
76
90
|
console.warn(`[data-retention:retention-cleanup] tenant=${tenantId} skipped=${result.skipped.map((s) => `${s.entityName}:${s.reason}`).join(",")}`);
|
|
@@ -2,3 +2,4 @@ export type { EffectiveRetentionPolicy, ResolveForTenantArgs, ResolveRetentionPo
|
|
|
2
2
|
export { createDataRetentionFeature, RETENTION_PRESETS, resolveRetentionPolicy, resolveRetentionPolicyForTenant, resolveTenantRetentionPreset, retentionOverrideSchema, SELECTABLE_RETENTION_PRESETS, tenantRetentionOverrideEntity, tenantRetentionOverrideTable, } from "./feature.ts";
|
|
3
3
|
export { computeCutoff, type Instant } from "./keep-for.ts";
|
|
4
4
|
export { type RetentionCleanupSkip, type RunRetentionCleanupArgs, type RunRetentionCleanupResult, runRetentionCleanup, } from "./run-retention-cleanup.ts";
|
|
5
|
+
export { type DestructionHold, holdBlockDeleteRowsForDestruction, tenantHasBlockDeleteRows, } from "./tenant-destruction-hold.ts";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { createDataRetentionFeature, RETENTION_PRESETS, resolveRetentionPolicy, resolveRetentionPolicyForTenant, resolveTenantRetentionPreset, retentionOverrideSchema, SELECTABLE_RETENTION_PRESETS, tenantRetentionOverrideEntity, tenantRetentionOverrideTable, } from "./feature.js";
|
|
2
2
|
export { computeCutoff } from "./keep-for.js";
|
|
3
3
|
export { runRetentionCleanup, } from "./run-retention-cleanup.js";
|
|
4
|
+
export { holdBlockDeleteRowsForDestruction, tenantHasBlockDeleteRows, } from "./tenant-destruction-hold.js";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type KmsAdapter } from "@cosmicdrift/kumiko-framework/crypto";
|
|
2
|
-
import { type DbRunner } from "@cosmicdrift/kumiko-framework/db";
|
|
3
|
-
import { type Registry, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { type DbRunner, selectMany, type WhereObject } from "@cosmicdrift/kumiko-framework/db";
|
|
3
|
+
import { type EntityId, type Registry, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
4
4
|
import { type FileContext } from "@cosmicdrift/kumiko-framework/files";
|
|
5
5
|
import { type Instant } from "./keep-for.ts";
|
|
6
6
|
import type { RetentionPresetKey } from "./presets.ts";
|
|
7
|
+
export declare const DEFAULT_REFERENCE_FIELD = "createdAt";
|
|
8
|
+
export declare const FRAMEWORK_REFERENCE_ALIAS: Readonly<Record<string, string>>;
|
|
7
9
|
export interface RunRetentionCleanupArgs {
|
|
8
10
|
readonly db: DbRunner;
|
|
9
11
|
readonly registry: Registry;
|
|
@@ -16,6 +18,9 @@ export interface RunRetentionCleanupArgs {
|
|
|
16
18
|
*/
|
|
17
19
|
readonly now: Instant;
|
|
18
20
|
readonly batchLimit?: number;
|
|
21
|
+
/** Tenant is being destroyed and only kept alive by its blockDelete rows: expired ones are
|
|
22
|
+
* deleted instead of anonymized. */
|
|
23
|
+
readonly purgeExpiredBlockDelete?: boolean;
|
|
19
24
|
/** Storage access for hardDelete entities with file/image/files/images fields.
|
|
20
25
|
* Missing while fileRefs are due → the row stays (skipped "missing_file_storage"),
|
|
21
26
|
* fail-closed instead of orphaning bytes. */
|
|
@@ -41,4 +46,11 @@ export interface RunRetentionCleanupResult {
|
|
|
41
46
|
*/
|
|
42
47
|
readonly skipped: readonly RetentionCleanupSkip[];
|
|
43
48
|
}
|
|
49
|
+
export declare function resolveAnonymizeTargets(fields: Readonly<Record<string, unknown>>): Promise<Record<string, unknown> | null>;
|
|
50
|
+
export declare function anonymizeMatchingRows(db: DbRunner, table: Parameters<typeof selectMany>[1], where: WhereObject, batchLimit: number, targets: Record<string, unknown>, op: (id: EntityId, changes: Record<string, unknown>) => Promise<{
|
|
51
|
+
readonly isSuccess: boolean;
|
|
52
|
+
}>): Promise<number>;
|
|
53
|
+
export declare function loadOverrideByEntity(db: DbRunner, tenantId: TenantId): Promise<ReadonlyMap<string, {
|
|
54
|
+
config: string | null;
|
|
55
|
+
}>>;
|
|
44
56
|
export declare function runRetentionCleanup(args: RunRetentionCleanupArgs): Promise<RunRetentionCleanupResult>;
|
|
@@ -36,19 +36,21 @@
|
|
|
36
36
|
// daily rerun appends zero events. The WHERE continues to match anonymized
|
|
37
37
|
// rows (reference remains old), hence id-cursor paging instead of a single
|
|
38
38
|
// page — otherwise completed rows clog the batchLimit window.
|
|
39
|
-
import { collectPiiSubjectFields, configuredPiiSubjectKms, isRecordKeyedField, isSelfPiiField, resolveSubjectForField, subjectIdToKey, } from "@cosmicdrift/kumiko-framework/crypto";
|
|
39
|
+
import { collectPiiSubjectFields, configuredPiiSubjectKms, isPiiCiphertext, isRecordKeyedField, isSelfPiiField, PII_ERASED_SENTINEL, resolveSubjectForField, subjectIdToKey, } from "@cosmicdrift/kumiko-framework/crypto";
|
|
40
40
|
import { createEventStoreExecutor, createTenantDb, nullBlindIndexesForSubject, selectMany, WritePurposes, } from "@cosmicdrift/kumiko-framework/db";
|
|
41
41
|
import { deleteFileRefBytes } from "@cosmicdrift/kumiko-framework/derivatives";
|
|
42
42
|
import { createSystemUser, entityHasAnonymizableSubjectField, } from "@cosmicdrift/kumiko-framework/engine";
|
|
43
43
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
44
44
|
import { fileRefEntity, fileRefsTable, } from "@cosmicdrift/kumiko-framework/files";
|
|
45
|
+
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
45
46
|
import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
46
|
-
import { collectSingleFileHolders, planFileFields, purgeRowFileRefs, runInSubTransaction, } from "../shared/index.js";
|
|
47
|
+
import { collectSingleFileHolders, decryptStoredPii, planFileFields, purgeRowFileRefs, runInSubTransaction, } from "../shared/index.js";
|
|
47
48
|
import { computeCutoff } from "./keep-for.js";
|
|
48
49
|
import { resolveRetentionPolicyForTenant } from "./resolve-for-tenant.js";
|
|
49
50
|
import { tenantRetentionOverrideTable } from "./schema/tenant-retention-override.js";
|
|
51
|
+
const log = createFallbackLogger("data-retention");
|
|
50
52
|
const DEFAULT_BATCH_LIMIT = 1000;
|
|
51
|
-
const DEFAULT_REFERENCE_FIELD = "createdAt";
|
|
53
|
+
export const DEFAULT_REFERENCE_FIELD = "createdAt";
|
|
52
54
|
// The boot validator (boot-validator/pii-retention.ts FRAMEWORK_TIMESTAMP_FIELDS)
|
|
53
55
|
// permits these aliases as retention.reference even when they are not declared in
|
|
54
56
|
// entity.fields, but the physical columns use different names
|
|
@@ -56,7 +58,7 @@ const DEFAULT_REFERENCE_FIELD = "createdAt";
|
|
|
56
58
|
// during cleanup; otherwise the column existence check below would cause the cron
|
|
57
59
|
// to do nothing silently. deletedAt/lastSeenAt are real fields (softDelete and
|
|
58
60
|
// session respectively) and need no translation.
|
|
59
|
-
const FRAMEWORK_REFERENCE_ALIAS = {
|
|
61
|
+
export const FRAMEWORK_REFERENCE_ALIAS = {
|
|
60
62
|
createdAt: "insertedAt",
|
|
61
63
|
updatedAt: "modifiedAt",
|
|
62
64
|
};
|
|
@@ -184,7 +186,14 @@ async function purgeHardDeleteRowWithFiles(args) {
|
|
|
184
186
|
table: args.table,
|
|
185
187
|
fileHolders: args.fileHolders,
|
|
186
188
|
row: args.row,
|
|
187
|
-
deleteBytes: files
|
|
189
|
+
deleteBytes: files
|
|
190
|
+
? (key) => deleteFileFailingClosed(key, files, logContext)
|
|
191
|
+
: args.deleteWithoutFileStorage
|
|
192
|
+
? async (key) => {
|
|
193
|
+
log.warn(`${logContext} no file storage wired, bytes of ${key} are not deleted`);
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
: undefined,
|
|
188
197
|
fileRefForget: async (fileRefId) => (await args.fileRefExecutor.forget({ id: fileRefId }, args.systemUser, args.tdb)).isSuccess,
|
|
189
198
|
onBytesDeleteFailed: (failedKeys) => {
|
|
190
199
|
// biome-ignore lint/suspicious/noConsole: operator-visibility for storage-cleanup failures
|
|
@@ -259,6 +268,7 @@ async function purgeHardDeleteRowsWithFiles(args) {
|
|
|
259
268
|
tdb: args.tdb,
|
|
260
269
|
kms: args.kms,
|
|
261
270
|
registry: args.registry,
|
|
271
|
+
deleteWithoutFileStorage: args.deleteWithoutFileStorage,
|
|
262
272
|
onSkip,
|
|
263
273
|
});
|
|
264
274
|
if (ok)
|
|
@@ -272,7 +282,7 @@ async function purgeHardDeleteRowsWithFiles(args) {
|
|
|
272
282
|
// Evaluate the entity's per-field anonymize functions ONCE — they are
|
|
273
283
|
// row-independent by signature, so the result doubles as the idempotency
|
|
274
284
|
// probe: a row already carrying these values needs no event.
|
|
275
|
-
async function resolveAnonymizeTargets(fields) {
|
|
285
|
+
export async function resolveAnonymizeTargets(fields) {
|
|
276
286
|
const targets = {};
|
|
277
287
|
for (const [name, field] of Object.entries(fields)) {
|
|
278
288
|
const annot = field; // @cast-boundary schema-walk
|
|
@@ -281,8 +291,18 @@ async function resolveAnonymizeTargets(fields) {
|
|
|
281
291
|
}
|
|
282
292
|
return Object.keys(targets).length > 0 ? targets : null;
|
|
283
293
|
}
|
|
284
|
-
|
|
285
|
-
|
|
294
|
+
// Encrypted PII is stored as ciphertext, so the diff has to compare the decrypted value; an erased
|
|
295
|
+
// subject key reads back as the sentinel and counts as anonymized already.
|
|
296
|
+
async function rowNeedsAnonymize(row, targets) {
|
|
297
|
+
for (const [field, target] of Object.entries(targets)) {
|
|
298
|
+
const stored = row[field];
|
|
299
|
+
const current = isPiiCiphertext(stored)
|
|
300
|
+
? await decryptStoredPii(stored, field, "retention-anonymize")
|
|
301
|
+
: stored;
|
|
302
|
+
if (current !== PII_ERASED_SENTINEL && current !== target)
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
return false;
|
|
286
306
|
}
|
|
287
307
|
// Anonymize every matching row via the executor (event → rebuild-safe).
|
|
288
308
|
// id-Cursor-paged because the where keeps matching already-anonymized rows;
|
|
@@ -290,7 +310,7 @@ function rowNeedsAnonymize(row, targets) {
|
|
|
290
310
|
// UPDATES per run, not the scan.
|
|
291
311
|
// ponytail: scans all past-cutoff rows per run — add an anonymized-marker
|
|
292
312
|
// column if a hot entity accumulates millions of held rows.
|
|
293
|
-
async function anonymizeMatchingRows(db, table, where, batchLimit, targets, op) {
|
|
313
|
+
export async function anonymizeMatchingRows(db, table, where, batchLimit, targets, op) {
|
|
294
314
|
let count = 0;
|
|
295
315
|
let cursor = null;
|
|
296
316
|
while (count < batchLimit) {
|
|
@@ -303,7 +323,7 @@ async function anonymizeMatchingRows(db, table, where, batchLimit, targets, op)
|
|
|
303
323
|
break;
|
|
304
324
|
for (const row of rows) {
|
|
305
325
|
cursor = row["id"]; // @cast-boundary db-row
|
|
306
|
-
if (!rowNeedsAnonymize(row, targets))
|
|
326
|
+
if (!(await rowNeedsAnonymize(row, targets)))
|
|
307
327
|
continue;
|
|
308
328
|
const res = await op(cursor, targets);
|
|
309
329
|
if (res.isSuccess)
|
|
@@ -314,6 +334,52 @@ async function anonymizeMatchingRows(db, table, where, batchLimit, targets, op)
|
|
|
314
334
|
}
|
|
315
335
|
return count;
|
|
316
336
|
}
|
|
337
|
+
export async function loadOverrideByEntity(db, tenantId) {
|
|
338
|
+
const overrideRows = await selectMany(db, tenantRetentionOverrideTable, { tenantId });
|
|
339
|
+
return new Map(overrideRows.map((r) => [r.entityName, { config: r.config }]));
|
|
340
|
+
}
|
|
341
|
+
async function hardDeleteMatchingRows(args) {
|
|
342
|
+
const executor = createEventStoreExecutor(args.table, args.entity, {
|
|
343
|
+
entityName: args.entityName,
|
|
344
|
+
});
|
|
345
|
+
const filePlan = planFileFields(args.entity.fields);
|
|
346
|
+
if (filePlan.singleFields.length === 0 && filePlan.multiFields.length === 0) {
|
|
347
|
+
return await purgeMatchingRows(args.db, args.table, args.where, args.batchLimit, (id) => forgetRowAndEraseKeys({
|
|
348
|
+
db: args.db,
|
|
349
|
+
executor,
|
|
350
|
+
entity: args.entity,
|
|
351
|
+
entityName: args.entityName,
|
|
352
|
+
tenantId: args.tenantId,
|
|
353
|
+
systemUser: args.systemUser,
|
|
354
|
+
rowId: id,
|
|
355
|
+
row: { id },
|
|
356
|
+
kms: args.kms,
|
|
357
|
+
registry: args.registry,
|
|
358
|
+
}));
|
|
359
|
+
}
|
|
360
|
+
const fileRefExecutor = createEventStoreExecutor(fileRefsTable, fileRefEntity, {
|
|
361
|
+
entityName: "fileRef",
|
|
362
|
+
});
|
|
363
|
+
return await purgeHardDeleteRowsWithFiles({
|
|
364
|
+
db: args.db,
|
|
365
|
+
table: args.table,
|
|
366
|
+
fileHolders: args.fileHolders,
|
|
367
|
+
where: args.where,
|
|
368
|
+
batchLimit: args.batchLimit,
|
|
369
|
+
tenantId: args.tenantId,
|
|
370
|
+
entityName: args.entityName,
|
|
371
|
+
entity: args.entity,
|
|
372
|
+
files: args.files,
|
|
373
|
+
entityExecutor: executor,
|
|
374
|
+
fileRefExecutor,
|
|
375
|
+
systemUser: args.systemUser,
|
|
376
|
+
tdb: args.tdb,
|
|
377
|
+
kms: args.kms,
|
|
378
|
+
registry: args.registry,
|
|
379
|
+
deleteWithoutFileStorage: args.deleteWithoutFileStorage,
|
|
380
|
+
skipped: args.skipped,
|
|
381
|
+
});
|
|
382
|
+
}
|
|
317
383
|
export async function runRetentionCleanup(args) {
|
|
318
384
|
const { db, registry, tenantId, preloadedTenantPreset, now } = args;
|
|
319
385
|
const batchLimit = args.batchLimit ?? DEFAULT_BATCH_LIMIT;
|
|
@@ -341,8 +407,7 @@ export async function runRetentionCleanup(args) {
|
|
|
341
407
|
// Pre-load every override row for this tenant ONCE — N entities × M
|
|
342
408
|
// tenants would otherwise mean one fetchOne per entity per tenant, even
|
|
343
409
|
// though the whole set for a tenant is a single small, indexed read.
|
|
344
|
-
const
|
|
345
|
-
const overrideByEntity = new Map(overrideRows.map((r) => [r.entityName, { config: r.config }]));
|
|
410
|
+
const overrideByEntity = await loadOverrideByEntity(db, tenantId);
|
|
346
411
|
for (const proj of registry.getAllProjections().values()) {
|
|
347
412
|
// Only implicit entity projections with a table are targets, as in
|
|
348
413
|
// soft-delete-cleanup. Custom projections and unmanaged tables (such as
|
|
@@ -380,42 +445,21 @@ export async function runRetentionCleanup(args) {
|
|
|
380
445
|
}
|
|
381
446
|
switch (policy.strategy) {
|
|
382
447
|
case "hardDelete": {
|
|
383
|
-
|
|
384
|
-
const filePlan = planFileFields(entity.fields);
|
|
385
|
-
if (filePlan.singleFields.length === 0 && filePlan.multiFields.length === 0) {
|
|
386
|
-
hardDeleted += await purgeMatchingRows(db, proj.table, where, batchLimit, (id) => forgetRowAndEraseKeys({
|
|
387
|
-
db,
|
|
388
|
-
executor,
|
|
389
|
-
entity,
|
|
390
|
-
entityName,
|
|
391
|
-
tenantId,
|
|
392
|
-
systemUser,
|
|
393
|
-
rowId: id,
|
|
394
|
-
row: { id },
|
|
395
|
-
kms,
|
|
396
|
-
registry,
|
|
397
|
-
}));
|
|
398
|
-
break;
|
|
399
|
-
}
|
|
400
|
-
const fileRefExecutor = createEventStoreExecutor(fileRefsTable, fileRefEntity, {
|
|
401
|
-
entityName: "fileRef",
|
|
402
|
-
});
|
|
403
|
-
hardDeleted += await purgeHardDeleteRowsWithFiles({
|
|
448
|
+
hardDeleted += await hardDeleteMatchingRows({
|
|
404
449
|
db,
|
|
405
450
|
table: proj.table,
|
|
406
|
-
fileHolders,
|
|
407
451
|
where,
|
|
408
452
|
batchLimit,
|
|
409
453
|
tenantId,
|
|
410
454
|
entityName,
|
|
411
455
|
entity,
|
|
412
456
|
files: args.files,
|
|
413
|
-
entityExecutor: executor,
|
|
414
|
-
fileRefExecutor,
|
|
415
457
|
systemUser,
|
|
416
458
|
tdb,
|
|
417
459
|
kms,
|
|
418
460
|
registry,
|
|
461
|
+
fileHolders,
|
|
462
|
+
deleteWithoutFileStorage: false,
|
|
419
463
|
skipped,
|
|
420
464
|
});
|
|
421
465
|
break;
|
|
@@ -438,6 +482,28 @@ export async function runRetentionCleanup(args) {
|
|
|
438
482
|
// anonymize strategy, so both cases share it.
|
|
439
483
|
case "anonymize":
|
|
440
484
|
case "blockDelete": {
|
|
485
|
+
// A tenant held in destroyHeld has its expired blockDelete rows removed for good;
|
|
486
|
+
// anonymizing them would keep the account's data stored for nothing.
|
|
487
|
+
if (policy.strategy === "blockDelete" && args.purgeExpiredBlockDelete === true) {
|
|
488
|
+
hardDeleted += await hardDeleteMatchingRows({
|
|
489
|
+
db,
|
|
490
|
+
table: proj.table,
|
|
491
|
+
where,
|
|
492
|
+
batchLimit,
|
|
493
|
+
tenantId,
|
|
494
|
+
entityName,
|
|
495
|
+
entity,
|
|
496
|
+
files: args.files,
|
|
497
|
+
systemUser,
|
|
498
|
+
tdb,
|
|
499
|
+
kms,
|
|
500
|
+
registry,
|
|
501
|
+
fileHolders,
|
|
502
|
+
deleteWithoutFileStorage: true,
|
|
503
|
+
skipped,
|
|
504
|
+
});
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
441
507
|
const targets = await resolveAnonymizeTargets(entity.fields);
|
|
442
508
|
if (!targets) {
|
|
443
509
|
// blockDelete without anonymize fields is a pure hold only while the
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type DbRunner } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import { type Registry, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
import { type Instant } from "./keep-for.ts";
|
|
4
|
+
type TenantHoldArgs = {
|
|
5
|
+
readonly db: DbRunner;
|
|
6
|
+
readonly registry: Registry;
|
|
7
|
+
readonly tenantId: TenantId;
|
|
8
|
+
readonly now: Instant;
|
|
9
|
+
};
|
|
10
|
+
/** True while the tenant still owns rows in an entity whose resolved policy is blockDelete. */
|
|
11
|
+
export declare function tenantHasBlockDeleteRows(args: TenantHoldArgs): Promise<boolean>;
|
|
12
|
+
export type DestructionHold = {
|
|
13
|
+
readonly entityNames: ReadonlySet<string>;
|
|
14
|
+
/** fileRefs the held rows point at: their rows and bytes must outlive the destruction too. */
|
|
15
|
+
readonly fileRefIds: ReadonlySet<string>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Entities of the tenant with at least one blockDelete row still inside keepFor. All tenant rows of
|
|
19
|
+
* those entities get their personal fields anonymized (idempotent: already anonymized rows emit no
|
|
20
|
+
* event) and stay; the caller must not delete them, nor the fileRefs they point at.
|
|
21
|
+
*/
|
|
22
|
+
export declare function holdBlockDeleteRowsForDestruction(args: TenantHoldArgs): Promise<DestructionHold>;
|
|
23
|
+
export {};
|