ddd-ts-kit 0.14.0 → 0.16.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 +31 -2
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +2 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/explain/domain-docs.d.ts +3 -0
- package/dist/check/explain/domain-docs.d.ts.map +1 -0
- package/dist/check/explain/domain-docs.js +30 -0
- package/dist/check/explain/domain-docs.js.map +1 -0
- package/dist/check/explain/rule-docs.d.ts.map +1 -1
- package/dist/check/explain/rule-docs.js +2 -0
- package/dist/check/explain/rule-docs.js.map +1 -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/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +4 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/model-function-fixtures.d.ts +4 -0
- package/dist/check/fixtures/model-function-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/model-function-fixtures.js +52 -0
- package/dist/check/fixtures/model-function-fixtures.js.map +1 -0
- 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/fixtures/value-object-file-fixtures.d.ts +4 -0
- package/dist/check/fixtures/value-object-file-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/value-object-file-fixtures.js +54 -0
- package/dist/check/fixtures/value-object-file-fixtures.js.map +1 -0
- package/dist/check/fixtures/value-object-files.d.ts +34 -0
- package/dist/check/fixtures/value-object-files.d.ts.map +1 -0
- package/dist/check/fixtures/value-object-files.js +46 -0
- package/dist/check/fixtures/value-object-files.js.map +1 -0
- package/dist/check/rules/domain-value-object-class.d.ts +3 -0
- package/dist/check/rules/domain-value-object-class.d.ts.map +1 -0
- package/dist/check/rules/domain-value-object-class.js +21 -0
- package/dist/check/rules/domain-value-object-class.js.map +1 -0
- package/dist/check/structure/class-body-brace.d.ts +6 -0
- package/dist/check/structure/class-body-brace.d.ts.map +1 -0
- package/dist/check/structure/class-body-brace.js +22 -0
- package/dist/check/structure/class-body-brace.js.map +1 -0
- package/dist/check/structure/read-structure.d.ts.map +1 -1
- package/dist/check/structure/read-structure.js +3 -1
- package/dist/check/structure/read-structure.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/check/values/answered-literals.d.ts +8 -0
- package/dist/check/values/answered-literals.d.ts.map +1 -0
- package/dist/check/values/answered-literals.js +20 -0
- package/dist/check/values/answered-literals.js.map +1 -0
- package/dist/check/values/arrow-body.d.ts +4 -0
- package/dist/check/values/arrow-body.d.ts.map +1 -0
- package/dist/check/values/arrow-body.js +52 -0
- package/dist/check/values/arrow-body.js.map +1 -0
- package/dist/check/values/entry-role.d.ts +10 -0
- package/dist/check/values/entry-role.d.ts.map +1 -0
- package/dist/check/values/entry-role.js +40 -0
- package/dist/check/values/entry-role.js.map +1 -0
- package/dist/check/values/exported-function-body.d.ts +9 -0
- package/dist/check/values/exported-function-body.d.ts.map +1 -0
- package/dist/check/values/exported-function-body.js +29 -0
- package/dist/check/values/exported-function-body.js.map +1 -0
- package/dist/check/values/exported-values.d.ts +9 -0
- package/dist/check/values/exported-values.d.ts.map +1 -0
- package/dist/check/values/exported-values.js +48 -0
- package/dist/check/values/exported-values.js.map +1 -0
- package/dist/check/values/extends-value-object.d.ts +9 -0
- package/dist/check/values/extends-value-object.d.ts.map +1 -0
- package/dist/check/values/extends-value-object.js +25 -0
- package/dist/check/values/extends-value-object.js.map +1 -0
- package/dist/check/values/function-body.d.ts +10 -0
- package/dist/check/values/function-body.d.ts.map +1 -0
- package/dist/check/values/function-body.js +2 -0
- package/dist/check/values/function-body.js.map +1 -0
- package/dist/check/values/generate-hint.d.ts +4 -0
- package/dist/check/values/generate-hint.d.ts.map +1 -0
- package/dist/check/values/generate-hint.js +8 -0
- package/dist/check/values/generate-hint.js.map +1 -0
- package/dist/check/values/initializer-of.d.ts +3 -0
- package/dist/check/values/initializer-of.d.ts.map +1 -0
- package/dist/check/values/initializer-of.js +15 -0
- package/dist/check/values/initializer-of.js.map +1 -0
- package/dist/check/values/is-model-file.d.ts +8 -0
- package/dist/check/values/is-model-file.d.ts.map +1 -0
- package/dist/check/values/is-model-file.js +15 -0
- package/dist/check/values/is-model-file.js.map +1 -0
- package/dist/check/values/is-value-object-file.d.ts +7 -0
- package/dist/check/values/is-value-object-file.d.ts.map +1 -0
- package/dist/check/values/is-value-object-file.js +14 -0
- package/dist/check/values/is-value-object-file.js.map +1 -0
- package/dist/check/values/javascript-globals.d.ts +3 -0
- package/dist/check/values/javascript-globals.d.ts.map +1 -0
- package/dist/check/values/javascript-globals.js +22 -0
- package/dist/check/values/javascript-globals.js.map +1 -0
- package/dist/check/values/literal-at.d.ts +3 -0
- package/dist/check/values/literal-at.d.ts.map +1 -0
- package/dist/check/values/literal-at.js +7 -0
- package/dist/check/values/literal-at.js.map +1 -0
- package/dist/check/values/local-declaration.d.ts +8 -0
- package/dist/check/values/local-declaration.d.ts.map +1 -0
- package/dist/check/values/local-declaration.js +31 -0
- package/dist/check/values/local-declaration.js.map +1 -0
- package/dist/check/values/nested-bodies.d.ts +8 -0
- package/dist/check/values/nested-bodies.d.ts.map +1 -0
- package/dist/check/values/nested-bodies.js +28 -0
- package/dist/check/values/nested-bodies.js.map +1 -0
- package/dist/check/values/plain-value-functions.d.ts +10 -0
- package/dist/check/values/plain-value-functions.d.ts.map +1 -0
- package/dist/check/values/plain-value-functions.js +33 -0
- package/dist/check/values/plain-value-functions.js.map +1 -0
- package/dist/check/values/returns-package-type.d.ts +9 -0
- package/dist/check/values/returns-package-type.d.ts.map +1 -0
- package/dist/check/values/returns-package-type.js +12 -0
- package/dist/check/values/returns-package-type.js.map +1 -0
- package/dist/check/values/stands-for-a-value.d.ts +9 -0
- package/dist/check/values/stands-for-a-value.d.ts.map +1 -0
- package/dist/check/values/stands-for-a-value.js +28 -0
- package/dist/check/values/stands-for-a-value.js.map +1 -0
- package/dist/check/values/value-object-file-findings.d.ts +5 -0
- package/dist/check/values/value-object-file-findings.d.ts.map +1 -0
- package/dist/check/values/value-object-file-findings.js +96 -0
- package/dist/check/values/value-object-file-findings.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 +12 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/parse-stack.d.ts.map +1 -1
- package/dist/config/parse-stack.js +2 -1
- package/dist/config/parse-stack.js.map +1 -1
- package/dist/config/stack.d.ts +8 -0
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -0
- package/dist/config/stack.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 +2 -2
- 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/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +3 -1
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +2 -0
- package/dist/init/stack/stack-options.d.ts.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/stack/stack-vars.js +2 -1
- package/dist/stack/stack-vars.js.map +1 -1
- 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/init/rules/domain.md.tpl +1 -1
- 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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { fileExports } from '../exports/file-exports.js';
|
|
2
|
+
import { braceDepthAt } from '../text/brace-depth-at.js';
|
|
3
|
+
import { endAtDepthZero } from '../text/end-at-depth-zero.js';
|
|
4
|
+
import { localDeclaration } from './local-declaration.js';
|
|
5
|
+
const LOCAL_LIST = /(?<![\w$.])export\s*\{([^}]*)\}(?!\s*from\b)/g;
|
|
6
|
+
const DEFAULT_EXPRESSION = /(?<![\w$.])export\s+default\s+(?!(?:abstract\s+)?class\b|(?:async\s+)?function\b|interface\b)/g;
|
|
7
|
+
const IDENTIFIER = /^([A-Za-z_$][\w$]*)\s*(?:;|$)/;
|
|
8
|
+
/**
|
|
9
|
+
* What a file exports, as `fileExports` reads it, with the values it leaves unread: a constant
|
|
10
|
+
* exported by `export { money }` is read from its declaration, and `export default <expression>`
|
|
11
|
+
* is read as a constant named `default` (`export default money` as what `money` declares).
|
|
12
|
+
*/
|
|
13
|
+
export function exportedValues(file) {
|
|
14
|
+
const { code } = file.scan;
|
|
15
|
+
const known = fileExports(file).filter(({ kind, text }) => kind !== 'const' || text !== '');
|
|
16
|
+
const listed = [...code.matchAll(LOCAL_LIST)].flatMap((match) => (match[1] ?? '')
|
|
17
|
+
.split(',')
|
|
18
|
+
.map((part) => part.trim())
|
|
19
|
+
.filter((part) => part !== '' && !part.startsWith('type '))
|
|
20
|
+
.flatMap((part) => {
|
|
21
|
+
const [local = '', alias] = part.split(/\s+as\s+/);
|
|
22
|
+
const declared = localDeclaration(code, local);
|
|
23
|
+
return declared?.kind === 'const'
|
|
24
|
+
? [{ ...declared, name: alias ?? local, line: file.scan.lineAt(match.index) }]
|
|
25
|
+
: [];
|
|
26
|
+
}));
|
|
27
|
+
return [...known, ...listed, ...defaultExpressions(file)];
|
|
28
|
+
}
|
|
29
|
+
function defaultExpressions(file) {
|
|
30
|
+
const { code } = file.scan;
|
|
31
|
+
return [...code.matchAll(DEFAULT_EXPRESSION)]
|
|
32
|
+
.filter(({ index }) => braceDepthAt(code, index) === 0)
|
|
33
|
+
.flatMap(({ index, 0: keyword }) => {
|
|
34
|
+
const start = index + keyword.length;
|
|
35
|
+
const named = IDENTIFIER.exec(code.slice(start));
|
|
36
|
+
const line = file.scan.lineAt(index);
|
|
37
|
+
const declared = named === null ? undefined : localDeclaration(code, named[1] ?? '');
|
|
38
|
+
if (named !== null) {
|
|
39
|
+
// A class keeps its own name, as `export { Money }` gives it: the value object files read classes by name.
|
|
40
|
+
return declared === undefined
|
|
41
|
+
? []
|
|
42
|
+
: [{ ...declared, name: declared.kind === 'class' ? declared.name : 'default', line }];
|
|
43
|
+
}
|
|
44
|
+
const text = `default = ${code.slice(start, endAtDepthZero(code, start, ';'))}`;
|
|
45
|
+
return [{ name: 'default', kind: 'const', line, text, signature: text }];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=exported-values.js.map
|
|
@@ -0,0 +1 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AC;QAErF,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,2GAA2G;YAC3G,OAAO,QAAQ,KAAK,SAAS;gBAC3B,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3F,CAAC;QAED,MAAM,IAAI,GAAG,aAAa,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;QAEhF,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SourceFile } from '../model/source-file.js';
|
|
2
|
+
import type { ClassShape } from '../structure/class-shape.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a class is a value object: it extends `ValueObject` of the kernel, a class of its own
|
|
5
|
+
* file that does, or a class imported from a value object file of the project, whose own file is
|
|
6
|
+
* judged on its own.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extendsValueObject(file: SourceFile, shape: ClassShape, sharedKernelDir: string): boolean;
|
|
9
|
+
//# sourceMappingURL=extends-value-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extends-value-object.d.ts","sourceRoot":"","sources":["../../../src/check/values/extends-value-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAI9D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAsBxG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { importedFrom } from '../support/imported-from.js';
|
|
2
|
+
import { isValueObjectFile } from './is-value-object-file.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a class is a value object: it extends `ValueObject` of the kernel, a class of its own
|
|
5
|
+
* file that does, or a class imported from a value object file of the project, whose own file is
|
|
6
|
+
* judged on its own.
|
|
7
|
+
*/
|
|
8
|
+
export function extendsValueObject(file, shape, sharedKernelDir) {
|
|
9
|
+
const seen = new Set();
|
|
10
|
+
let current = shape;
|
|
11
|
+
while (current?.superclass !== undefined && !seen.has(current.name)) {
|
|
12
|
+
const parent = current.superclass;
|
|
13
|
+
if (parent === 'ValueObject' || parent.endsWith('.ValueObject')) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
const target = importedFrom(file, parent)?.target;
|
|
17
|
+
if (target?.kind === 'file') {
|
|
18
|
+
return isValueObjectFile(target.path, target.location, sharedKernelDir);
|
|
19
|
+
}
|
|
20
|
+
seen.add(current.name);
|
|
21
|
+
current = file.structure.classes.find(({ name, depth }) => name === parent && depth === 0);
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=extends-value-object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extends-value-object.js","sourceRoot":"","sources":["../../../src/check/values/extends-value-object.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAgB,EAAE,KAAiB,EAAE,eAAuB;IAC7F,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,IAAI,OAAO,GAA2B,KAAK,CAAC;IAE5C,OAAO,OAAO,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACpE,MAAM,MAAM,GAAW,OAAO,CAAC,UAAU,CAAC;QAE1C,IAAI,MAAM,KAAK,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YAChE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAElD,IAAI,MAAM,EAAE,IAAI,KAAK,MAAM,EAAE,CAAC;YAC5B,OAAO,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC1E,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Where the body of a function lies in blanked code: a block between braces, or the expression an arrow answers. */
|
|
2
|
+
export type FunctionBody = {
|
|
3
|
+
readonly kind: 'block';
|
|
4
|
+
readonly open: number;
|
|
5
|
+
readonly close: number;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: 'expression';
|
|
8
|
+
readonly start: number;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=function-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-body.d.ts","sourceRoot":"","sources":["../../../src/check/values/function-body.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-body.js","sourceRoot":"","sources":["../../../src/check/values/function-body.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SourceFile } from '../model/source-file.js';
|
|
2
|
+
/** The command that writes a value object where the file is: in its context, or by hand in the shared kernel. */
|
|
3
|
+
export declare function generateHint(file: SourceFile, name?: string): string;
|
|
4
|
+
//# sourceMappingURL=generate-hint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-hint.d.ts","sourceRoot":"","sources":["../../../src/check/values/generate-hint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,iHAAiH;AACjH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,SAAW,GAAG,MAAM,CAMtE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The command that writes a value object where the file is: in its context, or by hand in the shared kernel. */
|
|
2
|
+
export function generateHint(file, name = '<Name>') {
|
|
3
|
+
const { location } = file;
|
|
4
|
+
return location.area === 'context'
|
|
5
|
+
? `\`npx ddd-ts-kit generate value-object ${location.context} ${name}\` writes one`
|
|
6
|
+
: '`npx ddd-ts-kit generate value-object <context> <Name>` writes one in a context, the model to follow here';
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=generate-hint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-hint.js","sourceRoot":"","sources":["../../../src/check/values/generate-hint.ts"],"names":[],"mappings":"AAEA,iHAAiH;AACjH,MAAM,UAAU,YAAY,CAAC,IAAgB,EAAE,IAAI,GAAG,QAAQ;IAC5D,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAE1B,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS;QAChC,CAAC,CAAC,0CAA0C,QAAQ,CAAC,OAAO,IAAI,IAAI,eAAe;QACnF,CAAC,CAAC,2GAA2G,CAAC;AAClH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializer-of.d.ts","sourceRoot":"","sources":["../../../src/check/values/initializer-of.ts"],"names":[],"mappings":"AAEA,0HAA0H;AAC1H,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAe9D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BRACKETS } from '../text/brackets.js';
|
|
2
|
+
/** Where the value of `export const name: Type = value` starts: after the first `=` outside brackets that is not `=>`. */
|
|
3
|
+
export function initializerOf(text) {
|
|
4
|
+
let depth = 0;
|
|
5
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
6
|
+
const char = text.charAt(i);
|
|
7
|
+
if (depth === 0 && char === '=' && !'=>'.includes(text.charAt(i + 1)) && !'=!<>'.includes(text.charAt(i - 1))) {
|
|
8
|
+
return i + 1 + (/^\s*/.exec(text.slice(i + 1))?.[0].length ?? 0);
|
|
9
|
+
}
|
|
10
|
+
depth += BRACKETS.openers.includes(char) ? 1 : 0;
|
|
11
|
+
depth -= BRACKETS.closers.includes(char) ? 1 : 0;
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=initializer-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializer-of.js","sourceRoot":"","sources":["../../../src/check/values/initializer-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,0HAA0H;AAC1H,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAE5B,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9G,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;QACnE,CAAC;QAED,KAAK,IAAI,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,KAAK,IAAI,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Location } from '../model/location.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where a value of the model may be written as a function and is looked for: `domain/` of a
|
|
4
|
+
* context, and the shared kernel outside its `presentation/`. Specs are never judged. Same table
|
|
5
|
+
* as the ESLint plugin.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isModelFile(file: string, location: Location, sharedKernelDir: string): boolean;
|
|
8
|
+
//# sourceMappingURL=is-model-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-model-file.d.ts","sourceRoot":"","sources":["../../../src/check/values/is-model-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAU9F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a value of the model may be written as a function and is looked for: `domain/` of a
|
|
3
|
+
* context, and the shared kernel outside its `presentation/`. Specs are never judged. Same table
|
|
4
|
+
* as the ESLint plugin.
|
|
5
|
+
*/
|
|
6
|
+
export function isModelFile(file, location, sharedKernelDir) {
|
|
7
|
+
if (/\.(?:spec|test)\.ts$/.test(file)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if (location.area === 'context') {
|
|
11
|
+
return location.layer === 'domain';
|
|
12
|
+
}
|
|
13
|
+
return location.area === 'shared-kernel' && !file.startsWith(`${sharedKernelDir}/presentation/`);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=is-model-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-model-file.js","sourceRoot":"","sources":["../../../src/check/values/is-model-file.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,QAAkB,EAAE,eAAuB;IACnF,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC;IACrC,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,KAAK,eAAe,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,eAAe,gBAAgB,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Location } from '../model/location.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where a value object is declared: `domain/value-objects/` of a context, or a `*.vo.ts` of the
|
|
4
|
+
* shared kernel outside its `presentation/`. Specs are never one.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isValueObjectFile(file: string, location: Location, sharedKernelDir: string): boolean;
|
|
7
|
+
//# sourceMappingURL=is-value-object-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-value-object-file.d.ts","sourceRoot":"","sources":["../../../src/check/values/is-value-object-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAYpG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a value object is declared: `domain/value-objects/` of a context, or a `*.vo.ts` of the
|
|
3
|
+
* shared kernel outside its `presentation/`. Specs are never one.
|
|
4
|
+
*/
|
|
5
|
+
export function isValueObjectFile(file, location, sharedKernelDir) {
|
|
6
|
+
if (/\.(?:spec|test)\.ts$/.test(file)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (location.area === 'context') {
|
|
10
|
+
return location.layer === 'domain' && location.inside[0] === 'value-objects';
|
|
11
|
+
}
|
|
12
|
+
return (location.area === 'shared-kernel' && file.endsWith('.vo.ts') && !file.startsWith(`${sharedKernelDir}/presentation/`));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=is-value-object-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-value-object-file.js","sourceRoot":"","sources":["../../../src/check/values/is-value-object-file.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,QAAkB,EAAE,eAAuB;IACzF,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC;IAC/E,CAAC;IAED,OAAO,CACL,QAAQ,CAAC,IAAI,KAAK,eAAe,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,eAAe,gBAAgB,CAAC,CACrH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript-globals.d.ts","sourceRoot":"","sources":["../../../src/check/values/javascript-globals.ts"],"names":[],"mappings":"AAAA,yIAAyI;AACzI,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAmBjD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** What a call of the language itself builds: a number, a string, a date, never a value of the model. Same list as the ESLint plugin. */
|
|
2
|
+
export const JAVASCRIPT_GLOBALS = new Set([
|
|
3
|
+
'Array',
|
|
4
|
+
'BigInt',
|
|
5
|
+
'Boolean',
|
|
6
|
+
'Date',
|
|
7
|
+
'Intl',
|
|
8
|
+
'JSON',
|
|
9
|
+
'Map',
|
|
10
|
+
'Math',
|
|
11
|
+
'Number',
|
|
12
|
+
'Object',
|
|
13
|
+
'RegExp',
|
|
14
|
+
'Set',
|
|
15
|
+
'String',
|
|
16
|
+
'Symbol',
|
|
17
|
+
'URL',
|
|
18
|
+
'parseFloat',
|
|
19
|
+
'parseInt',
|
|
20
|
+
'structuredClone',
|
|
21
|
+
]);
|
|
22
|
+
//# sourceMappingURL=javascript-globals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript-globals.js","sourceRoot":"","sources":["../../../src/check/values/javascript-globals.ts"],"names":[],"mappings":"AAAA,yIAAyI;AACzI,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,YAAY;IACZ,UAAU;IACV,iBAAiB;CAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal-at.d.ts","sourceRoot":"","sources":["../../../src/check/values/literal-at.ts"],"names":[],"mappings":"AAAA,6IAA6I;AAC7I,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKxE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The offset of the `{` of an object literal the expression starting at `from` is, through its parentheses; undefined for anything else. */
|
|
2
|
+
export function literalAt(code, from) {
|
|
3
|
+
const opening = /^[\s(]*/.exec(code.slice(from))?.[0].length ?? 0;
|
|
4
|
+
const at = from + opening;
|
|
5
|
+
return code.charAt(at) === '{' ? at : undefined;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=literal-at.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal-at.js","sourceRoot":"","sources":["../../../src/check/values/literal-at.ts"],"names":[],"mappings":"AAAA,6IAA6I;AAC7I,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,IAAY;IAClD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;IAClE,MAAM,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC;IAE1B,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Exported } from '../exports/exported.js';
|
|
2
|
+
/**
|
|
3
|
+
* The declaration of a name at the top of a module, read as an export would be: a function with
|
|
4
|
+
* its body, a constant up to its `;`, a class only by its kind. Undefined when the module does
|
|
5
|
+
* not declare it there.
|
|
6
|
+
*/
|
|
7
|
+
export declare function localDeclaration(code: string, name: string): Exported | undefined;
|
|
8
|
+
//# sourceMappingURL=local-declaration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-declaration.d.ts","sourceRoot":"","sources":["../../../src/check/values/local-declaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAMvD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CA+BjF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { signatureAt } from '../structure/signature-at.js';
|
|
2
|
+
import { braceDepthAt } from '../text/brace-depth-at.js';
|
|
3
|
+
import { endAtDepthZero } from '../text/end-at-depth-zero.js';
|
|
4
|
+
import { escapeRegExp } from '../text/escape-reg-exp.js';
|
|
5
|
+
/**
|
|
6
|
+
* The declaration of a name at the top of a module, read as an export would be: a function with
|
|
7
|
+
* its body, a constant up to its `;`, a class only by its kind. Undefined when the module does
|
|
8
|
+
* not declare it there.
|
|
9
|
+
*/
|
|
10
|
+
export function localDeclaration(code, name) {
|
|
11
|
+
const pattern = new RegExp(`(?<![\\w$.])(?:(?:async\\s+)?(function)\\s*\\*?\\s*|(const|let|var)\\s+|(class)\\s+)${escapeRegExp(name)}(?![\\w$])`, 'g');
|
|
12
|
+
const match = [...code.matchAll(pattern)].find(({ index }) => braceDepthAt(code, index) === 0);
|
|
13
|
+
if (match === undefined) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const at = match.index;
|
|
17
|
+
const afterName = at + match[0].length;
|
|
18
|
+
const base = { name, line: 0 };
|
|
19
|
+
if (match[3] !== undefined) {
|
|
20
|
+
return { ...base, kind: 'class', text: '', signature: '' };
|
|
21
|
+
}
|
|
22
|
+
if (match[2] !== undefined) {
|
|
23
|
+
const text = code.slice(at, endAtDepthZero(code, afterName, ';'));
|
|
24
|
+
return { ...base, kind: 'const', text, signature: text };
|
|
25
|
+
}
|
|
26
|
+
const body = signatureAt(code, code.indexOf('(', afterName));
|
|
27
|
+
return body === undefined
|
|
28
|
+
? undefined
|
|
29
|
+
: { ...base, kind: 'function', text: code.slice(at, body.bodyClose + 1), signature: code.slice(at, body.bodyOpen) };
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=local-declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-declaration.js","sourceRoot":"","sources":["../../../src/check/values/local-declaration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;GAI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,OAAO,IAAI,KAAK,SAAS;QACvB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;AACxH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A stretch of code between two braces. */
|
|
2
|
+
export type Span = readonly [open: number, close: number];
|
|
3
|
+
/**
|
|
4
|
+
* The bodies of the functions written between `from` and `to`: block arrows, function
|
|
5
|
+
* expressions and declarations, and methods of the object literals and classes found there.
|
|
6
|
+
*/
|
|
7
|
+
export declare function nestedBodies(code: string, from: number, to: number): Span[];
|
|
8
|
+
//# sourceMappingURL=nested-bodies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-bodies.d.ts","sourceRoot":"","sources":["../../../src/check/values/nested-bodies.ts"],"names":[],"mappings":"AAGA,4CAA4C;AAC5C,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAS1D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,EAAE,CAoB3E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { signatureAt } from '../structure/signature-at.js';
|
|
2
|
+
import { matchingBracket } from '../text/matching-bracket.js';
|
|
3
|
+
const ARROW = /=>\s*\{/g;
|
|
4
|
+
const FUNCTION = /(?<![\w$.])function\b[\s*]*(?:[\w$]+)?\s*(?:<[^()]*>)?\s*\(/g;
|
|
5
|
+
const METHOD = /(?<![\w$.])([A-Za-z_$][\w$]*)\s*(?:<[^()]*>)?\s*\(/g;
|
|
6
|
+
/** Words a parenthesis follows without starting a method: `if (..) {` is a block, not a body. */
|
|
7
|
+
const KEYWORDS = new Set(['if', 'for', 'while', 'switch', 'catch', 'with', 'return', 'function', 'typeof', 'await']);
|
|
8
|
+
/**
|
|
9
|
+
* The bodies of the functions written between `from` and `to`: block arrows, function
|
|
10
|
+
* expressions and declarations, and methods of the object literals and classes found there.
|
|
11
|
+
*/
|
|
12
|
+
export function nestedBodies(code, from, to) {
|
|
13
|
+
const within = (index) => index > from && index < to;
|
|
14
|
+
const arrows = [...code.matchAll(ARROW)]
|
|
15
|
+
.filter(({ index }) => within(index))
|
|
16
|
+
.map(({ index, 0: arrow }) => {
|
|
17
|
+
const open = index + arrow.length - 1;
|
|
18
|
+
return [open, matchingBracket(code, open)];
|
|
19
|
+
});
|
|
20
|
+
const functions = [...code.matchAll(FUNCTION), ...code.matchAll(METHOD)]
|
|
21
|
+
.filter((match) => within(match.index) && !KEYWORDS.has(match[1] ?? ''))
|
|
22
|
+
.flatMap((match) => {
|
|
23
|
+
const signature = signatureAt(code, match.index + match[0].length - 1);
|
|
24
|
+
return signature === undefined ? [] : [[signature.bodyOpen, signature.bodyClose]];
|
|
25
|
+
});
|
|
26
|
+
return [...arrows, ...functions];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=nested-bodies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-bodies.js","sourceRoot":"","sources":["../../../src/check/values/nested-bodies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAK9D,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,QAAQ,GAAG,8DAA8D,CAAC;AAChF,MAAM,MAAM,GAAG,qDAAqD,CAAC;AAErE,iGAAiG;AACjG,MAAM,QAAQ,GAAG,IAAI,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AEvE,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Finding } from '../model/finding.js';
|
|
2
|
+
import type { SourceFile } from '../model/source-file.js';
|
|
3
|
+
/**
|
|
4
|
+
* The exported functions of a file of the model that answer a record of data: a value of the
|
|
5
|
+
* model written as a function. A function that answers a value object, a boolean, a number, an
|
|
6
|
+
* object of functions only (a specification, a strategy), a record holding what a call of the
|
|
7
|
+
* model built, a record derived by a spread, or a type of a package is not one.
|
|
8
|
+
*/
|
|
9
|
+
export declare function plainValueFunctions(file: SourceFile): Finding[];
|
|
10
|
+
//# sourceMappingURL=plain-value-functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plain-value-functions.d.ts","sourceRoot":"","sources":["../../../src/check/values/plain-value-functions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAQ1D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,EAAE,CAwB/D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { answeredLiterals } from './answered-literals.js';
|
|
2
|
+
import { exportedFunctionBody } from './exported-function-body.js';
|
|
3
|
+
import { exportedValues } from './exported-values.js';
|
|
4
|
+
import { generateHint } from './generate-hint.js';
|
|
5
|
+
import { returnsPackageType } from './returns-package-type.js';
|
|
6
|
+
import { standsForAValue } from './stands-for-a-value.js';
|
|
7
|
+
/**
|
|
8
|
+
* The exported functions of a file of the model that answer a record of data: a value of the
|
|
9
|
+
* model written as a function. A function that answers a value object, a boolean, a number, an
|
|
10
|
+
* object of functions only (a specification, a strategy), a record holding what a call of the
|
|
11
|
+
* model built, a record derived by a spread, or a type of a package is not one.
|
|
12
|
+
*/
|
|
13
|
+
export function plainValueFunctions(file) {
|
|
14
|
+
return exportedValues(file).flatMap((exported) => {
|
|
15
|
+
const body = exportedFunctionBody(exported);
|
|
16
|
+
if (body === undefined || returnsPackageType(file, exported, body)) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const answers = answeredLiterals(exported.text, body);
|
|
20
|
+
if (!answers.some((open) => standsForAValue(exported.text, open, file.scan.code))) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const name = exported.name.charAt(0).toUpperCase() + exported.name.slice(1);
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
line: exported.line,
|
|
27
|
+
message: `${exported.name} builds a plain object: a value of the model written as a function.`,
|
|
28
|
+
fix: `Write it as a value object class (${generateHint(file, name)}): its rules checked once in a static factory, \`equals\` to compare two of them, its operations as methods next to its data. A domain service, a state machine, a specification, a function that answers value objects it builds or derives a record with a spread stays as it is.`,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=plain-value-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plain-value-functions.js","sourceRoot":"","sources":["../../../src/check/values/plain-value-functions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAgB;IAClD,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC/C,MAAM,IAAI,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAE5C,IAAI,IAAI,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;YACnE,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAClF,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAE5E,OAAO;YACL;gBACE,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,OAAO,EAAE,GAAG,QAAQ,CAAC,IAAI,qEAAqE;gBAC9F,GAAG,EAAE,qCAAqC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,qRAAqR;aACxV;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Exported } from '../exports/exported.js';
|
|
2
|
+
import type { SourceFile } from '../model/source-file.js';
|
|
3
|
+
import type { FunctionBody } from './function-body.js';
|
|
4
|
+
/**
|
|
5
|
+
* Whether a function declares that it returns a type of a package (`): EventStamp` of the kernel):
|
|
6
|
+
* the shape is the one of the library, which the project cannot make a class of its own.
|
|
7
|
+
*/
|
|
8
|
+
export declare function returnsPackageType(file: SourceFile, { text }: Exported, body: FunctionBody): boolean;
|
|
9
|
+
//# sourceMappingURL=returns-package-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"returns-package-type.d.ts","sourceRoot":"","sources":["../../../src/check/values/returns-package-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAIpG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { importedFrom } from '../support/imported-from.js';
|
|
2
|
+
/** `): EventStamp {` or `): EventStamp =>`: the return type a function declares, by the name it starts with. */
|
|
3
|
+
const RETURN_TYPE = /\)\s*:\s*([A-Za-z_$][\w$]*)[^()]*$/;
|
|
4
|
+
/**
|
|
5
|
+
* Whether a function declares that it returns a type of a package (`): EventStamp` of the kernel):
|
|
6
|
+
* the shape is the one of the library, which the project cannot make a class of its own.
|
|
7
|
+
*/
|
|
8
|
+
export function returnsPackageType(file, { text }, body) {
|
|
9
|
+
const name = RETURN_TYPE.exec(text.slice(0, body.kind === 'block' ? body.open : body.start))?.[1];
|
|
10
|
+
return name !== undefined && importedFrom(file, name)?.target.kind === 'package';
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=returns-package-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"returns-package-type.js","sourceRoot":"","sources":["../../../src/check/values/returns-package-type.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,gHAAgH;AAChH,MAAM,WAAW,GAAG,oCAAoC,CAAC;AAEzD;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAgB,EAAE,EAAE,IAAI,EAAY,EAAE,IAAkB;IACzF,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAElG,OAAO,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the object literal opening at `open` is a value of the model written as a record: it
|
|
3
|
+
* holds data (an entry that is not a function), nothing a call or `new` of the model built, and
|
|
4
|
+
* no spread. A record of value objects the function builds (`{ first: Money.of(1), rest }`) is an
|
|
5
|
+
* operation of the model; a spread (`{ ...state, status }`) derives a record that exists; an
|
|
6
|
+
* object of functions only is behaviour, a specification or a strategy. Names are read in `module`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function standsForAValue(code: string, open: number, module: string): boolean;
|
|
9
|
+
//# sourceMappingURL=stands-for-a-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stands-for-a-value.d.ts","sourceRoot":"","sources":["../../../src/check/values/stands-for-a-value.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAgBnF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { matchingBracket } from '../text/matching-bracket.js';
|
|
2
|
+
import { splitTopLevel } from '../text/split-top-level.js';
|
|
3
|
+
import { expressionRole } from './entry-role.js';
|
|
4
|
+
/** `name(..) {`, `get name() {`, `async [key](..) {`: a method of the literal. */
|
|
5
|
+
const METHOD = /^(?:async\s+)?(?:get\s+|set\s+)?\*?\s*(?:[\w$]+|'[^']*'|"[^"]*"|\[[^\]]*\])\s*(?:<[^()]*>)?\s*\(/;
|
|
6
|
+
/** `name:`, `'name':`, `[key]:`: the key of a property, before its value. */
|
|
7
|
+
const KEY = /^(?:[\w$]+|'[^']*'|"[^"]*"|\[[^\]]*\])\s*:/;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the object literal opening at `open` is a value of the model written as a record: it
|
|
10
|
+
* holds data (an entry that is not a function), nothing a call or `new` of the model built, and
|
|
11
|
+
* no spread. A record of value objects the function builds (`{ first: Money.of(1), rest }`) is an
|
|
12
|
+
* operation of the model; a spread (`{ ...state, status }`) derives a record that exists; an
|
|
13
|
+
* object of functions only is behaviour, a specification or a strategy. Names are read in `module`.
|
|
14
|
+
*/
|
|
15
|
+
export function standsForAValue(code, open, module) {
|
|
16
|
+
const roles = splitTopLevel(code.slice(open + 1, matchingBracket(code, open))).map(({ code: entry }) => {
|
|
17
|
+
if (entry.startsWith('...')) {
|
|
18
|
+
return 'spread';
|
|
19
|
+
}
|
|
20
|
+
if (METHOD.test(entry)) {
|
|
21
|
+
return 'behaviour';
|
|
22
|
+
}
|
|
23
|
+
const key = KEY.exec(entry);
|
|
24
|
+
return expressionRole(key === null ? entry : entry.slice(key[0].length), module);
|
|
25
|
+
});
|
|
26
|
+
return roles.includes('data') && !roles.includes('built') && !roles.includes('spread');
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=stands-for-a-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stands-for-a-value.js","sourceRoot":"","sources":["../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|
|
1
|
+
import type { Finding } from '../model/finding.js';
|
|
2
|
+
import type { SourceFile } from '../model/source-file.js';
|
|
3
|
+
/** What a value object file says of itself: one class extending ValueObject, built by static factories, and nothing else that stands for a value. */
|
|
4
|
+
export declare function valueObjectFileFindings(file: SourceFile, sharedKernelDir: string): Finding[];
|
|
5
|
+
//# sourceMappingURL=value-object-file-findings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-object-file-findings.d.ts","sourceRoot":"","sources":["../../../src/check/values/value-object-file-findings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAU1D,qJAAqJ;AACrJ,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,EAAE,CAoB5F"}
|