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,72 @@
|
|
|
1
|
+
import { renderTemplate, templateExists } from '../../templating/index.js';
|
|
2
|
+
import { applyWiring } from '../apply-wiring.js';
|
|
3
|
+
import { CliError } from '../../cli-error.js';
|
|
4
|
+
import { TABLES_FILES } from './tables-files.js';
|
|
5
|
+
import { keepsSinglePrismaSchema, PRISMA_MAIN_SCHEMA, PRISMA_SCHEMA_FOLDER, prismaSchemaOf, schemaOfContext, singlePrismaSchemaFound, singlePrismaSchemaSteps, withDatasourceSchema, } from '../../prisma-schema/index.js';
|
|
6
|
+
/** A table or a model, declared where the migration tooling of the ORM reads it; nothing without an ORM of the kit. */
|
|
7
|
+
export function declareTable(scope, context, declared) {
|
|
8
|
+
const { orm } = scope.config.stack;
|
|
9
|
+
const tablesFile = TABLES_FILES[orm];
|
|
10
|
+
if (orm === 'prisma') {
|
|
11
|
+
declarePrismaModel(scope, context, declared);
|
|
12
|
+
}
|
|
13
|
+
if (tablesFile === undefined) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const template = (file) => templateOf(declared, `${orm}/${file}`);
|
|
17
|
+
const directory = `${scope.dir}/infrastructure/persistence`;
|
|
18
|
+
const tables = `${directory}/${tablesFile(scope.context.kebab)}.ts`;
|
|
19
|
+
if (orm === 'knex') {
|
|
20
|
+
scope.ws.create(`${directory}/${scope.context.kebab}.schema.ts`, renderTemplate(template('schema.ts.tpl'), context));
|
|
21
|
+
scope.ws.create(tables, renderTemplate(template('tables.ts.tpl'), context));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
scope.ws.create(tables, renderTemplate(template('schema.ts.tpl'), context));
|
|
25
|
+
}
|
|
26
|
+
declareOnce(scope, { file: tables, declared }, renderTemplate(template('table.tpl'), context));
|
|
27
|
+
applyWiring(scope.ws, `${scope.config.platformDir}/database/schema.ts`, renderTemplate(template('schema-export.tpl'), context));
|
|
28
|
+
}
|
|
29
|
+
/** The template of the kind that declares the table, or the one a repository starts the same file with. */
|
|
30
|
+
function templateOf({ templates }, file) {
|
|
31
|
+
const own = `${templates}/${file}`;
|
|
32
|
+
return templateExists(own) ? own : `repository/${file}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A command run again with the same options adds nothing, its block being there already. Run again with others
|
|
36
|
+
* (`--personal`, `--tenant-scoped`, `--field`), it would declare the table a second time under the same name, and
|
|
37
|
+
* every spec that loads the file would fail on the name declared twice: it is refused, the file left as it was.
|
|
38
|
+
* A table is counted where it is declared (`.table(`, `createTable(`, `tableName:`, `@@map(`): a column may bear
|
|
39
|
+
* the name of another table.
|
|
40
|
+
*/
|
|
41
|
+
function declareOnce(scope, { file, declared }, wiring) {
|
|
42
|
+
const named = new RegExp(`(?:\\btable\\(\\s*|\\bcreateTable\\(|\\btableName: |@@map\\()['"]${declared.table}['"]`, 'g');
|
|
43
|
+
const count = () => scope.ws.read(file)?.match(named)?.length ?? 0;
|
|
44
|
+
const before = count();
|
|
45
|
+
applyWiring(scope.ws, file, wiring);
|
|
46
|
+
if (before > 0 && count() > before) {
|
|
47
|
+
throw new CliError(`${file} already declares the table ${declared.table}, with other columns than this command would write.`, declared.changedBy
|
|
48
|
+
.replace('<file>', file)
|
|
49
|
+
.replace('<context>', scope.context.kebab)
|
|
50
|
+
.replace('<table>', declared.table));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Prisma reads the files of one folder: the model joins the file of its context, which the worker
|
|
55
|
+
* of the context owns, and the database schema of the context the datasource of the main file.
|
|
56
|
+
*/
|
|
57
|
+
function declarePrismaModel(scope, context, declared) {
|
|
58
|
+
const models = prismaSchemaOf(scope.context.kebab);
|
|
59
|
+
if (keepsSinglePrismaSchema((file) => scope.ws.exists(file))) {
|
|
60
|
+
throw new CliError(`${singlePrismaSchemaFound()} The model would go to ${models}, which Prisma reads only once prisma.config.ts names ${PRISMA_SCHEMA_FOLDER}.`, `${singlePrismaSchemaSteps(Object.keys(scope.config.contexts))} Then run this command again.`);
|
|
61
|
+
}
|
|
62
|
+
if (scope.ws.read(models) === undefined) {
|
|
63
|
+
scope.ws.create(models, renderTemplate('repository/prisma/schema.prisma.tpl', context));
|
|
64
|
+
}
|
|
65
|
+
declareOnce(scope, { file: models, declared }, renderTemplate(templateOf(declared, 'prisma/model.tpl'), context));
|
|
66
|
+
const content = scope.ws.read(PRISMA_MAIN_SCHEMA);
|
|
67
|
+
if (content !== undefined) {
|
|
68
|
+
scope.ws.update(PRISMA_MAIN_SCHEMA, withDatasourceSchema(content, schemaOfContext(scope.context.kebab)));
|
|
69
|
+
}
|
|
70
|
+
scope.ws.note(`${models} changed: run \`npm run db:client\` to regenerate the client and the schema of the tests.`);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=declare-table.js.map
|
|
@@ -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E,OAAO,CAAC,CAAC,CAAC;IAC1F,CAAC;IAED,WAAW,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,cAAc,CAAC,UAAU,CAAC,QAAQ,EAAE,kBAAkB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAElH,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAElD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3G,CAAC;IAED,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,MAAM,2FAA2F,CAAC,CAAC;AACtH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-slug.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/job-slug.ts"],"names":[],"mappings":"AAKA,kKAAkK;AAClK,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { toName } from '../../../naming/index.js';
|
|
2
|
+
/** `ShipDailyJob`, `ImportRowsBackgroundJob` and `import-rows-background-job` name the jobs `ShipDaily` and `ImportRows`. */
|
|
3
|
+
const ROLE_SUFFIX = /(?:[-_]?background)?[-_]?job$/i;
|
|
4
|
+
/** A job as a file name carries it, from its class or from what a person calls it: `ship-daily` of `ShipDailyJob`, `import-rows` of `ImportRowsBackgroundJob`. */
|
|
5
|
+
export function jobSlug(className) {
|
|
6
|
+
return toName(className.replace(ROLE_SUFFIX, '')).kebab;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=job-slug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-slug.js","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/job-slug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,6HAA6H;AAC7H,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAErD,kKAAkK;AAClK,MAAM,UAAU,OAAO,CAAC,SAAiB;IACvC,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Name } from '../../../naming/index.js';
|
|
2
|
+
import type { Scope } from '../../scope.js';
|
|
3
|
+
import type { JobStart } from './reaction-of.js';
|
|
4
|
+
/** A function of the end-to-end support a spec starts its use case with. */
|
|
5
|
+
export type Support = 'publish' | 'runJob' | 'runDueJobs';
|
|
6
|
+
/** The end-to-end spec of a use case its jobs start. */
|
|
7
|
+
export interface JobSpec {
|
|
8
|
+
/** Under the name of the use case, or, when `--job` names the job, that name followed by the job: the name of a part of a spec, which leaves the spec of a route alone. */
|
|
9
|
+
readonly file: string;
|
|
10
|
+
readonly content: string;
|
|
11
|
+
/** What the spec calls on the support: `runJob` for a scheduled job, `runDueJobs` for a background one. */
|
|
12
|
+
readonly needs: readonly Support[];
|
|
13
|
+
}
|
|
14
|
+
/** The spec of a use case its jobs start: one test per job, the scheduled one run at once, the background one with what is due on its queue. */
|
|
15
|
+
export declare function jobSpec(scope: Scope, name: Name, { jobs, e2e }: JobStart): JobSpec;
|
|
16
|
+
//# sourceMappingURL=job-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-spec.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/job-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,4EAA4E;AAC5E,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE1D,wDAAwD;AACxD,MAAM,WAAW,OAAO;IACtB,2KAA2K;IAC3K,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2GAA2G;IAC3G,QAAQ,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,CAAC;CACpC;AAID,gJAAgJ;AAChJ,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,QAAQ,GAAG,OAAO,CAwBlF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { renderTemplate } from '../../../templating/index.js';
|
|
2
|
+
import { named } from '../../named.js';
|
|
3
|
+
import { vars } from '../../vars.js';
|
|
4
|
+
import { jobSlug } from './job-slug.js';
|
|
5
|
+
const GLOBALS = ['afterAll', 'beforeAll', 'beforeEach', 'describe', 'it'];
|
|
6
|
+
/** The spec of a use case its jobs start: one test per job, the scheduled one run at once, the background one with what is due on its queue. */
|
|
7
|
+
export function jobSpec(scope, name, { jobs, e2e }) {
|
|
8
|
+
const caseOf = (job, template) => renderTemplate(template, vars(scope, { name: named(name), job: { ...job } })).trimEnd();
|
|
9
|
+
const cases = [
|
|
10
|
+
...jobs.scheduled.map((job) => caseOf(job, 'e2e/e2e-job-case.ts.tpl')),
|
|
11
|
+
...jobs.background.map((job) => caseOf(job, 'e2e/e2e-background-job-case.ts.tpl')),
|
|
12
|
+
];
|
|
13
|
+
// A background job runs only once a request enqueued it, which the spec asserts.
|
|
14
|
+
const globals = jobs.background.length === 0 ? GLOBALS : [...GLOBALS, 'expect'].sort();
|
|
15
|
+
const starts = startsOf(scope, name, jobs);
|
|
16
|
+
return {
|
|
17
|
+
file: fileOf(scope, name, jobs),
|
|
18
|
+
content: renderTemplate('e2e/e2e-job.spec.ts.tpl', vars(scope, {
|
|
19
|
+
name: named(name),
|
|
20
|
+
e2e: { ...e2e, cases: cases.join('\n\n'), globals: globals.join(', '), starts },
|
|
21
|
+
})),
|
|
22
|
+
needs: needsOf(jobs),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function needsOf(jobs) {
|
|
26
|
+
const scheduled = jobs.scheduled.length === 0 ? [] : ['runJob'];
|
|
27
|
+
const background = jobs.background.length === 0 ? [] : ['runDueJobs'];
|
|
28
|
+
return [...scheduled, ...background];
|
|
29
|
+
}
|
|
30
|
+
function fileOf(scope, name, jobs) {
|
|
31
|
+
const asked = scope.flags.job === undefined ? [] : [...jobs.scheduled, ...jobs.background].slice(0, 1);
|
|
32
|
+
return `test/e2e/${[name.kebab, ...asked.map((job) => jobSlug(job.className))].join('-')}.e2e.spec.ts`;
|
|
33
|
+
}
|
|
34
|
+
/** Why the spec runs jobs, said above its tests. */
|
|
35
|
+
function startsOf(scope, name, jobs) {
|
|
36
|
+
const lead = scope.flags.job === undefined ? `No route starts "${name.words}"` : `"${name.words}" as a job starts it`;
|
|
37
|
+
const ways = [
|
|
38
|
+
...(jobs.scheduled.length === 0
|
|
39
|
+
? []
|
|
40
|
+
: [
|
|
41
|
+
`${namesOf(jobs.scheduled)} sends its command when its schedule is due, so the spec runs the job as the scheduler would`,
|
|
42
|
+
]),
|
|
43
|
+
...(jobs.background.length === 0
|
|
44
|
+
? []
|
|
45
|
+
: [
|
|
46
|
+
`${namesOf(jobs.background)} sends its command once a use case enqueued it, so the spec runs what is due on the queue as the worker would`,
|
|
47
|
+
]),
|
|
48
|
+
];
|
|
49
|
+
return `${lead}: ${ways.join('; ')}.`;
|
|
50
|
+
}
|
|
51
|
+
function namesOf(jobs) {
|
|
52
|
+
return jobs.map((job) => job.name).join(', ');
|
|
53
|
+
}
|
|
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GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC;AACzG,CAAC;AAED,oDAAoD;AACpD,SAAS,QAAQ,CAAC,KAAY,EAAE,IAAU,EAAE,IAAiB;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,oBAAoB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,sBAAsB,CAAC;IAEtH,MAAM,IAAI,GAAG;QACX,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;YAC7B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,8FAA8F;aACzH,CAAC;QACN,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;YAC9B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,+GAA+G;aAC3I,CAAC;KACP,CAAC;IAEF,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACxC,CAAC;AAED,SAAS,OAAO,CAAC,IAA2B;IAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { type Name } from '../../../naming/index.js';
|
|
2
2
|
import type { Scope } from '../../scope.js';
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/** A job that sends the command of a use case, as an end-to-end spec starts it. */
|
|
4
|
+
export interface SendingJob {
|
|
5
|
+
/** The name the job runs under, `<context>.<job>`: what the scheduler runs, or the static `jobName` of a background job. */
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly className: string;
|
|
8
|
+
/** The file of the job, which the command builds on. */
|
|
9
|
+
readonly file: string;
|
|
10
|
+
}
|
|
11
|
+
/** The jobs of a context that send the command of a use case. */
|
|
12
|
+
export interface SendingJobs {
|
|
13
|
+
/** Those a schedule runs (`application/scheduling/`). */
|
|
14
|
+
readonly scheduled: readonly SendingJob[];
|
|
15
|
+
/** Those a use case enqueues and a worker runs (`application/background/`). */
|
|
16
|
+
readonly background: readonly SendingJob[];
|
|
17
|
+
}
|
|
18
|
+
/** Each job of the context that sends the command of the use case, scheduled or background. */
|
|
19
|
+
export declare function jobsSending(scope: Scope, name: Name): SendingJobs;
|
|
8
20
|
//# sourceMappingURL=jobs-sending.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobs-sending.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/jobs-sending.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jobs-sending.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/jobs-sending.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,4HAA4H;IAC5H,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,SAAS,EAAE,SAAS,UAAU,EAAE,CAAC;IAC1C,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,SAAS,UAAU,EAAE,CAAC;CAC5C;AAED,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,CAEjE"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
+
import { readBackgroundJobs } from '../../../docs/read-background-jobs.js';
|
|
1
2
|
import { readJobFiles } from '../../../docs/read-job-files.js';
|
|
2
3
|
import { toName } from '../../../naming/index.js';
|
|
3
4
|
import { treeOf } from '../../../model-modules/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* The name of a job as the scheduler knows it, `<context>.<job>`, of each job of the context that
|
|
6
|
-
* sends the command of the use case; the file of each is what the command builds on.
|
|
7
|
-
*/
|
|
5
|
+
/** Each job of the context that sends the command of the use case, scheduled or background. */
|
|
8
6
|
export function jobsSending(scope, name) {
|
|
7
|
+
return { scheduled: scheduledSending(scope, name), background: backgroundSending(scope, name) };
|
|
8
|
+
}
|
|
9
|
+
function scheduledSending(scope, name) {
|
|
9
10
|
const context = scope.context.kebab;
|
|
10
11
|
return readJobFiles(scope.ws, treeOf(scope.config, context), context)
|
|
11
12
|
.filter((job) => job.command === name.pascal)
|
|
12
13
|
.map((job) => {
|
|
13
|
-
|
|
14
|
-
return
|
|
14
|
+
const declared = toName(job.file.slice(job.file.lastIndexOf('/') + 1, -'.job.ts'.length));
|
|
15
|
+
return {
|
|
16
|
+
name: job.name.includes('.') ? job.name : `${context}.${declared.kebab}`,
|
|
17
|
+
className: `${declared.pascal}Job`,
|
|
18
|
+
file: job.file,
|
|
19
|
+
};
|
|
15
20
|
});
|
|
16
21
|
}
|
|
22
|
+
function backgroundSending(scope, name) {
|
|
23
|
+
const sends = new RegExp(String.raw `\bnew ${name.pascal}Command\(`);
|
|
24
|
+
return readBackgroundJobs(scope.ws, treeOf(scope.config, scope.context.kebab)).filter((job) => sends.test(scope.ws.read(job.file) ?? ''));
|
|
25
|
+
}
|
|
17
26
|
//# sourceMappingURL=jobs-sending.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobs-sending.js","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/jobs-sending.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAa,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"jobs-sending.js","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/jobs-sending.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAa,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAoBhD,+FAA+F;AAC/F,MAAM,UAAU,WAAW,CAAC,KAAY,EAAE,IAAU;IAClD,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;AAClG,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAY,EAAE,IAAU;IAChD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IAEpC,OAAO,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC;SAClE,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC,MAAM,CAAC;SAC5C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QAE1F,OAAO;YACL,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,QAAQ,CAAC,KAAK,EAAE;YACxE,SAAS,EAAE,GAAG,QAAQ,CAAC,MAAM,KAAK;YAClC,IAAI,EAAE,GAAG,CAAC,IAAI;SACf,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAY,EAAE,IAAU;IACjD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,SAAS,IAAI,CAAC,MAAM,WAAW,CAAC,CAAC;IAEpE,OAAO,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAC5F,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { type Name } from '../../../naming/index.js';
|
|
2
2
|
import type { RenderContext } from '../../../templating/index.js';
|
|
3
3
|
import type { Scope } from '../../scope.js';
|
|
4
|
+
import type { SendingJobs } from './jobs-sending.js';
|
|
4
5
|
/** What an end-to-end spec publishes to start a use case no route reaches, and where a client reads what followed. */
|
|
5
6
|
export interface Reaction {
|
|
6
7
|
readonly upstream: RenderContext;
|
|
7
8
|
readonly e2e: RenderContext;
|
|
8
9
|
}
|
|
9
|
-
/** What an end-to-end spec runs to start a use case no route reaches and no handler does: the jobs that send its command. */
|
|
10
|
+
/** What an end-to-end spec runs to start a use case no route reaches and no handler does, or the one `--job` names: the jobs that send its command. */
|
|
10
11
|
export interface JobStart {
|
|
11
|
-
|
|
12
|
-
readonly jobs: readonly string[];
|
|
12
|
+
readonly jobs: SendingJobs;
|
|
13
13
|
readonly e2e: RenderContext;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* The integration event whose handler sends the command of the use case: the one named with
|
|
17
|
-
* `--event`, or the only one a handler of the context sends that command for. Failing that,
|
|
18
|
-
* jobs of the context that send it.
|
|
17
|
+
* `--event`, or the only one a handler of the context sends that command for. Failing that, or
|
|
18
|
+
* when `--job` names one, the jobs of the context that send it, scheduled or background.
|
|
19
19
|
*/
|
|
20
20
|
export declare function reactionOf(scope: Scope, name: Name, routeFile: string): Reaction | JobStart;
|
|
21
21
|
//# sourceMappingURL=reaction-of.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reaction-of.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/reaction-of.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"reaction-of.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/reaction-of.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,sHAAsH;AACtH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;CAC7B;AAED,uJAAuJ;AACvJ,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CA4B3F"}
|
|
@@ -5,21 +5,21 @@ import { readRoutes } from '../../../describe/read-routes.js';
|
|
|
5
5
|
import { toName } from '../../../naming/index.js';
|
|
6
6
|
import { foundPrerequisite } from '../../found-prerequisite.js';
|
|
7
7
|
import { MissingPrerequisite } from '../../missing-prerequisite.js';
|
|
8
|
-
import {
|
|
8
|
+
import { startingJobs } from './starting-jobs.js';
|
|
9
9
|
import { declaredModules, wiringTextOf } from '../../../model-modules/index.js';
|
|
10
10
|
/**
|
|
11
11
|
* The integration event whose handler sends the command of the use case: the one named with
|
|
12
|
-
* `--event`, or the only one a handler of the context sends that command for. Failing that,
|
|
13
|
-
* jobs of the context that send it.
|
|
12
|
+
* `--event`, or the only one a handler of the context sends that command for. Failing that, or
|
|
13
|
+
* when `--job` names one, the jobs of the context that send it, scheduled or background.
|
|
14
14
|
*/
|
|
15
15
|
export function reactionOf(scope, name, routeFile) {
|
|
16
16
|
const sources = sourcesOf(scope);
|
|
17
17
|
const consumed = readConsumedEvents(sources);
|
|
18
18
|
const useCase = { scope, name, consumed };
|
|
19
19
|
const asked = scope.flags.event;
|
|
20
|
-
const event =
|
|
21
|
-
const jobs = event === undefined ?
|
|
22
|
-
if (event === undefined && jobs.length === 0) {
|
|
20
|
+
const event = eventOf(useCase, asked);
|
|
21
|
+
const jobs = event === undefined ? startingJobs(scope, name) : { scheduled: [], background: [] };
|
|
22
|
+
if (event === undefined && jobs.scheduled.length + jobs.background.length === 0) {
|
|
23
23
|
throw noTrigger(useCase, routeFile);
|
|
24
24
|
}
|
|
25
25
|
if (event !== undefined) {
|
|
@@ -29,13 +29,20 @@ export function reactionOf(scope, name, routeFile) {
|
|
|
29
29
|
.filter((route) => route.method === 'GET')
|
|
30
30
|
.map((route) => `GET ${route.path}`);
|
|
31
31
|
if (event === undefined) {
|
|
32
|
-
return { jobs, e2e: { reads: reads.join(', '), readable: reads.length > 0
|
|
32
|
+
return { jobs, e2e: { reads: reads.join(', '), readable: reads.length > 0 } };
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
upstream: upstreamVars(scope, event),
|
|
36
36
|
e2e: { reads: reads.join(', '), readable: reads.length > 0, handlers: handlersOf(consumed, event.type) },
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
+
/** No event when `--job` names what starts the use case: the spec is the one of that job. */
|
|
40
|
+
function eventOf(useCase, asked) {
|
|
41
|
+
if (useCase.scope.flags.job !== undefined) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
return asked === undefined ? sentFor(useCase) : handledOf(useCase, asked);
|
|
45
|
+
}
|
|
39
46
|
function sourcesOf(scope) {
|
|
40
47
|
const { ws, config, context, dir } = scope;
|
|
41
48
|
return {
|
|
@@ -64,7 +71,7 @@ function sentFor(useCase) {
|
|
|
64
71
|
}
|
|
65
72
|
function noTrigger({ scope, name, consumed }, routeFile) {
|
|
66
73
|
const handled = consumed.length === 0 ? '' : ` (handled here: ${typesOf(consumed).join(', ')})`;
|
|
67
|
-
return new MissingPrerequisite(`The use case ${name.pascal} has no route in "${scope.context.kebab}" (${routeFile}), no integration event handler of it sends ${name.pascal}Command, and no job of it does (application/scheduling/*.job.ts).`, `An end-to-end spec drives the application through HTTP, through the integration event that starts the use case, or through the job that runs it: create the route first with \`ddd-ts-kit generate route ${scope.context.kebab} ${name.pascal} --method <M> --path <path>\`, create the job with \`ddd-ts-kit generate job ${scope.context.kebab} <JobName> --every <duration> --command ${name.pascal}
|
|
74
|
+
return new MissingPrerequisite(`The use case ${name.pascal} has no route in "${scope.context.kebab}" (${routeFile}), no integration event handler of it sends ${name.pascal}Command, and no job of it does (application/scheduling/*.job.ts, application/background/*.background-job.ts).`, `An end-to-end spec drives the application through HTTP, through the integration event that starts the use case, or through the job that runs it: create the route first with \`ddd-ts-kit generate route ${scope.context.kebab} ${name.pascal} --method <M> --path <path>\`, create the job with \`ddd-ts-kit generate job ${scope.context.kebab} <JobName> --every <duration> --command ${name.pascal}\` (or \`generate background-job ${scope.context.kebab} <Name> --command ${name.pascal}\` for one a use case enqueues), or name the event its handler receives with --event <context>.<aggregate>.<fact>${handled}.`);
|
|
68
75
|
}
|
|
69
76
|
/** The event named with `--event`: a handler of the context receives it, and the command it starts exists. */
|
|
70
77
|
function handledOf({ scope, name, consumed }, asked) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reaction-of.js","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/reaction-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAa,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"reaction-of.js","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/reaction-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,E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KAAK,IAAI,CAAC;SACpC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;SAC3B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,+GAA+G;AAC/G,SAAS,YAAY,CAAC,KAAY,EAAE,KAAwB;IAC1D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAC/F,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,UAAU,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,CACvF,CAAC;IAEF,MAAM,CAAC,EAAE,SAAS,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjD,OAAO;QACL,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QACrB,SAAS,EAAE,KAAK,CAAC,IAAI;QACrB,KAAK,EAAE,QAAQ,KAAK,SAAS;QAC7B,UAAU,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE;QAChC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC;QAC3B,qDAAqD;QACrD,UAAU,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,IAAI;QAC1C,aAAa,EAAE,GAAG,SAAS,IAAI;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Name } from '../../../naming/index.js';
|
|
2
|
+
import type { Scope } from '../../scope.js';
|
|
3
|
+
import { type SendingJobs } from './jobs-sending.js';
|
|
4
|
+
/**
|
|
5
|
+
* The jobs an end-to-end spec starts the use case with: every job of the context that sends its
|
|
6
|
+
* command, or the one `--job` names, by its class (`ImportRows`, `ImportRowsBackgroundJob`) or by
|
|
7
|
+
* the name it runs under (`shipping.import-rows`). The file of each is what the command builds on.
|
|
8
|
+
*/
|
|
9
|
+
export declare function startingJobs(scope: Scope, name: Name): SendingJobs;
|
|
10
|
+
//# sourceMappingURL=starting-jobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starting-jobs.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/starting-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAgC,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEhF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,CAmBlE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { MissingPrerequisite } from '../../missing-prerequisite.js';
|
|
2
|
+
import { jobSlug } from './job-slug.js';
|
|
3
|
+
import { jobsSending } from './jobs-sending.js';
|
|
4
|
+
/**
|
|
5
|
+
* The jobs an end-to-end spec starts the use case with: every job of the context that sends its
|
|
6
|
+
* command, or the one `--job` names, by its class (`ImportRows`, `ImportRowsBackgroundJob`) or by
|
|
7
|
+
* the name it runs under (`shipping.import-rows`). The file of each is what the command builds on.
|
|
8
|
+
*/
|
|
9
|
+
export function startingJobs(scope, name) {
|
|
10
|
+
const sending = jobsSending(scope, name);
|
|
11
|
+
const asked = scope.flags.job;
|
|
12
|
+
const kept = (jobs) => jobs.filter((job) => asked === undefined || isNamed(job, asked));
|
|
13
|
+
const starting = { scheduled: kept(sending.scheduled), background: kept(sending.background) };
|
|
14
|
+
const all = [...starting.scheduled, ...starting.background];
|
|
15
|
+
if (asked !== undefined && all.length === 0) {
|
|
16
|
+
throw notSending({ scope, name, asked }, sending);
|
|
17
|
+
}
|
|
18
|
+
for (const job of all) {
|
|
19
|
+
scope.flags.builtOn?.(scope.ws.placed(job.file));
|
|
20
|
+
}
|
|
21
|
+
return starting;
|
|
22
|
+
}
|
|
23
|
+
function isNamed(job, asked) {
|
|
24
|
+
return asked.includes('.') ? asked === job.name : jobSlug(asked) === jobSlug(job.className);
|
|
25
|
+
}
|
|
26
|
+
function notSending({ scope, name, asked }, sending) {
|
|
27
|
+
const context = scope.context.kebab;
|
|
28
|
+
const senders = [...sending.scheduled, ...sending.background].map((job) => `${job.className} (${job.name})`);
|
|
29
|
+
return new MissingPrerequisite(`No job of "${context}" named ${asked} sends ${name.pascal}Command.`, senders.length === 0
|
|
30
|
+
? `Create the job first with \`ddd-ts-kit generate job ${context} <JobName> --every <duration> --command ${name.pascal}\` (a schedule runs it) or \`ddd-ts-kit generate background-job ${context} <Name> --command ${name.pascal}\` (a use case enqueues it).`
|
|
31
|
+
: `Pass --job with one of the jobs that send it: ${senders.join(', ')}.`);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=starting-jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starting-jobs.js","sourceRoot":"","sources":["../../../../src/generate/kinds/e2e/starting-jobs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAqC,MAAM,gBAAgB,CAAC;AAEhF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAY,EAAE,IAAU;IACnD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;IAE9B,MAAM,IAAI,GAAG,CAAC,IAA2B,EAAgB,EAAE,CACzD,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,KAAK,S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AG,CAAC,SAAS,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;IAE7G,OAAO,IAAI,mBAAmB,CAC5B,cAAc,OAAO,WAAW,KAAK,UAAU,IAAI,CAAC,MAAM,UAAU,EACpE,OAAO,CAAC,MAAM,KAAK,CAAC;QAClB,CAAC,CAAC,uDAAuD,OAAO,2CAA2C,IAAI,CAAC,MAAM,mEAAmE,OAAO,qBAAqB,IAAI,CAAC,MAAM,8BAA8B;QAC9P,CAAC,CAAC,iDAAiD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC3E,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/e2e-kind.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"e2e-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/e2e-kind.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAapC,eAAO,MAAM,OAAO,EAAE,IAiBrB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readControllers } from '../../describe/read-controllers.js';
|
|
2
|
+
import { CliError } from '../../cli-error.js';
|
|
2
3
|
import { fitStatement } from '../../layout/index.js';
|
|
3
4
|
import { toName } from '../../naming/index.js';
|
|
4
5
|
import { renderTemplate } from '../../templating/index.js';
|
|
@@ -7,6 +8,7 @@ import { named } from '../named.js';
|
|
|
7
8
|
import { openScope } from '../open-scope.js';
|
|
8
9
|
import { vars } from '../vars.js';
|
|
9
10
|
import { actingRole } from './e2e/acting-role.js';
|
|
11
|
+
import { jobSpec } from './e2e/job-spec.js';
|
|
10
12
|
import { reactionOf } from './e2e/reaction-of.js';
|
|
11
13
|
import { tracedCommand } from './traced-command.js';
|
|
12
14
|
import { isControlPlane } from '../../config/is-control-plane.js';
|
|
@@ -14,8 +16,8 @@ import { declaredModules } from '../../model-modules/index.js';
|
|
|
14
16
|
export const e2eKind = {
|
|
15
17
|
name: 'e2e',
|
|
16
18
|
aliases: [],
|
|
17
|
-
usage: 'e2e <context> <UseCaseName> [--event <eventType>]',
|
|
18
|
-
summary: 'An end-to-end spec on the whole application, in test/e2e/ at the project root: driving the route of a use case, or, for a use case no route reaches, publishing the integration event its handler receives (--event names it when several do) or running the job that sends its command. After `generate route <context> <UseCaseName>`, or the `generate integration-handler` or `generate job` that starts its use case.',
|
|
19
|
+
usage: 'e2e <context> <UseCaseName> [--event <eventType> | --job <JobName>]',
|
|
20
|
+
summary: 'An end-to-end spec on the whole application, in test/e2e/ at the project root: driving the route of a use case, or, for a use case no route reaches, publishing the integration event its handler receives (--event names it when several do) or running the job that sends its command, the scheduled one at once and the background one with what is due on its queue (--job names one job, also for a use case a route reaches, and writes test/e2e/<use-case>-<job>.e2e.spec.ts). After `generate route <context> <UseCaseName>`, or the `generate integration-handler`, `generate job` or `generate background-job` that starts its use case.',
|
|
19
21
|
positionals: ['context', 'UseCaseName'],
|
|
20
22
|
writesShared: false,
|
|
21
23
|
writesInModules: false,
|
|
@@ -23,35 +25,39 @@ export const e2eKind = {
|
|
|
23
25
|
const scope = openScope(request);
|
|
24
26
|
const name = label(scope, request.args[1] ?? '', { what: 'use case', strip: ['route', 'controller', 'handler'] });
|
|
25
27
|
const file = `${scope.dir}/presentation/http/${name.kebab}.route.ts`;
|
|
26
|
-
const endpoint = scope
|
|
27
|
-
|
|
28
|
-
let starts = 'route';
|
|
29
|
-
if (endpoint === undefined) {
|
|
30
|
-
const reaction = reactionOf(scope, name, file);
|
|
31
|
-
starts = 'jobs' in reaction ? 'job' : 'event';
|
|
32
|
-
scope.ws.create(spec, reactionSpec(scope, name, reaction));
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const traced = tracedCommand(scope, name);
|
|
36
|
-
const command = `{ name: 'command ${name.pascal}Command'${traced.saved} }`;
|
|
37
|
-
const tree = spanTree(`${endpoint.method} ${endpoint.path}`, command);
|
|
38
|
-
const { written: role, roleImport } = actingRole(scope);
|
|
39
|
-
const namesRole = endpoint.protected === true && roleImport !== '';
|
|
40
|
-
const actor = { role, roleImport, namesRole, tenant: tenantOf(scope) };
|
|
41
|
-
scope.ws.create(spec, renderTemplate('e2e/e2e.spec.ts.tpl', vars(scope, { name: named(name), e2e: { ...endpoint, ...traced, tree, ...actor } })));
|
|
42
|
-
}
|
|
43
|
-
noteSupport(scope, starts);
|
|
28
|
+
const endpoint = namesItsStarter(scope) ? undefined : endpointOf(scope, name, file);
|
|
29
|
+
noteSupport(scope, endpoint === undefined ? startedSpec(scope, name, file) : routeSpec(scope, name, endpoint));
|
|
44
30
|
},
|
|
45
31
|
};
|
|
46
|
-
/** The spec of a use case no route reaches: it publishes the event its handler receives, or runs the
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
/** The spec of a use case no route reaches, or whose starter a flag names: it publishes the event its handler receives, or runs the jobs that send its command. Answers what it needs of the support. */
|
|
33
|
+
function startedSpec(scope, name, routeFile) {
|
|
34
|
+
const reaction = reactionOf(scope, name, routeFile);
|
|
35
|
+
if ('jobs' in reaction) {
|
|
36
|
+
const { file, content, needs } = jobSpec(scope, name, reaction);
|
|
37
|
+
scope.ws.create(file, content);
|
|
38
|
+
return needs;
|
|
39
|
+
}
|
|
40
|
+
scope.ws.create(`test/e2e/${name.kebab}.e2e.spec.ts`, renderTemplate('e2e/e2e-reaction.spec.ts.tpl', vars(scope, { name: named(name), ...reaction })));
|
|
41
|
+
return ['publish'];
|
|
42
|
+
}
|
|
43
|
+
/** The spec that drives the route of the use case: the support of any project serves it. */
|
|
44
|
+
function routeSpec(scope, name, endpoint) {
|
|
45
|
+
const traced = tracedCommand(scope, name);
|
|
46
|
+
const command = `{ name: 'command ${name.pascal}Command'${traced.saved} }`;
|
|
47
|
+
const tree = spanTree(`${endpoint.method} ${endpoint.path}`, command);
|
|
48
|
+
const { written: role, roleImport } = actingRole(scope);
|
|
49
|
+
const namesRole = endpoint.protected === true && roleImport !== '';
|
|
50
|
+
const actor = { role, roleImport, namesRole, tenant: tenantOf(scope) };
|
|
51
|
+
scope.ws.create(`test/e2e/${name.kebab}.e2e.spec.ts`, renderTemplate('e2e/e2e.spec.ts.tpl', vars(scope, { name: named(name), e2e: { ...endpoint, ...traced, tree, ...actor } })));
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
/** True when a flag says what starts the use case: its route is then left aside. `--event` and `--job` name two different specs. */
|
|
55
|
+
function namesItsStarter(scope) {
|
|
56
|
+
const { event, job } = scope.flags;
|
|
57
|
+
if (event !== undefined && job !== undefined) {
|
|
58
|
+
throw new CliError('generate e2e takes --event or --job, not both.', 'A spec starts its use case one way: run the command once with --event <eventType>, once with --job <JobName>.');
|
|
50
59
|
}
|
|
51
|
-
|
|
52
|
-
.map((job) => renderTemplate('e2e/e2e-job-case.ts.tpl', vars(scope, { name: named(name), job: { name: job } })).trimEnd())
|
|
53
|
-
.join('\n\n');
|
|
54
|
-
return renderTemplate('e2e/e2e-job.spec.ts.tpl', vars(scope, { name: named(name), e2e: { ...reaction.e2e, cases } }));
|
|
60
|
+
return event !== undefined || job !== undefined;
|
|
55
61
|
}
|
|
56
62
|
/** The tenant the actors of the spec act in: a tenant-scoped repository refuses a token without one. */
|
|
57
63
|
function tenantOf(scope) {
|
|
@@ -60,17 +66,23 @@ function tenantOf(scope) {
|
|
|
60
66
|
: ", tenantId: 'acme'";
|
|
61
67
|
}
|
|
62
68
|
const SUPPORT = 'test/e2e/support/start-application.ts';
|
|
63
|
-
/**
|
|
64
|
-
|
|
69
|
+
/** How a project whose support was written before a function existed adds it by hand. */
|
|
70
|
+
const ADDED_BY_HAND = {
|
|
71
|
+
runJob: `${SUPPORT} has no runJob(name): add \`runJob(name: string): Promise<void>;\` to RunningApplication and implement it with \`async (name) => { await application.jobs.runNow(name); }\` on the composed application (\`jobs\` is its JobScheduler: \`platform.jobs\` by hand, \`container.resolve(JobScheduler)\` on tsyringe), as a new project has it.`,
|
|
72
|
+
runDueJobs: `${SUPPORT} has no runDueJobs(): add \`runDueJobs(): Promise<string[]>;\` to RunningApplication and implement it on the queue worker of the composed application (\`application.container.resolve(QueueWorker)\` on a container; by hand, \`application.platform.backgroundJobs\` once \`runDue: () => worker.runDue()\` is among what \`jobs/create-background-work.ts\` answers): \`await worker.stop()\`, then \`await worker.runDue()\`, rejecting when the outcome of a run is not \`succeeded\` and answering the name of each job run, as a new project has it.`,
|
|
73
|
+
publish: `${SUPPORT} has no publish(events): add \`publish(events: readonly IntegrationEvent[]): Promise<void>;\` to RunningApplication and implement it with \`(events) => application.eventBus.publish(events)\` on the composed application, as a new project has it.`,
|
|
74
|
+
};
|
|
75
|
+
/** What the spec needs of the support of the project: `init` writes it, older projects add what they lack by hand. */
|
|
76
|
+
function noteSupport(scope, needs) {
|
|
65
77
|
const support = scope.ws.read(SUPPORT);
|
|
66
78
|
if (support === undefined) {
|
|
67
79
|
scope.ws.note(`${SUPPORT} is missing: \`ddd-ts-kit init\` creates it (existing files are kept).`);
|
|
80
|
+
return;
|
|
68
81
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
scope.ws.note(`${SUPPORT} has no publish(events): add \`publish(events: readonly IntegrationEvent[]): Promise<void>;\` to RunningApplication and implement it with \`(events) => application.eventBus.publish(events)\` on the composed application, as a new project has it.`);
|
|
82
|
+
for (const need of needs) {
|
|
83
|
+
if (!new RegExp(String.raw `^\s*${need}\(`, 'm').test(support)) {
|
|
84
|
+
scope.ws.note(ADDED_BY_HAND[need]);
|
|
85
|
+
}
|
|
74
86
|
}
|
|
75
87
|
}
|
|
76
88
|
/** The spans a request leaves, as the spec expects them, laid out for the six spaces the element is written after. */
|