ddd-ts-kit 0.110.1 → 0.112.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 +164 -0
- package/README.fr.md +39 -8
- package/README.md +36 -7
- package/dist/alias/index.d.ts +2 -0
- package/dist/alias/index.d.ts.map +1 -1
- package/dist/alias/index.js +2 -0
- package/dist/alias/index.js.map +1 -1
- package/dist/alias/neighbour-sources.d.ts +17 -0
- package/dist/alias/neighbour-sources.d.ts.map +1 -0
- package/dist/alias/neighbour-sources.js +11 -0
- package/dist/alias/neighbour-sources.js.map +1 -0
- package/dist/alias/neighbour-suffix.d.ts +8 -0
- package/dist/alias/neighbour-suffix.d.ts.map +1 -0
- package/dist/alias/neighbour-suffix.js +10 -0
- package/dist/alias/neighbour-suffix.js.map +1 -0
- package/dist/build/rewrite-aliases.d.ts.map +1 -1
- package/dist/build/rewrite-aliases.js +11 -0
- package/dist/build/rewrite-aliases.js.map +1 -1
- package/dist/check/alias/build-scripts.d.ts.map +1 -1
- package/dist/check/alias/build-scripts.js +4 -8
- package/dist/check/alias/build-scripts.js.map +1 -1
- package/dist/check/alias/compiler-options-of.d.ts +3 -3
- package/dist/check/alias/compiler-options-of.js +17 -6
- package/dist/check/alias/compiler-options-of.js.map +1 -1
- package/dist/check/alias/neighbour-sources.d.ts +12 -0
- package/dist/check/alias/neighbour-sources.d.ts.map +1 -0
- package/dist/check/alias/neighbour-sources.js +80 -0
- package/dist/check/alias/neighbour-sources.js.map +1 -0
- package/dist/check/alias/script-steps.d.ts +11 -0
- package/dist/check/alias/script-steps.d.ts.map +1 -0
- package/dist/check/alias/script-steps.js +22 -0
- package/dist/check/alias/script-steps.js.map +1 -0
- package/dist/check/aspects/adapter-policies.d.ts +10 -0
- package/dist/check/aspects/adapter-policies.d.ts.map +1 -0
- package/dist/check/aspects/adapter-policies.js +104 -0
- package/dist/check/aspects/adapter-policies.js.map +1 -0
- package/dist/check/aspects/adapter-policy.d.ts +18 -0
- package/dist/check/aspects/adapter-policy.d.ts.map +1 -0
- package/dist/check/aspects/adapter-policy.js +2 -0
- package/dist/check/aspects/adapter-policy.js.map +1 -0
- package/dist/check/aspects/is-under-condition.d.ts +7 -0
- package/dist/check/aspects/is-under-condition.d.ts.map +1 -0
- package/dist/check/aspects/is-under-condition.js +50 -0
- package/dist/check/aspects/is-under-condition.js.map +1 -0
- package/dist/check/aspects/stated-policy.d.ts +18 -0
- package/dist/check/aspects/stated-policy.d.ts.map +1 -0
- package/dist/check/aspects/stated-policy.js +39 -0
- package/dist/check/aspects/stated-policy.js.map +1 -0
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +4 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/explain/imports-docs.d.ts.map +1 -1
- package/dist/check/explain/imports-docs.js +5 -3
- package/dist/check/explain/imports-docs.js.map +1 -1
- package/dist/check/explain/persistence-docs.d.ts.map +1 -1
- package/dist/check/explain/persistence-docs.js +21 -0
- package/dist/check/explain/persistence-docs.js.map +1 -1
- package/dist/check/explain/standard-docs.d.ts.map +1 -1
- package/dist/check/explain/standard-docs.js +16 -0
- package/dist/check/explain/standard-docs.js.map +1 -1
- package/dist/check/explain/tenancy-docs.d.ts.map +1 -1
- package/dist/check/explain/tenancy-docs.js +3 -1
- package/dist/check/explain/tenancy-docs.js.map +1 -1
- package/dist/check/files/kit-content-types.d.ts +12 -0
- package/dist/check/files/kit-content-types.d.ts.map +1 -0
- package/dist/check/files/kit-content-types.js +38 -0
- package/dist/check/files/kit-content-types.js.map +1 -0
- package/dist/check/files/upload-content-defect.d.ts +7 -0
- package/dist/check/files/upload-content-defect.d.ts.map +1 -0
- package/dist/check/files/upload-content-defect.js +2 -0
- package/dist/check/files/upload-content-defect.js.map +1 -0
- package/dist/check/files/upload-content-defects.d.ts +9 -0
- package/dist/check/files/upload-content-defects.d.ts.map +1 -0
- package/dist/check/files/upload-content-defects.js +54 -0
- package/dist/check/files/upload-content-defects.js.map +1 -0
- package/dist/check/files/upload-declaration.d.ts +7 -0
- package/dist/check/files/upload-declaration.d.ts.map +1 -0
- package/dist/check/files/upload-declaration.js +2 -0
- package/dist/check/files/upload-declaration.js.map +1 -0
- package/dist/check/files/upload-declarations.d.ts +9 -0
- package/dist/check/files/upload-declarations.d.ts.map +1 -0
- package/dist/check/files/upload-declarations.js +41 -0
- package/dist/check/files/upload-declarations.js.map +1 -0
- package/dist/check/fixtures/alias-declared-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/alias-declared-fixtures.js +95 -1
- package/dist/check/fixtures/alias-declared-fixtures.js.map +1 -1
- 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/imports-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/imports-fixtures.js +97 -0
- package/dist/check/fixtures/imports-fixtures.js.map +1 -1
- package/dist/check/fixtures/standard-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/standard-fixtures.js +42 -0
- package/dist/check/fixtures/standard-fixtures.js.map +1 -1
- package/dist/check/fixtures/tenancy-advisory-lock-fixtures.d.ts +9 -0
- package/dist/check/fixtures/tenancy-advisory-lock-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-advisory-lock-fixtures.js +45 -0
- package/dist/check/fixtures/tenancy-advisory-lock-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tenancy-fixtures.js +2 -0
- package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
- package/dist/check/fixtures/upload-fixtures.d.ts +3 -0
- package/dist/check/fixtures/upload-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/upload-fixtures.js +94 -0
- package/dist/check/fixtures/upload-fixtures.js.map +1 -0
- package/dist/check/migrations/is-working-migration.d.ts +6 -0
- package/dist/check/migrations/is-working-migration.d.ts.map +1 -0
- package/dist/check/migrations/is-working-migration.js +8 -0
- package/dist/check/migrations/is-working-migration.js.map +1 -0
- package/dist/check/migrations/journal-entries.d.ts +4 -0
- package/dist/check/migrations/journal-entries.d.ts.map +1 -0
- package/dist/check/migrations/journal-entries.js +21 -0
- package/dist/check/migrations/journal-entries.js.map +1 -0
- package/dist/check/migrations/read-drizzle-migrations.d.ts.map +1 -1
- package/dist/check/migrations/read-drizzle-migrations.js +4 -9
- package/dist/check/migrations/read-drizzle-migrations.js.map +1 -1
- package/dist/check/modules/imported-modules.d.ts +4 -0
- package/dist/check/modules/imported-modules.d.ts.map +1 -0
- package/dist/check/modules/imported-modules.js +5 -0
- package/dist/check/modules/imported-modules.js.map +1 -0
- package/dist/check/modules/module-imports.d.ts +17 -0
- package/dist/check/modules/module-imports.d.ts.map +1 -0
- package/dist/check/modules/module-imports.js +23 -0
- package/dist/check/modules/module-imports.js.map +1 -0
- package/dist/check/project/assemble-project.d.ts.map +1 -1
- package/dist/check/project/assemble-project.js +1 -8
- package/dist/check/project/assemble-project.js.map +1 -1
- package/dist/check/project/file-severity.d.ts +4 -0
- package/dist/check/project/file-severity.d.ts.map +1 -0
- package/dist/check/project/file-severity.js +11 -0
- package/dist/check/project/file-severity.js.map +1 -0
- package/dist/check/project/load-project.js +1 -10
- package/dist/check/project/load-project.js.map +1 -1
- package/dist/check/project/not-in-the-tree.d.ts +10 -0
- package/dist/check/project/not-in-the-tree.d.ts.map +1 -0
- package/dist/check/project/not-in-the-tree.js +17 -0
- package/dist/check/project/not-in-the-tree.js.map +1 -0
- package/dist/check/project/skipped-directories.d.ts +3 -0
- package/dist/check/project/skipped-directories.d.ts.map +1 -0
- package/dist/check/project/skipped-directories.js +3 -0
- package/dist/check/project/skipped-directories.js.map +1 -0
- package/dist/check/project/walk-directory.d.ts.map +1 -1
- package/dist/check/project/walk-directory.js +1 -1
- package/dist/check/project/walk-directory.js.map +1 -1
- package/dist/check/rules/aspects-timeout-covers-delegate.d.ts +3 -0
- package/dist/check/rules/aspects-timeout-covers-delegate.d.ts.map +1 -0
- package/dist/check/rules/aspects-timeout-covers-delegate.js +179 -0
- package/dist/check/rules/aspects-timeout-covers-delegate.js.map +1 -0
- package/dist/check/rules/files-upload-content-rule.d.ts +3 -0
- package/dist/check/rules/files-upload-content-rule.d.ts.map +1 -0
- package/dist/check/rules/files-upload-content-rule.js +25 -0
- package/dist/check/rules/files-upload-content-rule.js.map +1 -0
- package/dist/check/rules/imports-alias-declared.d.ts.map +1 -1
- package/dist/check/rules/imports-alias-declared.js +3 -1
- package/dist/check/rules/imports-alias-declared.js.map +1 -1
- package/dist/check/rules/imports-alias-only.d.ts.map +1 -1
- package/dist/check/rules/imports-alias-only.js +86 -7
- package/dist/check/rules/imports-alias-only.js.map +1 -1
- package/dist/check/rules/module-no-cycle.d.ts.map +1 -1
- package/dist/check/rules/module-no-cycle.js +12 -34
- package/dist/check/rules/module-no-cycle.js.map +1 -1
- package/dist/check/rules/privacy-declared-field.js +1 -1
- package/dist/check/rules/privacy-declared-field.js.map +1 -1
- package/dist/check/rules/tenancy-scoped-statement.d.ts.map +1 -1
- package/dist/check/rules/tenancy-scoped-statement.js +11 -3
- package/dist/check/rules/tenancy-scoped-statement.js.map +1 -1
- package/dist/cli-error.d.ts +7 -2
- package/dist/cli-error.d.ts.map +1 -1
- package/dist/cli-error.js +8 -2
- package/dist/cli-error.js.map +1 -1
- package/dist/commands/generate.js +3 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/knex-generate.d.ts.map +1 -1
- package/dist/commands/knex-generate.js +2 -1
- package/dist/commands/knex-generate.js.map +1 -1
- package/dist/commands/move-to-module.d.ts +6 -1
- package/dist/commands/move-to-module.d.ts.map +1 -1
- package/dist/commands/move-to-module.js +28 -3
- package/dist/commands/move-to-module.js.map +1 -1
- package/dist/commands/prisma-generate.d.ts.map +1 -1
- package/dist/commands/prisma-generate.js +2 -1
- package/dist/commands/prisma-generate.js.map +1 -1
- package/dist/commands/typeorm-generate.d.ts.map +1 -1
- package/dist/commands/typeorm-generate.js +2 -1
- package/dist/commands/typeorm-generate.js.map +1 -1
- package/dist/commands/verify-merge.d.ts +4 -2
- package/dist/commands/verify-merge.d.ts.map +1 -1
- package/dist/commands/verify-merge.js +8 -5
- package/dist/commands/verify-merge.js.map +1 -1
- package/dist/context-layout/context-layout.d.ts.map +1 -1
- package/dist/context-layout/context-layout.js +6 -0
- package/dist/context-layout/context-layout.js.map +1 -1
- package/dist/context-layout/module-moves.d.ts +8 -0
- package/dist/context-layout/module-moves.d.ts.map +1 -1
- package/dist/context-layout/module-moves.js +14 -3
- package/dist/context-layout/module-moves.js.map +1 -1
- package/dist/context-layout/runner-configs-by-hand.d.ts.map +1 -1
- package/dist/context-layout/runner-configs-by-hand.js +12 -0
- package/dist/context-layout/runner-configs-by-hand.js.map +1 -1
- package/dist/context-layout/settle.d.ts +9 -0
- package/dist/context-layout/settle.d.ts.map +1 -1
- package/dist/context-layout/settle.js +25 -3
- package/dist/context-layout/settle.js.map +1 -1
- package/dist/describe/read-adapters.d.ts.map +1 -1
- package/dist/describe/read-adapters.js +5 -1
- package/dist/describe/read-adapters.js.map +1 -1
- package/dist/describe/read-ports.js +8 -1
- package/dist/describe/read-ports.js.map +1 -1
- package/dist/generate/generate-options.d.ts +10 -0
- package/dist/generate/generate-options.d.ts.map +1 -1
- package/dist/generate/generate-options.js +3 -0
- package/dist/generate/generate-options.js.map +1 -1
- package/dist/generate/kind.d.ts +6 -0
- 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 +12 -0
- package/dist/generate/kinds/adapter-kind.js.map +1 -1
- package/dist/generate/kinds/declare-storage.d.ts.map +1 -1
- package/dist/generate/kinds/declare-storage.js +3 -57
- package/dist/generate/kinds/declare-storage.js.map +1 -1
- package/dist/generate/kinds/declare-table.d.ts +14 -0
- package/dist/generate/kinds/declare-table.d.ts.map +1 -0
- package/dist/generate/kinds/declare-table.js +72 -0
- package/dist/generate/kinds/declare-table.js.map +1 -0
- package/dist/generate/kinds/e2e/job-slug.d.ts +3 -0
- package/dist/generate/kinds/e2e/job-slug.d.ts.map +1 -0
- package/dist/generate/kinds/e2e/job-slug.js +8 -0
- package/dist/generate/kinds/e2e/job-slug.js.map +1 -0
- package/dist/generate/kinds/e2e/job-spec.d.ts +16 -0
- package/dist/generate/kinds/e2e/job-spec.d.ts.map +1 -0
- package/dist/generate/kinds/e2e/job-spec.js +54 -0
- package/dist/generate/kinds/e2e/job-spec.js.map +1 -0
- package/dist/generate/kinds/e2e/jobs-sending.d.ts +17 -5
- package/dist/generate/kinds/e2e/jobs-sending.d.ts.map +1 -1
- package/dist/generate/kinds/e2e/jobs-sending.js +15 -6
- package/dist/generate/kinds/e2e/jobs-sending.js.map +1 -1
- package/dist/generate/kinds/e2e/reaction-of.d.ts +5 -5
- package/dist/generate/kinds/e2e/reaction-of.d.ts.map +1 -1
- package/dist/generate/kinds/e2e/reaction-of.js +15 -8
- package/dist/generate/kinds/e2e/reaction-of.js.map +1 -1
- package/dist/generate/kinds/e2e/starting-jobs.d.ts +10 -0
- package/dist/generate/kinds/e2e/starting-jobs.d.ts.map +1 -0
- package/dist/generate/kinds/e2e/starting-jobs.js +33 -0
- package/dist/generate/kinds/e2e/starting-jobs.js.map +1 -0
- package/dist/generate/kinds/e2e-kind.d.ts.map +1 -1
- package/dist/generate/kinds/e2e-kind.js +47 -35
- package/dist/generate/kinds/e2e-kind.js.map +1 -1
- package/dist/generate/kinds/file-upload/upload-file-vars.d.ts +9 -0
- package/dist/generate/kinds/file-upload/upload-file-vars.d.ts.map +1 -0
- package/dist/generate/kinds/file-upload/upload-file-vars.js +39 -0
- package/dist/generate/kinds/file-upload/upload-file-vars.js.map +1 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts.map +1 -1
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.js +2 -1
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.js.map +1 -1
- package/dist/generate/kinds/file-upload/write-upload-controller.d.ts.map +1 -1
- package/dist/generate/kinds/file-upload/write-upload-controller.js +2 -1
- package/dist/generate/kinds/file-upload/write-upload-controller.js.map +1 -1
- package/dist/generate/kinds/file-upload-kind.d.ts.map +1 -1
- package/dist/generate/kinds/file-upload-kind.js +5 -3
- package/dist/generate/kinds/file-upload-kind.js.map +1 -1
- package/dist/generate/kinds/generate-repository.d.ts +8 -0
- package/dist/generate/kinds/generate-repository.d.ts.map +1 -1
- package/dist/generate/kinds/generate-repository.js +2 -13
- package/dist/generate/kinds/generate-repository.js.map +1 -1
- package/dist/generate/kinds/note-the-migration.d.ts +4 -0
- package/dist/generate/kinds/note-the-migration.d.ts.map +1 -0
- package/dist/generate/kinds/note-the-migration.js +13 -0
- package/dist/generate/kinds/note-the-migration.js.map +1 -0
- package/dist/generate/kinds/personal-data/columns-of-table.d.ts +18 -0
- package/dist/generate/kinds/personal-data/columns-of-table.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/columns-of-table.js +31 -0
- package/dist/generate/kinds/personal-data/columns-of-table.js.map +1 -0
- package/dist/generate/kinds/personal-data/declare-personal-data.d.ts.map +1 -1
- package/dist/generate/kinds/personal-data/declare-personal-data.js +7 -52
- package/dist/generate/kinds/personal-data/declare-personal-data.js.map +1 -1
- package/dist/generate/kinds/personal-data/declare-table-personal-fields.d.ts +11 -0
- package/dist/generate/kinds/personal-data/declare-table-personal-fields.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/declare-table-personal-fields.js +71 -0
- package/dist/generate/kinds/personal-data/declare-table-personal-fields.js.map +1 -0
- package/dist/generate/kinds/personal-data/personal-request-of-table.d.ts +11 -0
- package/dist/generate/kinds/personal-data/personal-request-of-table.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/personal-request-of-table.js +20 -0
- package/dist/generate/kinds/personal-data/personal-request-of-table.js.map +1 -0
- package/dist/generate/kinds/personal-data/personal-vars.d.ts +7 -0
- package/dist/generate/kinds/personal-data/personal-vars.d.ts.map +1 -1
- package/dist/generate/kinds/personal-data/personal-vars.js +14 -11
- package/dist/generate/kinds/personal-data/personal-vars.js.map +1 -1
- package/dist/generate/kinds/personal-data/schema-table.d.ts +13 -0
- package/dist/generate/kinds/personal-data/schema-table.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/schema-table.js +2 -0
- package/dist/generate/kinds/personal-data/schema-table.js.map +1 -0
- package/dist/generate/kinds/personal-data/schema-tables-of.d.ts +9 -0
- package/dist/generate/kinds/personal-data/schema-tables-of.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/schema-tables-of.js +78 -0
- package/dist/generate/kinds/personal-data/schema-tables-of.js.map +1 -0
- package/dist/generate/kinds/personal-data/table-of-schema.d.ts +15 -0
- package/dist/generate/kinds/personal-data/table-of-schema.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/table-of-schema.js +39 -0
- package/dist/generate/kinds/personal-data/table-of-schema.js.map +1 -0
- package/dist/generate/kinds/personal-data/write-personal-declaration.d.ts +20 -0
- package/dist/generate/kinds/personal-data/write-personal-declaration.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/write-personal-declaration.js +63 -0
- package/dist/generate/kinds/personal-data/write-personal-declaration.js.map +1 -0
- package/dist/generate/kinds/personal-fields-kind.d.ts +3 -0
- package/dist/generate/kinds/personal-fields-kind.d.ts.map +1 -0
- package/dist/generate/kinds/personal-fields-kind.js +15 -0
- package/dist/generate/kinds/personal-fields-kind.js.map +1 -0
- package/dist/generate/kinds/projection-kind.d.ts.map +1 -1
- package/dist/generate/kinds/projection-kind.js +2 -1
- package/dist/generate/kinds/projection-kind.js.map +1 -1
- package/dist/generate/kinds/read-model/field-lines.d.ts +11 -0
- package/dist/generate/kinds/read-model/field-lines.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/field-lines.js +85 -0
- package/dist/generate/kinds/read-model/field-lines.js.map +1 -0
- package/dist/generate/kinds/read-model/list-read-model.d.ts +17 -0
- package/dist/generate/kinds/read-model/list-read-model.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/list-read-model.js +22 -0
- package/dist/generate/kinds/read-model/list-read-model.js.map +1 -0
- package/dist/generate/kinds/read-model/live-rows-check.d.ts +22 -0
- package/dist/generate/kinds/read-model/live-rows-check.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/live-rows-check.js +47 -0
- package/dist/generate/kinds/read-model/live-rows-check.js.map +1 -0
- package/dist/generate/kinds/read-model/read-model-fields.d.ts +19 -0
- package/dist/generate/kinds/read-model/read-model-fields.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/read-model-fields.js +31 -0
- package/dist/generate/kinds/read-model/read-model-fields.js.map +1 -0
- package/dist/generate/kinds/read-model/read-model-store.d.ts +24 -0
- package/dist/generate/kinds/read-model/read-model-store.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/read-model-store.js +39 -0
- package/dist/generate/kinds/read-model/read-model-store.js.map +1 -0
- package/dist/generate/kinds/read-model/read-model-table.d.ts +11 -0
- package/dist/generate/kinds/read-model/read-model-table.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/read-model-table.js +2 -0
- package/dist/generate/kinds/read-model/read-model-table.js.map +1 -0
- package/dist/generate/kinds/read-model-kind.d.ts +3 -0
- package/dist/generate/kinds/read-model-kind.d.ts.map +1 -0
- package/dist/generate/kinds/read-model-kind.js +103 -0
- package/dist/generate/kinds/read-model-kind.js.map +1 -0
- package/dist/generate/kinds/service-kind.d.ts.map +1 -1
- package/dist/generate/kinds/service-kind.js +8 -0
- package/dist/generate/kinds/service-kind.js.map +1 -1
- package/dist/generate/kinds/wire-context.d.ts.map +1 -1
- package/dist/generate/kinds/wire-context.js +4 -0
- package/dist/generate/kinds/wire-context.js.map +1 -1
- package/dist/generate/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +4 -0
- package/dist/generate/kinds.js.map +1 -1
- package/dist/generate/shared-writes.d.ts.map +1 -1
- package/dist/generate/shared-writes.js +9 -0
- package/dist/generate/shared-writes.js.map +1 -1
- package/dist/help/tool-notes.d.ts.map +1 -1
- package/dist/help/tool-notes.js +7 -2
- package/dist/help/tool-notes.js.map +1 -1
- package/dist/help/usage.js +1 -1
- package/dist/help/work-notes.d.ts.map +1 -1
- package/dist/help/work-notes.js +9 -2
- package/dist/help/work-notes.js.map +1 -1
- package/dist/init/files/end-to-end-files.d.ts.map +1 -1
- package/dist/init/files/end-to-end-files.js +3 -0
- package/dist/init/files/end-to-end-files.js.map +1 -1
- package/dist/init/files/persistence-files.d.ts.map +1 -1
- package/dist/init/files/persistence-files.js +8 -0
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/files/script-files.d.ts +2 -1
- package/dist/init/files/script-files.d.ts.map +1 -1
- package/dist/init/files/script-files.js +6 -1
- package/dist/init/files/script-files.js.map +1 -1
- package/dist/init/is-team-file.d.ts +2 -2
- package/dist/init/is-team-file.d.ts.map +1 -1
- package/dist/init/is-team-file.js +5 -4
- package/dist/init/is-team-file.js.map +1 -1
- package/dist/init/list-read-models.d.ts +17 -0
- package/dist/init/list-read-models.d.ts.map +1 -0
- package/dist/init/list-read-models.js +74 -0
- package/dist/init/list-read-models.js.map +1 -0
- package/dist/init/manifest/database-scripts.d.ts.map +1 -1
- package/dist/init/manifest/database-scripts.js +8 -0
- package/dist/init/manifest/database-scripts.js.map +1 -1
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +10 -7
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/versions.js +25 -25
- package/dist/init/rewire-contexts.d.ts +4 -2
- package/dist/init/rewire-contexts.d.ts.map +1 -1
- package/dist/init/rewire-contexts.js +10 -2
- package/dist/init/rewire-contexts.js.map +1 -1
- package/dist/init/run-init.js +1 -1
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/wiring-notes.js +1 -1
- package/dist/init/wiring-notes.js.map +1 -1
- package/dist/init/write-type-script-configs.d.ts +3 -1
- package/dist/init/write-type-script-configs.d.ts.map +1 -1
- package/dist/init/write-type-script-configs.js +14 -2
- package/dist/init/write-type-script-configs.js.map +1 -1
- package/dist/layout/fit-block.js +4 -0
- package/dist/layout/fit-block.js.map +1 -1
- package/dist/merge/format-merge-report.js +5 -2
- package/dist/merge/format-merge-report.js.map +1 -1
- package/dist/merge/land-drizzle.d.ts +4 -0
- package/dist/merge/land-drizzle.d.ts.map +1 -1
- package/dist/merge/land-drizzle.js +6 -1
- package/dist/merge/land-drizzle.js.map +1 -1
- package/dist/merge/land-up-to-date.d.ts +15 -0
- package/dist/merge/land-up-to-date.d.ts.map +1 -0
- package/dist/merge/land-up-to-date.js +76 -0
- package/dist/merge/land-up-to-date.js.map +1 -0
- package/dist/merge/lost/format-merge-verification.d.ts +2 -1
- package/dist/merge/lost/format-merge-verification.d.ts.map +1 -1
- package/dist/merge/lost/format-merge-verification.js +13 -2
- package/dist/merge/lost/format-merge-verification.js.map +1 -1
- package/dist/merge/lost/merge-verification.d.ts +4 -0
- package/dist/merge/lost/merge-verification.d.ts.map +1 -1
- package/dist/merge/lost/verify-merges.d.ts +2 -1
- package/dist/merge/lost/verify-merges.d.ts.map +1 -1
- package/dist/merge/lost/verify-merges.js +10 -4
- package/dist/merge/lost/verify-merges.js.map +1 -1
- package/dist/merge/merge-trunk.d.ts +2 -1
- package/dist/merge/merge-trunk.d.ts.map +1 -1
- package/dist/merge/merge-trunk.js +5 -2
- package/dist/merge/merge-trunk.js.map +1 -1
- package/dist/merge/next-steps.d.ts +3 -0
- package/dist/merge/next-steps.d.ts.map +1 -1
- package/dist/merge/next-steps.js +3 -0
- package/dist/merge/next-steps.js.map +1 -1
- package/dist/merge/order/applied-under-old-name.d.ts +13 -0
- package/dist/merge/order/applied-under-old-name.d.ts.map +1 -0
- package/dist/merge/order/applied-under-old-name.js +14 -0
- package/dist/merge/order/applied-under-old-name.js.map +1 -0
- package/dist/merge/order/comes-after.d.ts +8 -0
- package/dist/merge/order/comes-after.d.ts.map +1 -0
- package/dist/merge/order/comes-after.js +9 -0
- package/dist/merge/order/comes-after.js.map +1 -0
- package/dist/merge/order/drizzle-order.d.ts +11 -0
- package/dist/merge/order/drizzle-order.d.ts.map +1 -0
- package/dist/merge/order/drizzle-order.js +64 -0
- package/dist/merge/order/drizzle-order.js.map +1 -0
- package/dist/merge/order/in-order.d.ts +4 -0
- package/dist/merge/order/in-order.d.ts.map +1 -0
- package/dist/merge/order/in-order.js +6 -0
- package/dist/merge/order/in-order.js.map +1 -0
- package/dist/merge/order/migration-order-finding.d.ts +18 -0
- package/dist/merge/order/migration-order-finding.d.ts.map +1 -0
- package/dist/merge/order/migration-order-finding.js +2 -0
- package/dist/merge/order/migration-order-finding.js.map +1 -0
- package/dist/merge/order/migration-order.d.ts +12 -0
- package/dist/merge/order/migration-order.d.ts.map +1 -0
- package/dist/merge/order/migration-order.js +21 -0
- package/dist/merge/order/migration-order.js.map +1 -0
- package/dist/merge/order/migrations-of-commit.d.ts +7 -0
- package/dist/merge/order/migrations-of-commit.d.ts.map +1 -0
- package/dist/merge/order/migrations-of-commit.js +43 -0
- package/dist/merge/order/migrations-of-commit.js.map +1 -0
- package/dist/merge/order/migrations-of-tree.d.ts +9 -0
- package/dist/merge/order/migrations-of-tree.d.ts.map +1 -0
- package/dist/merge/order/migrations-of-tree.js +25 -0
- package/dist/merge/order/migrations-of-tree.js.map +1 -0
- package/dist/merge/order/named-order.d.ts +11 -0
- package/dist/merge/order/named-order.d.ts.map +1 -0
- package/dist/merge/order/named-order.js +36 -0
- package/dist/merge/order/named-order.js.map +1 -0
- package/dist/merge/order/ordered-migration.d.ts +12 -0
- package/dist/merge/order/ordered-migration.d.ts.map +1 -0
- package/dist/merge/order/ordered-migration.js +2 -0
- package/dist/merge/order/ordered-migration.js.map +1 -0
- package/dist/merge/order/trunk-to-follow.d.ts +9 -0
- package/dist/merge/order/trunk-to-follow.d.ts.map +1 -0
- package/dist/merge/order/trunk-to-follow.js +2 -0
- package/dist/merge/order/trunk-to-follow.js.map +1 -0
- package/dist/merge/renumber-migrations.d.ts +14 -5
- package/dist/merge/renumber-migrations.d.ts.map +1 -1
- package/dist/merge/renumber-migrations.js +141 -60
- package/dist/merge/renumber-migrations.js.map +1 -1
- package/dist/merge/restamp-class.d.ts +9 -0
- package/dist/merge/restamp-class.d.ts.map +1 -0
- package/dist/merge/restamp-class.js +30 -0
- package/dist/merge/restamp-class.js.map +1 -0
- package/dist/migration/index.d.ts +1 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +1 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/plan-replay.d.ts.map +1 -1
- package/dist/migration/plan-replay.js +2 -1
- package/dist/migration/plan-replay.js.map +1 -1
- package/dist/migration/refuse-taken-migration-name.d.ts +8 -0
- package/dist/migration/refuse-taken-migration-name.d.ts.map +1 -0
- package/dist/migration/refuse-taken-migration-name.js +22 -0
- package/dist/migration/refuse-taken-migration-name.js.map +1 -0
- package/dist/migration/replay-drizzle-migrations.d.ts +5 -0
- package/dist/migration/replay-drizzle-migrations.d.ts.map +1 -1
- package/dist/migration/replay-drizzle-migrations.js +10 -2
- package/dist/migration/replay-drizzle-migrations.js.map +1 -1
- package/dist/migration/replay-plan.d.ts +2 -2
- package/dist/migration/replay-plan.d.ts.map +1 -1
- package/dist/migration/restore-migration-folder.d.ts +6 -2
- package/dist/migration/restore-migration-folder.d.ts.map +1 -1
- package/dist/migration/restore-migration-folder.js +14 -7
- package/dist/migration/restore-migration-folder.js.map +1 -1
- package/dist/migration/snapshot-migration-folder.d.ts +7 -0
- package/dist/migration/snapshot-migration-folder.d.ts.map +1 -0
- package/dist/migration/snapshot-migration-folder.js +12 -0
- package/dist/migration/snapshot-migration-folder.js.map +1 -0
- package/dist/move-to-module/before-the-move.d.ts +5 -0
- package/dist/move-to-module/before-the-move.d.ts.map +1 -0
- package/dist/move-to-module/before-the-move.js +13 -0
- package/dist/move-to-module/before-the-move.js.map +1 -0
- package/dist/move-to-module/closed-cycles.d.ts +21 -0
- package/dist/move-to-module/closed-cycles.d.ts.map +1 -0
- package/dist/move-to-module/closed-cycles.js +66 -0
- package/dist/move-to-module/closed-cycles.js.map +1 -0
- package/dist/move-to-module/cycle-lines.d.ts +7 -0
- package/dist/move-to-module/cycle-lines.d.ts.map +1 -0
- package/dist/move-to-module/cycle-lines.js +22 -0
- package/dist/move-to-module/cycle-lines.js.map +1 -0
- package/dist/move-to-module/cycle-refusal.d.ts +17 -0
- package/dist/move-to-module/cycle-refusal.d.ts.map +1 -0
- package/dist/move-to-module/cycle-refusal.js +25 -0
- package/dist/move-to-module/cycle-refusal.js.map +1 -0
- package/dist/move-to-module/index.d.ts +5 -0
- package/dist/move-to-module/index.d.ts.map +1 -1
- package/dist/move-to-module/index.js +4 -0
- package/dist/move-to-module/index.js.map +1 -1
- package/dist/move-to-module/module-imports-in.d.ts +11 -0
- package/dist/move-to-module/module-imports-in.d.ts.map +1 -0
- package/dist/move-to-module/module-imports-in.js +32 -0
- package/dist/move-to-module/module-imports-in.js.map +1 -0
- package/dist/move-to-module/moves-into-module.d.ts.map +1 -1
- package/dist/move-to-module/moves-into-module.js +6 -18
- package/dist/move-to-module/moves-into-module.js.map +1 -1
- package/dist/move-to-module/place-in-module.d.ts +13 -0
- package/dist/move-to-module/place-in-module.d.ts.map +1 -0
- package/dist/move-to-module/place-in-module.js +24 -0
- package/dist/move-to-module/place-in-module.js.map +1 -0
- package/dist/move-to-module/watch-cycles.d.ts +19 -0
- package/dist/move-to-module/watch-cycles.d.ts.map +1 -0
- package/dist/move-to-module/watch-cycles.js +51 -0
- package/dist/move-to-module/watch-cycles.js.map +1 -0
- package/dist/presets/no-flags.d.ts.map +1 -1
- package/dist/presets/no-flags.js +1 -0
- package/dist/presets/no-flags.js.map +1 -1
- package/dist/run.js +1 -1
- package/dist/run.js.map +1 -1
- package/dist/slice/format-slice-verification.d.ts.map +1 -1
- package/dist/slice/format-slice-verification.js +11 -5
- package/dist/slice/format-slice-verification.js.map +1 -1
- package/dist/stack/alias-vars.d.ts +3 -1
- package/dist/stack/alias-vars.d.ts.map +1 -1
- package/dist/stack/alias-vars.js +5 -2
- package/dist/stack/alias-vars.js.map +1 -1
- package/dist/stack/end-to-end-vars.d.ts +9 -0
- package/dist/stack/end-to-end-vars.d.ts.map +1 -0
- package/dist/stack/end-to-end-vars.js +32 -0
- package/dist/stack/end-to-end-vars.js.map +1 -0
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +2 -0
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/briefing-of.js +2 -2
- package/dist/worker/briefing-of.js.map +1 -1
- package/package.json +6 -6
- package/templates/e2e/e2e-background-job-case.ts.tpl +12 -0
- package/templates/e2e/e2e-job.spec.ts.tpl +3 -3
- package/templates/file-upload/controller.spec.ts.tpl +66 -2
- package/templates/file-upload/controller.ts.tpl +12 -0
- package/templates/file-upload/handler.spec.ts.tpl +3 -3
- package/templates/init/README.md.tpl +20 -1
- package/templates/init/e2e/jest.e2e.config.js.tpl +29 -5
- package/templates/init/e2e/start-application.database.ts.tpl +40 -2
- package/templates/init/e2e/start-application.memory.ts.tpl +36 -0
- package/templates/init/e2e/test-database-setup.ts.tpl +120 -0
- package/templates/init/e2e/vitest.e2e.config.ts.tpl +14 -4
- package/templates/init/platform/composition/compose-application.container.ts.tpl +5 -0
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +20 -3
- package/templates/init/platform/composition/create-platform.manual.ts.tpl +6 -0
- package/templates/init/platform/composition/platform-options.manual.ts.tpl +11 -0
- package/templates/init/platform/composition/platform.manual.ts.tpl +7 -0
- package/templates/init/platform/composition/platform.module.container.ts.tpl +34 -0
- package/templates/init/platform/database/connect-to-database.drizzle.ts.tpl +7 -2
- package/templates/init/platform/database/open-test-database.drizzle.ts.tpl +27 -4
- package/templates/init/platform/database/open-test-database.knex.ts.tpl +26 -3
- package/templates/init/platform/database/open-test-database.prisma.ts.tpl +27 -3
- package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +27 -3
- package/templates/init/platform/database/read-model-tables.ts.tpl +67 -0
- package/templates/init/platform/database/test-database-budget.ts.tpl +108 -0
- package/templates/init/platform/database/test-database-clone.ts.tpl +75 -0
- package/templates/init/platform/database/test-database-copy.ts.tpl +76 -0
- package/templates/init/platform/database/test-database-emptying.ts.tpl +209 -0
- package/templates/init/platform/database/test-database-kept.ts.tpl +32 -0
- package/templates/init/platform/database/test-database-leftovers.ts.tpl +52 -0
- package/templates/init/platform/database/test-database-run.ts.tpl +99 -0
- package/templates/init/platform/database/test-database-server.ts.tpl +140 -0
- package/templates/init/platform/database/test-database-session.ts.tpl +141 -0
- package/templates/init/platform/database/test-database-teardown.ts.tpl +11 -1
- package/templates/init/platform/jobs/background-jobs.ts.tpl +4 -0
- package/templates/init/platform/jobs/create-background-work.ts.tpl +1 -0
- package/templates/init/platform/resilience/default-policy.ts.tpl +8 -1
- package/templates/init/rules/infrastructure.md.tpl +3 -3
- package/templates/init/scripts/read-model-tables.ts.tpl +83 -0
- package/templates/nest-controller/upload.spec.ts.tpl +67 -2
- package/templates/nest-controller/upload.ts.tpl +12 -0
- package/templates/personal-data/declaration.drizzle.ts.tpl +6 -1
- package/templates/personal-data/declaration.knex.ts.tpl +14 -1
- package/templates/personal-data/declaration.prisma.ts.tpl +6 -1
- package/templates/personal-data/declaration.typeorm.ts.tpl +21 -1
- package/templates/personal-data/spec.table.ts.tpl +39 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-account.repository.drizzle.ts.tpl +5 -9
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-delegation.repository.drizzle.ts.tpl +5 -9
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-invitation.repository.drizzle.ts.tpl +5 -9
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-member.repository.drizzle.ts.tpl +5 -9
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation.repository.drizzle.ts.tpl +5 -9
- package/templates/projection/projection.manual.ts.tpl +2 -2
- package/templates/projection/projection.ts.tpl +2 -2
- package/templates/read-model/contract.spec.ts.tpl +95 -0
- package/templates/read-model/drizzle/schema.ts.tpl +8 -0
- package/templates/read-model/drizzle/store.ts.tpl +41 -0
- package/templates/read-model/drizzle/table.tpl +38 -0
- package/templates/read-model/fake.ts.tpl +8 -0
- package/templates/read-model/knex/store.ts.tpl +41 -0
- package/templates/read-model/knex/table.tpl +26 -0
- package/templates/read-model/none/store.ts.tpl +17 -0
- package/templates/read-model/port.ts.tpl +24 -0
- package/templates/read-model/prisma/model.tpl +25 -0
- package/templates/read-model/prisma/store.ts.tpl +43 -0
- package/templates/read-model/typeorm/schema-export.tpl +4 -0
- package/templates/read-model/typeorm/schema.ts.tpl +9 -0
- package/templates/read-model/typeorm/store.ts.tpl +30 -0
- package/templates/read-model/typeorm/table.tpl +54 -0
- package/templates/read-model/wiring.container.tpl +21 -0
- package/templates/repository/drizzle/repository.ts.tpl +6 -9
- package/templates/repository/drizzle/table.tpl +1 -0
- package/templates/repository/typeorm/table.tpl +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-in-the-tree.d.ts","sourceRoot":"","sources":["../../../src/check/project/not-in-the-tree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAIzD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,MAAM,GAAG,OAAO,CAOvF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { gitIgnored } from './git-ignored.js';
|
|
3
|
+
import { isUnder } from './is-under.js';
|
|
4
|
+
import { SKIPPED_DIRECTORIES } from './skipped-directories.js';
|
|
5
|
+
/**
|
|
6
|
+
* The tree under the source root is what git sees: an entry git ignores is not read, nor a
|
|
7
|
+
* dot-directory under the contexts directory, which a tool writes and no context declares, nor a
|
|
8
|
+
* directory no walk enters (`SKIPPED_DIRECTORIES`). `ddd-ts-kit check` walks with it, and so does a
|
|
9
|
+
* command that judges, before it writes, what a rule will judge.
|
|
10
|
+
*/
|
|
11
|
+
export function notInTheTree(root, { sourceRoot, contextsDir }) {
|
|
12
|
+
const ignored = gitIgnored(root, sourceRoot);
|
|
13
|
+
return (file, isDirectory) => ignored(file, isDirectory) ||
|
|
14
|
+
(isDirectory && SKIPPED_DIRECTORIES.has(path.posix.basename(file))) ||
|
|
15
|
+
(isDirectory && file !== contextsDir && isUnder(file, contextsDir) && path.posix.basename(file).startsWith('.'));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=not-in-the-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-in-the-tree.js","sourceRoot":"","sources":["../../../src/check/project/not-in-the-tree.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAgB,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,EAAE,UAAU,EAAE,WAAW,EAAU;IAC5E,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAE7C,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,CAC3B,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC;QAC1B,CAAC,WAAW,IAAI,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QACnE,CAAC,WAAW,IAAI,IAAI,KAAK,WAAW,IAAI,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AACrH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skipped-directories.d.ts","sourceRoot":"","sources":["../../../src/check/project/skipped-directories.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAA2D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skipped-directories.js","sourceRoot":"","sources":["../../../src/check/project/skipped-directories.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,CAAC,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk-directory.d.ts","sourceRoot":"","sources":["../../../src/check/project/walk-directory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"walk-directory.d.ts","sourceRoot":"","sources":["../../../src/check/project/walk-directory.ts"],"names":[],"mappings":"AAIA,mDAAmD;AACnD,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oGAAoG;IACpG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC;CACjE;AAED,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAkBnG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
|
|
3
|
+
import { SKIPPED_DIRECTORIES } from './skipped-directories.js';
|
|
4
4
|
/** Visits every entry below the directory, sorted by name, directories before what they hold. */
|
|
5
5
|
export function walkDirectory(walk, visit) {
|
|
6
6
|
const { root, directory, skip } = walk;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk-directory.js","sourceRoot":"","sources":["../../../src/check/project/walk-directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"walk-directory.js","sourceRoot":"","sources":["../../../src/check/project/walk-directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAW5D,iGAAiG;AACjG,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,KAAmD;IAC3F,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEvC,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC;QAC/C,MAAM,QAAQ,GAAG,GAAG,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAC9C,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAExC,IAAI,IAAI,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC;YAC3C,SAAS;QACX,CAAC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzB,CAAC;aAAM,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACtB,aAAa,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,SAAiB;IAChD,IAAI,CAAC;QACH,OAAO,EAAE;aACN,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;aAChE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aspects-timeout-covers-delegate.d.ts","sourceRoot":"","sources":["../../../src/check/rules/aspects-timeout-covers-delegate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAoC1C,eAAO,MAAM,4BAA4B,EAAE,IAsB1C,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { parameterShape } from '../../declared/injection/parameter-shape.js';
|
|
2
|
+
import { rawClassName } from '../../declared/injection/raw-class-name.js';
|
|
3
|
+
import { adapterPolicies } from '../aspects/adapter-policies.js';
|
|
4
|
+
import { bindingCalls } from '../declarations/binding-calls.js';
|
|
5
|
+
import { importedFrom } from '../support/imported-from.js';
|
|
6
|
+
import { perFile } from '../support/per-file.js';
|
|
7
|
+
import { chainEnd } from '../text/chain-end.js';
|
|
8
|
+
import { escapeRegExp } from '../text/escape-reg-exp.js';
|
|
9
|
+
/** The kinds the default policy of the platform goes around (`resilience/default-policy.ts`). */
|
|
10
|
+
const DEFAULTED_KINDS = ['external', 'gateway'];
|
|
11
|
+
const DEFAULT_SETTINGS = '/resilience/default-resilience-settings.ts';
|
|
12
|
+
const DEFAULT_TIMEOUT = /(?<![\w$.])timeoutMs\s*:\s*(\d[\d_]*)\s*[,}]/;
|
|
13
|
+
/** The variable the configuration of the platform reads the default limit from, and the fallback written beside it. */
|
|
14
|
+
const DEFAULT_VARIABLE = 'OUTBOUND_TIMEOUT_MS';
|
|
15
|
+
const FALLBACK = /^\s*,\s*\{[^{}]*?(?<![\w$.])fallback\s*:\s*(\d[\d_]*)\s*[,}]/;
|
|
16
|
+
const FIRST_ARGUMENT = /\(\s*$/;
|
|
17
|
+
export const aspectsTimeoutCoversDelegate = {
|
|
18
|
+
id: 'aspects/timeout-covers-delegate',
|
|
19
|
+
description: 'An `external` or `gateway` adapter left to the default policy of the platform (no `ownPolicy(...)`, no `timeout(...)` of its own) is not given a port (a constructor parameter typed by it) whose adapter states a longer time limit for all its methods: the default limit, the fallback of `OUTBOUND_TIMEOUT_MS` in the configuration of the platform, else `timeoutMs` of `resilience/default-resilience-settings.ts`, would cut every call the slower adapter still answers. Read from the declarations (`@Adapter`, `@Gateway`) and the bindings of the container of the kit, where the port and the adapter are bound once, without condition, and the durations are written as numbers. An adapter that states its own limit, even a shorter one, chose it.',
|
|
20
|
+
scope: 'project',
|
|
21
|
+
run(project) {
|
|
22
|
+
const sources = project.files.filter((file) => !file.isTest);
|
|
23
|
+
const policies = adapterPolicies(project);
|
|
24
|
+
const reading = {
|
|
25
|
+
sources,
|
|
26
|
+
policies,
|
|
27
|
+
rebound: policies.length === 0 ? [] : reboundIn(sources),
|
|
28
|
+
defaultMs: policies.length === 0 ? undefined : defaultLimit(sources),
|
|
29
|
+
};
|
|
30
|
+
const outers = policies.flatMap((policy) => outerOf(policy, reading));
|
|
31
|
+
return perFile(project, this.id, (file) => outers.filter((outer) => outer.file === file).flatMap((outer) => cutShort(outer, reading)));
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
function reboundIn(sources) {
|
|
35
|
+
return sources.flatMap((file) => bindingCalls(file)
|
|
36
|
+
.filter(({ method }) => method === 'rebind')
|
|
37
|
+
.map(({ open }) => file.scan.code.slice(open, chainEnd(file.scan.code, open + 1))));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* What the default policy cuts an attempt at. `main.ts` gives it the validated configuration, so
|
|
41
|
+
* the fallback written where the platform reads `OUTBOUND_TIMEOUT_MS` counts first; a platform
|
|
42
|
+
* that does not name that variable runs with `timeoutMs` of the default settings. Named twice, or
|
|
43
|
+
* elsewhere than as the first argument of the call that reads it, the limit is not one the text shows.
|
|
44
|
+
*/
|
|
45
|
+
function defaultLimit(sources) {
|
|
46
|
+
const platform = sources.filter(({ location }) => location.area === 'platform');
|
|
47
|
+
const settings = platform.find(({ path }) => path.endsWith(DEFAULT_SETTINGS));
|
|
48
|
+
if (settings === undefined) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const named = platform.flatMap(({ scan }) => scan.strings
|
|
52
|
+
.filter(({ value }) => value === DEFAULT_VARIABLE)
|
|
53
|
+
.map(({ start, end }) => FIRST_ARGUMENT.test(scan.code.slice(0, start)) ? FALLBACK.exec(scan.code.slice(end))?.[1] : undefined));
|
|
54
|
+
const written = named.length === 0 ? DEFAULT_TIMEOUT.exec(settings.scan.code)?.[1] : named[0];
|
|
55
|
+
return named.length > 1 || written === undefined ? undefined : Number(written.replaceAll('_', ''));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The adapter of a policy when it runs under the default one and nothing else: a kind the default
|
|
59
|
+
* goes around, written as a literal, no `ownPolicy(...)`, no limit of its own, bound once and
|
|
60
|
+
* without condition, and a class the text shows.
|
|
61
|
+
*/
|
|
62
|
+
function outerOf(policy, reading) {
|
|
63
|
+
const { className } = policy;
|
|
64
|
+
if (className === undefined || !isLeftToTheDefault(policy) || !isBoundOnce(className, 'className', reading)) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const file = fileOf(className, policy.source, reading.sources);
|
|
68
|
+
const shape = file === undefined ? undefined : classNamed(file, className);
|
|
69
|
+
return file === undefined || shape === undefined ? [] : [{ policy, className, file, shape }];
|
|
70
|
+
}
|
|
71
|
+
function isLeftToTheDefault(policy) {
|
|
72
|
+
const chosen = policy.ownPolicy || policy.timeouts.length > 0 || !policy.readable;
|
|
73
|
+
return !chosen && policy.kindKnown && DEFAULTED_KINDS.includes(policy.kind ?? '');
|
|
74
|
+
}
|
|
75
|
+
/** Whether one binding, without condition, names the port or the class, and no `rebind(...)` names it. */
|
|
76
|
+
function isBoundOnce(name, by, { policies, rebound }) {
|
|
77
|
+
const naming = policies.filter((policy) => policy[by] === name);
|
|
78
|
+
const named = new RegExp(String.raw `(?<![\w$.])${escapeRegExp(name)}(?![\w$])`);
|
|
79
|
+
return (naming.length === 1 &&
|
|
80
|
+
naming.every(({ conditional }) => !conditional) &&
|
|
81
|
+
!rebound.some((chain) => named.test(chain)));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The file of the class a policy names: the one that states the policy, else the one that file
|
|
85
|
+
* imports the name from, else the only file of the sources that declares a class of that name.
|
|
86
|
+
*/
|
|
87
|
+
function fileOf(className, source, sources) {
|
|
88
|
+
const imported = importedFrom(source, className)?.target;
|
|
89
|
+
const declaring = sources.filter((file) => classNamed(file, className) !== undefined);
|
|
90
|
+
return (declaring.find((candidate) => candidate === source) ??
|
|
91
|
+
declaring.find((candidate) => imported?.kind === 'file' && candidate.path === imported.path) ??
|
|
92
|
+
(declaring.length === 1 ? declaring[0] : undefined));
|
|
93
|
+
}
|
|
94
|
+
function classNamed(file, name) {
|
|
95
|
+
return file.scan.code.includes(name)
|
|
96
|
+
? file.structure.classes.find((shape) => shape.depth === 0 && shape.name === name)
|
|
97
|
+
: undefined;
|
|
98
|
+
}
|
|
99
|
+
function cutShort(outer, reading) {
|
|
100
|
+
const { defaultMs } = reading;
|
|
101
|
+
if (defaultMs === undefined) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
return injectedOf(outer.shape).flatMap((port) => {
|
|
105
|
+
const inner = servingOf(port, outer, reading);
|
|
106
|
+
const stated = inner === undefined ? undefined : statedLimit(inner);
|
|
107
|
+
return inner?.className === undefined || stated === undefined || stated <= defaultMs
|
|
108
|
+
? []
|
|
109
|
+
: [finding(outer, { port, inner: inner.className }, { defaultMs, stated })];
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/** The classes that type the constructor parameters of an adapter: what the container gives it. */
|
|
113
|
+
function injectedOf(shape) {
|
|
114
|
+
const parameters = shape.methods.find((method) => method.isConstructor)?.parameters ?? [];
|
|
115
|
+
return parameters.flatMap((parameter) => rawClassName(parameterShape(parameter).type ?? '') ?? []);
|
|
116
|
+
}
|
|
117
|
+
/** The one binding of a port the outer adapter is given, when the two files name the same port. */
|
|
118
|
+
function servingOf(port, outer, reading) {
|
|
119
|
+
const inner = reading.policies.find((policy) => policy.port === port);
|
|
120
|
+
return inner !== undefined &&
|
|
121
|
+
inner.className !== outer.className &&
|
|
122
|
+
isBoundOnce(port, 'port', reading) &&
|
|
123
|
+
isSamePort(port, { given: outer.file, served: inner.source }, reading.sources)
|
|
124
|
+
? inner
|
|
125
|
+
: undefined;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Whether the port the outer adapter is given is the one the inner adapter is bound to. The
|
|
129
|
+
* outer file has to import that name from a file of the project: a type of a package, a class or
|
|
130
|
+
* an interface of its own file, or a name it imports from nowhere is not a port the text can
|
|
131
|
+
* follow. With one port of that name in the sources, an import through a barrel is enough; with
|
|
132
|
+
* several, each side has to show the file that declares its own, and it is one file.
|
|
133
|
+
*/
|
|
134
|
+
function isSamePort(port, { given, served }, sources) {
|
|
135
|
+
const declaring = sources.filter((file) => classNamed(file, port) !== undefined);
|
|
136
|
+
const imported = importedFrom(given, port)?.target;
|
|
137
|
+
if (imported?.kind !== 'file' || declaring.length === 0 || !isOfTheProject(port, served)) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
if (declaring.length === 1) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
const givenFrom = originOf(port, given, sources);
|
|
144
|
+
return givenFrom !== undefined && givenFrom === originOf(port, served, sources);
|
|
145
|
+
}
|
|
146
|
+
/** A file names a class of the project unless it imports that name from a package. */
|
|
147
|
+
function isOfTheProject(name, file) {
|
|
148
|
+
const target = importedFrom(file, name)?.target;
|
|
149
|
+
return target === undefined || target.kind === 'file';
|
|
150
|
+
}
|
|
151
|
+
/** The file that declares the class `name` as `file` reads it: itself or the one it imports it from; undefined through a barrel or a package. */
|
|
152
|
+
function originOf(name, file, sources) {
|
|
153
|
+
if (classNamed(file, name) !== undefined) {
|
|
154
|
+
return file.path;
|
|
155
|
+
}
|
|
156
|
+
const target = importedFrom(file, name)?.target;
|
|
157
|
+
const declaring = target?.kind === 'file' ? sources.find(({ path }) => path === target.path) : undefined;
|
|
158
|
+
return declaring !== undefined && classNamed(declaring, name) !== undefined ? declaring.path : undefined;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The limit the adapter behind a port states around all its methods: the shortest `timeout(<ms>)`
|
|
162
|
+
* of its declaration or binding, when the default policy does not go around it as well.
|
|
163
|
+
* Undefined when it states none, or one the text does not show. A `@Timeout` on one of its
|
|
164
|
+
* methods is not counted: the text does not say which method is called.
|
|
165
|
+
*/
|
|
166
|
+
function statedLimit(policy) {
|
|
167
|
+
const besideTheDefault = !policy.ownPolicy && !(policy.kindKnown && !DEFAULTED_KINDS.includes(policy.kind ?? ''));
|
|
168
|
+
return !policy.readable || besideTheDefault || policy.timeouts.length === 0
|
|
169
|
+
? undefined
|
|
170
|
+
: Math.min(...policy.timeouts);
|
|
171
|
+
}
|
|
172
|
+
function finding({ className, shape }, { port, inner }, { defaultMs, stated }) {
|
|
173
|
+
return {
|
|
174
|
+
line: shape.line,
|
|
175
|
+
message: `${className} is left to the default policy of the platform, which cuts each attempt after ${defaultMs} ms, and is given ${port}, which ${inner} serves with a limit of ${stated} ms: a call ${inner} would still answer fails in ${className} first, as a timeout of ${className}.`,
|
|
176
|
+
fix: `State the policy of ${className} where it is declared or bound: \`ownPolicy(timeout(${stated}))\`, or any limit it chooses; or \`ownPolicy()\` alone when it only hands the call over, ${inner} carrying the policy.`,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=aspects-timeout-covers-delegate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aspects-timeout-covers-delegate.js","sourceRoot":"","sources":["../../../src/check/rules/aspects-timeout-covers-delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAK7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,iGAAiG;AACjG,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAChD,MAAM,gBAAgB,GAAG,4CAA4C,CAAC;AACtE,MAAM,eAAe,GAAG,8CAA8C,CAAC;AACvE,uHAAuH;AACvH,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAC/C,MAAM,QAAQ,GAAG,8DAA8D,CAAC;AAChF,MAAM,cAAc,GAAG,QAAQ,CAAC;AAqB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KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3G,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,MAAqB;IACxC,MAAM,gBAAgB,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IAElH,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,gBAAgB,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QACzE,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,OAAO,CACd,EAAE,SAAS,EAAE,KAAK,EAAS,EAC3B,EAAE,IAAI,EAAE,KAAK,EAAmC,EAChD,EAAE,SAAS,EAAE,MAAM,EAAyC;IAE5D,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,GAAG,SAAS,iFAAiF,SAAS,qBAAqB,IAAI,WAAW,KAAK,2BAA2B,MAAM,eAAe,KAAK,gCAAgC,SAAS,2BAA2B,SAAS,GAAG;QAC7R,GAAG,EAAE,uBAAuB,SAAS,uDAAuD,MAAM,6FAA6F,KAAK,uBAAuB;KAC5N,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files-upload-content-rule.d.ts","sourceRoot":"","sources":["../../../src/check/rules/files-upload-content-rule.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAO1C,eAAO,MAAM,sBAAsB,EAAE,IAQpC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { uploadContentDefects } from '../files/upload-content-defects.js';
|
|
2
|
+
import { uploadDeclarations } from '../files/upload-declarations.js';
|
|
3
|
+
import { perFile } from '../support/per-file.js';
|
|
4
|
+
const FIX = "Give each accepted media type a content rule. The kit has one for the formats it recognises by their first bytes (PDF, PNG, JPEG, GIF, WebP, zip and the office documents, gzip) and for text (`text/plain`, `text/csv`, `text/tab-separated-values`, `text/markdown`, `application/json`, `application/csv`). For another type the route states it in `contentRules` of the upload: `'text'` when the content is text under another name (`{ 'application/vnd.ms-excel': 'text' }` for the CSV a browser on Windows sends), `'unchecked'` when the route takes the bytes as they are (`{ 'application/octet-stream': 'unchecked' }`). A stated rule names a type the upload accepts and the kit has no rule for.";
|
|
5
|
+
export const filesUploadContentRule = {
|
|
6
|
+
id: 'files/upload-content-rule',
|
|
7
|
+
description: 'Every media type the `upload` of a route or a controller accepts has a content rule, of the kit (a signature, text) or stated in its `contentRules`: a type with none could receive no file, and `@ddd-ts-kit/http` refuses the route when it is declared.',
|
|
8
|
+
scope: 'file',
|
|
9
|
+
run(project) {
|
|
10
|
+
return perFile(project, this.id, (file) => (isRouteFile(file) ? findingsOf(file) : []));
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
function isRouteFile(file) {
|
|
14
|
+
return !file.isTest && /\.(?:route|controller)\.ts$/.test(file.path);
|
|
15
|
+
}
|
|
16
|
+
function findingsOf({ scan }) {
|
|
17
|
+
return uploadDeclarations(scan)
|
|
18
|
+
.flatMap(uploadContentDefects)
|
|
19
|
+
.map(({ literal, message }) => ({
|
|
20
|
+
line: literal.line,
|
|
21
|
+
message: `${message} The upload could receive no file of it, and the route is refused when it is declared.`,
|
|
22
|
+
fix: FIX,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=files-upload-content-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files-upload-content-rule.js","sourceRoot":"","sources":["../../../src/check/rules/files-upload-content-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAIlE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,GAAG,GACP,mrBAAmrB,CAAC;AAEtrB,MAAM,CAAC,MAAM,sBAAsB,GAAS;IAC1C,EAAE,EAAE,2BAA2B;IAC/B,WAAW,EACT,4PAA4P;IAC9P,KAAK,EAAE,MAAM;IACb,GAAG,CAAC,OAAO;QACT,OAAO,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF,CAAC;AAEF,SAAS,WAAW,CAAC,IAAgB;IACnC,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,UAAU,CAAC,EAAE,IAAI,EAAc;IACtC,OAAO,kBAAkB,CAAC,IAAI,CAAC;SAC5B,OAAO,CAAC,oBAAoB,CAAC;SAC7B,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,GAAG,OAAO,wFAAwF;QAC3G,GAAG,EAAE,GAAG;KACT,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports-alias-declared.d.ts","sourceRoot":"","sources":["../../../src/check/rules/imports-alias-declared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"imports-alias-declared.d.ts","sourceRoot":"","sources":["../../../src/check/rules/imports-alias-declared.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG1C,eAAO,MAAM,oBAAoB,EAAE,IAuBlC,CAAC"}
|
|
@@ -4,12 +4,13 @@ import { compilerPaths } from '../alias/compiler-paths.js';
|
|
|
4
4
|
import { compilerResolution } from '../alias/compiler-resolution.js';
|
|
5
5
|
import { configuredAlias } from '../alias/configured-alias.js';
|
|
6
6
|
import { graphTools } from '../alias/graph-tools.js';
|
|
7
|
+
import { neighbourSources } from '../alias/neighbour-sources.js';
|
|
7
8
|
import { sourceRunners } from '../alias/source-runners.js';
|
|
8
9
|
import { testRunners } from '../alias/test-runners.js';
|
|
9
10
|
import { reporter } from '../support/reporter.js';
|
|
10
11
|
export const importsAliasDeclared = {
|
|
11
12
|
id: 'imports/alias-declared',
|
|
12
|
-
description: 'The import alias has one source, "importAlias", and the ending of an import another, "importExtension"; every tool follows them: tsconfig "paths" is exactly what the alias gives, "module" and "moduleResolution" are what the ending needs, vitest and dependency-cruiser read tsconfig, jest repeats the same mapping, no knip "paths" adds another, and the build rewrites the aliases after the compiler.',
|
|
13
|
+
description: 'The import alias has one source, "importAlias", and the ending of an import another, "importExtension"; every tool follows them: tsconfig "paths" is exactly what the alias gives, "module" and "moduleResolution" are what the ending needs, with ".js" the type check reads the ".ts" by which the files of `test/support/` name their neighbours and the build emits as before, vitest and dependency-cruiser read tsconfig, jest repeats the same mapping, no knip "paths" adds another, and the build rewrites the aliases after the compiler.',
|
|
13
14
|
scope: 'project',
|
|
14
15
|
run(project) {
|
|
15
16
|
const inspected = { project, roots: aliasRoots(project.config), report: reporter(project, this.id) };
|
|
@@ -20,6 +21,7 @@ export const importsAliasDeclared = {
|
|
|
20
21
|
return [
|
|
21
22
|
...compilerPaths(inspected),
|
|
22
23
|
...compilerResolution(inspected),
|
|
24
|
+
...neighbourSources(inspected),
|
|
23
25
|
...buildScripts(inspected),
|
|
24
26
|
...sourceRunners(inspected),
|
|
25
27
|
...testRunners(inspected),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports-alias-declared.js","sourceRoot":"","sources":["../../../src/check/rules/imports-alias-declared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAS;IACxC,EAAE,EAAE,wBAAwB;IAC5B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"imports-alias-declared.js","sourceRoot":"","sources":["../../../src/check/rules/imports-alias-declared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAS;IACxC,EAAE,EAAE,wBAAwB;IAC5B,WAAW,EACT,qhBAAqhB;IACvhB,KAAK,EAAE,SAAS;IAChB,GAAG,CAAC,OAAO;QACT,MAAM,SAAS,GAAc,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QAChH,MAAM,WAAW,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QAE/C,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,OAAO;YACL,GAAG,aAAa,CAAC,SAAS,CAAC;YAC3B,GAAG,kBAAkB,CAAC,SAAS,CAAC;YAChC,GAAG,gBAAgB,CAAC,SAAS,CAAC;YAC9B,GAAG,YAAY,CAAC,SAAS,CAAC;YAC1B,GAAG,aAAa,CAAC,SAAS,CAAC;YAC3B,GAAG,WAAW,CAAC,SAAS,CAAC;YACzB,GAAG,UAAU,CAAC,SAAS,CAAC;SACzB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports-alias-only.d.ts","sourceRoot":"","sources":["../../../src/check/rules/imports-alias-only.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"imports-alias-only.d.ts","sourceRoot":"","sources":["../../../src/check/rules/imports-alias-only.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAyB1C,eAAO,MAAM,gBAAgB,EAAE,IAgB9B,CAAC"}
|
|
@@ -1,14 +1,31 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
1
2
|
import path from 'node:path';
|
|
2
|
-
import { aliasRoots, specifierSuffix, toAlias } from '../../alias/index.js';
|
|
3
|
+
import { aliasRoots, neighbourSuffix, specifierSuffix, toAlias } from '../../alias/index.js';
|
|
4
|
+
import { CONFIG_FILE } from '../../config/index.js';
|
|
3
5
|
import { besideTheSources } from '../project/beside-the-sources.js';
|
|
4
6
|
import { perFile } from '../support/per-file.js';
|
|
5
7
|
import { reporter } from '../support/reporter.js';
|
|
6
8
|
import { toViolations } from '../support/to-violations.js';
|
|
7
9
|
const RELATIVE = /^\.{1,2}(?:\/|$)/;
|
|
8
10
|
const DOT_SEGMENT = /\/\.{1,2}(?:\/|$)/;
|
|
11
|
+
/**
|
|
12
|
+
* A test runner loads its global setup, and what that file imports, from the sources and before
|
|
13
|
+
* any alias of the project exists: the files directly under `test/support/` import one another by
|
|
14
|
+
* a relative path of that same directory, `./<name>`, and nothing else is spared: not the
|
|
15
|
+
* directory itself (`./.`), its parent (`./..`), nor a directory of it. The path names the file
|
|
16
|
+
* the runner finds: the source, with its `.ts` where an import carries an extension. What is on
|
|
17
|
+
* disk says which file that is.
|
|
18
|
+
*/
|
|
19
|
+
const SUPPORT = 'test/support';
|
|
20
|
+
const LOADED_BY_A_RUNNER = /^test\/support\/[^/]+$/;
|
|
21
|
+
const NEIGHBOUR = /^\.\/(?!\.{1,2}$)[^/]+$/;
|
|
22
|
+
/** The extensions a module of the project or the file emitted for it can bear. */
|
|
23
|
+
const EXTENSION = /\.(?:[cm]?js|[cm]?ts)$/;
|
|
24
|
+
/** The source the compiler emits a JavaScript file from, by their extensions. */
|
|
25
|
+
const SOURCE_OF = { '.js': '.ts', '.mjs': '.mts', '.cjs': '.cts' };
|
|
9
26
|
export const importsAliasOnly = {
|
|
10
27
|
id: 'imports/alias-only',
|
|
11
|
-
description: 'A file of the project is imported by its alias (`@/...`), never by a relative path, the same directory included; an alias path holds no `.` or `..` segment. Holds under the source root, `test/` and `scripts
|
|
28
|
+
description: 'A file of the project is imported by its alias (`@/...`), never by a relative path, the same directory included; an alias path holds no `.` or `..` segment. Holds under the source root, `test/` and `scripts/`; the files directly under `test/support/`, which a test runner loads before any alias exists, import one another by `./<name>`, ending with `.ts` under `js`.',
|
|
12
29
|
scope: 'file',
|
|
13
30
|
run(project) {
|
|
14
31
|
const written = writtenBy(project);
|
|
@@ -20,8 +37,13 @@ export const importsAliasOnly = {
|
|
|
20
37
|
return besideTheSources(project).flatMap((file) => toViolations(report, file.path, findingsIn(written, file)));
|
|
21
38
|
},
|
|
22
39
|
};
|
|
23
|
-
function writtenBy({ config }) {
|
|
24
|
-
return {
|
|
40
|
+
function writtenBy({ root, config }) {
|
|
41
|
+
return {
|
|
42
|
+
root,
|
|
43
|
+
roots: aliasRoots(config),
|
|
44
|
+
suffix: specifierSuffix(config.importExtension),
|
|
45
|
+
neighbourSuffix: neighbourSuffix(config.importExtension),
|
|
46
|
+
};
|
|
25
47
|
}
|
|
26
48
|
function findingsIn(written, file) {
|
|
27
49
|
return file.imports.flatMap(({ specifier, line }) => {
|
|
@@ -31,8 +53,13 @@ function findingsIn(written, file) {
|
|
|
31
53
|
}
|
|
32
54
|
function flawOf(written, file, specifier) {
|
|
33
55
|
const { roots } = written;
|
|
56
|
+
if (LOADED_BY_A_RUNNER.test(file) && NEIGHBOUR.test(specifier)) {
|
|
57
|
+
return namesADirectory(written, specifier)
|
|
58
|
+
? directoryFlaw(written, file, specifier)
|
|
59
|
+
: neighbourFlaw(written, specifier);
|
|
60
|
+
}
|
|
34
61
|
if (RELATIVE.test(specifier)) {
|
|
35
|
-
return relativeFlaw(written, file, specifier);
|
|
62
|
+
return relativeFlaw(written, specifier, path.posix.join(path.posix.dirname(file), specifier));
|
|
36
63
|
}
|
|
37
64
|
const named = roots.find(({ prefix }) => specifier.startsWith(prefix));
|
|
38
65
|
if (named === undefined || !DOT_SEGMENT.test(`/${specifier.slice(named.prefix.length)}`)) {
|
|
@@ -43,8 +70,60 @@ function flawOf(written, file, specifier) {
|
|
|
43
70
|
fix: `Write the path of the file from ${named.directory}/ after "${named.prefix}", with no "." or ".." segment: an alias names one file of its directory, and the build rewrites it as such.`,
|
|
44
71
|
};
|
|
45
72
|
}
|
|
46
|
-
|
|
47
|
-
|
|
73
|
+
/** `./parts` where test/support/parts/ is a directory and no parts.ts stands beside it: an index, not a neighbour file. */
|
|
74
|
+
function namesADirectory({ root }, specifier) {
|
|
75
|
+
const named = path.join(root, SUPPORT, specifier);
|
|
76
|
+
return !isFile(`${named}.ts`) && fs.statSync(named, { throwIfNoEntry: false })?.isDirectory() === true;
|
|
77
|
+
}
|
|
78
|
+
/** What the runner finds on disk is judged, whatever the compiler would accept: a neighbour named as it should be, or left to the compiler, is no flaw. */
|
|
79
|
+
function neighbourFlaw(written, specifier) {
|
|
80
|
+
const expected = neighbourName(written, specifier);
|
|
81
|
+
if (expected === undefined) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
if (written.neighbourSuffix === '') {
|
|
85
|
+
return {
|
|
86
|
+
message: `"${specifier}" ends with "${EXTENSION.exec(specifier)?.[0] ?? ''}" although "importExtension" is "none" in ${CONFIG_FILE}.`,
|
|
87
|
+
fix: `Write '${expected}' (\`eslint --fix\` rewrites it): a file of ${SUPPORT}/ names its neighbour as every import of the project names a file, without its extension.`,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
message: `"${specifier}" does not name its neighbour of ${SUPPORT}/ by the name of its source.`,
|
|
92
|
+
fix: `Write '${expected}' (\`eslint --fix\` rewrites it): a test runner loads its global setup, and what that file imports, from the sources and before any alias exists, where the file is "${expected.slice(2)}". The name of the file the compiler would emit passes the type check, then stops the run on a module that cannot be found.`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The name a neighbour is to be imported by, when it is imported by another one. Under `none`, the
|
|
97
|
+
* source `<name>.ts` without its extension. Otherwise the source that exists: `<name>.ts` for
|
|
98
|
+
* `<name>` and `<name>.js`, `<name>.mts` for `<name>.mjs`, `<name>.cts` for `<name>.cjs`. A file
|
|
99
|
+
* that exists as it is named (a source, a JSON file, a JavaScript file) is left alone, and so is a
|
|
100
|
+
* name no source answers, which the compiler reports.
|
|
101
|
+
*/
|
|
102
|
+
function neighbourName({ root, neighbourSuffix: suffix }, specifier) {
|
|
103
|
+
const extension = EXTENSION.exec(specifier)?.[0] ?? '';
|
|
104
|
+
const bare = specifier.slice(0, specifier.length - extension.length);
|
|
105
|
+
const exists = (name) => isFile(path.join(root, SUPPORT, name));
|
|
106
|
+
const source = `${bare}${SOURCE_OF[extension] ?? '.ts'}`;
|
|
107
|
+
if (suffix === '') {
|
|
108
|
+
return namedWithItsExtension(extension, exists(specifier)) && exists(`${bare}.ts`) ? bare : undefined;
|
|
109
|
+
}
|
|
110
|
+
return !exists(specifier) && exists(source) ? source : undefined;
|
|
111
|
+
}
|
|
112
|
+
/** Under `none`: a source named with its `.ts`, or by the `.js` the compiler would emit, unless a JavaScript file of that name is there. */
|
|
113
|
+
function namedWithItsExtension(extension, isThere) {
|
|
114
|
+
return extension === '.ts' || (extension === '.js' && !isThere);
|
|
115
|
+
}
|
|
116
|
+
function isFile(file) {
|
|
117
|
+
return fs.statSync(file, { throwIfNoEntry: false })?.isFile() === true;
|
|
118
|
+
}
|
|
119
|
+
/** A directory is no neighbour: its index is a file of another directory, named by its alias, which names the index file where an import carries an extension. */
|
|
120
|
+
function directoryFlaw(written, file, specifier) {
|
|
121
|
+
const index = written.suffix === '' ? specifier : `${specifier}/index`;
|
|
122
|
+
return relativeFlaw(written, specifier, path.posix.join(path.posix.dirname(file), index));
|
|
123
|
+
}
|
|
124
|
+
/** `target` is the file the specifier names, from the project root. */
|
|
125
|
+
function relativeFlaw({ roots, suffix }, specifier, target) {
|
|
126
|
+
const alias = toAlias(roots, target, suffix);
|
|
48
127
|
if (alias !== undefined) {
|
|
49
128
|
return {
|
|
50
129
|
message: `"${specifier}" is a relative import.`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports-alias-only.js","sourceRoot":"","sources":["../../../src/check/rules/imports-alias-only.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAkB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"imports-alias-only.js","sourceRoot":"","sources":["../../../src/check/rules/imports-alias-only.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAkB,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AACpC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AACxC;;;;;;;GAOG;AACH,MAAM,OAAO,GAAG,cAAc,CAAC;AAC/B,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AACpD,MAAM,SAAS,GAAG,yBAAyB,CAAC;AAC5C,kFAAkF;AAClF,MAAM,SAAS,GAAG,wBAAwB,CAAC;AAC3C,iFAAiF;AACjF,MAAM,SAAS,GAAqC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAErG,MAAM,CAAC,MAAM,gBAAgB,GAAS;IACpC,EAAE,EAAE,oBAAoB;IACxB,WAAW,EACT,gXAAgX;IAClX,KAAK,EAAE,MAAM;IACb,GAAG,CAAC,OAAO;QACT,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,C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E,SAAS,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAW,EAAE,SAAiB,EAAE,MAAc;IACjF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;YACL,OAAO,EAAE,IAAI,SAAS,yBAAyB;YAC/C,GAAG,EAAE,kCAAkC,KAAK,uKAAuK;SACpN,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7E,OAAO;QACL,OAAO,EAAE,IAAI,SAAS,kDAAkD;QACxE,GAAG,EAAE,oCAAoC,WAAW,qFAAqF;KAC1I,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-no-cycle.d.ts","sourceRoot":"","sources":["../../../src/check/rules/module-no-cycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module-no-cycle.d.ts","sourceRoot":"","sources":["../../../src/check/rules/module-no-cycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAS1C,eAAO,MAAM,aAAa,EAAE,IAuB3B,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { importedModules } from '../modules/imported-modules.js';
|
|
2
|
+
import { moduleImports } from '../modules/module-imports.js';
|
|
1
3
|
import { cyclesIn } from '../support/cycles-in.js';
|
|
2
4
|
import { reporter } from '../support/reporter.js';
|
|
3
5
|
const FIX = 'Look for a way to change the model to disentangle the concepts (Evans, Modules): an effect that follows a decision of one module becomes a domain event the other handles; a concept both reach for may be an overlooked module of its own, which both import; reads of the other module can go through a projection of its events. Coupling between modules is a signal about the model, which is why this is a warning.';
|
|
@@ -7,45 +9,21 @@ export const moduleNoCycle = {
|
|
|
7
9
|
scope: 'project',
|
|
8
10
|
run(project) {
|
|
9
11
|
const report = reporter(project, this.id);
|
|
10
|
-
return [...
|
|
11
|
-
const modules = [...new Set(
|
|
12
|
-
|
|
13
|
-
...new Set(edges.filter((edge) => edge.from === module).map((edge) => edge.to)),
|
|
14
|
-
];
|
|
15
|
-
return cyclesIn(modules, next).map((cycle) => {
|
|
12
|
+
return [...byContext(moduleImports(project.files))].flatMap(([context, imports]) => {
|
|
13
|
+
const modules = [...new Set(imports.map((one) => one.from))].sort();
|
|
14
|
+
return cyclesIn(modules, importedModules(imports)).map((cycle) => {
|
|
16
15
|
const [first = '', second = ''] = cycle;
|
|
17
|
-
const
|
|
18
|
-
return report({ file:
|
|
16
|
+
const closing = imports.find((candidate) => candidate.from === first && candidate.to === second);
|
|
17
|
+
return report({ file: closing?.file ?? '', line: closing?.line ?? 1 }, `The modules of the model of "${context}" import each other in a cycle: ${[...cycle, first].join(' -> ')}.`, FIX);
|
|
19
18
|
});
|
|
20
19
|
});
|
|
21
20
|
},
|
|
22
21
|
};
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
for (const
|
|
26
|
-
|
|
27
|
-
const edges = byContext.get(edge.context);
|
|
28
|
-
if (edges === undefined) {
|
|
29
|
-
byContext.set(edge.context, [edge]);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
edges.push(edge);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
22
|
+
function byContext(imports) {
|
|
23
|
+
const grouped = new Map();
|
|
24
|
+
for (const one of imports) {
|
|
25
|
+
grouped.set(one.context, [...(grouped.get(one.context) ?? []), one]);
|
|
35
26
|
}
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
/** The imports of a file of one module of the model to another module of the same context. */
|
|
39
|
-
function edgesOf({ location, imports, path }) {
|
|
40
|
-
if (location.area !== 'context' || location.module === undefined) {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
const { context, module: from } = location;
|
|
44
|
-
return imports.flatMap(({ target, line }) => {
|
|
45
|
-
const to = target.kind === 'file' && target.location.area === 'context' ? target.location : undefined;
|
|
46
|
-
return to?.context === context && to.module !== undefined && to.module !== from
|
|
47
|
-
? [{ context, from, to: to.module, file: path, line }]
|
|
48
|
-
: [];
|
|
49
|
-
});
|
|
27
|
+
return grouped;
|
|
50
28
|
}
|
|
51
29
|
//# sourceMappingURL=module-no-cycle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-no-cycle.js","sourceRoot":"","sources":["../../../src/check/rules/module-no-cycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module-no-cycle.js","sourceRoot":"","sources":["../../../src/check/rules/module-no-cycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAqB,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,GAAG,GACP,2ZAA2Z,CAAC;AAE9Z,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,EAAE,EAAE,iBAAiB;IACrB,WAAW,EACT,mRAAmR;IACrR,KAAK,EAAE,SAAS;IAChB,GAAG,CAAC,OAAO;QACT,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAE1C,OAAO,CAAC,GAAG,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAAE;YACjF,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAEpE,OAAO,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC/D,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;gBACxC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,KAAK,IAAI,SAAS,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;gBAEjG,OAAO,MAAM,CACX,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,EACvD,gCAAgC,OAAO,mCAAmC,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAC3G,GAAG,CACJ,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,SAAS,SAAS,CAAC,OAAgC;IACjD,MAAM,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;IAElD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -69,6 +69,6 @@ function unsealed(file, columns) {
|
|
|
69
69
|
function undeclared(report, kept, { term, declarations }) {
|
|
70
70
|
const column = kept.names[0] ?? '';
|
|
71
71
|
const where = declarations.find((declaration) => declaration.context === kept.context)?.file;
|
|
72
|
-
return report(kept, `The column ${column} of ${kept.context} is named like personal data (${term}), and no personalFields declaration of ${kept.context} names it: the erasure, the export and the register of personal data do not reach it.`, `Name it in the fields of the declaration of its table (${where ?? `infrastructure/persistence/<aggregate>${SUFFIX}`}, which \`ddd-ts-kit generate repository ${kept.context} <Aggregate> --personal <column>,...\` writes). A column that holds nothing of a person in this project is recorded: \`// ddd-ts-kit-disable-next-line privacy/declared-field -- ADR-NNNN: <why>\` above it, or the word in \`privacy.allow\` of ddd-ts-kit.config.json.`);
|
|
72
|
+
return report(kept, `The column ${column} of ${kept.context} is named like personal data (${term}), and no personalFields declaration of ${kept.context} names it: the erasure, the export and the register of personal data do not reach it.`, `Name it in the fields of the declaration of its table (${where ?? `infrastructure/persistence/<aggregate>${SUFFIX}`}, which \`ddd-ts-kit generate repository ${kept.context} <Aggregate> --personal <column>,...\` writes; for a table no aggregate owns, \`ddd-ts-kit generate personal-fields ${kept.context} <table> --personal <column>,... --subject <column>\`). A column that holds nothing of a person in this project is recorded: \`// ddd-ts-kit-disable-next-line privacy/declared-field -- ADR-NNNN: <why>\` above it, or the word in \`privacy.allow\` of ddd-ts-kit.config.json.`);
|
|
73
73
|
}
|
|
74
74
|
//# sourceMappingURL=privacy-declared-field.js.map
|