@cosmicdrift/kumiko-bundled-features 0.405.0 → 0.409.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/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/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/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 +130 -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 +186 -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 +464 -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/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/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/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/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-tenant.query.js +3 -1
- 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 +48 -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/constants.d.ts +1 -0
- package/dist/tenant-lifecycle/constants.js +5 -0
- package/dist/tenant-lifecycle/events.d.ts +2 -0
- package/dist/tenant-lifecycle/events.js +2 -0
- package/dist/tenant-lifecycle/feature.js +18 -3
- package/dist/tenant-lifecycle/handlers/request-destruction.write.js +11 -67
- package/dist/tenant-lifecycle/index.d.ts +2 -1
- package/dist/tenant-lifecycle/index.js +2 -1
- 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 +5 -0
- package/dist/tenant-lifecycle/run-tenant-destroy.js +85 -12
- package/dist/tenant-lifecycle/stages.d.ts +3 -0
- package/dist/tenant-lifecycle/stages.js +27 -3
- 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/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/kumiko-es-tables.json +12 -0
- package/package.json +46 -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 +27 -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 +30 -0
- package/src/tier-engine/changes.json +6 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const DOCUMENT_INGEST_BOOT_RULES = {
|
|
2
|
+
jobWithoutProviderFilter: {
|
|
3
|
+
id: "document-ingest-foundation/job-without-provider-filter",
|
|
4
|
+
summary: "A job triggered by documentIngest.requested filters to one provider, so it does not fire for every provider's uploads.",
|
|
5
|
+
fix: 'Use trigger: documentIngestProviderTrigger("<name>").',
|
|
6
|
+
},
|
|
7
|
+
jobUnknownProvider: {
|
|
8
|
+
id: "document-ingest-foundation/job-unknown-provider",
|
|
9
|
+
summary: "A documentIngest.requested job filters to a provider that some feature registers via EXT_DOCUMENT_INGEST_PROVIDER.",
|
|
10
|
+
fix: 'Register the provider via r.useExtension(EXT_DOCUMENT_INGEST_PROVIDER, "<name>", ...) or fix the provider name.',
|
|
11
|
+
},
|
|
12
|
+
providerWithoutJob: {
|
|
13
|
+
id: "document-ingest-foundation/provider-without-job",
|
|
14
|
+
summary: "A registered document-ingest provider has a job triggered by documentIngestProviderTrigger, otherwise requested files are never processed.",
|
|
15
|
+
fix: "Add an r.job with that trigger, or unmount the provider.",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -26,6 +26,14 @@ export declare const documentIngestSkippedPayloadSchema: z.ZodObject<{
|
|
|
26
26
|
}>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
28
|
export type DocumentIngestSkippedPayload = z.infer<typeof documentIngestSkippedPayloadSchema>;
|
|
29
|
+
export declare const DOCUMENT_INGEST_PROGRESS_EVENT_SHORT: "documentIngest.progress";
|
|
30
|
+
export declare const DOCUMENT_INGEST_PROGRESS_EVENT_QN: "document-ingest-foundation:event:document-ingest-progress";
|
|
31
|
+
export declare const documentIngestProgressPayloadSchema: z.ZodObject<{
|
|
32
|
+
fileRefId: z.ZodString;
|
|
33
|
+
pagesDone: z.ZodNumber;
|
|
34
|
+
pagesTotal: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type DocumentIngestProgressPayload = z.infer<typeof documentIngestProgressPayloadSchema>;
|
|
29
37
|
export declare const documentExtractReadyPayloadSchema: z.ZodObject<{
|
|
30
38
|
documentExtractId: z.ZodString;
|
|
31
39
|
fileRefId: z.ZodString;
|
|
@@ -35,6 +35,18 @@ export const documentIngestSkippedPayloadSchema = z.object({
|
|
|
35
35
|
size: z.number().int().min(0),
|
|
36
36
|
reason: z.enum(["file-too-large", "unsupported-mime-type"]),
|
|
37
37
|
});
|
|
38
|
+
export const DOCUMENT_INGEST_PROGRESS_EVENT_SHORT = "documentIngest.progress";
|
|
39
|
+
export const DOCUMENT_INGEST_PROGRESS_EVENT_QN = "document-ingest-foundation:event:document-ingest-progress";
|
|
40
|
+
export const documentIngestProgressPayloadSchema = z
|
|
41
|
+
.object({
|
|
42
|
+
fileRefId: z.string().min(1),
|
|
43
|
+
pagesDone: z.number().int().min(0),
|
|
44
|
+
pagesTotal: z.number().int().min(1),
|
|
45
|
+
})
|
|
46
|
+
.refine((p) => p.pagesDone <= p.pagesTotal, {
|
|
47
|
+
message: "pagesDone must not exceed pagesTotal",
|
|
48
|
+
path: ["pagesDone"],
|
|
49
|
+
});
|
|
38
50
|
// Terminal events of a document-extract stream. The QNs belong to the provider that registers
|
|
39
51
|
// them; the foundation only owns the shared payload shape.
|
|
40
52
|
export const documentExtractReadyPayloadSchema = z.object({
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
// Provider-driven PDF/Scan/Image → normalized-text ingest primitive. No
|
|
4
4
|
// hardcoded mime allowlist or size cap — providers register via
|
|
5
5
|
// EXT_DOCUMENT_INGEST_PROVIDER (see providers.ts).
|
|
6
|
-
import { applyEntityEvent, entityEventName } from "@cosmicdrift/kumiko-framework/db";
|
|
6
|
+
import { applyEntityEvent, entityEventName, upsertByPk } from "@cosmicdrift/kumiko-framework/db";
|
|
7
7
|
import { access, createTenantConfig, defineFeature, EXT_TENANT_DATA, } from "@cosmicdrift/kumiko-framework/engine";
|
|
8
8
|
import { normalizeMimeType } from "@cosmicdrift/kumiko-framework/files";
|
|
9
9
|
import * as z from "zod";
|
|
10
10
|
import { documentIngestAggregateId } from "./aggregate-id.js";
|
|
11
11
|
import { validateDocumentIngestProviderWiring } from "./boot-checks.js";
|
|
12
12
|
import { documentExtractEntity, documentExtractsTable } from "./entity.js";
|
|
13
|
-
import { DOCUMENT_EXTRACT_AGGREGATE_TYPE, DOCUMENT_INGEST_AGGREGATE_TYPE, DOCUMENT_INGEST_REQUESTED_EVENT_QN, DOCUMENT_INGEST_REQUESTED_EVENT_SHORT, DOCUMENT_INGEST_SKIPPED_EVENT_QN, DOCUMENT_INGEST_SKIPPED_EVENT_SHORT, documentIngestRequestedPayloadSchema, documentIngestSkippedPayloadSchema, } from "./events.js";
|
|
13
|
+
import { DOCUMENT_EXTRACT_AGGREGATE_TYPE, DOCUMENT_INGEST_AGGREGATE_TYPE, DOCUMENT_INGEST_PROGRESS_EVENT_QN, DOCUMENT_INGEST_PROGRESS_EVENT_SHORT, DOCUMENT_INGEST_REQUESTED_EVENT_QN, DOCUMENT_INGEST_REQUESTED_EVENT_SHORT, DOCUMENT_INGEST_SKIPPED_EVENT_QN, DOCUMENT_INGEST_SKIPPED_EVENT_SHORT, documentIngestProgressPayloadSchema, documentIngestRequestedPayloadSchema, documentIngestSkippedPayloadSchema, } from "./events.js";
|
|
14
14
|
import { forgetExtractOnFileRefDeletedHook, forgetExtractOnFileRefForgottenHook, forgetOrphanedDocumentExtractHook, } from "./forget-extract-with-file-ref.js";
|
|
15
15
|
import { EXT_DOCUMENT_INGEST_PROVIDER, resolveDocumentIngestProviders, UNCLAIMED_PROVIDER_SENTINEL, } from "./providers.js";
|
|
16
|
+
import { documentIngestProgressTable, documentIngestProgressTableMeta } from "./tables.js";
|
|
16
17
|
import { documentExtractTenantDestroyHook } from "./tenant-destroy-hook.js";
|
|
17
18
|
const FEATURE_NAME = "document-ingest-foundation";
|
|
18
19
|
const FILE_REF_CREATED = entityEventName("fileRef", "created");
|
|
@@ -148,6 +149,33 @@ export function createDocumentIngestFoundationFeature() {
|
|
|
148
149
|
r.defineEvent(DOCUMENT_INGEST_SKIPPED_EVENT_SHORT, documentIngestSkippedPayloadSchema, {
|
|
149
150
|
piiFields: "none",
|
|
150
151
|
});
|
|
152
|
+
r.defineEvent(DOCUMENT_INGEST_PROGRESS_EVENT_SHORT, documentIngestProgressPayloadSchema, {
|
|
153
|
+
piiFields: "none",
|
|
154
|
+
});
|
|
155
|
+
r.storeTable(documentIngestProgressTableMeta, {
|
|
156
|
+
reason: "read_side.document_ingest_progress",
|
|
157
|
+
});
|
|
158
|
+
r.projection({
|
|
159
|
+
name: "ingest-progress",
|
|
160
|
+
source: DOCUMENT_INGEST_AGGREGATE_TYPE,
|
|
161
|
+
table: documentIngestProgressTable,
|
|
162
|
+
apply: {
|
|
163
|
+
[DOCUMENT_INGEST_PROGRESS_EVENT_QN]: async (event, tx) => {
|
|
164
|
+
const progress = documentIngestProgressPayloadSchema.parse(event.payload);
|
|
165
|
+
await upsertByPk(tx, documentIngestProgressTable, {
|
|
166
|
+
id: event.aggregateId,
|
|
167
|
+
tenantId: event.tenantId,
|
|
168
|
+
fileRefId: progress.fileRefId,
|
|
169
|
+
pagesDone: progress.pagesDone,
|
|
170
|
+
pagesTotal: progress.pagesTotal,
|
|
171
|
+
}, {
|
|
172
|
+
pagesDone: progress.pagesDone,
|
|
173
|
+
pagesTotal: progress.pagesTotal,
|
|
174
|
+
updatedAt: event.createdAt,
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
});
|
|
151
179
|
r.multiStreamProjection({
|
|
152
180
|
name: "request-ingest",
|
|
153
181
|
apply: {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { documentIngestAggregateId } from "./aggregate-id.ts";
|
|
2
2
|
export { type AppendMissingExtractEventDeps, type AppendMissingExtractEventOptions, type AppendMissingExtractEventResult, appendMissingDocumentExtractEvent, type ExistingDocumentExtract, } from "./append-missing-extract-event.ts";
|
|
3
3
|
export { type DocumentExtractMeta, documentExtractEntity, documentExtractsTable, type IngestPage, } from "./entity.ts";
|
|
4
|
-
export { DOCUMENT_EXTRACT_AGGREGATE_TYPE, DOCUMENT_INGEST_AGGREGATE_TYPE, DOCUMENT_INGEST_REQUESTED_EVENT_QN, DOCUMENT_INGEST_REQUESTED_EVENT_SHORT, DOCUMENT_INGEST_SKIPPED_EVENT_QN, DOCUMENT_INGEST_SKIPPED_EVENT_SHORT, type DocumentExtractFailedPayload, type DocumentExtractReadyPayload, type DocumentIngestRequestedPayload, type DocumentIngestSkippedPayload, documentExtractFailedPayloadSchema, documentExtractReadyPayloadSchema, documentIngestRequestedPayloadSchema, documentIngestSkippedPayloadSchema, } from "./events.ts";
|
|
4
|
+
export { DOCUMENT_EXTRACT_AGGREGATE_TYPE, DOCUMENT_INGEST_AGGREGATE_TYPE, DOCUMENT_INGEST_PROGRESS_EVENT_QN, DOCUMENT_INGEST_PROGRESS_EVENT_SHORT, DOCUMENT_INGEST_REQUESTED_EVENT_QN, DOCUMENT_INGEST_REQUESTED_EVENT_SHORT, DOCUMENT_INGEST_SKIPPED_EVENT_QN, DOCUMENT_INGEST_SKIPPED_EVENT_SHORT, type DocumentExtractFailedPayload, type DocumentExtractReadyPayload, type DocumentIngestProgressPayload, type DocumentIngestRequestedPayload, type DocumentIngestSkippedPayload, documentExtractFailedPayloadSchema, documentExtractReadyPayloadSchema, documentIngestProgressPayloadSchema, documentIngestRequestedPayloadSchema, documentIngestSkippedPayloadSchema, } from "./events.ts";
|
|
5
5
|
export { createDocumentIngestFoundationFeature } from "./feature.ts";
|
|
6
6
|
export { readIngestPages, writeIngestPages } from "./pages.ts";
|
|
7
7
|
export { type DocumentIngestProviderOptions, documentIngestProviderOptionsSchema, documentIngestProviderTrigger, EXT_DOCUMENT_INGEST_PROVIDER, listIngestibleMimeTypes, type ResolvedDocumentIngestProvider, resolveDocumentIngestProviders, } from "./providers.ts";
|
|
8
|
+
export { type ReportIngestProgressDeps, type ReportIngestProgressInput, reportIngestProgress, } from "./report-ingest-progress.ts";
|
|
9
|
+
export { documentIngestProgressTable } from "./tables.ts";
|
|
8
10
|
export { type DocumentExtractWriteResult, writeDocumentExtractForLiveFileRef, } from "./write-document-extract.ts";
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
export { documentIngestAggregateId } from "./aggregate-id.js";
|
|
3
3
|
export { appendMissingDocumentExtractEvent, } from "./append-missing-extract-event.js";
|
|
4
4
|
export { documentExtractEntity, documentExtractsTable, } from "./entity.js";
|
|
5
|
-
export { DOCUMENT_EXTRACT_AGGREGATE_TYPE, DOCUMENT_INGEST_AGGREGATE_TYPE, DOCUMENT_INGEST_REQUESTED_EVENT_QN, DOCUMENT_INGEST_REQUESTED_EVENT_SHORT, DOCUMENT_INGEST_SKIPPED_EVENT_QN, DOCUMENT_INGEST_SKIPPED_EVENT_SHORT, documentExtractFailedPayloadSchema, documentExtractReadyPayloadSchema, documentIngestRequestedPayloadSchema, documentIngestSkippedPayloadSchema, } from "./events.js";
|
|
5
|
+
export { DOCUMENT_EXTRACT_AGGREGATE_TYPE, DOCUMENT_INGEST_AGGREGATE_TYPE, DOCUMENT_INGEST_PROGRESS_EVENT_QN, DOCUMENT_INGEST_PROGRESS_EVENT_SHORT, DOCUMENT_INGEST_REQUESTED_EVENT_QN, DOCUMENT_INGEST_REQUESTED_EVENT_SHORT, DOCUMENT_INGEST_SKIPPED_EVENT_QN, DOCUMENT_INGEST_SKIPPED_EVENT_SHORT, documentExtractFailedPayloadSchema, documentExtractReadyPayloadSchema, documentIngestProgressPayloadSchema, documentIngestRequestedPayloadSchema, documentIngestSkippedPayloadSchema, } from "./events.js";
|
|
6
6
|
export { createDocumentIngestFoundationFeature } from "./feature.js";
|
|
7
7
|
export { readIngestPages, writeIngestPages } from "./pages.js";
|
|
8
8
|
export { documentIngestProviderOptionsSchema, documentIngestProviderTrigger, EXT_DOCUMENT_INGEST_PROVIDER, listIngestibleMimeTypes, resolveDocumentIngestProviders, } from "./providers.js";
|
|
9
|
+
export { reportIngestProgress, } from "./report-ingest-progress.js";
|
|
10
|
+
export { documentIngestProgressTable } from "./tables.js";
|
|
9
11
|
export { writeDocumentExtractForLiveFileRef, } from "./write-document-extract.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import type { Registry } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
export type ReportIngestProgressDeps = {
|
|
4
|
+
readonly db: DbConnection;
|
|
5
|
+
readonly registry: Registry;
|
|
6
|
+
readonly tenantId: string;
|
|
7
|
+
readonly actorId: string;
|
|
8
|
+
};
|
|
9
|
+
export type ReportIngestProgressInput = {
|
|
10
|
+
readonly fileRefId: string;
|
|
11
|
+
readonly pagesDone: number;
|
|
12
|
+
readonly pagesTotal: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function reportIngestProgress(deps: ReportIngestProgressDeps, input: ReportIngestProgressInput): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { append, getStreamVersion } from "@cosmicdrift/kumiko-framework/event-store";
|
|
2
|
+
import { runProjectionsForEvent } from "@cosmicdrift/kumiko-framework/pipeline";
|
|
3
|
+
import { documentIngestAggregateId } from "./aggregate-id.js";
|
|
4
|
+
import { DOCUMENT_INGEST_AGGREGATE_TYPE, DOCUMENT_INGEST_PROGRESS_EVENT_QN, documentIngestProgressPayloadSchema, } from "./events.js";
|
|
5
|
+
// Low-level append() does not fire projections, so they run explicitly in the same call.
|
|
6
|
+
export async function reportIngestProgress(deps, input) {
|
|
7
|
+
const payload = documentIngestProgressPayloadSchema.parse(input);
|
|
8
|
+
const aggregateId = documentIngestAggregateId(deps.tenantId, payload.fileRefId);
|
|
9
|
+
const expectedVersion = await getStreamVersion(deps.db, aggregateId, deps.tenantId);
|
|
10
|
+
const stored = await append(deps.db, {
|
|
11
|
+
aggregateId,
|
|
12
|
+
aggregateType: DOCUMENT_INGEST_AGGREGATE_TYPE,
|
|
13
|
+
tenantId: deps.tenantId,
|
|
14
|
+
expectedVersion,
|
|
15
|
+
type: DOCUMENT_INGEST_PROGRESS_EVENT_QN,
|
|
16
|
+
payload,
|
|
17
|
+
metadata: { userId: deps.actorId },
|
|
18
|
+
});
|
|
19
|
+
await runProjectionsForEvent(stored, deps.registry, deps.db);
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineUnmanagedTable, index, instant, integer, table as pgTable, sql, text, uuid, } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
const INGEST_PROGRESS_FILE_REF_INDEX = "store_document_ingest_progress_tenant_id_file_ref_id_idx";
|
|
3
|
+
// One row per ingest stream (PK = documentIngestAggregateId), upserted by the
|
|
4
|
+
// "ingest-progress" projection on every documentIngest.progress event.
|
|
5
|
+
export const documentIngestProgressTable = pgTable("store_document_ingest_progress", {
|
|
6
|
+
id: uuid("id").primaryKey(),
|
|
7
|
+
tenantId: uuid("tenant_id").notNull(),
|
|
8
|
+
fileRefId: text("file_ref_id").notNull(),
|
|
9
|
+
pagesDone: integer("pages_done").notNull(),
|
|
10
|
+
pagesTotal: integer("pages_total").notNull(),
|
|
11
|
+
updatedAt: instant("updated_at").default(sql `now()`).notNull(),
|
|
12
|
+
}, (t) => [index(INGEST_PROGRESS_FILE_REF_INDEX).on(t.tenantId, t.fileRefId)]);
|
|
13
|
+
// Unmanaged: the id is the event-stream aggregate id and replays are idempotent via the PK upsert,
|
|
14
|
+
// so the managed base columns (version, audit columns) have no use here.
|
|
15
|
+
export const documentIngestProgressTableMeta = defineUnmanagedTable({
|
|
16
|
+
tableName: "store_document_ingest_progress",
|
|
17
|
+
indexes: [{ name: INGEST_PROGRESS_FILE_REF_INDEX, columns: ["tenant_id", "file_ref_id"] }],
|
|
18
|
+
columns: [
|
|
19
|
+
{ name: "id", pgType: "uuid", notNull: true, primaryKey: true },
|
|
20
|
+
{ name: "tenant_id", pgType: "uuid", notNull: true },
|
|
21
|
+
{ name: "file_ref_id", pgType: "text", notNull: true },
|
|
22
|
+
{ name: "pages_done", pgType: "integer", notNull: true },
|
|
23
|
+
{ name: "pages_total", pgType: "integer", notNull: true },
|
|
24
|
+
{ name: "updated_at", pgType: "timestamptz", notNull: true, defaultSql: "now()" },
|
|
25
|
+
],
|
|
26
|
+
});
|
|
@@ -72,7 +72,10 @@ export const fileRefTenantDestroyHook = async (ctx) => {
|
|
|
72
72
|
// Converges without a cursor: forget() hard-deletes, so each batch query
|
|
73
73
|
// returns the next rows.
|
|
74
74
|
const result = await runChunkedMigration({
|
|
75
|
-
nextBatch: () => ctx.db.selectMany(fileRefsTable, {
|
|
75
|
+
nextBatch: () => ctx.db.selectMany(fileRefsTable, {
|
|
76
|
+
tenantId: ctx.tenantId,
|
|
77
|
+
id: { notIn: [...(ctx.heldFileRefIds ?? [])] },
|
|
78
|
+
}, { limit: DESTROY_CHUNK_SIZE }),
|
|
76
79
|
migrateRow: async (row) => {
|
|
77
80
|
if (!isUnderOwnPrefix(row.storageKey, ownPrefixes)) {
|
|
78
81
|
await deleteHandedOverBinary(ctx, row.storageKey);
|
|
@@ -26,10 +26,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
26
26
|
// NOTE on Tailwind: a host's Tailwind v4 build must `@source`-scan this package's
|
|
27
27
|
// src (node_modules is ignored by default) or these classes never compile. money-
|
|
28
28
|
// horse already does; that scan is a real shipping requirement for any host.
|
|
29
|
-
import { usePrimitives, useQuery, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
29
|
+
import { toggleSetMember, usePrimitives, useQuery, useTranslation, } from "@cosmicdrift/kumiko-renderer";
|
|
30
30
|
import { ChevronRight, File, Folder, Pencil, Plus, Trash2 } from "lucide-react";
|
|
31
31
|
import { useEffect, useState } from "react";
|
|
32
|
-
import { useDispatchedWrites } from "../../shared/web/
|
|
32
|
+
import { useDispatchedWrites } from "../../shared/web/index.js";
|
|
33
33
|
import { FoldersHandlers, FoldersQueries } from "./constants.js";
|
|
34
34
|
import { buildFolderTree } from "./tree.js";
|
|
35
35
|
const UNFILED = "__unfiled__";
|
|
@@ -99,14 +99,7 @@ export function FolderManager({ renderMeta, filing, }) {
|
|
|
99
99
|
typeByEntity.set(leaf.id, typeOf(leaf));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
const toggleCollapse = (id) => setCollapsed((prev) =>
|
|
103
|
-
const next = new Set(prev);
|
|
104
|
-
if (next.has(id))
|
|
105
|
-
next.delete(id);
|
|
106
|
-
else
|
|
107
|
-
next.add(id);
|
|
108
|
-
return next;
|
|
109
|
-
});
|
|
102
|
+
const toggleCollapse = (id) => setCollapsed((prev) => toggleSetMember(prev, id));
|
|
110
103
|
const openCreate = (parentId) => {
|
|
111
104
|
setErrorKey(null);
|
|
112
105
|
setDraftName("");
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
// (RenderEdit passes { entityName, entityId }).
|
|
14
14
|
import { useDispatcher, usePrimitives, useQuery, useTranslation, } from "@cosmicdrift/kumiko-renderer";
|
|
15
15
|
import { useState } from "react";
|
|
16
|
-
import { useDispatchedWrites } from "../../shared/web/
|
|
16
|
+
import { useDispatchedWrites } from "../../shared/web/index.js";
|
|
17
17
|
import { FoldersHandlers, FoldersQueries } from "./constants.js";
|
|
18
18
|
import { folderPath } from "./tree.js";
|
|
19
19
|
// Sentinel for the "no folder" combobox option — selecting it clears the
|
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
// pull a hard dependency. Mirrors notes-history-user-data.
|
|
7
7
|
import { defineFeature, EXT_USER_DATA } from "@cosmicdrift/kumiko-framework/engine";
|
|
8
8
|
import { formDraftDeleteHook, formDraftExportHook } from "./hooks.js";
|
|
9
|
+
// guard:dup-ok feature tooling and guards find features by a literal defineFeature call per feature
|
|
9
10
|
export function createFormDraftUserDataFeature() {
|
|
10
|
-
return defineFeature("form-draft-user-data",
|
|
11
|
+
return defineFeature("form-draft-user-data",
|
|
12
|
+
// guard:dup-ok feature tooling and guards find features by a literal defineFeature call per feature
|
|
13
|
+
(r) => {
|
|
11
14
|
r.describe("GDPR (Art. 20 export / Art. 17 erasure) coverage for the `form-draft` feature's `form-draft` entity. Mounts the EXT_USER_DATA export hook so a user's saved drafts are included in the user-data export bundle, and a delete hook that physically removes the user's own draft rows on forget. Kept separate from `form-draft` so form-draft consumers without the user-data-rights pipeline don't pull a hard dependency — requires `user-data-rights`, optionalRequires `form-draft`.");
|
|
12
15
|
r.requires({ features: ["user-data-rights"] });
|
|
13
16
|
r.optionalRequires("form-draft");
|
|
@@ -115,6 +115,9 @@ export declare const inboundMessageEntity: import("@cosmicdrift/kumiko-types/fie
|
|
|
115
115
|
required: false;
|
|
116
116
|
default: boolean;
|
|
117
117
|
};
|
|
118
|
+
readonly bodyHtml: import("@cosmicdrift/kumiko-types/fields").EntityLongTextFieldDef & {
|
|
119
|
+
required: false;
|
|
120
|
+
};
|
|
118
121
|
readonly attachmentFileIds: import("@cosmicdrift/kumiko-types/fields").FilesFieldDef;
|
|
119
122
|
readonly skippedAttachments: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
|
|
120
123
|
required: false;
|
|
@@ -108,6 +108,8 @@ export const inboundMessageEntity = createEntity({
|
|
|
108
108
|
// Null on rows from before the column; list-messages never selects it.
|
|
109
109
|
bodyText: createLongTextField({ maxLength: 200_000, personal: "tenant", find: "none" }),
|
|
110
110
|
bodyTextTruncated: createBooleanField(),
|
|
111
|
+
// Sanitized HTML of the mail (sanitizeInboundHtml), null when the mail has none or it was too large.
|
|
112
|
+
bodyHtml: createLongTextField({ maxLength: 500_000, personal: "tenant", find: "none" }),
|
|
111
113
|
// Bound to the message (entityType = the aggregate type), so the file guard answers with the
|
|
112
114
|
// mail's visibility. The fileRefs are bound at ingest, the projection copies the ids.
|
|
113
115
|
attachmentFileIds: createFilesField({ personal: false, reason: "technical_reference" }),
|
|
@@ -50,6 +50,7 @@ export declare const skippedAttachmentSchema: z.ZodObject<{
|
|
|
50
50
|
export declare const inboundMessageEventPayloadSchema: z.ZodObject<{
|
|
51
51
|
bodyText: z.ZodString;
|
|
52
52
|
bodyTextTruncated: z.ZodBoolean;
|
|
53
|
+
bodyHtml: z.ZodNullable<z.ZodString>;
|
|
53
54
|
attachmentFileIds: z.ZodArray<z.ZodUUID>;
|
|
54
55
|
skippedAttachments: z.ZodArray<z.ZodObject<{
|
|
55
56
|
mimeType: z.ZodString;
|
|
@@ -112,6 +113,7 @@ export type InboundMessageEventPayload = z.infer<typeof inboundMessageEventPaylo
|
|
|
112
113
|
export declare const inboundMessageContentFetchedEventPayloadSchema: z.ZodObject<{
|
|
113
114
|
bodyText: z.ZodString;
|
|
114
115
|
bodyTextTruncated: z.ZodBoolean;
|
|
116
|
+
bodyHtml: z.ZodNullable<z.ZodString>;
|
|
115
117
|
attachmentFileIds: z.ZodArray<z.ZodUUID>;
|
|
116
118
|
skippedAttachments: z.ZodArray<z.ZodObject<{
|
|
117
119
|
mimeType: z.ZodString;
|
|
@@ -98,6 +98,8 @@ export const skippedAttachmentSchema = z.object({
|
|
|
98
98
|
const inboundMessageContentShape = {
|
|
99
99
|
bodyText: z.string().max(200_000),
|
|
100
100
|
bodyTextTruncated: z.boolean(),
|
|
101
|
+
/** Sanitized HTML body, PII ciphertext (500_000 characters become roughly 1.2 MB). Null: none or too large. */
|
|
102
|
+
bodyHtml: z.string().max(1_500_000).nullable(),
|
|
101
103
|
/** file-foundation FileRef ids (plaintext uuids). Attachments outlive the mail: apps turn them
|
|
102
104
|
* into documents, so the retention sweep never deletes them. */
|
|
103
105
|
attachmentFileIds: z.array(z.uuid()).max(50),
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
// ingest-message (programmatic, SystemAdmin), account:list +
|
|
15
15
|
// message:list (PII-decrypted; personal mail only for its owner).
|
|
16
16
|
//
|
|
17
|
-
// **Not here:** business semantics (intent, ticket, assignment, read/completed) belong to the
|
|
18
|
-
// app consumer, for example an event job on inbound-message-received with its own projection.
|
|
17
|
+
// **Not here:** business semantics (intent, ticket, assignment, read/completed) belong to the app consumer (e.g. an event job on inbound-message-received).
|
|
19
18
|
//
|
|
20
19
|
// **PII/GDPR:** address/from/to/cc/subject/snippet are `personal: "tenant"`, encrypted BEFORE every
|
|
21
20
|
// event append (the only write path), so event log AND projections carry ciphertext; tenant-destroy
|
|
@@ -90,11 +89,10 @@ export function createInboundMailFoundationFeature(options = {}) {
|
|
|
90
89
|
version: 2,
|
|
91
90
|
migrations: mailAccountMigrations,
|
|
92
91
|
});
|
|
93
|
-
// v1 mails carry the snippet only
|
|
94
|
-
// refetch find them. v3 adds the reason a message has no content.
|
|
92
|
+
// v1 mails carry the snippet only (contentState "snippet" lets the refetch find them); v3 adds the unavailable reason, v4 the sanitized HTML body.
|
|
95
93
|
r.defineEvent(INBOUND_MESSAGE_RECEIVED_EVENT_SHORT, inboundMessageEventPayloadSchema, {
|
|
96
94
|
piiFields: "none",
|
|
97
|
-
version:
|
|
95
|
+
version: 4,
|
|
98
96
|
migrations: [
|
|
99
97
|
{
|
|
100
98
|
fromVersion: 1,
|
|
@@ -115,11 +113,12 @@ export function createInboundMailFoundationFeature(options = {}) {
|
|
|
115
113
|
toVersion: 3,
|
|
116
114
|
transform: { default: { contentUnavailableReason: null } },
|
|
117
115
|
},
|
|
116
|
+
{ fromVersion: 3, toVersion: 4, transform: { default: { bodyHtml: null } } },
|
|
118
117
|
],
|
|
119
118
|
});
|
|
120
119
|
r.defineEvent(INBOUND_MESSAGE_CONTENT_FETCHED_EVENT_SHORT, inboundMessageContentFetchedEventPayloadSchema, {
|
|
121
120
|
piiFields: "none",
|
|
122
|
-
version:
|
|
121
|
+
version: 4,
|
|
123
122
|
migrations: [
|
|
124
123
|
{
|
|
125
124
|
fromVersion: 1,
|
|
@@ -131,6 +130,7 @@ export function createInboundMailFoundationFeature(options = {}) {
|
|
|
131
130
|
toVersion: 3,
|
|
132
131
|
transform: { default: { accountId: null, ownerUserId: null } },
|
|
133
132
|
},
|
|
133
|
+
{ fromVersion: 3, toVersion: 4, transform: { default: { bodyHtml: null } } },
|
|
134
134
|
],
|
|
135
135
|
});
|
|
136
136
|
r.defineEvent(MAIL_THREAD_UPDATED_EVENT_SHORT, mailThreadEventPayloadSchema, {
|
|
@@ -8,8 +8,9 @@ import * as z from "zod";
|
|
|
8
8
|
import { inboundMessageAggregateId } from "../aggregate-id.js";
|
|
9
9
|
import { INBOUND_MESSAGE_AGGREGATE_TYPE, INBOUND_MESSAGE_CONTENT_FETCHED_EVENT_QN, INBOUND_MESSAGE_RECEIVED_EVENT_QN, } from "../events.js";
|
|
10
10
|
import { inboundMessagesProjectionTable } from "../projection.js";
|
|
11
|
+
import { sanitizeInboundHtml } from "../sanitize-inbound-html.js";
|
|
11
12
|
import { finalizePreparedContent, prepareInboundContent, } from "./ingest-message-prepare.js";
|
|
12
|
-
import { contentStateOf, encryptMessageBodyText, inboundContentPayloadShape, MESSAGE_LOCK_NAMESPACE, storeInboundMessageContent, } from "./message-content.js";
|
|
13
|
+
import { contentStateOf, encryptMessageBodyHtml, encryptMessageBodyText, inboundContentPayloadShape, MESSAGE_LOCK_NAMESPACE, storeInboundMessageContent, } from "./message-content.js";
|
|
13
14
|
export const attachMessageContentSchema = z.object({
|
|
14
15
|
accountId: z.uuid(),
|
|
15
16
|
providerMessageId: z.string().min(1).max(500),
|
|
@@ -62,6 +63,7 @@ async function contentEventPayloadOf(payload, content, tenantId, messageAggId, o
|
|
|
62
63
|
bodyRef: content?.bodyRef ?? "",
|
|
63
64
|
bodyText: await encryptMessageBodyText(tenantId, messageAggId, fetched ? payload.bodyText : ""),
|
|
64
65
|
bodyTextTruncated: fetched && payload.bodyTextTruncated,
|
|
66
|
+
bodyHtml: await encryptMessageBodyHtml(tenantId, messageAggId, fetched && payload.bodyHtml !== undefined ? sanitizeInboundHtml(payload.bodyHtml) : null),
|
|
65
67
|
attachmentFileIds: content?.attachmentFileIds ?? [],
|
|
66
68
|
skippedAttachments: content?.skippedAttachments ?? [],
|
|
67
69
|
contentState: content
|
|
@@ -28,6 +28,7 @@ import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
|
28
28
|
import { inboundMessageAggregateId, mailThreadAggregateId } from "../aggregate-id.js";
|
|
29
29
|
import { INBOUND_MESSAGE_PII_FIELDS, inboundMessageEntity, seenMessageTable } from "../entities.js";
|
|
30
30
|
import { INBOUND_MESSAGE_AGGREGATE_TYPE, INBOUND_MESSAGE_RECEIVED_EVENT_QN, } from "../events.js";
|
|
31
|
+
import { sanitizeInboundHtml } from "../sanitize-inbound-html.js";
|
|
31
32
|
import { finalizePreparedContent, prepareIngestMessage, } from "./ingest-message-prepare.js";
|
|
32
33
|
import { ingestMessageSchema } from "./ingest-message-schema.js";
|
|
33
34
|
import { contentStateOf, MESSAGE_LOCK_NAMESPACE, storeInboundMessageContent, } from "./message-content.js";
|
|
@@ -109,9 +110,12 @@ export const ingestMessageHandler = defineWriteHandler({
|
|
|
109
110
|
const contentUnavailableReason = payload.contentUnavailableReason ??
|
|
110
111
|
(content.contentStorage === "unavailable" ? "no_file_storage" : null);
|
|
111
112
|
const piiKms = configuredPiiSubjectKms();
|
|
113
|
+
// Only the sanitized HTML reaches the event; the unsanitized original stays in the file store.
|
|
114
|
+
const sanitizedHtml = payload.bodyHtml === undefined ? null : sanitizeInboundHtml(payload.bodyHtml);
|
|
112
115
|
const messagePlainPii = {
|
|
113
116
|
tenantId,
|
|
114
117
|
bodyText: payload.bodyText,
|
|
118
|
+
bodyHtml: sanitizedHtml,
|
|
115
119
|
from: payload.from,
|
|
116
120
|
to: JSON.stringify(payload.to),
|
|
117
121
|
cc: JSON.stringify(payload.cc),
|
|
@@ -141,6 +145,7 @@ export const ingestMessageHandler = defineWriteHandler({
|
|
|
141
145
|
senderAuthentication: payload.senderAuthentication ?? null,
|
|
142
146
|
bodyText: encryptedMessageFields.bodyText,
|
|
143
147
|
bodyTextTruncated: payload.bodyTextTruncated,
|
|
148
|
+
bodyHtml: encryptedMessageFields.bodyHtml,
|
|
144
149
|
attachmentFileIds: content.attachmentFileIds,
|
|
145
150
|
skippedAttachments: content.skippedAttachments,
|
|
146
151
|
contentState: payload.contentUnavailableReason !== undefined
|
|
@@ -12,7 +12,9 @@ import * as z from "zod";
|
|
|
12
12
|
import { INBOUND_MESSAGE_PII_FIELDS, inboundMessageEntity } from "../entities.js";
|
|
13
13
|
import { inboundMessagesProjectionTable } from "../projection.js";
|
|
14
14
|
import { isVisibleToCaller } from "./scope-visibility.js";
|
|
15
|
-
// The full text
|
|
15
|
+
// The full text and HTML are delivered only by message:content; selecting them here would decrypt
|
|
16
|
+
// every body of the list, the HTML at up to its event cap per row.
|
|
17
|
+
const LIST_EXCLUDED_BODY_FIELDS = new Set(["bodyText", "bodyHtml"]);
|
|
16
18
|
const LIST_MESSAGE_COLUMNS = [
|
|
17
19
|
"id",
|
|
18
20
|
"tenantId",
|
|
@@ -21,7 +23,7 @@ const LIST_MESSAGE_COLUMNS = [
|
|
|
21
23
|
"modifiedAt",
|
|
22
24
|
"insertedById",
|
|
23
25
|
"modifiedById",
|
|
24
|
-
...Object.keys(inboundMessageEntity.fields).filter((name) => name
|
|
26
|
+
...Object.keys(inboundMessageEntity.fields).filter((name) => !LIST_EXCLUDED_BODY_FIELDS.has(name)),
|
|
25
27
|
];
|
|
26
28
|
const listMessagesSchema = z
|
|
27
29
|
.object({
|
|
@@ -62,6 +62,7 @@ export declare function contentWithoutFileStorage(input: InboundContentInput): S
|
|
|
62
62
|
export declare function storeInboundMessageContent(ctx: ContentContext, input: InboundContentInput): Promise<StoredInboundContent>;
|
|
63
63
|
export declare const MESSAGE_LOCK_NAMESPACE = 1768844643;
|
|
64
64
|
export declare function encryptMessageBodyText(tenantId: string, messageAggId: string, bodyText: string): Promise<string>;
|
|
65
|
+
export declare function encryptMessageBodyHtml(tenantId: string, messageAggId: string, bodyHtml: string | null): Promise<string | null>;
|
|
65
66
|
export declare function contentStateOf(args: {
|
|
66
67
|
readonly bodyText: string;
|
|
67
68
|
readonly hasOriginal: boolean;
|
|
@@ -130,6 +130,14 @@ export async function encryptMessageBodyText(tenantId, messageAggId, bodyText) {
|
|
|
130
130
|
const encrypted = await encryptPiiFieldValues({ tenantId, bodyText }, inboundMessageEntity, INBOUND_MESSAGE_PII_FIELDS, piiKms, { requestId: `inbound-mail-foundation:message-content:${messageAggId}`, tenantId }, { tenantId, entityName: INBOUND_MESSAGE_AGGREGATE_TYPE });
|
|
131
131
|
return encrypted.bodyText;
|
|
132
132
|
}
|
|
133
|
+
// Same, for the sanitized HTML body (null stays null: nothing to encrypt).
|
|
134
|
+
export async function encryptMessageBodyHtml(tenantId, messageAggId, bodyHtml) {
|
|
135
|
+
const piiKms = configuredPiiSubjectKms();
|
|
136
|
+
if (!piiKms || bodyHtml === null)
|
|
137
|
+
return bodyHtml;
|
|
138
|
+
const encrypted = await encryptPiiFieldValues({ tenantId, bodyHtml }, inboundMessageEntity, INBOUND_MESSAGE_PII_FIELDS, piiKms, { requestId: `inbound-mail-foundation:message-content:${messageAggId}`, tenantId }, { tenantId, entityName: INBOUND_MESSAGE_AGGREGATE_TYPE });
|
|
139
|
+
return encrypted.bodyHtml;
|
|
140
|
+
}
|
|
133
141
|
export function contentStateOf(args) {
|
|
134
142
|
if (args.contentStorage === "unavailable")
|
|
135
143
|
return "unavailable";
|
|
@@ -7,6 +7,8 @@ export type InboundMessageContent = {
|
|
|
7
7
|
readonly messageId: string;
|
|
8
8
|
readonly bodyText: string;
|
|
9
9
|
readonly bodyTextTruncated: boolean;
|
|
10
|
+
/** Sanitized HTML, null when the mail has none; readers show bodyText then. */
|
|
11
|
+
readonly bodyHtml: string | null;
|
|
10
12
|
readonly bodyRef: string;
|
|
11
13
|
readonly attachmentFileIds: readonly string[];
|
|
12
14
|
readonly skippedAttachments: readonly SkippedInboundAttachment[];
|
|
@@ -36,6 +36,7 @@ export async function loadInboundMessageContent(ctx, messageId) {
|
|
|
36
36
|
messageId,
|
|
37
37
|
bodyText: typeof bodyText === "string" ? bodyText : "",
|
|
38
38
|
bodyTextTruncated: row["bodyTextTruncated"] === true,
|
|
39
|
+
bodyHtml: typeof readable["bodyHtml"] === "string" ? readable["bodyHtml"] : null,
|
|
39
40
|
bodyRef: typeof row["bodyRef"] === "string" ? row["bodyRef"] : "",
|
|
40
41
|
attachmentFileIds: fileIdsSchema.parse(row["attachmentFileIds"] ?? []),
|
|
41
42
|
skippedAttachments: parseJsonColumn(row["skippedAttachments"], skippedListSchema, []),
|
|
@@ -110,6 +110,9 @@ export declare const inboundMessagesProjectionTable: import("@cosmicdrift/kumiko
|
|
|
110
110
|
required: false;
|
|
111
111
|
default: boolean;
|
|
112
112
|
};
|
|
113
|
+
readonly bodyHtml: import("@cosmicdrift/kumiko-types/fields").EntityLongTextFieldDef & {
|
|
114
|
+
required: false;
|
|
115
|
+
};
|
|
113
116
|
readonly attachmentFileIds: import("@cosmicdrift/kumiko-types/fields").FilesFieldDef;
|
|
114
117
|
readonly skippedAttachments: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
|
|
115
118
|
required: false;
|
|
@@ -91,6 +91,7 @@ export const applyInboundMessageReceived = defineApply(async (event, tx) => {
|
|
|
91
91
|
scope: p.scope,
|
|
92
92
|
bodyText: p.bodyText,
|
|
93
93
|
bodyTextTruncated: p.bodyTextTruncated,
|
|
94
|
+
bodyHtml: p.bodyHtml,
|
|
94
95
|
attachmentFileIds: p.attachmentFileIds,
|
|
95
96
|
skippedAttachments: JSON.stringify(p.skippedAttachments),
|
|
96
97
|
senderAuthentication: JSON.stringify(p.senderAuthentication),
|
|
@@ -105,6 +106,7 @@ export const applyInboundMessageContentFetched = defineApply(async (event, tx) =
|
|
|
105
106
|
bodyRef: p.bodyRef,
|
|
106
107
|
bodyText: p.bodyText,
|
|
107
108
|
bodyTextTruncated: p.bodyTextTruncated,
|
|
109
|
+
bodyHtml: p.bodyHtml,
|
|
108
110
|
attachmentFileIds: p.attachmentFileIds,
|
|
109
111
|
skippedAttachments: JSON.stringify(p.skippedAttachments),
|
|
110
112
|
contentState: p.contentState,
|