ddd-ts-kit 0.27.0 → 0.83.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +232 -0
- package/README.fr.md +186 -72
- package/README.md +177 -71
- package/dist/check/canonical/role.d.ts +2 -0
- package/dist/check/canonical/role.d.ts.map +1 -1
- package/dist/check/canonical/roles.js +1 -1
- package/dist/check/canonical/roles.js.map +1 -1
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +6 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/catalogue/default-severities.d.ts.map +1 -1
- package/dist/check/catalogue/default-severities.js +2 -0
- package/dist/check/catalogue/default-severities.js.map +1 -1
- package/dist/check/catalogue/eslint-only-rules.js +3 -3
- package/dist/check/catalogue/eslint-only-rules.js.map +1 -1
- package/dist/check/commands/check-command.d.ts.map +1 -1
- package/dist/check/commands/check-command.js +4 -1
- package/dist/check/commands/check-command.js.map +1 -1
- package/dist/check/commands/explain-command.d.ts.map +1 -1
- package/dist/check/commands/explain-command.js +2 -9
- package/dist/check/commands/explain-command.js.map +1 -1
- package/dist/check/engine/format-check.d.ts +6 -1
- package/dist/check/engine/format-check.d.ts.map +1 -1
- package/dist/check/engine/format-check.js +33 -11
- package/dist/check/engine/format-check.js.map +1 -1
- package/dist/check/errors/builds-through-factories.d.ts +4 -1
- package/dist/check/errors/builds-through-factories.d.ts.map +1 -1
- package/dist/check/errors/builds-through-factories.js +6 -2
- package/dist/check/errors/builds-through-factories.js.map +1 -1
- package/dist/check/errors/code-entry.d.ts +8 -0
- package/dist/check/errors/code-entry.d.ts.map +1 -0
- package/dist/check/errors/code-entry.js +2 -0
- package/dist/check/errors/code-entry.js.map +1 -0
- package/dist/check/errors/code-list-name.d.ts +3 -0
- package/dist/check/errors/code-list-name.d.ts.map +1 -0
- package/dist/check/errors/code-list-name.js +6 -0
- package/dist/check/errors/code-list-name.js.map +1 -0
- package/dist/check/errors/code-list.d.ts +10 -0
- package/dist/check/errors/code-list.d.ts.map +1 -0
- package/dist/check/errors/code-list.js +2 -0
- package/dist/check/errors/code-list.js.map +1 -0
- package/dist/check/errors/codes-set-in.d.ts +9 -0
- package/dist/check/errors/codes-set-in.d.ts.map +1 -0
- package/dist/check/errors/codes-set-in.js +15 -0
- package/dist/check/errors/codes-set-in.js.map +1 -0
- package/dist/check/errors/error-codes.d.ts +2 -0
- package/dist/check/errors/error-codes.d.ts.map +1 -1
- package/dist/check/errors/error-codes.js +8 -0
- package/dist/check/errors/error-codes.js.map +1 -1
- package/dist/check/errors/is-codes-file.d.ts +4 -0
- package/dist/check/errors/is-codes-file.d.ts.map +1 -0
- package/dist/check/errors/is-codes-file.js +11 -0
- package/dist/check/errors/is-codes-file.js.map +1 -0
- package/dist/check/errors/is-error-file.d.ts +4 -0
- package/dist/check/errors/is-error-file.d.ts.map +1 -0
- package/dist/check/errors/is-error-file.js +6 -0
- package/dist/check/errors/is-error-file.js.map +1 -0
- package/dist/check/errors/listed-codes.d.ts +5 -0
- package/dist/check/errors/listed-codes.d.ts.map +1 -0
- package/dist/check/errors/listed-codes.js +12 -0
- package/dist/check/errors/listed-codes.js.map +1 -0
- package/dist/check/errors/names-refusals.d.ts +4 -0
- package/dist/check/errors/names-refusals.d.ts.map +1 -0
- package/dist/check/errors/names-refusals.js +5 -0
- package/dist/check/errors/names-refusals.js.map +1 -0
- package/dist/check/errors/read-code-list.d.ts +5 -0
- package/dist/check/errors/read-code-list.d.ts.map +1 -0
- package/dist/check/errors/read-code-list.js +32 -0
- package/dist/check/errors/read-code-list.js.map +1 -0
- package/dist/check/errors/refusal-classes.d.ts +8 -0
- package/dist/check/errors/refusal-classes.d.ts.map +1 -0
- package/dist/check/errors/refusal-classes.js +9 -0
- package/dist/check/errors/refusal-classes.js.map +1 -0
- package/dist/check/event-sourcing/declared-shape.d.ts +7 -1
- package/dist/check/event-sourcing/declared-shape.d.ts.map +1 -1
- package/dist/check/event-sourcing/declared-shape.js +12 -4
- package/dist/check/event-sourcing/declared-shape.js.map +1 -1
- package/dist/check/event-sourcing/read-stored-shape.d.ts.map +1 -1
- package/dist/check/event-sourcing/read-stored-shape.js +10 -2
- package/dist/check/event-sourcing/read-stored-shape.js.map +1 -1
- package/dist/check/event-sourcing/stored-event-declaration.d.ts +2 -0
- package/dist/check/event-sourcing/stored-event-declaration.d.ts.map +1 -1
- package/dist/check/event-sourcing/stored-event-declarations.js +1 -0
- package/dist/check/event-sourcing/stored-event-declarations.js.map +1 -1
- package/dist/check/event-sourcing/stored-shape.d.ts +2 -0
- package/dist/check/event-sourcing/stored-shape.d.ts.map +1 -1
- package/dist/check/explain/documented-rule.d.ts +8 -0
- package/dist/check/explain/documented-rule.d.ts.map +1 -0
- package/dist/check/explain/documented-rule.js +14 -0
- package/dist/check/explain/documented-rule.js.map +1 -0
- package/dist/check/explain/errors-docs.d.ts.map +1 -1
- package/dist/check/explain/errors-docs.js +30 -2
- package/dist/check/explain/errors-docs.js.map +1 -1
- package/dist/check/explain/explanations-of.d.ts +5 -0
- package/dist/check/explain/explanations-of.d.ts.map +1 -0
- package/dist/check/explain/explanations-of.js +16 -0
- package/dist/check/explain/explanations-of.js.map +1 -0
- package/dist/check/explain/language-docs.js +1 -1
- package/dist/check/explain/language-docs.js.map +1 -1
- package/dist/check/explain/persistence-docs.d.ts.map +1 -1
- package/dist/check/explain/persistence-docs.js +7 -0
- package/dist/check/explain/persistence-docs.js.map +1 -1
- package/dist/check/explain/wiring-docs.d.ts.map +1 -1
- package/dist/check/explain/wiring-docs.js +13 -0
- package/dist/check/explain/wiring-docs.js.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.js +11 -0
- package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.js +78 -1
- package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
- package/dist/check/fixtures/errors-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/errors-fixtures.js +1 -1
- package/dist/check/fixtures/errors-fixtures.js.map +1 -1
- package/dist/check/fixtures/errors-route.d.ts +3 -0
- package/dist/check/fixtures/errors-route.d.ts.map +1 -0
- package/dist/check/fixtures/errors-route.js +6 -0
- package/dist/check/fixtures/errors-route.js.map +1 -0
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +2 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/named-refusal-fixtures.d.ts +4 -0
- package/dist/check/fixtures/named-refusal-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/named-refusal-fixtures.js +210 -0
- package/dist/check/fixtures/named-refusal-fixtures.js.map +1 -0
- package/dist/check/fixtures/persistence-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/persistence-fixtures.js +25 -0
- package/dist/check/fixtures/persistence-fixtures.js.map +1 -1
- package/dist/check/language/refusal-qualifiers.d.ts +8 -0
- package/dist/check/language/refusal-qualifiers.d.ts.map +1 -0
- package/dist/check/language/refusal-qualifiers.js +16 -0
- package/dist/check/language/refusal-qualifiers.js.map +1 -0
- package/dist/check/language/unknown-words.d.ts +2 -2
- package/dist/check/language/unknown-words.d.ts.map +1 -1
- package/dist/check/language/unknown-words.js +3 -2
- package/dist/check/language/unknown-words.js.map +1 -1
- package/dist/check/model/rule-explanation.d.ts +10 -0
- package/dist/check/model/rule-explanation.d.ts.map +1 -0
- package/dist/check/model/rule-explanation.js +2 -0
- package/dist/check/model/rule-explanation.js.map +1 -0
- package/dist/check/rules/authz-policy-asked.js +5 -2
- package/dist/check/rules/authz-policy-asked.js.map +1 -1
- package/dist/check/rules/declarations-port-adapter-wired.d.ts +3 -0
- package/dist/check/rules/declarations-port-adapter-wired.d.ts.map +1 -0
- package/dist/check/rules/declarations-port-adapter-wired.js +104 -0
- package/dist/check/rules/declarations-port-adapter-wired.js.map +1 -0
- package/dist/check/rules/errors-code-listed.d.ts +3 -0
- package/dist/check/rules/errors-code-listed.d.ts.map +1 -0
- package/dist/check/rules/errors-code-listed.js +160 -0
- package/dist/check/rules/errors-code-listed.js.map +1 -0
- package/dist/check/rules/errors-code-unique.d.ts.map +1 -1
- package/dist/check/rules/errors-code-unique.js +13 -8
- package/dist/check/rules/errors-code-unique.js.map +1 -1
- package/dist/check/rules/errors-known-code.d.ts.map +1 -1
- package/dist/check/rules/errors-known-code.js +17 -7
- package/dist/check/rules/errors-known-code.js.map +1 -1
- package/dist/check/rules/event-sourcing-upcaster-required.js +14 -4
- package/dist/check/rules/event-sourcing-upcaster-required.js.map +1 -1
- package/dist/check/rules/language-glossary-term.d.ts.map +1 -1
- package/dist/check/rules/language-glossary-term.js +10 -3
- package/dist/check/rules/language-glossary-term.js.map +1 -1
- package/dist/check/rules/naming-suffix.js +1 -1
- package/dist/check/rules/naming-suffix.js.map +1 -1
- package/dist/check/rules/persistence-primary-key-order.d.ts +3 -0
- package/dist/check/rules/persistence-primary-key-order.d.ts.map +1 -0
- package/dist/check/rules/persistence-primary-key-order.js +31 -0
- package/dist/check/rules/persistence-primary-key-order.js.map +1 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +16 -7
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/doctor.d.ts +4 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +20 -4
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/error-factories.d.ts +4 -2
- package/dist/commands/error-factories.d.ts.map +1 -1
- package/dist/commands/error-factories.js +74 -17
- package/dist/commands/error-factories.js.map +1 -1
- package/dist/commands/lint.d.ts +7 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +55 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/open-api-problems.js +7 -6
- package/dist/config/open-api-problems.js.map +1 -1
- package/dist/config/parse-config.d.ts.map +1 -1
- package/dist/config/parse-config.js +2 -0
- package/dist/config/parse-config.js.map +1 -1
- package/dist/config/restack-config-text.d.ts +3 -2
- package/dist/config/restack-config-text.d.ts.map +1 -1
- package/dist/config/restack-config-text.js +5 -3
- package/dist/config/restack-config-text.js.map +1 -1
- package/dist/config/serialize-config.d.ts.map +1 -1
- package/dist/config/serialize-config.js +2 -1
- package/dist/config/serialize-config.js.map +1 -1
- package/dist/config/stack.d.ts +9 -6
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -1
- package/dist/config/stack.js.map +1 -1
- package/dist/describe/context-description.d.ts +7 -2
- package/dist/describe/context-description.d.ts.map +1 -1
- package/dist/describe/exposed-by.d.ts +7 -0
- package/dist/describe/exposed-by.d.ts.map +1 -0
- package/dist/describe/exposed-by.js +11 -0
- package/dist/describe/exposed-by.js.map +1 -0
- package/dist/describe/read-errors.d.ts +3 -1
- package/dist/describe/read-errors.d.ts.map +1 -1
- package/dist/describe/read-errors.js +18 -11
- package/dist/describe/read-errors.js.map +1 -1
- package/dist/describe/read-refusals.d.ts +11 -0
- package/dist/describe/read-refusals.d.ts.map +1 -0
- package/dist/describe/read-refusals.js +41 -0
- package/dist/describe/read-refusals.js.map +1 -0
- package/dist/describe/reference-lines.d.ts.map +1 -1
- package/dist/describe/reference-lines.js +18 -2
- package/dist/describe/reference-lines.js.map +1 -1
- package/dist/docs/formerly-recorded-stored-events.d.ts +9 -0
- package/dist/docs/formerly-recorded-stored-events.d.ts.map +1 -0
- package/dist/docs/formerly-recorded-stored-events.js +17 -0
- package/dist/docs/formerly-recorded-stored-events.js.map +1 -0
- package/dist/docs/write-stored-events-lock.d.ts +3 -2
- package/dist/docs/write-stored-events-lock.d.ts.map +1 -1
- package/dist/docs/write-stored-events-lock.js +10 -4
- package/dist/docs/write-stored-events-lock.js.map +1 -1
- package/dist/doctor/diagnose.d.ts +2 -0
- package/dist/doctor/diagnose.d.ts.map +1 -1
- package/dist/doctor/diagnose.js +22 -3
- package/dist/doctor/diagnose.js.map +1 -1
- package/dist/doctor/doctor-finding.d.ts +13 -5
- package/dist/doctor/doctor-finding.d.ts.map +1 -1
- package/dist/doctor/format-diagnosis.d.ts +4 -1
- package/dist/doctor/format-diagnosis.d.ts.map +1 -1
- package/dist/doctor/format-diagnosis.js +49 -3
- package/dist/doctor/format-diagnosis.js.map +1 -1
- package/dist/doctor/in-range.d.ts +7 -0
- package/dist/doctor/in-range.d.ts.map +1 -0
- package/dist/doctor/in-range.js +90 -0
- package/dist/doctor/in-range.js.map +1 -0
- package/dist/doctor/install-findings.d.ts +11 -0
- package/dist/doctor/install-findings.d.ts.map +1 -0
- package/dist/doctor/install-findings.js +119 -0
- package/dist/doctor/install-findings.js.map +1 -0
- package/dist/doctor/node-findings.d.ts +7 -0
- package/dist/doctor/node-findings.d.ts.map +1 -0
- package/dist/doctor/node-findings.js +19 -0
- package/dist/doctor/node-findings.js.map +1 -0
- package/dist/doctor/package-findings.d.ts +2 -0
- package/dist/doctor/package-findings.d.ts.map +1 -1
- package/dist/doctor/package-findings.js +1 -1
- package/dist/doctor/package-findings.js.map +1 -1
- package/dist/doctor/submodule-findings.d.ts +7 -0
- package/dist/doctor/submodule-findings.d.ts.map +1 -0
- package/dist/doctor/submodule-findings.js +22 -0
- package/dist/doctor/submodule-findings.js.map +1 -0
- package/dist/generate/concept.d.ts.map +1 -1
- package/dist/generate/concept.js +3 -29
- package/dist/generate/concept.js.map +1 -1
- package/dist/generate/errors/add-code.d.ts +13 -0
- package/dist/generate/errors/add-code.d.ts.map +1 -0
- package/dist/generate/errors/add-code.js +18 -0
- package/dist/generate/errors/add-code.js.map +1 -0
- package/dist/generate/errors/codes-list.d.ts +10 -0
- package/dist/generate/errors/codes-list.d.ts.map +1 -0
- package/dist/generate/errors/codes-list.js +25 -0
- package/dist/generate/errors/codes-list.js.map +1 -0
- package/dist/generate/errors/error-code-pattern.d.ts +3 -0
- package/dist/generate/errors/error-code-pattern.d.ts.map +1 -0
- package/dist/generate/errors/error-code-pattern.js +3 -0
- package/dist/generate/errors/error-code-pattern.js.map +1 -0
- package/dist/generate/errors/factory-prefix.d.ts +3 -0
- package/dist/generate/errors/factory-prefix.d.ts.map +1 -0
- package/dist/generate/errors/factory-prefix.js +3 -0
- package/dist/generate/errors/factory-prefix.js.map +1 -0
- package/dist/generate/errors/named-refusal-code.d.ts +17 -0
- package/dist/generate/errors/named-refusal-code.d.ts.map +1 -0
- package/dist/generate/errors/named-refusal-code.js +42 -0
- package/dist/generate/errors/named-refusal-code.js.map +1 -0
- package/dist/generate/errors/refusal-class-name.d.ts +8 -0
- package/dist/generate/errors/refusal-class-name.d.ts.map +1 -0
- package/dist/generate/errors/refusal-class-name.js +16 -0
- package/dist/generate/errors/refusal-class-name.js.map +1 -0
- package/dist/generate/errors/refusal-factory-name.d.ts +4 -0
- package/dist/generate/errors/refusal-factory-name.d.ts.map +1 -0
- package/dist/generate/errors/refusal-factory-name.js +15 -0
- package/dist/generate/errors/refusal-factory-name.js.map +1 -0
- package/dist/generate/errors/write-named-refusal.d.ts +18 -0
- package/dist/generate/errors/write-named-refusal.d.ts.map +1 -0
- package/dist/generate/errors/write-named-refusal.js +89 -0
- package/dist/generate/errors/write-named-refusal.js.map +1 -0
- package/dist/generate/kinds/domain-error-kind.d.ts.map +1 -1
- package/dist/generate/kinds/domain-error-kind.js +12 -5
- package/dist/generate/kinds/domain-error-kind.js.map +1 -1
- package/dist/generate/kinds/error-kind.d.ts.map +1 -1
- package/dist/generate/kinds/error-kind.js +27 -12
- package/dist/generate/kinds/error-kind.js.map +1 -1
- package/dist/generate/schedule/cron-problem.d.ts.map +1 -1
- package/dist/generate/schedule/cron-problem.js +16 -1
- package/dist/generate/schedule/cron-problem.js.map +1 -1
- package/dist/generate/spoken-in-language.d.ts +9 -0
- package/dist/generate/spoken-in-language.d.ts.map +1 -0
- package/dist/generate/spoken-in-language.js +39 -0
- package/dist/generate/spoken-in-language.js.map +1 -0
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +32 -13
- package/dist/help/notes.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 +4 -3
- package/dist/help/usage.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +4 -2
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-stack.js +2 -2
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/lint/eslint-in-project.d.ts +8 -0
- package/dist/lint/eslint-in-project.d.ts.map +1 -0
- package/dist/lint/eslint-in-project.js +33 -0
- package/dist/lint/eslint-in-project.js.map +1 -0
- package/dist/lint/format-verdict.d.ts +4 -0
- package/dist/lint/format-verdict.d.ts.map +1 -0
- package/dist/lint/format-verdict.js +11 -0
- package/dist/lint/format-verdict.js.map +1 -0
- package/dist/lint/lint-run.d.ts +8 -0
- package/dist/lint/lint-run.d.ts.map +1 -0
- package/dist/lint/lint-run.js +2 -0
- package/dist/lint/lint-run.js.map +1 -0
- package/dist/lint/lint-verdict.d.ts +19 -0
- package/dist/lint/lint-verdict.d.ts.map +1 -0
- package/dist/lint/lint-verdict.js +25 -0
- package/dist/lint/lint-verdict.js.map +1 -0
- package/dist/lint/parse-lint-answer.d.ts +13 -0
- package/dist/lint/parse-lint-answer.d.ts.map +1 -0
- package/dist/lint/parse-lint-answer.js +18 -0
- package/dist/lint/parse-lint-answer.js.map +1 -0
- package/dist/migration/plan-replay.d.ts +4 -3
- package/dist/migration/plan-replay.d.ts.map +1 -1
- package/dist/migration/plan-replay.js +21 -6
- package/dist/migration/plan-replay.js.map +1 -1
- package/dist/migration/rename-branch-migrations.d.ts +13 -0
- package/dist/migration/rename-branch-migrations.d.ts.map +1 -0
- package/dist/migration/rename-branch-migrations.js +25 -0
- package/dist/migration/rename-branch-migrations.js.map +1 -0
- package/dist/migration/replay-drizzle-migrations.d.ts +6 -3
- package/dist/migration/replay-drizzle-migrations.d.ts.map +1 -1
- package/dist/migration/replay-drizzle-migrations.js +48 -4
- package/dist/migration/replay-drizzle-migrations.js.map +1 -1
- package/dist/migration/replay-plan.d.ts +8 -0
- package/dist/migration/replay-plan.d.ts.map +1 -1
- package/dist/migration/restore-migration-folder.d.ts +4 -0
- package/dist/migration/restore-migration-folder.d.ts.map +1 -0
- package/dist/migration/restore-migration-folder.js +15 -0
- package/dist/migration/restore-migration-folder.js.map +1 -0
- package/dist/package-manager/lockfiles.d.ts +2 -0
- package/dist/package-manager/lockfiles.d.ts.map +1 -1
- package/dist/package-manager/lockfiles.js +5 -0
- package/dist/package-manager/lockfiles.js.map +1 -1
- package/dist/presets/identity-refusal.js +1 -1
- package/dist/presets/identity-refusal.js.map +1 -1
- package/dist/presets/identity-terms.d.ts.map +1 -1
- package/dist/presets/identity-terms.js +30 -0
- package/dist/presets/identity-terms.js.map +1 -1
- package/dist/presets/preset-files.d.ts.map +1 -1
- package/dist/presets/preset-files.js +4 -1
- package/dist/presets/preset-files.js.map +1 -1
- package/dist/refusals/aggregates-of.d.ts +10 -0
- package/dist/refusals/aggregates-of.d.ts.map +1 -0
- package/dist/refusals/aggregates-of.js +9 -0
- package/dist/refusals/aggregates-of.js.map +1 -0
- package/dist/refusals/applied-moves.d.ts +7 -0
- package/dist/refusals/applied-moves.d.ts.map +1 -0
- package/dist/refusals/applied-moves.js +2 -0
- package/dist/refusals/applied-moves.js.map +1 -0
- package/dist/refusals/apply-named-plan.d.ts +19 -0
- package/dist/refusals/apply-named-plan.d.ts.map +1 -0
- package/dist/refusals/apply-named-plan.js +46 -0
- package/dist/refusals/apply-named-plan.js.map +1 -0
- package/dist/refusals/apply-plan.d.ts.map +1 -1
- package/dist/refusals/apply-plan.js +21 -25
- package/dist/refusals/apply-plan.js.map +1 -1
- package/dist/refusals/code-without-imports.d.ts +3 -0
- package/dist/refusals/code-without-imports.d.ts.map +1 -0
- package/dist/refusals/code-without-imports.js +9 -0
- package/dist/refusals/code-without-imports.js.map +1 -0
- package/dist/refusals/concept-error-class.d.ts +26 -0
- package/dist/refusals/concept-error-class.d.ts.map +1 -0
- package/dist/refusals/concept-error-class.js +2 -0
- package/dist/refusals/concept-error-class.js.map +1 -0
- package/dist/refusals/concept-errors.d.ts +6 -0
- package/dist/refusals/concept-errors.d.ts.map +1 -0
- package/dist/refusals/concept-errors.js +16 -0
- package/dist/refusals/concept-errors.js.map +1 -0
- package/dist/refusals/concept-imports.d.ts +8 -0
- package/dist/refusals/concept-imports.d.ts.map +1 -0
- package/dist/refusals/concept-imports.js +33 -0
- package/dist/refusals/concept-imports.js.map +1 -0
- package/dist/refusals/concept-leftovers.d.ts +5 -0
- package/dist/refusals/concept-leftovers.d.ts.map +1 -0
- package/dist/refusals/concept-leftovers.js +26 -0
- package/dist/refusals/concept-leftovers.js.map +1 -0
- package/dist/refusals/concept-named.d.ts +3 -0
- package/dist/refusals/concept-named.d.ts.map +1 -0
- package/dist/refusals/concept-named.js +13 -0
- package/dist/refusals/concept-named.js.map +1 -0
- package/dist/refusals/concerns.d.ts +16 -0
- package/dist/refusals/concerns.d.ts.map +1 -0
- package/dist/refusals/concerns.js +9 -0
- package/dist/refusals/concerns.js.map +1 -0
- package/dist/refusals/cut-factories.d.ts +7 -0
- package/dist/refusals/cut-factories.d.ts.map +1 -0
- package/dist/refusals/cut-factories.js +30 -0
- package/dist/refusals/cut-factories.js.map +1 -0
- package/dist/refusals/earlier-guidance.d.ts +8 -0
- package/dist/refusals/earlier-guidance.d.ts.map +1 -0
- package/dist/refusals/earlier-guidance.js +21 -0
- package/dist/refusals/earlier-guidance.js.map +1 -0
- package/dist/refusals/factory-for-parameter.d.ts +7 -0
- package/dist/refusals/factory-for-parameter.d.ts.map +1 -0
- package/dist/refusals/factory-for-parameter.js +17 -0
- package/dist/refusals/factory-for-parameter.js.map +1 -0
- package/dist/refusals/first-parameter.d.ts +6 -0
- package/dist/refusals/first-parameter.d.ts.map +1 -0
- package/dist/refusals/first-parameter.js +12 -0
- package/dist/refusals/first-parameter.js.map +1 -0
- package/dist/refusals/ignore-code-types.d.ts +10 -0
- package/dist/refusals/ignore-code-types.d.ts.map +1 -0
- package/dist/refusals/ignore-code-types.js +53 -0
- package/dist/refusals/ignore-code-types.js.map +1 -0
- package/dist/refusals/imports-used-by.d.ts +6 -0
- package/dist/refusals/imports-used-by.d.ts.map +1 -0
- package/dist/refusals/imports-used-by.js +32 -0
- package/dist/refusals/imports-used-by.js.map +1 -0
- package/dist/refusals/leave-origins.d.ts +10 -0
- package/dist/refusals/leave-origins.d.ts.map +1 -0
- package/dist/refusals/leave-origins.js +35 -0
- package/dist/refusals/leave-origins.js.map +1 -0
- package/dist/refusals/legacy-move.d.ts +5 -0
- package/dist/refusals/legacy-move.d.ts.map +1 -0
- package/dist/refusals/legacy-move.js +14 -0
- package/dist/refusals/legacy-move.js.map +1 -0
- package/dist/refusals/markdown-files.d.ts +4 -0
- package/dist/refusals/markdown-files.d.ts.map +1 -0
- package/dist/refusals/markdown-files.js +13 -0
- package/dist/refusals/markdown-files.js.map +1 -0
- package/dist/refusals/member-start.d.ts +3 -0
- package/dist/refusals/member-start.d.ts.map +1 -0
- package/dist/refusals/member-start.js +14 -0
- package/dist/refusals/member-start.js.map +1 -0
- package/dist/refusals/migration-targets.d.ts +3 -0
- package/dist/refusals/migration-targets.d.ts.map +1 -0
- package/dist/refusals/migration-targets.js +3 -0
- package/dist/refusals/migration-targets.js.map +1 -0
- package/dist/refusals/move-named-specs.d.ts +16 -0
- package/dist/refusals/move-named-specs.d.ts.map +1 -0
- package/dist/refusals/move-named-specs.js +119 -0
- package/dist/refusals/move-named-specs.js.map +1 -0
- package/dist/refusals/move.d.ts +6 -1
- package/dist/refusals/move.d.ts.map +1 -1
- package/dist/refusals/named-move.d.ts +23 -0
- package/dist/refusals/named-move.d.ts.map +1 -0
- package/dist/refusals/named-move.js +2 -0
- package/dist/refusals/named-move.js.map +1 -0
- package/dist/refusals/named-moves.d.ts +10 -0
- package/dist/refusals/named-moves.d.ts.map +1 -0
- package/dist/refusals/named-moves.js +64 -0
- package/dist/refusals/named-moves.js.map +1 -0
- package/dist/refusals/named-plan.d.ts +7 -0
- package/dist/refusals/named-plan.d.ts.map +1 -0
- package/dist/refusals/named-plan.js +2 -0
- package/dist/refusals/named-plan.js.map +1 -0
- package/dist/refusals/own-factory.d.ts +14 -0
- package/dist/refusals/own-factory.d.ts.map +1 -0
- package/dist/refusals/own-factory.js +38 -0
- package/dist/refusals/own-factory.js.map +1 -0
- package/dist/refusals/plan-target.d.ts +7 -0
- package/dist/refusals/plan-target.d.ts.map +1 -0
- package/dist/refusals/plan-target.js +13 -0
- package/dist/refusals/plan-target.js.map +1 -0
- package/dist/refusals/planned-refusal.d.ts +13 -0
- package/dist/refusals/planned-refusal.d.ts.map +1 -0
- package/dist/refusals/planned-refusal.js +2 -0
- package/dist/refusals/planned-refusal.js.map +1 -0
- package/dist/refusals/propose-named-plan.d.ts +25 -0
- package/dist/refusals/propose-named-plan.d.ts.map +1 -0
- package/dist/refusals/propose-named-plan.js +67 -0
- package/dist/refusals/propose-named-plan.js.map +1 -0
- package/dist/refusals/propose-plan.d.ts.map +1 -1
- package/dist/refusals/propose-plan.js +3 -19
- package/dist/refusals/propose-plan.js.map +1 -1
- package/dist/refusals/read-concept-error.d.ts +9 -0
- package/dist/refusals/read-concept-error.d.ts.map +1 -0
- package/dist/refusals/read-concept-error.js +51 -0
- package/dist/refusals/read-concept-error.js.map +1 -0
- package/dist/refusals/read-named-plan.d.ts +4 -0
- package/dist/refusals/read-named-plan.d.ts.map +1 -0
- package/dist/refusals/read-named-plan.js +57 -0
- package/dist/refusals/read-named-plan.js.map +1 -0
- package/dist/refusals/refusal-class-file.d.ts +15 -0
- package/dist/refusals/refusal-class-file.d.ts.map +1 -0
- package/dist/refusals/refusal-class-file.js +38 -0
- package/dist/refusals/refusal-class-file.js.map +1 -0
- package/dist/refusals/rename-concept.d.ts +7 -0
- package/dist/refusals/rename-concept.d.ts.map +1 -0
- package/dist/refusals/rename-concept.js +15 -0
- package/dist/refusals/rename-concept.js.map +1 -0
- package/dist/refusals/render-factory.d.ts +1 -1
- package/dist/refusals/render-factory.d.ts.map +1 -1
- package/dist/refusals/render-factory.js +3 -2
- package/dist/refusals/render-factory.js.map +1 -1
- package/dist/refusals/rewrite-concept-usages.d.ts +11 -0
- package/dist/refusals/rewrite-concept-usages.d.ts.map +1 -0
- package/dist/refusals/rewrite-concept-usages.js +61 -0
- package/dist/refusals/rewrite-concept-usages.js.map +1 -0
- package/dist/refusals/rewrite-named-usages.d.ts +9 -0
- package/dist/refusals/rewrite-named-usages.d.ts.map +1 -0
- package/dist/refusals/rewrite-named-usages.js +14 -0
- package/dist/refusals/rewrite-named-usages.js.map +1 -0
- package/dist/refusals/rewrite-usages.d.ts.map +1 -1
- package/dist/refusals/rewrite-usages.js +10 -6
- package/dist/refusals/rewrite-usages.js.map +1 -1
- package/dist/refusals/say-refusals.d.ts +3 -0
- package/dist/refusals/say-refusals.d.ts.map +1 -0
- package/dist/refusals/say-refusals.js +8 -0
- package/dist/refusals/say-refusals.js.map +1 -0
- package/dist/refusals/split-concept-spec.d.ts +19 -0
- package/dist/refusals/split-concept-spec.d.ts.map +1 -0
- package/dist/refusals/split-concept-spec.js +74 -0
- package/dist/refusals/split-concept-spec.js.map +1 -0
- package/dist/refusals/stale-mentions.d.ts +10 -0
- package/dist/refusals/stale-mentions.d.ts.map +1 -0
- package/dist/refusals/stale-mentions.js +41 -0
- package/dist/refusals/stale-mentions.js.map +1 -0
- package/dist/refusals/undefined-words.d.ts +15 -0
- package/dist/refusals/undefined-words.d.ts.map +1 -0
- package/dist/refusals/undefined-words.js +26 -0
- package/dist/refusals/undefined-words.js.map +1 -0
- package/dist/refusals/with-codes.d.ts +11 -0
- package/dist/refusals/with-codes.d.ts.map +1 -0
- package/dist/refusals/with-codes.js +46 -0
- package/dist/refusals/with-codes.js.map +1 -0
- package/dist/refusals/with-imports.d.ts +3 -0
- package/dist/refusals/with-imports.d.ts.map +1 -0
- package/dist/refusals/with-imports.js +8 -0
- package/dist/refusals/with-imports.js.map +1 -0
- package/dist/refusals/write-refusal-classes.d.ts +9 -0
- package/dist/refusals/write-refusal-classes.d.ts.map +1 -0
- package/dist/refusals/write-refusal-classes.js +23 -0
- package/dist/refusals/write-refusal-classes.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- package/dist/stack/stack-vars.js +1 -1
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/templates/aggregate/aggregate.ts.tpl +3 -0
- package/templates/aggregate/event-sourced.aggregate.ts.tpl +3 -0
- package/templates/command/handler.declared.ts.tpl +3 -0
- package/templates/command/handler.ts.tpl +3 -0
- package/templates/entity/entity.ts.tpl +3 -0
- package/templates/error/codes.ts.tpl +5 -0
- package/templates/error/refusal-case.spec.ts.tpl +8 -0
- package/templates/error/refusal-factory.ts.tpl +4 -0
- package/templates/error/refusal.spec.ts.tpl +7 -0
- package/templates/error/refusal.ts.tpl +8 -0
- package/templates/init/rules/domain.md.tpl +9 -2
- package/templates/init/rules/presentation.md.tpl +3 -0
- package/templates/pipeline/knip.json.tpl +5 -0
- package/templates/pipeline/package-scripts.json +3 -3
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +22 -0
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +10 -0
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +10 -0
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +10 -0
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/aggregates/account.aggregate.ts.tpl +16 -0
- package/templates/presets/identity/context/domain/aggregates/delegation.aggregate.ts.tpl +28 -0
- package/templates/presets/identity/context/domain/aggregates/invitation.aggregate.ts.tpl +27 -0
- package/templates/presets/identity/context/domain/aggregates/member.aggregate.ts.tpl +31 -0
- package/templates/presets/identity/context/domain/errors/above-own-role.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/account-already-deactivated.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/already-member.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/codes.named.ts.tpl +33 -0
- package/templates/presets/identity/context/domain/errors/deactivated-account.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/delegation-not-active.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/delegation-period-inverted.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/delegation-to-oneself.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/delegation-too-long.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/delegation-with-no-right.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/email-not-verified.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/invalid-display-name.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/invalid-email-address.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/invalid-organisation-name.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/invalid-organisation-slug.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/invitation-expired.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/invitation-not-addressed-to-account.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/invitation-not-pending.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/last-owner.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/not-an-owner.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/organisation-slug-taken.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/own-role.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/right-not-in-role.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/unknown-account.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/unknown-delegation.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/unknown-invitation.error.named.ts.tpl +11 -0
- package/templates/presets/identity/context/domain/errors/unknown-member.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/unknown-organisation.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/value-objects/delegation-period.vo.ts.tpl +16 -0
- package/templates/presets/identity/context/domain/value-objects/display-name.vo.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/value-objects/email-address.vo.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/value-objects/organisation-name.vo.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/value-objects/organisation-slug.vo.ts.tpl +10 -0
- package/templates/state-machine/state-machine.ts.tpl +5 -0
- package/templates/value-object/value-object.ts.tpl +6 -0
- /package/templates/presets/identity/context/domain/errors/{account.error.ts.tpl → account.error.factories.ts.tpl} +0 -0
- /package/templates/presets/identity/context/domain/errors/{delegation.error.ts.tpl → delegation.error.factories.ts.tpl} +0 -0
- /package/templates/presets/identity/context/domain/errors/{invitation.error.ts.tpl → invitation.error.factories.ts.tpl} +0 -0
- /package/templates/presets/identity/context/domain/errors/{member.error.ts.tpl → member.error.factories.ts.tpl} +0 -0
- /package/templates/presets/identity/context/domain/errors/{organisation.error.ts.tpl → organisation.error.factories.ts.tpl} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset-files.d.ts","sourceRoot":"","sources":["../../src/presets/preset-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"preset-files.d.ts","sourceRoot":"","sources":["../../src/presets/preset-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAuBnD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,EAAE,CAevG"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { listTemplates } from '../templating/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* The variants a template is written for, by the segments before its extension:
|
|
4
|
-
* `account.mapper.knex.ts.tpl`, `open-organisation.accepted.class-validator.per-route.ts.tpl
|
|
4
|
+
* `account.mapper.knex.ts.tpl`, `open-organisation.accepted.class-validator.per-route.ts.tpl`,
|
|
5
|
+
* `unknown-account.error.named.ts.tpl`.
|
|
5
6
|
*/
|
|
6
7
|
const VARIANTS = {
|
|
7
8
|
knex: (config) => config.stack.orm === 'knex',
|
|
@@ -10,6 +11,8 @@ const VARIANTS = {
|
|
|
10
11
|
'class-validator': (config) => config.stack.validation === 'class-validator',
|
|
11
12
|
'per-route': (config) => config.stack.schemas === 'per-route',
|
|
12
13
|
shared: (config) => config.stack.schemas === 'shared',
|
|
14
|
+
named: (config) => config.stack.refusals === 'named',
|
|
15
|
+
factories: (config) => config.stack.refusals === 'factories',
|
|
13
16
|
};
|
|
14
17
|
const NAMES = Object.keys(VARIANTS).join('|');
|
|
15
18
|
/** One variant segment, followed by others or by the extension only. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset-files.js","sourceRoot":"","sources":["../../src/presets/preset-files.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD
|
|
1
|
+
{"version":3,"file":"preset-files.js","sourceRoot":"","sources":["../../src/presets/preset-files.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD;;;;GAIG;AACH,MAAM,QAAQ,GAA0D;IACtE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,MAAM;IAC7C,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,SAAS;IACnD,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,KAAK,KAAK;IAClD,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,KAAK,iBAAiB;IAC5E,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,WAAW;IAC7D,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,QAAQ;IACrD,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO;IACpD,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,KAAK,WAAW;CAC7D,CAAC;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0,0 +1,10 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { Workspace } from '../workspace/index.js';
|
|
3
|
+
interface Tree {
|
|
4
|
+
readonly ws: Workspace;
|
|
5
|
+
readonly config: Config;
|
|
6
|
+
}
|
|
7
|
+
/** The names of the aggregates of a context, in PascalCase. */
|
|
8
|
+
export declare function aggregatesOf({ ws, config }: Tree, context: string): string[];
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=aggregates-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregates-of.d.ts","sourceRoot":"","sources":["../../src/refusals/aggregates-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,UAAU,IAAI;IACZ,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAK5E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { toName } from '../naming/index.js';
|
|
2
|
+
/** The names of the aggregates of a context, in PascalCase. */
|
|
3
|
+
export function aggregatesOf({ ws, config }, context) {
|
|
4
|
+
return ws
|
|
5
|
+
.list(`${config.contextsDir}/${context}/domain/aggregates`)
|
|
6
|
+
.filter((name) => name.endsWith('.aggregate.ts'))
|
|
7
|
+
.map((name) => toName(name.replace(/\.aggregate\.ts$/, '')).pascal);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=aggregates-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregates-of.js","sourceRoot":"","sources":["../../src/refusals/aggregates-of.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAQ5C,+DAA+D;AAC/D,MAAM,UAAU,YAAY,CAAC,EAAE,EAAE,EAAE,MAAM,EAAQ,EAAE,OAAe;IAChE,OAAO,EAAE;SACN,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,IAAI,OAAO,oBAAoB,CAAC;SAC1D,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;SAChD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NamedMove } from './named-move.js';
|
|
2
|
+
/** The moves a plan to the named form made, and the concept classes they left empty, which nothing may name any more. */
|
|
3
|
+
export interface AppliedMoves {
|
|
4
|
+
readonly moves: readonly NamedMove[];
|
|
5
|
+
readonly gone: ReadonlySet<string>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=applied-moves.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applied-moves.d.ts","sourceRoot":"","sources":["../../src/refusals/applied-moves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,yHAAyH;AACzH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applied-moves.js","sourceRoot":"","sources":["../../src/refusals/applied-moves.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Config } from '../config/index.js';
|
|
2
|
+
import type { Workspace } from '../workspace/index.js';
|
|
3
|
+
import type { MigrationDraft } from './migration-draft.js';
|
|
4
|
+
import type { NamedMove } from './named-move.js';
|
|
5
|
+
import type { NamedPlan } from './named-plan.js';
|
|
6
|
+
interface Tree {
|
|
7
|
+
readonly ws: Workspace;
|
|
8
|
+
readonly config: Config;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Follows a plan to the named form: each refusal gets a class of its own, whose code is read from
|
|
12
|
+
* the `codes.ts` of its context, with its factory; the classes per error go, the concept classes
|
|
13
|
+
* left empty go, the specs follow, every file that named them follows, and the config says the
|
|
14
|
+
* project names its refusals, as knip is told. What the guides and the documents still say of the
|
|
15
|
+
* earlier form is said. Answers the moves it made.
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyNamedPlan(tree: Tree, plan: NamedPlan, draft: MigrationDraft): NamedMove[];
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=apply-named-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-named-plan.d.ts","sourceRoot":"","sources":["../../src/refusals/apply-named-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,MAAM,EAAkB,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAOjD,UAAU,IAAI;IACZ,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,GAAG,SAAS,EAAE,CAc9F"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CONFIG_FILE, editConfigText } from '../config/index.js';
|
|
2
|
+
import { conceptErrors } from './concept-errors.js';
|
|
3
|
+
import { concerns } from './concerns.js';
|
|
4
|
+
import { earlierGuidance } from './earlier-guidance.js';
|
|
5
|
+
import { ignoreCodeTypes } from './ignore-code-types.js';
|
|
6
|
+
import { leaveOrigins } from './leave-origins.js';
|
|
7
|
+
import { legacyErrors } from './legacy-errors.js';
|
|
8
|
+
import { moveNamedSpecs } from './move-named-specs.js';
|
|
9
|
+
import { namedMoves } from './named-moves.js';
|
|
10
|
+
import { projectSources } from './project-sources.js';
|
|
11
|
+
import { rewriteNamedUsages } from './rewrite-named-usages.js';
|
|
12
|
+
import { sayRefusals } from './say-refusals.js';
|
|
13
|
+
import { staleMentions } from './stale-mentions.js';
|
|
14
|
+
import { writeRefusalClasses } from './write-refusal-classes.js';
|
|
15
|
+
/**
|
|
16
|
+
* Follows a plan to the named form: each refusal gets a class of its own, whose code is read from
|
|
17
|
+
* the `codes.ts` of its context, with its factory; the classes per error go, the concept classes
|
|
18
|
+
* left empty go, the specs follow, every file that named them follows, and the config says the
|
|
19
|
+
* project names its refusals, as knip is told. What the guides and the documents still say of the
|
|
20
|
+
* earlier form is said. Answers the moves it made.
|
|
21
|
+
*/
|
|
22
|
+
export function applyNamedPlan(tree, plan, draft) {
|
|
23
|
+
const sources = { legacy: legacyErrors(tree.ws, tree.config), concepts: conceptErrors(tree.ws, tree.config) };
|
|
24
|
+
const moves = namedMoves(plan, sources, draft);
|
|
25
|
+
const gone = leaveOrigins(moves, sources, draft);
|
|
26
|
+
writeRefusalClasses(tree.config, moves, draft);
|
|
27
|
+
moveNamedSpecs(tree.config, { moves, sources }, draft);
|
|
28
|
+
rewriteProject(tree, { moves, gone }, draft);
|
|
29
|
+
draft.write(CONFIG_FILE, editConfigText(draft.read(CONFIG_FILE) ?? '{}', sayRefusals('named')));
|
|
30
|
+
ignoreCodeTypes(tree.config, draft);
|
|
31
|
+
earlierGuidance(draft);
|
|
32
|
+
staleMentions(tree.ws, { moves, gone }, draft);
|
|
33
|
+
return moves;
|
|
34
|
+
}
|
|
35
|
+
function rewriteProject({ ws, config }, applied, draft) {
|
|
36
|
+
const removed = new Set(draft.removed);
|
|
37
|
+
for (const file of projectSources(ws, config).filter((candidate) => !removed.has(candidate))) {
|
|
38
|
+
const source = draft.read(file) ?? '';
|
|
39
|
+
const moves = applied.moves.filter((move) => concerns({ context: move.context, path: move.oldPath }, { file, source }, config));
|
|
40
|
+
const told = (line, note) => {
|
|
41
|
+
draft.manual.push(`${file}:${line}: ${note}`);
|
|
42
|
+
};
|
|
43
|
+
draft.write(file, rewriteNamedUsages(source, { moves, gone: applied.gone }, told));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=apply-named-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-named-plan.js","sourceRoot":"","sources":["../../src/refusals/apply-named-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,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AAC;IAE/C,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,EAAE,EAAE,MAAM,EAAQ,EAAE,OAAqB,EAAE,KAAqB;IACxF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEvC,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QAC7F,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC1C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,CAClF,CAAC;QAEF,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,IAAY,EAAQ,EAAE;YAChD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC;QAEF,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,kBAAkB,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IACrF,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../src/refusals/apply-plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../src/refusals/apply-plan.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAK9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AASrD,UAAU,IAAI;IACZ,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,GAAG,WAAW,EAAE,CAgC/F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { CliError } from '../cli-error.js';
|
|
1
2
|
import { CONFIG_FILE, editConfigText } from '../config/index.js';
|
|
2
|
-
import { isRecord } from '../check/support/is-record.js';
|
|
3
3
|
import { addFactory } from '../generate/errors/add-factory.js';
|
|
4
4
|
import { addSpecCase } from '../generate/errors/add-spec-case.js';
|
|
5
5
|
import { fitSource } from '../layout/index.js';
|
|
@@ -7,9 +7,12 @@ import { toName } from '../naming/index.js';
|
|
|
7
7
|
import { legacyErrors } from './legacy-errors.js';
|
|
8
8
|
import { nestedCases } from './nested-cases.js';
|
|
9
9
|
import { projectSources } from './project-sources.js';
|
|
10
|
+
import { concerns } from './concerns.js';
|
|
11
|
+
import { sayRefusals } from './say-refusals.js';
|
|
10
12
|
import { renderFactory } from './render-factory.js';
|
|
11
13
|
import { rewriteUsages } from './rewrite-usages.js';
|
|
12
14
|
import { specParts } from './spec-parts.js';
|
|
15
|
+
import { withImports } from './with-imports.js';
|
|
13
16
|
/**
|
|
14
17
|
* Follows the plan: each class per error becomes a factory of the error class of its concept,
|
|
15
18
|
* its spec becomes cases of the spec of that class, every file that named it follows, and the
|
|
@@ -27,24 +30,11 @@ export function applyPlan(tree, plan, draft) {
|
|
|
27
30
|
draft.manual.push(`${file}: ${conceptClass} stands where ${className} stood as a value: assert the code of the refusal there.`);
|
|
28
31
|
};
|
|
29
32
|
const source = draft.read(file) ?? '';
|
|
30
|
-
draft.write(file, rewriteUsages(source, all.filter((move) => concerns(move, { file, source }, tree.config)), told));
|
|
33
|
+
draft.write(file, rewriteUsages(source, all.filter((move) => concerns({ context: move.context, path: move.legacyPath }, { file, source }, tree.config)), told));
|
|
31
34
|
}
|
|
32
|
-
draft.write(CONFIG_FILE, editConfigText(draft.read(CONFIG_FILE) ?? '{}',
|
|
35
|
+
draft.write(CONFIG_FILE, editConfigText(draft.read(CONFIG_FILE) ?? '{}', sayRefusals('factories')));
|
|
33
36
|
return moves;
|
|
34
37
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Two contexts may name a class the same way: a move concerns the files of its own context, and
|
|
37
|
-
* elsewhere the files that import the class from that context.
|
|
38
|
-
*/
|
|
39
|
-
function concerns(move, { file, source }, config) {
|
|
40
|
-
const contexts = `${config.contextsDir}/`;
|
|
41
|
-
return file.startsWith(contexts)
|
|
42
|
-
? file.startsWith(`${contexts}${move.context}/`)
|
|
43
|
-
: source.includes(`/${move.legacyPath}`);
|
|
44
|
-
}
|
|
45
|
-
function sayFactories(raw) {
|
|
46
|
-
raw['stack'] = { ...(isRecord(raw['stack']) ? raw['stack'] : {}), refusals: 'factories' };
|
|
47
|
-
}
|
|
48
38
|
/** The classes still there whose plan entry says where they go; one that cannot move mechanically is said, and left. */
|
|
49
39
|
function plannedMoves({ ws, config }, plan, draft) {
|
|
50
40
|
return legacyErrors(ws, config).flatMap((error) => {
|
|
@@ -78,6 +68,10 @@ function moveClass({ config }, { error, move }, draft) {
|
|
|
78
68
|
name: move.factory,
|
|
79
69
|
text: factory,
|
|
80
70
|
});
|
|
71
|
+
// The draft is not committed yet: refusing here writes nothing of the move.
|
|
72
|
+
if (next === undefined) {
|
|
73
|
+
throw new CliError(`${target} holds another class than ${move.conceptClass}.`, `Give ${error.className} another concept in the plan, or move what ${target} holds to a file of its own, then run \`ddd-ts-kit error-factories --apply\` again.`);
|
|
74
|
+
}
|
|
81
75
|
if (error.parameters.length > 3) {
|
|
82
76
|
draft.manual.push(`${target}: ${move.conceptClass}.${move.factory} takes more than three parameters, give it one typed object.`);
|
|
83
77
|
}
|
|
@@ -85,10 +79,14 @@ function moveClass({ config }, { error, move }, draft) {
|
|
|
85
79
|
draft.manual.push(`${error.className}.${property} was a property of the error: read \`error.facts.${property}\` where it was read.`);
|
|
86
80
|
}
|
|
87
81
|
draft.remove(error.file);
|
|
88
|
-
draft.write(target, fitSource(next
|
|
82
|
+
draft.write(target, fitSource(next));
|
|
89
83
|
moveSpec(context, { error, move }, draft);
|
|
90
84
|
}
|
|
91
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* The spec of the class, rewritten as any other file, becomes the cases of its factory in the spec
|
|
87
|
+
* of the concept class. A spec of the concept class without a `describe` takes no case: the spec of
|
|
88
|
+
* the class stays, and is said.
|
|
89
|
+
*/
|
|
92
90
|
function moveSpec(context, { error, move }, draft) {
|
|
93
91
|
const old = `${context}/test/unit/${baseName(error.file).replace(/\.ts$/, '.spec.ts')}`;
|
|
94
92
|
const source = draft.read(old);
|
|
@@ -103,14 +101,12 @@ function moveSpec(context, { error, move }, draft) {
|
|
|
103
101
|
}
|
|
104
102
|
const existing = draft.read(target) ?? `${imports.join('')}\ndescribe('${move.conceptClass}', () => {\n});\n`;
|
|
105
103
|
const merged = addSpecCase(withImports(existing, imports), `describe('${move.factory}'`, nestedCases(move.factory, cases));
|
|
104
|
+
if (merged === undefined) {
|
|
105
|
+
draft.manual.push(`${target}: no describe block was found, move the cases of ${old} to it by hand.`);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
106
108
|
draft.remove(old);
|
|
107
|
-
draft.write(target, merged
|
|
108
|
-
}
|
|
109
|
-
function withImports(spec, imports) {
|
|
110
|
-
const missing = imports.filter((line) => !spec.includes(line));
|
|
111
|
-
const last = [...spec.matchAll(/^import [^;]+;\n/gm)].at(-1);
|
|
112
|
-
const at = last === undefined ? 0 : last.index + last[0].length;
|
|
113
|
-
return spec.slice(0, at) + missing.join('') + spec.slice(at);
|
|
109
|
+
draft.write(target, merged);
|
|
114
110
|
}
|
|
115
111
|
function baseName(file) {
|
|
116
112
|
return file.slice(file.lastIndexOf('/') + 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-plan.js","sourceRoot":"","sources":["../../src/refusals/apply-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"apply-plan.js","sourceRoot":"","sources":["../../src/refusals/apply-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,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C,CAAC;QAE/F,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,IAAI,CAAC,YAAY,mBAAmB,CAAC;IAE9G,MAAM,MAAM,GAAG,WAAW,CACxB,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,EAC9B,aAAa,IAAI,CAAC,OAAO,GAAG,EAC5B,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CACjC,CAAC;IAEF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,oDAAoD,GAAG,iBAAiB,CAAC,CAAC;QAErG,OAAO;IACT,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClB,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-without-imports.d.ts","sourceRoot":"","sources":["../../src/refusals/code-without-imports.ts"],"names":[],"mappings":"AAEA,yHAAyH;AACzH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKzD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { scan } from '../check/scan/scan.js';
|
|
2
|
+
/** The code of a source, comments and the contents of strings blanked, and its import lines too: what the file reads. */
|
|
3
|
+
export function codeWithoutImports(source) {
|
|
4
|
+
return scan(source)
|
|
5
|
+
.code.split('\n')
|
|
6
|
+
.map((line) => (/^\s*import\s/.test(line) ? '' : line))
|
|
7
|
+
.join('\n');
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=code-without-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-without-imports.js","sourceRoot":"","sources":["../../src/refusals/code-without-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,yHAAyH;AACzH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,OAAO,IAAI,CAAC,MAAM,CAAC;SAChB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;SAChB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SACtD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** One static factory of an error class per concept, as much of it as a class of its own needs. */
|
|
2
|
+
export interface ConceptFactory {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
/** Its first parameter, what the refusal is about; undefined when it has none or destructures it. */
|
|
5
|
+
readonly parameter: string | undefined;
|
|
6
|
+
/** The code it gives to `refusal(..)`, when that is one string literal. */
|
|
7
|
+
readonly code: string | undefined;
|
|
8
|
+
/** Where the method starts, its comments above included, and the offset of its closing brace. */
|
|
9
|
+
readonly start: number;
|
|
10
|
+
readonly end: number;
|
|
11
|
+
/** The method as written, its comments above included, indented as a member. */
|
|
12
|
+
readonly text: string;
|
|
13
|
+
/** Why it cannot become the factory of a class of its own mechanically, when it cannot. */
|
|
14
|
+
readonly manual?: string;
|
|
15
|
+
}
|
|
16
|
+
/** An error class per concept (`AppointmentError extends ConceptError`) and its factories. */
|
|
17
|
+
export interface ConceptErrorClass {
|
|
18
|
+
readonly file: string;
|
|
19
|
+
readonly context: string;
|
|
20
|
+
/** For example `AppointmentError`. */
|
|
21
|
+
readonly className: string;
|
|
22
|
+
readonly factories: readonly ConceptFactory[];
|
|
23
|
+
/** The import lines of its file: a factory may read a type or a value of another file. */
|
|
24
|
+
readonly imports: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=concept-error-class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-error-class.d.ts","sourceRoot":"","sources":["../../src/refusals/concept-error-class.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,iGAAiG;IACjG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,8FAA8F;AAC9F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;IAC9C,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-error-class.js","sourceRoot":"","sources":["../../src/refusals/concept-error-class.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { Workspace } from '../workspace/index.js';
|
|
3
|
+
import type { ConceptErrorClass } from './concept-error-class.js';
|
|
4
|
+
/** Every error class per concept of the `domain/errors/` of every context, in the order of their files. */
|
|
5
|
+
export declare function conceptErrors(ws: Workspace, config: Config): ConceptErrorClass[];
|
|
6
|
+
//# sourceMappingURL=concept-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-errors.d.ts","sourceRoot":"","sources":["../../src/refusals/concept-errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,2GAA2G;AAC3G,wBAAgB,aAAa,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAchF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { readConceptError } from './read-concept-error.js';
|
|
2
|
+
/** Every error class per concept of the `domain/errors/` of every context, in the order of their files. */
|
|
3
|
+
export function conceptErrors(ws, config) {
|
|
4
|
+
return Object.keys(config.contexts).flatMap((context) => {
|
|
5
|
+
const directory = `${config.contextsDir}/${context}/domain/errors`;
|
|
6
|
+
return ws
|
|
7
|
+
.list(directory)
|
|
8
|
+
.filter((name) => name.endsWith('.error.ts'))
|
|
9
|
+
.flatMap((name) => {
|
|
10
|
+
const file = `${directory}/${name}`;
|
|
11
|
+
const read = readConceptError(ws.read(file) ?? '', { file, context });
|
|
12
|
+
return read === undefined ? [] : [read];
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=concept-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-errors.js","sourceRoot":"","sources":["../../src/refusals/concept-errors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,2GAA2G;AAC3G,MAAM,UAAU,aAAa,CAAC,EAAa,EAAE,MAAc;IACzD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACtD,MAAM,SAAS,GAAG,GAAG,MAAM,CAAC,WAAW,IAAI,OAAO,gBAAgB,CAAC;QAEnE,OAAO,EAAE;aACN,IAAI,CAAC,SAAS,CAAC;aACf,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;aAC5C,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,IAAI,GAAG,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,GAAG,gBAAgB,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAEtE,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NamedMove } from './named-move.js';
|
|
2
|
+
/**
|
|
3
|
+
* The import of a concept class becomes the imports of the classes of their own the file reads,
|
|
4
|
+
* from the files next to it, in the form it was written (alias or relative path, extension). It
|
|
5
|
+
* stays when the file still names the concept class.
|
|
6
|
+
*/
|
|
7
|
+
export declare function conceptImports(source: string, concept: string, moves: readonly NamedMove[]): string;
|
|
8
|
+
//# sourceMappingURL=concept-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-imports.d.ts","sourceRoot":"","sources":["../../src/refusals/concept-imports.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CASnG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { escapeRegExp } from '../check/text/escape-reg-exp.js';
|
|
2
|
+
import { codeWithoutImports } from './code-without-imports.js';
|
|
3
|
+
import { replaceInCode } from './replace-in-code.js';
|
|
4
|
+
/**
|
|
5
|
+
* The import of a concept class becomes the imports of the classes of their own the file reads,
|
|
6
|
+
* from the files next to it, in the form it was written (alias or relative path, extension). It
|
|
7
|
+
* stays when the file still names the concept class.
|
|
8
|
+
*/
|
|
9
|
+
export function conceptImports(source, concept, moves) {
|
|
10
|
+
const pattern = new RegExp(`import\\s+(type\\s+)?\\{\\s*${escapeRegExp(concept)}\\s*\\}\\s*from\\s*`, 'g');
|
|
11
|
+
const code = codeWithoutImports(source);
|
|
12
|
+
const reads = (name) => new RegExp(`(?<![\\w$.])${escapeRegExp(name)}(?![\\w$])`).test(code);
|
|
13
|
+
const imported = (name) => new RegExp(`^import [^;]*\\{[^}]*\\b${name}\\b`, 'm').test(source);
|
|
14
|
+
const classes = [...new Map(moves.map((move) => [move.className, move])).values()];
|
|
15
|
+
const needed = classes.filter((move) => reads(move.className) && !imported(move.className));
|
|
16
|
+
return replaceInCode(source, pattern, (found) => replaced(found, { kept: reads(concept), needed }));
|
|
17
|
+
}
|
|
18
|
+
function replaced(found, { kept, needed }) {
|
|
19
|
+
const { match, scanned } = found;
|
|
20
|
+
const start = match.index + match[0].length;
|
|
21
|
+
const specifier = scanned.strings.find((literal) => literal.start === start);
|
|
22
|
+
if (specifier === undefined) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const semicolon = scanned.code.charAt(specifier.end) === ';' ? specifier.end + 1 : specifier.end;
|
|
26
|
+
const lines = needed.map((move) => `import ${match[1] ?? ''}{ ${move.className} } from '${specifier.value.replace(/[^/]+?\.error((?:\.js)?)$/, `${move.classFile}$1`)}';`);
|
|
27
|
+
const all = kept ? [found.slice(match.index, semicolon), ...lines] : lines;
|
|
28
|
+
// An import nothing replaces goes with its line.
|
|
29
|
+
return all.length === 0
|
|
30
|
+
? { text: '', end: scanned.code.charAt(semicolon) === '\n' ? semicolon + 1 : semicolon }
|
|
31
|
+
: { text: all.join('\n'), end: semicolon };
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=concept-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-imports.js","sourceRoot":"","sources":["../../src/refusals/concept-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAkB,MAAM,sBAAsB,CAAC;AAErE;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,OAAe,EAAE,KAA2B;IACzF,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,+BAA+B,YAAY,CAAC,OAAO,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;IAC3G,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,IAAI,MAAM,CAAC,eAAe,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9G,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,IAAI,MAAM,CAAC,2BAA2B,IAAI,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/G,MAAM,OAAO,GAAG,CAAC,GAA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,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,SAAS,YAAY,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,2BAA2B,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CACzI,CAAC;IAEF,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAE3E,iDAAiD;IACjD,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC;QACrB,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;QACxF,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Told what still names a concept class that is gone, with its line: what to write there is a decision. */
|
|
2
|
+
export type OnLeft = (line: number, note: string) => void;
|
|
3
|
+
/** Tells every place of the code that still names `concept`, its import lines aside. */
|
|
4
|
+
export declare function conceptLeftovers(source: string, concept: string, onLeft: OnLeft): void;
|
|
5
|
+
//# sourceMappingURL=concept-leftovers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-leftovers.d.ts","sourceRoot":"","sources":["../../src/refusals/concept-leftovers.ts"],"names":[],"mappings":"AAGA,4GAA4G;AAC5G,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AAI1D,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CActF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { scan } from '../check/scan/scan.js';
|
|
2
|
+
import { escapeRegExp } from '../check/text/escape-reg-exp.js';
|
|
3
|
+
const IMPORT_LINE = /^\s*import\s/;
|
|
4
|
+
/** Tells every place of the code that still names `concept`, its import lines aside. */
|
|
5
|
+
export function conceptLeftovers(source, concept, onLeft) {
|
|
6
|
+
const scanned = scan(source);
|
|
7
|
+
const name = escapeRegExp(concept);
|
|
8
|
+
for (const match of scanned.code.matchAll(new RegExp(`(?<![\\w$.])${name}(?![\\w$])`, 'g'))) {
|
|
9
|
+
const lineStart = scanned.code.lastIndexOf('\n', match.index - 1) + 1;
|
|
10
|
+
if (!IMPORT_LINE.test(scanned.code.slice(lineStart, match.index))) {
|
|
11
|
+
const before = scanned.code.slice(lineStart, match.index);
|
|
12
|
+
const after = scanned.code.slice(match.index + match[0].length);
|
|
13
|
+
onLeft(scanned.lineAt(match.index), noteOn(concept, { before, after }));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function noteOn(concept, { before, after }) {
|
|
18
|
+
if (/CodeOf\s*<\s*typeof\s+$/.test(before)) {
|
|
19
|
+
return `\`CodeOf<typeof ${concept}>\` names the codes of a class that is gone: write the union of the codes it means, or the code type of codes.ts.`;
|
|
20
|
+
}
|
|
21
|
+
if (/^\s*\.\s*is\s*\(/.test(after)) {
|
|
22
|
+
return `\`${concept}.is(..)\` without a code narrowed to every refusal of the concept: write the refusals it means, \`<Refusal>.is(error) || ..\`.`;
|
|
23
|
+
}
|
|
24
|
+
return `${concept} is gone: name the refusal classes that replace it there.`;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=concept-leftovers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-leftovers.js","sourceRoot":"","sources":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EAAE,KAAK,EAAqC;IACnF,IAAI,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3C,OAAO,mBAAmB,OAAO,mHAAmH,CAAC;IACvJ,CAAC;IAED,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,KAAK,OAAO,gIAAgI,CAAC;IACtJ,CAAC;IAED,OAAO,GAAG,OAAO,2DAA2D,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-named.d.ts","sourceRoot":"","sources":["../../src/refusals/concept-named.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAYrF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { splitWords } from '../naming/index.js';
|
|
2
|
+
/** The longest aggregate name the words of a class per error start or end with; empty when none. */
|
|
3
|
+
export function conceptNamed(className, aggregates) {
|
|
4
|
+
const words = splitWords(className.replace(/Error$/, '')).join(' ');
|
|
5
|
+
const named = aggregates
|
|
6
|
+
.filter((aggregate) => {
|
|
7
|
+
const subject = splitWords(aggregate).join(' ');
|
|
8
|
+
return words === subject || words.startsWith(`${subject} `) || words.endsWith(` ${subject}`);
|
|
9
|
+
})
|
|
10
|
+
.sort((a, b) => b.length - a.length);
|
|
11
|
+
return named[0] ?? '';
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=concept-named.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept-named.js","sourceRoot":"","sources":["../../src/refusals/concept-named.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,oGAAoG;AACpG,MAAM,UAAU,YAAY,CAAC,SAAiB,EAAE,UAA6B;IAC3E,MAAM,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEpE,MAAM,KAAK,GAAG,UAAU;SACrB,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE;QACpB,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEhD,OAAO,KAAK,KAAK,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,OAAO,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
/** A move, by its context and the path of the file it leaves from the contexts directory, without extension. */
|
|
3
|
+
interface Leaving {
|
|
4
|
+
readonly context: string;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Two contexts may name a class the same way: a move concerns the files of its own context, and
|
|
9
|
+
* elsewhere the files that import the class from that context.
|
|
10
|
+
*/
|
|
11
|
+
export declare function concerns(move: Leaving, { file, source }: {
|
|
12
|
+
file: string;
|
|
13
|
+
source: string;
|
|
14
|
+
}, config: Config): boolean;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=concerns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concerns.d.ts","sourceRoot":"","sources":["../../src/refusals/concerns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,gHAAgH;AAChH,UAAU,OAAO;IACf,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAInH"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Two contexts may name a class the same way: a move concerns the files of its own context, and
|
|
3
|
+
* elsewhere the files that import the class from that context.
|
|
4
|
+
*/
|
|
5
|
+
export function concerns(move, { file, source }, config) {
|
|
6
|
+
const contexts = `${config.contextsDir}/`;
|
|
7
|
+
return file.startsWith(contexts) ? file.startsWith(`${contexts}${move.context}/`) : source.includes(`/${move.path}`);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=concerns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concerns.js","sourceRoot":"","sources":["../../src/refusals/concerns.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAoC,EAAE,MAAc;IACxG,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,WAAW,GAAG,CAAC;IAE1C,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AACvH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ConceptFactory } from './concept-error-class.js';
|
|
2
|
+
/**
|
|
3
|
+
* The file of a concept class without the factories that moved, and without the imports only they
|
|
4
|
+
* read. Undefined when the class is left empty: the file goes.
|
|
5
|
+
*/
|
|
6
|
+
export declare function cutFactories(source: string, className: string, moved: readonly ConceptFactory[]): string | undefined;
|
|
7
|
+
//# sourceMappingURL=cut-factories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cut-factories.d.ts","sourceRoot":"","sources":["../../src/refusals/cut-factories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,GAAG,SAAS,CA0BpH"}
|