ddd-ts-kit 0.14.0 → 0.15.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/README.md +28 -1
- package/dist/check/explain/tenancy-docs.d.ts.map +1 -1
- package/dist/check/explain/tenancy-docs.js +3 -1
- package/dist/check/explain/tenancy-docs.js.map +1 -1
- package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tenancy-fixtures.js +28 -0
- package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
- package/dist/check/tenancy/knex-unscoped.d.ts +6 -1
- package/dist/check/tenancy/knex-unscoped.d.ts.map +1 -1
- package/dist/check/tenancy/knex-unscoped.js +19 -6
- package/dist/check/tenancy/knex-unscoped.js.map +1 -1
- package/dist/check/tenancy/raw-reaches-rows.d.ts +8 -0
- package/dist/check/tenancy/raw-reaches-rows.d.ts.map +1 -0
- package/dist/check/tenancy/raw-reaches-rows.js +91 -0
- package/dist/check/tenancy/raw-reaches-rows.js.map +1 -0
- package/dist/check/tenancy/raw-sql-text.d.ts +9 -0
- package/dist/check/tenancy/raw-sql-text.d.ts.map +1 -0
- package/dist/check/tenancy/raw-sql-text.js +29 -0
- package/dist/check/tenancy/raw-sql-text.js.map +1 -0
- package/dist/commands/generate.js +2 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +11 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/declared/injection/laid-out-calls.d.ts +7 -0
- package/dist/declared/injection/laid-out-calls.d.ts.map +1 -0
- package/dist/declared/injection/laid-out-calls.js +14 -0
- package/dist/declared/injection/laid-out-calls.js.map +1 -0
- package/dist/declared/render-barrel.d.ts.map +1 -1
- package/dist/declared/render-barrel.js +2 -1
- package/dist/declared/render-barrel.js.map +1 -1
- package/dist/declared/render-dependencies-file.d.ts.map +1 -1
- package/dist/declared/render-dependencies-file.js +2 -1
- package/dist/declared/render-dependencies-file.js.map +1 -1
- package/dist/generate/kind.d.ts +2 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/context-kind.d.ts.map +1 -1
- package/dist/generate/kinds/context-kind.js +13 -6
- package/dist/generate/kinds/context-kind.js.map +1 -1
- package/dist/generate/kinds/next-adr-number.d.ts +4 -0
- package/dist/generate/kinds/next-adr-number.d.ts.map +1 -0
- package/dist/generate/kinds/next-adr-number.js +7 -0
- package/dist/generate/kinds/next-adr-number.js.map +1 -0
- package/dist/generate/kinds/write-adr.js +3 -6
- package/dist/generate/kinds/write-adr.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/run-init.d.ts +2 -0
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +15 -1
- package/dist/init/run-init.js.map +1 -1
- package/dist/presets/apply-preset.d.ts +15 -0
- package/dist/presets/apply-preset.d.ts.map +1 -0
- package/dist/presets/apply-preset.js +94 -0
- package/dist/presets/apply-preset.js.map +1 -0
- package/dist/presets/grant-to-signed-in.d.ts +9 -0
- package/dist/presets/grant-to-signed-in.d.ts.map +1 -0
- package/dist/presets/grant-to-signed-in.js +61 -0
- package/dist/presets/grant-to-signed-in.js.map +1 -0
- package/dist/presets/identity-preset.d.ts +9 -0
- package/dist/presets/identity-preset.d.ts.map +1 -0
- package/dist/presets/identity-preset.js +44 -0
- package/dist/presets/identity-preset.js.map +1 -0
- package/dist/presets/identity-refusal.d.ts +5 -0
- package/dist/presets/identity-refusal.d.ts.map +1 -0
- package/dist/presets/identity-refusal.js +29 -0
- package/dist/presets/identity-refusal.js.map +1 -0
- package/dist/presets/identity-terms.d.ts +4 -0
- package/dist/presets/identity-terms.d.ts.map +1 -0
- package/dist/presets/identity-terms.js +57 -0
- package/dist/presets/identity-terms.js.map +1 -0
- package/dist/presets/no-flags.d.ts +4 -0
- package/dist/presets/no-flags.d.ts.map +1 -0
- package/dist/presets/no-flags.js +18 -0
- package/dist/presets/no-flags.js.map +1 -0
- package/dist/presets/organisations-as-tenants.d.ts +9 -0
- package/dist/presets/organisations-as-tenants.d.ts.map +1 -0
- package/dist/presets/organisations-as-tenants.js +43 -0
- package/dist/presets/organisations-as-tenants.js.map +1 -0
- package/dist/presets/preset-decision.d.ts +8 -0
- package/dist/presets/preset-decision.d.ts.map +1 -0
- package/dist/presets/preset-decision.js +19 -0
- package/dist/presets/preset-decision.js.map +1 -0
- package/dist/presets/preset-file.d.ts +13 -0
- package/dist/presets/preset-file.d.ts.map +1 -0
- package/dist/presets/preset-file.js +2 -0
- package/dist/presets/preset-file.js.map +1 -0
- package/dist/presets/preset-files.d.ts +9 -0
- package/dist/presets/preset-files.d.ts.map +1 -0
- package/dist/presets/preset-files.js +34 -0
- package/dist/presets/preset-files.js.map +1 -0
- package/dist/presets/preset-named.d.ts +3 -0
- package/dist/presets/preset-named.d.ts.map +1 -0
- package/dist/presets/preset-named.js +12 -0
- package/dist/presets/preset-named.js.map +1 -0
- package/dist/presets/preset-refusal.d.ts +6 -0
- package/dist/presets/preset-refusal.d.ts.map +1 -0
- package/dist/presets/preset-refusal.js +2 -0
- package/dist/presets/preset-refusal.js.map +1 -0
- package/dist/presets/preset-step.d.ts +8 -0
- package/dist/presets/preset-step.d.ts.map +1 -0
- package/dist/presets/preset-step.js +2 -0
- package/dist/presets/preset-step.js.map +1 -0
- package/dist/presets/preset.d.ts +36 -0
- package/dist/presets/preset.d.ts.map +1 -0
- package/dist/presets/preset.js +2 -0
- package/dist/presets/preset.js.map +1 -0
- package/dist/presets/with-authorizer-import.d.ts +6 -0
- package/dist/presets/with-authorizer-import.d.ts.map +1 -0
- package/dist/presets/with-authorizer-import.js +27 -0
- package/dist/presets/with-authorizer-import.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workspace/workspace.d.ts +2 -0
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/dist/workspace/workspace.js +4 -0
- package/dist/workspace/workspace.js.map +1 -1
- package/package.json +2 -2
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/application/authorization/__context__.permissions.ts.tpl +23 -0
- package/templates/presets/identity/context/application/authorization/change-member-roles.policy.ts.tpl +17 -0
- package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl +17 -0
- package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl +17 -0
- package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl +17 -0
- package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl +17 -0
- package/templates/presets/identity/context/application/authorization/revoke-delegations.policy.ts.tpl +17 -0
- package/templates/presets/identity/context/application/authorization/revoke-invitations.policy.ts.tpl +17 -0
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.command.ts.tpl +14 -0
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +56 -0
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.command.ts.tpl +17 -0
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +82 -0
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.command.ts.tpl +7 -0
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +69 -0
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.command.ts.tpl +14 -0
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +36 -0
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.command.ts.tpl +21 -0
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +43 -0
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.command.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.handler.ts.tpl +53 -0
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.command.ts.tpl +14 -0
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +50 -0
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.command.ts.tpl +14 -0
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +41 -0
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.command.ts.tpl +15 -0
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +79 -0
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.command.ts.tpl +15 -0
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +39 -0
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.command.ts.tpl +15 -0
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +42 -0
- package/templates/presets/identity/context/application/integration/handlers/account-deactivated.integration-handler.ts.tpl +19 -0
- package/templates/presets/identity/context/application/integration/handlers/member-joined.integration-handler.ts.tpl +33 -0
- package/templates/presets/identity/context/application/integration/handlers/member-removed.integration-handler.ts.tpl +30 -0
- package/templates/presets/identity/context/application/integration/handlers/organisation-opened.integration-handler.ts.tpl +19 -0
- package/templates/presets/identity/context/application/integration/publishers/account-deactivated.publisher.ts.tpl +24 -0
- package/templates/presets/identity/context/application/integration/publishers/delegation-granted.publisher.ts.tpl +36 -0
- package/templates/presets/identity/context/application/integration/publishers/delegation-revoked.publisher.ts.tpl +33 -0
- package/templates/presets/identity/context/application/integration/publishers/member-joined.publisher.ts.tpl +33 -0
- package/templates/presets/identity/context/application/integration/publishers/member-removed.publisher.ts.tpl +33 -0
- package/templates/presets/identity/context/application/integration/publishers/member-role-changed.publisher.ts.tpl +35 -0
- package/templates/presets/identity/context/application/integration/publishers/organisation-opened.publisher.ts.tpl +32 -0
- package/templates/presets/identity/context/application/ports/identity-provider-admin.port.ts.tpl +17 -0
- package/templates/presets/identity/context/application/ports/identity-provider-connection.port.ts.tpl +14 -0
- package/templates/presets/identity/context/application/ports/invitation-tokens.port.ts.tpl +7 -0
- package/templates/presets/identity/context/application/ports/search-members-reader.port.ts.tpl +10 -0
- package/templates/presets/identity/context/application/queries/search-members/search-members.handler.ts.tpl +33 -0
- package/templates/presets/identity/context/application/queries/search-members/search-members.query.ts.tpl +19 -0
- package/templates/presets/identity/context/application/queries/search-members/search-members.result.ts.tpl +17 -0
- package/templates/presets/identity/context/domain/aggregates/account.aggregate.ts.tpl +92 -0
- package/templates/presets/identity/context/domain/aggregates/delegation.aggregate.ts.tpl +117 -0
- package/templates/presets/identity/context/domain/aggregates/invitation.aggregate.ts.tpl +128 -0
- package/templates/presets/identity/context/domain/aggregates/member.aggregate.ts.tpl +149 -0
- package/templates/presets/identity/context/domain/aggregates/organisation.aggregate.ts.tpl +52 -0
- package/templates/presets/identity/context/domain/errors/account.error.ts.tpl +40 -0
- package/templates/presets/identity/context/domain/errors/delegation.error.ts.tpl +45 -0
- package/templates/presets/identity/context/domain/errors/invitation.error.ts.tpl +30 -0
- package/templates/presets/identity/context/domain/errors/member.error.ts.tpl +50 -0
- package/templates/presets/identity/context/domain/errors/organisation.error.ts.tpl +32 -0
- package/templates/presets/identity/context/domain/events/account-deactivated.event.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/events/account-provisioned.event.ts.tpl +17 -0
- package/templates/presets/identity/context/domain/events/delegation-granted.event.ts.tpl +22 -0
- package/templates/presets/identity/context/domain/events/delegation-revoked.event.ts.tpl +18 -0
- package/templates/presets/identity/context/domain/events/invitation-accepted.event.ts.tpl +17 -0
- package/templates/presets/identity/context/domain/events/invitation-declined.event.ts.tpl +16 -0
- package/templates/presets/identity/context/domain/events/invitation-issued.event.ts.tpl +22 -0
- package/templates/presets/identity/context/domain/events/invitation-revoked.event.ts.tpl +16 -0
- package/templates/presets/identity/context/domain/events/member-joined.event.ts.tpl +19 -0
- package/templates/presets/identity/context/domain/events/member-removed.event.ts.tpl +19 -0
- package/templates/presets/identity/context/domain/events/member-role-changed.event.ts.tpl +22 -0
- package/templates/presets/identity/context/domain/events/organisation-opened.event.ts.tpl +17 -0
- package/templates/presets/identity/context/domain/repositories/account.repository.ts.tpl +5 -0
- package/templates/presets/identity/context/domain/repositories/delegation.repository.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/repositories/invitation.repository.ts.tpl +7 -0
- package/templates/presets/identity/context/domain/repositories/member.repository.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/repositories/organisation.repository.ts.tpl +5 -0
- package/templates/presets/identity/context/domain/services/role-rights.service.ts.tpl +59 -0
- package/templates/presets/identity/context/domain/value-objects/delegation-period.vo.ts.tpl +42 -0
- package/templates/presets/identity/context/domain/value-objects/display-name.vo.ts.tpl +29 -0
- package/templates/presets/identity/context/domain/value-objects/email-address.vo.ts.tpl +31 -0
- package/templates/presets/identity/context/domain/value-objects/organisation-name.vo.ts.tpl +29 -0
- package/templates/presets/identity/context/domain/value-objects/organisation-rights.vo.ts.tpl +43 -0
- package/templates/presets/identity/context/domain/value-objects/organisation-slug.vo.ts.tpl +30 -0
- package/templates/presets/identity/context/domain/vocabularies/account-status.vocabulary.ts.tpl +7 -0
- package/templates/presets/identity/context/domain/vocabularies/invitation-status.vocabulary.ts.tpl +9 -0
- package/templates/presets/identity/context/domain/vocabularies/member-right.vocabulary.ts.tpl +9 -0
- package/templates/presets/identity/context/domain/vocabularies/member-role.vocabulary.ts.tpl +8 -0
- package/templates/presets/identity/context/infrastructure/external/crypto-invitation-tokens.adapter.ts.tpl +20 -0
- package/templates/presets/identity/context/infrastructure/external/environment-identity-provider-connection.adapter.ts.tpl +37 -0
- package/templates/presets/identity/context/infrastructure/external/keycloak-identity-provider-admin.adapter.ts.tpl +149 -0
- package/templates/presets/identity/context/infrastructure/persistence/__context__.schema.drizzle.ts.tpl +102 -0
- package/templates/presets/identity/context/infrastructure/persistence/account-row.schema.knex.ts.tpl +15 -0
- package/templates/presets/identity/context/infrastructure/persistence/account.mapper.drizzle.ts.tpl +38 -0
- package/templates/presets/identity/context/infrastructure/persistence/account.mapper.knex.ts.tpl +33 -0
- package/templates/presets/identity/context/infrastructure/persistence/create-__context__-tables.schema.knex.ts.tpl +107 -0
- package/templates/presets/identity/context/infrastructure/persistence/delegation-row.schema.knex.ts.tpl +17 -0
- package/templates/presets/identity/context/infrastructure/persistence/delegation.mapper.drizzle.ts.tpl +50 -0
- package/templates/presets/identity/context/infrastructure/persistence/delegation.mapper.knex.ts.tpl +45 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-account.repository.drizzle.ts.tpl +59 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-delegation.repository.drizzle.ts.tpl +77 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-invitation.repository.drizzle.ts.tpl +65 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-member.repository.drizzle.ts.tpl +84 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation.repository.drizzle.ts.tpl +59 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-search-members-reader.repository.drizzle.ts.tpl +53 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation-row.schema.knex.ts.tpl +20 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.drizzle.ts.tpl +45 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.knex.ts.tpl +40 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-account.repository.knex.ts.tpl +61 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-delegation.repository.knex.ts.tpl +80 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-invitation.repository.knex.ts.tpl +67 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-member.repository.knex.ts.tpl +82 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-organisation.repository.knex.ts.tpl +61 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-search-members-reader.repository.knex.ts.tpl +77 -0
- package/templates/presets/identity/context/infrastructure/persistence/member-row.schema.knex.ts.tpl +15 -0
- package/templates/presets/identity/context/infrastructure/persistence/member.mapper.drizzle.ts.tpl +36 -0
- package/templates/presets/identity/context/infrastructure/persistence/member.mapper.knex.ts.tpl +31 -0
- package/templates/presets/identity/context/infrastructure/persistence/organisation-row.schema.knex.ts.tpl +12 -0
- package/templates/presets/identity/context/infrastructure/persistence/organisation.mapper.drizzle.ts.tpl +28 -0
- package/templates/presets/identity/context/infrastructure/persistence/organisation.mapper.knex.ts.tpl +26 -0
- package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.controller.ts.tpl +71 -0
- package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.body.class-validator.ts.tpl +9 -0
- package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.controller.ts.tpl +85 -0
- package/templates/presets/identity/context/presentation/http/accounts.routes.ts.tpl +5 -0
- package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.body.class-validator.per-route.ts.tpl +8 -0
- package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.controller.ts.tpl +100 -0
- package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.body.class-validator.per-route.ts.tpl +8 -0
- package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.controller.ts.tpl +98 -0
- package/templates/presets/identity/context/presentation/http/invitations.routes.ts.tpl +5 -0
- package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.body.class-validator.ts.tpl +7 -0
- package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.controller.ts.tpl +83 -0
- package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.params.class-validator.ts.tpl +11 -0
- package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.body.class-validator.ts.tpl +18 -0
- package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.controller.ts.tpl +103 -0
- package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.params.class-validator.ts.tpl +7 -0
- package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.accepted.class-validator.ts.tpl +10 -0
- package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.body.class-validator.ts.tpl +10 -0
- package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.controller.ts.tpl +65 -0
- package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.params.class-validator.ts.tpl +7 -0
- package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.body.class-validator.ts.tpl +12 -0
- package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.controller.ts.tpl +79 -0
- package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.controller.ts.tpl +73 -0
- package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.params.class-validator.ts.tpl +11 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.controller.ts.tpl +73 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.params.class-validator.ts.tpl +11 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.accepted.class-validator.per-route.ts.tpl +6 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.controller.ts.tpl +73 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.params.class-validator.ts.tpl +11 -0
- package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.controller.ts.tpl +86 -0
- package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.line.class-validator.ts.tpl +22 -0
- package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.params.class-validator.ts.tpl +7 -0
- package/templates/presets/identity/context/presentation/http/organisations.routes.ts.tpl +5 -0
- package/templates/presets/identity/context/presentation/http/shared/invitation-token.schema.class-validator.shared.ts.tpl +9 -0
- package/templates/presets/identity/context/presentation/http/shared/invitation-token.schema.zod.shared.ts.tpl +9 -0
- package/templates/presets/identity/context/published-language/account-deactivated.v1.integration-event.ts.tpl +33 -0
- package/templates/presets/identity/context/published-language/account-deactivated.v1.payload.class-validator.ts.tpl +7 -0
- package/templates/presets/identity/context/published-language/delegation-granted.v1.integration-event.ts.tpl +39 -0
- package/templates/presets/identity/context/published-language/delegation-granted.v1.payload.class-validator.ts.tpl +28 -0
- package/templates/presets/identity/context/published-language/delegation-revoked.v1.integration-event.ts.tpl +36 -0
- package/templates/presets/identity/context/published-language/delegation-revoked.v1.payload.class-validator.ts.tpl +16 -0
- package/templates/presets/identity/context/published-language/member-joined.v1.integration-event.ts.tpl +36 -0
- package/templates/presets/identity/context/published-language/member-joined.v1.payload.class-validator.ts.tpl +16 -0
- package/templates/presets/identity/context/published-language/member-removed.v1.integration-event.ts.tpl +36 -0
- package/templates/presets/identity/context/published-language/member-removed.v1.payload.class-validator.ts.tpl +18 -0
- package/templates/presets/identity/context/published-language/member-role-changed.v1.integration-event.ts.tpl +38 -0
- package/templates/presets/identity/context/published-language/member-role-changed.v1.payload.class-validator.ts.tpl +24 -0
- package/templates/presets/identity/context/published-language/organisation-opened.v1.integration-event.ts.tpl +35 -0
- package/templates/presets/identity/context/published-language/organisation-opened.v1.payload.class-validator.ts.tpl +13 -0
- package/templates/presets/identity/context/test/builders/account.builder.ts.tpl +59 -0
- package/templates/presets/identity/context/test/builders/delegation.builder.ts.tpl +67 -0
- package/templates/presets/identity/context/test/builders/invitation.builder.ts.tpl +60 -0
- package/templates/presets/identity/context/test/builders/member.builder.ts.tpl +59 -0
- package/templates/presets/identity/context/test/builders/organisation.builder.ts.tpl +44 -0
- package/templates/presets/identity/context/test/fakes/account.repository.fake.ts.tpl +10 -0
- package/templates/presets/identity/context/test/fakes/delegation.repository.fake.ts.tpl +26 -0
- package/templates/presets/identity/context/test/fakes/identity-provider-admin.fake.ts.tpl +41 -0
- package/templates/presets/identity/context/test/fakes/invitation-tokens.fake.ts.tpl +18 -0
- package/templates/presets/identity/context/test/fakes/invitation.repository.fake.ts.tpl +14 -0
- package/templates/presets/identity/context/test/fakes/member.repository.fake.ts.tpl +29 -0
- package/templates/presets/identity/context/test/fakes/organisation.repository.fake.ts.tpl +10 -0
- package/templates/presets/identity/context/test/fakes/search-members-reader.fake.ts.tpl +25 -0
- package/templates/presets/identity/context/test/integration/account.repository.contract.spec.ts.tpl +48 -0
- package/templates/presets/identity/context/test/integration/delegation.repository.contract.spec.ts.tpl +84 -0
- package/templates/presets/identity/context/test/integration/invitation.repository.contract.spec.ts.tpl +76 -0
- package/templates/presets/identity/context/test/integration/keycloak-identity-provider-admin.adapter.spec.ts.tpl +123 -0
- package/templates/presets/identity/context/test/integration/member.repository.contract.spec.ts.tpl +92 -0
- package/templates/presets/identity/context/test/integration/organisation.repository.contract.spec.ts.tpl +46 -0
- package/templates/presets/identity/context/test/integration/search-members-reader.spec.ts.tpl +86 -0
- package/templates/presets/identity/context/test/unit/accept-invitation.controller.spec.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/accept-invitation.handler.spec.ts.tpl +69 -0
- package/templates/presets/identity/context/test/unit/account-deactivated.integration-handler.spec.ts.tpl +24 -0
- package/templates/presets/identity/context/test/unit/account-deactivated.publisher.spec.ts.tpl +25 -0
- package/templates/presets/identity/context/test/unit/account.aggregate.spec.ts.tpl +72 -0
- package/templates/presets/identity/context/test/unit/change-member-role.controller.spec.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/change-member-role.handler.spec.ts.tpl +135 -0
- package/templates/presets/identity/context/test/unit/crypto-invitation-tokens.adapter.spec.ts.tpl +15 -0
- package/templates/presets/identity/context/test/unit/deactivate-account.controller.spec.ts.tpl +44 -0
- package/templates/presets/identity/context/test/unit/deactivate-account.handler.spec.ts.tpl +106 -0
- package/templates/presets/identity/context/test/unit/decline-invitation.controller.spec.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/decline-invitation.handler.spec.ts.tpl +40 -0
- package/templates/presets/identity/context/test/unit/delegation-granted.publisher.spec.ts.tpl +36 -0
- package/templates/presets/identity/context/test/unit/delegation-period.vo.spec.ts.tpl +32 -0
- package/templates/presets/identity/context/test/unit/delegation-revoked.publisher.spec.ts.tpl +35 -0
- package/templates/presets/identity/context/test/unit/delegation.aggregate.spec.ts.tpl +111 -0
- package/templates/presets/identity/context/test/unit/display-name.vo.spec.ts.tpl +13 -0
- package/templates/presets/identity/context/test/unit/email-address.vo.spec.ts.tpl +24 -0
- package/templates/presets/identity/context/test/unit/environment-identity-provider-connection.adapter.spec.ts.tpl +41 -0
- package/templates/presets/identity/context/test/unit/grant-delegation.controller.spec.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/grant-delegation.handler.spec.ts.tpl +66 -0
- package/templates/presets/identity/context/test/unit/identity-application.ts.tpl +79 -0
- package/templates/presets/identity/context/test/unit/invitation.aggregate.spec.ts.tpl +118 -0
- package/templates/presets/identity/context/test/unit/invite-member.controller.spec.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/invite-member.handler.spec.ts.tpl +110 -0
- package/templates/presets/identity/context/test/unit/member-joined.integration-handler.spec.ts.tpl +38 -0
- package/templates/presets/identity/context/test/unit/member-joined.publisher.spec.ts.tpl +36 -0
- package/templates/presets/identity/context/test/unit/member-removed.integration-handler.spec.ts.tpl +45 -0
- package/templates/presets/identity/context/test/unit/member-removed.publisher.spec.ts.tpl +35 -0
- package/templates/presets/identity/context/test/unit/member-role-changed.publisher.spec.ts.tpl +36 -0
- package/templates/presets/identity/context/test/unit/member.aggregate.spec.ts.tpl +142 -0
- package/templates/presets/identity/context/test/unit/open-organisation.controller.spec.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/open-organisation.handler.spec.ts.tpl +52 -0
- package/templates/presets/identity/context/test/unit/organisation-name.vo.spec.ts.tpl +13 -0
- package/templates/presets/identity/context/test/unit/organisation-opened.integration-handler.spec.ts.tpl +24 -0
- package/templates/presets/identity/context/test/unit/organisation-opened.publisher.spec.ts.tpl +35 -0
- package/templates/presets/identity/context/test/unit/organisation-rights.vo.spec.ts.tpl +23 -0
- package/templates/presets/identity/context/test/unit/organisation-slug.vo.spec.ts.tpl +17 -0
- package/templates/presets/identity/context/test/unit/organisation.aggregate.spec.ts.tpl +33 -0
- package/templates/presets/identity/context/test/unit/provision-account.controller.spec.ts.tpl +73 -0
- package/templates/presets/identity/context/test/unit/provision-account.handler.spec.ts.tpl +65 -0
- package/templates/presets/identity/context/test/unit/remove-member.controller.spec.ts.tpl +44 -0
- package/templates/presets/identity/context/test/unit/remove-member.handler.spec.ts.tpl +125 -0
- package/templates/presets/identity/context/test/unit/revoke-delegation.controller.spec.ts.tpl +44 -0
- package/templates/presets/identity/context/test/unit/revoke-delegation.handler.spec.ts.tpl +51 -0
- package/templates/presets/identity/context/test/unit/revoke-invitation.controller.spec.ts.tpl +44 -0
- package/templates/presets/identity/context/test/unit/revoke-invitation.handler.spec.ts.tpl +44 -0
- package/templates/presets/identity/context/test/unit/role-rights.service.spec.ts.tpl +54 -0
- package/templates/presets/identity/context/test/unit/search-members.controller.spec.ts.tpl +43 -0
- package/templates/presets/identity/context/test/unit/search-members.handler.spec.ts.tpl +38 -0
- package/templates/presets/identity/decision.md.tpl +37 -0
- package/templates/presets/identity/design.md.tpl +71 -0
- package/templates/presets/signed-in-grants.ts.tpl +12 -0
|
@@ -2,22 +2,29 @@ import { isOneOf, RELATIONSHIPS } from '../../config/index.js';
|
|
|
2
2
|
import { CliError } from '../../cli-error.js';
|
|
3
3
|
import { parseContextName } from '../../naming/index.js';
|
|
4
4
|
import { parseTerms } from '../parse-terms.js';
|
|
5
|
+
import { applyPreset } from '../../presets/apply-preset.js';
|
|
6
|
+
import { presetNamed } from '../../presets/preset-named.js';
|
|
5
7
|
import { generateContext } from './generate-context.js';
|
|
6
8
|
export const contextKind = {
|
|
7
9
|
name: 'context',
|
|
8
10
|
aliases: [],
|
|
9
|
-
usage: 'context <name> --classification <core|supporting|generic> [--purpose "<two sentences>"] [--term "<Term>=<meaning>"]... [--upstream <ctx>[:relationship]]...',
|
|
10
|
-
summary: 'A bounded context: CONTEXT.md with its glossary, published language, config entry, and what assembles it (its declarations, or its module file).',
|
|
11
|
+
usage: 'context <name> --classification <core|supporting|generic> [--purpose "<two sentences>"] [--term "<Term>=<meaning>"]... [--upstream <ctx>[:relationship]]... [--preset identity]',
|
|
12
|
+
summary: 'A bounded context: CONTEXT.md with its glossary, published language, config entry, and what assembles it (its declarations, or its module file); with --preset, written whole from a preset of the kit.',
|
|
11
13
|
positionals: ['name'],
|
|
12
14
|
writesShared: true,
|
|
13
15
|
run: ({ ws, config, args, flags }) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const name = args[0] ?? '';
|
|
17
|
+
const preset = flags.preset === undefined ? undefined : presetNamed(flags.preset);
|
|
18
|
+
const declared = generateContext(ws, config, {
|
|
19
|
+
name,
|
|
20
|
+
classification: flags.classification ?? preset?.classification,
|
|
17
21
|
upstreams: flags.upstream.map(parseUpstreamFlag),
|
|
18
|
-
purpose: flags.purpose,
|
|
22
|
+
purpose: flags.purpose ?? preset?.purpose,
|
|
19
23
|
terms: parseTerms(flags.term),
|
|
20
24
|
});
|
|
25
|
+
if (preset !== undefined) {
|
|
26
|
+
applyPreset(ws, declared, { context: name, preset });
|
|
27
|
+
}
|
|
21
28
|
},
|
|
22
29
|
};
|
|
23
30
|
function parseUpstreamFlag(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/context-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAiB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAAS;IAC/B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,EAAE;IACX,KAAK,EACH,
|
|
1
|
+
{"version":3,"file":"context-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/context-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAiB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAA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,mBAAmB,KAAK,GAAG,EAChE,eAAe,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC3C,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Workspace } from '../../workspace/index.js';
|
|
2
|
+
/** The number the next decision record of the project takes: one after the highest in `docs/adr/`. */
|
|
3
|
+
export declare function nextAdrNumber(ws: Workspace): string;
|
|
4
|
+
//# sourceMappingURL=next-adr-number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-adr-number.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/next-adr-number.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,sGAAsG;AACtG,wBAAgB,aAAa,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAInD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ADR_DIRECTORY } from '../../check/governance/adr-directory.js';
|
|
2
|
+
/** The number the next decision record of the project takes: one after the highest in `docs/adr/`. */
|
|
3
|
+
export function nextAdrNumber(ws) {
|
|
4
|
+
const taken = ws.list(ADR_DIRECTORY).map((file) => Number(/^(\d+)-/.exec(file)?.[1] ?? '0'));
|
|
5
|
+
return String(Math.max(0, ...taken) + 1).padStart(4, '0');
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=next-adr-number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-adr-number.js","sourceRoot":"","sources":["../../../src/generate/kinds/next-adr-number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAGxE,sGAAsG;AACtG,MAAM,UAAU,aAAa,CAAC,EAAa;IACzC,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IAE7F,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { CliError } from '../../cli-error.js';
|
|
2
2
|
import { toName } from '../../naming/index.js';
|
|
3
3
|
import { renderTemplate } from '../../templating/index.js';
|
|
4
|
-
|
|
4
|
+
import { ADR_DIRECTORY } from '../../check/governance/adr-directory.js';
|
|
5
|
+
import { nextAdrNumber } from './next-adr-number.js';
|
|
5
6
|
/** Writes the record under the next free number and answers that number. */
|
|
6
7
|
export function writeAdr(ws, request) {
|
|
7
8
|
const slug = toName(request.title).kebab;
|
|
8
9
|
if (slug === '') {
|
|
9
10
|
throw new CliError('A decision record needs a title.', 'Pass it as the first argument, for example: ddd-ts-kit generate adr "Read the catalog without a gateway".');
|
|
10
11
|
}
|
|
11
|
-
const number =
|
|
12
|
+
const number = nextAdrNumber(ws);
|
|
12
13
|
const { deviation } = request;
|
|
13
14
|
const adr = {
|
|
14
15
|
number,
|
|
@@ -21,10 +22,6 @@ export function writeAdr(ws, request) {
|
|
|
21
22
|
ws.create(`${ADR_DIRECTORY}/${number}-${slug}.md`, renderTemplate('adr/adr.md.tpl', { adr }));
|
|
22
23
|
return number;
|
|
23
24
|
}
|
|
24
|
-
function nextNumber(ws) {
|
|
25
|
-
const taken = ws.list(ADR_DIRECTORY).map((file) => Number(/^(\d+)-/.exec(file)?.[1] ?? '0'));
|
|
26
|
-
return String(Math.max(0, ...taken) + 1).padStart(4, '0');
|
|
27
|
-
}
|
|
28
25
|
function today() {
|
|
29
26
|
return new Date().toISOString().slice(0, 10);
|
|
30
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-adr.js","sourceRoot":"","sources":["../../../src/generate/kinds/write-adr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"write-adr.js","sourceRoot":"","sources":["../../../src/generate/kinds/write-adr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQrD,4EAA4E;AAC5E,MAAM,UAAU,QAAQ,CAAC,EAAa,EAAE,OAAmB;IACzD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;IAEzC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,MAAM,IAAI,QAAQ,CAChB,kCAAkC,EAClC,2GAA2G,CAC5G,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;IACjC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAE9B,MAAM,GAAG,GAAG;QACV,MAAM;QACN,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,KAAK,EAAE;QACb,SAAS,EAAE,SAAS,KAAK,SAAS;QAClC,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE;QAC3B,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,EAAE;KAChC,CAAC;IAEF,EAAE,CAAC,MAAM,CAAC,GAAG,aAAa,IAAI,MAAM,IAAI,IAAI,KAAK,EAAE,cAAc,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IAE9F,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,KAAK;IACZ,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/help/usage.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Every command of the CLI and its flags, as `--help` prints them and docs/guides/commands.md shows them. */
|
|
2
|
-
export declare const USAGE = "Usage\n ddd-ts-kit init [--http express|fastify|hono|nest|none]\n [--validation zod|class-validator|typebox|standard-schema|none]\n [--di tsyringe|nest|manual] [--tests vitest|jest]\n [--orm drizzle|knex|prisma|typeorm|custom|none] [--database postgres|mysql|sqlite|none]\n [--events in-memory|outbox] [--docs-ui swagger|scalar|redoc|none]\n [--ci github|gitlab|both|none] [--ci-extras <extra>,...|none]\n [--authn jwt|keycloak|none] [--authz rbac|abac|rebac|custom]\n [--broker none|rabbitmq|kafka|nats|redis|custom] [--cache none|redis] [--http-cache none|varnish]\n [--storage local|s3|none]\n [--audit on|off]\n [--errors none|sentry] [--logger stdout|pino|winston] [--style declared|explicit] [--assembly barrel|discovery]\n [--dependencies signature|listed] [--refusals factories|classes]\n [--routes controllers|functions] [--representations negotiated|json] [--forms on|off]\n [--value-objects throwing|result] [--literals named|free] [--tenancy none|shared-table] [--queue database|redis|memory]\n [--schemas shared|per-route]\n [--package-manager npm|pnpm] [--allow-no-outbox \"<reason>\"] [--import-alias '$<name>/']\n [--import-extension none|js] [--sdk]\n [--context <name>:<core|supporting|generic>]... [--dry-run] [--force]\n ddd-ts-kit generate <kind> ... [--term \"<Term>=<meaning>\"]... [--allow-name] [--local-only] [--dry-run] [--force] (alias: g)\n ddd-ts-kit generate --help --json\n ddd-ts-kit list [--context <name>]\n ddd-ts-kit describe <context>\n ddd-ts-kit status\n ddd-ts-kit todo [<context>]\n ddd-ts-kit worker-scope <context> [--worktree <path>] [--branch <name>] [--dry-run]\n ddd-ts-kit docs [--check] [--stored-events]\n ddd-ts-kit sdk [--check] [--dry-run]\n ddd-ts-kit depcruise-config [--check|--write]\n ddd-ts-kit build-aliases [--project <tsconfig>]\n ddd-ts-kit error-factories --plan | --apply [--dry-run]\n ddd-ts-kit controllers [<context>] [--dry-run]\n ddd-ts-kit value-objects [--dry-run]\n ddd-ts-kit affected [--base <git-ref>] [--head <git-ref>] [--format text|json|github|env]\n ddd-ts-kit check [paths...] [--rule <id>]... [--format text|json|github|gitlab] [--changed-since <git-ref>] [--self]\n ddd-ts-kit check --clean-only <dir>... [--rule <id>]... [--format text|json|github]\n ddd-ts-kit check --commit-size [--staged] [--strict]\n ddd-ts-kit check-file <path>\n ddd-ts-kit rules\n ddd-ts-kit explain <rule-id>\n\nEvery command accepts --json (machine-readable output) and --cwd <dir> (project root).";
|
|
2
|
+
export declare const USAGE = "Usage\n ddd-ts-kit init [--http express|fastify|hono|nest|none]\n [--validation zod|class-validator|typebox|standard-schema|none]\n [--di tsyringe|nest|manual] [--tests vitest|jest]\n [--orm drizzle|knex|prisma|typeorm|custom|none] [--database postgres|mysql|sqlite|none]\n [--events in-memory|outbox] [--docs-ui swagger|scalar|redoc|none]\n [--ci github|gitlab|both|none] [--ci-extras <extra>,...|none]\n [--authn jwt|keycloak|none] [--authz rbac|abac|rebac|custom]\n [--broker none|rabbitmq|kafka|nats|redis|custom] [--cache none|redis] [--http-cache none|varnish]\n [--storage local|s3|none]\n [--audit on|off]\n [--errors none|sentry] [--logger stdout|pino|winston] [--style declared|explicit] [--assembly barrel|discovery]\n [--dependencies signature|listed] [--refusals factories|classes]\n [--routes controllers|functions] [--representations negotiated|json] [--forms on|off]\n [--value-objects throwing|result] [--literals named|free] [--tenancy none|shared-table] [--queue database|redis|memory]\n [--schemas shared|per-route]\n [--package-manager npm|pnpm] [--allow-no-outbox \"<reason>\"] [--import-alias '$<name>/']\n [--import-extension none|js] [--sdk]\n [--context <name>:<core|supporting|generic>]... [--preset identity]... [--dry-run] [--force]\n ddd-ts-kit generate <kind> ... [--term \"<Term>=<meaning>\"]... [--allow-name] [--local-only] [--dry-run] [--force] (alias: g)\n ddd-ts-kit generate --help --json\n ddd-ts-kit list [--context <name>]\n ddd-ts-kit describe <context>\n ddd-ts-kit status\n ddd-ts-kit todo [<context>]\n ddd-ts-kit worker-scope <context> [--worktree <path>] [--branch <name>] [--dry-run]\n ddd-ts-kit docs [--check] [--stored-events]\n ddd-ts-kit sdk [--check] [--dry-run]\n ddd-ts-kit depcruise-config [--check|--write]\n ddd-ts-kit build-aliases [--project <tsconfig>]\n ddd-ts-kit error-factories --plan | --apply [--dry-run]\n ddd-ts-kit controllers [<context>] [--dry-run]\n ddd-ts-kit value-objects [--dry-run]\n ddd-ts-kit affected [--base <git-ref>] [--head <git-ref>] [--format text|json|github|env]\n ddd-ts-kit check [paths...] [--rule <id>]... [--format text|json|github|gitlab] [--changed-since <git-ref>] [--self]\n ddd-ts-kit check --clean-only <dir>... [--rule <id>]... [--format text|json|github]\n ddd-ts-kit check --commit-size [--staged] [--strict]\n ddd-ts-kit check-file <path>\n ddd-ts-kit rules\n ddd-ts-kit explain <rule-id>\n\nEvery command accepts --json (machine-readable output) and --cwd <dir> (project root).";
|
|
3
3
|
//# sourceMappingURL=usage.d.ts.map
|
package/dist/help/usage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/help/usage.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/help/usage.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,eAAO,MAAM,KAAK,mvFAyCqE,CAAC"}
|
package/dist/help/usage.js
CHANGED
|
@@ -17,7 +17,7 @@ export const USAGE = `Usage
|
|
|
17
17
|
[--schemas shared|per-route]
|
|
18
18
|
[--package-manager npm|pnpm] [--allow-no-outbox "<reason>"] [--import-alias '$<name>/']
|
|
19
19
|
[--import-extension none|js] [--sdk]
|
|
20
|
-
[--context <name>:<core|supporting|generic>]... [--dry-run] [--force]
|
|
20
|
+
[--context <name>:<core|supporting|generic>]... [--preset identity]... [--dry-run] [--force]
|
|
21
21
|
ddd-ts-kit generate <kind> ... [--term "<Term>=<meaning>"]... [--allow-name] [--local-only] [--dry-run] [--force] (alias: g)
|
|
22
22
|
ddd-ts-kit generate --help --json
|
|
23
23
|
ddd-ts-kit list [--context <name>]
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/** Ranges written to the generated package.json; bumped together with the kit. */
|
|
2
2
|
export const VERSIONS = {
|
|
3
|
-
'@ddd-ts-kit/kernel': '^0.
|
|
4
|
-
'@ddd-ts-kit/validation': '^0.
|
|
5
|
-
'@ddd-ts-kit/http': '^0.
|
|
6
|
-
'@ddd-ts-kit/tracing': '^0.
|
|
7
|
-
'@ddd-ts-kit/di': '^0.
|
|
8
|
-
'@ddd-ts-kit/events': '^0.
|
|
9
|
-
'@ddd-ts-kit/testing': '^0.
|
|
10
|
-
'@ddd-ts-kit/drizzle': '^0.
|
|
11
|
-
'@ddd-ts-kit/knex': '^0.
|
|
12
|
-
'@ddd-ts-kit/prisma': '^0.
|
|
13
|
-
'@ddd-ts-kit/typeorm': '^0.
|
|
14
|
-
'@ddd-ts-kit/auth': '^0.
|
|
15
|
-
'@ddd-ts-kit/rabbitmq': '^0.
|
|
16
|
-
'@ddd-ts-kit/aspects': '^0.
|
|
17
|
-
'@ddd-ts-kit/audit': '^0.
|
|
18
|
-
'@ddd-ts-kit/redis': '^0.
|
|
19
|
-
'@ddd-ts-kit/kafka': '^0.
|
|
20
|
-
'@ddd-ts-kit/nats': '^0.
|
|
21
|
-
'@ddd-ts-kit/scheduling': '^0.
|
|
22
|
-
'@ddd-ts-kit/sentry': '^0.
|
|
23
|
-
'@ddd-ts-kit/s3': '^0.
|
|
3
|
+
'@ddd-ts-kit/kernel': '^0.15.0',
|
|
4
|
+
'@ddd-ts-kit/validation': '^0.15.0',
|
|
5
|
+
'@ddd-ts-kit/http': '^0.15.0',
|
|
6
|
+
'@ddd-ts-kit/tracing': '^0.15.0',
|
|
7
|
+
'@ddd-ts-kit/di': '^0.15.0',
|
|
8
|
+
'@ddd-ts-kit/events': '^0.15.0',
|
|
9
|
+
'@ddd-ts-kit/testing': '^0.15.0',
|
|
10
|
+
'@ddd-ts-kit/drizzle': '^0.15.0',
|
|
11
|
+
'@ddd-ts-kit/knex': '^0.15.0',
|
|
12
|
+
'@ddd-ts-kit/prisma': '^0.15.0',
|
|
13
|
+
'@ddd-ts-kit/typeorm': '^0.15.0',
|
|
14
|
+
'@ddd-ts-kit/auth': '^0.15.0',
|
|
15
|
+
'@ddd-ts-kit/rabbitmq': '^0.15.0',
|
|
16
|
+
'@ddd-ts-kit/aspects': '^0.15.0',
|
|
17
|
+
'@ddd-ts-kit/audit': '^0.15.0',
|
|
18
|
+
'@ddd-ts-kit/redis': '^0.15.0',
|
|
19
|
+
'@ddd-ts-kit/kafka': '^0.15.0',
|
|
20
|
+
'@ddd-ts-kit/nats': '^0.15.0',
|
|
21
|
+
'@ddd-ts-kit/scheduling': '^0.15.0',
|
|
22
|
+
'@ddd-ts-kit/sentry': '^0.15.0',
|
|
23
|
+
'@ddd-ts-kit/s3': '^0.15.0',
|
|
24
24
|
'@aws-sdk/client-s3': '^3.1150.0',
|
|
25
25
|
'@aws-sdk/lib-storage': '^3.1150.0',
|
|
26
26
|
'@aws-sdk/s3-request-presigner': '^3.1150.0',
|
|
27
27
|
busboy: '^1.6.0',
|
|
28
28
|
'@sentry/node': '^11.6.0',
|
|
29
|
-
'@ddd-ts-kit/pino': '^0.
|
|
29
|
+
'@ddd-ts-kit/pino': '^0.15.0',
|
|
30
30
|
pino: '^10.4.0',
|
|
31
31
|
'pino-pretty': '^13.2.0',
|
|
32
|
-
'@ddd-ts-kit/winston': '^0.
|
|
32
|
+
'@ddd-ts-kit/winston': '^0.15.0',
|
|
33
33
|
winston: '^3.19.0',
|
|
34
34
|
'@confluentinc/kafka-javascript': '^1.11.0',
|
|
35
35
|
'@nats-io/jetstream': '^3.4.0',
|
|
@@ -37,7 +37,7 @@ export const VERSIONS = {
|
|
|
37
37
|
ioredis: '^6.0.0',
|
|
38
38
|
jose: '^6.0.0',
|
|
39
39
|
amqplib: '^2.2.0',
|
|
40
|
-
'ddd-ts-kit': '^0.
|
|
40
|
+
'ddd-ts-kit': '^0.15.0',
|
|
41
41
|
tsx: '^4.23.15',
|
|
42
42
|
vitest: '^5.0.3',
|
|
43
43
|
zod: '^4.6.5',
|
package/dist/init/run-init.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { type StackOptions } from './stack/resolve-stack.js';
|
|
|
3
3
|
export interface InitOptions extends StackOptions {
|
|
4
4
|
/** `<name>:<classification>` entries. */
|
|
5
5
|
readonly contexts: readonly string[];
|
|
6
|
+
/** Presets of the kit, each written into the context of its name (declared by the preset when no `--context` names it). */
|
|
7
|
+
readonly presets?: readonly string[];
|
|
6
8
|
readonly dryRun: boolean;
|
|
7
9
|
}
|
|
8
10
|
export declare function runInit(root: string, options: InitOptions): WorkspaceReport;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-init.d.ts","sourceRoot":"","sources":["../../src/init/run-init.ts"],"names":[],"mappings":"AAYA,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-init.d.ts","sourceRoot":"","sources":["../../src/init/run-init.ts"],"names":[],"mappings":"AAYA,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxE,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAY3E,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,2HAA2H;IAC3H,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,eAAe,CAgC3E"}
|
package/dist/init/run-init.js
CHANGED
|
@@ -11,6 +11,8 @@ import { inDialect } from '../package-manager/in-dialect.js';
|
|
|
11
11
|
import { setUpSdk } from '../sdk/index.js';
|
|
12
12
|
import { readTemplate, renderTemplate } from '../templating/index.js';
|
|
13
13
|
import { Workspace } from '../workspace/index.js';
|
|
14
|
+
import { applyPreset } from '../presets/apply-preset.js';
|
|
15
|
+
import { presetNamed } from '../presets/preset-named.js';
|
|
14
16
|
import { addContext } from './add-context.js';
|
|
15
17
|
import { existingName } from './existing-name.js';
|
|
16
18
|
import { initFiles } from './files/init-files.js';
|
|
@@ -38,7 +40,8 @@ export function runInit(root, options) {
|
|
|
38
40
|
if (options.force) {
|
|
39
41
|
rewireContexts(ws, config);
|
|
40
42
|
}
|
|
41
|
-
const
|
|
43
|
+
const declared = addContexts(ws, config, [...options.contexts, ...presetContexts(config, options)]);
|
|
44
|
+
const withContexts = addPresets(ws, declared, [...new Set(options.presets ?? [])]);
|
|
42
45
|
writeDocs(ws, withContexts);
|
|
43
46
|
writeContracts(ws, withContexts, projectName);
|
|
44
47
|
setUpSdk(ws, withContexts);
|
|
@@ -83,6 +86,17 @@ function addContexts(ws, config, entries) {
|
|
|
83
86
|
ws.update(DEPCRUISE_FILE, renderCruiseFile(withContexts));
|
|
84
87
|
return withContexts;
|
|
85
88
|
}
|
|
89
|
+
/** The context of each preset that no `--context` and no config declares yet, under the classification of the preset. */
|
|
90
|
+
function presetContexts(config, options) {
|
|
91
|
+
const named = new Set(options.contexts.map((entry) => entry.split(':')[0]));
|
|
92
|
+
return (options.presets ?? [])
|
|
93
|
+
.filter((name) => !named.has(name) && config.contexts[name] === undefined)
|
|
94
|
+
.map((name) => `${name}:${presetNamed(name).classification}`);
|
|
95
|
+
}
|
|
96
|
+
/** Each preset is written into the context of its name, which `addContexts` declared. */
|
|
97
|
+
function addPresets(ws, config, names) {
|
|
98
|
+
return names.reduce((current, name) => applyPreset(ws, current, { context: name, preset: presetNamed(name) }), config);
|
|
99
|
+
}
|
|
86
100
|
/** A template ending in `.tpl` is rendered; any other is copied as it is. */
|
|
87
101
|
function writeFiles(ws, config, projectName) {
|
|
88
102
|
const context = templateVars(config, projectName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-init.js","sourceRoot":"","sources":["../../src/init/run-init.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAe,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,M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,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Config } from '../config/index.js';
|
|
2
|
+
import type { Workspace } from '../workspace/index.js';
|
|
3
|
+
import type { Preset } from './preset.js';
|
|
4
|
+
/** The context a preset is written into, which `generate context` or `init` declared just before. */
|
|
5
|
+
export interface PresetRequest {
|
|
6
|
+
readonly context: string;
|
|
7
|
+
readonly preset: Preset;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Writes a preset into its context: its glossary, its files, then the generators that wire them
|
|
11
|
+
* (the storage of the platform, the published language, the registries), then the files those
|
|
12
|
+
* generators keep adding to, laid out whole. A file already on disk is kept, as a generator keeps it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyPreset(ws: Workspace, config: Config, request: PresetRequest): Config;
|
|
15
|
+
//# sourceMappingURL=apply-preset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-preset.d.ts","sourceRoot":"","sources":["../../src/presets/apply-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAS3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,qGAAqG;AACrG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAiCzF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CONFIG_FILE, parseConfig } from '../config/index.js';
|
|
2
|
+
import { CliError } from '../cli-error.js';
|
|
3
|
+
import { learnTerms } from '../generate/learn-terms.js';
|
|
4
|
+
import { vars } from '../generate/vars.js';
|
|
5
|
+
import { parseContextName } from '../naming/index.js';
|
|
6
|
+
import { renderTemplate } from '../templating/index.js';
|
|
7
|
+
import { grantToSignedIn } from './grant-to-signed-in.js';
|
|
8
|
+
import { NO_FLAGS } from './no-flags.js';
|
|
9
|
+
import { organisationsAsTenants } from './organisations-as-tenants.js';
|
|
10
|
+
import { presetDecision } from './preset-decision.js';
|
|
11
|
+
/**
|
|
12
|
+
* Writes a preset into its context: its glossary, its files, then the generators that wire them
|
|
13
|
+
* (the storage of the platform, the published language, the registries), then the files those
|
|
14
|
+
* generators keep adding to, laid out whole. A file already on disk is kept, as a generator keeps it.
|
|
15
|
+
*/
|
|
16
|
+
export function applyPreset(ws, config, request) {
|
|
17
|
+
const { preset } = request;
|
|
18
|
+
const refusal = preset.refusal(config);
|
|
19
|
+
if (refusal !== undefined) {
|
|
20
|
+
throw new CliError(refusal.message, refusal.fix);
|
|
21
|
+
}
|
|
22
|
+
assertNoTwin(ws, config, request);
|
|
23
|
+
const scope = scopeOf(ws, config, request);
|
|
24
|
+
const adr = presetDecision(scope, preset.name);
|
|
25
|
+
const rendering = { preset: preset.name, context: vars(scope, { preset: { adr } }) };
|
|
26
|
+
learnTerms(scope);
|
|
27
|
+
writeFiles(scope, preset.files(config).filter((file) => file.afterSteps !== true), rendering);
|
|
28
|
+
const wired = runSteps(scope, preset);
|
|
29
|
+
writeFiles({ ...scope, config: wired }, preset.files(config).filter((file) => file.afterSteps === true), rendering);
|
|
30
|
+
describeContext(scope, preset, rendering);
|
|
31
|
+
return wired;
|
|
32
|
+
}
|
|
33
|
+
/** One context of each preset kind: two would declare the same facts, routes and platform files, and could not live together. */
|
|
34
|
+
function assertNoTwin(ws, config, { context, preset }) {
|
|
35
|
+
const own = parseContextName(context).kebab;
|
|
36
|
+
const holds = (other) => ws.read(`${config.contextsDir}/${other}/${preset.signature}`) !== undefined;
|
|
37
|
+
const twin = Object.keys(config.contexts).find((other) => other !== own && holds(other));
|
|
38
|
+
if (twin !== undefined) {
|
|
39
|
+
throw new CliError(`The context ${twin} is written from the ${preset.name} preset already: a project holds one context of each preset.`, `Extend ${twin} instead (its CONTEXT.md says how it is designed), or generate ${own} empty and build it with the generators.`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** The purpose, the classification and the design of the context, in place of what its CONTEXT.md leaves to write. */
|
|
43
|
+
function describeContext(scope, preset, rendering) {
|
|
44
|
+
const file = `${scope.dir}/CONTEXT.md`;
|
|
45
|
+
const design = renderTemplate(`presets/${rendering.preset}/design.md.tpl`, rendering.context);
|
|
46
|
+
const text = (scope.ws.read(file) ?? '')
|
|
47
|
+
.replace(/## Purpose\n\n[\s\S]*?\n\n## Classification/, `## Purpose\n\n${preset.purpose}\n\n## Classification`)
|
|
48
|
+
.replace(/TODO\(domain\): say in one sentence why this context is [a-z]+\./, preset.classificationReason)
|
|
49
|
+
.replace(/TODO\(domain\): define the ubiquitous language first[^\n]*\n\n/, '')
|
|
50
|
+
.replace('## Aggregates', `${design}## Aggregates`);
|
|
51
|
+
scope.ws.update(file, text);
|
|
52
|
+
}
|
|
53
|
+
function scopeOf(ws, config, { context, preset }) {
|
|
54
|
+
const name = parseContextName(context);
|
|
55
|
+
const term = preset.terms.map((row) => `${row.term}=${row.meaning}`);
|
|
56
|
+
return { ws, config, context: name, dir: `${config.contextsDir}/${name.kebab}`, flags: { ...NO_FLAGS, term } };
|
|
57
|
+
}
|
|
58
|
+
function writeFiles(scope, files, rendering) {
|
|
59
|
+
for (const file of files) {
|
|
60
|
+
const target = `${scope.dir}/${file.target.replaceAll('__context__', scope.context.kebab)}`;
|
|
61
|
+
const content = renderTemplate(`presets/${rendering.preset}/${file.template}`, rendering.context);
|
|
62
|
+
if (scope.ws.planned(target)) {
|
|
63
|
+
scope.ws.update(target, content);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
scope.ws.create(target, content);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Each generator sees the config as the one before it left it; then the platform grants what the preset asks to every signed-in person, and reads its organisations as tenants. */
|
|
71
|
+
function runSteps(scope, preset) {
|
|
72
|
+
const config = generated(scope, preset);
|
|
73
|
+
if (preset.grantsEverySignedInPerson) {
|
|
74
|
+
grantToSignedIn({ ...scope, config });
|
|
75
|
+
}
|
|
76
|
+
if (preset.organisationsAreTenants) {
|
|
77
|
+
organisationsAsTenants({ ...scope, config });
|
|
78
|
+
}
|
|
79
|
+
return config;
|
|
80
|
+
}
|
|
81
|
+
function generated(scope, preset) {
|
|
82
|
+
let config = scope.config;
|
|
83
|
+
for (const step of preset.steps) {
|
|
84
|
+
const flags = { ...NO_FLAGS, allowName: true, ...step.flags };
|
|
85
|
+
step.kind.run({ ws: scope.ws, config, args: [scope.context.kebab, ...step.args], flags });
|
|
86
|
+
config = current(scope.ws) ?? config;
|
|
87
|
+
}
|
|
88
|
+
return config;
|
|
89
|
+
}
|
|
90
|
+
function current(ws) {
|
|
91
|
+
const text = ws.read(CONFIG_FILE);
|
|
92
|
+
return text === undefined ? undefined : parseConfig(JSON.parse(text));
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=apply-preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-preset.js","sourceRoot":"","sources":["../../src/presets/apply-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAe,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,e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AAC,KAAK,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,EAAa;IAC5B,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAElC,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Scope } from '../generate/scope.js';
|
|
2
|
+
/**
|
|
3
|
+
* Grants every signed-in person the permissions of the context, whatever the access model: the
|
|
4
|
+
* line `'<context>:*'` in `signed-in-grants.ts` of the platform, which `createAuthorizer` asks
|
|
5
|
+
* before the model once wrapped in `SignedInGrantsAuthorizer`. An authorizer the generator cannot
|
|
6
|
+
* read is left to the team, with a step saying how.
|
|
7
|
+
*/
|
|
8
|
+
export declare function grantToSignedIn(scope: Scope): void;
|
|
9
|
+
//# sourceMappingURL=grant-to-signed-in.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-to-signed-in.d.ts","sourceRoot":"","sources":["../../src/presets/grant-to-signed-in.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AASlD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAclD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { specifierOf } from '../alias/index.js';
|
|
2
|
+
import { insertInRegion } from '../markers/index.js';
|
|
3
|
+
import { withImport } from '../generate/with-import.js';
|
|
4
|
+
import { renderTemplate } from '../templating/index.js';
|
|
5
|
+
import { withAuthorizerImport } from './with-authorizer-import.js';
|
|
6
|
+
const REGION = 'signed-in-grants';
|
|
7
|
+
const WRAPPED = 'SignedInGrantsAuthorizer';
|
|
8
|
+
const AUTHORIZER = /(export function createAuthorizer\(\): Authorizer \{\n) {2}return ([\s\S]*?);\n\}/;
|
|
9
|
+
/**
|
|
10
|
+
* Grants every signed-in person the permissions of the context, whatever the access model: the
|
|
11
|
+
* line `'<context>:*'` in `signed-in-grants.ts` of the platform, which `createAuthorizer` asks
|
|
12
|
+
* before the model once wrapped in `SignedInGrantsAuthorizer`. An authorizer the generator cannot
|
|
13
|
+
* read is left to the team, with a step saying how.
|
|
14
|
+
*/
|
|
15
|
+
export function grantToSignedIn(scope) {
|
|
16
|
+
const auth = `${scope.config.platformDir}/auth`;
|
|
17
|
+
const grants = `${auth}/signed-in-grants.ts`;
|
|
18
|
+
const line = `'${scope.context.kebab}:*',`;
|
|
19
|
+
const current = scope.ws.read(grants) ?? renderTemplate('presets/signed-in-grants.ts.tpl', {});
|
|
20
|
+
const next = insertInRegion(current, REGION, line) ?? current;
|
|
21
|
+
writeFile(scope, grants, next);
|
|
22
|
+
scope.ws.step({
|
|
23
|
+
file: grants,
|
|
24
|
+
anchor: line,
|
|
25
|
+
text: grantStep(scope, wrapAuthorizer(scope, `${auth}/create-authorizer.ts`, grants)),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function grantStep(scope, isWrapped) {
|
|
29
|
+
const granted = `every signed-in person now holds the permissions of ${scope.context.kebab}, its policies deciding inside an organisation.`;
|
|
30
|
+
return isWrapped
|
|
31
|
+
? `check this grant: ${granted}`
|
|
32
|
+
: `wrap the authorizer of create-authorizer.ts in new SignedInGrantsAuthorizer({ grants: signedInGrants, otherwise }): until then ${scope.context.kebab} refuses who holds no grant of the access model.`;
|
|
33
|
+
}
|
|
34
|
+
/** The authorizer of the platform, wrapped once; false when the file is not one the generator wrote. */
|
|
35
|
+
function wrapAuthorizer(scope, file, grants) {
|
|
36
|
+
const source = scope.ws.read(file);
|
|
37
|
+
if (source === undefined) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (source.includes(WRAPPED)) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (!AUTHORIZER.test(source)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const wrapped = source.replace(AUTHORIZER, `$1 const model = $2;\n\n return new ${WRAPPED}({ grants: signedInGrants, otherwise: model });\n}`);
|
|
47
|
+
scope.ws.update(file, withImport(withAuthorizerImport(wrapped, WRAPPED), signedInImport(scope, grants)));
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
function signedInImport(scope, grants) {
|
|
51
|
+
return `import { signedInGrants } from '${specifierOf(scope.config, grants)}';`;
|
|
52
|
+
}
|
|
53
|
+
function writeFile(scope, file, content) {
|
|
54
|
+
if (scope.ws.read(file) === undefined) {
|
|
55
|
+
scope.ws.create(file, content);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
scope.ws.update(file, content);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=grant-to-signed-in.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-to-signed-in.js","sourceRoot":"","sources":["../../src/presets/grant-to-signed-in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAClC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAC3C,MAAM,UAAU,GAAG,mFAAmF,CAAC;AAEvG;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAY;IAC1C,MAAM,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,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AC;IAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAC5B,UAAU,EACV,yCAAyC,OAAO,oDAAoD,CACrG,CAAC;IAEF,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAEzG,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,KAAY,EAAE,MAAc;IAClD,OAAO,mCAAmC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC;AAClF,CAAC;AAED,SAAS,SAAS,CAAC,KAAY,EAAE,IAAY,EAAE,OAAe;IAC5D,IAAI,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACtC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Preset } from './preset.js';
|
|
2
|
+
/**
|
|
3
|
+
* Who the people of the application are, the organisations they belong to and in which role:
|
|
4
|
+
* accounts provisioned from the identity provider at the first sign-in (it authenticates, the
|
|
5
|
+
* application authorizes, no password is kept), organisations (the tenants when the project has
|
|
6
|
+
* tenants), members with roles, invitations, and delegations of rights for a period.
|
|
7
|
+
*/
|
|
8
|
+
export declare const identityPreset: Preset;
|
|
9
|
+
//# sourceMappingURL=identity-preset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-preset.d.ts","sourceRoot":"","sources":["../../src/presets/identity-preset.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsB1C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,MAiB5B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { integrationEventKind } from '../generate/kinds/integration-event-kind.js';
|
|
2
|
+
import { repositoryKind } from '../generate/kinds/repository-kind.js';
|
|
3
|
+
import { identityRefusal } from './identity-refusal.js';
|
|
4
|
+
import { IDENTITY_TERMS } from './identity-terms.js';
|
|
5
|
+
import { presetFiles } from './preset-files.js';
|
|
6
|
+
/** The tables of the context: the repository generator starts them, the preset lays them out whole. */
|
|
7
|
+
const AFTER_STEPS = [
|
|
8
|
+
'infrastructure/persistence/create-__context__-tables.schema.ts',
|
|
9
|
+
'infrastructure/persistence/__context__.schema.ts',
|
|
10
|
+
];
|
|
11
|
+
const AGGREGATES = ['Account', 'Organisation', 'Member', 'Invitation', 'Delegation'];
|
|
12
|
+
/** The facts other contexts learn: each is declared in the published language and goes through the outbox. */
|
|
13
|
+
const PUBLISHED = [
|
|
14
|
+
['Account', 'Deactivated'],
|
|
15
|
+
['Organisation', 'Opened'],
|
|
16
|
+
['Member', 'Joined'],
|
|
17
|
+
['Member', 'RoleChanged'],
|
|
18
|
+
['Member', 'Removed'],
|
|
19
|
+
['Delegation', 'Granted'],
|
|
20
|
+
['Delegation', 'Revoked'],
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Who the people of the application are, the organisations they belong to and in which role:
|
|
24
|
+
* accounts provisioned from the identity provider at the first sign-in (it authenticates, the
|
|
25
|
+
* application authorizes, no password is kept), organisations (the tenants when the project has
|
|
26
|
+
* tenants), members with roles, invitations, and delegations of rights for a period.
|
|
27
|
+
*/
|
|
28
|
+
export const identityPreset = {
|
|
29
|
+
name: 'identity',
|
|
30
|
+
classification: 'generic',
|
|
31
|
+
classificationReason: 'Every application that serves people who sign in and work in groups needs it, and nothing in it distinguishes this business: it is designed once and kept small.',
|
|
32
|
+
purpose: 'Who the people of the application are, the organisations they belong to and in which role. The identity provider authenticates them; this context keeps their accounts, invites them, and decides what each member may do in an organisation.',
|
|
33
|
+
terms: IDENTITY_TERMS,
|
|
34
|
+
refusal: identityRefusal,
|
|
35
|
+
steps: [
|
|
36
|
+
...AGGREGATES.map((aggregate) => ({ kind: repositoryKind, args: [aggregate] })),
|
|
37
|
+
...PUBLISHED.map((fact) => ({ kind: integrationEventKind, args: fact })),
|
|
38
|
+
],
|
|
39
|
+
grantsEverySignedInPerson: true,
|
|
40
|
+
organisationsAreTenants: true,
|
|
41
|
+
signature: 'domain/services/role-rights.service.ts',
|
|
42
|
+
files: (config) => presetFiles('identity', config, AFTER_STEPS),
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=identity-preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-preset.js","sourceRoot":"","sources":["../../src/presets/identity-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,uGAAuG;AACvG,MAAM,WAAW,GAAG;IAClB,gEAAgE;IAChE,kDAAkD;CACnD,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AAErF,8GAA8G;AAC9G,MAAM,SAAS,GAAG;IAChB,CAAC,SAAS,EAAE,aAAa,CAAC;IAC1B,CAAC,cAAc,EAAE,QAAQ,CAAC;IAC1B,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzB,CAAC,QAAQ,EAAE,SAAS,CAAC;IACrB,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,YAAY,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAW;IACpC,IAAI,EAAE,UAAU;IAChB,cAAc,EAAE,SAAS;IACzB,oBAAoB,EAClB,kKAAkK;IACpK,OAAO,EACL,+OAA+O;IACjP,KAAK,EAAE,cAAc;IACrB,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE;QACL,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC/E,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;KACzE;IACD,yBAAyB,EAAE,IAAI;IAC/B,uBAAuB,EAAE,IAAI;IAC7B,SAAS,EAAE,wCAAwC;IACnD,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC;CAChE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { PresetRefusal } from './preset-refusal.js';
|
|
3
|
+
/** The identity preset is written for the defaults of `init` and their nearest variants; another stack is refused with what to change. */
|
|
4
|
+
export declare function identityRefusal(config: Config): PresetRefusal | undefined;
|
|
5
|
+
//# sourceMappingURL=identity-refusal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-refusal.d.ts","sourceRoot":"","sources":["../../src/presets/identity-refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAwBzD,0IAA0I;AAC1I,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAWzE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** What the identity preset is written for, each with the value it needs and the flag of `init` that gives it. */
|
|
2
|
+
const NEEDED = [
|
|
3
|
+
{ key: 'style', values: ['declared'], flag: '--style declared' },
|
|
4
|
+
{ key: 'dependencies', values: ['signature'], flag: '--dependencies signature' },
|
|
5
|
+
{ key: 'refusals', values: ['factories'], flag: '--refusals factories' },
|
|
6
|
+
{ key: 'valueObjects', values: ['throwing'], flag: '--value-objects throwing' },
|
|
7
|
+
{ key: 'routes', values: ['controllers'], flag: '--routes controllers' },
|
|
8
|
+
{ key: 'orm', values: ['knex', 'drizzle'], flag: '--orm knex or --orm drizzle' },
|
|
9
|
+
{ key: 'validation', values: ['zod', 'class-validator'], flag: '--validation zod or --validation class-validator' },
|
|
10
|
+
{ key: 'http', values: ['express', 'fastify'], flag: '--http express or --http fastify' },
|
|
11
|
+
{
|
|
12
|
+
key: 'authn',
|
|
13
|
+
values: ['jwt', 'keycloak'],
|
|
14
|
+
flag: '--authn jwt or --authn keycloak (an account is the subject of a token)',
|
|
15
|
+
},
|
|
16
|
+
{ key: 'database', values: ['postgres'], flag: '--database postgres (its tables use partial unique indexes)' },
|
|
17
|
+
];
|
|
18
|
+
/** The identity preset is written for the defaults of `init` and their nearest variants; another stack is refused with what to change. */
|
|
19
|
+
export function identityRefusal(config) {
|
|
20
|
+
const missing = NEEDED.find(({ key, values }) => !values.includes(config.stack[key]));
|
|
21
|
+
if (missing === undefined) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
message: `The identity preset is not written for "stack.${missing.key}": "${config.stack[missing.key]}".`,
|
|
26
|
+
fix: `It needs ${missing.flag}, which init writes by default (docs/guides/bootstrap-with-well-designed-contexts.md says why). Otherwise, generate the context empty and build it with the generators.`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=identity-refusal.js.map
|