ddd-ts-kit 0.4.1 → 0.6.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/README.md +41 -10
- package/dist/check/alias/build-scripts.d.ts.map +1 -1
- package/dist/check/alias/build-scripts.js +3 -1
- package/dist/check/alias/build-scripts.js.map +1 -1
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +2 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/configuration/config-inspection.d.ts +6 -0
- package/dist/check/configuration/config-inspection.d.ts.map +1 -1
- package/dist/check/configuration/config-inspection.js +14 -1
- package/dist/check/configuration/config-inspection.js.map +1 -1
- package/dist/check/explain/persistence-docs.d.ts +3 -0
- package/dist/check/explain/persistence-docs.d.ts.map +1 -0
- package/dist/check/explain/persistence-docs.js +14 -0
- package/dist/check/explain/persistence-docs.js.map +1 -0
- package/dist/check/explain/rule-docs.d.ts.map +1 -1
- package/dist/check/explain/rule-docs.js +2 -0
- package/dist/check/explain/rule-docs.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/persistence-fixtures.d.ts +3 -0
- package/dist/check/fixtures/persistence-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/persistence-fixtures.js +72 -0
- package/dist/check/fixtures/persistence-fixtures.js.map +1 -0
- package/dist/check/migrations/drizzle-history-findings.d.ts +9 -0
- package/dist/check/migrations/drizzle-history-findings.d.ts.map +1 -0
- package/dist/check/migrations/drizzle-history-findings.js +70 -0
- package/dist/check/migrations/drizzle-history-findings.js.map +1 -0
- package/dist/check/migrations/drizzle-migrations.d.ts +23 -0
- package/dist/check/migrations/drizzle-migrations.d.ts.map +1 -0
- package/dist/check/migrations/drizzle-migrations.js +2 -0
- package/dist/check/migrations/drizzle-migrations.js.map +1 -0
- package/dist/check/migrations/drizzle-out-folder.d.ts +3 -0
- package/dist/check/migrations/drizzle-out-folder.d.ts.map +1 -0
- package/dist/check/migrations/drizzle-out-folder.js +18 -0
- package/dist/check/migrations/drizzle-out-folder.js.map +1 -0
- package/dist/check/migrations/migration-folder.d.ts +13 -0
- package/dist/check/migrations/migration-folder.d.ts.map +1 -0
- package/dist/check/migrations/migration-folder.js +2 -0
- package/dist/check/migrations/migration-folder.js.map +1 -0
- package/dist/check/migrations/migration-name-findings.d.ts +9 -0
- package/dist/check/migrations/migration-name-findings.d.ts.map +1 -0
- package/dist/check/migrations/migration-name-findings.js +32 -0
- package/dist/check/migrations/migration-name-findings.js.map +1 -0
- package/dist/check/migrations/read-drizzle-migrations.d.ts +4 -0
- package/dist/check/migrations/read-drizzle-migrations.d.ts.map +1 -0
- package/dist/check/migrations/read-drizzle-migrations.js +67 -0
- package/dist/check/migrations/read-drizzle-migrations.js.map +1 -0
- package/dist/check/migrations/read-migration-folder.d.ts +5 -0
- package/dist/check/migrations/read-migration-folder.d.ts.map +1 -0
- package/dist/check/migrations/read-migration-folder.js +38 -0
- package/dist/check/migrations/read-migration-folder.js.map +1 -0
- package/dist/check/rules/config-valid.d.ts.map +1 -1
- package/dist/check/rules/config-valid.js +4 -1
- package/dist/check/rules/config-valid.js.map +1 -1
- package/dist/check/rules/persistence-migration-history.d.ts +3 -0
- package/dist/check/rules/persistence-migration-history.d.ts.map +1 -0
- package/dist/check/rules/persistence-migration-history.js +24 -0
- package/dist/check/rules/persistence-migration-history.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +12 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/sdk.d.ts +8 -0
- package/dist/commands/sdk.d.ts.map +1 -0
- package/dist/commands/sdk.js +82 -0
- package/dist/commands/sdk.js.map +1 -0
- package/dist/commit/is-derived.d.ts.map +1 -1
- package/dist/commit/is-derived.js +5 -7
- package/dist/commit/is-derived.js.map +1 -1
- package/dist/config/ci-extra-problems.d.ts +4 -0
- package/dist/config/ci-extra-problems.d.ts.map +1 -0
- package/dist/config/ci-extra-problems.js +27 -0
- package/dist/config/ci-extra-problems.js.map +1 -0
- package/dist/config/ci-extras.d.ts +13 -0
- package/dist/config/ci-extras.d.ts.map +1 -0
- package/dist/config/ci-extras.js +13 -0
- package/dist/config/ci-extras.js.map +1 -0
- package/dist/config/config.d.ts +32 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/default-sdk-name.d.ts +3 -0
- package/dist/config/default-sdk-name.d.ts.map +1 -0
- package/dist/config/default-sdk-name.js +3 -0
- package/dist/config/default-sdk-name.js.map +1 -0
- package/dist/config/index.d.ts +6 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +5 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/open-api-problems.d.ts +4 -0
- package/dist/config/open-api-problems.d.ts.map +1 -0
- package/dist/config/open-api-problems.js +87 -0
- package/dist/config/open-api-problems.js.map +1 -0
- package/dist/config/openapi-formats.d.ts +3 -0
- package/dist/config/openapi-formats.d.ts.map +1 -0
- package/dist/config/openapi-formats.js +3 -0
- package/dist/config/openapi-formats.js.map +1 -0
- package/dist/config/parse-ci.d.ts +4 -0
- package/dist/config/parse-ci.d.ts.map +1 -0
- package/dist/config/parse-ci.js +7 -0
- package/dist/config/parse-ci.js.map +1 -0
- package/dist/config/parse-config.d.ts.map +1 -1
- package/dist/config/parse-config.js +6 -0
- package/dist/config/parse-config.js.map +1 -1
- package/dist/config/parse-open-api.d.ts +4 -0
- package/dist/config/parse-open-api.d.ts.map +1 -0
- package/dist/config/parse-open-api.js +20 -0
- package/dist/config/parse-open-api.js.map +1 -0
- package/dist/config/parse-sdk.d.ts +4 -0
- package/dist/config/parse-sdk.d.ts.map +1 -0
- package/dist/config/parse-sdk.js +12 -0
- package/dist/config/parse-sdk.js.map +1 -0
- package/dist/config/restack-config-text.d.ts +1 -1
- package/dist/config/restack-config-text.d.ts.map +1 -1
- package/dist/config/restack-config-text.js +12 -2
- package/dist/config/restack-config-text.js.map +1 -1
- package/dist/config/sdk-accesses.d.ts +3 -0
- package/dist/config/sdk-accesses.d.ts.map +1 -0
- package/dist/config/sdk-accesses.js +3 -0
- package/dist/config/sdk-accesses.js.map +1 -0
- package/dist/config/sdk-problems.d.ts +4 -0
- package/dist/config/sdk-problems.d.ts.map +1 -0
- package/dist/config/sdk-problems.js +55 -0
- package/dist/config/sdk-problems.js.map +1 -0
- package/dist/config/serialize-config.js +11 -0
- package/dist/config/serialize-config.js.map +1 -1
- package/dist/contracts/contract-format.d.ts +3 -0
- package/dist/contracts/contract-format.d.ts.map +1 -0
- package/dist/contracts/contract-format.js +11 -0
- package/dist/contracts/contract-format.js.map +1 -0
- package/dist/contracts/stringify-contract.d.ts +3 -0
- package/dist/contracts/stringify-contract.d.ts.map +1 -0
- package/dist/contracts/stringify-contract.js +6 -0
- package/dist/contracts/stringify-contract.js.map +1 -0
- package/dist/contracts.d.ts +9 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +9 -0
- package/dist/contracts.js.map +1 -0
- package/dist/describe/describe-context.d.ts.map +1 -1
- package/dist/describe/describe-context.js +14 -3
- package/dist/describe/describe-context.js.map +1 -1
- package/dist/docs/open-api-documents-file.d.ts +4 -0
- package/dist/docs/open-api-documents-file.d.ts.map +1 -0
- package/dist/docs/open-api-documents-file.js +5 -0
- package/dist/docs/open-api-documents-file.js.map +1 -0
- package/dist/docs/render-open-api-documents.d.ts +13 -0
- package/dist/docs/render-open-api-documents.d.ts.map +1 -0
- package/dist/docs/render-open-api-documents.js +42 -0
- package/dist/docs/render-open-api-documents.js.map +1 -0
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +2 -0
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/docs/write-open-api-documents.d.ts +9 -0
- package/dist/docs/write-open-api-documents.d.ts.map +1 -0
- package/dist/docs/write-open-api-documents.js +33 -0
- package/dist/docs/write-open-api-documents.js.map +1 -0
- package/dist/generate/kinds/declare-context-entries.d.ts.map +1 -1
- package/dist/generate/kinds/declare-context-entries.js +3 -1
- package/dist/generate/kinds/declare-context-entries.js.map +1 -1
- package/dist/generate/kinds/extraction/entry-point.d.ts.map +1 -1
- package/dist/generate/kinds/extraction/entry-point.js +3 -1
- package/dist/generate/kinds/extraction/entry-point.js.map +1 -1
- package/dist/generate/kinds/knip-project.d.ts +7 -0
- package/dist/generate/kinds/knip-project.d.ts.map +1 -0
- package/dist/generate/kinds/knip-project.js +12 -0
- package/dist/generate/kinds/knip-project.js.map +1 -0
- package/dist/help/commands-guide-region.d.ts +3 -0
- package/dist/help/commands-guide-region.d.ts.map +1 -0
- package/dist/help/commands-guide-region.js +12 -0
- package/dist/help/commands-guide-region.js.map +1 -0
- package/dist/help/notes.d.ts +3 -0
- package/dist/help/notes.d.ts.map +1 -0
- package/dist/help/notes.js +30 -0
- package/dist/help/notes.js.map +1 -0
- package/dist/help/reference-text.d.ts +3 -0
- package/dist/help/reference-text.d.ts.map +1 -0
- package/dist/help/reference-text.js +14 -0
- package/dist/help/reference-text.js.map +1 -0
- package/dist/help/usage.d.ts +3 -0
- package/dist/help/usage.d.ts.map +1 -0
- package/dist/help/usage.js +38 -0
- package/dist/help/usage.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/init/files/persistence-files.js +1 -1
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/files/pipeline-files.d.ts.map +1 -1
- package/dist/init/files/pipeline-files.js +4 -2
- package/dist/init/files/pipeline-files.js.map +1 -1
- package/dist/init/manifest/database-scripts.d.ts.map +1 -1
- package/dist/init/manifest/database-scripts.js +5 -4
- package/dist/init/manifest/database-scripts.js.map +1 -1
- package/dist/init/manifest/versions.js +23 -23
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +5 -0
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-ci-extras.d.ts +8 -0
- package/dist/init/stack/resolve-ci-extras.d.ts.map +1 -0
- package/dist/init/stack/resolve-ci-extras.js +31 -0
- package/dist/init/stack/resolve-ci-extras.js.map +1 -0
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +15 -3
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +4 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/init/template-vars.d.ts.map +1 -1
- package/dist/init/template-vars.js +16 -0
- package/dist/init/template-vars.js.map +1 -1
- package/dist/init/write-agent-settings.js +2 -2
- package/dist/init/write-agent-settings.js.map +1 -1
- package/dist/init/write-contracts.d.ts.map +1 -1
- package/dist/init/write-contracts.js +7 -3
- package/dist/init/write-contracts.js.map +1 -1
- package/dist/progress/format-progress.d.ts.map +1 -1
- package/dist/progress/format-progress.js +3 -1
- package/dist/progress/format-progress.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +4 -63
- package/dist/run.js.map +1 -1
- package/dist/sdk/agent-instruction.d.ts +3 -0
- package/dist/sdk/agent-instruction.d.ts.map +1 -0
- package/dist/sdk/agent-instruction.js +3 -0
- package/dist/sdk/agent-instruction.js.map +1 -0
- package/dist/sdk/client-document.d.ts +16 -0
- package/dist/sdk/client-document.d.ts.map +1 -0
- package/dist/sdk/client-document.js +2 -0
- package/dist/sdk/client-document.js.map +1 -0
- package/dist/sdk/client-files.d.ts +7 -0
- package/dist/sdk/client-files.d.ts.map +1 -0
- package/dist/sdk/client-files.js +25 -0
- package/dist/sdk/client-files.js.map +1 -0
- package/dist/sdk/client-manifest.d.ts +14 -0
- package/dist/sdk/client-manifest.d.ts.map +1 -0
- package/dist/sdk/client-manifest.js +45 -0
- package/dist/sdk/client-manifest.js.map +1 -0
- package/dist/sdk/client-names.d.ts +7 -0
- package/dist/sdk/client-names.d.ts.map +1 -0
- package/dist/sdk/client-names.js +30 -0
- package/dist/sdk/client-names.js.map +1 -0
- package/dist/sdk/client-operation.d.ts +21 -0
- package/dist/sdk/client-operation.d.ts.map +1 -0
- package/dist/sdk/client-operation.js +2 -0
- package/dist/sdk/client-operation.js.map +1 -0
- package/dist/sdk/client-package-name.d.ts +3 -0
- package/dist/sdk/client-package-name.d.ts.map +1 -0
- package/dist/sdk/client-package-name.js +5 -0
- package/dist/sdk/client-package-name.js.map +1 -0
- package/dist/sdk/client-parameter.d.ts +9 -0
- package/dist/sdk/client-parameter.d.ts.map +1 -0
- package/dist/sdk/client-parameter.js +2 -0
- package/dist/sdk/client-parameter.js.map +1 -0
- package/dist/sdk/client-response.d.ts +10 -0
- package/dist/sdk/client-response.d.ts.map +1 -0
- package/dist/sdk/client-response.js +2 -0
- package/dist/sdk/client-response.js.map +1 -0
- package/dist/sdk/client-tsconfig.d.ts +7 -0
- package/dist/sdk/client-tsconfig.d.ts.map +1 -0
- package/dist/sdk/client-tsconfig.js +26 -0
- package/dist/sdk/client-tsconfig.js.map +1 -0
- package/dist/sdk/clients-directory.d.ts +3 -0
- package/dist/sdk/clients-directory.d.ts.map +1 -0
- package/dist/sdk/clients-directory.js +3 -0
- package/dist/sdk/clients-directory.js.map +1 -0
- package/dist/sdk/contract-documents.d.ts +11 -0
- package/dist/sdk/contract-documents.d.ts.map +1 -0
- package/dist/sdk/contract-documents.js +46 -0
- package/dist/sdk/contract-documents.js.map +1 -0
- package/dist/sdk/doc-comment.d.ts +3 -0
- package/dist/sdk/doc-comment.d.ts.map +1 -0
- package/dist/sdk/doc-comment.js +11 -0
- package/dist/sdk/doc-comment.js.map +1 -0
- package/dist/sdk/document-source.d.ts +6 -0
- package/dist/sdk/document-source.d.ts.map +1 -0
- package/dist/sdk/document-source.js +2 -0
- package/dist/sdk/document-source.js.map +1 -0
- package/dist/sdk/edit-json-file.d.ts +9 -0
- package/dist/sdk/edit-json-file.d.ts.map +1 -0
- package/dist/sdk/edit-json-file.js +31 -0
- package/dist/sdk/edit-json-file.js.map +1 -0
- package/dist/sdk/error-codes.d.ts +4 -0
- package/dist/sdk/error-codes.d.ts.map +1 -0
- package/dist/sdk/error-codes.js +6 -0
- package/dist/sdk/error-codes.js.map +1 -0
- package/dist/sdk/generated-header.d.ts +4 -0
- package/dist/sdk/generated-header.d.ts.map +1 -0
- package/dist/sdk/generated-header.js +5 -0
- package/dist/sdk/generated-header.js.map +1 -0
- package/dist/sdk/index.d.ts +3 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +3 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/instruct-agents.d.ts +8 -0
- package/dist/sdk/instruct-agents.d.ts.map +1 -0
- package/dist/sdk/instruct-agents.js +19 -0
- package/dist/sdk/instruct-agents.js.map +1 -0
- package/dist/sdk/is-input-optional.d.ts +4 -0
- package/dist/sdk/is-input-optional.d.ts.map +1 -0
- package/dist/sdk/is-input-optional.js +5 -0
- package/dist/sdk/is-input-optional.js.map +1 -0
- package/dist/sdk/is-json.d.ts +3 -0
- package/dist/sdk/is-json.d.ts.map +1 -0
- package/dist/sdk/is-json.js +5 -0
- package/dist/sdk/is-json.js.map +1 -0
- package/dist/sdk/manifest-json.d.ts +3 -0
- package/dist/sdk/manifest-json.d.ts.map +1 -0
- package/dist/sdk/manifest-json.js +5 -0
- package/dist/sdk/manifest-json.js.map +1 -0
- package/dist/sdk/operation-description.d.ts +4 -0
- package/dist/sdk/operation-description.d.ts.map +1 -0
- package/dist/sdk/operation-description.js +11 -0
- package/dist/sdk/operation-description.js.map +1 -0
- package/dist/sdk/operation-names.d.ts +8 -0
- package/dist/sdk/operation-names.d.ts.map +1 -0
- package/dist/sdk/operation-names.js +35 -0
- package/dist/sdk/operation-names.js.map +1 -0
- package/dist/sdk/operation-place.d.ts +8 -0
- package/dist/sdk/operation-place.d.ts.map +1 -0
- package/dist/sdk/operation-place.js +2 -0
- package/dist/sdk/operation-place.js.map +1 -0
- package/dist/sdk/planned-client.d.ts +8 -0
- package/dist/sdk/planned-client.d.ts.map +1 -0
- package/dist/sdk/planned-client.js +2 -0
- package/dist/sdk/planned-client.js.map +1 -0
- package/dist/sdk/planned-clients.d.ts +6 -0
- package/dist/sdk/planned-clients.d.ts.map +1 -0
- package/dist/sdk/planned-clients.js +30 -0
- package/dist/sdk/planned-clients.js.map +1 -0
- package/dist/sdk/property-key.d.ts +3 -0
- package/dist/sdk/property-key.d.ts.map +1 -0
- package/dist/sdk/property-key.js +6 -0
- package/dist/sdk/property-key.js.map +1 -0
- package/dist/sdk/put-file.d.ts +4 -0
- package/dist/sdk/put-file.d.ts.map +1 -0
- package/dist/sdk/put-file.js +10 -0
- package/dist/sdk/put-file.js.map +1 -0
- package/dist/sdk/read-client-document.d.ts +5 -0
- package/dist/sdk/read-client-document.d.ts.map +1 -0
- package/dist/sdk/read-client-document.js +34 -0
- package/dist/sdk/read-client-document.js.map +1 -0
- package/dist/sdk/read-operation.d.ts +4 -0
- package/dist/sdk/read-operation.d.ts.map +1 -0
- package/dist/sdk/read-operation.js +64 -0
- package/dist/sdk/read-operation.js.map +1 -0
- package/dist/sdk/read-responses.d.ts +4 -0
- package/dist/sdk/read-responses.d.ts.map +1 -0
- package/dist/sdk/read-responses.js +32 -0
- package/dist/sdk/read-responses.js.map +1 -0
- package/dist/sdk/read-schemes.d.ts +8 -0
- package/dist/sdk/read-schemes.d.ts.map +1 -0
- package/dist/sdk/read-schemes.js +37 -0
- package/dist/sdk/read-schemes.js.map +1 -0
- package/dist/sdk/read-security.d.ts +3 -0
- package/dist/sdk/read-security.d.ts.map +1 -0
- package/dist/sdk/read-security.js +7 -0
- package/dist/sdk/read-security.js.map +1 -0
- package/dist/sdk/render-client.d.ts +4 -0
- package/dist/sdk/render-client.d.ts.map +1 -0
- package/dist/sdk/render-client.js +49 -0
- package/dist/sdk/render-client.js.map +1 -0
- package/dist/sdk/render-errors.d.ts +4 -0
- package/dist/sdk/render-errors.d.ts.map +1 -0
- package/dist/sdk/render-errors.js +18 -0
- package/dist/sdk/render-errors.js.map +1 -0
- package/dist/sdk/render-index.d.ts +4 -0
- package/dist/sdk/render-index.d.ts.map +1 -0
- package/dist/sdk/render-index.js +22 -0
- package/dist/sdk/render-index.js.map +1 -0
- package/dist/sdk/render-input.d.ts +4 -0
- package/dist/sdk/render-input.d.ts.map +1 -0
- package/dist/sdk/render-input.js +31 -0
- package/dist/sdk/render-input.js.map +1 -0
- package/dist/sdk/render-operation.d.ts +7 -0
- package/dist/sdk/render-operation.d.ts.map +1 -0
- package/dist/sdk/render-operation.js +46 -0
- package/dist/sdk/render-operation.js.map +1 -0
- package/dist/sdk/render-operations.d.ts +4 -0
- package/dist/sdk/render-operations.d.ts.map +1 -0
- package/dist/sdk/render-operations.js +12 -0
- package/dist/sdk/render-operations.js.map +1 -0
- package/dist/sdk/render-readme.d.ts +9 -0
- package/dist/sdk/render-readme.d.ts.map +1 -0
- package/dist/sdk/render-readme.js +53 -0
- package/dist/sdk/render-readme.js.map +1 -0
- package/dist/sdk/render-result.d.ts +4 -0
- package/dist/sdk/render-result.d.ts.map +1 -0
- package/dist/sdk/render-result.js +26 -0
- package/dist/sdk/render-result.js.map +1 -0
- package/dist/sdk/render-schemas.d.ts +4 -0
- package/dist/sdk/render-schemas.d.ts.map +1 -0
- package/dist/sdk/render-schemas.js +15 -0
- package/dist/sdk/render-schemas.js.map +1 -0
- package/dist/sdk/schema-type-name.d.ts +3 -0
- package/dist/sdk/schema-type-name.d.ts.map +1 -0
- package/dist/sdk/schema-type-name.js +9 -0
- package/dist/sdk/schema-type-name.js.map +1 -0
- package/dist/sdk/schema-types.d.ts +17 -0
- package/dist/sdk/schema-types.d.ts.map +1 -0
- package/dist/sdk/schema-types.js +120 -0
- package/dist/sdk/schema-types.js.map +1 -0
- package/dist/sdk/scheme-carrier.d.ts +7 -0
- package/dist/sdk/scheme-carrier.d.ts.map +1 -0
- package/dist/sdk/scheme-carrier.js +2 -0
- package/dist/sdk/scheme-carrier.js.map +1 -0
- package/dist/sdk/sdk-scripts.d.ts +8 -0
- package/dist/sdk/sdk-scripts.d.ts.map +1 -0
- package/dist/sdk/sdk-scripts.js +26 -0
- package/dist/sdk/sdk-scripts.js.map +1 -0
- package/dist/sdk/sdk-set-up.d.ts +8 -0
- package/dist/sdk/sdk-set-up.d.ts.map +1 -0
- package/dist/sdk/sdk-set-up.js +2 -0
- package/dist/sdk/sdk-set-up.js.map +1 -0
- package/dist/sdk/set-up-sdk.d.ts +11 -0
- package/dist/sdk/set-up-sdk.d.ts.map +1 -0
- package/dist/sdk/set-up-sdk.js +19 -0
- package/dist/sdk/set-up-sdk.js.map +1 -0
- package/dist/sdk/type-name.d.ts +3 -0
- package/dist/sdk/type-name.d.ts.map +1 -0
- package/dist/sdk/type-name.js +5 -0
- package/dist/sdk/type-name.js.map +1 -0
- package/dist/sdk/unlocked-clients.d.ts +10 -0
- package/dist/sdk/unlocked-clients.d.ts.map +1 -0
- package/dist/sdk/unlocked-clients.js +36 -0
- package/dist/sdk/unlocked-clients.js.map +1 -0
- package/dist/sdk/wire-sdk.d.ts +12 -0
- package/dist/sdk/wire-sdk.d.ts.map +1 -0
- package/dist/sdk/wire-sdk.js +58 -0
- package/dist/sdk/wire-sdk.js.map +1 -0
- package/dist/sdk/with-client-paths.d.ts +8 -0
- package/dist/sdk/with-client-paths.d.ts.map +1 -0
- package/dist/sdk/with-client-paths.js +20 -0
- package/dist/sdk/with-client-paths.js.map +1 -0
- package/dist/sdk/with-entry.d.ts +3 -0
- package/dist/sdk/with-entry.d.ts.map +1 -0
- package/dist/sdk/with-entry.js +6 -0
- package/dist/sdk/with-entry.js.map +1 -0
- package/dist/sdk/with-knip-workspaces.d.ts +7 -0
- package/dist/sdk/with-knip-workspaces.d.ts.map +1 -0
- package/dist/sdk/with-knip-workspaces.js +40 -0
- package/dist/sdk/with-knip-workspaces.js.map +1 -0
- package/dist/sdk/write-clients.d.ts +10 -0
- package/dist/sdk/write-clients.d.ts.map +1 -0
- package/dist/sdk/write-clients.js +32 -0
- package/dist/sdk/write-clients.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/yaml/from-yaml.d.ts +8 -0
- package/dist/yaml/from-yaml.d.ts.map +1 -0
- package/dist/yaml/from-yaml.js +149 -0
- package/dist/yaml/from-yaml.js.map +1 -0
- package/dist/yaml/read-scalar.d.ts +7 -0
- package/dist/yaml/read-scalar.d.ts.map +1 -0
- package/dist/yaml/read-scalar.js +50 -0
- package/dist/yaml/read-scalar.js.map +1 -0
- package/dist/yaml/to-yaml.d.ts +8 -0
- package/dist/yaml/to-yaml.d.ts.map +1 -0
- package/dist/yaml/to-yaml.js +132 -0
- package/dist/yaml/to-yaml.js.map +1 -0
- package/dist/yaml/yaml-shape-error.d.ts +6 -0
- package/dist/yaml/yaml-shape-error.d.ts.map +1 -0
- package/dist/yaml/yaml-shape-error.js +10 -0
- package/dist/yaml/yaml-shape-error.js.map +1 -0
- package/package.json +2 -2
- package/templates/docs/integration-readme.md.tpl +2 -2
- package/templates/init/CLAUDE.md.tpl +5 -1
- package/templates/init/README.md.tpl +45 -12
- package/templates/init/platform/database/data-source.typeorm.ts.tpl +1 -1
- package/templates/init/platform/database/drizzle.config.ts.tpl +2 -0
- package/templates/init/platform/database/knexfile.js.tpl +9 -3
- package/templates/init/platform/database/schema.drizzle.ts.tpl +1 -1
- package/templates/init/platform/database/schema.knex.ts.tpl +2 -2
- package/templates/init/platform/http/with-documentation.ts.tpl +13 -9
- package/templates/init/rules/presentation.md.tpl +4 -1
- package/templates/init/scripts/events.ts.tpl +16 -5
- package/templates/init/scripts/openapi.ts.tpl +49 -20
- package/templates/pipeline/github/branch-protection.md +8 -7
- package/templates/pipeline/github/workflows/{ci.yml → ci.yml.tpl} +3 -0
- package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +14 -0
- package/templates/pipeline/gitlab/merge-request-settings.md +7 -6
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/repository/drizzle/table.tpl +2 -2
- package/templates/repository/prisma/model.tpl +1 -1
- package/templates/repository/typeorm/table.tpl +1 -1
- package/templates/sdk/errors.ts.tpl +30 -0
- package/templates/sdk/runtime.ts.tpl +347 -0
|
@@ -13,7 +13,7 @@ cp .env.example .env
|
|
|
13
13
|
npm run infra:up # the database, in Docker; add --profile observability for Jaeger
|
|
14
14
|
{{/if}}
|
|
15
15
|
{{#if orm.drizzle}}
|
|
16
|
-
npm run db:generate
|
|
16
|
+
npm run db:generate initial # migrations/<timestamp>_initial.sql, from the Drizzle schema
|
|
17
17
|
npm run db:migrate
|
|
18
18
|
{{/if}}
|
|
19
19
|
{{#if orm.knex}}
|
|
@@ -21,16 +21,22 @@ npm run db:migrate # builds, then applies migrations/ (the first one create
|
|
|
21
21
|
{{/if}}
|
|
22
22
|
{{#if orm.prisma}}
|
|
23
23
|
npm run db:client # the Prisma client and the schema of the tests, from prisma/schema.prisma
|
|
24
|
-
npm run db:generate
|
|
24
|
+
npm run db:generate initial # prisma/migrations/<timestamp>_initial/, from the schema
|
|
25
25
|
npm run db:migrate
|
|
26
26
|
{{/if}}
|
|
27
27
|
{{#if orm.typeorm}}
|
|
28
|
-
npm run build && npm run db:generate #
|
|
28
|
+
npm run build && npm run db:generate migrations/initial # migrations/<timestamp>-initial.ts, from the entity schemas
|
|
29
29
|
npm run db:migrate
|
|
30
30
|
{{/if}}
|
|
31
31
|
npm run dev
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
{{#if persistence.hasDatabase}}
|
|
35
|
+
Every migration is named `<timestamp>_<what-it-does>`: `npm run db:generate` refuses to run
|
|
36
|
+
without a name, so two branches never write the same file, and `npm run check:arch` reports
|
|
37
|
+
migrations that a merge left out of order (`npx ddd-ts-kit explain persistence/migration-history`).
|
|
38
|
+
|
|
39
|
+
{{/if}}
|
|
34
40
|
`npm run dev` restarts the application when a source file changes. It runs `tsx watch`, which
|
|
35
41
|
executes TypeScript directly and resolves an import alias from the `paths` of `tsconfig.json`;
|
|
36
42
|
`--env-file-if-exists=.env` gives Node the variables of `.env`
|
|
@@ -41,7 +47,16 @@ one is wrong.
|
|
|
41
47
|
{{#if docs.any}}
|
|
42
48
|
|
|
43
49
|
The API documentation is served at `/docs` and the contract at `/openapi.json`, outside
|
|
44
|
-
production unless `API_DOCS=true
|
|
50
|
+
production unless `API_DOCS=true`; a contract split into documents (`openapi.documents` of
|
|
51
|
+
`ddd-ts-kit.config.json`) is served at `/openapi/<name>.json`, and the page offers each one.
|
|
52
|
+
`npm run docs:generate` commits it as `openapi/openapi.yaml` (or one file per document).
|
|
53
|
+
{{/if}}
|
|
54
|
+
{{#if sdk.on}}
|
|
55
|
+
|
|
56
|
+
A typed client of the contract is generated for its callers, one workspace package per document
|
|
57
|
+
under `clients/` (`npx ddd-ts-kit sdk`, run by `npm run docs:generate`): typed errors keyed by
|
|
58
|
+
the error codes of each operation, a credential per security scheme, no runtime dependency.
|
|
59
|
+
`npm run sdk:build` compiles them; publishing one is a manual step, its README says how.
|
|
45
60
|
{{/if}}
|
|
46
61
|
|
|
47
62
|
## How it is put together
|
|
@@ -250,13 +265,31 @@ The pipeline calls the same `ci:*` scripts; what makes it binding is described i
|
|
|
250
265
|
how the editor hook of the ddd-ts-kit plugin reacts when a file just written breaks a rule
|
|
251
266
|
(refuse it, only say so, or stay silent).
|
|
252
267
|
|
|
253
|
-
##
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
268
|
+
## Recommended steps
|
|
269
|
+
|
|
270
|
+
Follow them in order: it is the path the kit supports, and each step leaves what the next one
|
|
271
|
+
reads. With the ddd-ts-kit plugin of Claude Code, `/ddd-ts-kit:start` conducts steps 1 to 7 and
|
|
272
|
+
records them in `docs/architecture/plan.md`; `npx ddd-ts-kit status` says which step is next.
|
|
273
|
+
|
|
274
|
+
1. **Discover the domain** (`/ddd-ts-kit:discover-domain`): actors, commands, events and
|
|
275
|
+
policies in `docs/architecture/discovery.md`.
|
|
276
|
+
2. **Find the bounded contexts** (`/ddd-ts-kit:bounded-contexts`): `docs/architecture/contexts.md`.
|
|
277
|
+
3. **Write the glossaries** (`/ddd-ts-kit:glossary`) before any code: the generators refuse a
|
|
278
|
+
name the glossary of its context does not hold.
|
|
279
|
+
4. **Draw the context map** (`/ddd-ts-kit:context-map`): who is upstream, by which pattern.
|
|
280
|
+
5. **Bootstrap**: done by `init`. Declare each context with its language and its upstreams,
|
|
281
|
+
upstreams first: `npx ddd-ts-kit generate context <name> --classification <core|supporting|generic> --term "<Term>=<meaning>" --upstream <context>:<pattern>`.
|
|
282
|
+
6. **Plan the slices** (`/ddd-ts-kit:plan-slices`): one use case per slice, in
|
|
283
|
+
`docs/architecture/slices.md`.
|
|
284
|
+
7. **Build slice by slice** (`/ddd-ts-kit:use-case`): `npx ddd-ts-kit generate ...`, then the
|
|
285
|
+
`TODO(domain)` places it lists (`npx ddd-ts-kit todo <context>`); builders and fakes, no mocks.
|
|
286
|
+
8. **Pass the gate** (`/ddd-ts-kit:quality-gate`): `npm run verify` before each merge.
|
|
287
|
+
9. **Document** (`/ddd-ts-kit:document`): `npm run docs:generate`, committed with the code.
|
|
288
|
+
|
|
289
|
+
A step skipped costs later: boundaries drawn from the tables, a glossary written after the
|
|
290
|
+
code, a first integration made by a direct import the checker then refuses. The method, step by
|
|
291
|
+
step: https://github.com/gbourgeat/ddd-ts-kit/blob/main/docs/guides/methodology.md; the command
|
|
292
|
+
for each moment of the project: https://github.com/gbourgeat/ddd-ts-kit/blob/main/docs/guides/commands.md.
|
|
260
293
|
|
|
261
294
|
| Script | Does |
|
|
262
295
|
|---|---|
|
|
@@ -264,5 +297,5 @@ how the editor hook of the ddd-ts-kit plugin reacts when a file just written bre
|
|
|
264
297
|
| `npm test` | domain, application and adapter specs |
|
|
265
298
|
| `npm run test:e2e` | the whole application through HTTP, on an in-process database unless `DATABASE_URL` is set |
|
|
266
299
|
| `npm run check:arch` | `ddd-ts-kit check` |
|
|
267
|
-
| `npm run docs:generate` | context map, OpenAPI, AsyncAPI and event catalog |
|
|
300
|
+
| `npm run docs:generate` | context map, OpenAPI, AsyncAPI and event catalog{{#if sdk.on}}, the clients under `clients/`{{/if}} |
|
|
268
301
|
| `npm run verify` | everything CI runs |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataSource } from 'typeorm';
|
|
2
2
|
import { entities } from '{{alias.platform}}/database/schema{{alias.ext}}';
|
|
3
3
|
|
|
4
|
-
// Read by the TypeORM CLI only (`npm run db:generate
|
|
4
|
+
// Read by the TypeORM CLI only (`npm run db:generate migrations/<what-it-does>`, `npm run db:migrate`), once compiled.
|
|
5
5
|
export default new DataSource({
|
|
6
6
|
type: 'postgres',
|
|
7
7
|
url: process.env['DATABASE_URL'] ?? '',
|
|
@@ -4,5 +4,7 @@ export default {
|
|
|
4
4
|
dialect: 'postgresql',
|
|
5
5
|
schema: './{{config.platformDir}}/database/schema.ts',
|
|
6
6
|
out: './migrations',
|
|
7
|
+
// `<timestamp>_<what-it-does>.sql` (`npm run db:generate add-invoices`): two branches never write the same file.
|
|
8
|
+
migrations: { prefix: 'timestamp' },
|
|
7
9
|
dbCredentials: { url: process.env['DATABASE_URL'] ?? '' },
|
|
8
10
|
} satisfies Config;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
1
2
|
import process from 'node:process';
|
|
2
3
|
|
|
3
|
-
// Read by the knex CLI (`npm run db:migrate`, `npm run db:generate <
|
|
4
|
-
// call the compiled schema of the application: run `npm run build` first.
|
|
4
|
+
// Read by the knex CLI (`npm run db:migrate`, `npm run db:generate <what-it-does>`). The migrations
|
|
5
|
+
// call the compiled schema of the application: run `npm run build` first. A new migration is
|
|
6
|
+
// `<timestamp>_<what-it-does>.js`, written from the ES module stub of knex: the project is ESM.
|
|
5
7
|
export default {
|
|
6
8
|
client: 'pg',
|
|
7
9
|
connection: process.env.DATABASE_URL,
|
|
8
|
-
migrations: {
|
|
10
|
+
migrations: {
|
|
11
|
+
directory: './migrations',
|
|
12
|
+
loadExtensions: ['.js'],
|
|
13
|
+
stub: createRequire(import.meta.url).resolve('knex/lib/migrations/migrate/stub/mjs.stub'),
|
|
14
|
+
},
|
|
9
15
|
};
|
|
@@ -10,7 +10,7 @@ export const processedEvents = processedEventsTable('messaging');
|
|
|
10
10
|
/** The schema of the audit trail. */
|
|
11
11
|
export const AUDIT_SCHEMA = 'audit';
|
|
12
12
|
|
|
13
|
-
// TODO(platform): drizzle-kit writes no trigger. After `npm run db:generate
|
|
13
|
+
// TODO(platform): drizzle-kit writes no trigger. After the first `npm run db:generate <name>`, add a custom migration (`npm run db:generate -- audit-guard --custom`) holding the statements `npm run db:audit-guard` prints: they make the entries refuse UPDATE, DELETE and TRUNCATE.
|
|
14
14
|
export const auditEntries = auditEntriesTable(AUDIT_SCHEMA);
|
|
15
15
|
export const auditChains = auditChainsTable(AUDIT_SCHEMA);
|
|
16
16
|
{{/if}}
|
|
@@ -13,9 +13,9 @@ export const AUDIT_SCHEMA = 'audit';
|
|
|
13
13
|
{{/if}}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Every table of the application. The first migration (migrations/
|
|
16
|
+
* Every table of the application. The first migration (migrations/00000000000000_initial.js) and the
|
|
17
17
|
* in-process database of the tests both call it; once a database is shared, a change of an
|
|
18
|
-
* existing table goes into a migration of its own (`npm run db:generate <
|
|
18
|
+
* existing table goes into a migration of its own (`npm run db:generate <what-it-does>`).
|
|
19
19
|
*/
|
|
20
20
|
export const createTables = async (knex: Knex): Promise<void> => {
|
|
21
21
|
await createOutboxTables(knex, { schema: MESSAGING });
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import type { Route } from '@ddd-ts-kit/http';
|
|
2
|
-
import {
|
|
3
|
-
import { generateOpenApi } from '@ddd-ts-kit/http/openapi';
|
|
2
|
+
import { openApiDocumentsRoutes } from '@ddd-ts-kit/http/docs';
|
|
3
|
+
import { generateOpenApi, routesByDocument } from '@ddd-ts-kit/http/openapi';
|
|
4
4
|
import { securitySchemes } from '{{alias.platform}}/auth/security-schemes{{alias.ext}}';
|
|
5
5
|
import type { AppConfig } from '{{alias.platform}}/config/app-config{{alias.ext}}';
|
|
6
|
+
import { OPENAPI_DOCUMENTS } from '{{alias.platform}}/http/openapi-documents{{alias.ext}}';
|
|
6
7
|
|
|
7
|
-
/** Adds the contract and its interactive page next to the routes, unless documentation is switched off (API_DOCS, off in production by default). */
|
|
8
|
+
/** Adds the contract and its interactive page next to the routes, one per document of a split contract, unless documentation is switched off (API_DOCS, off in production by default). */
|
|
8
9
|
export function withDocumentation(routes: readonly Route[], config: AppConfig): readonly Route[] {
|
|
9
10
|
if (!config.docsEnabled) {
|
|
10
11
|
return routes;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const documents = routesByDocument(routes, OPENAPI_DOCUMENTS).map(({ name, title, routes: selected }) => ({
|
|
15
|
+
name,
|
|
16
|
+
document: generateOpenApi({
|
|
17
|
+
info: { title: title ?? config.serviceName, version: config.serviceVersion },
|
|
18
|
+
routes: selected,
|
|
19
|
+
securitySchemes,
|
|
20
|
+
}),
|
|
21
|
+
}));
|
|
18
22
|
|
|
19
|
-
return [...routes, ...
|
|
23
|
+
return [...routes, ...openApiDocumentsRoutes(documents, { ui: '{{docs.ui}}', title: config.serviceName })];
|
|
20
24
|
}
|
|
@@ -3,6 +3,9 @@ paths:
|
|
|
3
3
|
- "{{config.contextsDir}}/*/presentation/**"
|
|
4
4
|
- "openapi/**"
|
|
5
5
|
- "scripts/openapi.ts"
|
|
6
|
+
{{#if sdk.on}}
|
|
7
|
+
- "clients/**"
|
|
8
|
+
{{/if}}
|
|
6
9
|
---
|
|
7
10
|
|
|
8
11
|
# Presentation layer
|
|
@@ -28,5 +31,5 @@ paths:
|
|
|
28
31
|
- Request and response types are presentation types, one class or schema per file next to the controller (`*.body.ts`, `*.params.ts`, `*.answer.ts`...; `*.dto.ts` for function routes and under `shared/`): never an aggregate, never a row.
|
|
29
32
|
- Never put the message of an unexpected failure in a response or a log.
|
|
30
33
|
- Files: the canonical tree of `presentation/http/` (`naming/suffix`, `tree/closed`): a folder per controller, `*.routes.ts` for the groups, `guards/`, `shared/`; function routes stay flat (`*.route.ts`, `*.dto.ts`).
|
|
31
|
-
- After a change, `npm run docs:generate` regenerates `openapi/openapi.json
|
|
34
|
+
- After a change, `npm run docs:generate` regenerates the contract, `openapi/openapi.yaml` (one file per document when `openapi.documents` of `ddd-ts-kit.config.json` splits it; JSON under `openapi.format: json`), committed with the route; CI fails on a difference. Never edit it by hand.{{#if sdk.on}} It regenerates the typed clients under `clients/` too (`npx ddd-ts-kit sdk`), committed with it.{{/if}}
|
|
32
35
|
- Contract with `/ddd-ts-kit:document`. Create with `npx ddd-ts-kit generate route <context> <UseCase> --method <M> --path <p> [--group <Name>] [--mapper] [--serializer] --json`, then `generate e2e <context> <UseCase>`; `generate route-group` and `generate guard` write a group and a guard.
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { createEventRegistry, generateEventCatalog, type AnyIntegrationEventDefinition } from '@ddd-ts-kit/events';
|
|
4
|
-
import { generateAsyncApi
|
|
4
|
+
import { generateAsyncApi } from '@ddd-ts-kit/events/asyncapi';
|
|
5
|
+
import { contractFormat, stringifyContract } from 'ddd-ts-kit/dist/contracts.js';
|
|
5
6
|
|
|
6
|
-
// Generates docs/integration/asyncapi.json
|
|
7
|
-
//
|
|
8
|
-
// differs. Both files are build
|
|
7
|
+
// Generates docs/integration/asyncapi.yaml (asyncapi.json under "openapi.format": "json" in
|
|
8
|
+
// ddd-ts-kit.config.json) and docs/integration/event-catalog.md from the declarations of every
|
|
9
|
+
// published language; with --check, fails when a committed file differs. Both files are build
|
|
10
|
+
// products: never edit them by hand.
|
|
9
11
|
const contextsDirectory = '{{config.contextsDir}}';
|
|
10
12
|
const target = path.resolve('docs/integration');
|
|
13
|
+
const format = contractFormat();
|
|
14
|
+
const other = format === 'yaml' ? 'asyncapi.json' : 'asyncapi.yaml';
|
|
11
15
|
|
|
12
16
|
const registry = createEventRegistry(await declaredEvents());
|
|
13
17
|
|
|
14
18
|
const generated: Readonly<Record<string, string>> = {
|
|
15
|
-
|
|
19
|
+
[`asyncapi.${format}`]: stringifyContract(
|
|
16
20
|
generateAsyncApi({
|
|
17
21
|
info: {
|
|
18
22
|
title: manifestField('name', '{{project.name}}'),
|
|
@@ -20,6 +24,7 @@ const generated: Readonly<Record<string, string>> = {
|
|
|
20
24
|
},
|
|
21
25
|
registry,
|
|
22
26
|
}),
|
|
27
|
+
format,
|
|
23
28
|
),
|
|
24
29
|
'event-catalog.md': generateEventCatalog(registry, { consumers: consumersByEventType() }),
|
|
25
30
|
};
|
|
@@ -28,6 +33,7 @@ if (process.argv.includes('--check')) {
|
|
|
28
33
|
reportStale();
|
|
29
34
|
} else {
|
|
30
35
|
fs.mkdirSync(target, { recursive: true });
|
|
36
|
+
fs.rmSync(path.join(target, other), { force: true });
|
|
31
37
|
|
|
32
38
|
for (const [file, content] of Object.entries(generated)) {
|
|
33
39
|
fs.writeFileSync(path.join(target, file), content);
|
|
@@ -43,6 +49,11 @@ function reportStale(): void {
|
|
|
43
49
|
process.exitCode = 1;
|
|
44
50
|
}
|
|
45
51
|
}
|
|
52
|
+
|
|
53
|
+
if (fs.existsSync(path.join(target, other))) {
|
|
54
|
+
console.error('docs/integration/' + other + ' is in the other format: run the script `docs:generate`.');
|
|
55
|
+
process.exitCode = 1;
|
|
56
|
+
}
|
|
46
57
|
}
|
|
47
58
|
|
|
48
59
|
/** Every declaration exported by a published language. Read from the compiled modules next to this script, so that a new context needs no registration: a path completed at run time cannot be an import alias, which the build rewrites. */
|
|
@@ -1,47 +1,76 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { generateOpenApi, routesByDocument } from '@ddd-ts-kit/http/openapi';
|
|
4
|
+
import { contractFormat, stringifyContract } from 'ddd-ts-kit/dist/contracts.js';
|
|
4
5
|
import { offlineAuthenticator } from '{{alias.platform}}/auth/offline-authenticator{{alias.ext}}';
|
|
5
6
|
import { securitySchemes } from '{{alias.platform}}/auth/security-schemes{{alias.ext}}';
|
|
6
7
|
import { composeApplication } from '{{alias.platform}}/compose-application{{alias.ext}}';
|
|
7
8
|
import { inertPersistence } from '{{alias.platform}}/database/inert-persistence{{alias.ext}}';
|
|
8
9
|
import { inProcessEvents } from '{{alias.platform}}/events/in-process-events{{alias.ext}}';
|
|
10
|
+
import { OPENAPI_DOCUMENTS } from '{{alias.platform}}/http/openapi-documents{{alias.ext}}';
|
|
9
11
|
|
|
10
|
-
// Generates
|
|
11
|
-
//
|
|
12
|
-
|
|
12
|
+
// Generates the contract from the route definitions: openapi/openapi.yaml, or one file per
|
|
13
|
+
// document of "openapi.documents" in ddd-ts-kit.config.json, in the format of "openapi.format";
|
|
14
|
+
// with --check, fails when a committed file differs. Build products: never edit them by hand.
|
|
15
|
+
const directory = path.resolve('openapi');
|
|
16
|
+
const format = contractFormat();
|
|
13
17
|
|
|
14
18
|
const application = composeApplication(inertPersistence(), {
|
|
15
19
|
events: inProcessEvents(),
|
|
16
20
|
authenticator: offlineAuthenticator,
|
|
17
21
|
});
|
|
18
22
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const generated = new Map(
|
|
24
|
+
routesByDocument(application.routes, OPENAPI_DOCUMENTS).map(({ name, title, routes }) => [
|
|
25
|
+
`${name}.${format}`,
|
|
26
|
+
stringifyContract(
|
|
27
|
+
generateOpenApi({
|
|
28
|
+
info: { title: title ?? manifestField('name', '{{project.name}}'), version: manifestField('version', '0.0.0') },
|
|
29
|
+
routes,
|
|
30
|
+
securitySchemes,
|
|
31
|
+
errorMapper: application.boundary.errorMapper,
|
|
32
|
+
}),
|
|
33
|
+
format,
|
|
34
|
+
),
|
|
35
|
+
]),
|
|
36
|
+
);
|
|
28
37
|
|
|
29
38
|
if (process.argv.includes('--check')) {
|
|
30
39
|
reportDrift();
|
|
31
40
|
} else {
|
|
32
|
-
fs.mkdirSync(
|
|
33
|
-
|
|
41
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
42
|
+
|
|
43
|
+
for (const file of staleFiles()) {
|
|
44
|
+
fs.rmSync(path.join(directory, file));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
for (const [file, content] of generated) {
|
|
48
|
+
fs.writeFileSync(path.join(directory, file), content);
|
|
49
|
+
}
|
|
34
50
|
}
|
|
35
51
|
|
|
36
52
|
function reportDrift(): void {
|
|
37
|
-
const
|
|
53
|
+
for (const [file, content] of generated) {
|
|
54
|
+
const target = path.join(directory, file);
|
|
55
|
+
const committed = fs.existsSync(target) ? fs.readFileSync(target, 'utf8') : '';
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
if (committed.replaceAll('\r\n', '\n') !== content) {
|
|
58
|
+
console.error(`openapi/${file} is out of date: run the script \`docs:generate\` and commit it.`);
|
|
59
|
+
process.exitCode = 1;
|
|
60
|
+
}
|
|
41
61
|
}
|
|
42
62
|
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
for (const file of staleFiles()) {
|
|
64
|
+
console.error(`openapi/${file} is no document of the contract any more: run the script \`docs:generate\`.`);
|
|
65
|
+
process.exitCode = 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The contracts left by another format or by a document that is gone. */
|
|
70
|
+
function staleFiles(): string[] {
|
|
71
|
+
const present = fs.existsSync(directory) ? fs.readdirSync(directory) : [];
|
|
72
|
+
|
|
73
|
+
return present.filter((file) => /\.(?:json|yaml)$/.test(file) && !generated.has(file));
|
|
45
74
|
}
|
|
46
75
|
|
|
47
76
|
function manifestField(name: string, fallback: string): string {
|
|
@@ -10,7 +10,7 @@ of `CI` on `main` (GitHub only offers a check as "required" once it has reported
|
|
|
10
10
|
|---|---|---|
|
|
11
11
|
| `gate` | `ci.yml` | Needs every other job of the workflow; a failed, cancelled or skipped job fails it. One required check, so adding a job never needs a settings change. |
|
|
12
12
|
| `Conventional title` | `pr-title.yml` | The squash commit takes the pull request title. |
|
|
13
|
-
| `Analyze` | `codeql.yml` |
|
|
13
|
+
| `Analyze` | `codeql.yml` | Only with `init --ci-extras codeql`: require it when code scanning is enabled on the repository. |
|
|
14
14
|
|
|
15
15
|
## Protect `main`
|
|
16
16
|
|
|
@@ -66,12 +66,13 @@ Expected: `{"checks":["gate","Conventional title"],"strict":true,"admins":true}`
|
|
|
66
66
|
|
|
67
67
|
## Notes
|
|
68
68
|
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
- Not installed by default, because they need a paid plan on a private repository:
|
|
70
|
+
dependency review (`--ci-extras dependency-review`: free on public repositories, GitHub Code
|
|
71
|
+
Security or GitHub Advanced Security on private ones) and CodeQL (`--ci-extras codeql`: free on
|
|
72
|
+
public repositories, GitHub Code Security on private ones). `npm run ci:audit` and gitleaks
|
|
73
|
+
hold dependencies and secrets on every plan.
|
|
73
74
|
- Secret scanning in `ci.yml` runs the gitleaks container, which needs no licence. The
|
|
74
|
-
`gitleaks/gitleaks-action` wrapper is not used
|
|
75
|
-
|
|
75
|
+
`gitleaks/gitleaks-action` wrapper is not used: it asks organization accounts for a licence
|
|
76
|
+
key (free, by its README) and is no longer MIT.
|
|
76
77
|
- Dependabot (`dependabot.yml`) is GitHub only. `renovate.json` works on both platforms; keep one
|
|
77
78
|
of the two, not both.
|
|
@@ -173,11 +173,14 @@ jobs:
|
|
|
173
173
|
- uses: ./.github/actions/setup
|
|
174
174
|
- name: Production dependencies audit
|
|
175
175
|
run: npm run ci:audit
|
|
176
|
+
{{#if extras.dependencyReview}}
|
|
177
|
+
# Opt-in (--ci-extras dependency-review): free on a public repository, GitHub Code Security on a private one.
|
|
176
178
|
- name: Dependency review
|
|
177
179
|
if: ${{ github.event_name == 'pull_request' && !cancelled() }}
|
|
178
180
|
uses: actions/dependency-review-action@v5.0.0
|
|
179
181
|
with:
|
|
180
182
|
fail-on-severity: high
|
|
183
|
+
{{/if}}
|
|
181
184
|
- name: Secrets
|
|
182
185
|
if: ${{ !cancelled() }}
|
|
183
186
|
run: docker run --rm --volume "$GITHUB_WORKSPACE:/repo" ghcr.io/gitleaks/gitleaks:v8.30.1 git /repo --redact --no-banner
|
|
@@ -7,13 +7,22 @@ workflow:
|
|
|
7
7
|
# A pipeline schedule (Build > Pipeline schedules, every night on the default branch) runs everything.
|
|
8
8
|
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
9
9
|
|
|
10
|
+
{{#if extras.gitlabSecurity}}
|
|
11
|
+
# Opt-in (--ci-extras): these run on every tier, but their findings reach a merge request on Ultimate only.
|
|
10
12
|
include:
|
|
13
|
+
{{#if extras.gitlabSast}}
|
|
11
14
|
- template: Jobs/SAST.gitlab-ci.yml
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#if extras.gitlabSecretDetection}}
|
|
12
17
|
- template: Jobs/Secret-Detection.gitlab-ci.yml
|
|
18
|
+
{{/if}}
|
|
19
|
+
{{#if extras.gitlabDependencyScanning}}
|
|
13
20
|
- template: Jobs/Dependency-Scanning.v2.gitlab-ci.yml
|
|
14
21
|
rules:
|
|
15
22
|
- if: $GITLAB_FEATURES =~ /\bdependency_scanning\b/
|
|
23
|
+
{{/if}}
|
|
16
24
|
|
|
25
|
+
{{/if}}
|
|
17
26
|
stages:
|
|
18
27
|
- install
|
|
19
28
|
- test
|
|
@@ -21,7 +30,9 @@ stages:
|
|
|
21
30
|
- gate
|
|
22
31
|
|
|
23
32
|
variables:
|
|
33
|
+
{{#if extras.gitlabSecurity}}
|
|
24
34
|
AST_ENABLE_MR_PIPELINES: 'true'
|
|
35
|
+
{{/if}}
|
|
25
36
|
NODE_IMAGE: node:24-bookworm-slim
|
|
26
37
|
# Behind the dependency proxy of a group, a registry that rate-limits is never asked twice:
|
|
27
38
|
# POSTGRES_IMAGE: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/postgres:18
|
|
@@ -194,6 +205,9 @@ build:
|
|
|
194
205
|
stage: test
|
|
195
206
|
needs: [install]
|
|
196
207
|
script:
|
|
208
|
+
{{#if sdk.on}}
|
|
209
|
+
# The production build, and the clients of the contract (sdk:build).
|
|
210
|
+
{{/if}}
|
|
197
211
|
- npm run ci:build
|
|
198
212
|
# The generated documents and contracts, from that build.
|
|
199
213
|
- npm run ci:docs
|
|
@@ -76,14 +76,15 @@ glab api "projects/:id/protected_branches/main" | jq '{name, allow_force_push, p
|
|
|
76
76
|
|
|
77
77
|
| Piece | Free | Premium | Ultimate |
|
|
78
78
|
|---|---|---|---|
|
|
79
|
-
| SAST template (`Jobs/SAST.gitlab-ci.yml`, Semgrep rules for JavaScript and TypeScript) | job runs, report downloadable as an artifact | same | findings in the merge request, vulnerability management, Advanced SAST |
|
|
80
|
-
| Secret Detection template (`Jobs/Secret-Detection.gitlab-ci.yml`) | job runs, report downloadable as an artifact | same | findings in the merge request and the security dashboard |
|
|
81
|
-
| Dependency Scanning template (`Jobs/Dependency-Scanning.v2.gitlab-ci.yml`) | not available: the `include` is skipped | not available | available |
|
|
79
|
+
| SAST template (`Jobs/SAST.gitlab-ci.yml`, Semgrep rules for JavaScript and TypeScript), `--ci-extras gitlab-sast` | job runs, report downloadable as an artifact | same | findings in the merge request, vulnerability management, Advanced SAST |
|
|
80
|
+
| Secret Detection template (`Jobs/Secret-Detection.gitlab-ci.yml`), `--ci-extras gitlab-secret-detection` | job runs, report downloadable as an artifact | same | findings in the merge request and the security dashboard |
|
|
81
|
+
| Dependency Scanning template (`Jobs/Dependency-Scanning.v2.gitlab-ci.yml`), `--ci-extras gitlab-dependency-scanning` | not available: the `include` is skipped | not available | available |
|
|
82
82
|
| Code Quality report (ESLint and architecture) | merge request widget | plus the pipeline report tab | plus inline in the changes view |
|
|
83
83
|
| JUnit report, coverage percentage, Cobertura coverage in the diff | available | available | available |
|
|
84
84
|
| Push rules | no | yes | yes |
|
|
85
85
|
| Required approvals | no | yes | yes |
|
|
86
86
|
|
|
87
|
-
The
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
The three templates are not in `.gitlab-ci.yml` unless `init --ci-extras` names them: on Free
|
|
88
|
+
and Premium their findings reach no merge request, and their jobs are `allow_failure: true` by
|
|
89
|
+
design of GitLab, so they never block a merge. What blocks, on every tier, is the `audit` job
|
|
90
|
+
(`npm audit`, production dependencies, high and above) and the `secrets` job (gitleaks).
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@biomejs/biome": "2.5.15",
|
|
24
24
|
"@commitlint/cli": "^21.2.3",
|
|
25
25
|
"@commitlint/config-conventional": "^21.2.3",
|
|
26
|
-
"@ddd-ts-kit/eslint-plugin": "^0.
|
|
26
|
+
"@ddd-ts-kit/eslint-plugin": "^0.6.0",
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@typescript/native": "npm:typescript@~7.0.2",
|
|
29
29
|
"@vitest/coverage-v8": "5.0.3",
|
|
@@ -13,7 +13,7 @@ export const {{aggregate.tableCamel}} = {{context.camel}}Schema.table(
|
|
|
13
13
|
{
|
|
14
14
|
id: text('id').primaryKey(),
|
|
15
15
|
registeredAt: timestamp('registered_at', { withTimezone: true, mode: 'date' }).notNull(),
|
|
16
|
-
// TODO(domain): add one column per field of {{aggregate.pascal}}State, with the type and the constraints the storage must enforce; then run `npm run db:generate
|
|
16
|
+
// TODO(domain): add one column per field of {{aggregate.pascal}}State, with the type and the constraints the storage must enforce; then run `npm run db:generate <what-it-does>`.
|
|
17
17
|
version: integer('version').notNull(),
|
|
18
18
|
...tenantColumn(),
|
|
19
19
|
...auditColumns(),
|
|
@@ -25,7 +25,7 @@ export const {{aggregate.tableCamel}} = {{context.camel}}Schema.table(
|
|
|
25
25
|
export const {{aggregate.tableCamel}} = {{context.camel}}Schema.table('{{aggregate.table}}', {
|
|
26
26
|
id: text('id').primaryKey(),
|
|
27
27
|
registeredAt: timestamp('registered_at', { withTimezone: true, mode: 'date' }).notNull(),
|
|
28
|
-
// TODO(domain): add one column per field of {{aggregate.pascal}}State, with the type and the constraints the storage must enforce; then run `npm run db:generate
|
|
28
|
+
// TODO(domain): add one column per field of {{aggregate.pascal}}State, with the type and the constraints the storage must enforce; then run `npm run db:generate <what-it-does>`.
|
|
29
29
|
version: integer('version').notNull(),
|
|
30
30
|
...auditColumns(),
|
|
31
31
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
model {{context.pascal}}{{aggregate.pascal}} {
|
|
3
3
|
id String @id
|
|
4
4
|
registeredAt DateTime @map("registered_at") @db.Timestamptz(3)
|
|
5
|
-
// TODO(domain): add one field per field of {{aggregate.pascal}}State, with the type and the constraints the storage must enforce; then run `npm run db:client` and `npm run db:generate
|
|
5
|
+
// TODO(domain): add one field per field of {{aggregate.pascal}}State, with the type and the constraints the storage must enforce; then run `npm run db:client` and `npm run db:generate <what-it-does>`.
|
|
6
6
|
version Int
|
|
7
7
|
createdAt DateTime @map("created_at") @db.Timestamptz(3)
|
|
8
8
|
createdBy String @map("created_by")
|
|
@@ -8,7 +8,7 @@ export const {{aggregate.tableCamel}} = new EntitySchema<{{aggregate.pascal}}Row
|
|
|
8
8
|
columns: {
|
|
9
9
|
id: { type: 'text', primary: true },
|
|
10
10
|
registeredAt: { name: 'registered_at', type: 'timestamptz' },
|
|
11
|
-
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run db:generate
|
|
11
|
+
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run build && npm run db:generate migrations/<what-it-does>`.
|
|
12
12
|
version: { type: 'int' },
|
|
13
13
|
...auditColumns(),
|
|
14
14
|
},
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{{header}}
|
|
2
|
+
import { type Failure, ProblemError } from './runtime.js';
|
|
3
|
+
import type * as Schemas from './schemas.js';
|
|
4
|
+
|
|
5
|
+
/** Every error code an operation of the API declares: branch on these, never on a title or a message. */
|
|
6
|
+
export const ERROR_CODES = {{codes}} as const;
|
|
7
|
+
|
|
8
|
+
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
9
|
+
|
|
10
|
+
/** A problem document of the API with one of its codes. */
|
|
11
|
+
export type ProblemOf<Code extends ErrorCode = ErrorCode> = Failure<number, Code, {{problem}}>['problem'];
|
|
12
|
+
|
|
13
|
+
export function isErrorCode(value: unknown): value is ErrorCode {
|
|
14
|
+
return ERROR_CODES.some((code) => code === value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* True when `unwrap` threw a refusal of the API with one of the codes, any of its codes when none
|
|
19
|
+
* is given: `if (isProblem(error, 'SOME_CODE')) { ... }`.
|
|
20
|
+
*/
|
|
21
|
+
export function isProblem<Code extends ErrorCode>(
|
|
22
|
+
error: unknown,
|
|
23
|
+
...codes: readonly Code[]
|
|
24
|
+
): error is ProblemError<Failure<number, Code, {{problem}}>> & { readonly code: Code } {
|
|
25
|
+
if (!(error instanceof ProblemError)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return codes.length === 0 ? isErrorCode(error.code) : codes.some((code) => code === error.code);
|
|
30
|
+
}
|