ddd-ts-kit 0.86.0 → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.fr.md +38 -39
- package/README.md +38 -37
- package/dist/check/canonical/earlier-context-file.d.ts +15 -0
- package/dist/check/canonical/earlier-context-file.d.ts.map +1 -0
- package/dist/check/canonical/earlier-context-file.js +33 -0
- package/dist/check/canonical/earlier-context-file.js.map +1 -0
- package/dist/check/canonical/stray-entry.d.ts.map +1 -1
- package/dist/check/canonical/stray-entry.js +11 -9
- package/dist/check/canonical/stray-entry.js.map +1 -1
- package/dist/check/configuration/module-problems.js +2 -2
- package/dist/check/configuration/module-problems.js.map +1 -1
- package/dist/check/errors/code-list.d.ts +1 -1
- package/dist/check/errors/code-list.d.ts.map +1 -1
- package/dist/check/errors/is-codes-file.d.ts +1 -1
- package/dist/check/errors/is-codes-file.d.ts.map +1 -1
- package/dist/check/errors/is-codes-file.js +1 -1
- package/dist/check/errors/is-codes-file.js.map +1 -1
- package/dist/check/explain/errors-docs.js +5 -5
- 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/explain/layout-docs.js +1 -1
- package/dist/check/explain/layout-docs.js.map +1 -1
- package/dist/check/explain/module-docs.d.ts.map +1 -1
- package/dist/check/explain/module-docs.js +16 -12
- package/dist/check/explain/module-docs.js.map +1 -1
- package/dist/check/explain/tree-docs.js +2 -2
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/explain/wiring-docs.d.ts.map +1 -1
- package/dist/check/explain/wiring-docs.js +8 -7
- package/dist/check/explain/wiring-docs.js.map +1 -1
- package/dist/check/fixtures/authz-granted-fixtures.js +2 -2
- package/dist/check/fixtures/authz-granted-fixtures.js.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.js +3 -3
- package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
- package/dist/check/fixtures/authz-scope-narrows-fixtures.js +4 -4
- package/dist/check/fixtures/authz-scope-narrows-fixtures.js.map +1 -1
- package/dist/check/fixtures/constructor-injection-fixtures.js +6 -6
- package/dist/check/fixtures/constructor-injection-fixtures.js.map +1 -1
- package/dist/check/fixtures/context-file-fixtures.d.ts +4 -0
- package/dist/check/fixtures/context-file-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/context-file-fixtures.js +36 -0
- package/dist/check/fixtures/context-file-fixtures.js.map +1 -0
- package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.js +15 -36
- package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
- package/dist/check/fixtures/declared-declarations.d.ts +4 -2
- package/dist/check/fixtures/declared-declarations.d.ts.map +1 -1
- package/dist/check/fixtures/declared-declarations.js +9 -3
- package/dist/check/fixtures/declared-declarations.js.map +1 -1
- package/dist/check/fixtures/earlier-declarations-fixtures.d.ts +4 -0
- package/dist/check/fixtures/earlier-declarations-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/earlier-declarations-fixtures.js +48 -0
- package/dist/check/fixtures/earlier-declarations-fixtures.js.map +1 -0
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +4 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/module-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/module-fixtures.js +50 -17
- package/dist/check/fixtures/module-fixtures.js.map +1 -1
- package/dist/check/fixtures/named-refusal-fixtures.js +5 -5
- package/dist/check/fixtures/named-refusal-fixtures.js.map +1 -1
- package/dist/check/fixtures/paths.d.ts +1 -1
- package/dist/check/fixtures/paths.js +1 -1
- package/dist/check/fixtures/paths.js.map +1 -1
- package/dist/check/fixtures/vocabulary-fixtures.js +2 -2
- package/dist/check/fixtures/vocabulary-fixtures.js.map +1 -1
- package/dist/check/project/locate.d.ts.map +1 -1
- package/dist/check/project/locate.js +18 -9
- package/dist/check/project/locate.js.map +1 -1
- package/dist/check/rules/declarations-barrel-current.js +16 -11
- package/dist/check/rules/declarations-barrel-current.js.map +1 -1
- package/dist/check/rules/errors-code-listed.js +6 -8
- package/dist/check/rules/errors-code-listed.js.map +1 -1
- package/dist/check/rules/errors-code-unique.js +2 -2
- package/dist/check/rules/errors-code-unique.js.map +1 -1
- package/dist/check/rules/errors-known-code.js +2 -2
- package/dist/check/rules/errors-known-code.js.map +1 -1
- package/dist/check/rules/language-glossary-term.js +1 -1
- package/dist/check/rules/language-glossary-term.js.map +1 -1
- package/dist/check/rules/module-complete.d.ts.map +1 -1
- package/dist/check/rules/module-complete.js +67 -13
- package/dist/check/rules/module-complete.js.map +1 -1
- package/dist/check/rules/naming-suffix.d.ts.map +1 -1
- package/dist/check/rules/naming-suffix.js +12 -9
- package/dist/check/rules/naming-suffix.js.map +1 -1
- package/dist/check/rules/tree-closed.d.ts.map +1 -1
- package/dist/check/rules/tree-closed.js +8 -1
- package/dist/check/rules/tree-closed.js.map +1 -1
- package/dist/check/support/is-generated-context-file.d.ts +1 -1
- package/dist/check/support/is-generated-context-file.js +1 -1
- package/dist/check/support/path-in-context.d.ts +5 -1
- package/dist/check/support/path-in-context.d.ts.map +1 -1
- package/dist/check/support/path-in-context.js +12 -3
- package/dist/check/support/path-in-context.js.map +1 -1
- package/dist/commands/context-layout.d.ts +4 -0
- package/dist/commands/context-layout.d.ts.map +1 -0
- package/dist/commands/context-layout.js +48 -0
- package/dist/commands/context-layout.js.map +1 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +14 -9
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/generate.js +2 -2
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/move-to-module.d.ts.map +1 -1
- package/dist/commands/move-to-module.js +2 -0
- package/dist/commands/move-to-module.js.map +1 -1
- package/dist/config/stack.d.ts +1 -1
- package/dist/context-files/context-file-at.d.ts +7 -0
- package/dist/context-files/context-file-at.d.ts.map +1 -0
- package/dist/context-files/context-file-at.js +9 -0
- package/dist/context-files/context-file-at.js.map +1 -0
- package/dist/context-files/context-file-placement.d.ts +8 -0
- package/dist/context-files/context-file-placement.d.ts.map +1 -0
- package/dist/context-files/context-file-placement.js +23 -0
- package/dist/context-files/context-file-placement.js.map +1 -0
- package/dist/context-files/context-file.d.ts +16 -0
- package/dist/context-files/context-file.d.ts.map +1 -0
- package/dist/context-files/context-file.js +12 -0
- package/dist/context-files/context-file.js.map +1 -0
- package/dist/context-files/earlier-place-of.d.ts +7 -0
- package/dist/context-files/earlier-place-of.d.ts.map +1 -0
- package/dist/context-files/earlier-place-of.js +10 -0
- package/dist/context-files/earlier-place-of.js.map +1 -0
- package/dist/context-files/index.d.ts +5 -0
- package/dist/context-files/index.d.ts.map +1 -0
- package/dist/context-files/index.js +5 -0
- package/dist/context-files/index.js.map +1 -0
- package/dist/context-layout/context-layout.d.ts +19 -0
- package/dist/context-layout/context-layout.d.ts.map +1 -0
- package/dist/context-layout/context-layout.js +55 -0
- package/dist/context-layout/context-layout.js.map +1 -0
- package/dist/context-layout/index.d.ts +2 -0
- package/dist/context-layout/index.d.ts.map +1 -0
- package/dist/context-layout/index.js +2 -0
- package/dist/context-layout/index.js.map +1 -0
- package/dist/context-layout/module-moves.d.ts +21 -0
- package/dist/context-layout/module-moves.d.ts.map +1 -0
- package/dist/context-layout/module-moves.js +146 -0
- package/dist/context-layout/module-moves.js.map +1 -0
- package/dist/controllers/migrate-context.js +20 -15
- package/dist/controllers/migrate-context.js.map +1 -1
- package/dist/controllers/plan-context.d.ts +5 -1
- package/dist/controllers/plan-context.d.ts.map +1 -1
- package/dist/controllers/plan-context.js +19 -5
- package/dist/controllers/plan-context.js.map +1 -1
- package/dist/declared/barrel-file.d.ts +1 -1
- package/dist/declared/barrel-file.js +1 -1
- package/dist/declared/context-declarations.d.ts +4 -2
- package/dist/declared/context-declarations.d.ts.map +1 -1
- package/dist/declared/context-declarations.js +4 -2
- package/dist/declared/context-declarations.js.map +1 -1
- package/dist/declared/declarations-folder-of.d.ts +12 -7
- package/dist/declared/declarations-folder-of.d.ts.map +1 -1
- package/dist/declared/declarations-folder-of.js +15 -11
- package/dist/declared/declarations-folder-of.js.map +1 -1
- package/dist/declared/earlier-layout-notice.d.ts +10 -0
- package/dist/declared/earlier-layout-notice.d.ts.map +1 -0
- package/dist/declared/earlier-layout-notice.js +12 -0
- package/dist/declared/earlier-layout-notice.js.map +1 -0
- package/dist/declared/earlier-layout-of.d.ts +10 -0
- package/dist/declared/earlier-layout-of.d.ts.map +1 -0
- package/dist/declared/earlier-layout-of.js +16 -0
- package/dist/declared/earlier-layout-of.js.map +1 -0
- package/dist/declared/earlier-shape-of.d.ts +13 -0
- package/dist/declared/earlier-shape-of.d.ts.map +1 -0
- package/dist/declared/earlier-shape-of.js +35 -0
- package/dist/declared/earlier-shape-of.js.map +1 -0
- package/dist/declared/folder-declarations-file.d.ts +6 -4
- package/dist/declared/folder-declarations-file.d.ts.map +1 -1
- package/dist/declared/folder-declarations-file.js +7 -5
- package/dist/declared/folder-declarations-file.js.map +1 -1
- package/dist/declared/index.d.ts +3 -2
- package/dist/declared/index.d.ts.map +1 -1
- package/dist/declared/index.js +3 -2
- package/dist/declared/index.js.map +1 -1
- package/dist/declared/is-declarations-file.d.ts +3 -2
- package/dist/declared/is-declarations-file.d.ts.map +1 -1
- package/dist/declared/is-declarations-file.js +9 -9
- package/dist/declared/is-declarations-file.js.map +1 -1
- package/dist/declared/keeps-role-folder-files.d.ts +12 -0
- package/dist/declared/keeps-role-folder-files.d.ts.map +1 -0
- package/dist/declared/keeps-role-folder-files.js +25 -0
- package/dist/declared/keeps-role-folder-files.js.map +1 -0
- package/dist/declared/keeps-single-file.d.ts +1 -1
- package/dist/declared/keeps-single-file.js +1 -1
- package/dist/declared/render-declarations.d.ts +7 -3
- package/dist/declared/render-declarations.d.ts.map +1 -1
- package/dist/declared/render-declarations.js +5 -3
- package/dist/declared/render-declarations.js.map +1 -1
- package/dist/declared/render-folder-declarations.d.ts +2 -2
- package/dist/declared/same-files.d.ts +3 -0
- package/dist/declared/same-files.d.ts.map +1 -0
- package/dist/declared/same-files.js +5 -0
- package/dist/declared/same-files.js.map +1 -0
- package/dist/depcruise/layer-rules.js +21 -7
- package/dist/depcruise/layer-rules.js.map +1 -1
- package/dist/describe/read-adapters.d.ts.map +1 -1
- package/dist/describe/read-adapters.js +6 -4
- package/dist/describe/read-adapters.js.map +1 -1
- package/dist/describe/read-controllers.d.ts.map +1 -1
- package/dist/describe/read-controllers.js +5 -3
- package/dist/describe/read-controllers.js.map +1 -1
- package/dist/describe/read-errors.d.ts +1 -1
- package/dist/describe/read-errors.d.ts.map +1 -1
- package/dist/describe/read-errors.js +5 -3
- package/dist/describe/read-errors.js.map +1 -1
- package/dist/describe/read-routes.d.ts.map +1 -1
- package/dist/describe/read-routes.js +5 -5
- package/dist/describe/read-routes.js.map +1 -1
- package/dist/dev/refresh-declarations.d.ts.map +1 -1
- package/dist/dev/refresh-declarations.js +1 -1
- package/dist/dev/refresh-declarations.js.map +1 -1
- package/dist/docs/context-facts.d.ts +1 -1
- package/dist/docs/context-facts.d.ts.map +1 -1
- package/dist/docs/read-context.d.ts.map +1 -1
- package/dist/docs/read-context.js +2 -1
- package/dist/docs/read-context.js.map +1 -1
- package/dist/docs/refresh-context-doc.js +1 -1
- package/dist/docs/refresh-context-doc.js.map +1 -1
- package/dist/docs/state-machine-lines.d.ts +1 -1
- package/dist/docs/state-machine-lines.d.ts.map +1 -1
- package/dist/docs/state-machine-lines.js +6 -2
- package/dist/docs/state-machine-lines.js.map +1 -1
- package/dist/docs/write-docs.d.ts +3 -3
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +3 -3
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/file-moves/file-move.d.ts +6 -0
- package/dist/file-moves/file-move.d.ts.map +1 -0
- package/dist/file-moves/file-move.js +2 -0
- package/dist/file-moves/file-move.js.map +1 -0
- package/dist/file-moves/index.d.ts +3 -0
- package/dist/file-moves/index.d.ts.map +1 -0
- package/dist/file-moves/index.js +2 -0
- package/dist/file-moves/index.js.map +1 -0
- package/dist/file-moves/move-files.d.ts +15 -0
- package/dist/file-moves/move-files.d.ts.map +1 -0
- package/dist/file-moves/move-files.js +37 -0
- package/dist/file-moves/move-files.js.map +1 -0
- package/dist/generate/errors/codes-list.d.ts +1 -1
- package/dist/generate/errors/codes-list.d.ts.map +1 -1
- package/dist/generate/errors/write-named-refusal.d.ts +1 -1
- package/dist/generate/errors/write-named-refusal.d.ts.map +1 -1
- package/dist/generate/errors/write-named-refusal.js +3 -2
- package/dist/generate/errors/write-named-refusal.js.map +1 -1
- package/dist/generate/kind.d.ts +1 -1
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/adapter-kind.d.ts.map +1 -1
- package/dist/generate/kinds/adapter-kind.js +22 -2
- package/dist/generate/kinds/adapter-kind.js.map +1 -1
- package/dist/generate/kinds/error-kind.js +1 -1
- package/dist/generate/kinds/error-kind.js.map +1 -1
- package/dist/generate/kinds/module-kind.js +1 -1
- package/dist/generate/kinds/module-kind.js.map +1 -1
- package/dist/generate/kinds/port-kind.d.ts.map +1 -1
- package/dist/generate/kinds/port-kind.js +3 -1
- package/dist/generate/kinds/port-kind.js.map +1 -1
- package/dist/generate/kinds/presentation/controller-of.d.ts +1 -1
- package/dist/generate/kinds/presentation/controller-of.d.ts.map +1 -1
- package/dist/generate/kinds/presentation/controller-of.js +7 -5
- package/dist/generate/kinds/presentation/controller-of.js.map +1 -1
- package/dist/generate/permissions-file.d.ts +4 -1
- package/dist/generate/permissions-file.d.ts.map +1 -1
- package/dist/generate/permissions-file.js +6 -2
- package/dist/generate/permissions-file.js.map +1 -1
- package/dist/generate/place-context-files.d.ts +9 -0
- package/dist/generate/place-context-files.d.ts.map +1 -0
- package/dist/generate/place-context-files.js +14 -0
- package/dist/generate/place-context-files.js.map +1 -0
- package/dist/generate/place-generated-files.d.ts +18 -0
- package/dist/generate/place-generated-files.d.ts.map +1 -0
- package/dist/generate/{place-in-modules.js → place-generated-files.js} +42 -17
- package/dist/generate/place-generated-files.js.map +1 -0
- package/dist/generate/refresh-barrels.d.ts +17 -11
- package/dist/generate/refresh-barrels.d.ts.map +1 -1
- package/dist/generate/refresh-barrels.js +32 -26
- package/dist/generate/refresh-barrels.js.map +1 -1
- package/dist/generate/refresh-docs.d.ts +2 -2
- package/dist/generate/refresh-docs.d.ts.map +1 -1
- package/dist/generate/refresh-docs.js +6 -3
- package/dist/generate/refresh-docs.js.map +1 -1
- package/dist/generate/refuse-earlier-layout.d.ts +9 -0
- package/dist/generate/refuse-earlier-layout.d.ts.map +1 -0
- package/dist/generate/refuse-earlier-layout.js +15 -0
- package/dist/generate/refuse-earlier-layout.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 +24 -9
- 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 +1 -0
- 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 +6 -0
- package/dist/init/run-init.js.map +1 -1
- package/dist/knip/ignore-code-types-where-they-are.d.ts +11 -0
- package/dist/knip/ignore-code-types-where-they-are.d.ts.map +1 -0
- package/dist/knip/ignore-code-types-where-they-are.js +56 -0
- package/dist/knip/ignore-code-types-where-they-are.js.map +1 -0
- package/dist/knip/index.d.ts +2 -0
- package/dist/knip/index.d.ts.map +1 -0
- package/dist/knip/index.js +2 -0
- package/dist/knip/index.js.map +1 -0
- package/dist/model-modules/index.d.ts +1 -1
- package/dist/model-modules/index.d.ts.map +1 -1
- package/dist/model-modules/index.js +1 -1
- package/dist/model-modules/index.js.map +1 -1
- package/dist/model-modules/into-module.d.ts +5 -1
- package/dist/model-modules/into-module.d.ts.map +1 -1
- package/dist/model-modules/into-module.js +12 -5
- package/dist/model-modules/into-module.js.map +1 -1
- package/dist/model-modules/is-context-level.d.ts +5 -3
- package/dist/model-modules/is-context-level.d.ts.map +1 -1
- package/dist/model-modules/is-context-level.js +17 -4
- package/dist/model-modules/is-context-level.js.map +1 -1
- package/dist/model-modules/module-layers.d.ts +7 -1
- package/dist/model-modules/module-layers.d.ts.map +1 -1
- package/dist/model-modules/module-layers.js +8 -2
- package/dist/model-modules/module-layers.js.map +1 -1
- package/dist/model-modules/module-name-flaw.d.ts +2 -2
- package/dist/model-modules/module-name-flaw.js +4 -4
- package/dist/model-modules/module-name-flaw.js.map +1 -1
- package/dist/model-modules/module-placement.d.ts +5 -1
- package/dist/model-modules/module-placement.d.ts.map +1 -1
- package/dist/model-modules/module-placement.js +47 -18
- package/dist/model-modules/module-placement.js.map +1 -1
- package/dist/model-modules/module-split.d.ts +9 -5
- package/dist/model-modules/module-split.d.ts.map +1 -1
- package/dist/model-modules/module-split.js +30 -13
- package/dist/model-modules/module-split.js.map +1 -1
- package/dist/model-modules/role-directories-of.d.ts.map +1 -1
- package/dist/model-modules/role-directories-of.js +6 -1
- package/dist/model-modules/role-directories-of.js.map +1 -1
- package/dist/model-modules/role-folders-of.d.ts +1 -1
- package/dist/model-modules/role-folders-of.d.ts.map +1 -1
- package/dist/model-modules/role-folders-of.js +15 -5
- package/dist/model-modules/role-folders-of.js.map +1 -1
- package/dist/model-modules/role-folders.d.ts +2 -2
- package/dist/model-modules/role-folders.js +2 -2
- package/dist/move-to-module/module-move.d.ts +2 -4
- package/dist/move-to-module/module-move.d.ts.map +1 -1
- package/dist/move-to-module/move-to-module.d.ts +2 -6
- package/dist/move-to-module/move-to-module.d.ts.map +1 -1
- package/dist/move-to-module/move-to-module.js +2 -31
- package/dist/move-to-module/move-to-module.js.map +1 -1
- package/dist/move-to-module/moves-into-module.d.ts +1 -1
- package/dist/move-to-module/moves-into-module.d.ts.map +1 -1
- package/dist/move-to-module/moves-into-module.js +25 -6
- package/dist/move-to-module/moves-into-module.js.map +1 -1
- package/dist/refusals/code-types-pattern.d.ts +4 -0
- package/dist/refusals/code-types-pattern.d.ts.map +1 -0
- package/dist/refusals/code-types-pattern.js +6 -0
- package/dist/refusals/code-types-pattern.js.map +1 -0
- package/dist/refusals/ignore-code-types.d.ts +1 -1
- package/dist/refusals/ignore-code-types.d.ts.map +1 -1
- package/dist/refusals/ignore-code-types.js +3 -2
- package/dist/refusals/ignore-code-types.js.map +1 -1
- package/dist/refusals/path-from-contexts.d.ts +1 -1
- package/dist/refusals/path-from-contexts.js +2 -2
- package/dist/refusals/path-from-contexts.js.map +1 -1
- package/dist/refusals/with-codes.d.ts +1 -1
- package/dist/refusals/with-codes.d.ts.map +1 -1
- package/dist/refusals/with-codes.js +1 -1
- package/dist/refusals/with-codes.js.map +1 -1
- package/dist/refusals/write-refusal-classes.d.ts.map +1 -1
- package/dist/refusals/write-refusal-classes.js +4 -2
- package/dist/refusals/write-refusal-classes.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/templates/command/handler.spec.buses.ts.tpl +1 -1
- package/templates/command/handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/context/permission-set.tpl +1 -1
- package/templates/context/permissions.spec.ts.tpl +1 -1
- package/templates/error/refusal.ts.tpl +1 -1
- package/templates/file-upload/handler.spec.ts.tpl +1 -1
- package/templates/init/AGENTS.md.tpl +1 -1
- package/templates/init/README.md.tpl +2 -2
- package/templates/init/rules/application.md.tpl +3 -2
- package/templates/init/rules/domain.md.tpl +3 -2
- package/templates/init/rules/infrastructure.md.tpl +1 -0
- package/templates/init/rules/presentation.md.tpl +2 -1
- package/templates/pipeline/knip.json.tpl +1 -1
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/policy/policy.declared.ts.tpl +1 -1
- package/templates/policy/policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/change-member-roles.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/revoke-delegations.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/revoke-invitations.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/queries/search-members/search-members.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/queries/search-members/search-members.query.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/above-own-role.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/account-already-deactivated.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/already-member.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/deactivated-account.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-not-active.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-period-inverted.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-to-oneself.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-too-long.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-with-no-right.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/email-not-verified.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invalid-display-name.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invalid-email-address.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invalid-organisation-name.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invalid-organisation-slug.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invitation-expired.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invitation-not-addressed-to-account.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invitation-not-pending.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/last-owner.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/not-an-owner.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/organisation-slug-taken.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/own-role.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/right-not-in-role.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-account.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-delegation.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-invitation.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-member.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-organisation.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/test/worlds/__context__.world.ts.tpl +1 -1
- package/templates/query/handler.spec.buses.ts.tpl +1 -1
- package/templates/query/handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/query/search.handler.declared.ts.tpl +1 -1
- package/templates/query/search.handler.spec.buses.ts.tpl +1 -1
- package/templates/query/search.handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/query/search.handler.ts.tpl +1 -1
- package/dist/declared/single-file-notice.d.ts +0 -8
- package/dist/declared/single-file-notice.d.ts.map +0 -1
- package/dist/declared/single-file-notice.js +0 -9
- package/dist/declared/single-file-notice.js.map +0 -1
- package/dist/generate/place-in-modules.d.ts +0 -16
- package/dist/generate/place-in-modules.d.ts.map +0 -1
- package/dist/generate/place-in-modules.js.map +0 -1
- /package/templates/presets/identity/context/{domain/errors/codes.named.ts.tpl → __context__.codes.named.ts.tpl} +0 -0
- /package/templates/presets/identity/context/{application/authorization/__context__.permissions.ts.tpl → __context__.permissions.ts.tpl} +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { aliasRoots } from '../alias/index.js';
|
|
3
|
+
import { isDeclarationsFile } from '../declared/index.js';
|
|
4
|
+
import { filesUnder } from '../generate/files-under.js';
|
|
5
|
+
import { declaredModules, intoModule, isContextLevel, MODULE_LAYERS, MODULE_TEST_FOLDERS, moduleSplit, } from '../model-modules/index.js';
|
|
6
|
+
const SPECIFIER = /(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])([^'"\n]+)\1/g;
|
|
7
|
+
const EXTENSION = /\.(?:ts|js)$/;
|
|
8
|
+
/**
|
|
9
|
+
* The moves that give each module of a context its folder: what 0.86 and 0.87 put under `domain/<module>/`
|
|
10
|
+
* and `application/<module>/` goes to `<module>/domain/` and `<module>/application/`; an adapter,
|
|
11
|
+
* a route or a spec left at the level of the context goes to the module of what it imports (or,
|
|
12
|
+
* for a spec, of the file it is named after), or of what imports it when it imports nothing of a
|
|
13
|
+
* module. The files the context keeps at its own level stay, and so does a file whose imports
|
|
14
|
+
* name two modules, or none: it is listed.
|
|
15
|
+
*/
|
|
16
|
+
export function moduleMoves(ws, config, context) {
|
|
17
|
+
const directory = `${config.contextsDir}/${context}`;
|
|
18
|
+
const modules = declaredModules(config, context);
|
|
19
|
+
if (modules.length === 0) {
|
|
20
|
+
return { moves: [], unplaced: [], taken: [] };
|
|
21
|
+
}
|
|
22
|
+
const files = filesUnder(ws, directory);
|
|
23
|
+
const earlier = files.flatMap((file) => earlierMove(file, modules));
|
|
24
|
+
const known = new Map(files.map((file) => [file, moduleSplit(file, modules).module]));
|
|
25
|
+
const open = files
|
|
26
|
+
.filter((file) => isOpen(context, file, modules))
|
|
27
|
+
.map((file) => ({ file, module: undefined }));
|
|
28
|
+
const imports = new Map(open.map(({ file }) => [file, importsOf(ws, { directory, file, roots: aliasRoots(config) })]));
|
|
29
|
+
settle(open, { known, imports, modules });
|
|
30
|
+
const placed = open.flatMap(({ file, module }) => module === undefined ? [] : [{ from: file, to: intoModule(module, file) }]);
|
|
31
|
+
const at = (file) => `${directory}/${file}`;
|
|
32
|
+
const all = [...earlier, ...placed].map(({ from, to }) => ({ from: at(from), to: at(to) }));
|
|
33
|
+
return {
|
|
34
|
+
moves: all.filter((move) => !ws.exists(move.to)),
|
|
35
|
+
unplaced: open.filter(({ module }) => module === undefined).map(({ file }) => at(file)),
|
|
36
|
+
taken: all.filter((move) => ws.exists(move.to)),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** A file of a module where 0.86 and 0.87 put it, with its place of today. */
|
|
40
|
+
function earlierMove(file, modules) {
|
|
41
|
+
const { module, path, earlier } = moduleSplit(file, modules);
|
|
42
|
+
return earlier === true ? [{ from: file, to: intoModule(module, path) }] : [];
|
|
43
|
+
}
|
|
44
|
+
/** A file of a layer, or a spec directly in a test folder, left at the level of the context, that a module may own. */
|
|
45
|
+
function isOpen(context, file, modules) {
|
|
46
|
+
return ((isLayerFile(file, modules) || isSpecInPlace(file, modules)) &&
|
|
47
|
+
!isContextLevel(context, file) &&
|
|
48
|
+
!isDeclarationsFile(context, file, modules));
|
|
49
|
+
}
|
|
50
|
+
function isLayerFile(file, modules) {
|
|
51
|
+
const [layer = '', , ...rest] = file.split('/');
|
|
52
|
+
return MODULE_LAYERS.includes(layer) && rest.length > 0 && moduleSplit(file, modules).module === undefined;
|
|
53
|
+
}
|
|
54
|
+
/** A spec of `test/unit/` or `test/integration/`, at any depth, in no module yet. */
|
|
55
|
+
function isSpecInPlace(file, modules) {
|
|
56
|
+
const [top, folder = '', ...rest] = file.split('/');
|
|
57
|
+
return (top === 'test' &&
|
|
58
|
+
MODULE_TEST_FOLDERS.includes(folder) &&
|
|
59
|
+
rest.length > 0 &&
|
|
60
|
+
file.endsWith('.spec.ts') &&
|
|
61
|
+
moduleSplit(file, modules).module === undefined);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Tells the module of each open file, until nothing changes: a spec named after a file of one
|
|
65
|
+
* module is of it; a file that imports files of exactly one module is of it; a file that imports
|
|
66
|
+
* none is of the one module of the open files that import it. A file whose imports name two
|
|
67
|
+
* modules, once every file is told, is of none: it is listed, whatever order the files came in.
|
|
68
|
+
*/
|
|
69
|
+
function settle(open, reading) {
|
|
70
|
+
const { known, modules } = reading;
|
|
71
|
+
const named = new Set();
|
|
72
|
+
for (const spec of open.filter(({ file }) => file.startsWith('test/'))) {
|
|
73
|
+
spec.module = namedAfter(spec.file, known, modules);
|
|
74
|
+
if (spec.module !== undefined) {
|
|
75
|
+
named.add(spec);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const conflicting = new Set();
|
|
79
|
+
do {
|
|
80
|
+
tellByImports(open, reading, conflicting);
|
|
81
|
+
} while (withdrawTwoModules(open, reading, { named, conflicting }));
|
|
82
|
+
}
|
|
83
|
+
/** Gives each open file the module its imports, or else its importers, name, until nothing changes. */
|
|
84
|
+
function tellByImports(open, reading, conflicting) {
|
|
85
|
+
let changed = true;
|
|
86
|
+
while (changed) {
|
|
87
|
+
changed = false;
|
|
88
|
+
for (const placed of open.filter((candidate) => candidate.module === undefined && !conflicting.has(candidate))) {
|
|
89
|
+
const reached = modulesReached(placed, open, reading);
|
|
90
|
+
const importers = open.filter(({ file }) => (reading.imports.get(file) ?? []).includes(placed.file));
|
|
91
|
+
const told = reached.length > 0 ? only(reached) : only(importers.map(({ module }) => module));
|
|
92
|
+
if (told !== undefined) {
|
|
93
|
+
placed.module = told;
|
|
94
|
+
changed = true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** Takes its module back from every file whose imports name two modules; answers whether one was. */
|
|
100
|
+
function withdrawTwoModules(open, reading, { named, conflicting }) {
|
|
101
|
+
const twice = open.filter((placed) => placed.module !== undefined && !named.has(placed) && new Set(modulesReached(placed, open, reading)).size > 1);
|
|
102
|
+
for (const placed of twice) {
|
|
103
|
+
placed.module = undefined;
|
|
104
|
+
conflicting.add(placed);
|
|
105
|
+
}
|
|
106
|
+
return twice.length > 0;
|
|
107
|
+
}
|
|
108
|
+
/** The modules of the files a file imports, those of the open files told so far included. */
|
|
109
|
+
function modulesReached(placed, open, { known, imports }) {
|
|
110
|
+
return (imports.get(placed.file) ?? []).flatMap((file) => {
|
|
111
|
+
const module = known.get(file) ?? open.find((candidate) => candidate.file === file)?.module;
|
|
112
|
+
return module === undefined ? [] : [module];
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/** The one module of a list, undefined when it names none or two. */
|
|
116
|
+
function only(modules) {
|
|
117
|
+
const named = [...new Set(modules.filter((module) => module !== undefined))];
|
|
118
|
+
return named.length === 1 ? named[0] : undefined;
|
|
119
|
+
}
|
|
120
|
+
/** The module of the production file a spec is named after, the longest name winning. */
|
|
121
|
+
function namedAfter(spec, known, modules) {
|
|
122
|
+
const stem = posix.basename(spec).replace(/\.spec\.ts$/, '');
|
|
123
|
+
const matches = [...known].flatMap(([file, module]) => {
|
|
124
|
+
const name = posix.basename(file).replace(EXTENSION, '');
|
|
125
|
+
const own = module !== undefined && modules.includes(module) && !file.startsWith('test/');
|
|
126
|
+
return own && (stem === name || stem.startsWith(`${name}.`)) ? [{ module, length: name.length }] : [];
|
|
127
|
+
});
|
|
128
|
+
return matches.sort((left, right) => right.length - left.length)[0]?.module;
|
|
129
|
+
}
|
|
130
|
+
/** The files of the context a file imports, relative to the context and with their extension, by alias or relative path. */
|
|
131
|
+
function importsOf(ws, { directory, file, roots }) {
|
|
132
|
+
const text = ws.read(`${directory}/${file}`) ?? '';
|
|
133
|
+
return [...text.matchAll(SPECIFIER)].flatMap(([, , specifier = '']) => {
|
|
134
|
+
const bare = specifier.replace(EXTENSION, '');
|
|
135
|
+
const root = roots.find(({ prefix }) => bare.startsWith(prefix));
|
|
136
|
+
const target = bare.startsWith('.')
|
|
137
|
+
? posix.join(posix.dirname(`${directory}/${file}`), bare)
|
|
138
|
+
: root === undefined
|
|
139
|
+
? undefined
|
|
140
|
+
: `${root.directory}/${bare.slice(root.prefix.length)}`;
|
|
141
|
+
return target !== undefined && target.startsWith(`${directory}/`)
|
|
142
|
+
? [`${target.slice(directory.length + 1)}.ts`]
|
|
143
|
+
: [];
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=module-moves.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-moves.js","sourceRoot":"","sources":["../../src/context-layout/module-moves.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAkB,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACL,eAAe,EACf,UAAU,EACV,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAG1B,MAAM,SAAS,GAAG,+DAA+D,CAAC;AAClF,MAAM,SAAS,GAAG,cAAc,CAAC;AAiBjC;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,EAAa,EAAE,MAAc,EAAE,OAAe;IACxE,MAAM,SAAS,GAAG,GAAG,MAAM,CAAC,WAAW,IAAI,OAAO,EAAE,CAAC;IACrD,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,OAA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Groups(migration, plan);
|
|
14
14
|
for (const controller of plan.controllers) {
|
|
15
15
|
writeController(migration, plan, controller);
|
|
16
|
-
moveSpec(migration,
|
|
16
|
+
moveSpec(migration, controller);
|
|
17
17
|
}
|
|
18
18
|
moveSchemas(migration, plan);
|
|
19
19
|
return true;
|
|
@@ -31,9 +31,9 @@ function writeGroups({ draft }, { http, groups }) {
|
|
|
31
31
|
}
|
|
32
32
|
function writeController(migration, plan, controller) {
|
|
33
33
|
const { draft, config, renamed, moved } = migration;
|
|
34
|
-
const { route, types, body, resource, isPublic } = controller;
|
|
34
|
+
const { route, types, body, resource, isPublic, http } = controller;
|
|
35
35
|
const group = isPublic ? undefined : plan.groups.get(resource);
|
|
36
|
-
const target = `${
|
|
36
|
+
const target = `${http}/${resource}/${route.kebab}/${route.kebab}.controller.ts`;
|
|
37
37
|
const groupImport = group === undefined
|
|
38
38
|
? ''
|
|
39
39
|
: `import { ${group.className} } from '${specifierOf(config, `${plan.http}/${group.kebab}.routes.ts`)}';`;
|
|
@@ -42,23 +42,28 @@ function writeController(migration, plan, controller) {
|
|
|
42
42
|
renamed.set(route.file, target);
|
|
43
43
|
moved.push(`${route.kebab}.route.ts -> ${resource}/${route.kebab}/${route.kebab}.controller.ts`);
|
|
44
44
|
}
|
|
45
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* A schema file named after a route of its folder follows it, under the role its name ends with;
|
|
47
|
+
* any other is shared, under the name it had, in the shared folder of the context.
|
|
48
|
+
*/
|
|
46
49
|
function moveSchemas({ ws, draft, renamed }, plan) {
|
|
47
50
|
const byLength = [...plan.controllers].sort((left, right) => right.route.kebab.length - left.route.kebab.length);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
const folders = [...new Set([plan.http, ...plan.controllers.map(({ http }) => http)])];
|
|
52
|
+
for (const http of folders) {
|
|
53
|
+
for (const name of ws.list(http).filter((file) => file.endsWith('.dto.ts'))) {
|
|
54
|
+
const stem = name.replace(/\.dto\.ts$/, '');
|
|
55
|
+
const owner = byLength.find(({ route, http: own }) => own === http && ROLES.includes(stem.slice(route.kebab.length + 1)) && stem.startsWith(`${route.kebab}-`));
|
|
56
|
+
const target = owner === undefined
|
|
57
|
+
? `${plan.http}/shared/${name}`
|
|
58
|
+
: `${http}/${owner.resource}/${owner.route.kebab}/${owner.route.kebab}.${stem.slice(owner.route.kebab.length + 1)}.ts`;
|
|
59
|
+
draft.write(target, ws.read(`${http}/${name}`) ?? '');
|
|
60
|
+
draft.remove(`${http}/${name}`);
|
|
61
|
+
renamed.set(`${http}/${name}`, target);
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
/** The spec of the route becomes the spec of the controller alone: its guards have their own. */
|
|
60
|
-
function moveSpec({ ws, draft
|
|
61
|
-
const unit = `${config.contextsDir}/${plan.context}/test/unit`;
|
|
66
|
+
function moveSpec({ ws, draft }, { route, unit }) {
|
|
62
67
|
const source = ws.read(`${unit}/${route.kebab}.route.spec.ts`);
|
|
63
68
|
const factory = `${toName(route.kebab).camel}Route`;
|
|
64
69
|
if (source === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-context.js","sourceRoot":"","sources":["../../src/controllers/migrate-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,WAAW,EAA4C,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,mGAAmG;AACnG,MAAM,KAAK,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEnF,8HAA8H;AAC9H,MAA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@ -9,10 +9,14 @@ export interface PlannedController {
|
|
|
9
9
|
/** The folder of its resource: the first literal segment of its path, or the context. */
|
|
10
10
|
readonly resource: string;
|
|
11
11
|
readonly isPublic: boolean;
|
|
12
|
+
/** The `presentation/http` folder its route sits in: the context's, or that of a module of its model. */
|
|
13
|
+
readonly http: string;
|
|
14
|
+
/** The folder of the unit specs of that module, or of the context. */
|
|
15
|
+
readonly unit: string;
|
|
12
16
|
}
|
|
13
17
|
export interface ContextPlan {
|
|
14
18
|
readonly context: string;
|
|
15
|
-
/** `<contextsDir>/<context>/presentation/http
|
|
19
|
+
/** `<contextsDir>/<context>/presentation/http`, where the route groups are written. */
|
|
16
20
|
readonly http: string;
|
|
17
21
|
readonly controllers: readonly PlannedController[];
|
|
18
22
|
readonly groups: ReadonlyMap<string, MigratedGroup>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-context.d.ts","sourceRoot":"","sources":["../../src/controllers/plan-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plan-context.d.ts","sourceRoot":"","sources":["../../src/controllers/plan-context.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,yGAAyG;IACzG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uFAAuF;IACvF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACrD;AAED,uHAAuH;AACvH,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAmB1F"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { intoModule, moduleSplit, roleFilesOf, treeOf } from '../model-modules/index.js';
|
|
1
3
|
import { toName } from '../naming/index.js';
|
|
2
4
|
import { handleTypesOf } from './handle-types-of.js';
|
|
3
5
|
import { handleBody } from './handle-body.js';
|
|
@@ -5,9 +7,11 @@ import { readFunctionRoute } from './read-function-route.js';
|
|
|
5
7
|
/** Reads every function route of a context; one that cannot be turned blocks the whole context, said in `blockers`. */
|
|
6
8
|
export function planContext(migration, context) {
|
|
7
9
|
const { ws, config, blockers } = migration;
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
10
|
+
const tree = treeOf(config, context);
|
|
11
|
+
const http = `${tree.directory}/presentation/http`;
|
|
12
|
+
// The function routes of the context and those of each module of its model.
|
|
13
|
+
const files = roleFilesOf(ws, tree, 'presentation/http').filter(({ name }) => name.endsWith('.route.ts'));
|
|
14
|
+
const planned = files.map(({ path }) => plannedOf(path, ws.read(path) ?? '', { context, tree }));
|
|
11
15
|
const refused = planned.filter((entry) => typeof entry === 'string');
|
|
12
16
|
if (files.length === 0 || refused.length > 0) {
|
|
13
17
|
blockers.push(...refused);
|
|
@@ -16,7 +20,7 @@ export function planContext(migration, context) {
|
|
|
16
20
|
const controllers = planned.filter((entry) => typeof entry !== 'string');
|
|
17
21
|
return { context, http, controllers, groups: groupsOf(controllers, context) };
|
|
18
22
|
}
|
|
19
|
-
function plannedOf(file, source, context) {
|
|
23
|
+
function plannedOf(file, source, { context, tree }) {
|
|
20
24
|
const route = readFunctionRoute(file, source);
|
|
21
25
|
if (typeof route === 'string') {
|
|
22
26
|
return `${file}: ${route}.`;
|
|
@@ -29,7 +33,17 @@ function plannedOf(file, source, context) {
|
|
|
29
33
|
if (body === undefined) {
|
|
30
34
|
return `${file}: its handler answers something else than \`{ status, body }\` (headers, a status chosen at run time): keep it a function.`;
|
|
31
35
|
}
|
|
32
|
-
|
|
36
|
+
const http = posix.dirname(file);
|
|
37
|
+
const { module } = moduleSplit(file.slice(tree.directory.length + 1), tree.modules);
|
|
38
|
+
return {
|
|
39
|
+
route,
|
|
40
|
+
types,
|
|
41
|
+
body,
|
|
42
|
+
resource: resourceOf(route, context),
|
|
43
|
+
isPublic: route.spec.get('security') === 'false',
|
|
44
|
+
http,
|
|
45
|
+
unit: `${tree.directory}/${intoModule(module, 'test/unit')}`,
|
|
46
|
+
};
|
|
33
47
|
}
|
|
34
48
|
/** The first literal segment of the path names the resource; a path that starts with a parameter belongs to the context. */
|
|
35
49
|
function resourceOf(route, context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-context.js","sourceRoot":"","sources":["../../src/controllers/plan-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAoB,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"plan-context.js","sourceRoot":"","sources":["../../src/controllers/plan-context.ts"],"names":[],"mappings":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AC,CAAC;AAC1C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The generated summary of a declared context, relative to the context: what the composition
|
|
3
|
-
* root imports. It re-exports the declarations file of each
|
|
3
|
+
* root imports. It re-exports the declarations file of each layer (`folderDeclarationsFile`).
|
|
4
4
|
*/
|
|
5
5
|
export declare function barrelFile(context: string): string;
|
|
6
6
|
//# sourceMappingURL=barrel-file.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The generated summary of a declared context, relative to the context: what the composition
|
|
3
|
-
* root imports. It re-exports the declarations file of each
|
|
3
|
+
* root imports. It re-exports the declarations file of each layer (`folderDeclarationsFile`).
|
|
4
4
|
*/
|
|
5
5
|
export function barrelFile(context) {
|
|
6
6
|
return `${context}.declarations.ts`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ClassInjection } from './injection/class-injection.js';
|
|
2
2
|
import type { Sources } from './injection/sources.js';
|
|
3
|
+
import type { DeclarationsGrouping } from './declarations-folder-of.js';
|
|
3
4
|
/** A declared context, read where its files are. */
|
|
4
5
|
export interface DeclaredContext {
|
|
5
6
|
readonly context: string;
|
|
@@ -20,7 +21,8 @@ export interface ContextDeclarations {
|
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* What the generator writes for a context assembled by barrel, and what `declarations/barrel-current`
|
|
23
|
-
* compares the tree with: one declarations file per
|
|
24
|
+
* compares the tree with: one declarations file per layer and the summary at the root, or, for
|
|
25
|
+
* `keepsRoleFolderFiles`, one per role folder as 0.85 and 0.86 wrote them.
|
|
24
26
|
*/
|
|
25
|
-
export declare function contextDeclarations({ context, directory, entries, sources, modules, specifierOf
|
|
27
|
+
export declare function contextDeclarations({ context, directory, entries, sources, modules, specifierOf }: DeclaredContext, grouping?: DeclarationsGrouping): ContextDeclarations;
|
|
26
28
|
//# sourceMappingURL=context-declarations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-declarations.d.ts","sourceRoot":"","sources":["../../src/declared/context-declarations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"context-declarations.d.ts","sourceRoot":"","sources":["../../src/declared/context-declarations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAChD;AAED,uHAAuH;AACvH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC;CAChD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,eAAe,EAC/E,QAAQ,GAAE,oBAA8B,GACvC,mBAAmB,CAmBrB"}
|
|
@@ -3,14 +3,16 @@ import { renderInjections } from './injection/render-injections.js';
|
|
|
3
3
|
import { renderDeclarations } from './render-declarations.js';
|
|
4
4
|
/**
|
|
5
5
|
* What the generator writes for a context assembled by barrel, and what `declarations/barrel-current`
|
|
6
|
-
* compares the tree with: one declarations file per
|
|
6
|
+
* compares the tree with: one declarations file per layer and the summary at the root, or, for
|
|
7
|
+
* `keepsRoleFolderFiles`, one per role folder as 0.85 and 0.86 wrote them.
|
|
7
8
|
*/
|
|
8
|
-
export function contextDeclarations({ context, directory, entries, sources, modules, specifierOf,
|
|
9
|
+
export function contextDeclarations({ context, directory, entries, sources, modules, specifierOf }, grouping = 'layer') {
|
|
9
10
|
const injections = [];
|
|
10
11
|
const files = renderDeclarations({
|
|
11
12
|
context,
|
|
12
13
|
files: entries,
|
|
13
14
|
modules,
|
|
15
|
+
grouping,
|
|
14
16
|
specifierOf: (entry) => specifierOf(`${directory}/${entry}`),
|
|
15
17
|
injectedIn: (roleFiles) => {
|
|
16
18
|
const read = contextInjections(sources, { directory, entries: roleFiles, modules });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-declarations.js","sourceRoot":"","sources":["../../src/declared/context-declarations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"context-declarations.js","sourceRoot":"","sources":["../../src/declared/context-declarations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAsB3D;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAmB,EAC/E,QAAQ,GAAyB,OAAO;IAExC,MAAM,UAAU,GAAqB,EAAE,CAAC;IAExC,MAAM,KAAK,GAAG,kBAAkB,CAAC;QAC/B,OAAO;QACP,KAAK,EAAE,OAAO;QACd,OAAO;QACP,QAAQ;QACR,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,SAAS,IAAI,KAAK,EAAE,CAAC;QAC5D,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE;YACxB,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;YAEpF,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YAEzB,OAAO,gBAAgB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* (`application/commands/issue-invoice/issue-invoice.handler.ts`) or of a route
|
|
5
|
-
* (`presentation/http/invoices/issue-invoice/issue-invoice.controller.ts`) rolls up to
|
|
6
|
-
* `application/commands` or `presentation/http`; a file sitting directly in its layer
|
|
7
|
-
* (`infrastructure/tax-rates.gateway.ts`) belongs to the layer itself.
|
|
2
|
+
* How the declarations of a context are grouped: one file per layer, as the generator writes them,
|
|
3
|
+
* or one per role folder, as 0.85 and 0.86 wrote them (`keepsRoleFolderFiles` alone reads that one).
|
|
8
4
|
*/
|
|
9
|
-
export
|
|
5
|
+
export type DeclarationsGrouping = 'layer' | 'role-folder';
|
|
6
|
+
/**
|
|
7
|
+
* The folder whose generated declarations hold a role file of a context, both relative to the
|
|
8
|
+
* context: its layer, in the module of the model that holds it
|
|
9
|
+
* (`application/commands/issue-invoice/issue-invoice.handler.ts` and
|
|
10
|
+
* `presentation/http/invoices/issue-invoice/issue-invoice.controller.ts` go to `application` and
|
|
11
|
+
* `presentation`). Grouped by role folder, it is the folder at `<layer>/<folder>/`, and a file
|
|
12
|
+
* sitting directly in its layer (`infrastructure/tax-rates.gateway.ts`) goes to the layer itself.
|
|
13
|
+
*/
|
|
14
|
+
export declare function declarationsFolderOf(inModule: string, modules: readonly string[], grouping?: DeclarationsGrouping): string;
|
|
10
15
|
//# sourceMappingURL=declarations-folder-of.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations-folder-of.d.ts","sourceRoot":"","sources":["../../src/declared/declarations-folder-of.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"declarations-folder-of.d.ts","sourceRoot":"","sources":["../../src/declared/declarations-folder-of.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,aAAa,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,QAAQ,GAAE,oBAA8B,GACvC,MAAM,CASR"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { moduleSplit } from '../model-modules/index.js';
|
|
2
2
|
/**
|
|
3
|
-
* The
|
|
4
|
-
*
|
|
5
|
-
* (`application/commands/issue-invoice/issue-invoice.handler.ts`
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
* (`infrastructure/tax-rates.gateway.ts`)
|
|
3
|
+
* The folder whose generated declarations hold a role file of a context, both relative to the
|
|
4
|
+
* context: its layer, in the module of the model that holds it
|
|
5
|
+
* (`application/commands/issue-invoice/issue-invoice.handler.ts` and
|
|
6
|
+
* `presentation/http/invoices/issue-invoice/issue-invoice.controller.ts` go to `application` and
|
|
7
|
+
* `presentation`). Grouped by role folder, it is the folder at `<layer>/<folder>/`, and a file
|
|
8
|
+
* sitting directly in its layer (`infrastructure/tax-rates.gateway.ts`) goes to the layer itself.
|
|
9
9
|
*/
|
|
10
|
-
export function declarationsFolderOf(inModule, modules) {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
10
|
+
export function declarationsFolderOf(inModule, modules, grouping = 'layer') {
|
|
11
|
+
const parts = moduleSplit(inModule, modules).path.split('/');
|
|
12
|
+
const kept = grouping === 'role-folder' && parts.length > 2 ? 2 : 1;
|
|
13
|
+
// The part of the path below the folder is the same in a module and outside one.
|
|
14
|
+
return inModule
|
|
15
|
+
.split('/')
|
|
16
|
+
.slice(0, kept - parts.length)
|
|
17
|
+
.join('/');
|
|
14
18
|
}
|
|
15
19
|
//# sourceMappingURL=declarations-folder-of.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations-folder-of.js","sourceRoot":"","sources":["../../src/declared/declarations-folder-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"declarations-folder-of.js","sourceRoot":"","sources":["../../src/declared/declarations-folder-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQ/C;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAgB,EAChB,OAA0B,EAC1B,QAAQ,GAAyB,OAAO;IAExC,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,QAAQ,KAAK,aAAa,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpE,iFAAiF;IACjF,OAAO,QAAQ;SACZ,KAAK,CAAC,GAAG,CAAC;SACV,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;SAC7B,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A layout of the declarations an earlier version of the generator wrote, accepted while it is current. */
|
|
2
|
+
export type EarlierLayout = 'single-file' | 'role-folders';
|
|
3
|
+
/** What a finding, a note or a warning says of a context that keeps an earlier layout. */
|
|
4
|
+
export interface EarlierLayoutNotice {
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly fix: string;
|
|
7
|
+
}
|
|
8
|
+
/** What `check`, `docs --check` and `generate --local-only` say of a context that keeps an earlier layout (`earlierLayoutOf`). */
|
|
9
|
+
export declare function earlierLayoutNotice(context: string, layout: EarlierLayout): EarlierLayoutNotice;
|
|
10
|
+
//# sourceMappingURL=earlier-layout-notice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier-layout-notice.d.ts","sourceRoot":"","sources":["../../src/declared/earlier-layout-notice.ts"],"names":[],"mappings":"AAEA,4GAA4G;AAC5G,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;AAE3D,0FAA0F;AAC1F,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,kIAAkI;AAClI,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,mBAAmB,CAU/F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { barrelFile } from './barrel-file.js';
|
|
2
|
+
/** What `check`, `docs --check` and `generate --local-only` say of a context that keeps an earlier layout (`earlierLayoutOf`). */
|
|
3
|
+
export function earlierLayoutNotice(context, layout) {
|
|
4
|
+
const kept = layout === 'single-file'
|
|
5
|
+
? `still keeps all its declarations in ${barrelFile(context)}, the single file the generator wrote up to 0.84`
|
|
6
|
+
: 'still keeps its declarations in one file per role folder (application/commands/commands.declarations.ts), as the generator wrote them in 0.85 and 0.86';
|
|
7
|
+
return {
|
|
8
|
+
message: `"${context}" ${kept}: they are current, so this version accepts them, and a later minor version reports them as an error.`,
|
|
9
|
+
fix: `Run \`npx ddd-ts-kit docs\` (or any \`generate\`, or \`npm run dev\`), which writes the <layer>.declarations.ts of each layer${layout === 'role-folders' ? ', deletes those of the role folders' : ''} and rewrites ${barrelFile(context)} as their summary, and commit the result.`,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=earlier-layout-notice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier-layout-notice.js","sourceRoot":"","sources":["../../src/declared/earlier-layout-notice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAW3C,kIAAkI;AAClI,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,MAAqB;IACxE,MAAM,IAAI,GACR,MAAM,KAAK,aAAa;QACtB,CAAC,CAAC,uCAAuC,UAAU,CAAC,OAAO,CAAC,kDAAkD;QAC9G,CAAC,CAAC,wJAAwJ,CAAC;IAE/J,OAAO;QACL,OAAO,EAAE,IAAI,OAAO,KAAK,IAAI,uGAAuG;QACpI,GAAG,EAAE,gIAAgI,MAAM,KAAK,cAAc,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,EAAE,iBAAiB,UAAU,CAAC,OAAO,CAAC,2CAA2C;KAC3R,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DeclaredContext } from './context-declarations.js';
|
|
2
|
+
import type { EarlierLayout } from './earlier-layout-notice.js';
|
|
3
|
+
/**
|
|
4
|
+
* The earlier layout a context keeps its declarations in, current for its tree of today, or
|
|
5
|
+
* undefined when it keeps none: the single file of 0.84 (`keepsSingleFile`) or the files of its
|
|
6
|
+
* role folders of 0.85 and 0.86 (`keepsRoleFolderFiles`). `read` gives the text of a file
|
|
7
|
+
* relative to the context.
|
|
8
|
+
*/
|
|
9
|
+
export declare function earlierLayoutOf(declared: DeclaredContext, read: (entry: string) => string | undefined): EarlierLayout | undefined;
|
|
10
|
+
//# sourceMappingURL=earlier-layout-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier-layout-of.d.ts","sourceRoot":"","sources":["../../src/declared/earlier-layout-of.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC1C,aAAa,GAAG,SAAS,CAM3B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { barrelFile } from './barrel-file.js';
|
|
2
|
+
import { keepsRoleFolderFiles } from './keeps-role-folder-files.js';
|
|
3
|
+
import { keepsSingleFile } from './keeps-single-file.js';
|
|
4
|
+
/**
|
|
5
|
+
* The earlier layout a context keeps its declarations in, current for its tree of today, or
|
|
6
|
+
* undefined when it keeps none: the single file of 0.84 (`keepsSingleFile`) or the files of its
|
|
7
|
+
* role folders of 0.85 and 0.86 (`keepsRoleFolderFiles`). `read` gives the text of a file
|
|
8
|
+
* relative to the context.
|
|
9
|
+
*/
|
|
10
|
+
export function earlierLayoutOf(declared, read) {
|
|
11
|
+
if (keepsSingleFile(declared, read(barrelFile(declared.context)))) {
|
|
12
|
+
return 'single-file';
|
|
13
|
+
}
|
|
14
|
+
return keepsRoleFolderFiles(declared, read) ? 'role-folders' : undefined;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=earlier-layout-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier-layout-of.js","sourceRoot":"","sources":["../../src/declared/earlier-layout-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAyB,EACzB,IAA2C;IAE3C,IAAI,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,OAAO,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type DeclaredContext } from './context-declarations.js';
|
|
2
|
+
import type { EarlierLayout } from './earlier-layout-notice.js';
|
|
3
|
+
/**
|
|
4
|
+
* The earlier layout a context is laid out in, current or not: what `docs --check` and
|
|
5
|
+
* `generate --local-only` keep it in, so that a role file written there is declared as that
|
|
6
|
+
* version would declare it and nothing else moves. The single file of 0.84 when
|
|
7
|
+
* `<context>.declarations.ts` is the only declarations file and exports role files itself; the
|
|
8
|
+
* files of the role folders of 0.85 and 0.86 when one of them is there and no declarations file
|
|
9
|
+
* of a layer that grouping would not write. `read` gives the text of a file relative to the
|
|
10
|
+
* context. A context half moved, or written the same in both layouts, keeps none.
|
|
11
|
+
*/
|
|
12
|
+
export declare function earlierShapeOf(declared: DeclaredContext, read: (entry: string) => string | undefined): EarlierLayout | undefined;
|
|
13
|
+
//# sourceMappingURL=earlier-shape-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier-shape-of.d.ts","sourceRoot":"","sources":["../../src/declared/earlier-shape-of.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM7D;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC1C,aAAa,GAAG,SAAS,CAgB3B"}
|