@starci/hfs 5.0.8 → 5.2.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/CHANGELOG.md +30 -0
- package/README.md +10 -1
- package/cache/import-graph.mjs +6 -61
- package/cache/lint-family.d.mts +10 -1
- package/cache/lint-family.mjs +12 -5
- package/codemod/directive-first.d.mts +48 -0
- package/codemod/directive-first.mjs +136 -0
- package/codemod/explicit-surface-edit.d.mts +14 -0
- package/codemod/explicit-surface-edit.mjs +57 -0
- package/codemod/explicit-surface-names.d.mts +30 -0
- package/codemod/explicit-surface-names.mjs +135 -0
- package/codemod/explicit-surface-render.d.mts +29 -0
- package/codemod/explicit-surface-render.mjs +197 -0
- package/codemod/explicit-surface.d.mts +50 -0
- package/codemod/explicit-surface.mjs +374 -0
- package/codemod/main.d.mts +7 -5
- package/codemod/main.mjs +37 -16
- package/codemod/source-tree.d.mts +8 -0
- package/codemod/source-tree.mjs +23 -0
- package/db/postgres.mjs +9 -1
- package/lint/eslint-list.cjs +29 -0
- package/lint/run.d.mts +19 -5
- package/lint/run.mjs +47 -14
- package/package.json +1 -1
- package/runtime/knowledge/hfs/canon-pins.yaml +31 -10
- package/runtime/knowledge/hfs/fe-stack.yaml +7 -7
- package/runtime/knowledge/hfs/fork-images.yaml +7 -0
- package/runtime/knowledge/hfs/rules.yaml +107 -8
- package/runtime/knowledge/hfs/slots.yaml +75 -24
- package/runtime/modules/kernel/failure-codes.yaml +62 -0
- package/runtime/modules/schemas/application-stacks.schema.yaml +6 -0
- package/runtime/scripts/hfs/architecture/identity.mjs +18 -83
- package/runtime/scripts/hfs/architecture/test-world-files.d.mts +4 -3
- package/runtime/scripts/hfs/architecture/test-world-files.mjs +26 -7
- package/runtime/scripts/hfs/architecture/transport-owner.d.mts +1 -2
- package/runtime/scripts/hfs/architecture/transport-owner.mjs +3 -6
- package/runtime/scripts/hfs/explicit-surface-rule.d.mts +58 -0
- package/runtime/scripts/hfs/explicit-surface-rule.mjs +59 -0
- package/runtime/scripts/hfs/manifest-shape.d.mts +1 -0
- package/runtime/scripts/hfs/manifest-shape.mjs +3 -1
- package/runtime/scripts/hfs/rules/a15-findings.mjs +5 -0
- package/runtime/scripts/hfs/rules/stacks-local.d.mts +7 -0
- package/runtime/scripts/hfs/rules/stacks-local.mjs +71 -0
- package/runtime/scripts/hfs/rules/stacks-runtime.mjs +6 -1
- package/runtime/scripts/hfs/rules/stacks-service-images.d.mts +12 -0
- package/runtime/scripts/hfs/rules/stacks-service-images.mjs +120 -0
- package/runtime/scripts/hfs/secret-dev-init.d.mts +11 -0
- package/runtime/scripts/hfs/secret-dev-init.mjs +79 -0
- package/runtime/scripts/hfs/secret.mjs +10 -7
- package/runtime/scripts/hfs/slots.mjs +1 -1
- package/runtime/scripts/hfs/stack-local-config.d.mts +101 -0
- package/runtime/scripts/hfs/stack-local-config.mjs +320 -0
- package/runtime/scripts/hfs/stacks-gate.mjs +1 -1
- package/runtime/scripts/lib/declaration-surface.d.mts +35 -0
- package/runtime/scripts/lib/declaration-surface.mjs +112 -0
- package/runtime/scripts/lib/swarm-stack.d.mts +2 -1
- package/runtime/scripts/lib/swarm-stack.mjs +2 -2
- package/scaffold/add-module.d.mts +16 -0
- package/scaffold/add-module.mjs +232 -0
- package/scaffold/add-queue-lite.mjs +49 -0
- package/scaffold/add.mjs +5 -0
- package/scaffold/app.mjs +7 -7
- package/scaffold/module-registry.d.mts +19 -0
- package/scaffold/module-registry.mjs +84 -0
- package/src/main.mjs +23 -2
- package/stack/cli.mjs +6 -1
- package/stack/context.d.mts +15 -0
- package/stack/context.mjs +1 -0
- package/stack/local-cli.d.mts +25 -0
- package/stack/local-cli.mjs +89 -0
- package/stack/local-config.d.mts +17 -0
- package/stack/local-config.mjs +37 -0
- package/stack/local-custody.d.mts +24 -0
- package/stack/local-custody.mjs +109 -0
- package/stack/local-doctor.d.mts +6 -0
- package/stack/local-doctor.mjs +49 -0
- package/stack/local-down.d.mts +8 -0
- package/stack/local-down.mjs +20 -0
- package/stack/local-host.d.mts +42 -0
- package/stack/local-host.mjs +163 -0
- package/stack/local-logs.d.mts +8 -0
- package/stack/local-logs.mjs +32 -0
- package/stack/local-ports.d.mts +7 -0
- package/stack/local-ports.mjs +39 -0
- package/stack/local-prepare.d.mts +22 -0
- package/stack/local-prepare.mjs +62 -0
- package/stack/local-run.d.mts +71 -0
- package/stack/local-run.mjs +200 -0
- package/stack/local-state.d.mts +35 -0
- package/stack/local-state.mjs +29 -0
- package/stack/local-status.d.mts +6 -0
- package/stack/local-status.mjs +36 -0
- package/stack/local-up.d.mts +11 -0
- package/stack/local-up.mjs +166 -0
- package/stack/local-verify.d.mts +6 -0
- package/stack/local-verify.mjs +21 -0
- package/sync/index.d.mts +13 -12
- package/sync/index.mjs +83 -28
- package/templates/app/module/jest.config.js.tpl +8 -0
- package/templates/app/module/src/index.ts.tpl +2 -0
- package/templates/app/module/src/manifest/declaration.spec.ts.tpl +11 -0
- package/templates/app/module/src/manifest/declaration.ts.tpl +13 -0
- package/templates/app/module/src/manifest/index.ts.tpl +1 -0
- package/templates/app/module/src/public/index.ts.tpl +2 -0
- package/templates/app/module/src/template/__name__.template.spec.ts.tpl +13 -0
- package/templates/app/module/src/template/__name__.template.ts.tpl +41 -0
- package/templates/app/module/src/template/index.ts.tpl +1 -0
- package/templates/app/module/src/workbench/components/__pascal__WorkbenchView.tsx.tpl +16 -0
- package/templates/app/module/src/workbench/index.ts.tpl +2 -0
- package/templates/app/package-scripts/package.json +1 -1
- package/templates/app/package-scripts-lite/package.json +1 -1
- package/templates/app/skeleton-lite/.starcistacks/application-stacks.yaml +76 -70
- package/templates/app/skeleton-lite/.starcistacks/dev/README.md +23 -13
- package/templates/app/skeleton-lite/.starcistacks/dev/infra/compose/compose.yaml +25 -0
- package/templates/app/skeleton-lite/.starcistacks/dev/runtime/env/KEYS.md +18 -26
- package/templates/app/skeleton-lite/.starcistacks/production/infra/swarm/stack.yaml +1 -0
- package/templates/app/skeleton-lite/.starcistacks/production/runtime/env/KEYS.md +2 -1
- package/templates/app/skeleton-lite/db/migrations/__timestamp___baseline.sql +57 -14
- package/templates/be/auth-lite/src/features/api/auth/application/auth.contracts.ts +11 -0
- package/templates/be/auth-lite/src/features/api/auth/application/get-jwks.handler.ts +23 -0
- package/templates/be/auth-lite/src/features/api/auth/application/get-jwks.query.ts +12 -0
- package/templates/be/auth-lite/src/features/api/auth/application/google-begin.command.ts +11 -0
- package/templates/be/auth-lite/src/features/api/auth/application/google-begin.handler.ts +22 -0
- package/templates/be/auth-lite/src/features/api/auth/application/google-complete.command.ts +12 -0
- package/templates/be/auth-lite/src/features/api/auth/application/google-complete.handler.ts +23 -0
- package/templates/be/auth-lite/src/features/api/auth/application/login.command.ts +12 -0
- package/templates/be/auth-lite/src/features/api/auth/application/login.handler.ts +23 -0
- package/templates/be/auth-lite/src/features/api/auth/application/logout.command.ts +11 -0
- package/templates/be/auth-lite/src/features/api/auth/application/logout.handler.ts +22 -0
- package/templates/be/auth-lite/src/features/api/auth/application/refresh.command.ts +12 -0
- package/templates/be/auth-lite/src/features/api/auth/application/refresh.handler.ts +23 -0
- package/templates/be/auth-lite/src/features/api/auth/application/session.command.ts +12 -0
- package/templates/be/auth-lite/src/features/api/auth/application/session.handler.ts +23 -0
- package/templates/be/auth-lite/src/features/api/auth/auth.module-definition.ts +13 -0
- package/templates/be/auth-lite/src/features/api/auth/auth.module.ts +16 -0
- package/templates/be/auth-lite/src/features/api/auth/auth.options.ts +3 -0
- package/templates/be/auth-lite/src/features/api/auth/index.ts +2 -0
- package/templates/be/auth-lite/src/features/api/auth/transport/http/auth-http.module-definition.ts +13 -0
- package/templates/be/auth-lite/src/features/api/auth/transport/http/auth-http.module.ts +9 -0
- package/templates/be/auth-lite/src/features/api/auth/transport/http/auth-http.options.ts +3 -0
- package/templates/be/auth-lite/src/features/api/auth/transport/http/auth.controller.ts +90 -0
- package/templates/be/auth-lite/src/features/api/auth/transport/http/dto/google-start.request.ts +17 -0
- package/templates/be/auth-lite/src/features/api/auth/transport/http/dto/login.request.ts +16 -0
- package/templates/be/auth-lite/src/modules/domain/identity/account-directory.service.spec.ts +46 -0
- package/templates/be/auth-lite/src/modules/domain/identity/account-directory.service.ts +28 -0
- package/templates/be/auth-lite/src/modules/domain/identity/authenticator.service.spec.ts +145 -0
- package/templates/be/auth-lite/src/modules/domain/identity/authenticator.service.ts +95 -0
- package/templates/be/auth-lite/src/modules/domain/identity/persistence/entities/auth-identity.entity.ts +38 -0
- package/templates/be/auth-lite/src/modules/domain/identity/persistence/entities/auth-user.entity.ts +54 -0
- package/templates/be/auth-lite/src/modules/domain/identity/persistence/entities/identity-attempt.entity.ts +18 -0
- package/templates/be/auth-lite/src/modules/domain/identity/persistence/entities/identity-refresh-token.entity.ts +34 -0
- package/templates/be/auth-lite/src/modules/domain/identity/persistence/entities/identity-session.entity.ts +30 -0
- package/templates/be/auth-lite/src/modules/domain/identity/persistence/entities/index.ts +17 -0
- package/templates/be/auth-lite/src/modules/domain/identity/rate-counter.service.spec.ts +86 -0
- package/templates/be/auth-lite/src/modules/domain/identity/rate-counter.service.ts +45 -0
- package/templates/be/auth-lite/src/modules/domain/identity/session-store.service.spec.ts +97 -0
- package/templates/be/auth-lite/src/modules/domain/identity/session-store.service.ts +81 -0
- package/templates/be/auth-lite/src/modules/domain/identity/sign-in.service.spec.ts +78 -0
- package/templates/be/auth-lite/src/modules/domain/identity/sign-in.service.ts +87 -0
- package/templates/be/auth-lite/src/tests/fixtures/builders/identity.builder.ts +44 -0
- package/templates/be/inbox/delivery-recorded.event.ts.tpl +2 -2
- package/templates/be/inbox/entities.index.ts.tpl +1 -1
- package/templates/be/inbox/module-definition.ts.tpl +8 -2
- package/templates/be/inbox/platform/event-bus/event-bus.module-definition.ts.tpl +10 -2
- package/templates/be/inbox/platform/inbox/inbox.module-definition.ts.tpl +8 -2
- package/templates/be/patterns/api/feature.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/api/graphql.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/cli/group.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/event-bus/platform/event-bus.module-definition.ts.tpl +8 -3
- package/templates/be/patterns/event-bus/platform/persistence/connection.ts.tpl +3 -2
- package/templates/be/patterns/event-bus/platform/persistence/event-bus.sql.ts.tpl +4 -3
- package/templates/be/patterns/idempotency/platform/inbox/inbox.module-definition.ts.tpl +8 -3
- package/templates/be/patterns/idempotency/platform/inbox/persistence/connection.ts.tpl +3 -2
- package/templates/be/patterns/idempotency/platform/inbox/persistence/inbox.sql.ts.tpl +7 -6
- package/templates/be/patterns/jobs/job.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/jobs/job.processor.ts.tpl +1 -1
- package/templates/be/patterns/jobs/job.queue.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/jobs/platform/jobs.module-definition.ts.tpl +8 -3
- package/templates/be/patterns/jobs/platform/persistence.connection.ts.tpl +3 -2
- package/templates/be/patterns/jobs/platform/persistence.jobs.sql.ts.tpl +5 -4
- package/templates/be/patterns/projections/persistence.connection.ts.tpl +3 -2
- package/templates/be/patterns/projections/projection.module-definition.ts.tpl +8 -3
- package/templates/be/patterns/queues/platform/persistence.connection.ts.tpl +3 -2
- package/templates/be/patterns/queues/platform/persistence.queue.sql.ts.tpl +4 -3
- package/templates/be/patterns/queues/platform/queue.module-definition.ts.tpl +8 -3
- package/templates/be/patterns/queues/queue.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/reactors/consumer.ts.tpl +1 -1
- package/templates/be/patterns/reactors/message.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/reactors/reactor.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/realtime/channel.graphql.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/realtime/channel.sse.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/realtime/channel.websocket.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/saga/saga.done.consumer.ts.tpl +1 -1
- package/templates/be/patterns/saga/saga.failed.consumer.ts.tpl +1 -1
- package/templates/be/patterns/saga/saga.message.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/saga/saga.module-definition.ts.tpl +9 -3
- package/templates/be/patterns/webhooks/webhook.http.module-definition.ts.tpl +9 -3
- package/templates/be/platform/graphql/graphql.module-definition.ts +8 -3
- package/templates/be/skeleton/src/features/api/system-health/system-health.module-definition.ts +9 -3
- package/templates/be/skeleton/src/features/api/system-health/transport/http/system-health-http.module-definition.ts +9 -3
- package/templates/be/skeleton/src/features/cli/cli.module-definition.ts +9 -3
- package/templates/be/skeleton/src/features/cli/migrate/migrate.module-definition.ts +9 -3
- package/templates/be/skeleton/src/features/cli/seed/seed.module-definition.ts +9 -3
- package/templates/be/skeleton/src/modules/domain/identity/identity.module-definition.ts +8 -3
- package/templates/be/skeleton/src/modules/domain/liveness/liveness.module-definition.ts +8 -3
- package/templates/be/skeleton/src/modules/domain/note/note.module-definition.ts +8 -3
- package/templates/be/skeleton/src/modules/domain/note/persistence/connection.ts +3 -2
- package/templates/be/skeleton/src/modules/domain/note/persistence/note.sql.ts +2 -1
- package/templates/be/skeleton/src/modules/platform/clock/clock.module-definition.ts +8 -3
- package/templates/be/skeleton/src/modules/platform/cqrs/cqrs.module-definition.ts +8 -3
- package/templates/be/skeleton/src/modules/platform/database/database.module-definition.ts +8 -3
- package/templates/be/skeleton/src/modules/platform/database/index.ts +1 -0
- package/templates/be/skeleton/src/modules/platform/errors/errors.module-definition.ts +10 -4
- package/templates/be/skeleton/src/modules/platform/http/http.module-definition.ts +8 -4
- package/templates/be/skeleton/src/modules/platform/http-security/http-security.module-definition.ts +10 -4
- package/templates/be/skeleton/src/modules/platform/http-security/persistence/connection.ts +3 -2
- package/templates/be/skeleton/src/modules/platform/http-security/persistence/rate-limit.sql.ts +3 -2
- package/templates/be/skeleton/src/modules/platform/i18n/i18n.module-definition.ts +10 -4
- package/templates/be/skeleton/src/modules/platform/ids/ids.module-definition.ts +8 -3
- package/templates/be/skeleton/src/modules/platform/logging/logging.module-definition.ts +8 -3
- package/templates/be/skeleton/src/modules/platform/retry/retry.module-definition.ts +8 -3
- package/templates/be/skeleton-lite/apps/api/src/app.module.ts +6 -5
- package/templates/be/skeleton-lite/apps/api/src/compose/api.ts +3 -2
- package/templates/be/skeleton-lite/apps/api/src/compose/integrations.ts +10 -5
- package/templates/be/skeleton-lite/src/modules/domain/identity/errors/identity.error.ts +34 -0
- package/templates/be/skeleton-lite/src/modules/domain/identity/identity.decorators.ts +23 -2
- package/templates/be/skeleton-lite/src/modules/domain/identity/identity.module.ts +47 -2
- package/templates/be/skeleton-lite/src/modules/domain/identity/index.ts +2 -0
- package/templates/be/skeleton-lite/src/modules/domain/identity/messages/identity.messages.ts +24 -0
- package/templates/be/skeleton-lite/src/modules/integrations/object-storage/index.ts +3 -3
- package/templates/be/skeleton-lite/src/modules/integrations/object-storage/object-storage.config.ts +3 -1
- package/templates/be/skeleton-lite/src/modules/integrations/object-storage/object-storage.decorators.ts +8 -4
- package/templates/be/skeleton-lite/src/modules/integrations/object-storage/object-storage.module-definition.ts +12 -0
- package/templates/be/skeleton-lite/src/modules/integrations/object-storage/object-storage.module.ts +29 -0
- package/templates/be/skeleton-lite/src/modules/integrations/object-storage/object-storage.options.ts +6 -31
- package/templates/be/skeleton-lite/src/modules/integrations/passport/errors/passport.error.ts +18 -9
- package/templates/be/skeleton-lite/src/modules/integrations/passport/index.ts +35 -11
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.config.spec.ts +44 -8
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.config.ts +40 -18
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.decorators.ts +18 -6
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.kit.spec.ts +73 -0
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.kit.ts +26 -0
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.options.ts +24 -53
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.registration.ts +31 -0
- package/templates/be/skeleton-lite/src/modules/platform/cqrs/index.ts +1 -1
- package/templates/be/skeleton-lite/src/modules/platform/database/database.port.ts +1 -1
- package/templates/be/skeleton-lite/src/modules/platform/database/entities.ts +2 -1
- package/templates/be/skeleton-lite/src/modules/platform/http-security/index.ts +1 -1
- package/templates/be/skeleton-lite/src/modules/platform/http-security/persistence/entities/index.ts +1 -1
- package/templates/be/skeleton-lite/src/tests/fixtures/builders/api.builder.ts +18 -5
- package/templates/be/skeleton-lite/src/tests/fixtures/builders/cli.builder.ts +7 -1
- package/templates/be/table/api/feature.module-definition.ts.tpl +9 -3
- package/templates/be/table/api/graphql.module-definition.ts.tpl +9 -3
- package/templates/be/table/entities.index.ts.tpl +1 -1
- package/templates/be/table/module-definition.ts.tpl +8 -3
- package/templates/be/test-world/e2e/serves-once-migrated.e2e-spec.ts.tpl +9 -9
- package/templates/be/test-world/fixtures/migrations.sql.ts.tpl +4 -3
- package/templates/be/test-world/world/test-world.config.ts.tpl +8 -1
- package/templates/fe/auth-lite/apps/web/src/modules/auth/client.ts +26 -0
- package/templates/fe/common/app-layout.tsx.partial +1 -1
- package/templates/fe/common/site-shell.tsx.partial +3 -3
- package/templates/fe/skeleton/apps/__app__/src/components/providers/AppProviders/index.tsx +33 -10
- package/templates/fe/skeleton/apps/__app__/src/hooks/auth/index.ts +1 -0
- package/templates/fe/skeleton/apps/__app__/src/hooks/auth/useSession.ts +2 -1
- package/templates/fe/skeleton/apps/__app__/src/hooks/auth/useSignIn.ts +11 -3
- package/templates/fe/skeleton/apps/__app__/src/hooks/auth/useSignOut.ts +8 -2
- package/templates/fe/skeleton/apps/__app__/src/hooks/auth/useViewerId.ts +11 -0
- package/templates/fe/skeleton/apps/__app__/src/hooks/zustand/appGuide/store.ts +2 -1
- package/templates/fe/skeleton/apps/__app__/src/modules/toast/hooks.ts +1 -1
- package/templates/fe/skeleton/apps/__app__/src/modules/toast/toast.tsx +18 -12
- package/templates/fe/skeleton/apps/__app__/src/modules/viewer-cache/index.ts +5 -0
- package/templates/fe/skeleton/apps/__app__/src/redux/hooks.ts +3 -2
- package/templates/fe/skeleton/apps/__app__/src/redux/index.ts +1 -0
- package/templates/fe/skeleton/apps/__app__/src/redux/slices/session.ts +12 -4
- package/templates/fe/skeleton/apps/__app__/src/redux/store.ts +8 -3
- package/templates/fe/skeleton/apps/app/src/app/[locale]/layout.tsx +4 -3
- package/templates/fe/skeleton/apps/app/src/features/layouts/AppLayout/index.tsx +1 -1
- package/templates/fe/skeleton/apps/app/src/features/pages/AppHomePage/index.tsx +2 -1
- package/templates/fe/skeleton/apps/app/src/features/pages/AppLoadingPage/index.tsx +2 -1
- package/templates/fe/skeleton/apps/app/src/features/pages/AppNotFoundPage/index.tsx +2 -1
- package/templates/fe/skeleton/apps/app/src/modules/i18n/index.ts +2 -1
- package/templates/fe/skeleton/apps/app/src/modules/i18n/request.ts +4 -1
- package/templates/fe/skeleton/apps/landing/src/app/[locale]/layout.tsx +4 -3
- package/templates/fe/skeleton/apps/landing/src/features/layouts/LandingLayout/index.tsx +2 -2
- package/templates/fe/skeleton/apps/landing/src/features/pages/LandingLoadingPage/index.tsx +2 -1
- package/templates/fe/skeleton/apps/landing/src/features/pages/LandingNotFoundPage/index.tsx +2 -1
- package/templates/fe/skeleton/apps/landing/src/features/pages/LandingPage/index.tsx +2 -1
- package/templates/fe/skeleton/apps/landing/src/modules/i18n/index.ts +2 -1
- package/templates/fe/skeleton/apps/landing/src/modules/i18n/request.ts +4 -1
- package/templates/fe/skeleton/packages/__project__-i18n/src/index.ts +20 -2
- package/templates/fe/skeleton/packages/__project__-i18n/src/proxy.ts +1 -1
- package/templates/fe/skeleton/packages/__project__-i18n/src/routing.ts +5 -1
- package/templates/fe/skeleton/packages/__project__-ui/src/composites/NotFoundNotice/index.tsx +4 -7
- package/templates/fe/skeleton/packages/__project__-ui/src/frames/SiteShell/index.tsx +2 -3
- package/templates/fe/skeleton-lite/apps/web/src/app/[locale]/layout.tsx +4 -3
- package/templates/fe/skeleton-lite/apps/web/src/components/composites/NotFoundNotice/index.tsx +4 -7
- package/templates/fe/skeleton-lite/apps/web/src/components/frames/SiteShell/index.tsx +1 -2
- package/templates/fe/skeleton-lite/apps/web/src/features/layouts/AppLayout/index.tsx +2 -2
- package/templates/fe/skeleton-lite/apps/web/src/features/pages/AppHomePage/index.tsx +2 -1
- package/templates/fe/skeleton-lite/apps/web/src/features/pages/AppLoadingPage/index.tsx +2 -1
- package/templates/fe/skeleton-lite/apps/web/src/features/pages/AppNotFoundPage/index.tsx +2 -1
- package/templates/fe/skeleton-lite/apps/web/src/modules/i18n/request.ts +3 -1
- package/templates/fe/skeleton-lite/apps/web/src/modules/i18n/routing.ts +5 -1
- package/templates/fe/table/graphql/useMutateSwr.ts.tpl +2 -1
- package/templates/fe/table/graphql/useQuerySwr.ts.tpl +2 -1
- package/templates/fe/transport/graphql/clients/clients/auth.ts +1 -1
- package/templates/fe/transport/graphql/clients/clients/no-auth.ts +1 -1
- package/templates/fe/transport/graphql/clients/links/attach-access-token.ts +1 -1
- package/templates/fe/transport/graphql/clients/links/error.ts +1 -1
- package/templates/fe/transport/graphql/clients/links/http.ts +1 -1
- package/templates/fe/transport/graphql/clients/links/locale.ts +1 -1
- package/templates/fe/transport/graphql/clients/links/refresh-token.ts +1 -1
- package/templates/fe/transport/graphql/clients/links/retry.ts +1 -1
- package/templates/fe/transport/graphql/clients/links/timeout.ts +1 -1
- package/templates/fe/units/page/index.tsx.tpl +3 -2
- package/templates/fe/units/slot/SlotView.tsx.tpl +1 -1
- package/templates/app/skeleton-lite/.starcistacks/dev/infra/swarm/Caddyfile +0 -16
- package/templates/app/skeleton-lite/.starcistacks/dev/infra/swarm/owner-actions.md +0 -11
- package/templates/app/skeleton-lite/.starcistacks/dev/infra/swarm/recovery/restore-proof.md +0 -7
- package/templates/app/skeleton-lite/.starcistacks/dev/infra/swarm/releases/current.yaml +0 -6
- package/templates/app/skeleton-lite/.starcistacks/dev/infra/swarm/releases/images.lock.yaml +0 -8
- package/templates/app/skeleton-lite/.starcistacks/dev/infra/swarm/releases/previous.yaml +0 -6
- package/templates/app/skeleton-lite/.starcistacks/dev/infra/swarm/stack.yaml +0 -186
- package/templates/be/skeleton-lite/src/modules/integrations/object-storage/object-storage.client.spec.ts +0 -22
- package/templates/be/skeleton-lite/src/modules/integrations/object-storage/object-storage.client.ts +0 -25
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.cookie.spec.ts +0 -104
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.cookie.ts +0 -34
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.password.spec.ts +0 -28
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.password.ts +0 -11
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.tokens.spec.ts +0 -88
- package/templates/be/skeleton-lite/src/modules/integrations/passport/passport.tokens.ts +0 -69
- package/templates/be/skeleton-lite/src/modules/integrations/passport/strategies/google.strategy.ts +0 -37
- package/templates/be/skeleton-lite/src/modules/integrations/passport/strategies/local.strategy.ts +0 -36
- package/templates/be/skeleton-lite/src/modules/integrations/passport/strategies/oauth-state.store.ts +0 -63
- package/templates/fe/skeleton/packages/__project__-ui/src/frames/SiteShell/classNames.ts +0 -4
- package/templates/fe/skeleton-lite/apps/__app__/src/modules/auth/auth-door.ts +0 -30
- package/templates/fe/skeleton-lite/apps/__app__/src/modules/auth/client.ts +0 -50
- package/templates/fe/skeleton-lite/apps/__app__/src/modules/auth/token-store.ts +0 -31
- package/templates/fe/skeleton-lite/apps/web/src/components/frames/SiteShell/classNames.ts +0 -4
|
@@ -8,7 +8,7 @@ import { Complete@@Saga@@Command } from "../../application/complete-@@saga@@.com
|
|
|
8
8
|
@Injectable()
|
|
9
9
|
/** Consumer of `@@from@@.@@done@@`, the last event of the @@saga@@ saga: hands each delivery to the complete command. */
|
|
10
10
|
export class @@Done@@Consumer implements EventConsumer<@@Done@@Event> {
|
|
11
|
-
readonly event = @@Done@@Event
|
|
11
|
+
readonly event: typeof @@Done@@Event = @@Done@@Event
|
|
12
12
|
|
|
13
13
|
constructor(@InjectCommandBus() private readonly commandBus: CommandBus) {}
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@ import { Compensate@@Saga@@Command } from "../../application/compensate-@@saga@@
|
|
|
8
8
|
@Injectable()
|
|
9
9
|
/** Consumer of `@@from@@.@@failed@@`, the failure event of the @@saga@@ saga: hands each delivery to the compensate command. */
|
|
10
10
|
export class @@Failed@@Consumer implements EventConsumer<@@Failed@@Event> {
|
|
11
|
-
readonly event = @@Failed@@Event
|
|
11
|
+
readonly event: typeof @@Failed@@Event = @@Failed@@Event
|
|
12
12
|
|
|
13
13
|
constructor(@InjectCommandBus() private readonly commandBus: CommandBus) {}
|
|
14
14
|
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { @@Saga@@MessageOptions } from "./@@saga@@-message.options"
|
|
3
3
|
|
|
4
|
+
const built = new ConfigurableModuleBuilder<@@Saga@@MessageOptions>().setClassMethodName("register").build()
|
|
5
|
+
type Host = ConfigurableModuleHost<@@Saga@@MessageOptions, "register", "create", {}>
|
|
6
|
+
|
|
4
7
|
/** The configurable-module base of the @@saga@@-message module. */
|
|
5
|
-
export const
|
|
6
|
-
|
|
8
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
9
|
+
/** The injection token of the registered options. */
|
|
10
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { @@Saga@@Options } from "./@@saga@@.options"
|
|
3
3
|
|
|
4
|
+
const built = new ConfigurableModuleBuilder<@@Saga@@Options>().setClassMethodName("register").build()
|
|
5
|
+
type Host = ConfigurableModuleHost<@@Saga@@Options, "register", "create", {}>
|
|
6
|
+
|
|
4
7
|
/** The configurable-module base of the @@saga@@ module. */
|
|
5
|
-
export const
|
|
6
|
-
|
|
8
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
9
|
+
/** The injection token of the registered options. */
|
|
10
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { @@Provider@@HttpOptions } from "./@@provider@@-http.options"
|
|
3
3
|
|
|
4
|
+
const built = new ConfigurableModuleBuilder<@@Provider@@HttpOptions>().setClassMethodName("register").build()
|
|
5
|
+
type Host = ConfigurableModuleHost<@@Provider@@HttpOptions, "register", "create", {}>
|
|
6
|
+
|
|
4
7
|
/** The configurable-module base of the @@provider@@-http module. */
|
|
5
|
-
export const
|
|
6
|
-
|
|
8
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
9
|
+
/** The injection token of the registered options. */
|
|
10
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { GraphqlOptions } from "./graphql.options"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<GraphqlOptions>()
|
|
4
|
+
const built = new ConfigurableModuleBuilder<GraphqlOptions>()
|
|
6
5
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
7
6
|
.build()
|
|
7
|
+
type Host = ConfigurableModuleHost<GraphqlOptions, "register", "create", { isGlobal: boolean }>
|
|
8
|
+
|
|
9
|
+
/** The configurable-module base of the graphql capability; `isGlobal` is decided by the app root. */
|
|
10
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
package/templates/be/skeleton/src/features/api/system-health/system-health.module-definition.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { SystemHealthOptions } from "./system-health.options"
|
|
3
3
|
|
|
4
|
+
const built = new ConfigurableModuleBuilder<SystemHealthOptions>().setClassMethodName("register").build()
|
|
5
|
+
type Host = ConfigurableModuleHost<SystemHealthOptions, "register", "create", {}>
|
|
6
|
+
|
|
4
7
|
/** The configurable-module base of the system-health module. */
|
|
5
|
-
export const
|
|
6
|
-
|
|
8
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
9
|
+
/** The injection token of the registered options. */
|
|
10
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { SystemHealthHttpOptions } from "./system-health-http.options"
|
|
3
3
|
|
|
4
|
+
const built = new ConfigurableModuleBuilder<SystemHealthHttpOptions>().setClassMethodName("register").build()
|
|
5
|
+
type Host = ConfigurableModuleHost<SystemHealthHttpOptions, "register", "create", {}>
|
|
6
|
+
|
|
4
7
|
/** The configurable-module base of the system-health-http module. */
|
|
5
|
-
export const
|
|
6
|
-
|
|
8
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
9
|
+
/** The injection token of the registered options. */
|
|
10
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { CliOptions } from "./cli.options"
|
|
3
3
|
|
|
4
|
+
const built = new ConfigurableModuleBuilder<CliOptions>().setClassMethodName("register").build()
|
|
5
|
+
type Host = ConfigurableModuleHost<CliOptions, "register", "create", {}>
|
|
6
|
+
|
|
4
7
|
/** The configurable-module base of the cli module. */
|
|
5
|
-
export const
|
|
6
|
-
|
|
8
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
9
|
+
/** The injection token of the registered options. */
|
|
10
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { MigrateOptions } from "./migrate.options"
|
|
3
3
|
|
|
4
|
+
const built = new ConfigurableModuleBuilder<MigrateOptions>().setClassMethodName("register").build()
|
|
5
|
+
type Host = ConfigurableModuleHost<MigrateOptions, "register", "create", {}>
|
|
6
|
+
|
|
4
7
|
/** The configurable-module base of the migrate module. */
|
|
5
|
-
export const
|
|
6
|
-
|
|
8
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
9
|
+
/** The injection token of the registered options. */
|
|
10
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { SeedOptions } from "./seed.options"
|
|
3
3
|
|
|
4
|
+
const built = new ConfigurableModuleBuilder<SeedOptions>().setClassMethodName("register").build()
|
|
5
|
+
type Host = ConfigurableModuleHost<SeedOptions, "register", "create", {}>
|
|
6
|
+
|
|
4
7
|
/** The configurable-module base of the seed module. */
|
|
5
|
-
export const
|
|
6
|
-
|
|
8
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
9
|
+
/** The injection token of the registered options. */
|
|
10
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { IdentityOptions } from "./identity.options"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<IdentityOptions>()
|
|
4
|
+
const built = new ConfigurableModuleBuilder<IdentityOptions>()
|
|
6
5
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
7
6
|
.build()
|
|
7
|
+
type Host = ConfigurableModuleHost<IdentityOptions, "register", "create", { isGlobal: boolean }>
|
|
8
|
+
|
|
9
|
+
/** The configurable-module base of the identity capability; `isGlobal` is decided by the app root. */
|
|
10
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { LivenessOptions } from "./liveness.options"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<LivenessOptions>()
|
|
4
|
+
const built = new ConfigurableModuleBuilder<LivenessOptions>()
|
|
6
5
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
7
6
|
.build()
|
|
7
|
+
type Host = ConfigurableModuleHost<LivenessOptions, "register", "create", { isGlobal: boolean }>
|
|
8
|
+
|
|
9
|
+
/** The configurable-module base of the liveness capability; `isGlobal` is decided by the app root. */
|
|
10
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { NoteOptions } from "./note.options"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<NoteOptions>()
|
|
4
|
+
const built = new ConfigurableModuleBuilder<NoteOptions>()
|
|
6
5
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
7
6
|
.build()
|
|
7
|
+
type Host = ConfigurableModuleHost<NoteOptions, "register", "create", { isGlobal: boolean }>
|
|
8
|
+
|
|
9
|
+
/** The configurable-module base of the note capability; `isGlobal` is decided by the app root. */
|
|
10
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { DatabaseConnectionOptions } from "@modules/platform/database"
|
|
1
2
|
import { NoteEntity } from "./entities/note.entity"
|
|
2
3
|
import { InitNote1790000000000 } from "./migrations/1790000000000-init-note"
|
|
3
4
|
|
|
4
5
|
/** The entities of the note capability, for the connection that holds them. */
|
|
5
|
-
export const noteEntities = [NoteEntity]
|
|
6
|
+
export const noteEntities: DatabaseConnectionOptions["entities"] = [NoteEntity]
|
|
6
7
|
|
|
7
8
|
/** The migrations of the note capability, in the order they run. */
|
|
8
|
-
export const noteMigrations = [InitNote1790000000000]
|
|
9
|
+
export const noteMigrations: DatabaseConnectionOptions["migrations"] = [InitNote1790000000000]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { sql } from "@modules/platform/database"
|
|
2
|
+
import type { SqlText } from "@modules/platform/database"
|
|
2
3
|
|
|
3
4
|
/** Writes one note ($1 body, $2 written at) and answers the stored row. */
|
|
4
|
-
export const INSERT_NOTE = sql`INSERT INTO notes (body, created_at) VALUES ($1, $2) RETURNING id, body, created_at`
|
|
5
|
+
export const INSERT_NOTE: SqlText = sql`INSERT INTO notes (body, created_at) VALUES ($1, $2) RETURNING id, body, created_at`
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { ClockOptions } from "./clock.options"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<ClockOptions>()
|
|
4
|
+
const built = new ConfigurableModuleBuilder<ClockOptions>()
|
|
6
5
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
7
6
|
.build()
|
|
7
|
+
type Host = ConfigurableModuleHost<ClockOptions, "register", "create", { isGlobal: boolean }>
|
|
8
|
+
|
|
9
|
+
/** The configurable-module base of the clock capability; `isGlobal` is decided by the app root. */
|
|
10
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { CqrsOptions } from "./cqrs.options"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<CqrsOptions>()
|
|
4
|
+
const built = new ConfigurableModuleBuilder<CqrsOptions>()
|
|
6
5
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
7
6
|
.build()
|
|
7
|
+
type Host = ConfigurableModuleHost<CqrsOptions, "register", "create", { isGlobal: boolean }>
|
|
8
|
+
|
|
9
|
+
/** The configurable-module base of the cqrs capability; `isGlobal` is decided by the app root. */
|
|
10
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import { DATABASE_OPTIONS } from "./database.port"
|
|
3
3
|
import type { DatabaseOptions } from "./database.options"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<DatabaseOptions>({
|
|
5
|
+
const built = new ConfigurableModuleBuilder<DatabaseOptions>({
|
|
7
6
|
optionsInjectionToken: DATABASE_OPTIONS,
|
|
8
7
|
})
|
|
9
8
|
.setExtras({ isGlobal: false }, (definition, extras) => ({
|
|
@@ -11,3 +10,9 @@ export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleB
|
|
|
11
10
|
global: extras.isGlobal,
|
|
12
11
|
}))
|
|
13
12
|
.build()
|
|
13
|
+
type Host = ConfigurableModuleHost<DatabaseOptions, "register", "create", { isGlobal: boolean }>
|
|
14
|
+
|
|
15
|
+
/** The configurable-module base of the database capability; `isGlobal` is decided by the app root. */
|
|
16
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
17
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
18
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -6,6 +6,7 @@ export { DEFAULT_SEED_ENV } from "./seed-connections.client"
|
|
|
6
6
|
export { SeedRunnerService } from "./seed-runner.service"
|
|
7
7
|
export type { DatabaseConnectionConfig, DatabaseConnectionOptions } from "./database.options"
|
|
8
8
|
export { LIST_ROWS_MAX, sql } from "./database.sql"
|
|
9
|
+
export type { SqlText } from "./database.sql"
|
|
9
10
|
export { DATABASE_ERROR_KINDS } from "./errors/database.error"
|
|
10
11
|
export { returnedRows, rowShape } from "./returned-rows.policy"
|
|
11
12
|
export { parsePrimaryDatabaseConfig } from "./primary.config"
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import { ERRORS_OPTIONS } from "./errors.decorators"
|
|
3
3
|
import type { ErrorsOptions } from "./errors.options"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
export const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE } =
|
|
7
|
-
new ConfigurableModuleBuilder<ErrorsOptions>({ optionsInjectionToken: ERRORS_OPTIONS })
|
|
5
|
+
const built = new ConfigurableModuleBuilder<ErrorsOptions>({ optionsInjectionToken: ERRORS_OPTIONS })
|
|
8
6
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
9
7
|
.build()
|
|
8
|
+
type Host = ConfigurableModuleHost<ErrorsOptions, "register", "create", { isGlobal: boolean }>
|
|
9
|
+
|
|
10
|
+
/** The configurable-module base of the errors capability; `isGlobal` is decided by the app root. */
|
|
11
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
12
|
+
/** The injection token of the registered options. */
|
|
13
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
14
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
15
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import { HTTP_OPTIONS } from "./http.decorators"
|
|
3
3
|
import type { HttpOptions } from "./http.options"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } =
|
|
7
|
-
new ConfigurableModuleBuilder<HttpOptions>({ optionsInjectionToken: HTTP_OPTIONS })
|
|
5
|
+
const built = new ConfigurableModuleBuilder<HttpOptions>({ optionsInjectionToken: HTTP_OPTIONS })
|
|
8
6
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
9
7
|
.build()
|
|
8
|
+
type Host = ConfigurableModuleHost<HttpOptions, "register", "create", { isGlobal: boolean }>
|
|
9
|
+
|
|
10
|
+
/** The configurable-module base of the http capability; `isGlobal` is decided by the app root. */
|
|
11
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
12
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
13
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
package/templates/be/skeleton/src/modules/platform/http-security/http-security.module-definition.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import { HTTP_SECURITY_OPTIONS } from "./http-security.decorators"
|
|
3
3
|
import type { HttpSecurityOptions } from "./http-security.options"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
export const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE } =
|
|
7
|
-
new ConfigurableModuleBuilder<HttpSecurityOptions>({ optionsInjectionToken: HTTP_SECURITY_OPTIONS })
|
|
5
|
+
const built = new ConfigurableModuleBuilder<HttpSecurityOptions>({ optionsInjectionToken: HTTP_SECURITY_OPTIONS })
|
|
8
6
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
9
7
|
.build()
|
|
8
|
+
type Host = ConfigurableModuleHost<HttpSecurityOptions, "register", "create", { isGlobal: boolean }>
|
|
9
|
+
|
|
10
|
+
/** The configurable-module base of the http-security capability; `isGlobal` is decided by the app root. */
|
|
11
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
12
|
+
/** The injection token of the registered options. */
|
|
13
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
14
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
15
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { DatabaseConnectionOptions } from "@modules/platform/database"
|
|
1
2
|
import { RateWindowEntity } from "./entities/rate-window.entity"
|
|
2
3
|
import { CreateRateWindows1789900000000 } from "./migrations/1789900000000-create-rate-windows"
|
|
3
4
|
|
|
4
5
|
/** The entities of the http-security capability, for the primary connection its rate limit counts in. */
|
|
5
|
-
export const httpSecurityEntities = [RateWindowEntity]
|
|
6
|
+
export const httpSecurityEntities: DatabaseConnectionOptions["entities"] = [RateWindowEntity]
|
|
6
7
|
|
|
7
8
|
/** The migrations of the http-security capability, in the order they run. */
|
|
8
|
-
export const httpSecurityMigrations = [CreateRateWindows1789900000000]
|
|
9
|
+
export const httpSecurityMigrations: DatabaseConnectionOptions["migrations"] = [CreateRateWindows1789900000000]
|
package/templates/be/skeleton/src/modules/platform/http-security/persistence/rate-limit.sql.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { sql } from "@modules/platform/database"
|
|
2
|
+
import type { SqlText } from "@modules/platform/database"
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Counts one hit in the caller's window and answers the hits of that window: a missing or expired window opens afresh at one
|
|
5
6
|
* hit and ends at $3 ($1 tier and address key, $2 instant, $3 end of a fresh window).
|
|
6
7
|
*/
|
|
7
|
-
export const HIT_RATE_WINDOW = sql`INSERT INTO http_security_rate_windows (key, hits, reset_at)
|
|
8
|
+
export const HIT_RATE_WINDOW: SqlText = sql`INSERT INTO http_security_rate_windows (key, hits, reset_at)
|
|
8
9
|
VALUES ($1::varchar, 1, $3::timestamptz)
|
|
9
10
|
ON CONFLICT (key) DO UPDATE SET
|
|
10
11
|
hits = CASE WHEN http_security_rate_windows.reset_at <= $2::timestamptz THEN 1
|
|
@@ -14,7 +15,7 @@ export const HIT_RATE_WINDOW = sql`INSERT INTO http_security_rate_windows (key,
|
|
|
14
15
|
RETURNING hits`
|
|
15
16
|
|
|
16
17
|
/** Deletes a bounded batch of the windows that ended by $1; a second replica skips the rows this one holds. */
|
|
17
|
-
export const PRUNE_RATE_WINDOWS = sql`DELETE FROM http_security_rate_windows WHERE key IN (
|
|
18
|
+
export const PRUNE_RATE_WINDOWS: SqlText = sql`DELETE FROM http_security_rate_windows WHERE key IN (
|
|
18
19
|
SELECT key FROM http_security_rate_windows WHERE reset_at <= $1::timestamptz
|
|
19
20
|
LIMIT 100 FOR UPDATE SKIP LOCKED
|
|
20
21
|
)`
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import { I18N_OPTIONS } from "./i18n.decorators"
|
|
3
3
|
import type { I18nOptions } from "./i18n.options"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
export const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE } =
|
|
7
|
-
new ConfigurableModuleBuilder<I18nOptions>({ optionsInjectionToken: I18N_OPTIONS })
|
|
5
|
+
const built = new ConfigurableModuleBuilder<I18nOptions>({ optionsInjectionToken: I18N_OPTIONS })
|
|
8
6
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
9
7
|
.build()
|
|
8
|
+
type Host = ConfigurableModuleHost<I18nOptions, "register", "create", { isGlobal: boolean }>
|
|
9
|
+
|
|
10
|
+
/** The configurable-module base of the i18n capability; `isGlobal` is decided by the app root. */
|
|
11
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
12
|
+
/** The injection token of the registered options. */
|
|
13
|
+
export const MODULE_OPTIONS_TOKEN: Host["MODULE_OPTIONS_TOKEN"] = built.MODULE_OPTIONS_TOKEN
|
|
14
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
15
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { IdsOptions } from "./ids.options"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<IdsOptions>()
|
|
4
|
+
const built = new ConfigurableModuleBuilder<IdsOptions>()
|
|
6
5
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
7
6
|
.build()
|
|
7
|
+
type Host = ConfigurableModuleHost<IdsOptions, "register", "create", { isGlobal: boolean }>
|
|
8
|
+
|
|
9
|
+
/** The configurable-module base of the ids capability; `isGlobal` is decided by the app root. */
|
|
10
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { LoggingOptions } from "./logging.options"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<LoggingOptions>()
|
|
4
|
+
const built = new ConfigurableModuleBuilder<LoggingOptions>()
|
|
6
5
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
7
6
|
.build()
|
|
7
|
+
type Host = ConfigurableModuleHost<LoggingOptions, "register", "create", { isGlobal: boolean }>
|
|
8
|
+
|
|
9
|
+
/** The configurable-module base of the logging capability; `isGlobal` is decided by the app root. */
|
|
10
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ConfigurableModuleBuilder } from "@nestjs/common"
|
|
1
|
+
import { ConfigurableModuleBuilder, type ConfigurableModuleHost } from "@nestjs/common"
|
|
2
2
|
import type { RetryOptions } from "./retry.options"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
export const { ConfigurableModuleClass, OPTIONS_TYPE } = new ConfigurableModuleBuilder<RetryOptions>()
|
|
4
|
+
const built = new ConfigurableModuleBuilder<RetryOptions>()
|
|
6
5
|
.setExtras({ isGlobal: false }, (definition, extras) => ({ ...definition, global: extras.isGlobal }))
|
|
7
6
|
.build()
|
|
7
|
+
type Host = ConfigurableModuleHost<RetryOptions, "register", "create", { isGlobal: boolean }>
|
|
8
|
+
|
|
9
|
+
/** The configurable-module base of the retry capability; the app root decides its global scope. */
|
|
10
|
+
export const ConfigurableModuleClass: Host["ConfigurableModuleClass"] = built.ConfigurableModuleClass
|
|
11
|
+
/** The options of a synchronous registration, for the register signature. */
|
|
12
|
+
export const OPTIONS_TYPE: Host["OPTIONS_TYPE"] = built.OPTIONS_TYPE
|
|
@@ -2,7 +2,7 @@ import { Module } from "@nestjs/common"
|
|
|
2
2
|
import type { DynamicModule } from "@nestjs/common"
|
|
3
3
|
import { APP_FILTER, APP_GUARD } from "@nestjs/core"
|
|
4
4
|
import { AuthGuard, CredentialGuard } from "@modules/domain/identity"
|
|
5
|
-
import {
|
|
5
|
+
import { passportKit } from "@modules/integrations/passport"
|
|
6
6
|
import { ErrorsFilter } from "@modules/platform/errors"
|
|
7
7
|
import { OriginGuard, RateLimitGuard } from "@modules/platform/http-security"
|
|
8
8
|
import { platformModules } from "./compose/platform"
|
|
@@ -10,7 +10,7 @@ import { domainModules } from "./compose/domain"
|
|
|
10
10
|
import { systemModules } from "./compose/system"
|
|
11
11
|
import { apiModules } from "./compose/api"
|
|
12
12
|
import { webhooksModules } from "./compose/webhooks"
|
|
13
|
-
import { integrationProviders } from "./compose/integrations"
|
|
13
|
+
import { integrationModules, integrationProviders } from "./compose/integrations"
|
|
14
14
|
import type { ApiOptions } from "./api.options"
|
|
15
15
|
|
|
16
16
|
@Module({})
|
|
@@ -18,18 +18,19 @@ import type { ApiOptions } from "./api.options"
|
|
|
18
18
|
export class AppModule {
|
|
19
19
|
/** Builds the module from options parsed once at boot; nothing here reads the environment. */
|
|
20
20
|
static register(options: ApiOptions): DynamicModule {
|
|
21
|
-
const
|
|
21
|
+
const passport = passportKit(options.passport)
|
|
22
22
|
return {
|
|
23
23
|
module: AppModule,
|
|
24
24
|
imports: [
|
|
25
25
|
...platformModules(options),
|
|
26
|
-
...
|
|
26
|
+
...integrationModules(options),
|
|
27
|
+
...domainModules(passport.verify),
|
|
27
28
|
...systemModules(),
|
|
28
29
|
...apiModules(),
|
|
29
30
|
...webhooksModules(),
|
|
30
31
|
],
|
|
31
32
|
providers: [
|
|
32
|
-
...integrationProviders(options,
|
|
33
|
+
...integrationProviders(options, passport.verify),
|
|
33
34
|
{ provide: APP_FILTER, useClass: ErrorsFilter },
|
|
34
35
|
{ provide: APP_GUARD, useClass: RateLimitGuard },
|
|
35
36
|
{ provide: APP_GUARD, useClass: OriginGuard },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DynamicModule, Type } from "@nestjs/common"
|
|
2
|
+
import { AuthHttpModule } from "@features/api/auth"
|
|
2
3
|
|
|
3
|
-
/** The API transports of the app; `starci app add api` registers each generated door here. */
|
|
4
|
-
export const apiModules = (): Array<Type<unknown> | DynamicModule> => []
|
|
4
|
+
/** The API transports of the app: the sign-in doors; `starci app add api` registers each generated door here. */
|
|
5
|
+
export const apiModules = (): Array<Type<unknown> | DynamicModule> => [AuthHttpModule.register({})]
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import type { Provider } from "@nestjs/common"
|
|
2
|
-
import { OWN_TOKEN_VERIFIER, PASSPORT_OPTIONS } from "@modules/integrations/passport"
|
|
1
|
+
import type { DynamicModule, Provider } from "@nestjs/common"
|
|
2
|
+
import { OWN_TOKEN_VERIFIER, PASSPORT_OPTIONS, passportModule } from "@modules/integrations/passport"
|
|
3
3
|
import type { VerifyAccessToken } from "@modules/integrations/passport"
|
|
4
|
-
import {
|
|
4
|
+
import { ObjectStorageModule } from "@modules/integrations/object-storage"
|
|
5
5
|
import type { ApiOptions } from "../api.options"
|
|
6
6
|
|
|
7
|
-
/** The
|
|
7
|
+
/** The sign-in and object storage packages of the app, each registered once with the app's typed settings. */
|
|
8
|
+
export const integrationModules = (options: ApiOptions): Array<DynamicModule> => [
|
|
9
|
+
passportModule(options.passport, { isGlobal: true }),
|
|
10
|
+
ObjectStorageModule.register({ ...options.objectStorage, isGlobal: true }),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
/** The passport integration ports bound once for this app. */
|
|
8
14
|
export const integrationProviders = (options: ApiOptions, verifyAccessToken: VerifyAccessToken): Array<Provider> => [
|
|
9
15
|
{ provide: PASSPORT_OPTIONS, useValue: options.passport },
|
|
10
16
|
{ provide: OWN_TOKEN_VERIFIER, useValue: verifyAccessToken },
|
|
11
|
-
{ provide: OBJECT_STORAGE, useValue: createObjectStorage(options.objectStorage) },
|
|
12
17
|
]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DomainError } from "@modules/platform/errors"
|
|
2
|
+
import type { ErrorKind } from "@modules/platform/errors"
|
|
3
|
+
|
|
4
|
+
/** Codes of the identity capability: the sign-in refusals travel under these wire codes, the same on both sides of the doors. */
|
|
5
|
+
export enum IdentityErrorCode {
|
|
6
|
+
/** The door needs a signed-in caller and the request establishes none. */
|
|
7
|
+
Unauthenticated = "IDENTITY_UNAUTHENTICATED",
|
|
8
|
+
/** The refresh token is unknown, expired or already spent. */
|
|
9
|
+
RefreshInvalid = "IDENTITY_REFRESH_INVALID",
|
|
10
|
+
/** A rotated refresh token was presented again: the session was ended. */
|
|
11
|
+
RefreshReused = "IDENTITY_REFRESH_REUSED",
|
|
12
|
+
/** The account is deleted or banned. */
|
|
13
|
+
AccountDisabled = "IDENTITY_ACCOUNT_DISABLED",
|
|
14
|
+
/** Too many failed attempts for this address; try again later. */
|
|
15
|
+
TooManyAttempts = "IDENTITY_TOO_MANY_ATTEMPTS",
|
|
16
|
+
/** The pair of address and password is wrong (the same answer for an unknown address). */
|
|
17
|
+
PairRefused = "IDENTITY_INVALID_CREDENTIALS",
|
|
18
|
+
/** The mailbox was never confirmed. */
|
|
19
|
+
EmailNotConfirmed = "IDENTITY_EMAIL_NOT_CONFIRMED",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** How each identity code travels. */
|
|
23
|
+
export const IDENTITY_ERROR_KINDS: Record<IdentityErrorCode, ErrorKind> = {
|
|
24
|
+
[IdentityErrorCode.Unauthenticated]: "unauthenticated",
|
|
25
|
+
[IdentityErrorCode.RefreshInvalid]: "unauthenticated",
|
|
26
|
+
[IdentityErrorCode.RefreshReused]: "unauthenticated",
|
|
27
|
+
[IdentityErrorCode.AccountDisabled]: "forbidden",
|
|
28
|
+
[IdentityErrorCode.TooManyAttempts]: "rate-limited",
|
|
29
|
+
[IdentityErrorCode.PairRefused]: "unauthenticated",
|
|
30
|
+
[IdentityErrorCode.EmailNotConfirmed]: "forbidden",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The one error class of the identity capability. */
|
|
34
|
+
export class IdentityError extends DomainError<IdentityErrorCode> {}
|