ddd-ts-kit 0.111.0 → 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 +112 -0
- package/README.fr.md +35 -6
- package/README.md +32 -5
- 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/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/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/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 +1 -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/generate/generate-options.d.ts +3 -0
- package/dist/generate/generate-options.d.ts.map +1 -1
- package/dist/generate/generate-options.js +1 -0
- package/dist/generate/generate-options.js.map +1 -1
- package/dist/generate/kind.d.ts +2 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/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/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-kind.d.ts.map +1 -1
- package/dist/generate/kinds/read-model-kind.js +19 -0
- package/dist/generate/kinds/read-model-kind.js.map +1 -1
- 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/shared-writes.d.ts.map +1 -1
- package/dist/generate/shared-writes.js +3 -2
- 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 +5 -1
- 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 -2
- 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/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/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/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/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
- 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 +5 -0
- package/templates/init/e2e/test-database-setup.ts.tpl +120 -0
- package/templates/init/e2e/vitest.e2e.config.ts.tpl +2 -1
- 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 +8 -3
- package/templates/init/platform/database/open-test-database.knex.ts.tpl +8 -3
- package/templates/init/platform/database/open-test-database.prisma.ts.tpl +8 -3
- package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +8 -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 +52 -161
- 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/resilience/default-policy.ts.tpl +8 -1
- package/templates/init/rules/infrastructure.md.tpl +2 -2
- 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/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/repository/drizzle/repository.ts.tpl +6 -9
|
@@ -2,19 +2,20 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { isRecord } from '../support/is-record.js';
|
|
4
4
|
import { drizzleOutFolder } from './drizzle-out-folder.js';
|
|
5
|
+
import { journalEntries } from './journal-entries.js';
|
|
5
6
|
/** The journal, the SQL files and the snapshots of the project; undefined when it has no journal to read. */
|
|
6
7
|
export function readDrizzleMigrations(root) {
|
|
7
8
|
const folder = drizzleOutFolder(root);
|
|
8
9
|
const directory = path.join(root, folder);
|
|
9
10
|
const journalText = readIfPresent(path.join(directory, 'meta', '_journal.json'));
|
|
10
|
-
const
|
|
11
|
-
if (journalText === undefined ||
|
|
11
|
+
const entries = journalText === undefined ? undefined : journalEntries(journalText);
|
|
12
|
+
if (journalText === undefined || entries === undefined) {
|
|
12
13
|
return undefined;
|
|
13
14
|
}
|
|
14
15
|
return {
|
|
15
16
|
folder,
|
|
16
17
|
journalText,
|
|
17
|
-
entries
|
|
18
|
+
entries,
|
|
18
19
|
files: namesEndingWith(directory, '.sql'),
|
|
19
20
|
snapshots: snapshotsIn(path.join(directory, 'meta')),
|
|
20
21
|
};
|
|
@@ -30,12 +31,6 @@ function linkOf(snapshot) {
|
|
|
30
31
|
const { id, prevId } = snapshot;
|
|
31
32
|
return typeof id === 'string' && typeof prevId === 'string' ? { id, prevId } : undefined;
|
|
32
33
|
}
|
|
33
|
-
function isEntry(value) {
|
|
34
|
-
return (isRecord(value) &&
|
|
35
|
-
typeof value['idx'] === 'number' &&
|
|
36
|
-
typeof value['when'] === 'number' &&
|
|
37
|
-
typeof value['tag'] === 'string');
|
|
38
|
-
}
|
|
39
34
|
function namesEndingWith(directory, suffix) {
|
|
40
35
|
try {
|
|
41
36
|
return fs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-drizzle-migrations.js","sourceRoot":"","sources":["../../../src/check/migrations/read-drizzle-migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,M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,CAAC,CAAC;aAC5C,IAAI,EAAE,CAAC;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ModuleImport } from './module-imports.js';
|
|
2
|
+
/** The graph the imports between the modules of one context draw: the modules each module imports. */
|
|
3
|
+
export declare function importedModules(imports: readonly ModuleImport[]): (module: string) => string[];
|
|
4
|
+
//# sourceMappingURL=imported-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imported-modules.d.ts","sourceRoot":"","sources":["../../../src/check/modules/imported-modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,CAE9F"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The graph the imports between the modules of one context draw: the modules each module imports. */
|
|
2
|
+
export function importedModules(imports) {
|
|
3
|
+
return (module) => [...new Set(imports.filter((one) => one.from === module).map((one) => one.to))];
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=imported-modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imported-modules.js","sourceRoot":"","sources":["../../../src/check/modules/imported-modules.ts"],"names":[],"mappings":"AAEA,sGAAsG;AACtG,MAAM,UAAU,eAAe,CAAC,OAAgC;IAC9D,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SourceFile } from '../model/source-file.js';
|
|
2
|
+
/** One import from a production file of one module to a file of another module of the same context: where it is written. */
|
|
3
|
+
export interface ModuleImport {
|
|
4
|
+
readonly context: string;
|
|
5
|
+
readonly from: string;
|
|
6
|
+
readonly to: string;
|
|
7
|
+
readonly file: string;
|
|
8
|
+
readonly line: number;
|
|
9
|
+
/** The file the import names, from the project root. */
|
|
10
|
+
readonly imported: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* What `module/no-cycle` judges, and a command that moves files before it writes: the imports of
|
|
14
|
+
* the production files of the modules of the model to another module of their context.
|
|
15
|
+
*/
|
|
16
|
+
export declare function moduleImports(files: readonly SourceFile[]): ModuleImport[];
|
|
17
|
+
//# sourceMappingURL=module-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-imports.d.ts","sourceRoot":"","sources":["../../../src/check/modules/module-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,4HAA4H;AAC5H,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,YAAY,EAAE,CAE1E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `module/no-cycle` judges, and a command that moves files before it writes: the imports of
|
|
3
|
+
* the production files of the modules of the model to another module of their context.
|
|
4
|
+
*/
|
|
5
|
+
export function moduleImports(files) {
|
|
6
|
+
return files.filter((file) => !file.isTest).flatMap(importsOf);
|
|
7
|
+
}
|
|
8
|
+
function importsOf({ location, imports, path }) {
|
|
9
|
+
if (location.area !== 'context' || location.module === undefined) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const { context, module: from } = location;
|
|
13
|
+
return imports.flatMap(({ target, line }) => {
|
|
14
|
+
if (target.kind !== 'file' || target.location.area !== 'context') {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const { context: reached, module: to } = target.location;
|
|
18
|
+
return reached === context && to !== undefined && to !== from
|
|
19
|
+
? [{ context, from, to, file: path, line, imported: target.path }]
|
|
20
|
+
: [];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=module-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-imports.js","sourceRoot":"","sources":["../../../src/check/modules/module-imports.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAA4B;IACxD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,SAAS,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAc;IACxD,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACjE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAE3C,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;QAC1C,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACjE,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEzD,OAAO,OAAO,KAAK,OAAO,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,IAAI;YAC3D,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;YAClE,CAAC,CAAC,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble-project.d.ts","sourceRoot":"","sources":["../../../src/check/project/assemble-project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assemble-project.d.ts","sourceRoot":"","sources":["../../../src/check/project/assemble-project.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,8HAA8H;AAC9H,wBAAgB,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,cAAc,GAAG,QAAQ,CAAC,GAAG,OAAO,CAetG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isOneOf, projectSeverity, SEVERITIES } from '../../config/index.js';
|
|
2
2
|
import { DEFAULT_SEVERITIES } from '../catalogue/default-severities.js';
|
|
3
|
-
import {
|
|
3
|
+
import { fileSeverity } from './file-severity.js';
|
|
4
4
|
import { locate } from './locate.js';
|
|
5
5
|
/** Gives what was loaded the questions every rule asks: the severity of a rule, on a file or not, and the place of a file. */
|
|
6
6
|
export function assembleProject(loaded) {
|
|
@@ -16,11 +16,4 @@ export function assembleProject(loaded) {
|
|
|
16
16
|
locate: (file) => locate(config, file),
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function fileSeverity(config, ruleId, file) {
|
|
20
|
-
const setting = config.rules[ruleId];
|
|
21
|
-
if (setting === undefined || typeof setting === 'string' || !isOneOf(SEVERITIES, setting.severity)) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
return setting.files.some((glob) => matchesGlob(glob, file)) ? setting.severity : undefined;
|
|
25
|
-
}
|
|
26
19
|
//# sourceMappingURL=assemble-project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble-project.js","sourceRoot":"","sources":["../../../src/check/project/assemble-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"assemble-project.js","sourceRoot":"","sources":["../../../src/check/project/assemble-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAiB,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,8HAA8H;AAC9H,MAAM,UAAU,eAAe,CAAC,MAA6D;IAC3F,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE1B,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAY,EAAE;QAC5C,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAEzD,OAAO,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC;IAChG,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,MAAM;QACT,QAAQ;QACR,YAAY,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;QAClE,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Config, type Severity } from '../../config/index.js';
|
|
2
|
+
/** The severity a setting for some files gives `file`; undefined when no such setting names it. */
|
|
3
|
+
export declare function fileSeverity(config: Config, ruleId: string, file: string): Severity | undefined;
|
|
4
|
+
//# sourceMappingURL=file-severity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-severity.d.ts","sourceRoot":"","sources":["../../../src/check/project/file-severity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG/E,mGAAmG;AACnG,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAQ/F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { isOneOf, SEVERITIES } from '../../config/index.js';
|
|
2
|
+
import { matchesGlob } from '../exports/matches-glob.js';
|
|
3
|
+
/** The severity a setting for some files gives `file`; undefined when no such setting names it. */
|
|
4
|
+
export function fileSeverity(config, ruleId, file) {
|
|
5
|
+
const setting = config.rules[ruleId];
|
|
6
|
+
if (setting === undefined || typeof setting === 'string' || !isOneOf(SEVERITIES, setting.severity)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return setting.files.some((glob) => matchesGlob(glob, file)) ? setting.severity : undefined;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=file-severity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-severity.js","sourceRoot":"","sources":["../../../src/check/project/file-severity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAA8B,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,mGAAmG;AACnG,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,MAAc,EAAE,IAAY;IACvE,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAErC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnG,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9F,CAAC"}
|
|
@@ -2,10 +2,10 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { readConfig } from '../../config/index.js';
|
|
4
4
|
import { assembleProject } from './assemble-project.js';
|
|
5
|
-
import { gitIgnored } from './git-ignored.js';
|
|
6
5
|
import { isSource } from './is-source.js';
|
|
7
6
|
import { isUnder } from './is-under.js';
|
|
8
7
|
import { loadSourceFile } from './load-source-file.js';
|
|
8
|
+
import { notInTheTree } from './not-in-the-tree.js';
|
|
9
9
|
import { walkDirectory } from './walk-directory.js';
|
|
10
10
|
export function loadProject(root, options = {}) {
|
|
11
11
|
// A directory of the config out of the project is read as its default here, and reported by config/valid.
|
|
@@ -38,15 +38,6 @@ function walkTree(root, config) {
|
|
|
38
38
|
walkDirectory({ root, directory: config.sourceRoot, skip: notInTheTree(root, config) }, visit);
|
|
39
39
|
return { files, contextEntries, contextsOnDisk };
|
|
40
40
|
}
|
|
41
|
-
/**
|
|
42
|
-
* The tree under the source root is what git sees: an entry git ignores is not read, nor a
|
|
43
|
-
* dot-directory under the contexts directory, which a tool writes and no context declares.
|
|
44
|
-
*/
|
|
45
|
-
function notInTheTree(root, { sourceRoot, contextsDir }) {
|
|
46
|
-
const ignored = gitIgnored(root, sourceRoot);
|
|
47
|
-
return (file, isDirectory) => ignored(file, isDirectory) ||
|
|
48
|
-
(isDirectory && file !== contextsDir && isUnder(file, contextsDir) && path.posix.basename(file).startsWith('.'));
|
|
49
|
-
}
|
|
50
41
|
function readSource(root, config, file) {
|
|
51
42
|
return loadSourceFile(config, file, fs.readFileSync(path.join(root, file), 'utf8'));
|
|
52
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-project.js","sourceRoot":"","sources":["../../../src/check/project/load-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAe,MAAM,cAAc,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"load-project.js","sourceRoot":"","sources":["../../../src/check/project/load-project.ts"],"names":[],"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,EAAE,IAAY;IAC5D,OAAO,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACtF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Config } from '../../config/index.js';
|
|
2
|
+
import { type Ignored } from './git-ignored.js';
|
|
3
|
+
/**
|
|
4
|
+
* The tree under the source root is what git sees: an entry git ignores is not read, nor a
|
|
5
|
+
* dot-directory under the contexts directory, which a tool writes and no context declares, nor a
|
|
6
|
+
* directory no walk enters (`SKIPPED_DIRECTORIES`). `ddd-ts-kit check` walks with it, and so does a
|
|
7
|
+
* command that judges, before it writes, what a rule will judge.
|
|
8
|
+
*/
|
|
9
|
+
export declare function notInTheTree(root: string, { sourceRoot, contextsDir }: Config): Ignored;
|
|
10
|
+
//# sourceMappingURL=not-in-the-tree.d.ts.map
|
|
@@ -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;AAqBhC,MAAM,CAAC,MAAM,4BAA4B,GAAS;IAChD,EAAE,EAAE,iCAAiC;IACrC,WAAW,EACT,ouBAAouB;IACtuB,KAAK,EAAE,SAAS;IAChB,GAAG,CAAC,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AqB;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,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