@cosmicdrift/kumiko-samples 0.385.0 → 0.387.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/LICENSE +21 -57
- package/README.md +1 -1
- package/package.json +2 -2
- package/packages/bundled-features/package.json +2 -2
- package/packages/bundled-features/src/agent-tools/tool-catalog.ts +1 -1
- package/packages/bundled-features/src/agent-tools/tool-dispatch.ts +0 -2
- package/packages/bundled-features/src/audit/screens.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/auth-user-row.ts +10 -10
- package/packages/bundled-features/src/auth-email-password/feature.ts +6 -6
- package/packages/bundled-features/src/auth-email-password/handlers/change-password.write.ts +3 -3
- package/packages/bundled-features/src/auth-email-password/handlers/confirm-token-flow.ts +5 -5
- package/packages/bundled-features/src/auth-email-password/handlers/invite-accept-with-login.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/invite-accept.write.ts +18 -18
- package/packages/bundled-features/src/auth-email-password/handlers/invite-create.write.ts +12 -12
- 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 +24 -26
- package/packages/bundled-features/src/auth-email-password/handlers/login.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/self-registration-status.query.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/signup-confirm.write.ts +34 -37
- package/packages/bundled-features/src/auth-email-password/handlers/signup-request.write.ts +6 -7
- package/packages/bundled-features/src/auth-email-password/handlers/switch-tenant-mfa-gate.write.ts +1 -5
- package/packages/bundled-features/src/auth-email-password/index.ts +5 -5
- package/packages/bundled-features/src/auth-email-password/lockout-store.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/seeding.ts +63 -66
- package/packages/bundled-features/src/auth-email-password/signup-token-store.ts +8 -8
- package/packages/bundled-features/src/auth-email-password/testing.ts +3 -3
- package/packages/bundled-features/src/auth-email-password/web/auth-client.ts +57 -57
- package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +14 -14
- package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +15 -16
- package/packages/bundled-features/src/auth-email-password/web/client-plugin.ts +11 -12
- package/packages/bundled-features/src/auth-email-password/web/confirm-account-unlock-screen.tsx +1 -1
- package/packages/bundled-features/src/auth-email-password/web/constants.ts +3 -3
- package/packages/bundled-features/src/auth-email-password/web/default-topbar-actions.tsx +14 -14
- package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +11 -11
- package/packages/bundled-features/src/auth-email-password/web/index.ts +5 -5
- package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +17 -17
- package/packages/bundled-features/src/auth-email-password/web/login-screen.tsx +3 -4
- package/packages/bundled-features/src/auth-email-password/web/reset-password-screen.tsx +16 -17
- package/packages/bundled-features/src/auth-email-password/web/session.tsx +34 -34
- package/packages/bundled-features/src/auth-email-password/web/signup-complete-screen.tsx +3 -3
- package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +14 -14
- package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +26 -27
- package/packages/bundled-features/src/auth-email-password/web/use-shell-user.ts +12 -13
- package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +17 -18
- package/packages/bundled-features/src/auth-email-password/web/verify-email-screen.tsx +11 -12
- package/packages/bundled-features/src/auth-foundation/boot-checks.ts +4 -4
- package/packages/bundled-features/src/auth-foundation/resolve-anonymous-access.ts +4 -4
- package/packages/bundled-features/src/auth-foundation/types.ts +2 -2
- package/packages/bundled-features/src/auth-mfa/handlers/disable.write.ts +3 -3
- package/packages/bundled-features/src/auth-mfa/handlers/enable-confirm-preauth.write.ts +4 -4
- package/packages/bundled-features/src/auth-mfa/handlers/enable-confirm.write.ts +2 -2
- 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 +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/regenerate-recovery.write.ts +5 -5
- package/packages/bundled-features/src/auth-mfa/handlers/verify.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/token-secrets.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/web/client-plugin.ts +2 -2
- package/packages/bundled-features/src/auth-mfa/web/i18n.ts +3 -3
- package/packages/bundled-features/src/auth-mfa/web/index.ts +4 -4
- package/packages/bundled-features/src/auth-mfa/web/mfa-client.ts +17 -16
- package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +6 -6
- package/packages/bundled-features/src/billing-foundation/aggregate-id.ts +10 -11
- package/packages/bundled-features/src/billing-foundation/entities.ts +27 -27
- package/packages/bundled-features/src/billing-foundation/events.ts +22 -21
- package/packages/bundled-features/src/billing-foundation/feature.ts +42 -43
- package/packages/bundled-features/src/billing-foundation/get-subscription-for-tenant.ts +3 -5
- package/packages/bundled-features/src/billing-foundation/handlers/create-checkout-session.write.ts +18 -17
- package/packages/bundled-features/src/billing-foundation/handlers/create-portal-session.write.ts +11 -12
- package/packages/bundled-features/src/billing-foundation/handlers/list-subscriptions.query.ts +4 -4
- package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +20 -20
- package/packages/bundled-features/src/billing-foundation/projection.ts +38 -37
- package/packages/bundled-features/src/billing-foundation/subscription-tier-sync.ts +3 -3
- package/packages/bundled-features/src/billing-foundation/tenant-destroy-hook.ts +7 -8
- package/packages/bundled-features/src/billing-foundation/types.ts +64 -65
- package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +4 -4
- package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +1 -1
- package/packages/bundled-features/src/cap-counter/aggregate-id.ts +8 -9
- package/packages/bundled-features/src/cap-counter/constants.ts +11 -12
- package/packages/bundled-features/src/cap-counter/enforce-cap.ts +64 -67
- package/packages/bundled-features/src/cap-counter/entity.ts +29 -29
- package/packages/bundled-features/src/cap-counter/feature.ts +34 -35
- package/packages/bundled-features/src/cap-counter/handlers/increment-rolling.write.ts +31 -31
- package/packages/bundled-features/src/cap-counter/handlers/mark-soft-warned.write.ts +4 -5
- package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +1 -1
- package/packages/bundled-features/src/cap-counter/with-cap-enforcement.ts +3 -5
- package/packages/bundled-features/src/cap-overview/handlers/caps-usage.query.ts +1 -3
- package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +1 -1
- package/packages/bundled-features/src/channel-email/smtp-transport.ts +34 -31
- package/packages/bundled-features/src/channel-in-app/handlers/unread-count.query.ts +3 -4
- package/packages/bundled-features/src/compliance-profiles/feature.ts +15 -16
- package/packages/bundled-features/src/compliance-profiles/handlers/for-tenant.query.ts +3 -6
- package/packages/bundled-features/src/compliance-profiles/handlers/list-profiles.query.ts +5 -5
- package/packages/bundled-features/src/compliance-profiles/handlers/needs-profile.query.ts +4 -4
- package/packages/bundled-features/src/compliance-profiles/handlers/set-profile.write.ts +13 -14
- package/packages/bundled-features/src/compliance-profiles/handlers/sub-processors.query.ts +9 -11
- package/packages/bundled-features/src/compliance-profiles/resolve-for-tenant.ts +7 -7
- package/packages/bundled-features/src/compliance-profiles/schema/profile-selection.ts +18 -23
- package/packages/bundled-features/src/compliance-profiles/seeding.ts +14 -15
- package/packages/bundled-features/src/compliance-profiles-ops/handlers/tenants-missing-profile.query.ts +3 -3
- package/packages/bundled-features/src/compliance-profiles-ops/index.ts +2 -2
- package/packages/bundled-features/src/config/handlers/readiness.query.ts +7 -7
- package/packages/bundled-features/src/config/handlers/reencrypt.job.ts +4 -5
- package/packages/bundled-features/src/config/handlers/set.write.ts +4 -4
- package/packages/bundled-features/src/config/resolver.ts +4 -4
- package/packages/bundled-features/src/config/table.ts +10 -10
- package/packages/bundled-features/src/config/write-helpers.ts +1 -1
- package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +13 -12
- package/packages/bundled-features/src/custom-fields/aggregate-id.ts +16 -17
- package/packages/bundled-features/src/custom-fields/entity.ts +49 -47
- package/packages/bundled-features/src/custom-fields/events.ts +7 -8
- package/packages/bundled-features/src/custom-fields/feature.ts +70 -72
- package/packages/bundled-features/src/custom-fields/handlers/clear-custom-field.write.ts +9 -8
- package/packages/bundled-features/src/custom-fields/handlers/define-tenant-field.write.ts +28 -26
- package/packages/bundled-features/src/custom-fields/handlers/delete-system-field.write.ts +6 -7
- package/packages/bundled-features/src/custom-fields/handlers/delete-tenant-field.write.ts +12 -13
- package/packages/bundled-features/src/custom-fields/handlers/set-custom-field.write.ts +25 -28
- package/packages/bundled-features/src/custom-fields/handlers/update-tenant-field.write.ts +6 -6
- package/packages/bundled-features/src/custom-fields/lib/field-access.ts +2 -2
- package/packages/bundled-features/src/custom-fields/lib/parse-serialized-field.ts +1 -1
- package/packages/bundled-features/src/custom-fields/lib/quota.ts +1 -1
- package/packages/bundled-features/src/custom-fields/lib/value-schema.ts +10 -12
- package/packages/bundled-features/src/custom-fields/run-retention.ts +3 -3
- package/packages/bundled-features/src/custom-fields/schemas.ts +14 -14
- package/packages/bundled-features/src/custom-fields/web/client-plugin.tsx +2 -5
- package/packages/bundled-features/src/custom-fields/web/constants.ts +2 -2
- package/packages/bundled-features/src/custom-fields/web/custom-fields-form-section.tsx +26 -26
- package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +65 -67
- package/packages/bundled-features/src/custom-fields/wire-user-data-rights.ts +3 -3
- package/packages/bundled-features/src/data-retention/_internal/parse-override.ts +2 -3
- package/packages/bundled-features/src/data-retention/feature.ts +11 -18
- package/packages/bundled-features/src/data-retention/handlers/policy-for.query.ts +6 -6
- package/packages/bundled-features/src/data-retention/keep-for.ts +17 -17
- package/packages/bundled-features/src/data-retention/override-schema.ts +13 -15
- package/packages/bundled-features/src/data-retention/presets.ts +18 -23
- package/packages/bundled-features/src/data-retention/resolve-for-tenant.ts +1 -1
- package/packages/bundled-features/src/data-retention/resolve-tenant-preset.ts +17 -16
- package/packages/bundled-features/src/data-retention/resolver.ts +33 -32
- package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +71 -58
- package/packages/bundled-features/src/data-retention/schema/tenant-retention-override.ts +13 -11
- package/packages/bundled-features/src/delivery/feature.ts +3 -3
- package/packages/bundled-features/src/delivery/handlers/log.query.ts +1 -1
- package/packages/bundled-features/src/delivery/tables.ts +9 -8
- package/packages/bundled-features/src/delivery/unsubscribe.ts +4 -4
- package/packages/bundled-features/src/delivery/upsert-preference.ts +3 -4
- package/packages/bundled-features/src/document-ingest-foundation/entity.ts +5 -5
- package/packages/bundled-features/src/document-ingest-foundation/events.ts +2 -2
- package/packages/bundled-features/src/document-ingest-foundation/feature.ts +2 -2
- package/packages/bundled-features/src/document-ingest-foundation/pages.ts +1 -1
- package/packages/bundled-features/src/document-ingest-foundation/tenant-destroy-hook.ts +4 -4
- package/packages/bundled-features/src/feature-toggles/compose-tier-resolver.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/feature.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/global-feature-state-table.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/handlers/registered.query.ts +5 -5
- package/packages/bundled-features/src/feature-toggles/toggle-runtime.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/toggle-sync-signal.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/web/constants.ts +1 -1
- package/packages/bundled-features/src/file-derivatives/feature.ts +2 -2
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +1 -1
- package/packages/bundled-features/src/file-derivatives/presets.ts +1 -1
- package/packages/bundled-features/src/file-foundation/feature.ts +6 -6
- package/packages/bundled-features/src/file-provider-inmemory/feature.ts +16 -16
- package/packages/bundled-features/src/file-provider-s3/feature.ts +16 -16
- package/packages/bundled-features/src/file-provider-s3/lib/s3-provider.ts +6 -6
- package/packages/bundled-features/src/files/feature.ts +6 -6
- package/packages/bundled-features/src/files-tenant-data/handlers/sweep-orphaned-derivatives.job.ts +5 -5
- package/packages/bundled-features/src/files-tenant-data/hooks.ts +24 -26
- package/packages/bundled-features/src/files-tenant-data/index.ts +1 -1
- package/packages/bundled-features/src/folders/feature.ts +1 -1
- package/packages/bundled-features/src/folders/web/folder-manager.tsx +2 -2
- package/packages/bundled-features/src/folders/web/tree.ts +5 -5
- package/packages/bundled-features/src/form-draft/db/queries/cleanup.ts +1 -1
- package/packages/bundled-features/src/form-draft/db/queries/owned-file-refs.ts +1 -1
- package/packages/bundled-features/src/form-draft/entity.ts +3 -3
- package/packages/bundled-features/src/form-draft/feature.ts +4 -5
- package/packages/bundled-features/src/form-draft/handlers/discard.write.ts +1 -1
- package/packages/bundled-features/src/form-draft/release-file-refs.ts +6 -6
- package/packages/bundled-features/src/form-draft/schemas.ts +3 -3
- package/packages/bundled-features/src/form-draft/web/constants.ts +0 -2
- package/packages/bundled-features/src/inbound-mail-foundation/aggregate-id.ts +19 -19
- package/packages/bundled-features/src/inbound-mail-foundation/connect-routes.ts +4 -3
- package/packages/bundled-features/src/inbound-mail-foundation/constants.ts +30 -33
- package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +47 -48
- package/packages/bundled-features/src/inbound-mail-foundation/events.ts +54 -50
- package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +39 -39
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/account-state.ts +8 -8
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/connect-account.write.ts +25 -26
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/disconnect-account.write.ts +7 -7
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message.write.ts +50 -51
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/list-accounts.query.ts +8 -8
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/list-messages.query.ts +10 -10
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/scope-visibility.ts +3 -4
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/update-account.write.ts +11 -11
- package/packages/bundled-features/src/inbound-mail-foundation/oauth-state.ts +16 -15
- package/packages/bundled-features/src/inbound-mail-foundation/projection.ts +31 -29
- package/packages/bundled-features/src/inbound-mail-foundation/provider-factory.ts +9 -9
- package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +45 -41
- package/packages/bundled-features/src/inbound-mail-foundation/tenant-destroy-hook.ts +14 -16
- package/packages/bundled-features/src/inbound-mail-foundation/types.ts +66 -67
- package/packages/bundled-features/src/inbound-mail-foundation/watch-supervisor.ts +69 -68
- package/packages/bundled-features/src/inbound-provider-imap/credential-document.ts +13 -13
- package/packages/bundled-features/src/inbound-provider-imap/feature.ts +42 -40
- package/packages/bundled-features/src/inbound-provider-imap/imap-client.ts +20 -19
- package/packages/bundled-features/src/inbound-provider-inmemory/feature.ts +21 -21
- package/packages/bundled-features/src/jobs/db/queries/retention.ts +2 -2
- package/packages/bundled-features/src/jobs/db/queries/stale-run-sweep.ts +3 -3
- package/packages/bundled-features/src/jobs/events.ts +1 -1
- package/packages/bundled-features/src/jobs/feature.ts +6 -7
- package/packages/bundled-features/src/jobs/handlers/detail.query.ts +4 -4
- package/packages/bundled-features/src/jobs/handlers/list.query.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/projection-rebuild.job.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/reindex-entity.job.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/retry.write.ts +1 -1
- package/packages/bundled-features/src/jobs/job-instant.ts +1 -1
- package/packages/bundled-features/src/jobs/job-run-logger.ts +14 -15
- package/packages/bundled-features/src/jobs/job-run-table.ts +3 -3
- package/packages/bundled-features/src/jobs/screens.ts +1 -1
- 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/entity.ts +5 -5
- package/packages/bundled-features/src/ledger/feature.ts +3 -3
- package/packages/bundled-features/src/ledger/handlers/confirm-schedule-period.write.ts +3 -3
- package/packages/bundled-features/src/ledger/recurring.ts +12 -12
- package/packages/bundled-features/src/ledger/schemas.ts +1 -1
- package/packages/bundled-features/src/ledger/web/constants.ts +2 -2
- package/packages/bundled-features/src/ledger/web/index.ts +7 -7
- package/packages/bundled-features/src/legal-pages/feature.ts +40 -41
- package/packages/bundled-features/src/legal-pages/markdown.ts +3 -3
- package/packages/bundled-features/src/legal-pages/web/client-plugin.ts +23 -24
- package/packages/bundled-features/src/legal-pages/web/index.ts +0 -2
- package/packages/bundled-features/src/mail-foundation/feature.ts +26 -27
- package/packages/bundled-features/src/mail-transport-inmemory/feature.ts +27 -28
- package/packages/bundled-features/src/mail-transport-smtp/feature.ts +20 -20
- package/packages/bundled-features/src/managed-pages/branding.ts +6 -6
- package/packages/bundled-features/src/managed-pages/feature.ts +62 -62
- package/packages/bundled-features/src/managed-pages/handlers/by-slug.query.ts +5 -6
- package/packages/bundled-features/src/managed-pages/handlers/by-tenant-published.query.ts +8 -8
- package/packages/bundled-features/src/managed-pages/handlers/set.write.ts +5 -7
- package/packages/bundled-features/src/managed-pages/screens/page-screens.ts +11 -11
- package/packages/bundled-features/src/managed-pages/seeding.ts +8 -8
- package/packages/bundled-features/src/managed-pages/table.ts +16 -15
- package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +6 -6
- package/packages/bundled-features/src/managed-pages/web/i18n.ts +1 -1
- package/packages/bundled-features/src/notes-history/entity.ts +4 -4
- package/packages/bundled-features/src/notes-history/feature.ts +2 -2
- package/packages/bundled-features/src/notes-history-user-data/hooks.ts +1 -1
- package/packages/bundled-features/src/page-render/layout.ts +9 -9
- package/packages/bundled-features/src/page-render/markdown.ts +11 -11
- package/packages/bundled-features/src/page-render/security-headers.ts +7 -6
- package/packages/bundled-features/src/personal-access-tokens/feature.ts +5 -5
- package/packages/bundled-features/src/personal-access-tokens/roles.ts +2 -2
- package/packages/bundled-features/src/readiness/handlers/status.query.ts +3 -3
- package/packages/bundled-features/src/renderer-foundation/api.ts +12 -13
- package/packages/bundled-features/src/renderer-foundation/constants.ts +2 -2
- package/packages/bundled-features/src/renderer-foundation/feature.ts +7 -7
- package/packages/bundled-features/src/renderer-foundation/types.ts +11 -12
- package/packages/bundled-features/src/secrets/feature.ts +9 -9
- package/packages/bundled-features/src/secrets/web/constants.ts +2 -2
- package/packages/bundled-features/src/seo/feature.ts +3 -3
- package/packages/bundled-features/src/sessions/constants.ts +1 -1
- package/packages/bundled-features/src/sessions/feature.ts +9 -9
- package/packages/bundled-features/src/sessions/handlers/revoke-all-for-user.write.ts +2 -2
- package/packages/bundled-features/src/sessions/handlers/revoke-all-others.write.ts +2 -2
- package/packages/bundled-features/src/sessions/handlers/revoke.write.ts +1 -1
- package/packages/bundled-features/src/sessions/schema/user-session.ts +4 -4
- package/packages/bundled-features/src/sessions/screens.ts +2 -2
- package/packages/bundled-features/src/sessions/session-callbacks.ts +2 -2
- package/packages/bundled-features/src/sessions/session-revoked-event.ts +2 -2
- package/packages/bundled-features/src/shared/assert-no-where-rule-in-ownership-write.ts +1 -1
- package/packages/bundled-features/src/shared/decrypt-stored-pii.ts +1 -1
- package/packages/bundled-features/src/shared/encrypt-for-direct-write.ts +1 -1
- package/packages/bundled-features/src/shared/map-with-concurrency.ts +5 -4
- package/packages/bundled-features/src/shared/parent-visibility.ts +2 -2
- package/packages/bundled-features/src/shared/password-hashing.ts +1 -1
- package/packages/bundled-features/src/shared/signup-handover.ts +1 -2
- package/packages/bundled-features/src/shared/single-use-token-store.ts +1 -1
- package/packages/bundled-features/src/subscription-mollie/constants.ts +15 -17
- package/packages/bundled-features/src/subscription-mollie/feature.ts +41 -42
- package/packages/bundled-features/src/subscription-mollie/index.ts +3 -3
- package/packages/bundled-features/src/subscription-mollie/plugin-methods.ts +17 -16
- package/packages/bundled-features/src/subscription-mollie/verify-webhook.ts +34 -34
- package/packages/bundled-features/src/subscription-stripe/constants.ts +4 -6
- package/packages/bundled-features/src/subscription-stripe/feature.ts +44 -43
- package/packages/bundled-features/src/subscription-stripe/index.ts +6 -6
- package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +22 -27
- package/packages/bundled-features/src/subscription-stripe/runtime.ts +2 -2
- package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +62 -64
- package/packages/bundled-features/src/tags/feature.ts +3 -3
- package/packages/bundled-features/src/tags/screens.ts +1 -1
- package/packages/bundled-features/src/template-resolver/api.ts +10 -10
- package/packages/bundled-features/src/template-resolver/handlers/find-by-id.query.ts +5 -5
- package/packages/bundled-features/src/template-resolver/handlers/list.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/shared.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +3 -3
- package/packages/bundled-features/src/template-resolver/handlers/upsert-system.write.ts +3 -4
- package/packages/bundled-features/src/template-resolver/handlers/upsert-tenant.write.ts +4 -5
- package/packages/bundled-features/src/template-resolver/seeding.ts +4 -4
- package/packages/bundled-features/src/template-resolver/table.ts +13 -14
- package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +2 -2
- package/packages/bundled-features/src/tenant/feature.ts +7 -7
- 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/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/invitation-table.ts +37 -40
- package/packages/bundled-features/src/tenant/membership-table.ts +3 -3
- package/packages/bundled-features/src/tenant/schema/tenant.ts +7 -9
- package/packages/bundled-features/src/tenant/screens.ts +1 -1
- package/packages/bundled-features/src/tenant/seeding.ts +19 -18
- package/packages/bundled-features/src/tenant/testing.ts +5 -6
- package/packages/bundled-features/src/tenant/web/constants.ts +2 -2
- package/packages/bundled-features/src/tenant-handover/events.ts +5 -7
- package/packages/bundled-features/src/tenant-handover/feature.ts +1 -1
- package/packages/bundled-features/src/tenant-handover/grant.ts +1 -1
- package/packages/bundled-features/src/tenant-handover/handlers/claim.write.ts +1 -1
- package/packages/bundled-features/src/tenant-handover/move-entity-graph.ts +8 -9
- package/packages/bundled-features/src/tenant-handover/signup-handover-provider.ts +1 -2
- package/packages/bundled-features/src/tenant-handover/transfer-graph.ts +4 -5
- package/packages/bundled-features/src/tenant-lifecycle/boot-checks.ts +1 -1
- package/packages/bundled-features/src/tenant-lifecycle/feature.ts +1 -1
- package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +2 -2
- package/packages/bundled-features/src/tenant-lifecycle/stages.ts +1 -1
- package/packages/bundled-features/src/tenant-settings/constants.ts +1 -1
- package/packages/bundled-features/src/tenant-settings/tenant-defaults.ts +12 -5
- package/packages/bundled-features/src/tier-engine/aggregate-id.ts +15 -16
- package/packages/bundled-features/src/tier-engine/compose-app.ts +14 -14
- package/packages/bundled-features/src/tier-engine/entity.ts +18 -19
- package/packages/bundled-features/src/tier-engine/feature.ts +88 -87
- package/packages/bundled-features/src/tier-engine/handlers/active-tier.query.ts +6 -7
- package/packages/bundled-features/src/tier-engine/handlers/get-tenant-tier.query.ts +4 -4
- package/packages/bundled-features/src/tier-engine/handlers/set-tenant-tier.write.ts +8 -8
- package/packages/bundled-features/src/tier-engine/tier-resolver.ts +2 -2
- package/packages/bundled-features/src/tier-engine/trial.ts +13 -13
- package/packages/bundled-features/src/tier-engine/web/index.ts +4 -4
- package/packages/bundled-features/src/user/db/queries/stream-tenant-backfill.ts +8 -8
- package/packages/bundled-features/src/user/handlers/create.write.ts +4 -4
- package/packages/bundled-features/src/user/schema/user.ts +45 -44
- package/packages/bundled-features/src/user/seeding.ts +40 -40
- package/packages/bundled-features/src/user/testing.ts +3 -3
- package/packages/bundled-features/src/user-data-rights/audit-download.ts +27 -28
- package/packages/bundled-features/src/user-data-rights/boot-checks.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/deletion-token.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/feature.ts +112 -113
- package/packages/bundled-features/src/user-data-rights/handlers/cancel-deletion.write.ts +9 -9
- package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +8 -8
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-job.query.ts +29 -30
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +40 -42
- package/packages/bundled-features/src/user-data-rights/handlers/export-status.query.ts +8 -9
- package/packages/bundled-features/src/user-data-rights/handlers/lift-restriction.write.ts +7 -8
- package/packages/bundled-features/src/user-data-rights/handlers/list-download-attempts.query.ts +2 -2
- package/packages/bundled-features/src/user-data-rights/handlers/my-audit-log.query.ts +4 -4
- package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts +30 -29
- package/packages/bundled-features/src/user-data-rights/handlers/request-deletion.write.ts +15 -18
- package/packages/bundled-features/src/user-data-rights/handlers/request-export.write.ts +42 -41
- package/packages/bundled-features/src/user-data-rights/handlers/restrict-account.write.ts +22 -19
- package/packages/bundled-features/src/user-data-rights/handlers/run-forget-cleanup.write.ts +8 -8
- package/packages/bundled-features/src/user-data-rights/index.ts +8 -10
- package/packages/bundled-features/src/user-data-rights/lib/default-mailers.ts +3 -3
- package/packages/bundled-features/src/user-data-rights/lib/update-user-lifecycle.ts +24 -27
- package/packages/bundled-features/src/user-data-rights/run-export-jobs.ts +166 -276
- package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +85 -107
- package/packages/bundled-features/src/user-data-rights/run-user-export.ts +67 -69
- package/packages/bundled-features/src/user-data-rights/schema/download-attempt.ts +11 -11
- package/packages/bundled-features/src/user-data-rights/schema/download-token.ts +37 -41
- package/packages/bundled-features/src/user-data-rights/schema/export-job.ts +65 -67
- package/packages/bundled-features/src/user-data-rights/token-helpers.ts +21 -25
- package/packages/bundled-features/src/user-data-rights/web/client-plugin.tsx +6 -6
- package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +6 -5
- package/packages/bundled-features/src/user-data-rights/web/constants.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/web/index.ts +5 -5
- package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +14 -13
- package/packages/bundled-features/src/user-data-rights/web/public-deletion-gate.tsx +13 -12
- package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +6 -6
- package/packages/bundled-features/src/user-data-rights/zip-path.ts +41 -40
- package/packages/bundled-features/src/user-data-rights-defaults/feature.ts +15 -15
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/delivery-attempt.userdata-hook.ts +3 -5
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/file-ref.userdata-hook.ts +45 -51
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/job-run.userdata-hook.ts +2 -2
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/notification-preference.userdata-hook.ts +1 -1
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/user-session.userdata-hook.ts +3 -3
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/user.userdata-hook.ts +32 -31
- package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +13 -13
- package/packages/bundled-features/src/user-profile/index.ts +3 -3
- package/packages/bundled-features/src/user-profile/web/client-plugin.ts +1 -1
- package/packages/bundled-features/src/user-profile/web/constants.ts +1 -1
- package/packages/bundled-features/src/user-profile/web/profile-screen.tsx +1 -1
- package/packages/bundled-features/src/workflow-runner/aggregate-id.ts +1 -1
- package/packages/bundled-features/src/workflow-runner/event-subscriber.ts +4 -5
- package/packages/bundled-features/src/workflow-runner/event-trigger.ts +4 -15
- package/packages/bundled-features/src/workflow-runner/feature.ts +2 -2
- package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +4 -4
- package/packages/bundled-features/src/workflow-runner/pending-projection.ts +6 -7
- package/packages/bundled-features/src/workflow-runner/runner.ts +6 -6
- package/packages/bundled-features/src/workflow-runner/tables.ts +6 -6
- package/packages/bundled-features/src/workflow-runner/workflow-registry.ts +1 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// Browser-
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// Browser-side wrappers around /api/auth/* using cookie transport: the JWT
|
|
2
|
+
// lives in the HttpOnly kumiko_auth cookie, while the Double-Submit CSRF
|
|
3
|
+
// token lives in the JS-readable kumiko_csrf cookie. Every state-changing
|
|
4
|
+
// request echoes the CSRF token via X-CSRF-Token; otherwise the server
|
|
5
|
+
// rejects it with csrf_token_missing.
|
|
6
6
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// nicht divergieren.
|
|
7
|
+
// dispatcher-live uses the same readCsrfToken helper; reusing it here keeps
|
|
8
|
+
// the cookie and header constants from diverging.
|
|
10
9
|
|
|
11
10
|
import { parseRoles } from "@cosmicdrift/kumiko-framework/utils";
|
|
12
11
|
import { CSRF_HEADER_NAME, readCsrfToken } from "@cosmicdrift/kumiko-renderer/live";
|
|
@@ -14,8 +13,8 @@ import { CSRF_HEADER_NAME, readCsrfToken } from "@cosmicdrift/kumiko-renderer/li
|
|
|
14
13
|
export type TenantSummary = {
|
|
15
14
|
readonly tenantId: string;
|
|
16
15
|
readonly roles: readonly string[];
|
|
17
|
-
/** Display
|
|
18
|
-
*
|
|
16
|
+
/** Display name from /auth/tenants; absent only for app-owned membership
|
|
17
|
+
* queries without tenantName enrichment. */
|
|
19
18
|
readonly name?: string;
|
|
20
19
|
readonly key?: string;
|
|
21
20
|
};
|
|
@@ -154,8 +153,8 @@ export async function login(req: LoginRequest): Promise<LoginResult> {
|
|
|
154
153
|
return { kind: "success", data: toLoginResponse(body.token, body.user, body.landingPath) };
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
|
-
//
|
|
158
|
-
//
|
|
156
|
+
// The server sends error either as a string ("invalid_body") or as a
|
|
157
|
+
// structured object. Extract the most descriptive reason.
|
|
159
158
|
const err = body.error;
|
|
160
159
|
if (typeof err === "string") {
|
|
161
160
|
return { kind: "failure", error: { reason: err } };
|
|
@@ -172,10 +171,10 @@ export async function login(req: LoginRequest): Promise<LoginResult> {
|
|
|
172
171
|
};
|
|
173
172
|
}
|
|
174
173
|
|
|
175
|
-
// POST /api/auth/logout.
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
//
|
|
174
|
+
// POST /api/auth/logout. The server revokes the session when
|
|
175
|
+
// sessionRevoker is wired and clears the cookies. A navigation refresh
|
|
176
|
+
// afterward ensures that all caches (React state, query cache) return to
|
|
177
|
+
// an unauthenticated state—the simplest way to restore a clean baseline.
|
|
179
178
|
export async function logout(): Promise<void> {
|
|
180
179
|
await fetch("/api/auth/logout", {
|
|
181
180
|
method: "POST",
|
|
@@ -184,29 +183,29 @@ export async function logout(): Promise<void> {
|
|
|
184
183
|
});
|
|
185
184
|
}
|
|
186
185
|
|
|
187
|
-
//
|
|
186
|
+
// Shared failure type for the four token-flow endpoints (request-
|
|
188
187
|
// password-reset, reset-password, request-email-verification, verify-
|
|
189
|
-
// email).
|
|
190
|
-
// signature
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
//
|
|
188
|
+
// email). The server collapses all token-verification errors (malformed,
|
|
189
|
+
// bad signature, expired) into one code per flow to prevent enumeration;
|
|
190
|
+
// the UI maps reason to an i18n key. Rate limits (429) pass through as
|
|
191
|
+
// reason "rate_limited" with retryAfterSeconds, using the same shape as
|
|
192
|
+
// LoginFailure so apps can map errors uniformly.
|
|
194
193
|
export type AuthTokenFailure = {
|
|
195
194
|
readonly reason: string;
|
|
196
195
|
readonly retryAfterSeconds?: number;
|
|
197
196
|
};
|
|
198
197
|
|
|
199
|
-
// Backward-
|
|
200
|
-
// `ResetPasswordFailure`
|
|
201
|
-
//
|
|
198
|
+
// Backward-compatible aliases for the old type names, so code importing
|
|
199
|
+
// `ResetPasswordFailure` or `VerifyEmailFailure` continues to work without
|
|
200
|
+
// changes. New code should use `AuthTokenFailure` directly.
|
|
202
201
|
export type ResetPasswordFailure = AuthTokenFailure;
|
|
203
202
|
export type VerifyEmailFailure = AuthTokenFailure;
|
|
204
203
|
|
|
205
|
-
// 4xx/5xx
|
|
206
|
-
//
|
|
204
|
+
// Parse 4xx/5xx responses into AuthTokenFailure. 429 uses a dedicated
|
|
205
|
+
// reason so the UI can display a retry hint.
|
|
207
206
|
async function parseTokenFailure(res: Response): Promise<AuthTokenFailure> {
|
|
208
207
|
if (res.status === 429) {
|
|
209
|
-
// @cast-boundary engine-payload — server
|
|
208
|
+
// @cast-boundary engine-payload — the server sends details.retryAfterSeconds for 429
|
|
210
209
|
const body = (await res.json().catch(() => ({}))) as {
|
|
211
210
|
error?: { details?: { retryAfterSeconds?: number } };
|
|
212
211
|
};
|
|
@@ -238,11 +237,12 @@ export async function requestPasswordReset(
|
|
|
238
237
|
return { ok: false, error: await parseTokenFailure(res) };
|
|
239
238
|
}
|
|
240
239
|
|
|
241
|
-
// POST /api/auth/reset-password.
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
//
|
|
240
|
+
// POST /api/auth/reset-password. The token comes from the URL and the
|
|
241
|
+
// request includes the new password. On 422, the server collapses all
|
|
242
|
+
// token-verification errors (malformed, bad signature, expired) into the
|
|
243
|
+
// single code `invalid_reset_token` to prevent enumeration. Zod validation
|
|
244
|
+
// failures (newPassword < 8) use a separate 4xx code, "validation_failed".
|
|
245
|
+
// The UI maps reason to an i18n key.
|
|
246
246
|
export async function resetPassword(
|
|
247
247
|
token: string,
|
|
248
248
|
newPassword: string,
|
|
@@ -272,9 +272,9 @@ export async function requestEmailVerification(
|
|
|
272
272
|
return { ok: false, error: await parseTokenFailure(res) };
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
// POST /api/auth/verify-email.
|
|
276
|
-
//
|
|
277
|
-
// `invalid_verification_token`
|
|
275
|
+
// POST /api/auth/verify-email. VerifyEmailScreen submits this automatically
|
|
276
|
+
// after parsing `?token=...`. The server collapses all verification failures
|
|
277
|
+
// into `invalid_verification_token` to prevent enumeration, as with reset.
|
|
278
278
|
export async function verifyEmail(
|
|
279
279
|
token: string,
|
|
280
280
|
): Promise<{ ok: true } | { ok: false; error: AuthTokenFailure }> {
|
|
@@ -321,15 +321,14 @@ export async function confirmAccountUnlock(
|
|
|
321
321
|
return { ok: false, error: await parseTokenFailure(res) };
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
// POST /api/auth/signup-request. Always
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
//
|
|
324
|
+
// POST /api/auth/signup-request. Always returns 200 to prevent enumeration;
|
|
325
|
+
// the response does not reveal whether the email is already registered. The
|
|
326
|
+
// server sends an activation email to the address; following its link takes
|
|
327
|
+
// the user to /signup/complete?token=… to set a password.
|
|
328
328
|
export async function requestSignup(
|
|
329
329
|
email: string,
|
|
330
|
-
// Cross-device try-first handover
|
|
331
|
-
//
|
|
332
|
-
// server can verify + rebind it to the signup token. The grant never
|
|
330
|
+
// Cross-device try-first handover: forwards a row-bound tenant-handover
|
|
331
|
+
// grant so the server can verify + rebind it to the signup token. The grant never
|
|
333
332
|
// travels any further than this request — never in the URL, the mail,
|
|
334
333
|
// or the confirm response.
|
|
335
334
|
handover?: { readonly entityType: string; readonly token: string },
|
|
@@ -397,8 +396,8 @@ export async function confirmSignup(
|
|
|
397
396
|
return { ok: false, error: await parseTokenFailure(res) };
|
|
398
397
|
}
|
|
399
398
|
|
|
400
|
-
// GET /api/auth/tenants.
|
|
401
|
-
//
|
|
399
|
+
// GET /api/auth/tenants. Returns the current user's memberships; the server
|
|
400
|
+
// returns 401 when the cookie is missing or expired.
|
|
402
401
|
export async function fetchTenants(): Promise<{
|
|
403
402
|
readonly tenants: readonly TenantSummary[];
|
|
404
403
|
readonly activeTenantId: string;
|
|
@@ -422,9 +421,9 @@ export async function fetchTenants(): Promise<{
|
|
|
422
421
|
};
|
|
423
422
|
}
|
|
424
423
|
|
|
425
|
-
// POST /api/auth/switch-tenant.
|
|
426
|
-
//
|
|
427
|
-
//
|
|
424
|
+
// POST /api/auth/switch-tenant. Mints a new JWT for the target tenant and
|
|
425
|
+
// rotates both cookies. Returns 400 for already_in_tenant or
|
|
426
|
+
// tenant_switch_not_available, and 403 for not_a_member.
|
|
428
427
|
export async function switchTenant(tenantId: string): Promise<void> {
|
|
429
428
|
const res = await fetch("/api/auth/switch-tenant", {
|
|
430
429
|
method: "POST",
|
|
@@ -438,14 +437,15 @@ export async function switchTenant(tenantId: string): Promise<void> {
|
|
|
438
437
|
}
|
|
439
438
|
}
|
|
440
439
|
|
|
441
|
-
// POST /api/query → user:query:user:me.
|
|
442
|
-
//
|
|
443
|
-
//
|
|
440
|
+
// POST /api/query → user:query:user:me. Returns profile data (email,
|
|
441
|
+
// displayName) for the UserMenu in the top bar. A 401 for a missing or
|
|
442
|
+
// expired cookie is interpreted by SessionProvider as signed out.
|
|
444
443
|
//
|
|
445
|
-
// globalRoles
|
|
446
|
-
// users.roles.
|
|
447
|
-
//
|
|
448
|
-
//
|
|
444
|
+
// globalRoles are tenant-independent user roles (for example, SystemAdmin)
|
|
445
|
+
// from users.roles. They are merged into the JWT with tenant-membership
|
|
446
|
+
// roles, but the JWT is HttpOnly and unreadable by JavaScript, so the client
|
|
447
|
+
// must fetch the global roles separately from the user row for navigation
|
|
448
|
+
// filtering.
|
|
449
449
|
export type CurrentUserProfile = {
|
|
450
450
|
readonly id: string;
|
|
451
451
|
readonly email: string;
|
|
@@ -479,8 +479,8 @@ export async function fetchCurrentUser(): Promise<CurrentUserProfile | null> {
|
|
|
479
479
|
displayName: string;
|
|
480
480
|
locale?: string;
|
|
481
481
|
effectiveTimeZone?: string;
|
|
482
|
-
// JSON-encoded string[]
|
|
483
|
-
//
|
|
482
|
+
// JSON-encoded string[]; see userEntity.roles. Defaults to "[]" when
|
|
483
|
+
// there are no global roles.
|
|
484
484
|
roles?: string;
|
|
485
485
|
};
|
|
486
486
|
};
|
|
@@ -14,10 +14,10 @@ import { usePrimitives } from "@cosmicdrift/kumiko-renderer";
|
|
|
14
14
|
import { BareFormProvider, cn } from "@cosmicdrift/kumiko-renderer/web";
|
|
15
15
|
import { createContext, type ReactNode, useContext, useEffect, useState } from "react";
|
|
16
16
|
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
17
|
+
// Wraps the centered auth card in its surrounding layout. The default is
|
|
18
|
+
// fullscreen-centered for standalone auth pages. Apex/marketing chrome can
|
|
19
|
+
// provide its own variant through AuthShellProvider without `min-h-screen`
|
|
20
|
+
// covering that chrome.
|
|
21
21
|
export type AuthShellRenderer = (card: ReactNode) => ReactNode;
|
|
22
22
|
|
|
23
23
|
const defaultAuthShell: AuthShellRenderer = (card) => (
|
|
@@ -64,8 +64,9 @@ export function AuthCard({
|
|
|
64
64
|
}: AuthCardProps): ReactNode {
|
|
65
65
|
const { Card } = usePrimitives();
|
|
66
66
|
const shell = useAuthShell() ?? defaultAuthShell;
|
|
67
|
-
// h1 (
|
|
68
|
-
//
|
|
67
|
+
// Keep an h1 (page heading) through the header slot; the Card's default
|
|
68
|
+
// header would be h3. padded:false keeps the form edge-to-edge as before
|
|
69
|
+
// (bare form).
|
|
69
70
|
const card = (
|
|
70
71
|
<Card
|
|
71
72
|
className={cn("w-full max-w-sm", className)}
|
|
@@ -94,14 +95,13 @@ export function AuthCard({
|
|
|
94
95
|
return shell(card);
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
// Browser nicht da ist (SSR-safety) oder der Parameter fehlt.
|
|
98
|
+
// Reads `?<paramName>=<value>` from the current URL, as used by token-bearing
|
|
99
|
+
// pages (reset, verify). Returns "" during SSR or when the parameter is absent.
|
|
100
100
|
//
|
|
101
|
-
//
|
|
102
|
-
// pattern
|
|
103
|
-
//
|
|
104
|
-
//
|
|
101
|
+
// This is intentionally not read through useState/useEffect: that would be a
|
|
102
|
+
// read-once-on-mount pattern, while URL changes are irrelevant here because
|
|
103
|
+
// token pages reload for new tokens. Callers can use
|
|
104
|
+
// useState(() => parseUrlToken(...)) when needed.
|
|
105
105
|
export function parseUrlToken(paramName = "token"): string {
|
|
106
106
|
if (typeof window === "undefined") return "";
|
|
107
107
|
return new URLSearchParams(window.location.search).get(paramName) ?? "";
|
|
@@ -109,7 +109,7 @@ export function parseUrlToken(paramName = "token"): string {
|
|
|
109
109
|
|
|
110
110
|
// Reads the magic-link token from `?<paramName>=` once on mount, then strips
|
|
111
111
|
// that param from the URL via history.replaceState so the single-use token
|
|
112
|
-
// doesn't linger in browser history / Referer
|
|
112
|
+
// doesn't linger in browser history / Referer. An explicit `override`
|
|
113
113
|
// (server-injected token) short-circuits both the URL read and the scrub.
|
|
114
114
|
export function useUrlToken(override?: string, paramName = "token"): string {
|
|
115
115
|
const [token] = useState(() => override ?? parseUrlToken(paramName));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// Auth
|
|
2
|
-
// "unauthenticated"
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// Auth gate: renders the LoginScreen while the session status is
|
|
2
|
+
// "unauthenticated" and the children otherwise. "loading" shows a
|
|
3
|
+
// minimal placeholder—the initial refresh usually completes in <100ms,
|
|
4
|
+
// so a spinner would be excessive.
|
|
5
5
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
6
|
+
// The makeAuthGate factory closes over the LoginScreen component so the
|
|
7
|
+
// gate matches the ClientFeatureDefinition signature (only a `{ children }`
|
|
8
|
+
// prop). This lets the sample configure a custom login screen without
|
|
9
|
+
// replacing the gate.
|
|
10
10
|
|
|
11
11
|
import { useLocale } from "@cosmicdrift/kumiko-renderer";
|
|
12
12
|
import { type ComponentType, type ReactNode, useEffect, useMemo, useState } from "react";
|
|
@@ -57,12 +57,11 @@ export type LoginRouteOptions = {
|
|
|
57
57
|
// their own standalone login route outside any gate (createPublicSurface
|
|
58
58
|
// apex pages stack providers, not gates — see auth-mount.tsx recipes).
|
|
59
59
|
// Handing an app raw LoginScreen + telling it to hand-roll the challenge-
|
|
60
|
-
// token swap itself is exactly how
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
// optional package).
|
|
60
|
+
// token swap itself is exactly how the login-time MFA step went missing in a
|
|
61
|
+
// real apex surface; this prevents the *most common* version of that mistake.
|
|
62
|
+
// MFA still only actually works once a consumer wires `mfaVerifyScreen` —
|
|
63
|
+
// omitting it is a silent no-MFA fallback, not something this route can catch
|
|
64
|
+
// on its own (auth-mfa is a separate, optional package).
|
|
66
65
|
export function createLoginRoute(
|
|
67
66
|
opts: LoginRouteOptions = {},
|
|
68
67
|
): ComponentType<Record<string, never>> {
|
|
@@ -82,7 +81,7 @@ export function createLoginRoute(
|
|
|
82
81
|
readonly accountLabel: string;
|
|
83
82
|
} | null>(null);
|
|
84
83
|
|
|
85
|
-
// kumiko-lint-ignore no-raw-hooks
|
|
84
|
+
// kumiko-lint-ignore no-raw-hooks not yet converted to the framework hook set
|
|
86
85
|
useEffect(() => {
|
|
87
86
|
if (status === "authenticated") onAuthenticated?.();
|
|
88
87
|
}, [status]);
|
|
@@ -236,7 +235,7 @@ export function makeAuthGate(opts: AuthGateOptions = {}): ComponentType<{
|
|
|
236
235
|
[status, locale, origin, pathname, search, hash],
|
|
237
236
|
);
|
|
238
237
|
const redirectUrl = loginRedirect?.kind === "redirect" ? loginRedirect.url : null;
|
|
239
|
-
// kumiko-lint-ignore no-raw-hooks
|
|
238
|
+
// kumiko-lint-ignore no-raw-hooks not yet converted to the framework hook set
|
|
240
239
|
useEffect(() => {
|
|
241
240
|
if (redirectUrl !== null) window.location.replace(redirectUrl);
|
|
242
241
|
}, [redirectUrl]);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
// Client
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// Strings pro Locale, pro Key.
|
|
1
|
+
// Client feature factory for auth-email-password. App code mounts it in
|
|
2
|
+
// createKumikoApp({ clientFeatures: [emailPasswordClient()] }) to provide
|
|
3
|
+
// session context, AuthGate, and default UI translations (de/en). All of
|
|
4
|
+
// these can be overridden: the login screen and strings per locale and key.
|
|
6
5
|
|
|
7
6
|
import type { ClientActionHandler, TranslationsByLocale } from "@cosmicdrift/kumiko-renderer";
|
|
8
7
|
import type { ComponentType, ReactNode } from "react";
|
|
@@ -18,9 +17,9 @@ import { defaultTranslations, mergeTranslations } from "./i18n.ts";
|
|
|
18
17
|
import type { LoginScreenProps } from "./login-screen.tsx";
|
|
19
18
|
|
|
20
19
|
export type EmailPasswordClientOptions = {
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
/** Custom login screen. Default: the shadcn-styled LoginScreen
|
|
21
|
+
* from this module. Provide a component with the same signature for
|
|
22
|
+
* branding or layout overrides. */
|
|
24
23
|
readonly loginScreen?: ComponentType<LoginScreenProps>;
|
|
25
24
|
readonly loginScreenProps?: LoginScreenProps;
|
|
26
25
|
/** auth-mfa's MfaVerifyScreen, wired in from the app so this feature
|
|
@@ -41,10 +40,10 @@ export type EmailPasswordClientOptions = {
|
|
|
41
40
|
readonly loginUrl?: AuthGateOptions["loginUrl"];
|
|
42
41
|
/** Where logout navigates to (root-relative path or http(s) URL). Default: reload. */
|
|
43
42
|
readonly postLogoutUrl?: string;
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* (`fr`, `es`, …)
|
|
43
|
+
/** Per-locale key overrides. Merged with the default bundles (de/en)
|
|
44
|
+
* from `translations.ts`; each key supplied here takes precedence.
|
|
45
|
+
* Use this for branding ("Sign in" → "Login to Acme") or to add
|
|
46
|
+
* further languages (`fr`, `es`, …). */
|
|
48
47
|
readonly translations?: TranslationsByLocale;
|
|
49
48
|
/** Serve the forgot-password, reset-password and unlock-account pages at
|
|
50
49
|
* their convention paths for signed-out visitors. Apps with their own
|
package/packages/bundled-features/src/auth-email-password/web/confirm-account-unlock-screen.tsx
CHANGED
|
@@ -32,7 +32,7 @@ export function ConfirmAccountUnlockScreen({
|
|
|
32
32
|
const [status, setStatus] = useState<Status>(token === "" ? "missing-token" : "verifying");
|
|
33
33
|
const startedRef = useRef(false);
|
|
34
34
|
|
|
35
|
-
// kumiko-lint-ignore no-raw-hooks
|
|
35
|
+
// kumiko-lint-ignore no-raw-hooks not yet converted to the framework hook set
|
|
36
36
|
useEffect(() => {
|
|
37
37
|
if (status !== "verifying") return;
|
|
38
38
|
if (startedRef.current) return;
|
|
@@ -17,7 +17,7 @@ export const AuthHandlers = {
|
|
|
17
17
|
requestEmailVerification: "auth-email-password:write:request-email-verification",
|
|
18
18
|
verifyEmail: "auth-email-password:write:verify-email",
|
|
19
19
|
// Account-Unlock Magic-Link (fixes the lockout-DoS where the monotonic
|
|
20
|
-
// failure-counter re-locks immediately after expiry
|
|
20
|
+
// failure-counter re-locks immediately after expiry). Mirrors
|
|
21
21
|
// reset: request mints an HMAC token + mails it, confirm clears the
|
|
22
22
|
// Redis lockout state.
|
|
23
23
|
requestAccountUnlock: "auth-email-password:write:request-account-unlock",
|
|
@@ -85,7 +85,7 @@ export const AuthErrors = {
|
|
|
85
85
|
invalidSignupToken: "invalid_signup_token",
|
|
86
86
|
signupNotConfigured: "signup_not_configured",
|
|
87
87
|
// Self-signup: confirm rejects an already-registered email instead of
|
|
88
|
-
// reusing the existing user (account takeover
|
|
88
|
+
// reusing the existing user (account takeover). NO
|
|
89
89
|
// anti-enumeration collapse like invalidSignupToken: whoever gets here
|
|
90
90
|
// controls the inbox (has the magic link), so revealing "email exists"
|
|
91
91
|
// is not new information.
|
|
@@ -105,7 +105,7 @@ export const AuthErrors = {
|
|
|
105
105
|
// deliberate enumeration trade-off: the lockout event itself is already
|
|
106
106
|
// observable to the attacker, and legit users benefit from a clear signal.
|
|
107
107
|
accountLocked: "account_locked",
|
|
108
|
-
//
|
|
108
|
+
// (GDPR Art. 18) — account is in Restricted status. Login is
|
|
109
109
|
// explicitly refused with its own code (not collapsed into
|
|
110
110
|
// invalid_credentials) so the UI can say "account is currently paused,
|
|
111
111
|
// click here to lift it". Enumeration leak accepted: restriction is
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// TenantSwitcher (
|
|
4
|
-
// ThemeToggle → UserMenu (
|
|
5
|
-
//
|
|
6
|
-
//
|
|
1
|
+
// Composes the standard top-bar actions for apps with auth and workspaces.
|
|
2
|
+
// This bundles the pattern that each app sample would otherwise write by hand:
|
|
3
|
+
// TenantSwitcher (left) → optional extras (for example, LanguageSwitcher) →
|
|
4
|
+
// ThemeToggle → UserMenu (right). Apps with a custom arrangement can still
|
|
5
|
+
// import the individual components directly; DefaultTopbarActions is
|
|
6
|
+
// convenience, not a requirement.
|
|
7
7
|
|
|
8
8
|
import { ThemeToggle } from "@cosmicdrift/kumiko-renderer/web";
|
|
9
9
|
import type { ReactNode } from "react";
|
|
@@ -11,16 +11,16 @@ import { TenantSwitcher } from "./tenant-switcher.tsx";
|
|
|
11
11
|
import { UserMenu } from "./user-menu.tsx";
|
|
12
12
|
|
|
13
13
|
export type DefaultTopbarActionsProps = {
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
/** Maps a tenant ID to a human-readable name (for example, a branded label
|
|
15
|
+
* per tenant). TenantSwitcher's default otherwise displays the first 8
|
|
16
|
+
* characters of the UUID. */
|
|
17
17
|
readonly tenantName?: (tenantId: string) => string;
|
|
18
|
-
/** Slot
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
/** Slot between TenantSwitcher and ThemeToggle. Typical use case:
|
|
19
|
+
* an app-specific LanguageSwitcher. ReactNode, rather than an array, so the
|
|
20
|
+
* app controls the ordering and spacing. */
|
|
21
21
|
readonly extras?: ReactNode;
|
|
22
|
-
/** Light-
|
|
23
|
-
* Lucide
|
|
22
|
+
/** Light-mode icon for ThemeToggle. Default: Unicode ☀. Apps that want
|
|
23
|
+
* Lucide icons or similar can provide a custom icon element. */
|
|
24
24
|
readonly lightIcon?: ReactNode;
|
|
25
25
|
/** Dark-Mode-Icon. Default: Unicode ☾. */
|
|
26
26
|
readonly darkIcon?: ReactNode;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// ForgotPasswordScreen —
|
|
2
|
-
// /api/auth/request-password-reset (silent
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// ForgotPasswordScreen — form with an email input. Submission triggers
|
|
2
|
+
// /api/auth/request-password-reset (silent success, no account enumeration).
|
|
3
|
+
// The UI always shows a "If an account exists, the email is on its way"
|
|
4
|
+
// confirmation, even when the server determines internally that the email
|
|
5
|
+
// does not exist.
|
|
6
6
|
//
|
|
7
|
-
//
|
|
8
|
-
// /forgot-password)
|
|
9
|
-
// "
|
|
7
|
+
// The app is responsible for mounting and exposing the screen at a URL
|
|
8
|
+
// (for example, /forgot-password); the LoginScreen can link to that app
|
|
9
|
+
// route with a "Forgot password?" link.
|
|
10
10
|
|
|
11
11
|
import { usePrimitives, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
12
12
|
import { type FormEvent, type ReactNode, useState } from "react";
|
|
@@ -16,8 +16,8 @@ import { AuthCard } from "./auth-form-primitives.tsx";
|
|
|
16
16
|
export type ForgotPasswordScreenProps = {
|
|
17
17
|
readonly title?: string;
|
|
18
18
|
readonly subtitle?: ReactNode;
|
|
19
|
-
/** href
|
|
20
|
-
*
|
|
19
|
+
/** href for the "Back to login" link in the success and form states. App-
|
|
20
|
+
* specific — defaults to "/login". */
|
|
21
21
|
readonly loginHref?: string;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -33,7 +33,7 @@ export function ForgotPasswordScreen({
|
|
|
33
33
|
const [done, setDone] = useState(false);
|
|
34
34
|
const [error, setError] = useState<string | null>(null);
|
|
35
35
|
|
|
36
|
-
// guard:dup-ok —
|
|
36
|
+
// guard:dup-ok — same submission pattern as signup-screen, but with different API endpoints and state
|
|
37
37
|
const doSubmit = async (): Promise<void> => {
|
|
38
38
|
setSubmitting(true);
|
|
39
39
|
setError(null);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// Public exports
|
|
2
|
-
//
|
|
3
|
-
// password/web
|
|
4
|
-
// `@cosmicdrift/kumiko-bundled-features/auth-email-password`
|
|
5
|
-
// React-/DOM
|
|
1
|
+
// Public exports for the browser side of the auth-email-password feature.
|
|
2
|
+
// Consumed through the subpath export `@cosmicdrift/kumiko-bundled-features/auth-email-
|
|
3
|
+
// password/web`; the server side (defineFeature) lives in
|
|
4
|
+
// `@cosmicdrift/kumiko-bundled-features/auth-email-password` and has no
|
|
5
|
+
// React-/DOM dependencies. This keeps the separation clean, like renderer vs renderer/web.
|
|
6
6
|
|
|
7
7
|
export type {
|
|
8
8
|
AuthTokenFailure,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
// InviteAcceptScreen —
|
|
1
|
+
// InviteAcceptScreen — accepts tenant invitations through a magic link.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// - Logged
|
|
5
|
-
// invite-accept).
|
|
6
|
-
//
|
|
7
|
-
// - Anonymous:
|
|
8
|
-
//
|
|
9
|
-
//
|
|
3
|
+
// Reads `?token=...` from the URL and selects a flow based on session state:
|
|
4
|
+
// - Logged in with a matching email: one-click accept (Branch 1, via the
|
|
5
|
+
// invite-accept dispatcher). For an email mismatch, show an error and a
|
|
6
|
+
// "Sign in with a different account" link.
|
|
7
|
+
// - Anonymous: email and password form. The "Already have an account?" toggle
|
|
8
|
+
// selects Branch 2 (existing user, login + accept) or Branch 3 (new user,
|
|
9
|
+
// signup + accept).
|
|
10
10
|
//
|
|
11
|
-
// Anti-enumeration: invalidInviteToken
|
|
12
|
-
//
|
|
11
|
+
// Anti-enumeration: invalidInviteToken collapses token, user, and password
|
|
12
|
+
// failures into one code, using the same trade-off as reset.
|
|
13
13
|
//
|
|
14
|
-
// Auto-
|
|
15
|
-
//
|
|
16
|
-
//
|
|
14
|
+
// Auto-login: Branches 2 and 3 set cookies through the server, then the
|
|
15
|
+
// frontend redirects to loggedInHref. Branch 1 already has a session, but the
|
|
16
|
+
// frontend also redirects to loggedInHref so the invitee enters the new tenant.
|
|
17
17
|
|
|
18
18
|
import { usePrimitives, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
19
19
|
import { type FormEvent, type ReactNode, useContext, useState } from "react";
|
|
@@ -34,7 +34,7 @@ export type InviteAcceptScreenProps = {
|
|
|
34
34
|
readonly loggedInHref?:
|
|
35
35
|
| string
|
|
36
36
|
| ((args: { tenantId: string; roles: readonly string[] }) => string);
|
|
37
|
-
/** Login
|
|
37
|
+
/** Login href for "Mit anderem Account anmelden". Default "/login". */
|
|
38
38
|
readonly loginHref?: string;
|
|
39
39
|
};
|
|
40
40
|
|
|
@@ -112,7 +112,7 @@ export function InviteAcceptScreen({
|
|
|
112
112
|
const acceptLoggedIn = async (): Promise<void> => {
|
|
113
113
|
setSubmitting(true);
|
|
114
114
|
setError(null);
|
|
115
|
-
// kumiko-lint-ignore no-raw-hooks
|
|
115
|
+
// kumiko-lint-ignore no-raw-hooks not yet converted to the framework hook set
|
|
116
116
|
const res = await fetch("/api/auth/invite-accept", {
|
|
117
117
|
method: "POST",
|
|
118
118
|
credentials: "same-origin",
|
|
@@ -132,7 +132,7 @@ export function InviteAcceptScreen({
|
|
|
132
132
|
const acceptAnonExisting = async (): Promise<void> => {
|
|
133
133
|
setSubmitting(true);
|
|
134
134
|
setError(null);
|
|
135
|
-
// kumiko-lint-ignore no-raw-hooks
|
|
135
|
+
// kumiko-lint-ignore no-raw-hooks not yet converted to the framework hook set
|
|
136
136
|
const res = await fetch("/api/auth/invite-accept-with-login", {
|
|
137
137
|
method: "POST",
|
|
138
138
|
credentials: "same-origin",
|
|
@@ -152,7 +152,7 @@ export function InviteAcceptScreen({
|
|
|
152
152
|
const acceptAnonNew = async (): Promise<void> => {
|
|
153
153
|
setSubmitting(true);
|
|
154
154
|
setError(null);
|
|
155
|
-
// kumiko-lint-ignore no-raw-hooks
|
|
155
|
+
// kumiko-lint-ignore no-raw-hooks not yet converted to the framework hook set
|
|
156
156
|
const res = await fetch("/api/auth/invite-signup-complete", {
|
|
157
157
|
method: "POST",
|
|
158
158
|
credentials: "same-origin",
|
|
@@ -41,7 +41,7 @@ export type LoginScreenProps = {
|
|
|
41
41
|
* default path once the server offers the reset flow (login-options);
|
|
42
42
|
* `null` hides the link deliberately. */
|
|
43
43
|
readonly forgotPasswordHref?: string | null;
|
|
44
|
-
/** Optional href to RequestAccountUnlockScreen
|
|
44
|
+
/** Optional href to RequestAccountUnlockScreen. When set, an
|
|
45
45
|
* account_locked login error renders an "Unlock account?" link inline —
|
|
46
46
|
* the account-lockout escape hatch, since forgotPasswordHref does NOT
|
|
47
47
|
* help here: the lockout gate blocks login before password verify even
|
|
@@ -71,9 +71,8 @@ export type LoginScreenProps = {
|
|
|
71
71
|
readonly onMfaSetupRequired?: (preauthSetupToken: string, accountLabel: string) => void;
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
// fallen auf `auth.errors.loginFailed` zurück.
|
|
74
|
+
// Maps login-handler reason codes to i18n keys and optional interpolation parameters.
|
|
75
|
+
// Unknown codes fall back to `auth.errors.loginFailed`.
|
|
77
76
|
function reasonToKey(failure: LoginFailure): {
|
|
78
77
|
readonly key: string;
|
|
79
78
|
readonly params?: Readonly<Record<string, unknown>>;
|