ddd-ts-kit 0.82.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 +103 -0
- package/README.fr.md +128 -60
- package/README.md +124 -59
- 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 +2 -0
- package/dist/check/catalogue/architecture-rules.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/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/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/language-docs.js +1 -1
- package/dist/check/explain/language-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/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/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/rules/authz-policy-asked.js +5 -2
- package/dist/check/rules/authz-policy-asked.js.map +1 -1
- 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/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/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/config/open-api-problems.js +7 -6
- package/dist/config/open-api-problems.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/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/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 +11 -5
- 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 +2 -2
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/stack/resolve-stack.js +2 -2
- package/dist/init/stack/resolve-stack.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/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 +1 -1
- 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,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,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;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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,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,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AAC,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":["../../src/refusals/concept-leftovers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,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,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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { scan } from '../check/scan/scan.js';
|
|
2
|
+
import { classBody } from '../generate/errors/class-body.js';
|
|
3
|
+
import { importsUsedBy } from './imports-used-by.js';
|
|
4
|
+
const IMPORT = /^import [^;]+;\n/gm;
|
|
5
|
+
/**
|
|
6
|
+
* The file of a concept class without the factories that moved, and without the imports only they
|
|
7
|
+
* read. Undefined when the class is left empty: the file goes.
|
|
8
|
+
*/
|
|
9
|
+
export function cutFactories(source, className, moved) {
|
|
10
|
+
const cut = [...moved]
|
|
11
|
+
.sort((a, b) => b.start - a.start)
|
|
12
|
+
.reduce((text, factory) => {
|
|
13
|
+
const lineEnd = text.indexOf('\n', factory.end);
|
|
14
|
+
return text.slice(0, factory.start) + text.slice(lineEnd === -1 ? text.length : lineEnd + 1);
|
|
15
|
+
}, source);
|
|
16
|
+
const scanned = scan(cut);
|
|
17
|
+
const body = classBody(scanned, className);
|
|
18
|
+
const inside = body === undefined ? '' : cut.slice(body.open + 1, body.close);
|
|
19
|
+
if (body === undefined || inside.trim() === '') {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const tidy = `\n${inside
|
|
23
|
+
.replace(/^\n+/, '')
|
|
24
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
25
|
+
.trimEnd()}\n`;
|
|
26
|
+
const kept = cut.slice(0, body.open + 1) + tidy + cut.slice(body.close);
|
|
27
|
+
const rest = kept.replace(IMPORT, '');
|
|
28
|
+
return kept.replace(IMPORT, (line) => importsUsedBy([line], rest)[0] ?? '');
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=cut-factories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cut-factories.js","sourceRoot":"","sources":["../../src/refusals/cut-factories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,MAAM,GAAG,oBAAoB,CAAC;AAEpC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,SAAiB,EAAE,KAAgC;IAC9F,MAAM,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC;SACnB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;SACjC,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAEhD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IAC/F,CAAC,EAAE,MAAM,CAAC,CAAC;IAEb,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAE9E,IAAI,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC/C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,MAAM;SACrB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;SACnB,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,OAAO,EAAE,IAAI,CAAC;IAEjB,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxE,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEtC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MigrationDraft } from './migration-draft.js';
|
|
2
|
+
/**
|
|
3
|
+
* Tells each guide of the agents that still describes the earlier form: an agent that reads it
|
|
4
|
+
* would write the refusals the project just left. No command writes them again alone (`init
|
|
5
|
+
* --force` rewrites the whole platform), and a team may have written in them: a person rewrites them.
|
|
6
|
+
*/
|
|
7
|
+
export declare function earlierGuidance(draft: MigrationDraft): void;
|
|
8
|
+
//# sourceMappingURL=earlier-guidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier-guidance.d.ts","sourceRoot":"","sources":["../../src/refusals/earlier-guidance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAc3D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAM3D"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** The guides `init` writes for agents that say how a refusal is built: the rules by layer, and the guide of every agent. */
|
|
2
|
+
const GUIDES = [
|
|
3
|
+
'.claude/rules/domain.md',
|
|
4
|
+
'.claude/rules/presentation.md',
|
|
5
|
+
'.github/instructions/domain.instructions.md',
|
|
6
|
+
'.github/instructions/presentation.instructions.md',
|
|
7
|
+
'AGENTS.md',
|
|
8
|
+
];
|
|
9
|
+
/** What only a guide written for classes per error or for factories of concept classes says. */
|
|
10
|
+
const EARLIER_FORM = /\bConceptError\b|\bDomainError\b|\bdomain-error\b|\brefusal\(code\b|as their factories set them/;
|
|
11
|
+
/**
|
|
12
|
+
* Tells each guide of the agents that still describes the earlier form: an agent that reads it
|
|
13
|
+
* would write the refusals the project just left. No command writes them again alone (`init
|
|
14
|
+
* --force` rewrites the whole platform), and a team may have written in them: a person rewrites them.
|
|
15
|
+
*/
|
|
16
|
+
export function earlierGuidance(draft) {
|
|
17
|
+
for (const guide of GUIDES.filter((file) => EARLIER_FORM.test(draft.read(file) ?? ''))) {
|
|
18
|
+
draft.manual.push(`${guide} still describes the earlier form of the refusals: rewrite it from the named form (one class per refusal, its code in codes.ts, its factories).`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=earlier-guidance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier-guidance.js","sourceRoot":"","sources":["../../src/refusals/earlier-guidance.ts"],"names":[],"mappings":"AAEA,6HAA6H;AAC7H,MAAM,MAAM,GAAG;IACb,yBAAyB;IACzB,+BAA+B;IAC/B,6CAA6C;IAC7C,mDAAmD;IACnD,WAAW;CACZ,CAAC;AAEF,gGAAgG;AAChG,MAAM,YAAY,GAAG,iGAAiG,CAAC;AAEvH;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAqB;IACnD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QACvF,KAAK,CAAC,MAAM,CAAC,IAAI,CACf,GAAG,KAAK,iJAAiJ,CAC1J,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The factory named after what the refusal is about, its first parameter: `appointmentId` gives
|
|
3
|
+
* `forAppointment` (the identifier stands for the thing), `horizon` gives `forHorizon`. A message
|
|
4
|
+
* or a cause gives `withMessage` or `becauseOf`. Undefined without a parameter to name it after.
|
|
5
|
+
*/
|
|
6
|
+
export declare function factoryForParameter(parameter: string | undefined): string | undefined;
|
|
7
|
+
//# sourceMappingURL=factory-for-parameter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-for-parameter.d.ts","sourceRoot":"","sources":["../../src/refusals/factory-for-parameter.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CASrF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toName } from '../naming/index.js';
|
|
2
|
+
/** Parameters that are not what the refusal is about, but how it is told: each has the factory that says so. */
|
|
3
|
+
const TOLD = { message: 'withMessage', cause: 'becauseOf' };
|
|
4
|
+
/**
|
|
5
|
+
* The factory named after what the refusal is about, its first parameter: `appointmentId` gives
|
|
6
|
+
* `forAppointment` (the identifier stands for the thing), `horizon` gives `forHorizon`. A message
|
|
7
|
+
* or a cause gives `withMessage` or `becauseOf`. Undefined without a parameter to name it after.
|
|
8
|
+
*/
|
|
9
|
+
export function factoryForParameter(parameter) {
|
|
10
|
+
if (parameter === undefined) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
const subject = toName(parameter).pascal;
|
|
14
|
+
const bare = subject.replace(/Id$/, '');
|
|
15
|
+
return TOLD[parameter] ?? `for${bare === '' ? subject : bare}`;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=factory-for-parameter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-for-parameter.js","sourceRoot":"","sources":["../../src/refusals/factory-for-parameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,gHAAgH;AAChH,MAAM,IAAI,GAAqC,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAE9F;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAA6B;IAC/D,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAExC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The name of the first parameter of the list opened at `open` in `code`: undefined when the list
|
|
3
|
+
* is empty or the first parameter is destructured, since no single name then says what it is.
|
|
4
|
+
*/
|
|
5
|
+
export declare function firstParameter(code: string, open: number): string | undefined;
|
|
6
|
+
//# sourceMappingURL=first-parameter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-parameter.d.ts","sourceRoot":"","sources":["../../src/refusals/first-parameter.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI7E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { matchingBracket } from '../check/text/matching-bracket.js';
|
|
2
|
+
import { splitTopLevel } from '../check/text/split-top-level.js';
|
|
3
|
+
const NAMED = /^(?:\.\.\.)?([A-Za-z_$][\w$]*)/;
|
|
4
|
+
/**
|
|
5
|
+
* The name of the first parameter of the list opened at `open` in `code`: undefined when the list
|
|
6
|
+
* is empty or the first parameter is destructured, since no single name then says what it is.
|
|
7
|
+
*/
|
|
8
|
+
export function firstParameter(code, open) {
|
|
9
|
+
const [first] = splitTopLevel(code.slice(open + 1, matchingBracket(code, open)));
|
|
10
|
+
return first === undefined ? undefined : NAMED.exec(first.code)?.[1];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=first-parameter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-parameter.js","sourceRoot":"","sources":["../../src/refusals/first-parameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,MAAM,KAAK,GAAG,gCAAgC,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,IAAY;IACvD,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAEjF,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { MigrationDraft } from './migration-draft.js';
|
|
3
|
+
/**
|
|
4
|
+
* knip reports the type `<Ctx>Code` of each `codes.ts` that nothing imports yet, though it is the
|
|
5
|
+
* contract a route or a client reads: `init` tells knip so under the named form, and the migration
|
|
6
|
+
* says it as `init` does. A knip config the migration cannot edit (another file, or not plain
|
|
7
|
+
* JSON) is left to a person.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ignoreCodeTypes(config: Config, draft: MigrationDraft): void;
|
|
10
|
+
//# sourceMappingURL=ignore-code-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore-code-types.d.ts","sourceRoot":"","sources":["../../src/refusals/ignore-code-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAkB3E"}
|