@cosmicdrift/kumiko-samples 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/package.json +1 -1
- package/packages/bundled-features/package.json +16 -2
- package/packages/bundled-features/src/audit/handlers/details.query.ts +1 -1
- package/packages/bundled-features/src/audit/handlers/list.query.ts +1 -1
- package/packages/bundled-features/src/audit/run-escape-hatch-retention.ts +5 -5
- package/packages/bundled-features/src/auth-email-password/bootstrap.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/invite-accept-with-login.write.ts +10 -3
- package/packages/bundled-features/src/auth-email-password/handlers/invite-accept.write.ts +10 -3
- package/packages/bundled-features/src/auth-email-password/handlers/invite-info.query.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/invite-signup-complete.write.ts +6 -2
- package/packages/bundled-features/src/auth-email-password/handlers/signup-confirm.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/seeding.ts +2 -2
- package/packages/bundled-features/src/auth-foundation/feature.ts +43 -34
- package/packages/bundled-features/src/auth-foundation/index.ts +1 -0
- package/packages/bundled-features/src/auth-mfa/db/queries.ts +5 -2
- package/packages/bundled-features/src/auth-mfa/handlers/enable-confirm-preauth.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/enable-start-preauth.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/reencrypt.job.ts +2 -2
- package/packages/bundled-features/src/auth-mfa/handlers/status.query.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/verify.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/mfa-code-verifier.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/mfa-status-checker.ts +1 -1
- package/packages/bundled-features/src/auth-mfa-user-data/index.ts +19 -10
- package/packages/bundled-features/src/billing-foundation/billing-info-query.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/feature.ts +138 -135
- package/packages/bundled-features/src/billing-foundation/handlers/create-portal-session.write.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/projection.ts +3 -2
- package/packages/bundled-features/src/cap-counter/calendar-cap-usage-reservation.ts +52 -1
- package/packages/bundled-features/src/cap-counter/cap-reservation.ts +203 -15
- package/packages/bundled-features/src/cap-counter/changes.json +13 -0
- package/packages/bundled-features/src/cap-counter/feature.ts +84 -73
- package/packages/bundled-features/src/cap-counter/handlers/increment-rolling.write.ts +3 -4
- package/packages/bundled-features/src/cap-counter/index.ts +9 -1
- package/packages/bundled-features/src/cap-counter/tables.ts +10 -3
- package/packages/bundled-features/src/cap-overview/handlers/caps-usage.query.ts +1 -2
- package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +6 -2
- package/packages/bundled-features/src/cap-overview/handlers/tenant-options.query.ts +1 -1
- package/packages/bundled-features/src/channel-in-app/handlers/inbox.query.ts +1 -1
- package/packages/bundled-features/src/channel-in-app/handlers/mark-all-read.write.ts +1 -1
- package/packages/bundled-features/src/channel-in-app/handlers/mark-read.write.ts +1 -1
- package/packages/bundled-features/src/channel-in-app/handlers/unread-count.query.ts +1 -1
- package/packages/bundled-features/src/channel-in-app/tables.ts +1 -1
- package/packages/bundled-features/src/compliance-profiles/handlers/for-tenant.query.ts +1 -1
- package/packages/bundled-features/src/compliance-profiles/handlers/needs-profile.query.ts +1 -1
- package/packages/bundled-features/src/compliance-profiles/handlers/set-profile.write.ts +1 -2
- package/packages/bundled-features/src/compliance-profiles/resolve-for-tenant.ts +1 -1
- package/packages/bundled-features/src/compliance-profiles/seeding.ts +8 -4
- package/packages/bundled-features/src/compliance-profiles-ops/index.ts +26 -17
- package/packages/bundled-features/src/config/db/queries/resolver.ts +1 -1
- package/packages/bundled-features/src/config/handlers/reencrypt.job.ts +2 -2
- package/packages/bundled-features/src/config/resolver.ts +1 -1
- package/packages/bundled-features/src/config/write-helpers.ts +1 -1
- package/packages/bundled-features/src/crypto-shredding/changes.json +6 -0
- package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +9 -7
- package/packages/bundled-features/src/custom-fields/db/queries/field-access.ts +1 -1
- package/packages/bundled-features/src/custom-fields/db/queries/projection.ts +1 -1
- package/packages/bundled-features/src/custom-fields/db/queries/quota.ts +1 -1
- package/packages/bundled-features/src/custom-fields/db/queries/retention.ts +6 -2
- package/packages/bundled-features/src/custom-fields/db/queries/user-data-rights.ts +1 -1
- package/packages/bundled-features/src/custom-fields/feature.ts +11 -14
- package/packages/bundled-features/src/custom-fields/handlers/clear-custom-field.write.ts +2 -2
- package/packages/bundled-features/src/custom-fields/handlers/delete-system-field.write.ts +2 -2
- package/packages/bundled-features/src/custom-fields/handlers/delete-tenant-field.write.ts +2 -2
- package/packages/bundled-features/src/custom-fields/handlers/set-custom-field.write.ts +2 -2
- package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +4 -4
- package/packages/bundled-features/src/data-retention/resolve-for-tenant.ts +1 -1
- package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +16 -10
- package/packages/bundled-features/src/delivery/address-opt-out.ts +5 -2
- package/packages/bundled-features/src/delivery/attempt-log-retention.ts +1 -1
- package/packages/bundled-features/src/delivery/channel-context.ts +1 -1
- package/packages/bundled-features/src/delivery/db/queries/address-opt-outs.ts +1 -1
- package/packages/bundled-features/src/delivery/db/queries/preferences.ts +1 -1
- package/packages/bundled-features/src/delivery/delivery-service.ts +16 -6
- package/packages/bundled-features/src/delivery/feature.ts +1 -1
- package/packages/bundled-features/src/delivery/handlers/log.query.ts +3 -2
- package/packages/bundled-features/src/delivery/handlers/preferences.query.ts +1 -1
- package/packages/bundled-features/src/delivery/upsert-preference.ts +5 -2
- package/packages/bundled-features/src/derivatives-sharp/feature.ts +21 -12
- package/packages/bundled-features/src/derivatives-sharp/index.ts +1 -1
- package/packages/bundled-features/src/document-ingest-foundation/feature.ts +112 -103
- package/packages/bundled-features/src/document-ingest-foundation/forget-extract-with-file-ref.ts +3 -3
- package/packages/bundled-features/src/document-ingest-foundation/index.ts +4 -1
- package/packages/bundled-features/src/feature-toggles/global-feature-state-table.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/handlers/set.write.ts +3 -5
- package/packages/bundled-features/src/feature-toggles/toggle-runtime.ts +1 -1
- package/packages/bundled-features/src/file-derivatives/feature.ts +134 -129
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant-by-file-ref.query.ts +1 -1
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +1 -1
- package/packages/bundled-features/src/file-foundation/feature.ts +38 -29
- package/packages/bundled-features/src/file-foundation/index.ts +1 -0
- package/packages/bundled-features/src/file-foundation/read-file-ref-content.ts +1 -1
- package/packages/bundled-features/src/file-provider-inmemory/feature.ts +32 -21
- package/packages/bundled-features/src/file-provider-inmemory/index.ts +6 -1
- package/packages/bundled-features/src/file-provider-s3/changes.json +10 -1
- package/packages/bundled-features/src/file-provider-s3/env-feature.ts +62 -0
- package/packages/bundled-features/src/file-provider-s3/feature.ts +107 -73
- package/packages/bundled-features/src/file-provider-s3/index.ts +6 -1
- package/packages/bundled-features/src/file-provider-s3/lib/index.ts +3 -0
- package/packages/bundled-features/src/{files-provider-s3 → file-provider-s3/lib}/s3-provider.ts +19 -19
- package/packages/bundled-features/src/file-provider-s3-env/index.ts +7 -2
- package/packages/bundled-features/src/files-provider-s3/index.ts +11 -3
- package/packages/bundled-features/src/files-tenant-data/handlers/sweep-orphaned-derivatives.job.ts +1 -1
- package/packages/bundled-features/src/files-tenant-data/hooks.ts +1 -2
- package/packages/bundled-features/src/folders/feature.ts +8 -3
- package/packages/bundled-features/src/folders-user-data/index.ts +27 -18
- package/packages/bundled-features/src/form-draft/db/queries/cleanup.ts +1 -1
- package/packages/bundled-features/src/form-draft/db/queries/draft-count.ts +1 -1
- package/packages/bundled-features/src/form-draft/db/queries/owned-file-refs.ts +3 -2
- package/packages/bundled-features/src/form-draft/feature.ts +6 -1
- package/packages/bundled-features/src/form-draft/handlers/cleanup.job.ts +2 -2
- package/packages/bundled-features/src/form-draft/index.ts +1 -1
- package/packages/bundled-features/src/form-draft/lookup.ts +1 -1
- package/packages/bundled-features/src/form-draft-user-data/index.ts +19 -10
- package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +165 -154
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message.write.ts +1 -2
- package/packages/bundled-features/src/inbound-mail-foundation/index.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/oauth-access-token.ts +5 -2
- package/packages/bundled-features/src/inbound-mail-foundation/projection.ts +3 -2
- package/packages/bundled-features/src/inbound-mail-foundation/watch-supervisor.ts +1 -1
- package/packages/bundled-features/src/inbound-provider-imap/feature.ts +22 -13
- package/packages/bundled-features/src/inbound-provider-imap/index.ts +6 -1
- package/packages/bundled-features/src/inbound-provider-inmemory/feature.ts +20 -12
- package/packages/bundled-features/src/inbound-provider-inmemory/index.ts +1 -0
- package/packages/bundled-features/src/jobs/db/queries/retention.ts +1 -1
- package/packages/bundled-features/src/jobs/db/queries/stale-run-sweep.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/detail.query.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/list.query.ts +7 -2
- package/packages/bundled-features/src/jobs/handlers/retry.write.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/tenant-failures.query.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/tenant-runs.query.ts +1 -1
- package/packages/bundled-features/src/jobs/job-run-logger.ts +11 -10
- package/packages/bundled-features/src/jobs/tenant-job-failure-table.ts +1 -1
- package/packages/bundled-features/src/jobs/tenant-job-run-table.ts +1 -1
- package/packages/bundled-features/src/ledger/feature.ts +6 -3
- package/packages/bundled-features/src/mail-foundation/feature.ts +57 -46
- package/packages/bundled-features/src/mail-foundation/index.ts +1 -0
- package/packages/bundled-features/src/mail-transport-inmemory/feature.ts +25 -17
- package/packages/bundled-features/src/mail-transport-inmemory/index.ts +6 -1
- package/packages/bundled-features/src/mail-transport-smtp/feature.ts +91 -79
- package/packages/bundled-features/src/mail-transport-smtp/index.ts +1 -0
- package/packages/bundled-features/src/managed-pages/handlers/by-slug.query.ts +1 -1
- package/packages/bundled-features/src/managed-pages/handlers/by-tenant-published.query.ts +1 -2
- package/packages/bundled-features/src/managed-pages/handlers/set.write.ts +1 -2
- package/packages/bundled-features/src/managed-pages/seeding.ts +8 -4
- package/packages/bundled-features/src/metrics/compute.ts +1 -1
- package/packages/bundled-features/src/metrics/filters.ts +1 -1
- package/packages/bundled-features/src/metrics/validate.ts +1 -1
- package/packages/bundled-features/src/notes-history/feature.ts +6 -3
- package/packages/bundled-features/src/notes-history/handlers/add-note.write.ts +1 -1
- package/packages/bundled-features/src/notes-history-user-data/hooks.ts +1 -1
- package/packages/bundled-features/src/notes-history-user-data/index.ts +27 -18
- package/packages/bundled-features/src/personal-access-tokens/changes.json +6 -0
- package/packages/bundled-features/src/personal-access-tokens/feature.ts +17 -2
- package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/handlers/list.query.ts +2 -2
- package/packages/bundled-features/src/personal-access-tokens/handlers/revoke.write.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/resolver.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/revoke-for-user.ts +2 -2
- package/packages/bundled-features/src/personal-access-tokens/roles.ts +8 -6
- package/packages/bundled-features/src/personal-access-tokens/screens.ts +2 -0
- package/packages/bundled-features/src/readiness/feature.ts +25 -16
- package/packages/bundled-features/src/readiness/index.ts +1 -1
- package/packages/bundled-features/src/secrets/db/queries/read.ts +1 -1
- package/packages/bundled-features/src/secrets/feature.ts +8 -3
- package/packages/bundled-features/src/secrets/handlers/rotate.job.ts +2 -2
- package/packages/bundled-features/src/secrets/secrets-context.ts +4 -3
- package/packages/bundled-features/src/sessions/db/queries/cleanup.ts +1 -1
- package/packages/bundled-features/src/sessions/handlers/detail.query.ts +1 -1
- package/packages/bundled-features/src/sessions/handlers/list.query.ts +2 -2
- package/packages/bundled-features/src/sessions/handlers/mine.query.ts +1 -1
- package/packages/bundled-features/src/sessions/handlers/revoke-all-for-user.write.ts +1 -1
- package/packages/bundled-features/src/sessions/handlers/revoke-all-others.write.ts +1 -1
- package/packages/bundled-features/src/sessions/handlers/revoke.write.ts +1 -1
- package/packages/bundled-features/src/sessions/session-callbacks.ts +14 -7
- package/packages/bundled-features/src/sessions/testing.ts +1 -1
- package/packages/bundled-features/src/tags/feature.ts +6 -3
- package/packages/bundled-features/src/template-resolver/api.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/bundle-import.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +1 -2
- package/packages/bundled-features/src/template-resolver/handlers/collection-item.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/collection-list.query.ts +1 -2
- package/packages/bundled-features/src/template-resolver/handlers/collection-set.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/copy-locale.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/diff-to-system.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/export-bundle.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/find-by-id.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/layout-source.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/list.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/reset-to-system.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/resource-remove.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/set.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/tenant-overrides.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/usage.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/validate.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/seeding.ts +3 -3
- package/packages/bundled-features/src/template-resolver/store-template-resource.ts +1 -1
- package/packages/bundled-features/src/template-resolver/template-preview.ts +1 -1
- package/packages/bundled-features/src/template-resolver/template-resources.ts +1 -1
- package/packages/bundled-features/src/template-resolver/testing.ts +1 -1
- package/packages/bundled-features/src/template-resolver-user-data/index.ts +23 -14
- package/packages/bundled-features/src/tenant/handlers/active-tenant-ids.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/add-member.write.ts +1 -2
- package/packages/bundled-features/src/tenant/handlers/cancel-invitation.write.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/invitations.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/me.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/member-directory.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/members.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/memberships.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/remove-member.write.ts +2 -1
- package/packages/bundled-features/src/tenant/handlers/resolve-user-ids.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/team-list.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/tenant-directory.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/update-member-roles.write.ts +1 -2
- package/packages/bundled-features/src/tenant/invited-membership.ts +2 -2
- package/packages/bundled-features/src/tenant/last-tenant-admin.ts +1 -2
- package/packages/bundled-features/src/tenant/seeding.ts +12 -12
- package/packages/bundled-features/src/tenant-lifecycle/handlers/cancel-destruction.write.ts +1 -2
- package/packages/bundled-features/src/tenant-lifecycle/handlers/request-destruction.write.ts +1 -2
- package/packages/bundled-features/src/tenant-lifecycle/lib/revoke-tenant-sessions.ts +1 -1
- package/packages/bundled-features/src/tenant-lifecycle/lifecycle-gate.ts +1 -1
- package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +3 -3
- package/packages/bundled-features/src/tenant-lifecycle/stages.ts +10 -5
- package/packages/bundled-features/src/tenant-lifecycle/testing.ts +3 -3
- package/packages/bundled-features/src/tenant-settings/feature.ts +34 -29
- package/packages/bundled-features/src/tier-engine/feature.ts +426 -428
- package/packages/bundled-features/src/tier-engine/handlers/get-tenant-tier.query.ts +2 -3
- package/packages/bundled-features/src/tier-engine/handlers/set-tenant-tier.write.ts +5 -2
- package/packages/bundled-features/src/user/changes.json +6 -0
- package/packages/bundled-features/src/user/db/queries/stream-tenant-backfill.ts +1 -1
- package/packages/bundled-features/src/user/handlers/create.write.ts +1 -2
- package/packages/bundled-features/src/user/handlers/find-for-auth.query.ts +1 -1
- package/packages/bundled-features/src/user/handlers/list.query.ts +1 -1
- package/packages/bundled-features/src/user/handlers/update-roles.ts +2 -1
- package/packages/bundled-features/src/user/index.ts +5 -1
- package/packages/bundled-features/src/user/invited-global-roles.ts +2 -2
- package/packages/bundled-features/src/user/principal-status.ts +13 -3
- package/packages/bundled-features/src/user/resolve-display-names.ts +1 -1
- package/packages/bundled-features/src/user/seeding.ts +5 -5
- package/packages/bundled-features/src/user-data-rights/audit-download.ts +2 -2
- package/packages/bundled-features/src/user-data-rights/db/queries/export-jobs.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/db/queries/forget-cleanup.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-job.query.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/export-status.query.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/list-download-attempts.query.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/my-audit-log.query.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/request-export.write.ts +1 -2
- package/packages/bundled-features/src/user-data-rights/handlers/run-forget-cleanup.write.ts +3 -3
- package/packages/bundled-features/src/user-data-rights/lib/deny-if-target-outside-admin-tenant.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/lib/update-user-lifecycle.ts +7 -2
- package/packages/bundled-features/src/user-data-rights/run-export-jobs.ts +7 -3
- package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +11 -5
- package/packages/bundled-features/src/user-data-rights/run-user-export.ts +10 -5
- package/packages/bundled-features/src/waitlist/handlers/invite.write.ts +1 -2
- package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +1 -1
- package/packages/bundled-features/src/waitlist/lib.ts +5 -2
- package/packages/bundled-features/src/workflow-runner/event-subscriber.ts +1 -1
- package/packages/bundled-features/src/workflow-runner/feature.ts +58 -47
- package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +1 -1
- package/packages/bundled-features/src/workflow-runner/index.ts +1 -1
- package/packages/bundled-features/src/workflow-runner/pending-projection.ts +1 -1
- package/samples/apps/admin-console/src/run-config.ts +2 -2
- package/samples/apps/cap-billing-demo/package.json +3 -0
- package/samples/apps/cap-billing-demo/src/feature.ts +2 -2
- package/samples/apps/cap-billing-demo/src/run-config.ts +8 -8
- package/samples/apps/marketing-demo/src/app/seed.ts +1 -1
- package/samples/apps/marketing-demo/src/db/queries/seed-counts.ts +1 -1
- package/samples/apps/showcase/package.json +3 -0
- package/samples/apps/showcase/src/app/seed-items.ts +1 -1
- package/samples/apps/styleguide/src/app/seed.ts +2 -2
- package/samples/apps/styleguide/src/features/ai-settings/seed.ts +2 -2
- package/samples/apps/ui-walkthrough/scripts/emit-e2e-data.ts +1 -1
- package/samples/apps/ui-walkthrough/src/app/auth-constants.ts +1 -1
- package/samples/apps/ui-walkthrough/src/app/seed-rental.ts +2 -2
- package/samples/apps/ui-walkthrough/src/app/seed-vehicles.ts +1 -1
- package/samples/apps/ui-walkthrough/src/app/seed.ts +1 -1
- package/samples/apps/ui-walkthrough/src/db/queries/row-counts.ts +1 -1
- package/samples/apps/ui-walkthrough/src/db/queries/task-counts.ts +1 -1
- package/samples/apps/use-all-bundled/package.json +3 -0
- package/samples/apps/use-all-bundled/scripts/check-coverage.ts +2 -2
- package/samples/apps/use-all-bundled/src/app/auth-constants.ts +1 -1
- package/samples/apps/use-all-bundled/src/app/cap-overview-caps.ts +2 -2
- package/samples/apps/use-all-bundled/src/app/dev-app-options.ts +1 -1
- package/samples/apps/use-all-bundled/src/app/seed-documents.ts +1 -1
- package/samples/apps/use-all-bundled/src/app/seed.ts +11 -5
- package/samples/apps/use-all-bundled/src/run-config.ts +55 -56
- package/samples/apps/user-data-rights-demo/README.md +2 -2
- package/samples/apps/user-data-rights-demo/package.json +3 -0
- package/samples/apps/user-data-rights-demo/src/run-config.ts +7 -7
- package/samples/apps/workspaces/package.json +3 -0
- package/samples/recipes/access-control/package.json +3 -0
- package/samples/recipes/anonymous-access/package.json +3 -0
- package/samples/recipes/anonymous-access-multitenant/package.json +3 -0
- package/samples/recipes/apex-landing/package.json +1 -0
- package/samples/recipes/apex-surface-auth/package.json +3 -0
- package/samples/recipes/apex-surface-auth/src/feature.ts +2 -2
- package/samples/recipes/api-worker-split/package.json +3 -0
- package/samples/recipes/api-worker-split/src/feature.ts +1 -2
- package/samples/recipes/auth-claims/package.json +3 -0
- package/samples/recipes/auth-foundation-providers/src/feature.ts +1 -1
- package/samples/recipes/auth-mfa/package.json +3 -0
- package/samples/recipes/basic-entity/package.json +3 -0
- package/samples/recipes/chat-channels/package.json +3 -0
- package/samples/recipes/compliance-profiles-demo/package.json +3 -0
- package/samples/recipes/cross-feature-events/package.json +3 -1
- package/samples/recipes/cross-feature-events/src/feature.ts +1 -1
- package/samples/recipes/crypto-shredding-hr/package.json +3 -0
- package/samples/recipes/currencies-global/package.json +3 -0
- package/samples/recipes/currencies-per-tenant/package.json +3 -0
- package/samples/recipes/custom-fields-basic/package.json +3 -0
- package/samples/recipes/custom-handlers/package.json +3 -0
- package/samples/recipes/dashboard-stats/package.json +3 -0
- package/samples/recipes/delivery-notifications/package.json +3 -0
- package/samples/recipes/e2e-generator/package.json +3 -0
- package/samples/recipes/embedded/package.json +3 -0
- package/samples/recipes/embedded-entity-form/package.json +1 -0
- package/samples/recipes/encrypted-tenant-config/README.md +1 -1
- package/samples/recipes/encrypted-tenant-config/package.json +3 -0
- package/samples/recipes/error-contract/package.json +3 -0
- package/samples/recipes/event-sourcing/package.json +3 -1
- package/samples/recipes/event-sourcing/src/feature.ts +16 -20
- package/samples/recipes/event-sourcing/tsconfig.json +2 -6
- package/samples/recipes/feature-toggles/package.json +3 -0
- package/samples/recipes/field-access/package.json +3 -0
- package/samples/recipes/files-post-processing/package.json +1 -0
- package/samples/recipes/golden-path/README.md +30 -0
- package/samples/recipes/golden-path/package.json +11 -0
- package/samples/recipes/golden-path/src/feature.ts +70 -0
- package/samples/recipes/idempotency/package.json +3 -0
- package/samples/recipes/inbound-mail-triage/package.json +3 -0
- package/samples/recipes/lane-routing/package.json +3 -0
- package/samples/recipes/ledger-banking/package.json +3 -0
- package/samples/recipes/ledger-invoicing/package.json +3 -0
- package/samples/recipes/legal-pages/package.json +3 -0
- package/samples/recipes/lifecycle-hooks/package.json +3 -0
- package/samples/recipes/managed-config/package.json +3 -0
- package/samples/recipes/managed-pages/package.json +3 -0
- package/samples/recipes/notes-history-basic/package.json +3 -0
- package/samples/recipes/ownership/package.json +3 -0
- package/samples/recipes/pdf-audit-export/package.json +1 -0
- package/samples/recipes/pipeline-basics/package.json +3 -0
- package/samples/recipes/public-share-token/package.json +3 -0
- package/samples/recipes/public-share-token/src/feature.ts +1 -1
- package/samples/recipes/rate-limiting/package.json +3 -0
- package/samples/recipes/realtime-sse/package.json +3 -0
- package/samples/recipes/record-detail-layout/package.json +1 -0
- package/samples/recipes/reference-data/package.json +3 -0
- package/samples/recipes/relations/package.json +3 -0
- package/samples/recipes/screens-nav/package.json +3 -0
- package/samples/recipes/search/package.json +3 -0
- package/samples/recipes/secrets-demo/package.json +3 -0
- package/samples/recipes/security-baseline/src/feature.ts +2 -2
- package/samples/recipes/session-revocation/README.md +1 -1
- package/samples/recipes/session-revocation/package.json +3 -0
- package/samples/recipes/session-revocation/src/feature.ts +1 -1
- package/samples/recipes/state-machine/package.json +3 -1
- package/samples/recipes/state-machine/src/entities/invoice.ts +2 -2
- package/samples/recipes/state-machine/src/events.ts +19 -0
- package/samples/recipes/state-machine/src/feature.ts +25 -30
- package/samples/recipes/state-machine/src/handlers/_helpers.ts +13 -14
- package/samples/recipes/state-machine/src/handlers/create.ts +1 -1
- package/samples/recipes/state-machine/src/handlers/transitions.ts +129 -122
- package/samples/recipes/state-machine/src/reducer.ts +1 -1
- package/samples/recipes/state-machine/tsconfig.json +2 -6
- package/samples/recipes/tags-basic/package.json +3 -0
- package/samples/recipes/tenant-isolation/package.json +3 -0
- package/samples/recipes/tenant-settings/package.json +3 -0
- package/samples/recipes/tier-admin/package.json +3 -0
- package/samples/recipes/timezones/package.json +3 -0
- package/samples/recipes/tsconfig.base.json +1 -1
- package/samples/recipes/user-data-rights/package.json +3 -0
- package/samples/recipes/user-data-rights/src/feature.ts +6 -2
- package/samples/recipes/user-profile/package.json +3 -0
- package/samples/recipes/user-profile/src/feature.ts +2 -2
- package/samples/recipes/webhook-step/package.json +3 -0
- package/samples/recipes/wizard-form/package.json +1 -0
- package/samples/recipes/workflow-engine/package.json +3 -0
- package/samples/recipes/workflow-engine/src/db/queries/suspended-runs.ts +5 -2
- package/samples/recipes/writeform-section/package.json +1 -0
- package/packages/bundled-features/src/file-provider-s3-env/feature.ts +0 -58
- /package/packages/bundled-features/src/{files-provider-s3 → file-provider-s3/lib}/env-helper.ts +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
2
|
-
import { buildEntityTable, createTenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { buildEntityTable, createTenantDb, fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
3
2
|
import { defineQueryHandler, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
4
3
|
import * as z from "zod";
|
|
5
4
|
import { type TierAssignmentRow, tierAssignmentEntity } from "../entity.js";
|
|
@@ -25,7 +24,7 @@ export const getTenantTierQuery = defineQueryHandler({
|
|
|
25
24
|
},
|
|
26
25
|
handler: async (query, ctx) => {
|
|
27
26
|
const tenantId = query.payload.tenantId as TenantId; // @cast-boundary engine-bridge
|
|
28
|
-
const tdb = createTenantDb(ctx.db.unsafeRaw(), tenantId, "system");
|
|
27
|
+
const tdb = createTenantDb({ db: ctx.db.unsafeRaw(), tenantId, mode: "system" });
|
|
29
28
|
const row = await fetchOne<TierAssignmentRow>(tdb, tierAssignmentTable, { tenantId });
|
|
30
29
|
return row ?? null;
|
|
31
30
|
},
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
buildEntityTable,
|
|
3
|
+
createEventStoreExecutor,
|
|
4
|
+
fetchOne,
|
|
5
|
+
} from "@cosmicdrift/kumiko-framework/db";
|
|
3
6
|
import { defineWriteHandler, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
4
7
|
import * as z from "zod";
|
|
5
8
|
import { requireForTenant } from "../../shared/index.js";
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.368.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "Soft-deleted users no longer count as active principals",
|
|
6
|
+
"detail": "A user deleted through the entity executor keeps its last status (usually active) with isDeleted set. principalStatusPlugin, the session checker and the PAT role resolver only looked at the status, so existing sessions and tokens of such a user stayed valid. They now treat isDeleted as blocked (session \"blocked\", PAT 401, principal_blocked for membership resolution) through the new isPrincipalRowBlocked predicate."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.364.0",
|
|
4
10
|
"type": "fix",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
// the stream move: rebuildProjection("user:projection:user-entity", ...) or
|
|
25
25
|
// the jobs:job:projection-rebuild job.
|
|
26
26
|
|
|
27
|
-
import { asRawClient, transaction, unsafeReadRetrying } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
28
27
|
import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
|
|
28
|
+
import { asRawClient, transaction, unsafeReadRetrying } from "@cosmicdrift/kumiko-framework/db";
|
|
29
29
|
import { SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
|
|
30
30
|
|
|
31
31
|
export type UserStreamBackfillResult = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
2
|
-
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { createEventStoreExecutor, fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
3
2
|
import {
|
|
4
3
|
defineWriteHandler,
|
|
5
4
|
findForbiddenRoleAssignment,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
1
|
+
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { access, defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import * as z from "zod";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { fetchOne, selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import {
|
|
3
2
|
acquireNamespacedAdvisoryLock,
|
|
4
3
|
createEventStoreExecutor,
|
|
5
4
|
type DbRunner,
|
|
5
|
+
fetchOne,
|
|
6
|
+
selectMany,
|
|
6
7
|
type TenantDb,
|
|
7
8
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
8
9
|
import {
|
|
@@ -5,7 +5,11 @@ export {
|
|
|
5
5
|
type UserStreamBackfillResult,
|
|
6
6
|
} from "./db/queries/stream-tenant-backfill.js";
|
|
7
7
|
export { createUserFeature } from "./feature.js";
|
|
8
|
-
export {
|
|
8
|
+
export {
|
|
9
|
+
isPrincipalBlocked,
|
|
10
|
+
isPrincipalRowBlocked,
|
|
11
|
+
principalStatusPlugin,
|
|
12
|
+
} from "./principal-status.js";
|
|
9
13
|
export { resolveUserDisplayNames } from "./resolve-display-names.js";
|
|
10
14
|
export type { UserStatus } from "./schema/user.js";
|
|
11
15
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import {
|
|
3
2
|
createEventStoreExecutor,
|
|
4
3
|
createTenantDb,
|
|
5
4
|
type DbRunner,
|
|
5
|
+
fetchOne,
|
|
6
6
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
7
7
|
import { createSystemUser, SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
|
|
8
8
|
import { NotFoundError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
@@ -45,7 +45,7 @@ export async function grantInvitedGlobalRoles(
|
|
|
45
45
|
const updateResult = await userExecutor.update(
|
|
46
46
|
{ id: existing.id, version: existing.version, changes: { roles } },
|
|
47
47
|
createSystemUser(SYSTEM_TENANT_ID),
|
|
48
|
-
createTenantDb(db, SYSTEM_TENANT_ID, "system"),
|
|
48
|
+
createTenantDb({ db, tenantId: SYSTEM_TENANT_ID, mode: "system" }),
|
|
49
49
|
);
|
|
50
50
|
if (!updateResult.isSuccess) return updateResult;
|
|
51
51
|
return grantedGlobalRoles(roles);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
1
|
+
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import type {
|
|
3
3
|
PrincipalProfile,
|
|
4
4
|
PrincipalStatus,
|
|
@@ -20,13 +20,23 @@ export function isPrincipalBlocked(status: UserStatus): boolean {
|
|
|
20
20
|
return BLOCKED_STATUSES.has(status);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// A soft-deleted row (executor.delete) keeps its last status, so isDeleted must block on its own.
|
|
24
|
+
export function isPrincipalRowBlocked(row: {
|
|
25
|
+
readonly status: UserStatus;
|
|
26
|
+
readonly isDeleted: boolean;
|
|
27
|
+
}): boolean {
|
|
28
|
+
return row.isDeleted || isPrincipalBlocked(row.status);
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
// Registered via r.useExtension(EXT_PRINCIPAL_STATUS, "user", principalStatusPlugin)
|
|
24
32
|
// so resolveActiveMembershipFn can reject a blocked principal without knowing about `user`'s table.
|
|
25
33
|
export const principalStatusPlugin: PrincipalStatusPlugin = {
|
|
26
34
|
async resolveStatus(userId, { db }): Promise<PrincipalStatus> {
|
|
27
|
-
const row = await fetchOne<{ status: UserStatus }>(db, userTable, {
|
|
35
|
+
const row = await fetchOne<{ status: UserStatus; isDeleted: boolean }>(db, userTable, {
|
|
36
|
+
id: userId,
|
|
37
|
+
});
|
|
28
38
|
if (!row) return "unknown";
|
|
29
|
-
return
|
|
39
|
+
return isPrincipalRowBlocked(row) ? "blocked" : "active";
|
|
30
40
|
},
|
|
31
41
|
|
|
32
42
|
// ctx.queryAsMember's global-roles/timezone/locale source — same fields
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import type { TenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
3
3
|
import { decryptStoredPii, mapWithConcurrency } from "../shared/index.js";
|
|
4
4
|
import { userTable } from "./schema/user.js";
|
|
5
5
|
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
// (audit, search-index) sehen den Seed. Der Executor-Pfad emittiert
|
|
11
11
|
// das Event UND schreibt die Projection-Zeile in einer TX.
|
|
12
12
|
|
|
13
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
14
13
|
import { computeBlindIndex, configuredBlindIndexKey } from "@cosmicdrift/kumiko-framework/crypto";
|
|
15
14
|
import {
|
|
16
15
|
createEventStoreExecutor,
|
|
17
16
|
createTenantDb,
|
|
18
17
|
type DbConnection,
|
|
18
|
+
fetchOne,
|
|
19
19
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
20
20
|
import type { SessionUser } from "@cosmicdrift/kumiko-framework/engine";
|
|
21
|
-
import { TestUsers } from "@cosmicdrift/kumiko-framework/
|
|
21
|
+
import { TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
|
|
22
22
|
// kumiko-lint-ignore cross-feature-import shares the postSave-hooks fixture contract with tenant/seeding (#1478)
|
|
23
23
|
import { fireEntityPostSave, type SeedTenantHooks } from "../tenant/seeding.js";
|
|
24
24
|
import { userEntity, userTable } from "./schema/user.js";
|
|
@@ -65,7 +65,7 @@ export async function seedUser(
|
|
|
65
65
|
// executor.create erwartet eine TenantDb (mit .insert()-API). User
|
|
66
66
|
// ist zwar tenant-agnostic (kein tenant_id-Spalte), aber das runtime-
|
|
67
67
|
// Interface braucht den Wrap.
|
|
68
|
-
const tdb = createTenantDb(db, by.tenantId, "system");
|
|
68
|
+
const tdb = createTenantDb({ db, tenantId: by.tenantId, mode: "system" });
|
|
69
69
|
|
|
70
70
|
const existing = await fetchOne(db, userTable, { email: options.email, isDeleted: false });
|
|
71
71
|
// @cast-boundary db-row: users.id ist uuid-Spalte (string), fetchOne
|
|
@@ -111,7 +111,7 @@ export async function reconcileSeededUserEmailVerified(
|
|
|
111
111
|
// @cast-boundary db-row: users.id ist uuid-Spalte (string), fetchOne
|
|
112
112
|
// liefert die Projection-Row als Record<string, unknown>.
|
|
113
113
|
const id = existingRow["id"] as string;
|
|
114
|
-
const tdb = createTenantDb(db, by.tenantId, "system");
|
|
114
|
+
const tdb = createTenantDb({ db, tenantId: by.tenantId, mode: "system" });
|
|
115
115
|
const result = await userExecutor.update(
|
|
116
116
|
{ id, version: existingRow["version"] as number, changes: { emailVerified: true } },
|
|
117
117
|
by,
|
|
@@ -157,7 +157,7 @@ export async function rewriteSeededUserEmail(
|
|
|
157
157
|
// skip: the stored blind index already matches, a rewrite would only append a no-op event.
|
|
158
158
|
if (indexed) return;
|
|
159
159
|
}
|
|
160
|
-
const tdb = createTenantDb(db, by.tenantId, "system");
|
|
160
|
+
const tdb = createTenantDb({ db, tenantId: by.tenantId, mode: "system" });
|
|
161
161
|
const result = await userExecutor.update({ id, version, changes: { email } }, by, tdb);
|
|
162
162
|
// version_conflict: a concurrent write already changed the row — fine for a seed helper.
|
|
163
163
|
// unique_violation: a duplicate row already holds the blind index; the repair
|
|
@@ -54,7 +54,7 @@ export interface RecordDownloadUseArgs {
|
|
|
54
54
|
export async function recordDownloadUse(args: RecordDownloadUseArgs): Promise<void> {
|
|
55
55
|
const { db, tokenId, tokenVersion, tokenUseCount, tenantId, now, ip, userAgent } = args;
|
|
56
56
|
const executor = createSystemUser(tenantId);
|
|
57
|
-
const tdb = createTenantDb(db, tenantId, "system");
|
|
57
|
+
const tdb = createTenantDb({ db, tenantId, mode: "system" });
|
|
58
58
|
|
|
59
59
|
await tokenCrud
|
|
60
60
|
.update(
|
|
@@ -103,7 +103,7 @@ export interface RecordInvalidAttemptArgs {
|
|
|
103
103
|
export async function recordInvalidAttempt(args: RecordInvalidAttemptArgs): Promise<void> {
|
|
104
104
|
const { db, tenantId, now } = args;
|
|
105
105
|
const executor = createSystemUser(tenantId);
|
|
106
|
-
const tdb = createTenantDb(db, tenantId, "system");
|
|
106
|
+
const tdb = createTenantDb({ db, tenantId, mode: "system" });
|
|
107
107
|
await attemptCrud
|
|
108
108
|
.create(
|
|
109
109
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
3
3
|
import type { TenantId } from "@cosmicdrift/kumiko-framework/engine";
|
|
4
4
|
import type { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
5
5
|
import { exportJobsTable } from "../../schema/export-job.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import type { DbRunner } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
3
3
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
4
4
|
import { userTable } from "../../../user/index.js";
|
|
5
5
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
// 7. Return {url, expiresAt}
|
|
25
25
|
|
|
26
26
|
import { requestContext } from "@cosmicdrift/kumiko-framework/api";
|
|
27
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
27
|
+
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
28
28
|
import {
|
|
29
29
|
defineQueryHandler,
|
|
30
30
|
SYSTEM_USER_ID,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
// signedUrl — User klickt 1× Email-Link, Browser folgt redirect, Download
|
|
27
27
|
// startet. Dieser query-handler liefert nur das JSON.
|
|
28
28
|
|
|
29
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
29
|
+
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
30
30
|
import {
|
|
31
31
|
defineQueryHandler,
|
|
32
32
|
SYSTEM_USER_ID,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// **Read-Only-Endpoint:** Pollt nur, kein State-Flip. Idempotent + cache-
|
|
12
12
|
// fest. UI poll-Intervall typisch 2-5s waehrend running.
|
|
13
13
|
|
|
14
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/
|
|
14
|
+
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
15
15
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
16
16
|
import type { getTemporal } from "@cosmicdrift/kumiko-framework/time";
|
|
17
17
|
import * as z from "zod";
|
package/packages/bundled-features/src/user-data-rights/handlers/list-download-attempts.query.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selectMany, type WhereObject } from "@cosmicdrift/kumiko-framework/
|
|
1
|
+
import { selectMany, type WhereObject } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
4
4
|
import * as z from "zod";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selectMany, type WhereObject } from "@cosmicdrift/kumiko-framework/
|
|
1
|
+
import { selectMany, type WhereObject } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { eventsTable } from "@cosmicdrift/kumiko-framework/event-store";
|
|
4
4
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
// 1. Klick — Worker liest sein Compliance-Profile aus DIESEM Tenant
|
|
21
21
|
// fuer Job-TTL/Stale/Cleanup.
|
|
22
22
|
|
|
23
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
24
|
-
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
23
|
+
import { createEventStoreExecutor, fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
25
24
|
import { defineWriteHandler, type SaveContext } from "@cosmicdrift/kumiko-framework/engine";
|
|
26
25
|
import type { WriteFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
27
26
|
import { getTemporal } from "@cosmicdrift/kumiko-framework/time";
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// Rueckgabe: Stats fuer Operator-Monitoring (processed-count, error-list).
|
|
12
12
|
|
|
13
13
|
import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
|
|
14
|
-
import { access, defineWriteHandler
|
|
14
|
+
import { access, defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
15
15
|
import { InternalError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
16
16
|
import { getTemporal } from "@cosmicdrift/kumiko-framework/time";
|
|
17
17
|
import * as z from "zod";
|
|
@@ -58,7 +58,7 @@ export function createRunForgetCleanupHandler(opts: RunForgetCleanupOptions = {}
|
|
|
58
58
|
registry: ctx.registry,
|
|
59
59
|
configResolver: ctx.configResolver,
|
|
60
60
|
db: forgetDb,
|
|
61
|
-
userId: ctx.
|
|
61
|
+
userId: ctx.user.id,
|
|
62
62
|
});
|
|
63
63
|
const result = await runForgetCleanup({
|
|
64
64
|
db: runner,
|
|
@@ -71,7 +71,7 @@ export function createRunForgetCleanupHandler(opts: RunForgetCleanupOptions = {}
|
|
|
71
71
|
configResolver: ctx.configResolver,
|
|
72
72
|
secrets: ctx.secrets,
|
|
73
73
|
db: forgetDb,
|
|
74
|
-
userId: ctx.
|
|
74
|
+
userId: ctx.user.id,
|
|
75
75
|
handlerName: "user-data-rights:run-forget-cleanup",
|
|
76
76
|
}),
|
|
77
77
|
...(opts.sendDeletionExecutedEmail && {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import type { DbRunner } from "@cosmicdrift/kumiko-framework/db";
|
|
3
2
|
import {
|
|
4
3
|
createEventStoreExecutor,
|
|
5
4
|
createTenantDb,
|
|
5
|
+
selectMany,
|
|
6
6
|
type WritePurpose,
|
|
7
7
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
8
8
|
import { createSystemUser, SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
|
|
@@ -34,6 +34,10 @@ export type UpdateUserLifecycleOptions = {
|
|
|
34
34
|
// Erasure flows run after the subject key is erased; the write then stores the
|
|
35
35
|
// erased sentinel instead of failing on re-encrypt.
|
|
36
36
|
readonly writePurpose?: WritePurpose;
|
|
37
|
+
// Also address a row the stream has already soft-deleted. Only erasure needs
|
|
38
|
+
// this: a deleted stream with a still-`active` status must still get its
|
|
39
|
+
// status event so the login door closes.
|
|
40
|
+
readonly includeDeleted?: boolean;
|
|
37
41
|
};
|
|
38
42
|
|
|
39
43
|
// `conn` is ctx.db.unsafeRaw() (regular handlers) or the open tx
|
|
@@ -61,7 +65,7 @@ export async function updateUserLifecycle(
|
|
|
61
65
|
// (restrict/lift-restriction/grace-period/cancel/forget) that holds no row
|
|
62
66
|
// version to pass as `payload.version`, which update() requires otherwise.
|
|
63
67
|
// Callers needing a guard use `options.expect` instead.
|
|
64
|
-
const tenantDb = createTenantDb(conn, SYSTEM_TENANT_ID, "system");
|
|
68
|
+
const tenantDb = createTenantDb({ db: conn, tenantId: SYSTEM_TENANT_ID, mode: "system" });
|
|
65
69
|
const result = await userExecutor.update(
|
|
66
70
|
{ id: userId, changes },
|
|
67
71
|
createSystemUser(SYSTEM_TENANT_ID),
|
|
@@ -70,6 +74,7 @@ export async function updateUserLifecycle(
|
|
|
70
74
|
skipOptimisticLock: true,
|
|
71
75
|
...(options?.expect && { expect: options.expect }),
|
|
72
76
|
...(options?.writePurpose && { writePurpose: options.writePurpose }),
|
|
77
|
+
...(options?.includeDeleted && { includeDeleted: true }),
|
|
73
78
|
},
|
|
74
79
|
);
|
|
75
80
|
|
|
@@ -45,11 +45,15 @@ import type { Logger } from "@cosmicdrift/kumiko-framework/logging";
|
|
|
45
45
|
// (`expiresAt + exportStorageCleanupGraceHours < now`) — abgelaufene ZIPs
|
|
46
46
|
// auf S3 sollen nicht ewig liegen.
|
|
47
47
|
|
|
48
|
-
import { fetchOne, selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
49
48
|
import { addDurationSpec } from "@cosmicdrift/kumiko-framework/compliance";
|
|
50
49
|
import { PII_ERASED_SENTINEL } from "@cosmicdrift/kumiko-framework/crypto";
|
|
51
50
|
import type { DbConnection, DbRunner } from "@cosmicdrift/kumiko-framework/db";
|
|
52
|
-
import {
|
|
51
|
+
import {
|
|
52
|
+
createEventStoreExecutor,
|
|
53
|
+
createTenantDb,
|
|
54
|
+
fetchOne,
|
|
55
|
+
selectMany,
|
|
56
|
+
} from "@cosmicdrift/kumiko-framework/db";
|
|
53
57
|
import type {
|
|
54
58
|
EscapeHatchAuditSink,
|
|
55
59
|
Registry,
|
|
@@ -811,7 +815,7 @@ function reportCleanupLastRun(metrics: MetricsHandle | undefined, now: Instant):
|
|
|
811
815
|
// Stream-Counter konsistent bleibt (Memory feedback_event_store_tenant_consistency).
|
|
812
816
|
// @wrapper-known semantic-alias
|
|
813
817
|
function systemTenantDb(db: DbConnection, tenantId: TenantId) {
|
|
814
|
-
return createTenantDb(db, tenantId, "system");
|
|
818
|
+
return createTenantDb({ db, tenantId, mode: "system" });
|
|
815
819
|
}
|
|
816
820
|
|
|
817
821
|
function buildExportStorageKey(job: JobRow): string {
|
|
@@ -35,7 +35,6 @@ import { createFallbackLogger, type Logger } from "@cosmicdrift/kumiko-framework
|
|
|
35
35
|
// gefailten Hooks bleibt im DeletionRequested-Status (next Lauf
|
|
36
36
|
// retried automatisch).
|
|
37
37
|
|
|
38
|
-
import { fetchOne, selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
39
38
|
import {
|
|
40
39
|
configuredPiiSubjectKms,
|
|
41
40
|
type KmsAdapter,
|
|
@@ -46,7 +45,9 @@ import {
|
|
|
46
45
|
type DbRunner,
|
|
47
46
|
entityEventName,
|
|
48
47
|
executeRawQuery,
|
|
48
|
+
fetchOne,
|
|
49
49
|
nullBlindIndexesForSubject,
|
|
50
|
+
selectMany,
|
|
50
51
|
WritePurposes,
|
|
51
52
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
52
53
|
import {
|
|
@@ -225,10 +226,15 @@ function buildHookDb(
|
|
|
225
226
|
sink: args.escapeHatchAuditSink,
|
|
226
227
|
log: args.escapeHatchAuditLog ?? createFallbackLogger("user-data-rights"),
|
|
227
228
|
});
|
|
228
|
-
return createTenantDb(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
return createTenantDb({
|
|
230
|
+
db,
|
|
231
|
+
tenantId,
|
|
232
|
+
mode: "tenant",
|
|
233
|
+
grants: {
|
|
234
|
+
unsafeRaw:
|
|
235
|
+
entry.escapeHatchReason !== undefined ? { reason: entry.escapeHatchReason } : undefined,
|
|
236
|
+
report,
|
|
237
|
+
},
|
|
232
238
|
});
|
|
233
239
|
}
|
|
234
240
|
|
|
@@ -21,7 +21,6 @@ import { createFallbackLogger, type Logger } from "@cosmicdrift/kumiko-framework
|
|
|
21
21
|
// landen. user-data-rights-defaults/hooks/user.userdata-hook expose
|
|
22
22
|
// expliziert KEIN passwordHash + KEINE roles (privileged columns).
|
|
23
23
|
|
|
24
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
25
24
|
import {
|
|
26
25
|
configuredPiiSubjectKms,
|
|
27
26
|
decryptPiiFieldValues,
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
configuredEntityFieldEncryption,
|
|
34
33
|
createTenantDb,
|
|
35
34
|
decryptEntityFieldValues,
|
|
35
|
+
selectMany,
|
|
36
36
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
37
37
|
import {
|
|
38
38
|
type EscapeHatchAuditSink,
|
|
@@ -121,10 +121,15 @@ function buildHookDb(
|
|
|
121
121
|
sink: args.escapeHatchAuditSink,
|
|
122
122
|
log: args.escapeHatchAuditLog ?? createFallbackLogger("user-data-rights"),
|
|
123
123
|
});
|
|
124
|
-
return createTenantDb(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
return createTenantDb({
|
|
125
|
+
db,
|
|
126
|
+
tenantId,
|
|
127
|
+
mode: "tenant",
|
|
128
|
+
grants: {
|
|
129
|
+
unsafeRaw:
|
|
130
|
+
entry.escapeHatchReason !== undefined ? { reason: entry.escapeHatchReason } : undefined,
|
|
131
|
+
report,
|
|
132
|
+
},
|
|
128
133
|
});
|
|
129
134
|
}
|
|
130
135
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
2
|
-
import { acquireNamespacedAdvisoryLock } from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { acquireNamespacedAdvisoryLock, fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
3
2
|
import {
|
|
4
3
|
createSystemUser,
|
|
5
4
|
defineWriteHandler,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createEventStoreExecutor,
|
|
3
|
+
fetchOne,
|
|
4
|
+
type TenantDb,
|
|
5
|
+
} from "@cosmicdrift/kumiko-framework/db";
|
|
3
6
|
import {
|
|
4
7
|
access,
|
|
5
8
|
createSystemUser,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
// existing resume-due-runs job (Phase 2) picks the row up on its next
|
|
25
25
|
// cron tick — the one resume path stays exactly the one Phase 2 built.
|
|
26
26
|
|
|
27
|
-
import { selectMany, updateMany } from "@cosmicdrift/kumiko-framework/
|
|
27
|
+
import { selectMany, updateMany } from "@cosmicdrift/kumiko-framework/db";
|
|
28
28
|
import type {
|
|
29
29
|
FeatureRegistrar,
|
|
30
30
|
MultiStreamApplyFn,
|
|
@@ -35,55 +35,66 @@ import { workflowRunPendingTableMeta } from "./tables.js";
|
|
|
35
35
|
// use-all-bundled's check-coverage matches exports to mounted features by it.
|
|
36
36
|
const FEATURE_NAME = "workflow-runner";
|
|
37
37
|
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{ trigger: { cron: "* * * * *" }, perTenant: true, concurrency: "skip" },
|
|
60
|
-
async (_payload, ctx) => {
|
|
61
|
-
if (!ctx.systemDb) {
|
|
62
|
-
throw new Error("resume-due-runs: ctx.systemDb required (r.systemScope() feature)");
|
|
63
|
-
}
|
|
64
|
-
const tenantId = ctx.systemUser?.tenantId ?? ctx._tenantId;
|
|
65
|
-
if (tenantId === undefined) {
|
|
66
|
-
// skip: cron fired without a perTenant fan-out tenant — nothing scoped
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
38
|
+
export function createWorkflowRunnerFeature() {
|
|
39
|
+
return defineFeature(
|
|
40
|
+
FEATURE_NAME,
|
|
41
|
+
(r) => {
|
|
42
|
+
r.describe(
|
|
43
|
+
"Writes the run-envelope (`workflow.run-started` / `workflow.run-completed` / `workflow.run-failed`) for a workflow run onto its `workflow-run` aggregate stream. Provides `startAndRunWorkflow` and `registerEventTrigger` for consumer features to wire up `defineWorkflow`-based workflows against domain events. Registers no workflows itself. Runs the resume loop for suspended `wait`/`retry`/`waitForEvent` steps (`resume-due-runs` job + `resume-run` handler); `registerEventTrigger` wires an event-wakeup subscriber per workflow that declares `awaits` so a `waitForEvent` step resumes as soon as its awaited event arrives, not just on timeout.",
|
|
44
|
+
);
|
|
45
|
+
r.uiHints({
|
|
46
|
+
displayLabel: "Workflow Runner",
|
|
47
|
+
category: "infrastructure",
|
|
48
|
+
recommended: false,
|
|
49
|
+
});
|
|
50
|
+
// resume-run needs a full HandlerContext + ctx.systemDb (the pending-row
|
|
51
|
+
// scan crosses whatever tenant the row belongs to relative to the job's
|
|
52
|
+
// own tenant loop iteration) — same reasoning as tenant/feature.ts.
|
|
53
|
+
r.systemScope();
|
|
54
|
+
r.storeTable(workflowRunPendingTableMeta, {
|
|
55
|
+
reason: "resume_loop.pending_suspended_steps",
|
|
56
|
+
});
|
|
57
|
+
registerWorkflowRunPendingProjection(r);
|
|
58
|
+
r.writeHandler(resumeRunHandler);
|
|
69
59
|
|
|
70
|
-
|
|
60
|
+
r.job(
|
|
61
|
+
"resume-due-runs",
|
|
62
|
+
{ trigger: { cron: "* * * * *" }, perTenant: true, concurrency: "skip" },
|
|
63
|
+
async (_payload, ctx) => {
|
|
64
|
+
if (!ctx.systemDb) {
|
|
65
|
+
throw new Error("resume-due-runs: ctx.systemDb required (r.systemScope() feature)");
|
|
66
|
+
}
|
|
67
|
+
const tenantId = ctx.systemUser?.tenantId ?? ctx._tenantId;
|
|
68
|
+
if (tenantId === undefined) {
|
|
69
|
+
// skip: cron fired without a perTenant fan-out tenant — nothing scoped
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
await ctx.write("workflow-runner:write:resume-run", {
|
|
75
|
-
runId: row.runId,
|
|
76
|
-
stepIndex: row.stepIndex,
|
|
77
|
-
});
|
|
78
|
-
} catch (error) {
|
|
79
|
-
// skip: one row's dispatch failing (infra hiccup, not a business
|
|
80
|
-
// outcome — resume-run itself never throws for expected cases)
|
|
81
|
-
// must not stop the rest of this tenant's due rows from resuming.
|
|
82
|
-
ctx.log.warn(
|
|
83
|
-
`[workflow-runner:resume-due-runs] runId=${row.runId} stepIndex=${row.stepIndex} dispatch failed: ${String(error)}`,
|
|
73
|
+
const dueRows = await selectDueWorkflowRunPending(
|
|
74
|
+
ctx.systemDb.assertTenantMatch(tenantId),
|
|
84
75
|
);
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
|
|
77
|
+
for (const row of dueRows) {
|
|
78
|
+
try {
|
|
79
|
+
await ctx.write("workflow-runner:write:resume-run", {
|
|
80
|
+
runId: row.runId,
|
|
81
|
+
stepIndex: row.stepIndex,
|
|
82
|
+
});
|
|
83
|
+
} catch (error) {
|
|
84
|
+
// skip: one row's dispatch failing (infra hiccup, not a business
|
|
85
|
+
// outcome — resume-run itself never throws for expected cases)
|
|
86
|
+
// must not stop the rest of this tenant's due rows from resuming.
|
|
87
|
+
ctx.log.warn(
|
|
88
|
+
`[workflow-runner:resume-due-runs] runId=${row.runId} stepIndex=${row.stepIndex} dispatch failed: ${String(error)}`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
);
|
|
87
94
|
},
|
|
95
|
+
{ dedupeOptions: {} },
|
|
88
96
|
);
|
|
89
|
-
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @deprecated Use createWorkflowRunnerFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
|
|
100
|
+
export const workflowRunnerFeature = createWorkflowRunnerFeature();
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
// resultKey on steps/wait-for-event.ts) — pre-seeded into stepsAcc below so
|
|
31
31
|
// a subsequent step's resolver can read `ctx.steps[awaits.someKey]`.
|
|
32
32
|
|
|
33
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/
|
|
33
|
+
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
34
34
|
import {
|
|
35
35
|
buildPipelineSteps,
|
|
36
36
|
computeDefinitionFingerprint,
|