@cosmicdrift/kumiko-samples 0.367.0 → 0.369.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-email/changes.json +7 -0
- package/packages/bundled-features/src/channel-email/email-channel.ts +39 -8
- package/packages/bundled-features/src/channel-email/feature.ts +1 -1
- package/packages/bundled-features/src/channel-email/index.ts +5 -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/web/i18n.ts +1 -2
- 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/changes.json +6 -0
- 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 +2 -2
- 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/index.ts +8 -1
- package/packages/bundled-features/src/delivery/unsubscribe.ts +66 -37
- 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 +66 -46
- package/packages/bundled-features/src/mail-foundation/i18n.ts +8 -0
- package/packages/bundled-features/src/mail-foundation/index.ts +1 -0
- package/packages/bundled-features/src/mail-transport-inmemory/feature.ts +31 -17
- package/packages/bundled-features/src/mail-transport-inmemory/index.ts +6 -1
- package/packages/bundled-features/src/mail-transport-smtp/changes.json +7 -0
- package/packages/bundled-features/src/mail-transport-smtp/config-keys.ts +67 -0
- package/packages/bundled-features/src/mail-transport-smtp/feature.ts +67 -82
- package/packages/bundled-features/src/mail-transport-smtp/i18n.ts +28 -0
- 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/changes.json +6 -0
- package/packages/bundled-features/src/secrets/db/queries/read.ts +1 -1
- package/packages/bundled-features/src/secrets/feature.ts +26 -6
- package/packages/bundled-features/src/secrets/handlers/delete.write.ts +5 -2
- package/packages/bundled-features/src/secrets/handlers/rotate.job.ts +2 -2
- package/packages/bundled-features/src/secrets/handlers/set.write.ts +5 -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/constants.ts +0 -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/send-test.write.ts +4 -2
- 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/changes.json +6 -0
- 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/feature.ts +7 -4
- 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/default-mailers.ts +40 -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/feature-manifest.json +16 -16
- 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
|
@@ -21,20 +21,17 @@
|
|
|
21
21
|
// handlers/create.ts — invoice:create (uses executor)
|
|
22
22
|
// handlers/transitions.ts — the six state-change handlers
|
|
23
23
|
|
|
24
|
-
import { defineFeature, setFields } from "@
|
|
25
|
-
import { z } from "zod";
|
|
24
|
+
import { defineFeature, setFields, typedPayload } from "@cosmicdrift/kumiko-framework/engine";
|
|
26
25
|
import { invoiceEntity, invoiceTable } from "./entities/invoice";
|
|
27
|
-
import { eventName, INVOICE_EVENTS } from "./events";
|
|
28
|
-
import { invoiceCreate } from "./handlers/create";
|
|
29
26
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} from "./handlers/
|
|
37
|
-
import
|
|
27
|
+
emptyEventPayload,
|
|
28
|
+
eventName,
|
|
29
|
+
INVOICE_EVENTS,
|
|
30
|
+
type InvoiceEvents,
|
|
31
|
+
statusForcedPayload,
|
|
32
|
+
} from "./events";
|
|
33
|
+
import { invoiceCreate } from "./handlers/create";
|
|
34
|
+
import { createInvoiceTransitionHandlers } from "./handlers/transitions";
|
|
38
35
|
|
|
39
36
|
export { invoiceEntity } from "./entities/invoice";
|
|
40
37
|
|
|
@@ -45,18 +42,15 @@ export const stateMachineFeature = defineFeature("billing", (r) => {
|
|
|
45
42
|
// and the projection stay in sync. The auto "invoice.created" event from
|
|
46
43
|
// the executor's create-path covers the initial insert, so we only declare
|
|
47
44
|
// the state-change events here.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
INVOICE_EVENTS.statusForced,
|
|
54
|
-
|
|
55
|
-
newStatus: z.enum(["draft", "sent", "paid", "cancelled"]),
|
|
56
|
-
fromStatus: z.enum(["draft", "sent", "paid", "cancelled"]),
|
|
45
|
+
const events: InvoiceEvents = {
|
|
46
|
+
sent: r.defineEvent(INVOICE_EVENTS.sent, emptyEventPayload, { piiFields: "none" }),
|
|
47
|
+
markedPaid: r.defineEvent(INVOICE_EVENTS.markedPaid, emptyEventPayload, { piiFields: "none" }),
|
|
48
|
+
cancelled: r.defineEvent(INVOICE_EVENTS.cancelled, emptyEventPayload, { piiFields: "none" }),
|
|
49
|
+
reopened: r.defineEvent(INVOICE_EVENTS.reopened, emptyEventPayload, { piiFields: "none" }),
|
|
50
|
+
statusForced: r.defineEvent(INVOICE_EVENTS.statusForced, statusForcedPayload, {
|
|
51
|
+
piiFields: "none",
|
|
57
52
|
}),
|
|
58
|
-
|
|
59
|
-
);
|
|
53
|
+
};
|
|
60
54
|
|
|
61
55
|
// The aggregate table (sample_sm_invoices) is INSERTed by the executor on
|
|
62
56
|
// invoice:create. State-change events update the same row via this inline
|
|
@@ -74,16 +68,17 @@ export const stateMachineFeature = defineFeature("billing", (r) => {
|
|
|
74
68
|
[eventName(INVOICE_EVENTS.cancelled)]: setFields(invoiceTable, { status: "cancelled" }),
|
|
75
69
|
[eventName(INVOICE_EVENTS.reopened)]: setFields(invoiceTable, { status: "draft" }),
|
|
76
70
|
[eventName(INVOICE_EVENTS.statusForced)]: setFields(invoiceTable, (e) => ({
|
|
77
|
-
status: (e.
|
|
71
|
+
status: typedPayload(e, events.statusForced).newStatus,
|
|
78
72
|
})),
|
|
79
73
|
},
|
|
80
74
|
});
|
|
81
75
|
|
|
76
|
+
const transitions = createInvoiceTransitionHandlers(events);
|
|
82
77
|
r.writeHandler(invoiceCreate);
|
|
83
|
-
r.writeHandler(invoiceSend);
|
|
84
|
-
r.writeHandler(invoiceMarkPaid);
|
|
85
|
-
r.writeHandler(invoiceCancel);
|
|
86
|
-
r.writeHandler(invoiceReopen);
|
|
87
|
-
r.writeHandler(invoiceUpdateStatus);
|
|
88
|
-
r.writeHandler(invoiceForceStatus);
|
|
78
|
+
r.writeHandler(transitions.invoiceSend);
|
|
79
|
+
r.writeHandler(transitions.invoiceMarkPaid);
|
|
80
|
+
r.writeHandler(transitions.invoiceCancel);
|
|
81
|
+
r.writeHandler(transitions.invoiceReopen);
|
|
82
|
+
r.writeHandler(transitions.invoiceUpdateStatus);
|
|
83
|
+
r.writeHandler(transitions.invoiceForceStatus);
|
|
89
84
|
});
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
// optionally guardTransition, append the domain event, return a WriteResult
|
|
3
3
|
// that reflects the post-write status.
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
type AccessRule,
|
|
7
|
+
defineWriteHandler,
|
|
8
|
+
type EventDef,
|
|
9
|
+
emitEvent,
|
|
10
|
+
guardTransition,
|
|
11
|
+
} from "@cosmicdrift/kumiko-framework/engine";
|
|
7
12
|
import { failNotFound } from "@cosmicdrift/kumiko-framework/errors";
|
|
8
13
|
import { z } from "zod";
|
|
9
14
|
import { INVOICE_TRANSITIONS } from "../entities/invoice";
|
|
10
|
-
import { ENTITY_NAME } from "../events";
|
|
15
|
+
import { ENTITY_NAME, type emptyEventPayload } from "../events";
|
|
11
16
|
import { type InvoiceStatus, loadInvoiceState } from "../reducer";
|
|
12
17
|
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
type EmptyPayloadEvent = {
|
|
17
|
-
[K in keyof KumikoEventTypeMap]: KumikoEventTypeMap[K] extends Record<string, never> ? K : never;
|
|
18
|
-
}[keyof KumikoEventTypeMap];
|
|
19
|
-
|
|
20
|
-
export function transitionHandler<const TEvent extends EmptyPayloadEvent>(opts: {
|
|
18
|
+
// The event carries an empty payload — this helper always emits `{}`, so an EventDef with a
|
|
19
|
+
// non-empty payload is a compile error at the call site.
|
|
20
|
+
export function transitionHandler(opts: {
|
|
21
21
|
name: string;
|
|
22
22
|
toStatus: InvoiceStatus;
|
|
23
|
-
|
|
23
|
+
event: EventDef<z.infer<typeof emptyEventPayload>>;
|
|
24
24
|
access: AccessRule;
|
|
25
25
|
skipGuard?: boolean;
|
|
26
26
|
}) {
|
|
@@ -41,10 +41,9 @@ export function transitionHandler<const TEvent extends EmptyPayloadEvent>(opts:
|
|
|
41
41
|
guardTransition(INVOICE_TRANSITIONS, state.status as InvoiceStatus, opts.toStatus);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
await ctx.
|
|
44
|
+
await emitEvent(ctx, opts.event, {
|
|
45
45
|
aggregateId: event.payload.id,
|
|
46
46
|
aggregateType: ENTITY_NAME,
|
|
47
|
-
type: opts.eventType,
|
|
48
47
|
payload: {},
|
|
49
48
|
});
|
|
50
49
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// keeps amount + amountCurrency flat, while the entity stores them as a
|
|
7
7
|
// money pair.
|
|
8
8
|
|
|
9
|
-
import { defineWriteHandler } from "@app/define";
|
|
10
9
|
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
10
|
+
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { invoiceEntity, invoiceTable } from "../entities/invoice";
|
|
13
13
|
|
|
@@ -3,135 +3,142 @@
|
|
|
3
3
|
// little extra logic (amount-check, verb routing, dedicated forced-event)
|
|
4
4
|
// and stay inline so the variation is visible at the call site.
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
defineWriteHandler,
|
|
8
|
+
emitEvent,
|
|
9
|
+
guardTransition,
|
|
10
|
+
} from "@cosmicdrift/kumiko-framework/engine";
|
|
7
11
|
import { failNotFound, failUnprocessable } from "@cosmicdrift/kumiko-framework/errors";
|
|
8
12
|
import { z } from "zod";
|
|
9
13
|
import { INVOICE_STATES, INVOICE_TRANSITIONS } from "../entities/invoice";
|
|
10
|
-
import { ENTITY_NAME,
|
|
14
|
+
import { ENTITY_NAME, type InvoiceEvents } from "../events";
|
|
11
15
|
import { type InvoiceStatus, loadInvoiceState } from "../reducer";
|
|
12
16
|
import { successResult, transitionHandler } from "./_helpers";
|
|
13
17
|
|
|
14
18
|
const adminOnly = { roles: ["Admin"] } as const;
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// --- updateStatus: relies on the pipeline's auto transition guard.
|
|
69
|
-
// Routes the requested status to the matching domain event so the audit
|
|
70
|
-
// log still reads as a workflow step ("invoice-sent"), not a generic
|
|
71
|
-
// "status set to ...".
|
|
72
|
-
|
|
73
|
-
// `
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
20
|
+
export function createInvoiceTransitionHandlers(events: InvoiceEvents) {
|
|
21
|
+
// --- Standard transitions (same shape, different target status) ---
|
|
22
|
+
|
|
23
|
+
const invoiceSend = transitionHandler({
|
|
24
|
+
name: "invoice:send",
|
|
25
|
+
toStatus: "sent",
|
|
26
|
+
event: events.sent,
|
|
27
|
+
access: adminOnly,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const invoiceCancel = transitionHandler({
|
|
31
|
+
name: "invoice:cancel",
|
|
32
|
+
toStatus: "cancelled",
|
|
33
|
+
event: events.cancelled,
|
|
34
|
+
access: adminOnly,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const invoiceReopen = transitionHandler({
|
|
38
|
+
name: "invoice:reopen",
|
|
39
|
+
toStatus: "draft",
|
|
40
|
+
event: events.reopened,
|
|
41
|
+
access: adminOnly,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// --- markPaid: same shape + business rule (amount must be > 0).
|
|
45
|
+
// The amount is reduced from the event stream, so the check stays
|
|
46
|
+
// consistent with everything else (no out-of-band DB query).
|
|
47
|
+
|
|
48
|
+
const invoiceMarkPaid = defineWriteHandler({
|
|
49
|
+
name: "invoice:mark-paid",
|
|
50
|
+
schema: z.object({ id: z.uuid() }),
|
|
51
|
+
access: { roles: ["Accounting"] },
|
|
52
|
+
handler: async (event, ctx) => {
|
|
53
|
+
const state = await loadInvoiceState(ctx, event.payload.id);
|
|
54
|
+
if (!state) return failNotFound(ENTITY_NAME, event.payload.id);
|
|
55
|
+
|
|
56
|
+
guardTransition(INVOICE_TRANSITIONS, state.status as InvoiceStatus, "paid");
|
|
57
|
+
|
|
58
|
+
if (state.amount === 0) {
|
|
59
|
+
return failUnprocessable("cannot_pay_zero_amount");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
await emitEvent(ctx, events.markedPaid, {
|
|
63
|
+
aggregateId: event.payload.id,
|
|
64
|
+
aggregateType: ENTITY_NAME,
|
|
65
|
+
payload: {},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return successResult(event.payload.id, "paid", state.status);
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// --- updateStatus: relies on the pipeline's auto transition guard.
|
|
73
|
+
// Routes the requested status to the matching domain event so the audit
|
|
74
|
+
// log still reads as a workflow step ("invoice-sent"), not a generic
|
|
75
|
+
// "status set to ...".
|
|
76
|
+
|
|
77
|
+
// `satisfies Record<InvoiceStatus, ...>` makes a missing status a compile error.
|
|
78
|
+
const verbToEvent = {
|
|
79
|
+
draft: events.reopened,
|
|
80
|
+
sent: events.sent,
|
|
81
|
+
paid: events.markedPaid,
|
|
82
|
+
cancelled: events.cancelled,
|
|
83
|
+
} satisfies Record<InvoiceStatus, InvoiceEvents["sent"]>;
|
|
84
|
+
|
|
85
|
+
const invoiceUpdateStatus = defineWriteHandler({
|
|
86
|
+
name: "invoice:update-status",
|
|
87
|
+
schema: z.object({
|
|
88
|
+
id: z.uuid(),
|
|
89
|
+
changes: z.object({
|
|
90
|
+
status: z.enum(INVOICE_STATES),
|
|
91
|
+
}),
|
|
92
|
+
}),
|
|
93
|
+
access: adminOnly,
|
|
94
|
+
// No skipTransitionGuard — pipeline auto-guards.
|
|
95
|
+
handler: async (event, ctx) => {
|
|
96
|
+
const state = await loadInvoiceState(ctx, event.payload.id);
|
|
97
|
+
if (!state) return failNotFound(ENTITY_NAME, event.payload.id);
|
|
98
|
+
|
|
99
|
+
const target = event.payload.changes.status;
|
|
100
|
+
await emitEvent(ctx, verbToEvent[target], {
|
|
101
|
+
aggregateId: event.payload.id,
|
|
102
|
+
aggregateType: ENTITY_NAME,
|
|
103
|
+
payload: {},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return successResult(event.payload.id, target, state.status);
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// --- forceStatus: skips the guard and emits a dedicated "forced" event so
|
|
111
|
+
// admin overrides stay visually distinct from normal workflow events in
|
|
112
|
+
// the audit log.
|
|
113
|
+
|
|
114
|
+
const invoiceForceStatus = defineWriteHandler({
|
|
115
|
+
name: "invoice:force-status",
|
|
116
|
+
schema: z.object({
|
|
117
|
+
id: z.uuid(),
|
|
91
118
|
status: z.enum(INVOICE_STATES),
|
|
92
119
|
}),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
payload
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
schema: z.object({
|
|
119
|
-
id: z.uuid(),
|
|
120
|
-
status: z.enum(INVOICE_STATES),
|
|
121
|
-
}),
|
|
122
|
-
access: adminOnly,
|
|
123
|
-
unsafeSkipTransitionGuard: true,
|
|
124
|
-
handler: async (event, ctx) => {
|
|
125
|
-
const state = await loadInvoiceState(ctx, event.payload.id);
|
|
126
|
-
if (!state) return failNotFound(ENTITY_NAME, event.payload.id);
|
|
127
|
-
|
|
128
|
-
await ctx.appendEvent({
|
|
129
|
-
aggregateId: event.payload.id,
|
|
130
|
-
aggregateType: ENTITY_NAME,
|
|
131
|
-
type: eventName(INVOICE_EVENTS.statusForced),
|
|
132
|
-
payload: { newStatus: event.payload.status, fromStatus: state.status as InvoiceStatus },
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
return successResult(event.payload.id, event.payload.status, state.status);
|
|
136
|
-
},
|
|
137
|
-
});
|
|
120
|
+
access: adminOnly,
|
|
121
|
+
unsafeSkipTransitionGuard: true,
|
|
122
|
+
handler: async (event, ctx) => {
|
|
123
|
+
const state = await loadInvoiceState(ctx, event.payload.id);
|
|
124
|
+
if (!state) return failNotFound(ENTITY_NAME, event.payload.id);
|
|
125
|
+
|
|
126
|
+
await emitEvent(ctx, events.statusForced, {
|
|
127
|
+
aggregateId: event.payload.id,
|
|
128
|
+
aggregateType: ENTITY_NAME,
|
|
129
|
+
payload: { newStatus: event.payload.status, fromStatus: state.status as InvoiceStatus },
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return successResult(event.payload.id, event.payload.status, state.status);
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
invoiceSend,
|
|
138
|
+
invoiceCancel,
|
|
139
|
+
invoiceReopen,
|
|
140
|
+
invoiceMarkPaid,
|
|
141
|
+
invoiceUpdateStatus,
|
|
142
|
+
invoiceForceStatus,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// and update the relevant `case` in `reduceInvoice` — that's the whole
|
|
8
8
|
// contract.
|
|
9
9
|
|
|
10
|
-
import type { HandlerContext } from "@
|
|
10
|
+
import type { HandlerContext } from "@cosmicdrift/kumiko-framework/engine";
|
|
11
11
|
import { eventName, INVOICE_CREATED_EVENT, INVOICE_EVENTS } from "./events";
|
|
12
12
|
|
|
13
13
|
export type InvoiceStatus = "draft" | "sent" | "paid" | "cancelled";
|
|
@@ -11,16 +11,12 @@
|
|
|
11
11
|
"@cosmicdrift/kumiko-dev-server": [
|
|
12
12
|
"../../../packages/dev-server/src/index.ts"
|
|
13
13
|
],
|
|
14
|
-
"@cosmicdrift/kumiko-dev-server/*": [
|
|
15
|
-
"../../../packages/dev-server/src/*"
|
|
16
|
-
],
|
|
17
|
-
"@app/define": ["./.kumiko/define.ts"],
|
|
18
|
-
"@app/*": ["./.kumiko/*"]
|
|
14
|
+
"@cosmicdrift/kumiko-dev-server/*": ["../../../packages/dev-server/src/*"]
|
|
19
15
|
},
|
|
20
16
|
"noEmit": true,
|
|
21
17
|
"rootDir": "../../..",
|
|
22
18
|
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
|
23
19
|
"types": ["bun-types"]
|
|
24
20
|
},
|
|
25
|
-
"include": ["./src"
|
|
21
|
+
"include": ["./src"]
|
|
26
22
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_comment": "Single source of truth \u2014 check-app-tsc reads this template
|
|
2
|
+
"_comment": "Single source of truth \u2014 check-app-tsc reads this template. Paths are relative to samples/recipes/<name>/.",
|
|
3
3
|
"extends": "../../../tsconfig.json",
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"paths": {
|
|
@@ -16,8 +16,12 @@
|
|
|
16
16
|
// - HTTP-Endpoints fuer create/list
|
|
17
17
|
// - Compliance-Profile-Wiring + Cron-Scheduling
|
|
18
18
|
|
|
19
|
-
import {
|
|
20
|
-
|
|
19
|
+
import {
|
|
20
|
+
deleteMany,
|
|
21
|
+
deriveEntityTableMeta,
|
|
22
|
+
selectMany,
|
|
23
|
+
updateMany,
|
|
24
|
+
} from "@cosmicdrift/kumiko-framework/db";
|
|
21
25
|
import {
|
|
22
26
|
createEntity,
|
|
23
27
|
createTextField,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// })
|
|
15
15
|
|
|
16
16
|
import { createAuthEmailPasswordFeature } from "@cosmicdrift/kumiko-bundled-features/auth-email-password";
|
|
17
|
-
import {
|
|
17
|
+
import { createAuthFoundationFeature } from "@cosmicdrift/kumiko-bundled-features/auth-foundation";
|
|
18
18
|
import { createComplianceProfilesFeature } from "@cosmicdrift/kumiko-bundled-features/compliance-profiles";
|
|
19
19
|
import { createConfigFeature } from "@cosmicdrift/kumiko-bundled-features/config";
|
|
20
20
|
import { createDataRetentionFeature } from "@cosmicdrift/kumiko-bundled-features/data-retention";
|
|
@@ -59,7 +59,7 @@ export function composeAccountApp(): FeatureDefinition[] {
|
|
|
59
59
|
createAuthEmailPasswordFeature(),
|
|
60
60
|
createDataRetentionFeature(),
|
|
61
61
|
createComplianceProfilesFeature(),
|
|
62
|
-
|
|
62
|
+
createAuthFoundationFeature(),
|
|
63
63
|
createPersonalAccessTokensFeature({ scopes: {} }),
|
|
64
64
|
createSessionsFeature(),
|
|
65
65
|
createFilesFeature(),
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
asRawClient,
|
|
3
|
+
type DbRunner,
|
|
4
|
+
toPostgresArrayLiteral,
|
|
5
|
+
} from "@cosmicdrift/kumiko-framework/db";
|
|
3
6
|
|
|
4
7
|
export async function selectExpiredSuspensionEvents(
|
|
5
8
|
db: DbRunner,
|