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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { and, eq, isNull, or } from 'drizzle-orm';
|
|
2
|
-
import {
|
|
2
|
+
import { insertIgnoringConflict, optimisticUpdate } from '@ddd-ts-kit/drizzle/postgres';
|
|
3
3
|
import { stampCreation, stampUpdate, type Clock, type ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
4
4
|
{{#if style.declared}}
|
|
5
5
|
import { Repository } from '@ddd-ts-kit/kernel/declarations';
|
|
@@ -50,20 +50,16 @@ export class DrizzleDelegationRepository implements DelegationRepository {
|
|
|
50
50
|
async save(saved: Delegation): Promise<void> {
|
|
51
51
|
await optimisticUpdate(saved, async ({ expected, next }) => {
|
|
52
52
|
const state = { ...DelegationMapper.toRow(saved), version: next };
|
|
53
|
-
const written = expected === 0 ? await this.insert(state) : await this.update(state, expected);
|
|
54
53
|
|
|
55
|
-
return
|
|
54
|
+
return expected === 0 ? this.insert(state) : (await this.update(state, expected)).length;
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
private insert(state: VersionedDelegation) {
|
|
58
|
+
private async insert(state: VersionedDelegation): Promise<number> {
|
|
60
59
|
const row = { ...state, ...stampCreation(this.scope, this.clock) };
|
|
60
|
+
const insertion = () => executorOf(this.database).insert(delegations).values(row);
|
|
61
61
|
|
|
62
|
-
return
|
|
63
|
-
.insert(delegations)
|
|
64
|
-
.values(row)
|
|
65
|
-
.onConflictDoNothing({ target: primaryKeyOf(delegations) })
|
|
66
|
-
.returning({ id: delegations.id });
|
|
62
|
+
return (await insertIgnoringConflict(insertion, delegations)) ? 1 : 0;
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
private update(state: VersionedDelegation, expected: number) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { and, eq } from 'drizzle-orm';
|
|
2
|
-
import {
|
|
2
|
+
import { insertIgnoringConflict, optimisticUpdate } from '@ddd-ts-kit/drizzle/postgres';
|
|
3
3
|
import { stampCreation, stampUpdate, type Clock, type ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
4
4
|
{{#if style.declared}}
|
|
5
5
|
import { Repository } from '@ddd-ts-kit/kernel/declarations';
|
|
@@ -42,20 +42,16 @@ export class DrizzleInvitationRepository implements InvitationRepository {
|
|
|
42
42
|
async save(saved: Invitation): Promise<void> {
|
|
43
43
|
await optimisticUpdate(saved, async ({ expected, next }) => {
|
|
44
44
|
const state = { ...InvitationMapper.toRow(saved), version: next };
|
|
45
|
-
const written = expected === 0 ? await this.insert(state) : await this.update(state, expected);
|
|
46
45
|
|
|
47
|
-
return
|
|
46
|
+
return expected === 0 ? this.insert(state) : (await this.update(state, expected)).length;
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
private insert(state: VersionedInvitation) {
|
|
50
|
+
private async insert(state: VersionedInvitation): Promise<number> {
|
|
52
51
|
const row = { ...state, ...stampCreation(this.scope, this.clock) };
|
|
52
|
+
const insertion = () => executorOf(this.database).insert(invitations).values(row);
|
|
53
53
|
|
|
54
|
-
return
|
|
55
|
-
.insert(invitations)
|
|
56
|
-
.values(row)
|
|
57
|
-
.onConflictDoNothing({ target: primaryKeyOf(invitations) })
|
|
58
|
-
.returning({ id: invitations.id });
|
|
54
|
+
return (await insertIgnoringConflict(insertion, invitations)) ? 1 : 0;
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
private update(state: VersionedInvitation, expected: number) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { and, count, eq, isNull } from 'drizzle-orm';
|
|
2
|
-
import {
|
|
2
|
+
import { insertIgnoringConflict, optimisticUpdate } from '@ddd-ts-kit/drizzle/postgres';
|
|
3
3
|
import { stampCreation, stampUpdate, type Clock, type ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
4
4
|
{{#if style.declared}}
|
|
5
5
|
import { Repository } from '@ddd-ts-kit/kernel/declarations';
|
|
@@ -57,20 +57,16 @@ export class DrizzleMemberRepository implements MemberRepository {
|
|
|
57
57
|
async save(saved: Member): Promise<void> {
|
|
58
58
|
await optimisticUpdate(saved, async ({ expected, next }) => {
|
|
59
59
|
const state = { ...MemberMapper.toRow(saved), version: next };
|
|
60
|
-
const written = expected === 0 ? await this.insert(state) : await this.update(state, expected);
|
|
61
60
|
|
|
62
|
-
return
|
|
61
|
+
return expected === 0 ? this.insert(state) : (await this.update(state, expected)).length;
|
|
63
62
|
});
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
private insert(state: VersionedMember) {
|
|
65
|
+
private async insert(state: VersionedMember): Promise<number> {
|
|
67
66
|
const row = { ...state, ...stampCreation(this.scope, this.clock) };
|
|
67
|
+
const insertion = () => executorOf(this.database).insert(members).values(row);
|
|
68
68
|
|
|
69
|
-
return
|
|
70
|
-
.insert(members)
|
|
71
|
-
.values(row)
|
|
72
|
-
.onConflictDoNothing({ target: primaryKeyOf(members) })
|
|
73
|
-
.returning({ id: members.id });
|
|
69
|
+
return (await insertIgnoringConflict(insertion, members)) ? 1 : 0;
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
private update(state: VersionedMember, expected: number) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { and, eq } from 'drizzle-orm';
|
|
2
|
-
import {
|
|
2
|
+
import { insertIgnoringConflict, optimisticUpdate } from '@ddd-ts-kit/drizzle/postgres';
|
|
3
3
|
import { stampCreation, stampUpdate, type Clock, type ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
4
4
|
{{#if style.declared}}
|
|
5
5
|
import { Repository } from '@ddd-ts-kit/kernel/declarations';
|
|
@@ -36,20 +36,16 @@ export class DrizzleOrganisationRepository implements OrganisationRepository {
|
|
|
36
36
|
async save(saved: Organisation): Promise<void> {
|
|
37
37
|
await optimisticUpdate(saved, async ({ expected, next }) => {
|
|
38
38
|
const state = { ...OrganisationMapper.toRow(saved), version: next };
|
|
39
|
-
const written = expected === 0 ? await this.insert(state) : await this.update(state, expected);
|
|
40
39
|
|
|
41
|
-
return
|
|
40
|
+
return expected === 0 ? this.insert(state) : (await this.update(state, expected)).length;
|
|
42
41
|
});
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
private insert(state: VersionedOrganisation) {
|
|
44
|
+
private async insert(state: VersionedOrganisation): Promise<number> {
|
|
46
45
|
const row = { ...state, ...stampCreation(this.scope, this.clock) };
|
|
46
|
+
const insertion = () => executorOf(this.database).insert(organisations).values(row);
|
|
47
47
|
|
|
48
|
-
return
|
|
49
|
-
.insert(organisations)
|
|
50
|
-
.values(row)
|
|
51
|
-
.onConflictDoNothing({ target: primaryKeyOf(organisations) })
|
|
52
|
-
.returning({ id: organisations.id });
|
|
48
|
+
return (await insertIgnoringConflict(insertion, organisations)) ? 1 : 0;
|
|
53
49
|
}
|
|
54
50
|
|
|
55
51
|
private update(state: VersionedOrganisation, expected: number) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type {{event.typeName}} } from '{{alias.contexts}}/{{publisher.kebab}}/published-language{{alias.index}}';
|
|
2
2
|
|
|
3
|
-
// TODO(domain): receive the port of the read model "{{name.words}}" keeps in the constructor, typed by that port (
|
|
3
|
+
// TODO(domain): receive the port of the read model "{{name.words}}" keeps in the constructor, typed by that port (`ddd-ts-kit generate read-model {{context.kebab}} <Name> --field <name>:<type>` writes it with its table, its store adapter and its fake), and pass the adapter (or its fake) where the module file of the context builds the projection.
|
|
4
4
|
export class {{name.pascal}}Projection {
|
|
5
5
|
async {{event.method}}(event: {{event.typeName}}): Promise<void> {
|
|
6
|
-
// TODO(domain): write what {{event.type}} says into the read model through its port and answer what the store answers, `return this.<port>.upsertIfNewer(<id>, stampOf(event), () => ({ ... }))` with `stampOf` of the kernel
|
|
6
|
+
// TODO(domain): write what {{event.type}} says into the read model through its port and answer what the store answers, `return this.<port>.upsertIfNewer(<id>, stampOf(event), () => ({ ... }))` with `stampOf` of the kernel when the event says the whole line (right in any order of delivery), or `this.<port>.updateIfNewer(<id>, stampOf(event), (line) => ({ ...line, ... }))` when it changes part of a line another event created, which answers `'missing'` when that line is not there. The stamp keeps a replay or a late delivery from undoing a newer line, and the answer is how the application counts what was applied.
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { On, Projection } from '@ddd-ts-kit/kernel/declarations';
|
|
2
2
|
import { {{event.definition}}, type {{event.typeName}} } from '{{alias.contexts}}/{{publisher.kebab}}/published-language{{alias.index}}';
|
|
3
3
|
|
|
4
|
-
// TODO(domain): receive the port of the read model "{{name.words}}" keeps in the constructor, typed by that port (
|
|
4
|
+
// TODO(domain): receive the port of the read model "{{name.words}}" keeps in the constructor, typed by that port (`ddd-ts-kit generate read-model {{context.kebab}} <Name> --field <name>:<type>` writes it with its table, its store adapter and its fake); its adapter and its fake are bound to it like any other port.
|
|
5
5
|
@Projection('{{context.kebab}}.{{name.kebab}}')
|
|
6
6
|
export class {{name.pascal}}Projection {
|
|
7
7
|
@On({{event.definition}})
|
|
8
8
|
async {{event.method}}(event: {{event.typeName}}): Promise<void> {
|
|
9
|
-
// TODO(domain): write what {{event.type}} says into the read model through its port and answer what the store answers, `return this.<port>.upsertIfNewer(<id>, stampOf(event), () => ({ ... }))` with `stampOf` of the kernel
|
|
9
|
+
// TODO(domain): write what {{event.type}} says into the read model through its port and answer what the store answers, `return this.<port>.upsertIfNewer(<id>, stampOf(event), () => ({ ... }))` with `stampOf` of the kernel when the event says the whole line (right in any order of delivery), or `this.<port>.updateIfNewer(<id>, stampOf(event), (line) => ({ ...line, ... }))` when it changes part of a line another event created, which answers `'missing'` when that line is not there. The stamp keeps a replay or a late delivery from undoing a newer line, and the answer is how the application counts what was applied.
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{{#if adapter.needsDatabase}}
|
|
2
|
+
{{#if tenant.scoped}}
|
|
3
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '{{tests.module}}';
|
|
4
|
+
import { FixedExecutionScope, executionContext, type Actor, type ExecutionContext } from '@ddd-ts-kit/kernel';
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#unless tenant.scoped}}
|
|
7
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '{{tests.module}}';
|
|
8
|
+
{{/unless}}
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{#unless adapter.needsDatabase}}
|
|
11
|
+
import { afterEach, beforeEach, describe, expect, it } from '{{tests.module}}';
|
|
12
|
+
{{/unless}}
|
|
13
|
+
import { readModelContract } from '@ddd-ts-kit/testing/contracts';
|
|
14
|
+
import type { {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
15
|
+
import { {{adapter.pascal}} } from '{{alias.context}}/infrastructure/persistence/{{adapter.kebab}}{{alias.ext}}';
|
|
16
|
+
{{#if adapter.needsDatabase}}
|
|
17
|
+
import { openTestDatabase, type TestDatabase } from '{{alias.platform}}/database/open-test-database{{alias.ext}}';
|
|
18
|
+
{{/if}}
|
|
19
|
+
import { Fake{{name.pascal}} } from '{{alias.context}}/test/fakes/{{name.kebab}}.fake{{alias.ext}}';
|
|
20
|
+
|
|
21
|
+
const runner = { describe, it, expect, beforeEach, afterEach };
|
|
22
|
+
|
|
23
|
+
const expectations = {
|
|
24
|
+
createRow: (key: string): {{name.pascal}}Row => ({
|
|
25
|
+
id: key,
|
|
26
|
+
{{#if fields.any}}
|
|
27
|
+
{{fields.sample}}
|
|
28
|
+
{{/if}}
|
|
29
|
+
}),
|
|
30
|
+
// TODO(domain): add `change: (row: {{name.pascal}}Row) => ({ ...row, <a field>: <another value> })`, so that the suite proves a later event replaces what the row holds; the case stays pending until then.
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
readModelContract<{{name.pascal}}Row>(runner, {
|
|
34
|
+
...expectations,
|
|
35
|
+
name: 'Fake{{name.pascal}}',
|
|
36
|
+
createStore: () => new Fake{{name.pascal}}(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
{{#if adapter.needsDatabase}}
|
|
40
|
+
let database: TestDatabase;
|
|
41
|
+
|
|
42
|
+
beforeAll(async () => {
|
|
43
|
+
database = await openTestDatabase();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
afterAll(async () => {
|
|
47
|
+
await database.close();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
readModelContract<{{name.pascal}}Row>(runner, {
|
|
51
|
+
...expectations,
|
|
52
|
+
name: '{{adapter.pascal}}',
|
|
53
|
+
createStore: async () => {
|
|
54
|
+
await database.reset();
|
|
55
|
+
|
|
56
|
+
{{#if tenant.scoped}}
|
|
57
|
+
return new {{adapter.pascal}}(database.persistence.database, new FixedExecutionScope(workOf('acme')));
|
|
58
|
+
{{/if}}
|
|
59
|
+
{{#unless tenant.scoped}}
|
|
60
|
+
return new {{adapter.pascal}}(database.persistence.database);
|
|
61
|
+
{{/unless}}
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
{{#if tenant.scoped}}
|
|
65
|
+
|
|
66
|
+
describe('{{adapter.pascal}}, tenant by tenant', () => {
|
|
67
|
+
it('hides from a tenant what another tenant wrote', async () => {
|
|
68
|
+
await database.reset();
|
|
69
|
+
|
|
70
|
+
const scope = new FixedExecutionScope(workOf('acme'));
|
|
71
|
+
const store = new {{adapter.pascal}}(database.persistence.database, scope);
|
|
72
|
+
const stamp = { eventId: 'event-1', occurredAt: new Date('2026-01-01T00:00:00.000Z') };
|
|
73
|
+
|
|
74
|
+
await store.upsertIfNewer('row-1', stamp, () => expectations.createRow('row-1'));
|
|
75
|
+
|
|
76
|
+
scope.enter(workOf('globex'));
|
|
77
|
+
|
|
78
|
+
expect(await store.get('row-1')).toBeUndefined();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
function workOf(tenantId: string): ExecutionContext {
|
|
83
|
+
const actor: Actor = { id: 'member-of-' + tenantId, type: 'user', tenantId, roles: [], attributes: {} };
|
|
84
|
+
|
|
85
|
+
return executionContext({ correlationId: 'contract-spec', actor, origin: 'test' });
|
|
86
|
+
}
|
|
87
|
+
{{/if}}
|
|
88
|
+
{{/if}}
|
|
89
|
+
{{#unless adapter.needsDatabase}}
|
|
90
|
+
readModelContract<{{name.pascal}}Row>(runner, {
|
|
91
|
+
...expectations,
|
|
92
|
+
name: '{{adapter.pascal}}',
|
|
93
|
+
createStore: () => new {{adapter.pascal}}(),
|
|
94
|
+
});
|
|
95
|
+
{{/unless}}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PgQueryResultHKT } from 'drizzle-orm/pg-core';
|
|
2
|
+
import { DrizzleReadModelStore } from '@ddd-ts-kit/drizzle/postgres';
|
|
3
|
+
{{#if tenant.scoped}}
|
|
4
|
+
import type { ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#if style.declared}}
|
|
7
|
+
import { Repository } from '@ddd-ts-kit/kernel/declarations';
|
|
8
|
+
import { {{name.pascal}}, {{name.camel}}Criteria, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{#unless style.declared}}
|
|
11
|
+
import { {{name.camel}}Criteria, type {{name.pascal}}, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
12
|
+
{{/unless}}
|
|
13
|
+
{{storage.adapterImport}}
|
|
14
|
+
import { {{name.camel}} } from '{{alias.context}}/infrastructure/persistence/{{context.kebab}}.schema{{alias.ext}}';
|
|
15
|
+
|
|
16
|
+
{{#if style.declared}}
|
|
17
|
+
@Repository({{name.pascal}})
|
|
18
|
+
{{/if}}
|
|
19
|
+
export class {{adapter.pascal}} extends DrizzleReadModelStore<{{name.pascal}}Row, PgQueryResultHKT> implements {{name.pascal}} {
|
|
20
|
+
{{#if tenant.scoped}}
|
|
21
|
+
constructor(database: Database, scope: ExecutionScope) {
|
|
22
|
+
{{/if}}
|
|
23
|
+
{{#unless tenant.scoped}}
|
|
24
|
+
constructor(database: Database) {
|
|
25
|
+
{{/unless}}
|
|
26
|
+
super(database, {
|
|
27
|
+
table: {{name.camel}},
|
|
28
|
+
key: {{name.camel}}.id,
|
|
29
|
+
columns: {
|
|
30
|
+
id: {{name.camel}}.id,
|
|
31
|
+
{{#if fields.any}}
|
|
32
|
+
{{fields.drizzleColumns}}
|
|
33
|
+
{{/if}}
|
|
34
|
+
},
|
|
35
|
+
{{#if tenant.scoped}}
|
|
36
|
+
tenant: { scope, column: {{name.camel}}.tenantId },
|
|
37
|
+
{{/if}}
|
|
38
|
+
definition: {{name.camel}}Criteria,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@@imports
|
|
2
|
+
{{#if fields.checked}}
|
|
3
|
+
import { sql } from 'drizzle-orm';
|
|
4
|
+
{{/if}}
|
|
5
|
+
{{#if tenant.scoped}}
|
|
6
|
+
import { index, {{fields.drizzleImports}} } from 'drizzle-orm/pg-core';
|
|
7
|
+
import { readModelColumns, tenantColumn } from '@ddd-ts-kit/drizzle/postgres';
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{#unless tenant.scoped}}
|
|
10
|
+
import { {{fields.drizzleImports}} } from 'drizzle-orm/pg-core';
|
|
11
|
+
import { readModelColumns } from '@ddd-ts-kit/drizzle/postgres';
|
|
12
|
+
{{/unless}}
|
|
13
|
+
@@tables
|
|
14
|
+
{{#if fields.drizzleWide}}
|
|
15
|
+
export const {{name.camel}} = {{context.camel}}Schema.table(
|
|
16
|
+
'{{table}}',
|
|
17
|
+
{
|
|
18
|
+
id: text('id').primaryKey(),
|
|
19
|
+
{{#if fields.any}}
|
|
20
|
+
{{fields.drizzleTable}}
|
|
21
|
+
{{/if}}
|
|
22
|
+
{{#if tenant.scoped}}
|
|
23
|
+
...tenantColumn(),
|
|
24
|
+
{{/if}}
|
|
25
|
+
...readModelColumns(),
|
|
26
|
+
},
|
|
27
|
+
{{fields.drizzleExtras}}
|
|
28
|
+
);
|
|
29
|
+
{{/if}}
|
|
30
|
+
{{#unless fields.drizzleWide}}
|
|
31
|
+
export const {{name.camel}} = {{context.camel}}Schema.table('{{table}}', {
|
|
32
|
+
id: text('id').primaryKey(),
|
|
33
|
+
{{#if fields.any}}
|
|
34
|
+
{{fields.drizzleTable}}
|
|
35
|
+
{{/if}}
|
|
36
|
+
...readModelColumns(),
|
|
37
|
+
});
|
|
38
|
+
{{/unless}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InMemoryReadModelStore } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{name.camel}}Criteria, type {{name.pascal}}, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class Fake{{name.pascal}} extends InMemoryReadModelStore<{{name.pascal}}Row> implements {{name.pascal}} {
|
|
5
|
+
constructor() {
|
|
6
|
+
super({{name.camel}}Criteria);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{{#if tenant.scoped}}
|
|
2
|
+
import type { ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
3
|
+
{{/if}}
|
|
4
|
+
{{#if style.declared}}
|
|
5
|
+
import { Repository } from '@ddd-ts-kit/kernel/declarations';
|
|
6
|
+
{{/if}}
|
|
7
|
+
import { type KnexContext, KnexReadModelStore } from '@ddd-ts-kit/knex';
|
|
8
|
+
{{#if style.declared}}
|
|
9
|
+
import { {{name.pascal}}, {{name.camel}}Criteria, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{#unless style.declared}}
|
|
12
|
+
import { {{name.camel}}Criteria, type {{name.pascal}}, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
13
|
+
{{/unless}}
|
|
14
|
+
import { {{context.constant}}_SCHEMA } from '{{alias.context}}/infrastructure/persistence/{{context.kebab}}.schema{{alias.ext}}';
|
|
15
|
+
|
|
16
|
+
{{#if style.declared}}
|
|
17
|
+
@Repository({{name.pascal}})
|
|
18
|
+
{{/if}}
|
|
19
|
+
export class {{adapter.pascal}} extends KnexReadModelStore<{{name.pascal}}Row> implements {{name.pascal}} {
|
|
20
|
+
{{#if tenant.scoped}}
|
|
21
|
+
constructor(database: KnexContext, scope: ExecutionScope) {
|
|
22
|
+
{{/if}}
|
|
23
|
+
{{#unless tenant.scoped}}
|
|
24
|
+
constructor(database: KnexContext) {
|
|
25
|
+
{{/unless}}
|
|
26
|
+
super(database, {
|
|
27
|
+
{{#if tenant.scoped}}
|
|
28
|
+
tenant: scope,
|
|
29
|
+
{{/if}}
|
|
30
|
+
schema: {{context.constant}}_SCHEMA,
|
|
31
|
+
table: '{{table}}',
|
|
32
|
+
columns: {
|
|
33
|
+
id: 'id',
|
|
34
|
+
{{#if fields.any}}
|
|
35
|
+
{{fields.names}}
|
|
36
|
+
{{/if}}
|
|
37
|
+
},
|
|
38
|
+
definition: {{name.camel}}Criteria,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@@imports
|
|
2
|
+
{{#if tenant.scoped}}
|
|
3
|
+
import { readModelColumns, tenantColumn } from '@ddd-ts-kit/knex';
|
|
4
|
+
{{/if}}
|
|
5
|
+
{{#unless tenant.scoped}}
|
|
6
|
+
import { readModelColumns } from '@ddd-ts-kit/knex';
|
|
7
|
+
{{/unless}}
|
|
8
|
+
@@tables
|
|
9
|
+
await create{{name.pascal}}Table(knex);
|
|
10
|
+
@@definitions
|
|
11
|
+
function create{{name.pascal}}Table(knex: Knex): Promise<void> {
|
|
12
|
+
return knex.schema.withSchema({{context.constant}}_SCHEMA).createTable('{{table}}', (table) => {
|
|
13
|
+
table.text('id').primary();
|
|
14
|
+
{{#if fields.any}}
|
|
15
|
+
{{fields.knexTable}}
|
|
16
|
+
{{/if}}
|
|
17
|
+
{{#if tenant.scoped}}
|
|
18
|
+
tenantColumn(table);
|
|
19
|
+
table.index(['tenant_id', 'id'], '{{table}}_tenant_idx');
|
|
20
|
+
{{/if}}
|
|
21
|
+
readModelColumns(table);
|
|
22
|
+
{{#if fields.checked}}
|
|
23
|
+
{{fields.knexCheck}}
|
|
24
|
+
{{/if}}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InMemoryReadModelStore } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
3
|
+
import { Repository } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
import { {{name.pascal}}, {{name.camel}}Criteria, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#unless style.declared}}
|
|
7
|
+
import { {{name.camel}}Criteria, type {{name.pascal}}, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
8
|
+
{{/unless}}
|
|
9
|
+
|
|
10
|
+
{{#if style.declared}}
|
|
11
|
+
@Repository({{name.pascal}})
|
|
12
|
+
{{/if}}
|
|
13
|
+
export class {{adapter.pascal}} extends InMemoryReadModelStore<{{name.pascal}}Row> implements {{name.pascal}} {
|
|
14
|
+
constructor() {
|
|
15
|
+
super({{name.camel}}Criteria);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReadModelStore, defineCriteria } from '@ddd-ts-kit/kernel';
|
|
2
|
+
|
|
3
|
+
export type {{name.pascal}}Row = {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
{{#if fields.any}}
|
|
6
|
+
{{fields.row}}
|
|
7
|
+
{{/if}}
|
|
8
|
+
{{#unless fields.any}}
|
|
9
|
+
// TODO(domain): add one field per thing a read of "{{name.words}}" shows or filters by, with its line in the criteria below, its column in the table and its entry in the columns of the store adapter (`--field <name>:<type>` writes the four).
|
|
10
|
+
{{/unless}}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const {{name.camel}}Criteria = defineCriteria<{{name.pascal}}Row>({
|
|
14
|
+
fields: {
|
|
15
|
+
// TODO(domain): open to the readers only what a screen needs: `filter: ['eq']` on a field it filters by, `sortable: true` on a field it sorts by, then a `defaultSort`.
|
|
16
|
+
id: { type: 'string' },
|
|
17
|
+
{{#if fields.any}}
|
|
18
|
+
{{fields.criteria}}
|
|
19
|
+
{{/if}}
|
|
20
|
+
},
|
|
21
|
+
tieBreaker: 'id',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export abstract class {{name.pascal}} extends ReadModelStore<{{name.pascal}}Row> {}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@@models
|
|
2
|
+
model {{context.pascal}}{{name.pascal}} {
|
|
3
|
+
id String @id
|
|
4
|
+
{{#if fields.any}}
|
|
5
|
+
{{fields.prismaModel}}
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#if fields.checked}}
|
|
8
|
+
// TODO(domain): the schema language has no check constraint. Add to the migration that creates this table, after its CREATE TABLE, what keeps the rows that are not removed whole: {{fields.prismaCheck}}
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{#if tenant.scoped}}
|
|
11
|
+
tenantId String @map("tenant_id")
|
|
12
|
+
{{/if}}
|
|
13
|
+
/// The event that last changed the row: an older one changes nothing.
|
|
14
|
+
lastEventId String @map("last_event_id")
|
|
15
|
+
lastEventAt DateTime @map("last_event_at") @db.Timestamptz(3)
|
|
16
|
+
lastEventVersion BigInt? @map("last_event_version")
|
|
17
|
+
/// The trace of a removed row, so that a late event does not bring it back.
|
|
18
|
+
deleted Boolean @default(false)
|
|
19
|
+
|
|
20
|
+
{{#if tenant.scoped}}
|
|
21
|
+
@@index([tenantId, id], map: "{{table}}_tenant_idx")
|
|
22
|
+
{{/if}}
|
|
23
|
+
@@map("{{table}}")
|
|
24
|
+
@@schema("{{context.schema}}")
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{{#if tenant.scoped}}
|
|
2
|
+
import type { ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
3
|
+
{{/if}}
|
|
4
|
+
{{#if style.declared}}
|
|
5
|
+
import { Repository } from '@ddd-ts-kit/kernel/declarations';
|
|
6
|
+
{{/if}}
|
|
7
|
+
import { PrismaReadModelStore } from '@ddd-ts-kit/prisma';
|
|
8
|
+
{{#if style.declared}}
|
|
9
|
+
import { {{name.pascal}}, {{name.camel}}Criteria, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{#unless style.declared}}
|
|
12
|
+
import { {{name.camel}}Criteria, type {{name.pascal}}, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
13
|
+
{{/unless}}
|
|
14
|
+
{{storage.adapterImport}}
|
|
15
|
+
import type { Prisma } from '{{alias.generated}}/prisma/client{{alias.ext}}';
|
|
16
|
+
|
|
17
|
+
{{#if style.declared}}
|
|
18
|
+
@Repository({{name.pascal}})
|
|
19
|
+
{{/if}}
|
|
20
|
+
export class {{adapter.pascal}} extends PrismaReadModelStore<{{name.pascal}}Row, Prisma.TransactionClient> implements {{name.pascal}} {
|
|
21
|
+
{{#if tenant.scoped}}
|
|
22
|
+
constructor(database: Database, scope: ExecutionScope) {
|
|
23
|
+
{{/if}}
|
|
24
|
+
{{#unless tenant.scoped}}
|
|
25
|
+
constructor(database: Database) {
|
|
26
|
+
{{/unless}}
|
|
27
|
+
super(database, {
|
|
28
|
+
delegate: (client) => client.{{context.camel}}{{name.pascal}},
|
|
29
|
+
schema: '{{context.schema}}',
|
|
30
|
+
table: '{{table}}',
|
|
31
|
+
columns: {
|
|
32
|
+
id: 'id',
|
|
33
|
+
{{#if fields.any}}
|
|
34
|
+
{{fields.names}}
|
|
35
|
+
{{/if}}
|
|
36
|
+
},
|
|
37
|
+
{{#if tenant.scoped}}
|
|
38
|
+
tenant: { scope },
|
|
39
|
+
{{/if}}
|
|
40
|
+
definition: {{name.camel}}Criteria,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// ddd-ts-kit:imports
|
|
2
|
+
import { EntitySchema } from 'typeorm';
|
|
3
|
+
import { schemaNameOf } from '@ddd-ts-kit/typeorm';
|
|
4
|
+
// /ddd-ts-kit:imports
|
|
5
|
+
|
|
6
|
+
const {{context.constant}}_SCHEMA = schemaNameOf('{{context.kebab}}');
|
|
7
|
+
|
|
8
|
+
// ddd-ts-kit:tables
|
|
9
|
+
// /ddd-ts-kit:tables
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{{#if tenant.scoped}}
|
|
2
|
+
import type { ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
3
|
+
{{/if}}
|
|
4
|
+
{{#if style.declared}}
|
|
5
|
+
import { Repository } from '@ddd-ts-kit/kernel/declarations';
|
|
6
|
+
{{/if}}
|
|
7
|
+
import { type TypeOrmContext, TypeOrmReadModelStore } from '@ddd-ts-kit/typeorm';
|
|
8
|
+
{{#if style.declared}}
|
|
9
|
+
import { {{name.pascal}}, {{name.camel}}Criteria, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{#unless style.declared}}
|
|
12
|
+
import { {{name.camel}}Criteria, type {{name.pascal}}, type {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
13
|
+
{{/unless}}
|
|
14
|
+
import { {{name.camel}} } from '{{alias.context}}/infrastructure/persistence/{{context.kebab}}.schema{{alias.ext}}';
|
|
15
|
+
|
|
16
|
+
{{#if style.declared}}
|
|
17
|
+
@Repository({{name.pascal}})
|
|
18
|
+
{{/if}}
|
|
19
|
+
export class {{adapter.pascal}} extends TypeOrmReadModelStore<{{name.pascal}}Row> implements {{name.pascal}} {
|
|
20
|
+
{{#if tenant.scoped}}
|
|
21
|
+
constructor(database: TypeOrmContext, scope: ExecutionScope) {
|
|
22
|
+
super(database, { entity: {{name.camel}}, tenant: { scope }, definition: {{name.camel}}Criteria });
|
|
23
|
+
}
|
|
24
|
+
{{/if}}
|
|
25
|
+
{{#unless tenant.scoped}}
|
|
26
|
+
constructor(database: TypeOrmContext) {
|
|
27
|
+
super(database, { entity: {{name.camel}}, definition: {{name.camel}}Criteria });
|
|
28
|
+
}
|
|
29
|
+
{{/unless}}
|
|
30
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@@imports
|
|
2
|
+
{{#if tenant.scoped}}
|
|
3
|
+
import type { TenantScoped } from '@ddd-ts-kit/kernel';
|
|
4
|
+
import { readModelColumns, tenantColumn, type ReadModelStamps } from '@ddd-ts-kit/typeorm';
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#unless tenant.scoped}}
|
|
7
|
+
import { readModelColumns, type ReadModelStamps } from '@ddd-ts-kit/typeorm';
|
|
8
|
+
{{/unless}}
|
|
9
|
+
import type { {{name.pascal}}Row } from '{{alias.context}}/application/ports/{{name.kebab}}.port{{alias.ext}}';
|
|
10
|
+
@@tables
|
|
11
|
+
{{#if tenant.scoped}}
|
|
12
|
+
export const {{name.camel}} = new EntitySchema<{{name.pascal}}Row & TenantScoped & ReadModelStamps>({
|
|
13
|
+
name: '{{context.pascal}}{{name.pascal}}',
|
|
14
|
+
tableName: '{{table}}',
|
|
15
|
+
schema: {{context.constant}}_SCHEMA,
|
|
16
|
+
columns: {
|
|
17
|
+
id: { type: 'text', primary: true },
|
|
18
|
+
{{#if fields.any}}
|
|
19
|
+
{{fields.typeormTable}}
|
|
20
|
+
{{/if}}
|
|
21
|
+
tenantId: { ...tenantColumn().tenantId, select: false },
|
|
22
|
+
...readModelColumns(),
|
|
23
|
+
},
|
|
24
|
+
indices: [{ name: '{{table}}_tenant_idx', columns: ['tenantId', 'id'] }],
|
|
25
|
+
{{#if fields.checked}}
|
|
26
|
+
checks: [
|
|
27
|
+
{
|
|
28
|
+
{{fields.typeormCheck}}
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
{{/if}}
|
|
32
|
+
});
|
|
33
|
+
{{/if}}
|
|
34
|
+
{{#unless tenant.scoped}}
|
|
35
|
+
export const {{name.camel}} = new EntitySchema<{{name.pascal}}Row & ReadModelStamps>({
|
|
36
|
+
name: '{{context.pascal}}{{name.pascal}}',
|
|
37
|
+
tableName: '{{table}}',
|
|
38
|
+
schema: {{context.constant}}_SCHEMA,
|
|
39
|
+
columns: {
|
|
40
|
+
id: { type: 'text', primary: true },
|
|
41
|
+
{{#if fields.any}}
|
|
42
|
+
{{fields.typeormTable}}
|
|
43
|
+
{{/if}}
|
|
44
|
+
...readModelColumns(),
|
|
45
|
+
},
|
|
46
|
+
{{#if fields.checked}}
|
|
47
|
+
checks: [
|
|
48
|
+
{
|
|
49
|
+
{{fields.typeormCheck}}
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
{{/if}}
|
|
53
|
+
});
|
|
54
|
+
{{/unless}}
|