@cosmicdrift/kumiko-bundled-features 0.367.0 → 0.368.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/audit/handlers/details.query.js +1 -1
- package/dist/audit/handlers/list.query.js +1 -1
- package/dist/audit/run-escape-hatch-retention.js +1 -1
- package/dist/auth-email-password/bootstrap.js +1 -1
- package/dist/auth-email-password/handlers/invite-accept-with-login.write.js +6 -3
- package/dist/auth-email-password/handlers/invite-accept.write.js +6 -3
- package/dist/auth-email-password/handlers/invite-info.query.js +1 -1
- package/dist/auth-email-password/handlers/invite-signup-complete.write.js +6 -3
- package/dist/auth-email-password/handlers/signup-confirm.write.js +1 -1
- package/dist/auth-email-password/seeding.js +2 -2
- package/dist/auth-foundation/feature.d.ts +4 -0
- package/dist/auth-foundation/feature.js +37 -33
- package/dist/auth-foundation/index.d.ts +1 -1
- package/dist/auth-foundation/index.js +1 -1
- package/dist/auth-mfa/db/queries.js +1 -2
- package/dist/auth-mfa/handlers/enable-confirm-preauth.write.js +1 -1
- package/dist/auth-mfa/handlers/enable-start-preauth.write.js +1 -1
- package/dist/auth-mfa/handlers/reencrypt.job.js +2 -3
- package/dist/auth-mfa/handlers/status.query.js +1 -1
- package/dist/auth-mfa/handlers/verify.write.js +1 -1
- package/dist/auth-mfa/mfa-code-verifier.js +1 -1
- package/dist/auth-mfa/mfa-status-checker.js +1 -1
- package/dist/auth-mfa-user-data/index.d.ts +4 -0
- package/dist/auth-mfa-user-data/index.js +13 -9
- package/dist/billing-foundation/billing-info-query.js +1 -1
- package/dist/billing-foundation/feature.d.ts +1 -0
- package/dist/billing-foundation/feature.js +5 -6
- package/dist/billing-foundation/handlers/create-portal-session.write.js +1 -1
- package/dist/billing-foundation/projection.js +1 -2
- package/dist/cap-counter/calendar-cap-usage-reservation.d.ts +7 -0
- package/dist/cap-counter/calendar-cap-usage-reservation.js +28 -2
- package/dist/cap-counter/cap-reservation.d.ts +16 -0
- package/dist/cap-counter/cap-reservation.js +144 -14
- package/dist/cap-counter/feature.d.ts +4 -0
- package/dist/cap-counter/feature.js +74 -68
- package/dist/cap-counter/handlers/increment-rolling.write.js +3 -4
- package/dist/cap-counter/index.d.ts +3 -2
- package/dist/cap-counter/index.js +3 -2
- package/dist/cap-counter/tables.js +10 -3
- package/dist/cap-overview/handlers/caps-usage.query.js +1 -2
- package/dist/cap-overview/handlers/tenant-caps-list.query.js +1 -2
- package/dist/cap-overview/handlers/tenant-options.query.js +1 -1
- package/dist/channel-in-app/handlers/inbox.query.js +1 -1
- package/dist/channel-in-app/handlers/mark-all-read.write.js +1 -1
- package/dist/channel-in-app/handlers/mark-read.write.js +1 -1
- package/dist/channel-in-app/handlers/unread-count.query.js +1 -1
- package/dist/channel-in-app/tables.js +1 -2
- package/dist/compliance-profiles/handlers/for-tenant.query.js +1 -1
- package/dist/compliance-profiles/handlers/needs-profile.query.js +1 -1
- package/dist/compliance-profiles/handlers/set-profile.write.js +1 -2
- package/dist/compliance-profiles/resolve-for-tenant.js +1 -1
- package/dist/compliance-profiles/seeding.js +3 -5
- package/dist/compliance-profiles-ops/index.d.ts +8 -0
- package/dist/compliance-profiles-ops/index.js +19 -15
- package/dist/config/db/queries/resolver.js +1 -1
- package/dist/config/handlers/reencrypt.job.js +2 -2
- package/dist/config/resolver.js +1 -1
- package/dist/config/write-helpers.js +1 -1
- package/dist/crypto-shredding/handlers/forget-subject.write.js +6 -3
- package/dist/custom-fields/db/queries/field-access.js +1 -1
- package/dist/custom-fields/db/queries/projection.js +1 -1
- package/dist/custom-fields/db/queries/quota.js +1 -1
- package/dist/custom-fields/db/queries/retention.js +1 -2
- package/dist/custom-fields/db/queries/user-data-rights.js +1 -1
- package/dist/custom-fields/feature.d.ts +20 -2
- package/dist/custom-fields/feature.js +9 -13
- package/dist/custom-fields/handlers/clear-custom-field.write.js +2 -2
- package/dist/custom-fields/handlers/delete-system-field.write.js +2 -2
- package/dist/custom-fields/handlers/delete-tenant-field.write.js +2 -2
- package/dist/custom-fields/handlers/set-custom-field.write.js +2 -2
- package/dist/custom-fields/wire-for-entity.js +4 -4
- package/dist/data-retention/resolve-for-tenant.js +1 -1
- package/dist/data-retention/run-retention-cleanup.js +17 -13
- package/dist/delivery/address-opt-out.js +1 -2
- package/dist/delivery/attempt-log-retention.js +1 -1
- package/dist/delivery/channel-context.js +1 -1
- package/dist/delivery/db/queries/address-opt-outs.js +1 -1
- package/dist/delivery/db/queries/preferences.js +1 -1
- package/dist/delivery/delivery-service.js +16 -7
- package/dist/delivery/feature.js +1 -1
- package/dist/delivery/handlers/log.query.js +2 -3
- package/dist/delivery/handlers/preferences.query.js +1 -1
- package/dist/delivery/upsert-preference.js +1 -2
- package/dist/derivatives-sharp/feature.d.ts +4 -0
- package/dist/derivatives-sharp/feature.js +15 -11
- package/dist/derivatives-sharp/index.d.ts +1 -1
- package/dist/derivatives-sharp/index.js +1 -1
- package/dist/document-ingest-foundation/feature.d.ts +7 -0
- package/dist/document-ingest-foundation/feature.js +94 -90
- package/dist/document-ingest-foundation/forget-extract-with-file-ref.js +3 -3
- package/dist/document-ingest-foundation/index.d.ts +1 -1
- package/dist/document-ingest-foundation/index.js +1 -1
- package/dist/feature-toggles/global-feature-state-table.js +1 -2
- package/dist/feature-toggles/handlers/set.write.js +3 -5
- package/dist/feature-toggles/toggle-runtime.js +1 -1
- package/dist/file-derivatives/feature.d.ts +1 -0
- package/dist/file-derivatives/feature.js +2 -1
- package/dist/file-derivatives/handlers/public-variant-by-file-ref.query.js +1 -1
- package/dist/file-derivatives/handlers/public-variant.query.js +1 -1
- package/dist/file-foundation/feature.d.ts +6 -0
- package/dist/file-foundation/feature.js +29 -25
- package/dist/file-foundation/index.d.ts +1 -1
- package/dist/file-foundation/index.js +1 -1
- package/dist/file-foundation/read-file-ref-content.js +1 -1
- package/dist/file-provider-inmemory/feature.d.ts +4 -0
- package/dist/file-provider-inmemory/feature.js +24 -20
- package/dist/file-provider-inmemory/index.d.ts +1 -1
- package/dist/file-provider-inmemory/index.js +1 -1
- package/dist/file-provider-s3/env-feature.d.ts +3 -0
- package/dist/file-provider-s3/env-feature.js +46 -0
- package/dist/file-provider-s3/feature.d.ts +26 -0
- package/dist/file-provider-s3/feature.js +84 -72
- package/dist/file-provider-s3/index.d.ts +1 -1
- package/dist/file-provider-s3/index.js +1 -1
- package/dist/file-provider-s3/lib/index.d.ts +3 -0
- package/dist/file-provider-s3/lib/index.js +2 -0
- package/dist/{files-provider-s3 → file-provider-s3/lib}/s3-provider.js +19 -19
- package/dist/file-provider-s3-env/index.d.ts +8 -1
- package/dist/file-provider-s3-env/index.js +7 -2
- package/dist/files-provider-s3/index.d.ts +5 -3
- package/dist/files-provider-s3/index.js +5 -2
- package/dist/files-tenant-data/handlers/sweep-orphaned-derivatives.job.js +1 -1
- package/dist/files-tenant-data/hooks.js +1 -2
- package/dist/folders/feature.d.ts +6 -2
- package/dist/folders/feature.js +4 -2
- package/dist/folders-user-data/index.d.ts +4 -0
- package/dist/folders-user-data/index.js +21 -17
- package/dist/form-draft/db/queries/cleanup.js +1 -1
- package/dist/form-draft/db/queries/draft-count.js +1 -1
- package/dist/form-draft/db/queries/owned-file-refs.js +1 -2
- package/dist/form-draft/feature.d.ts +4 -0
- package/dist/form-draft/feature.js +5 -1
- package/dist/form-draft/handlers/cleanup.job.js +2 -2
- package/dist/form-draft/index.d.ts +1 -1
- package/dist/form-draft/index.js +1 -1
- package/dist/form-draft/lookup.js +1 -1
- package/dist/form-draft-user-data/index.d.ts +4 -0
- package/dist/form-draft-user-data/index.js +13 -9
- package/dist/inbound-mail-foundation/feature.d.ts +4 -0
- package/dist/inbound-mail-foundation/feature.js +151 -147
- package/dist/inbound-mail-foundation/handlers/ingest-message.write.js +1 -2
- package/dist/inbound-mail-foundation/index.d.ts +1 -1
- package/dist/inbound-mail-foundation/index.js +1 -1
- package/dist/inbound-mail-foundation/oauth-access-token.js +1 -2
- package/dist/inbound-mail-foundation/projection.js +1 -2
- package/dist/inbound-mail-foundation/watch-supervisor.js +1 -1
- package/dist/inbound-provider-imap/feature.d.ts +4 -0
- package/dist/inbound-provider-imap/feature.js +16 -12
- package/dist/inbound-provider-imap/index.d.ts +1 -1
- package/dist/inbound-provider-imap/index.js +1 -1
- package/dist/inbound-provider-inmemory/feature.d.ts +4 -0
- package/dist/inbound-provider-inmemory/feature.js +14 -10
- package/dist/inbound-provider-inmemory/index.d.ts +1 -1
- package/dist/inbound-provider-inmemory/index.js +1 -1
- package/dist/jobs/db/queries/retention.js +1 -1
- package/dist/jobs/db/queries/stale-run-sweep.js +1 -1
- package/dist/jobs/handlers/detail.query.js +1 -1
- package/dist/jobs/handlers/list.query.js +1 -2
- package/dist/jobs/handlers/retry.write.js +1 -1
- package/dist/jobs/handlers/tenant-failures.query.js +1 -1
- package/dist/jobs/handlers/tenant-runs.query.js +1 -1
- package/dist/jobs/job-run-logger.js +1 -2
- package/dist/jobs/tenant-job-failure-table.js +1 -2
- package/dist/jobs/tenant-job-run-table.js +1 -2
- package/dist/ledger/feature.d.ts +6 -2
- package/dist/ledger/feature.js +4 -2
- package/dist/mail-foundation/feature.d.ts +7 -0
- package/dist/mail-foundation/feature.js +48 -42
- package/dist/mail-foundation/index.d.ts +1 -1
- package/dist/mail-foundation/index.js +1 -1
- package/dist/mail-transport-inmemory/feature.d.ts +4 -0
- package/dist/mail-transport-inmemory/feature.js +20 -16
- package/dist/mail-transport-inmemory/index.d.ts +1 -1
- package/dist/mail-transport-inmemory/index.js +1 -1
- package/dist/mail-transport-smtp/feature.d.ts +16 -0
- package/dist/mail-transport-smtp/feature.js +85 -79
- package/dist/mail-transport-smtp/index.d.ts +1 -1
- package/dist/mail-transport-smtp/index.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 -2
- package/dist/managed-pages/handlers/set.write.js +1 -2
- package/dist/managed-pages/seeding.js +3 -5
- package/dist/metrics/compute.d.ts +1 -1
- package/dist/metrics/filters.d.ts +1 -1
- package/dist/metrics/filters.js +1 -1
- package/dist/metrics/validate.js +1 -1
- package/dist/notes-history/feature.d.ts +7 -2
- package/dist/notes-history/feature.js +4 -2
- package/dist/notes-history/handlers/add-note.write.js +1 -1
- package/dist/notes-history-user-data/hooks.js +1 -1
- package/dist/notes-history-user-data/index.d.ts +4 -0
- package/dist/notes-history-user-data/index.js +21 -17
- package/dist/personal-access-tokens/feature.d.ts +4 -1
- package/dist/personal-access-tokens/feature.js +10 -2
- package/dist/personal-access-tokens/handlers/create.write.js +1 -1
- package/dist/personal-access-tokens/handlers/list.query.js +2 -2
- package/dist/personal-access-tokens/handlers/revoke.write.js +1 -1
- package/dist/personal-access-tokens/resolver.js +1 -1
- package/dist/personal-access-tokens/revoke-for-user.js +1 -1
- package/dist/personal-access-tokens/roles.js +3 -5
- package/dist/personal-access-tokens/screens.js +2 -0
- package/dist/readiness/feature.d.ts +8 -0
- package/dist/readiness/feature.js +18 -14
- package/dist/readiness/index.d.ts +1 -1
- package/dist/readiness/index.js +1 -1
- package/dist/secrets/db/queries/read.js +1 -1
- package/dist/secrets/feature.d.ts +3 -0
- package/dist/secrets/feature.js +3 -2
- package/dist/secrets/handlers/rotate.job.js +2 -3
- package/dist/secrets/secrets-context.js +3 -4
- package/dist/sessions/db/queries/cleanup.js +1 -1
- package/dist/sessions/handlers/detail.query.js +1 -1
- package/dist/sessions/handlers/list.query.js +2 -2
- package/dist/sessions/handlers/mine.query.js +1 -1
- package/dist/sessions/handlers/revoke-all-for-user.write.js +1 -1
- package/dist/sessions/handlers/revoke-all-others.write.js +1 -1
- package/dist/sessions/handlers/revoke.write.js +1 -1
- package/dist/sessions/session-callbacks.js +4 -6
- package/dist/sessions/testing.d.ts +1 -1
- package/dist/tags/feature.d.ts +6 -2
- package/dist/tags/feature.js +4 -2
- package/dist/template-resolver/api.js +1 -1
- package/dist/template-resolver/handlers/bundle-import.js +1 -1
- package/dist/template-resolver/handlers/by-slug.query.js +1 -1
- package/dist/template-resolver/handlers/by-tenant.query.js +1 -2
- package/dist/template-resolver/handlers/collection-item.query.js +1 -1
- package/dist/template-resolver/handlers/collection-list.query.js +1 -2
- package/dist/template-resolver/handlers/collection-set.write.js +1 -1
- package/dist/template-resolver/handlers/copy-locale.write.js +1 -1
- package/dist/template-resolver/handlers/diff-to-system.query.js +1 -1
- package/dist/template-resolver/handlers/export-bundle.query.js +1 -1
- package/dist/template-resolver/handlers/find-by-id.query.js +1 -1
- package/dist/template-resolver/handlers/layout-source.query.js +1 -1
- package/dist/template-resolver/handlers/list.query.js +1 -1
- package/dist/template-resolver/handlers/overview.query.js +1 -1
- package/dist/template-resolver/handlers/reset-to-system.write.js +1 -1
- package/dist/template-resolver/handlers/resource-remove.write.js +1 -1
- package/dist/template-resolver/handlers/set.write.js +1 -1
- package/dist/template-resolver/handlers/template-write.js +1 -1
- package/dist/template-resolver/handlers/tenant-overrides.query.js +1 -1
- package/dist/template-resolver/handlers/toggle-status.write.js +1 -1
- package/dist/template-resolver/handlers/usage.query.js +1 -1
- package/dist/template-resolver/handlers/validate.query.js +1 -1
- package/dist/template-resolver/seeding.js +3 -4
- package/dist/template-resolver/store-template-resource.js +1 -1
- package/dist/template-resolver/template-preview.js +1 -1
- package/dist/template-resolver/template-resources.js +1 -1
- package/dist/template-resolver/testing.js +1 -1
- package/dist/template-resolver-user-data/index.d.ts +4 -0
- package/dist/template-resolver-user-data/index.js +17 -13
- package/dist/tenant/handlers/active-tenant-ids.query.js +1 -1
- package/dist/tenant/handlers/add-member.write.js +1 -2
- package/dist/tenant/handlers/cancel-invitation.write.js +1 -1
- package/dist/tenant/handlers/invitations.query.js +1 -1
- package/dist/tenant/handlers/me.query.js +1 -1
- package/dist/tenant/handlers/member-directory.query.js +1 -1
- package/dist/tenant/handlers/members.query.js +1 -1
- package/dist/tenant/handlers/memberships.query.js +1 -1
- package/dist/tenant/handlers/remove-member.write.js +1 -2
- package/dist/tenant/handlers/resolve-user-ids.query.js +1 -1
- package/dist/tenant/handlers/team-list.query.js +1 -1
- package/dist/tenant/handlers/tenant-directory.query.js +1 -1
- package/dist/tenant/handlers/update-member-roles.write.js +1 -2
- package/dist/tenant/invited-membership.js +2 -3
- package/dist/tenant/last-tenant-admin.js +1 -2
- package/dist/tenant/seeding.js +12 -6
- package/dist/tenant-lifecycle/handlers/cancel-destruction.write.js +1 -2
- package/dist/tenant-lifecycle/handlers/request-destruction.write.js +1 -2
- package/dist/tenant-lifecycle/lib/revoke-tenant-sessions.js +1 -1
- package/dist/tenant-lifecycle/lifecycle-gate.js +1 -1
- package/dist/tenant-lifecycle/run-tenant-destroy.js +3 -5
- package/dist/tenant-lifecycle/stages.js +10 -6
- package/dist/tenant-lifecycle/testing.d.ts +1 -1
- package/dist/tenant-lifecycle/testing.js +2 -2
- package/dist/tenant-settings/feature.d.ts +1 -0
- package/dist/tenant-settings/feature.js +2 -1
- package/dist/tier-engine/feature.d.ts +1 -8
- package/dist/tier-engine/feature.js +71 -78
- package/dist/tier-engine/handlers/get-tenant-tier.query.js +2 -3
- package/dist/tier-engine/handlers/set-tenant-tier.write.js +1 -2
- package/dist/user/db/queries/stream-tenant-backfill.js +1 -1
- package/dist/user/handlers/create.write.js +1 -2
- package/dist/user/handlers/find-for-auth.query.js +1 -1
- package/dist/user/handlers/list.query.js +1 -1
- package/dist/user/handlers/update-roles.js +1 -2
- package/dist/user/index.d.ts +1 -1
- package/dist/user/index.js +1 -1
- package/dist/user/invited-global-roles.js +2 -3
- package/dist/user/principal-status.d.ts +4 -0
- package/dist/user/principal-status.js +9 -3
- package/dist/user/resolve-display-names.js +1 -1
- package/dist/user/seeding.js +5 -6
- package/dist/user-data-rights/audit-download.js +2 -2
- package/dist/user-data-rights/db/queries/export-jobs.js +1 -1
- package/dist/user-data-rights/db/queries/forget-cleanup.js +1 -1
- package/dist/user-data-rights/handlers/download-by-job.query.js +1 -1
- package/dist/user-data-rights/handlers/download-by-token.query.js +1 -1
- package/dist/user-data-rights/handlers/export-status.query.js +1 -1
- package/dist/user-data-rights/handlers/list-download-attempts.query.js +1 -1
- package/dist/user-data-rights/handlers/my-audit-log.query.js +1 -1
- package/dist/user-data-rights/handlers/request-export.write.js +1 -2
- package/dist/user-data-rights/handlers/run-forget-cleanup.write.js +3 -3
- package/dist/user-data-rights/lib/deny-if-target-outside-admin-tenant.d.ts +1 -1
- package/dist/user-data-rights/lib/deny-if-target-outside-admin-tenant.js +1 -1
- package/dist/user-data-rights/lib/update-user-lifecycle.d.ts +1 -0
- package/dist/user-data-rights/lib/update-user-lifecycle.js +3 -3
- package/dist/user-data-rights/run-export-jobs.js +2 -3
- package/dist/user-data-rights/run-forget-cleanup.js +9 -5
- package/dist/user-data-rights/run-user-export.js +9 -5
- package/dist/waitlist/handlers/invite.write.js +1 -2
- package/dist/waitlist/handlers/reject.write.js +1 -1
- package/dist/waitlist/lib.js +1 -2
- package/dist/workflow-runner/event-subscriber.js +1 -1
- package/dist/workflow-runner/feature.d.ts +4 -0
- package/dist/workflow-runner/feature.js +44 -40
- package/dist/workflow-runner/handlers/resume-run.write.js +1 -1
- package/dist/workflow-runner/index.d.ts +1 -1
- package/dist/workflow-runner/index.js +1 -1
- package/dist/workflow-runner/pending-projection.js +1 -1
- package/package.json +28 -11
- package/src/cap-counter/changes.json +13 -0
- package/src/crypto-shredding/changes.json +6 -0
- package/src/file-provider-s3/changes.json +10 -1
- package/src/personal-access-tokens/changes.json +6 -0
- package/src/user/changes.json +6 -0
- package/dist/file-provider-s3-env/feature.d.ts +0 -3
- package/dist/file-provider-s3-env/feature.js +0 -46
- /package/dist/{files-provider-s3 → file-provider-s3/lib}/env-helper.d.ts +0 -0
- /package/dist/{files-provider-s3 → file-provider-s3/lib}/env-helper.js +0 -0
- /package/dist/{files-provider-s3 → file-provider-s3/lib}/s3-provider.d.ts +0 -0
|
@@ -81,95 +81,99 @@ async function requestIngestForFileRef(event, fileRef, ctx) {
|
|
|
81
81
|
},
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
export
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
84
|
+
export function createDocumentIngestFoundationFeature() {
|
|
85
|
+
return defineFeature(FEATURE_NAME, (r) => {
|
|
86
|
+
r.describe("Shared PDF/Scan/Image → normalized-text ingest primitive. Owns the `documentExtract` entity (fileRefId, storageKey, per-page text + metadata) as an implicit entity-projection, the per-tenant `ocrLanguage`/`maxPagesPerFile` config keys, the `documentIngestProvider` extension-point providers register accepted mimeTypes/size caps under, and a fileRef.created/fileRef.restored trigger that resolves the provider for a file's mimeType and requests ingest via `documentIngest.requested` tagged with the winning provider — a delete→restore round-trip re-requests ingest the same way a fresh upload does. An orphan-extract guard forgets any `documentExtract` whose fileRef is no longer live at processing time, regardless of how a provider's own write races the fileRef's delete/forget — providers should write through `writeDocumentExtractForLiveFileRef`.");
|
|
87
|
+
r.uiHints({
|
|
88
|
+
displayLabel: "Document Ingest Foundation",
|
|
89
|
+
category: "storage",
|
|
90
|
+
recommended: false,
|
|
91
|
+
});
|
|
92
|
+
// tenant-lifecycle hosts EXT_TENANT_DATA — documentExtract.pages is
|
|
93
|
+
// tenant-subject ciphertext and needs the destroy hook below.
|
|
94
|
+
r.requires({ features: ["config", "tenant-lifecycle"] });
|
|
95
|
+
r.entity({ name: "documentExtract", ...documentExtractEntity });
|
|
96
|
+
r.useExtension(EXT_TENANT_DATA, "documentExtract", {
|
|
97
|
+
destroy: documentExtractTenantDestroyHook,
|
|
98
|
+
});
|
|
99
|
+
// No onRegister: resolution happens at boot and per-apply, not on register.
|
|
100
|
+
r.extendsRegistrar(EXT_DOCUMENT_INGEST_PROVIDER, {});
|
|
101
|
+
r.bootCheck(({ features }) => validateDocumentIngestProviderWiring(features));
|
|
102
|
+
const ocrLanguageConfigKey = r.config("ocrLanguage", createTenantConfig("text", {
|
|
103
|
+
default: "deu+eng",
|
|
104
|
+
// Tesseract -l argument syntax: one or more 3-letter language codes
|
|
105
|
+
// joined by "+" (e.g. "deu+eng"). Unconstrained free text here would
|
|
106
|
+
// reach the OCR provider call unvalidated (#1501).
|
|
107
|
+
pattern: { regex: "^[a-z]{3}(\\+[a-z]{3})*$" },
|
|
108
|
+
write: access.roles("TenantAdmin", "SystemAdmin"),
|
|
109
|
+
read: access.roles("TenantAdmin", "SystemAdmin", "User"),
|
|
110
|
+
}));
|
|
111
|
+
const maxPagesPerFileConfigKey = r.config("maxPagesPerFile", createTenantConfig("number", {
|
|
112
|
+
default: 50,
|
|
113
|
+
// Without a bound a tenant could set 0 (silently kills ingest) or an
|
|
114
|
+
// unbounded value (OCR worker runs per-file for as long as the PDF
|
|
115
|
+
// has pages — job-queue starvation) (#1501).
|
|
116
|
+
bounds: { min: 1, max: 500 },
|
|
117
|
+
write: access.roles("TenantAdmin", "SystemAdmin"),
|
|
118
|
+
read: access.roles("TenantAdmin", "SystemAdmin", "User"),
|
|
119
|
+
}));
|
|
120
|
+
// "fileName" can carry a real person's name, but it reaches both events already as the
|
|
121
|
+
// fileRef's own self-subject ciphertext (copied from fileRef.created/restored), which
|
|
122
|
+
// append() passes through; shredding the fileRef's key shreds it here too.
|
|
123
|
+
r.defineEvent(DOCUMENT_INGEST_REQUESTED_EVENT_SHORT, documentIngestRequestedPayloadSchema, {
|
|
124
|
+
piiFields: "none",
|
|
125
|
+
version: 2,
|
|
126
|
+
migrations: [
|
|
127
|
+
{
|
|
128
|
+
fromVersion: 1,
|
|
129
|
+
toVersion: 2,
|
|
130
|
+
// The sentinel can never match a real where.provider filter (providers
|
|
131
|
+
// may not register under it) — an upcast v1 row reads as unclaimed
|
|
132
|
+
// instead of silently misrouting to a currently mounted provider.
|
|
133
|
+
transform: { default: { provider: UNCLAIMED_PROVIDER_SENTINEL } },
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
r.defineEvent(DOCUMENT_INGEST_SKIPPED_EVENT_SHORT, documentIngestSkippedPayloadSchema, {
|
|
138
|
+
piiFields: "none",
|
|
139
|
+
});
|
|
140
|
+
r.multiStreamProjection({
|
|
141
|
+
name: "request-ingest",
|
|
142
|
+
apply: {
|
|
143
|
+
[FILE_REF_CREATED]: async (event, _tx, ctx) => {
|
|
144
|
+
// entity-event payloads are generic Record<string, unknown> — parse
|
|
145
|
+
// at the MSP boundary (same pattern as storage-tracking's readNumber).
|
|
146
|
+
const parsed = fileRefIngestFieldsSchema.safeParse(event.payload);
|
|
147
|
+
// skip: malformed / incomplete payload — don't poison the consumer
|
|
148
|
+
if (!parsed.success)
|
|
149
|
+
return;
|
|
150
|
+
await requestIngestForFileRef(event, parsed.data, ctx);
|
|
151
|
+
},
|
|
152
|
+
[FILE_REF_RESTORED]: async (event, _tx, ctx) => {
|
|
153
|
+
// fileRef.restored carries { previous }, the pre-restore soft-deleted
|
|
154
|
+
// row (event-store-executor-write.ts restore()) — same field shape
|
|
155
|
+
// as fileRef.created's payload.
|
|
156
|
+
const parsed = fileRefIngestFieldsSchema.safeParse(event.payload["previous"]);
|
|
157
|
+
// skip: malformed / incomplete previous snapshot — don't poison the consumer
|
|
158
|
+
if (!parsed.success)
|
|
159
|
+
return;
|
|
160
|
+
await requestIngestForFileRef(event, parsed.data, ctx);
|
|
161
|
+
},
|
|
150
162
|
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
});
|
|
164
|
+
// fileRef delete/forget cleanup: documentExtract rows are derived data —
|
|
165
|
+
// once the source file is gone (soft-deleted or Art.17-forgotten), the
|
|
166
|
+
// extracted text has no reason to survive it either.
|
|
167
|
+
r.multiStreamProjection({
|
|
168
|
+
name: "forget-extract-with-file-ref",
|
|
169
|
+
apply: {
|
|
170
|
+
[FILE_REF_DELETED]: forgetExtractOnFileRefDeletedHook,
|
|
171
|
+
[FILE_REF_FORGOTTEN]: forgetExtractOnFileRefForgottenHook,
|
|
172
|
+
[DOCUMENT_EXTRACT_CREATED]: forgetOrphanedDocumentExtractHook,
|
|
160
173
|
},
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
name: "forget-extract-with-file-ref",
|
|
168
|
-
apply: {
|
|
169
|
-
[FILE_REF_DELETED]: forgetExtractOnFileRefDeletedHook,
|
|
170
|
-
[FILE_REF_FORGOTTEN]: forgetExtractOnFileRefForgottenHook,
|
|
171
|
-
[DOCUMENT_EXTRACT_CREATED]: forgetOrphanedDocumentExtractHook,
|
|
172
|
-
},
|
|
173
|
-
});
|
|
174
|
-
return { ocrLanguageConfigKey, maxPagesPerFileConfigKey };
|
|
175
|
-
});
|
|
174
|
+
});
|
|
175
|
+
return { ocrLanguageConfigKey, maxPagesPerFileConfigKey };
|
|
176
|
+
}, { dedupeOptions: {} });
|
|
177
|
+
}
|
|
178
|
+
/** @deprecated Use createDocumentIngestFoundationFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
|
|
179
|
+
export const documentIngestFoundationFeature = createDocumentIngestFoundationFeature();
|
|
@@ -48,7 +48,7 @@ export const forgetOrphanedDocumentExtractHook = async (event, tx) => {
|
|
|
48
48
|
// skip: malformed payload — don't poison the consumer
|
|
49
49
|
if (!parsed.success)
|
|
50
50
|
return;
|
|
51
|
-
const tenantDb = createTenantDb(tx, event.tenantId);
|
|
51
|
+
const tenantDb = createTenantDb({ db: tx, tenantId: event.tenantId });
|
|
52
52
|
// skip: fileRef still live — the extract is legitimate
|
|
53
53
|
if (await isFileRefLive(tenantDb, parsed.data.fileRefId))
|
|
54
54
|
return;
|
|
@@ -60,7 +60,7 @@ export const forgetOrphanedDocumentExtractHook = async (event, tx) => {
|
|
|
60
60
|
throw new Error(`document-ingest-foundation: failed to forget orphaned documentExtract ${event.aggregateId}: ${result.error.message}`);
|
|
61
61
|
};
|
|
62
62
|
export const forgetExtractOnFileRefDeletedHook = async (event, tx) => {
|
|
63
|
-
const tenantDb = createTenantDb(tx, event.tenantId);
|
|
63
|
+
const tenantDb = createTenantDb({ db: tx, tenantId: event.tenantId });
|
|
64
64
|
// skip: fileRef is live again — request-ingest and this consumer poll via
|
|
65
65
|
// separate cursors, so a delete→restore round-trip can finish before this
|
|
66
66
|
// consumer sees fileRef.deleted; forgetting would drop the live file's extract.
|
|
@@ -69,6 +69,6 @@ export const forgetExtractOnFileRefDeletedHook = async (event, tx) => {
|
|
|
69
69
|
await forgetExtractsForFileRef(event, tenantDb);
|
|
70
70
|
};
|
|
71
71
|
export const forgetExtractOnFileRefForgottenHook = async (event, tx) => {
|
|
72
|
-
const tenantDb = createTenantDb(tx, event.tenantId);
|
|
72
|
+
const tenantDb = createTenantDb({ db: tx, tenantId: event.tenantId });
|
|
73
73
|
await forgetExtractsForFileRef(event, tenantDb);
|
|
74
74
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { documentIngestAggregateId } from "./aggregate-id.js";
|
|
2
2
|
export { type DocumentExtractMeta, documentExtractEntity, documentExtractsTable, type IngestPage, } from "./entity.js";
|
|
3
3
|
export { 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 DocumentIngestRequestedPayload, type DocumentIngestSkippedPayload, documentIngestRequestedPayloadSchema, documentIngestSkippedPayloadSchema, } from "./events.js";
|
|
4
|
-
export { documentIngestFoundationFeature } from "./feature.js";
|
|
4
|
+
export { createDocumentIngestFoundationFeature, documentIngestFoundationFeature, } from "./feature.js";
|
|
5
5
|
export { readIngestPages, writeIngestPages } from "./pages.js";
|
|
6
6
|
export { type DocumentIngestProviderOptions, documentIngestProviderOptionsSchema, documentIngestProviderTrigger, EXT_DOCUMENT_INGEST_PROVIDER, listIngestibleMimeTypes, type ResolvedDocumentIngestProvider, resolveDocumentIngestProviders, } from "./providers.js";
|
|
7
7
|
export { type DocumentExtractWriteResult, writeDocumentExtractForLiveFileRef, } from "./write-document-extract.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export { documentIngestAggregateId } from "./aggregate-id.js";
|
|
3
3
|
export { documentExtractEntity, documentExtractsTable, } from "./entity.js";
|
|
4
4
|
export { 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";
|
|
5
|
-
export { documentIngestFoundationFeature } from "./feature.js";
|
|
5
|
+
export { createDocumentIngestFoundationFeature, documentIngestFoundationFeature, } from "./feature.js";
|
|
6
6
|
export { readIngestPages, writeIngestPages } from "./pages.js";
|
|
7
7
|
export { documentIngestProviderOptionsSchema, documentIngestProviderTrigger, EXT_DOCUMENT_INGEST_PROVIDER, listIngestibleMimeTypes, resolveDocumentIngestProviders, } from "./providers.js";
|
|
8
8
|
export { writeDocumentExtractForLiveFileRef, } from "./write-document-extract.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { requireEntityTableMeta } from "@cosmicdrift/kumiko-framework/
|
|
2
|
-
import { boolean, declareGlobalTenancy, instant, integer, table as pgTable, sql, text, } from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { boolean, declareGlobalTenancy, instant, integer, table as pgTable, requireEntityTableMeta, sql, text, } from "@cosmicdrift/kumiko-framework/db";
|
|
3
2
|
// Global feature-toggle override state. One row per feature that has ever
|
|
4
3
|
// been explicitly flipped by an operator. Missing row = "no override,
|
|
5
4
|
// fall back to the feature's r.toggleable({ default }) value".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insertOne, selectMany } from "@cosmicdrift/kumiko-framework/
|
|
1
|
+
import { insertOne, selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineWriteHandler, SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { UnprocessableError, VersionConflictError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
@@ -109,10 +109,8 @@ export function createSetWriteHandler(getRuntime) {
|
|
|
109
109
|
// and filtering by payload.featureName is trivial at query time.
|
|
110
110
|
// This mirrors how `config` handles the same constraint for
|
|
111
111
|
// its config-changed events.
|
|
112
|
-
// unsafeAppendEvent
|
|
113
|
-
//
|
|
114
|
-
// path; bundled-features bleibt bei der unsafe-Variante. Schema-
|
|
115
|
-
// Validation läuft trotzdem via r.defineEvent("toggle-set", ...).
|
|
112
|
+
// unsafeAppendEvent: the strict appendEvent is bound to an app's own event map, which
|
|
113
|
+
// bundled-features cannot see. Schema validation still runs via r.defineEvent("toggle-set", ...).
|
|
116
114
|
await ctx.unsafeAppendEvent({
|
|
117
115
|
aggregateId: SYSTEM_TENANT_ID,
|
|
118
116
|
aggregateType: FEATURE_TOGGLE_AGGREGATE_TYPE,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/
|
|
1
|
+
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { computeEffectiveFeatures, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
4
4
|
import { createDefaultCacheSyncBus, } from "@cosmicdrift/kumiko-framework/redis";
|
|
@@ -25,4 +25,5 @@ export type FileDerivativesOptions = {
|
|
|
25
25
|
readonly publicTenantResolution?: PublicVariantTenantResolution;
|
|
26
26
|
};
|
|
27
27
|
export declare function createFileDerivativesFeature(opts?: FileDerivativesOptions): FeatureDefinition;
|
|
28
|
+
/** @deprecated Use createFileDerivativesFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
|
|
28
29
|
export declare const fileDerivativesFeature: FeatureDefinition;
|
|
@@ -161,6 +161,7 @@ export function createFileDerivativesFeature(opts = {}) {
|
|
|
161
161
|
},
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
});
|
|
164
|
+
}, Object.keys(opts).length === 0 ? { dedupeOptions: {} } : undefined);
|
|
165
165
|
}
|
|
166
|
+
/** @deprecated Use createFileDerivativesFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
|
|
166
167
|
export const fileDerivativesFeature = createFileDerivativesFeature();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
1
|
+
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { createAnonymousUser, defineQueryHandler, isUuid, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { fileRefsTable } from "@cosmicdrift/kumiko-framework/files";
|
|
4
4
|
import { isTenantServingPublicContent, tenantTable, } from "../../tenant/index.js";
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// publicVariantByFileRefQuery — tenantId there comes from the FileRef row,
|
|
23
23
|
// but this handler's own isPublic gate runs exactly the same either way.
|
|
24
24
|
import { computeRevisionEtag } from "@cosmicdrift/kumiko-framework/api";
|
|
25
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
25
|
+
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
26
26
|
import { resolveFieldVariant } from "@cosmicdrift/kumiko-framework/derivatives";
|
|
27
27
|
import { defineQueryHandler, EXT_DERIVATIVE_PUBLIC_PREDICATE, isUuid, } from "@cosmicdrift/kumiko-framework/engine";
|
|
28
28
|
import { fileRefsTable } from "@cosmicdrift/kumiko-framework/files";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export type { FileProviderContext, FileProviderPlugin, } from "@cosmicdrift/kumiko-framework/files";
|
|
2
2
|
export { createFileProviderForTenant, isFileProviderPlugin, } from "@cosmicdrift/kumiko-framework/files";
|
|
3
|
+
export declare function createFileFoundationFeature(): import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
|
|
4
|
+
readonly exports: {
|
|
5
|
+
providerConfigKey: import("@cosmicdrift/kumiko-types/config").ConfigKeyHandle<"text">;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
/** @deprecated Use createFileFoundationFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
|
|
3
9
|
export declare const fileFoundationFeature: import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
|
|
4
10
|
readonly exports: {
|
|
5
11
|
providerConfigKey: import("@cosmicdrift/kumiko-types/config").ConfigKeyHandle<"text">;
|
|
@@ -20,28 +20,32 @@ import { access, createTenantConfig, defineFeature, EXT_FILE_PROVIDER, FILE_STOR
|
|
|
20
20
|
// features/file-foundation` consumers (user-data-rights, app code) keep working.
|
|
21
21
|
export { createFileProviderForTenant, isFileProviderPlugin, } from "@cosmicdrift/kumiko-framework/files";
|
|
22
22
|
const FEATURE_NAME = "file-foundation";
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
23
|
+
export function createFileFoundationFeature() {
|
|
24
|
+
return defineFeature(FEATURE_NAME, (r) => {
|
|
25
|
+
r.describe("Defines the `fileProvider` extension point and a per-tenant `provider` config key that selects which registered storage plugin to use at runtime. Call `createFileProviderForTenant(ctx, tenantId)` to get a `FileStorageProvider` — use this feature together with at least one `file-provider-*` feature; the `files` feature builds on top of it for tracked `FileRef` entities with GDPR hooks.");
|
|
26
|
+
r.uiHints({
|
|
27
|
+
displayLabel: "File Provider Foundation",
|
|
28
|
+
category: "storage",
|
|
29
|
+
recommended: false,
|
|
30
|
+
});
|
|
31
|
+
r.requires({ features: ["config"] });
|
|
32
|
+
r.extendsRegistrar(EXT_FILE_PROVIDER, {
|
|
33
|
+
onRegister: () => {
|
|
34
|
+
// No side-effects at register-time — registry stores the usage,
|
|
35
|
+
// factory looks it up at request-time.
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const providerConfigKey = r.config("provider", createTenantConfig("text", {
|
|
39
|
+
default: "",
|
|
40
|
+
env: FILE_STORAGE_PROVIDER_ENV,
|
|
41
|
+
write: access.roles("TenantAdmin", "SystemAdmin"),
|
|
42
|
+
read: access.roles("TenantAdmin", "SystemAdmin", "User"),
|
|
43
|
+
}));
|
|
44
|
+
// Readiness gating: provider-plugins' required keys/secrets count only
|
|
45
|
+
// while their plugin is the one this key selects.
|
|
46
|
+
r.extensionSelector(EXT_FILE_PROVIDER, providerConfigKey);
|
|
47
|
+
return { providerConfigKey };
|
|
48
|
+
}, { dedupeOptions: {} });
|
|
49
|
+
}
|
|
50
|
+
/** @deprecated Use createFileFoundationFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
|
|
51
|
+
export const fileFoundationFeature = createFileFoundationFeature();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createFileProviderForTenant, type FileProviderContext, type FileProviderPlugin, fileFoundationFeature, isFileProviderPlugin, } from "./feature.js";
|
|
1
|
+
export { createFileFoundationFeature, createFileProviderForTenant, type FileProviderContext, type FileProviderPlugin, fileFoundationFeature, isFileProviderPlugin, } from "./feature.js";
|
|
2
2
|
export { type FileRefContent, FileRefTooLargeError, fileContextForTenant, fileContextFromResolver, readFileRefContent, } from "./read-file-ref-content.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Public API of the file-foundation bundled-feature.
|
|
2
|
-
export { createFileProviderForTenant, fileFoundationFeature, isFileProviderPlugin, } from "./feature.js";
|
|
2
|
+
export { createFileFoundationFeature, createFileProviderForTenant, fileFoundationFeature, isFileProviderPlugin, } from "./feature.js";
|
|
3
3
|
export { FileRefTooLargeError, fileContextForTenant, fileContextFromResolver, readFileRefContent, } from "./read-file-ref-content.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/
|
|
1
|
+
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { isUuid } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { createFileContext, fileRefsTable, } from "@cosmicdrift/kumiko-framework/files";
|
|
4
4
|
// Tenant-bound on purpose: without a resolver `ctx.files` only reaches the storage of the
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
export declare function listKeys(tenantId: string): readonly string[];
|
|
3
3
|
/** Demo/Test-Helper: leere den Tenant-Storage. */
|
|
4
4
|
export declare function clearStorage(tenantId: string): void;
|
|
5
|
+
export declare function createFileProviderInMemoryFeature(): import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
|
|
6
|
+
readonly exports: void;
|
|
7
|
+
};
|
|
8
|
+
/** @deprecated Use createFileProviderInMemoryFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
|
|
5
9
|
export declare const fileProviderInMemoryFeature: import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
|
|
6
10
|
readonly exports: void;
|
|
7
11
|
};
|
|
@@ -42,23 +42,27 @@ export function clearStorage(tenantId) {
|
|
|
42
42
|
// =============================================================================
|
|
43
43
|
// Feature-definition
|
|
44
44
|
// =============================================================================
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
45
|
+
export function createFileProviderInMemoryFeature() {
|
|
46
|
+
return defineFeature(FEATURE_NAME, (r) => {
|
|
47
|
+
r.describe('Registers an in-process `"inmemory"` provider for `file-foundation` that stores file bytes per tenant in a module-level Map. Use `listKeys(tenantId)` and `clearStorage(tenantId)` in demo apps and tests; not for production (data is lost on restart and grows without bound).');
|
|
48
|
+
r.uiHints({
|
|
49
|
+
displayLabel: "File Provider · In-Memory",
|
|
50
|
+
category: "storage",
|
|
51
|
+
recommended: false,
|
|
52
|
+
});
|
|
53
|
+
// Kein requires auf "config" oder "secrets" — der
|
|
54
|
+
// In-Memory-Provider hat keine Config + kein Secret. Nur die
|
|
55
|
+
// file-foundation muss da sein (Plugin-extension-point).
|
|
56
|
+
r.requires({ features: ["file-foundation"] });
|
|
57
|
+
const plugin = {
|
|
58
|
+
build: async (_ctx, tenantId) => {
|
|
59
|
+
// Returns the per-tenant storage. Identity-stable across calls so
|
|
60
|
+
// accumulated state is kept.
|
|
61
|
+
return getOrCreateProviderForTenant(tenantId);
|
|
62
|
+
}, // @wrapper-known semantic-alias
|
|
63
|
+
};
|
|
64
|
+
r.useExtension("fileProvider", "inmemory", plugin);
|
|
65
|
+
}, { dedupeOptions: {} });
|
|
66
|
+
}
|
|
67
|
+
/** @deprecated Use createFileProviderInMemoryFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
|
|
68
|
+
export const fileProviderInMemoryFeature = createFileProviderInMemoryFeature();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { clearStorage, fileProviderInMemoryFeature, listKeys } from "./feature.js";
|
|
1
|
+
export { clearStorage, createFileProviderInMemoryFeature, fileProviderInMemoryFeature, listKeys, } from "./feature.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Public API of the file-provider-inmemory bundled-feature.
|
|
2
|
-
export { clearStorage, fileProviderInMemoryFeature, listKeys } from "./feature.js";
|
|
2
|
+
export { clearStorage, createFileProviderInMemoryFeature, fileProviderInMemoryFeature, listKeys, } from "./feature.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// file-provider-s3-env — S3 file provider configured entirely from
|
|
2
|
+
// process.env. ONE shared bucket for ALL tenants: wire it by setting the
|
|
3
|
+
// `S3_*` env vars + mounting — no per-tenant admin seeding and no
|
|
4
|
+
// `secrets`-feature dependency.
|
|
5
|
+
//
|
|
6
|
+
// **vs the default file-provider-s3:** the config-based `"s3"` provider owns per-tenant
|
|
7
|
+
// config keys + an encrypted `s3.secretAccessKey` secret (per-tenant
|
|
8
|
+
// buckets, admin-seeded). This `"s3-env"` provider reads one credential set
|
|
9
|
+
// from env and serves every tenant from one bucket — the
|
|
10
|
+
// Hetzner-Object-Storage / single-bucket deploy case. Tenant isolation
|
|
11
|
+
// still holds: file keys carry the tenant (export ZIPs:
|
|
12
|
+
// `exports/<tenantId>/<jobId>.zip`) or are globally-unique UUIDs (fileRefs).
|
|
13
|
+
//
|
|
14
|
+
// **Pattern-Vorbild:** mirrors file-provider-inmemory (zero admin seeding,
|
|
15
|
+
// only the file-foundation plugin-point required).
|
|
16
|
+
//
|
|
17
|
+
// **Env vars** (read by createS3ProviderFromEnv, prefix `S3_`):
|
|
18
|
+
// required — S3_BUCKET, S3_REGION, S3_ACCESS_KEY, S3_SECRET_KEY
|
|
19
|
+
// optional — S3_ENDPOINT (S3-compat stores incl. Hetzner Object Storage),
|
|
20
|
+
// S3_FORCE_PATH_STYLE
|
|
21
|
+
// Missing required vars throw on the FIRST file op (inside the export cron).
|
|
22
|
+
// The user-data-rights boot guard surfaces that at boot instead.
|
|
23
|
+
import { defineFeature } from "@cosmicdrift/kumiko-framework/engine";
|
|
24
|
+
import { createS3ProviderFromEnv } from "./lib/env-helper.js";
|
|
25
|
+
const FEATURE_NAME = "file-provider-s3-env";
|
|
26
|
+
export function createFileProviderS3EnvFeature() {
|
|
27
|
+
return defineFeature(FEATURE_NAME, (r) => {
|
|
28
|
+
r.describe('Registers an `"s3-env"` provider for `file-foundation` that reads one S3 credential set from `process.env` (`S3_BUCKET`/`S3_REGION`/`S3_ACCESS_KEY`/`S3_SECRET_KEY`, optional `S3_ENDPOINT`/`S3_FORCE_PATH_STYLE`) and serves every tenant from one shared bucket — no per-tenant config or secret seeding. Use this for single-bucket S3-compatible deploys (e.g. Hetzner Object Storage); use `file-provider-s3` instead when each tenant needs its own bucket/credentials.');
|
|
29
|
+
r.uiHints({
|
|
30
|
+
displayLabel: "File Provider · S3 (env)",
|
|
31
|
+
category: "storage",
|
|
32
|
+
recommended: false,
|
|
33
|
+
});
|
|
34
|
+
// No requires on "config" or "secrets" — credentials come from
|
|
35
|
+
// env, not the per-tenant config + secrets store. Only the file-foundation
|
|
36
|
+
// plugin-extension-point must be mounted.
|
|
37
|
+
r.requires({ features: ["file-foundation"] });
|
|
38
|
+
const plugin = {
|
|
39
|
+
// tenantId ignored: one shared bucket serves all tenants (isolation via
|
|
40
|
+
// tenant-prefixed / UUID keys). Built fresh per call like file-provider-s3;
|
|
41
|
+
// the S3 client opens no connection at construction.
|
|
42
|
+
build: async (_ctx, _tenantId) => createS3ProviderFromEnv(), // @wrapper-known semantic-alias
|
|
43
|
+
};
|
|
44
|
+
r.useExtension("fileProvider", "s3-env", plugin);
|
|
45
|
+
}, { dedupeOptions: {} });
|
|
46
|
+
}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
import { createFileProviderS3EnvFeature } from "./env-feature.js";
|
|
2
|
+
declare function createTenantConfigFileProviderS3Feature(): import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
|
|
3
|
+
readonly exports: {
|
|
4
|
+
configKeys: {
|
|
5
|
+
readonly bucket: import("@cosmicdrift/kumiko-types/config").ConfigKeyHandle<"text">;
|
|
6
|
+
readonly region: import("@cosmicdrift/kumiko-types/config").ConfigKeyHandle<"text">;
|
|
7
|
+
readonly endpoint: import("@cosmicdrift/kumiko-types/config").ConfigKeyHandle<"text">;
|
|
8
|
+
readonly forcePathStyle: import("@cosmicdrift/kumiko-types/config").ConfigKeyHandle<"boolean">;
|
|
9
|
+
readonly accessKeyId: import("@cosmicdrift/kumiko-types/config").ConfigKeyHandle<"text">;
|
|
10
|
+
};
|
|
11
|
+
secretAccessKey: import("@cosmicdrift/kumiko-types/feature").SecretKeyHandle;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type FileProviderS3FeatureOptions = {
|
|
15
|
+
/** Read one shared credential set from the `S3_*` env vars (provider key "s3-env", feature name "file-provider-s3-env") instead of per-tenant config and secret. */
|
|
16
|
+
readonly fromEnv?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function createFileProviderS3Feature(options: {
|
|
19
|
+
readonly fromEnv: true;
|
|
20
|
+
}): ReturnType<typeof createFileProviderS3EnvFeature>;
|
|
21
|
+
export declare function createFileProviderS3Feature(options?: {
|
|
22
|
+
readonly fromEnv?: false;
|
|
23
|
+
}): ReturnType<typeof createTenantConfigFileProviderS3Feature>;
|
|
24
|
+
export declare function createFileProviderS3Feature(options: FileProviderS3FeatureOptions): ReturnType<typeof createFileProviderS3EnvFeature> | ReturnType<typeof createTenantConfigFileProviderS3Feature>;
|
|
25
|
+
/** @deprecated Use createFileProviderS3Feature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
|
|
1
26
|
export declare const fileProviderS3Feature: import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
|
|
2
27
|
readonly exports: {
|
|
3
28
|
configKeys: {
|
|
@@ -12,3 +37,4 @@ export declare const fileProviderS3Feature: import("@cosmicdrift/kumiko-types/fe
|
|
|
12
37
|
};
|
|
13
38
|
/** Typed handle for the S3 secret-access-key. */
|
|
14
39
|
export declare const S3_SECRET_ACCESS_KEY: import("@cosmicdrift/kumiko-types/feature").SecretKeyHandle;
|
|
40
|
+
export {};
|