ddd-ts-kit 0.112.0 → 0.113.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 +42 -0
- package/README.fr.md +18 -1
- package/README.md +16 -0
- 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/commands/check-command.js +4 -3
- package/dist/check/commands/check-command.js.map +1 -1
- package/dist/check/explain/persistence-docs.d.ts.map +1 -1
- package/dist/check/explain/persistence-docs.js +17 -0
- package/dist/check/explain/persistence-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/read-model-list-files.d.ts +7 -0
- package/dist/check/fixtures/read-model-list-files.d.ts.map +1 -0
- package/dist/check/fixtures/read-model-list-files.js +18 -0
- package/dist/check/fixtures/read-model-list-files.js.map +1 -0
- package/dist/check/fixtures/read-model-listed-fixtures.d.ts +3 -0
- package/dist/check/fixtures/read-model-listed-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/read-model-listed-fixtures.js +292 -0
- package/dist/check/fixtures/read-model-listed-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tenancy-fixtures.js +2 -1
- package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
- package/dist/check/fixtures/tenancy-prisma-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tenancy-prisma-fixtures.js +2 -0
- package/dist/check/fixtures/tenancy-prisma-fixtures.js.map +1 -1
- package/dist/check/fixtures/tenancy-typeorm-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tenancy-typeorm-fixtures.js +2 -0
- package/dist/check/fixtures/tenancy-typeorm-fixtures.js.map +1 -1
- package/dist/check/model/finding.d.ts +2 -1
- package/dist/check/model/finding.d.ts.map +1 -1
- package/dist/check/model/violation.d.ts +4 -1
- package/dist/check/model/violation.d.ts.map +1 -1
- package/dist/check/read-models/list-findings.d.ts +22 -0
- package/dist/check/read-models/list-findings.d.ts.map +1 -0
- package/dist/check/read-models/list-findings.js +84 -0
- package/dist/check/read-models/list-findings.js.map +1 -0
- package/dist/check/rules/declarations-port-adapter-wired.js +9 -2
- package/dist/check/rules/declarations-port-adapter-wired.js.map +1 -1
- package/dist/check/rules/persistence-read-model-listed.d.ts +3 -0
- package/dist/check/rules/persistence-read-model-listed.d.ts.map +1 -0
- package/dist/check/rules/persistence-read-model-listed.js +93 -0
- package/dist/check/rules/persistence-read-model-listed.js.map +1 -0
- package/dist/check/scan/lexer.d.ts +4 -0
- package/dist/check/scan/lexer.d.ts.map +1 -1
- package/dist/check/scan/lexer.js +11 -0
- package/dist/check/scan/lexer.js.map +1 -1
- package/dist/check/scan/scan.d.ts +6 -0
- package/dist/check/scan/scan.d.ts.map +1 -1
- package/dist/check/scan/scan.js +1 -0
- package/dist/check/scan/scan.js.map +1 -1
- package/dist/check/structure/read-structure.js +35 -13
- package/dist/check/structure/read-structure.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +3 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/json-report.js +4 -4
- package/dist/commands/json-report.js.map +1 -1
- package/dist/commands/print-report.js +3 -0
- package/dist/commands/print-report.js.map +1 -1
- package/dist/commands/prisma-client.d.ts +8 -0
- package/dist/commands/prisma-client.d.ts.map +1 -0
- package/dist/commands/prisma-client.js +23 -0
- package/dist/commands/prisma-client.js.map +1 -0
- package/dist/generate/kinds/declare-storage.d.ts.map +1 -1
- package/dist/generate/kinds/declare-storage.js +6 -1
- package/dist/generate/kinds/declare-storage.js.map +1 -1
- package/dist/generate/kinds/declare-table.d.ts +2 -0
- package/dist/generate/kinds/declare-table.d.ts.map +1 -1
- package/dist/generate/kinds/declare-table.js +65 -1
- package/dist/generate/kinds/declare-table.js.map +1 -1
- package/dist/generate/kinds/read-model/list-read-model.d.ts +4 -9
- package/dist/generate/kinds/read-model/list-read-model.d.ts.map +1 -1
- package/dist/generate/kinds/read-model/list-read-model.js +11 -9
- package/dist/generate/kinds/read-model/list-read-model.js.map +1 -1
- package/dist/generate/kinds/read-model-kind.d.ts.map +1 -1
- package/dist/generate/kinds/read-model-kind.js +7 -2
- package/dist/generate/kinds/read-model-kind.js.map +1 -1
- package/dist/generate/kinds/same-name/code-from.d.ts +8 -0
- package/dist/generate/kinds/same-name/code-from.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/code-from.js +34 -0
- package/dist/generate/kinds/same-name/code-from.js.map +1 -0
- package/dist/generate/kinds/same-name/context-of-source.d.ts +5 -0
- package/dist/generate/kinds/same-name/context-of-source.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/context-of-source.js +10 -0
- package/dist/generate/kinds/same-name/context-of-source.js.map +1 -0
- package/dist/generate/kinds/same-name/entities-list.d.ts +6 -0
- package/dist/generate/kinds/same-name/entities-list.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/entities-list.js +25 -0
- package/dist/generate/kinds/same-name/entities-list.js.map +1 -0
- package/dist/generate/kinds/same-name/exports-an-alias.d.ts +12 -0
- package/dist/generate/kinds/same-name/exports-an-alias.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/exports-an-alias.js +150 -0
- package/dist/generate/kinds/same-name/exports-an-alias.js.map +1 -0
- package/dist/generate/kinds/same-name/free-name.d.ts +10 -0
- package/dist/generate/kinds/same-name/free-name.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/free-name.js +20 -0
- package/dist/generate/kinds/same-name/free-name.js.map +1 -0
- package/dist/generate/kinds/same-name/hidden-symbols.d.ts +8 -0
- package/dist/generate/kinds/same-name/hidden-symbols.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/hidden-symbols.js +18 -0
- package/dist/generate/kinds/same-name/hidden-symbols.js.map +1 -0
- package/dist/generate/kinds/same-name/imported-twice-notes.d.ts +10 -0
- package/dist/generate/kinds/same-name/imported-twice-notes.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/imported-twice-notes.js +24 -0
- package/dist/generate/kinds/same-name/imported-twice-notes.js.map +1 -0
- package/dist/generate/kinds/same-name/index-exports.d.ts +11 -0
- package/dist/generate/kinds/same-name/index-exports.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/index-exports.js +27 -0
- package/dist/generate/kinds/same-name/index-exports.js.map +1 -0
- package/dist/generate/kinds/same-name/index-picture.d.ts +29 -0
- package/dist/generate/kinds/same-name/index-picture.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/index-picture.js +63 -0
- package/dist/generate/kinds/same-name/index-picture.js.map +1 -0
- package/dist/generate/kinds/same-name/index-reading.d.ts +83 -0
- package/dist/generate/kinds/same-name/index-reading.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/index-reading.js +105 -0
- package/dist/generate/kinds/same-name/index-reading.js.map +1 -0
- package/dist/generate/kinds/same-name/keep-the-picture.d.ts +17 -0
- package/dist/generate/kinds/same-name/keep-the-picture.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/keep-the-picture.js +164 -0
- package/dist/generate/kinds/same-name/keep-the-picture.js.map +1 -0
- package/dist/generate/kinds/same-name/lines-to-settle.d.ts +37 -0
- package/dist/generate/kinds/same-name/lines-to-settle.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/lines-to-settle.js +100 -0
- package/dist/generate/kinds/same-name/lines-to-settle.js.map +1 -0
- package/dist/generate/kinds/same-name/linked.d.ts +14 -0
- package/dist/generate/kinds/same-name/linked.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/linked.js +14 -0
- package/dist/generate/kinds/same-name/linked.js.map +1 -0
- package/dist/generate/kinds/same-name/listed-entity.d.ts +25 -0
- package/dist/generate/kinds/same-name/listed-entity.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/listed-entity.js +25 -0
- package/dist/generate/kinds/same-name/listed-entity.js.map +1 -0
- package/dist/generate/kinds/same-name/may-share.d.ts +22 -0
- package/dist/generate/kinds/same-name/may-share.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/may-share.js +35 -0
- package/dist/generate/kinds/same-name/may-share.js.map +1 -0
- package/dist/generate/kinds/same-name/not-settled.d.ts +16 -0
- package/dist/generate/kinds/same-name/not-settled.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/not-settled.js +12 -0
- package/dist/generate/kinds/same-name/not-settled.js.map +1 -0
- package/dist/generate/kinds/same-name/places-of.d.ts +4 -0
- package/dist/generate/kinds/same-name/places-of.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/places-of.js +13 -0
- package/dist/generate/kinds/same-name/places-of.js.map +1 -0
- package/dist/generate/kinds/same-name/project-reader.d.ts +13 -0
- package/dist/generate/kinds/same-name/project-reader.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/project-reader.js +55 -0
- package/dist/generate/kinds/same-name/project-reader.js.map +1 -0
- package/dist/generate/kinds/same-name/read-module.d.ts +44 -0
- package/dist/generate/kinds/same-name/read-module.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/read-module.js +189 -0
- package/dist/generate/kinds/same-name/read-module.js.map +1 -0
- package/dist/generate/kinds/same-name/read-tables-file.d.ts +34 -0
- package/dist/generate/kinds/same-name/read-tables-file.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/read-tables-file.js +116 -0
- package/dist/generate/kinds/same-name/read-tables-file.js.map +1 -0
- package/dist/generate/kinds/same-name/region-of.d.ts +3 -0
- package/dist/generate/kinds/same-name/region-of.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/region-of.js +5 -0
- package/dist/generate/kinds/same-name/region-of.js.map +1 -0
- package/dist/generate/kinds/same-name/settle-same-names.d.ts +30 -0
- package/dist/generate/kinds/same-name/settle-same-names.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/settle-same-names.js +123 -0
- package/dist/generate/kinds/same-name/settle-same-names.js.map +1 -0
- package/dist/generate/kinds/same-name/signature-of.d.ts +4 -0
- package/dist/generate/kinds/same-name/signature-of.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/signature-of.js +5 -0
- package/dist/generate/kinds/same-name/signature-of.js.map +1 -0
- package/dist/generate/kinds/same-name/sources-of.d.ts +35 -0
- package/dist/generate/kinds/same-name/sources-of.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/sources-of.js +57 -0
- package/dist/generate/kinds/same-name/sources-of.js.map +1 -0
- package/dist/generate/kinds/same-name/symbol-of.d.ts +9 -0
- package/dist/generate/kinds/same-name/symbol-of.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/symbol-of.js +8 -0
- package/dist/generate/kinds/same-name/symbol-of.js.map +1 -0
- package/dist/generate/kinds/same-name/tables-constants.d.ts +5 -0
- package/dist/generate/kinds/same-name/tables-constants.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/tables-constants.js +8 -0
- package/dist/generate/kinds/same-name/tables-constants.js.map +1 -0
- package/dist/generate/kinds/same-name/tables-file-of.d.ts +5 -0
- package/dist/generate/kinds/same-name/tables-file-of.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/tables-file-of.js +6 -0
- package/dist/generate/kinds/same-name/tables-file-of.js.map +1 -0
- package/dist/generate/kinds/same-name/tables-files-held.d.ts +9 -0
- package/dist/generate/kinds/same-name/tables-files-held.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/tables-files-held.js +14 -0
- package/dist/generate/kinds/same-name/tables-files-held.js.map +1 -0
- package/dist/generate/kinds/same-name/unread-note.d.ts +22 -0
- package/dist/generate/kinds/same-name/unread-note.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/unread-note.js +76 -0
- package/dist/generate/kinds/same-name/unread-note.js.map +1 -0
- package/dist/generate/kinds/same-name/unseen-shares.d.ts +14 -0
- package/dist/generate/kinds/same-name/unseen-shares.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/unseen-shares.js +23 -0
- package/dist/generate/kinds/same-name/unseen-shares.js.map +1 -0
- package/dist/generate/kinds/same-name/workspace-index.d.ts +6 -0
- package/dist/generate/kinds/same-name/workspace-index.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/workspace-index.js +13 -0
- package/dist/generate/kinds/same-name/workspace-index.js.map +1 -0
- package/dist/generate/kinds/same-name/workspace-sources.d.ts +9 -0
- package/dist/generate/kinds/same-name/workspace-sources.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/workspace-sources.js +10 -0
- package/dist/generate/kinds/same-name/workspace-sources.js.map +1 -0
- package/dist/generate/kinds/same-name/yield-to-the-trunk.d.ts +14 -0
- package/dist/generate/kinds/same-name/yield-to-the-trunk.d.ts.map +1 -0
- package/dist/generate/kinds/same-name/yield-to-the-trunk.js +59 -0
- package/dist/generate/kinds/same-name/yield-to-the-trunk.js.map +1 -0
- package/dist/generator-lock/held-lock-refusal.d.ts.map +1 -1
- package/dist/generator-lock/held-lock-refusal.js +1 -7
- package/dist/generator-lock/held-lock-refusal.js.map +1 -1
- package/dist/generator-lock/holder-text.d.ts +4 -0
- package/dist/generator-lock/holder-text.d.ts.map +1 -0
- package/dist/generator-lock/holder-text.js +10 -0
- package/dist/generator-lock/holder-text.js.map +1 -0
- package/dist/generator-lock/index.d.ts +4 -0
- package/dist/generator-lock/index.d.ts.map +1 -1
- package/dist/generator-lock/index.js +2 -0
- package/dist/generator-lock/index.js.map +1 -1
- package/dist/generator-lock/with-folder-lock.d.ts +27 -0
- package/dist/generator-lock/with-folder-lock.d.ts.map +1 -0
- package/dist/generator-lock/with-folder-lock.js +65 -0
- package/dist/generator-lock/with-folder-lock.js.map +1 -0
- package/dist/generator-lock/with-generator-lock.d.ts +1 -5
- package/dist/generator-lock/with-generator-lock.d.ts.map +1 -1
- package/dist/generator-lock/with-generator-lock.js +11 -58
- package/dist/generator-lock/with-generator-lock.js.map +1 -1
- package/dist/help/tool-notes.d.ts.map +1 -1
- package/dist/help/tool-notes.js +12 -0
- package/dist/help/tool-notes.js.map +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +1 -0
- package/dist/help/usage.js.map +1 -1
- package/dist/help/work-notes.d.ts.map +1 -1
- package/dist/help/work-notes.js +6 -3
- package/dist/help/work-notes.js.map +1 -1
- package/dist/init/end-of-the-index.d.ts +9 -0
- package/dist/init/end-of-the-index.d.ts.map +1 -0
- package/dist/init/end-of-the-index.js +13 -0
- package/dist/init/end-of-the-index.js.map +1 -0
- package/dist/init/laid-out.d.ts +3 -0
- package/dist/init/laid-out.d.ts.map +1 -0
- package/dist/init/laid-out.js +7 -0
- package/dist/init/laid-out.js.map +1 -0
- package/dist/init/list-read-models.d.ts +11 -8
- package/dist/init/list-read-models.d.ts.map +1 -1
- package/dist/init/list-read-models.js +55 -55
- package/dist/init/list-read-models.js.map +1 -1
- package/dist/init/manifest/prisma-client-script.js +1 -1
- package/dist/init/manifest/prisma-client-script.js.map +1 -1
- package/dist/init/manifest/versions.js +33 -33
- package/dist/init/rewire-contexts.d.ts.map +1 -1
- package/dist/init/rewire-contexts.js +2 -0
- package/dist/init/rewire-contexts.js.map +1 -1
- package/dist/init/rewire-tables.d.ts.map +1 -1
- package/dist/init/rewire-tables.js +18 -10
- package/dist/init/rewire-tables.js.map +1 -1
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +3 -7
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/settle-index-names.d.ts +11 -0
- package/dist/init/settle-index-names.d.ts.map +1 -0
- package/dist/init/settle-index-names.js +89 -0
- package/dist/init/settle-index-names.js.map +1 -0
- package/dist/merge/accept-in-merge-message.d.ts.map +1 -1
- package/dist/merge/accept-in-merge-message.js +2 -7
- package/dist/merge/accept-in-merge-message.js.map +1 -1
- package/dist/merge/as-settled.d.ts +7 -0
- package/dist/merge/as-settled.d.ts.map +1 -0
- package/dist/merge/as-settled.js +9 -0
- package/dist/merge/as-settled.js.map +1 -0
- package/dist/merge/config-of-the-merge.d.ts +12 -0
- package/dist/merge/config-of-the-merge.d.ts.map +1 -0
- package/dist/merge/config-of-the-merge.js +35 -0
- package/dist/merge/config-of-the-merge.js.map +1 -0
- package/dist/merge/continue-merge.d.ts.map +1 -1
- package/dist/merge/continue-merge.js +32 -1
- package/dist/merge/continue-merge.js.map +1 -1
- package/dist/merge/lines-at-moved-places.d.ts +10 -0
- package/dist/merge/lines-at-moved-places.d.ts.map +1 -0
- package/dist/merge/lines-at-moved-places.js +38 -0
- package/dist/merge/lines-at-moved-places.js.map +1 -0
- package/dist/merge/lost/in-progress-merge.d.ts.map +1 -1
- package/dist/merge/lost/in-progress-merge.js +6 -2
- package/dist/merge/lost/in-progress-merge.js.map +1 -1
- package/dist/merge/lost/line-findings.d.ts +3 -2
- package/dist/merge/lost/line-findings.d.ts.map +1 -1
- package/dist/merge/lost/line-findings.js +5 -4
- package/dist/merge/lost/line-findings.js.map +1 -1
- package/dist/merge/lost/line-key.d.ts +7 -0
- package/dist/merge/lost/line-key.d.ts.map +1 -0
- package/dist/merge/lost/line-key.js +11 -0
- package/dist/merge/lost/line-key.js.map +1 -0
- package/dist/merge/lost/lost-lines.d.ts +1 -1
- package/dist/merge/lost/lost-lines.d.ts.map +1 -1
- package/dist/merge/lost/lost-lines.js +3 -2
- package/dist/merge/lost/lost-lines.js.map +1 -1
- package/dist/merge/lost/merge-of-record.d.ts.map +1 -1
- package/dist/merge/lost/merge-of-record.js +1 -0
- package/dist/merge/lost/merge-of-record.js.map +1 -1
- package/dist/merge/lost/merge-records.d.ts +2 -0
- package/dist/merge/lost/merge-records.d.ts.map +1 -1
- package/dist/merge/lost/merge-records.js +3 -2
- package/dist/merge/lost/merge-records.js.map +1 -1
- package/dist/merge/lost/merge-to-verify.d.ts +2 -0
- package/dist/merge/lost/merge-to-verify.d.ts.map +1 -1
- package/dist/merge/lost/rewritten-in-place.d.ts +5 -2
- package/dist/merge/lost/rewritten-in-place.d.ts.map +1 -1
- package/dist/merge/lost/rewritten-in-place.js +6 -5
- package/dist/merge/lost/rewritten-in-place.js.map +1 -1
- package/dist/merge/lost/verify-merge.d.ts.map +1 -1
- package/dist/merge/lost/verify-merge.js +10 -3
- package/dist/merge/lost/verify-merge.js.map +1 -1
- package/dist/merge/merge-state.d.ts +2 -0
- package/dist/merge/merge-state.d.ts.map +1 -1
- package/dist/merge/merge-state.js +3 -2
- package/dist/merge/merge-state.js.map +1 -1
- package/dist/merge/merge-trunk.d.ts.map +1 -1
- package/dist/merge/merge-trunk.js +3 -1
- package/dist/merge/merge-trunk.js.map +1 -1
- package/dist/merge/merged-tree-workspace.d.ts +19 -0
- package/dist/merge/merged-tree-workspace.d.ts.map +1 -0
- package/dist/merge/merged-tree-workspace.js +41 -0
- package/dist/merge/merged-tree-workspace.js.map +1 -0
- package/dist/merge/moved-tables-files.d.ts +9 -0
- package/dist/merge/moved-tables-files.d.ts.map +1 -0
- package/dist/merge/moved-tables-files.js +16 -0
- package/dist/merge/moved-tables-files.js.map +1 -0
- package/dist/merge/preview-table-names.d.ts +21 -0
- package/dist/merge/preview-table-names.d.ts.map +1 -0
- package/dist/merge/preview-table-names.js +85 -0
- package/dist/merge/preview-table-names.js.map +1 -0
- package/dist/merge/settle-table-names.d.ts +21 -0
- package/dist/merge/settle-table-names.d.ts.map +1 -0
- package/dist/merge/settle-table-names.js +60 -0
- package/dist/merge/settle-table-names.js.map +1 -0
- package/dist/merge/side-index.d.ts +13 -0
- package/dist/merge/side-index.d.ts.map +1 -0
- package/dist/merge/side-index.js +43 -0
- package/dist/merge/side-index.js.map +1 -0
- package/dist/merge/side-reader.d.ts +8 -0
- package/dist/merge/side-reader.d.ts.map +1 -0
- package/dist/merge/side-reader.js +13 -0
- package/dist/merge/side-reader.js.map +1 -0
- package/dist/merge/side-tables-file.d.ts +5 -0
- package/dist/merge/side-tables-file.d.ts.map +1 -0
- package/dist/merge/side-tables-file.js +10 -0
- package/dist/merge/side-tables-file.js.map +1 -0
- package/dist/merge/table-names-settled.d.ts +18 -0
- package/dist/merge/table-names-settled.d.ts.map +1 -0
- package/dist/merge/table-names-settled.js +168 -0
- package/dist/merge/table-names-settled.js.map +1 -0
- package/dist/merge/trailer-in-merge-message.d.ts +9 -0
- package/dist/merge/trailer-in-merge-message.d.ts.map +1 -0
- package/dist/merge/trailer-in-merge-message.js +16 -0
- package/dist/merge/trailer-in-merge-message.js.map +1 -0
- package/dist/merge/tree-files.d.ts +21 -0
- package/dist/merge/tree-files.d.ts.map +1 -0
- package/dist/merge/tree-files.js +86 -0
- package/dist/merge/tree-files.js.map +1 -0
- package/dist/merge/trunk-reader.d.ts +5 -0
- package/dist/merge/trunk-reader.d.ts.map +1 -0
- package/dist/merge/trunk-reader.js +9 -0
- package/dist/merge/trunk-reader.js.map +1 -0
- package/dist/merge/two-tables-files.d.ts +19 -0
- package/dist/merge/two-tables-files.d.ts.map +1 -0
- package/dist/merge/two-tables-files.js +67 -0
- package/dist/merge/two-tables-files.js.map +1 -0
- package/dist/migration/file-of-source.d.ts +3 -0
- package/dist/migration/file-of-source.d.ts.map +1 -0
- package/dist/migration/file-of-source.js +5 -0
- package/dist/migration/file-of-source.js.map +1 -0
- package/dist/migration/hidden-in-index.d.ts +15 -0
- package/dist/migration/hidden-in-index.d.ts.map +1 -0
- package/dist/migration/hidden-in-index.js +23 -0
- package/dist/migration/hidden-in-index.js.map +1 -0
- package/dist/migration/index.d.ts +2 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +2 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/is-source-of-context.d.ts +17 -0
- package/dist/migration/is-source-of-context.d.ts.map +1 -0
- package/dist/migration/is-source-of-context.js +13 -0
- package/dist/migration/is-source-of-context.js.map +1 -0
- package/dist/migration/listed-in-index.d.ts +15 -3
- package/dist/migration/listed-in-index.d.ts.map +1 -1
- package/dist/migration/listed-in-index.js +25 -4
- package/dist/migration/listed-in-index.js.map +1 -1
- package/dist/migration/named-bindings-of.d.ts +14 -0
- package/dist/migration/named-bindings-of.d.ts.map +1 -0
- package/dist/migration/named-bindings-of.js +21 -0
- package/dist/migration/named-bindings-of.js.map +1 -0
- package/dist/migration/warn-dropped-context-tables.d.ts.map +1 -1
- package/dist/migration/warn-dropped-context-tables.js +21 -6
- package/dist/migration/warn-dropped-context-tables.js.map +1 -1
- package/dist/prisma-client/client-outputs.d.ts +3 -0
- package/dist/prisma-client/client-outputs.d.ts.map +1 -0
- package/dist/prisma-client/client-outputs.js +9 -0
- package/dist/prisma-client/client-outputs.js.map +1 -0
- package/dist/prisma-client/index.d.ts +4 -0
- package/dist/prisma-client/index.d.ts.map +1 -0
- package/dist/prisma-client/index.js +4 -0
- package/dist/prisma-client/index.js.map +1 -0
- package/dist/prisma-client/prisma-client-fingerprint.d.ts +7 -0
- package/dist/prisma-client/prisma-client-fingerprint.d.ts.map +1 -0
- package/dist/prisma-client/prisma-client-fingerprint.js +32 -0
- package/dist/prisma-client/prisma-client-fingerprint.js.map +1 -0
- package/dist/prisma-client/prisma-client-in-turn.d.ts +14 -0
- package/dist/prisma-client/prisma-client-in-turn.d.ts.map +1 -0
- package/dist/prisma-client/prisma-client-in-turn.js +15 -0
- package/dist/prisma-client/prisma-client-in-turn.js.map +1 -0
- package/dist/prisma-client/prisma-client-lock-refusal.d.ts +5 -0
- package/dist/prisma-client/prisma-client-lock-refusal.d.ts.map +1 -0
- package/dist/prisma-client/prisma-client-lock-refusal.js +11 -0
- package/dist/prisma-client/prisma-client-lock-refusal.js.map +1 -0
- package/dist/prisma-client/prisma-client-paths.d.ts +7 -0
- package/dist/prisma-client/prisma-client-paths.d.ts.map +1 -0
- package/dist/prisma-client/prisma-client-paths.js +8 -0
- package/dist/prisma-client/prisma-client-paths.js.map +1 -0
- package/dist/prisma-client/refresh-prisma-client.d.ts +16 -0
- package/dist/prisma-client/refresh-prisma-client.d.ts.map +1 -0
- package/dist/prisma-client/refresh-prisma-client.js +53 -0
- package/dist/prisma-client/refresh-prisma-client.js.map +1 -0
- package/dist/prisma-client/schema-files.d.ts +3 -0
- package/dist/prisma-client/schema-files.d.ts.map +1 -0
- package/dist/prisma-client/schema-files.js +18 -0
- package/dist/prisma-client/schema-files.js.map +1 -0
- package/dist/prisma-schema/single-prisma-schema-steps.js +1 -1
- package/dist/prisma-schema/single-prisma-schema-steps.js.map +1 -1
- package/dist/read-models/buildable-constructor.d.ts +3 -0
- package/dist/read-models/buildable-constructor.d.ts.map +1 -0
- package/dist/read-models/buildable-constructor.js +3 -0
- package/dist/read-models/buildable-constructor.js.map +1 -0
- package/dist/read-models/declared-class.d.ts +14 -0
- package/dist/read-models/declared-class.d.ts.map +1 -0
- package/dist/read-models/declared-class.js +2 -0
- package/dist/read-models/declared-class.js.map +1 -0
- package/dist/read-models/declared-classes.d.ts +32 -0
- package/dist/read-models/declared-classes.d.ts.map +1 -0
- package/dist/read-models/declared-classes.js +123 -0
- package/dist/read-models/declared-classes.js.map +1 -0
- package/dist/read-models/list-answers.d.ts +35 -0
- package/dist/read-models/list-answers.d.ts.map +1 -0
- package/dist/read-models/list-answers.js +53 -0
- package/dist/read-models/list-answers.js.map +1 -0
- package/dist/read-models/listing-of.d.ts +25 -0
- package/dist/read-models/listing-of.d.ts.map +1 -0
- package/dist/read-models/listing-of.js +22 -0
- package/dist/read-models/listing-of.js.map +1 -0
- package/dist/read-models/read-model-list-of.d.ts +12 -0
- package/dist/read-models/read-model-list-of.d.ts.map +1 -0
- package/dist/read-models/read-model-list-of.js +94 -0
- package/dist/read-models/read-model-list-of.js.map +1 -0
- package/dist/read-models/read-model-list.d.ts +41 -0
- package/dist/read-models/read-model-list.d.ts.map +1 -0
- package/dist/read-models/read-model-list.js +2 -0
- package/dist/read-models/read-model-list.js.map +1 -0
- package/dist/read-models/read-model-store.d.ts +16 -0
- package/dist/read-models/read-model-store.d.ts.map +1 -0
- package/dist/read-models/read-model-store.js +2 -0
- package/dist/read-models/read-model-store.js.map +1 -0
- package/dist/read-models/read-model-stores-of.d.ts +14 -0
- package/dist/read-models/read-model-stores-of.d.ts.map +1 -0
- package/dist/read-models/read-model-stores-of.js +63 -0
- package/dist/read-models/read-model-stores-of.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- package/dist/slice/storage-of-slice.d.ts +10 -7
- package/dist/slice/storage-of-slice.d.ts.map +1 -1
- package/dist/slice/storage-of-slice.js +145 -22
- package/dist/slice/storage-of-slice.js.map +1 -1
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +10 -1
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workspace/exit-code-of.d.ts +2 -2
- package/dist/workspace/exit-code-of.d.ts.map +1 -1
- package/dist/workspace/exit-code-of.js +2 -2
- package/dist/workspace/exit-code-of.js.map +1 -1
- package/dist/workspace/located-step.d.ts +5 -0
- package/dist/workspace/located-step.d.ts.map +1 -0
- package/dist/workspace/located-step.js +7 -0
- package/dist/workspace/located-step.js.map +1 -0
- package/dist/workspace/remove-file.d.ts +3 -0
- package/dist/workspace/remove-file.d.ts.map +1 -0
- package/dist/workspace/remove-file.js +11 -0
- package/dist/workspace/remove-file.js.map +1 -0
- package/dist/workspace/workspace-report.d.ts +2 -0
- package/dist/workspace/workspace-report.d.ts.map +1 -1
- package/dist/workspace/workspace.d.ts +4 -3
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/dist/workspace/workspace.js +16 -16
- package/dist/workspace/workspace.js.map +1 -1
- package/package.json +6 -6
- package/templates/init/docker/dockerignore.tpl +2 -0
- package/templates/init/platform/database/read-model-tables.ts.tpl +7 -4
- package/templates/init/rules/infrastructure.md.tpl +3 -0
- package/templates/pipeline/biome.json.tpl +1 -1
- package/templates/pipeline/github/workflows/codeql.yml +2 -2
- package/templates/pipeline/package-scripts.json +2 -2
- package/templates/repository/typeorm/schema-export.tpl +2 -2
- package/templates/read-model/typeorm/schema-export.tpl +0 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { indexExports } from './index-exports.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the files the index re-exports whole export that the index exports under no name, each `<origin>` with the
|
|
4
|
+
* kind it is: a value the index does not export as a value, a line written `export type` never
|
|
5
|
+
* counting for one, and a type it exports neither as a type nor with its value.
|
|
6
|
+
*/
|
|
7
|
+
export function hiddenSymbols(reading) {
|
|
8
|
+
const exported = [...indexExports(reading).values()];
|
|
9
|
+
const values = new Set(exported.flatMap(({ value }) => (value === undefined ? [] : [value])));
|
|
10
|
+
const types = new Set(exported.flatMap(({ type }) => (type === undefined ? [] : [type])));
|
|
11
|
+
const symbols = reading.stars.flatMap(({ symbols: held }) => held);
|
|
12
|
+
return [
|
|
13
|
+
...new Set(symbols
|
|
14
|
+
.filter(({ kind, origin }) => !(kind === 'value' ? values : types).has(origin))
|
|
15
|
+
.map(({ kind, origin }) => `${origin}${kind === 'type' ? ' (a type)' : ''}`)),
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=hidden-symbols.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden-symbols.js","sourceRoot":"","sources":["../../../../src/generate/kinds/same-name/hidden-symbols.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAqB;IACjD,MAAM,QAAQ,GAAG,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9F,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IAEnE,OAAO;QACL,GAAG,IAAI,GAAG,CACR,OAAO;aACJ,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;aAC9E,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAC/E;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Config } from '../../../config/index.js';
|
|
2
|
+
import type { Workspace } from '../../../workspace/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* On TypeORM the kit writes no name of the schema index after a merge, in `merge-trunk` or
|
|
5
|
+
* `init --force`: it cannot tell by the code whether two imports of one name are two entities or
|
|
6
|
+
* one. Each name the region of the imports gives more than once is said, once, with the files it
|
|
7
|
+
* comes from, and what to write by hand either way. Answers nothing when no name is given twice.
|
|
8
|
+
*/
|
|
9
|
+
export declare function importedTwiceNotes(ws: Workspace, config: Config): string[];
|
|
10
|
+
//# sourceMappingURL=imported-twice-notes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imported-twice-notes.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/same-name/imported-twice-notes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAoB1E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { namedBindingsOf } from '../../../migration/index.js';
|
|
2
|
+
import { regionOf } from './region-of.js';
|
|
3
|
+
import { workspaceSources } from './workspace-sources.js';
|
|
4
|
+
/**
|
|
5
|
+
* On TypeORM the kit writes no name of the schema index after a merge, in `merge-trunk` or
|
|
6
|
+
* `init --force`: it cannot tell by the code whether two imports of one name are two entities or
|
|
7
|
+
* one. Each name the region of the imports gives more than once is said, once, with the files it
|
|
8
|
+
* comes from, and what to write by hand either way. Answers nothing when no name is given twice.
|
|
9
|
+
*/
|
|
10
|
+
export function importedTwiceNotes(ws, config) {
|
|
11
|
+
const index = `${config.platformDir}/database/schema.ts`;
|
|
12
|
+
const sources = workspaceSources(ws, config);
|
|
13
|
+
const imports = namedBindingsOf(regionOf(ws.read(index) ?? '', 'imports'), 'import').flatMap(({ source, names }) => {
|
|
14
|
+
const resolved = sources.resolve(index, source);
|
|
15
|
+
const file = resolved.kind === 'file' ? resolved.path : source;
|
|
16
|
+
return names.map(({ local }) => ({ local, file }));
|
|
17
|
+
});
|
|
18
|
+
const twice = [...new Set(imports.map(({ local }) => local))].filter((local) => imports.filter((held) => held.local === local).length > 1);
|
|
19
|
+
return twice.map((local) => {
|
|
20
|
+
const files = imports.filter((held) => held.local === local).map(({ file }) => file);
|
|
21
|
+
return `${index}: imports \`${local}\` ${files.length} times (from ${files.join(', ')}); the kit writes no name on TypeORM after a merge: if they are distinct entities, import each but one under its own name and list that name in \`entities\`; if they are one entity, take out the extra import.`;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=imported-twice-notes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imported-twice-notes.js","sourceRoot":"","sources":["../../../../src/generate/kinds/same-name/imported-twice-notes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAa,EAAE,MAAc;IAC9D,MAAM,KAAK,GAAG,GAAG,MAAM,CAAC,WAAW,qBAAqB,CAAC;IACzD,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAE7C,MAAM,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QACjH,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;QAE/D,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAClE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CACrE,CAAC;IAEF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACzB,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QAErF,OAAO,GAAG,KAAK,eAAe,KAAK,MAAM,KAAK,CAAC,MAAM,gBAAgB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kNAAkN,CAAC;IAC1S,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IndexReading } from './index-reading.js';
|
|
2
|
+
import { type Bound } from './symbol-of.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a schema index exports under each name, as the compiler resolves it, each by the place that
|
|
5
|
+
* declares it. A name the index declares or exports by name is that and nothing else: it shadows
|
|
6
|
+
* what the `export *` lines bring under it, a line written `export type` giving it no value at
|
|
7
|
+
* all. A name the `export *` lines alone bring is exported when every file that holds it holds the
|
|
8
|
+
* same symbol; several symbols under one name are exported by none.
|
|
9
|
+
*/
|
|
10
|
+
export declare function indexExports(reading: IndexReading): Map<string, Bound>;
|
|
11
|
+
//# sourceMappingURL=index-exports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-exports.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/same-name/index-exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,aAAa,CAAC;AAEnD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAsBtE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { signatureOf } from './signature-of.js';
|
|
2
|
+
import { symbolOf } from './symbol-of.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a schema index exports under each name, as the compiler resolves it, each by the place that
|
|
5
|
+
* declares it. A name the index declares or exports by name is that and nothing else: it shadows
|
|
6
|
+
* what the `export *` lines bring under it, a line written `export type` giving it no value at
|
|
7
|
+
* all. A name the `export *` lines alone bring is exported when every file that holds it holds the
|
|
8
|
+
* same symbol; several symbols under one name are exported by none.
|
|
9
|
+
*/
|
|
10
|
+
export function indexExports(reading) {
|
|
11
|
+
const exported = new Map();
|
|
12
|
+
const join = (name, bound) => void exported.set(name, { ...exported.get(name), ...bound });
|
|
13
|
+
reading.values.forEach((name) => join(name, { value: `${reading.index}#${name}` }));
|
|
14
|
+
reading.types.forEach((name) => join(name, { type: `${reading.index}#${name}` }));
|
|
15
|
+
for (const { local, value, type } of reading.given) {
|
|
16
|
+
join(local, { ...(value === undefined ? {} : { value }), ...(type === undefined ? {} : { type }) });
|
|
17
|
+
}
|
|
18
|
+
const explicit = new Set(exported.keys());
|
|
19
|
+
for (const name of new Set(reading.stars.flatMap(({ symbols }) => symbols.map((symbol) => symbol.name)))) {
|
|
20
|
+
const held = reading.stars.map((star) => symbolOf(star, name)).filter((bound) => signatureOf(bound) !== '|');
|
|
21
|
+
if (!explicit.has(name) && new Set(held.map(signatureOf)).size === 1) {
|
|
22
|
+
exported.set(name, held[0] ?? {});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return exported;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index-exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAE1C,KAAK,MAAM,IAAI,IAAI,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACzG,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;QAE7G,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACrE,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Config } from '../../../config/index.js';
|
|
2
|
+
import type { Workspace } from '../../../workspace/index.js';
|
|
3
|
+
/** What a schema index gives the migration tooling at one moment: taken before a command writes it, and after. */
|
|
4
|
+
export interface IndexPicture {
|
|
5
|
+
/** The index as it stood. */
|
|
6
|
+
readonly text: string | undefined;
|
|
7
|
+
/** On Drizzle, the value each name exports, by the place that declares it; a name that does not compile exports none. */
|
|
8
|
+
readonly names: ReadonlyMap<string, string>;
|
|
9
|
+
/** Every table within reach: on Drizzle a value exported under a name, on TypeORM an entity listed in `entities`. */
|
|
10
|
+
readonly reachable: ReadonlySet<string>;
|
|
11
|
+
/** What the index re-exports, or itself holds, that is not read with certainty: what it exports is out of the picture. */
|
|
12
|
+
readonly unread: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* While something is not read with certainty, the names files read with certainty export
|
|
15
|
+
* different values under, which only a line by name settles: the settle wrote none, and its
|
|
16
|
+
* note says so and who keeps each.
|
|
17
|
+
*/
|
|
18
|
+
readonly toTheSettle: ReadonlySet<string>;
|
|
19
|
+
/** On Drizzle, the file or the package the index takes each name from, as its line names it: not the place that declares the value. */
|
|
20
|
+
readonly givers: ReadonlyMap<string, string>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The picture of the schema index a workspace holds. On Drizzle, what each name exports as a
|
|
24
|
+
* value, read as the compiler resolves it. On TypeORM, the entities its `entities` lists, each by
|
|
25
|
+
* the file it is imported from, resolved, and its name there: the names of the imports are local
|
|
26
|
+
* to the index. On another ORM, nothing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function indexPicture(ws: Workspace, config: Config): IndexPicture;
|
|
29
|
+
//# sourceMappingURL=index-picture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-picture.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/same-name/index-picture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQpD,kHAAkH;AAClH,MAAM,WAAW,YAAY;IAC3B,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,yHAAyH;IACzH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,qHAAqH;IACrH,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,0HAA0H;IAC1H,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C,uIAAuI;IACvI,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAiCxE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { workspaceSources } from './workspace-sources.js';
|
|
2
|
+
import { namedBindingsOf } from '../../../migration/index.js';
|
|
3
|
+
import { entitiesList } from './entities-list.js';
|
|
4
|
+
import { readTablesFile } from './read-tables-file.js';
|
|
5
|
+
import { indexExports } from './index-exports.js';
|
|
6
|
+
import { linesToSettle } from './lines-to-settle.js';
|
|
7
|
+
import { workspaceIndex } from './workspace-index.js';
|
|
8
|
+
/**
|
|
9
|
+
* The picture of the schema index a workspace holds. On Drizzle, what each name exports as a
|
|
10
|
+
* value, read as the compiler resolves it. On TypeORM, the entities its `entities` lists, each by
|
|
11
|
+
* the file it is imported from, resolved, and its name there: the names of the imports are local
|
|
12
|
+
* to the index. On another ORM, nothing.
|
|
13
|
+
*/
|
|
14
|
+
export function indexPicture(ws, config) {
|
|
15
|
+
const index = `${config.platformDir}/database/schema.ts`;
|
|
16
|
+
const text = ws.read(index);
|
|
17
|
+
const none = emptyPicture(text);
|
|
18
|
+
if (text === undefined || !['drizzle', 'typeorm'].includes(config.stack.orm)) {
|
|
19
|
+
return none;
|
|
20
|
+
}
|
|
21
|
+
if (config.stack.orm === 'typeorm') {
|
|
22
|
+
return { ...none, reachable: entitiesListed(ws, config, { index, text }) };
|
|
23
|
+
}
|
|
24
|
+
const reading = workspaceIndex(ws, config);
|
|
25
|
+
const isCertain = reading.unread.length === 0;
|
|
26
|
+
const exported = [...indexExports(reading)];
|
|
27
|
+
// What the index declares itself is the template's: a table is what a file it re-exports or names holds.
|
|
28
|
+
const names = new Map(exported.flatMap(([name, { value }]) => value === undefined || value.startsWith(`${index}#`) ? [] : [[name, value]]));
|
|
29
|
+
return {
|
|
30
|
+
text,
|
|
31
|
+
names,
|
|
32
|
+
reachable: new Set(names.values()),
|
|
33
|
+
unread: reading.unreadFiles,
|
|
34
|
+
toTheSettle: new Set(isCertain ? [] : linesToSettle(reading, {}).map(({ constant }) => constant)),
|
|
35
|
+
givers: new Map([...names.keys()].flatMap((name) => giverOf(reading, name))),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** A picture that holds nothing but the text of the index. */
|
|
39
|
+
function emptyPicture(text) {
|
|
40
|
+
return { text, names: new Map(), reachable: new Set(), unread: [], toTheSettle: new Set(), givers: new Map() };
|
|
41
|
+
}
|
|
42
|
+
/** The module the index takes a name from: the one a line by name names, else the file re-exported whole that holds it as a value. */
|
|
43
|
+
function giverOf(reading, name) {
|
|
44
|
+
const given = reading.given.find(({ local }) => local === name);
|
|
45
|
+
const from = given === undefined
|
|
46
|
+
? reading.stars.find(({ symbols }) => symbols.some((symbol) => symbol.name === name && symbol.kind === 'value'))
|
|
47
|
+
?.file
|
|
48
|
+
: (given.file ?? given.source);
|
|
49
|
+
return from === undefined ? [] : [[name, from]];
|
|
50
|
+
}
|
|
51
|
+
function entitiesListed(ws, config, { index, text }) {
|
|
52
|
+
const sources = workspaceSources(ws, config);
|
|
53
|
+
const listed = new Set(entitiesList(text));
|
|
54
|
+
return new Set(namedBindingsOf(text, 'import').flatMap(({ source, names }) => {
|
|
55
|
+
const resolved = sources.resolve(index, source);
|
|
56
|
+
const from = resolved.kind === 'file' ? resolved.path : source;
|
|
57
|
+
const read = resolved.kind === 'file' ? readTablesFile(sources, resolved.path) : undefined;
|
|
58
|
+
// An entity its file, read with certainty, no longer exports is listed in name only: the index does not compile.
|
|
59
|
+
const isThere = (name) => read === undefined || read.unread.length > 0 || read.symbols.some((symbol) => symbol.name === name);
|
|
60
|
+
return names.filter(({ local, name }) => listed.has(local) && isThere(name)).map(({ name }) => `${from}#${name}`);
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=index-picture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-picture.js","sourceRoot":"","sources":["../../../../src/generate/kinds/same-name/index-picture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAsBnD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAa,EAAE,MAAc;IACxD,MAAM,KAAK,GAAG,GAAG,MAAM,CAAC,WAAW,qBAAqB,CAAC;IACzD,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE5B,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAEhC,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;I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AAM,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE3F,iHAAiH;QACjH,MAAM,OAAO,GAAG,CAAC,IAAY,EAAW,EAAE,CACxC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAEtG,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACpH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Config } from '../../../config/index.js';
|
|
2
|
+
import { type ExportedSymbol } from './read-tables-file.js';
|
|
3
|
+
import { type FileReader } from './sources-of.js';
|
|
4
|
+
/** A file of the project the index re-exports whole: the tables file of a context, or another module, read for what it is. */
|
|
5
|
+
export interface StarModule {
|
|
6
|
+
/** The context whose tables file it is; undefined for any other file of the project. */
|
|
7
|
+
readonly context: string | undefined;
|
|
8
|
+
/** The module as the index names it. */
|
|
9
|
+
readonly source: string;
|
|
10
|
+
/** The file, from the project root. */
|
|
11
|
+
readonly file: string;
|
|
12
|
+
/** What it exports, each with the place that declares it. */
|
|
13
|
+
readonly symbols: readonly ExportedSymbol[];
|
|
14
|
+
/** Why the file is not read with certainty; empty when it is. */
|
|
15
|
+
readonly unread: readonly string[];
|
|
16
|
+
/** Whether it, or a module it re-exports whole, is not looked into: it may export any name. */
|
|
17
|
+
readonly isBlind?: true;
|
|
18
|
+
}
|
|
19
|
+
/** The tables file of a context the index re-exports whole. */
|
|
20
|
+
interface TablesOfContext extends StarModule {
|
|
21
|
+
readonly context: string;
|
|
22
|
+
}
|
|
23
|
+
/** A name the index exports by name from a module, with what it is there. */
|
|
24
|
+
interface GivenName {
|
|
25
|
+
/** The name the index exports. */
|
|
26
|
+
readonly local: string;
|
|
27
|
+
/** The name the module calls it. */
|
|
28
|
+
readonly name: string;
|
|
29
|
+
/** The module, as the index names it. */
|
|
30
|
+
readonly source: string;
|
|
31
|
+
/** The file of the project it comes from; undefined for a package. */
|
|
32
|
+
readonly file: string | undefined;
|
|
33
|
+
/** The origin of its value, when the line exports one. */
|
|
34
|
+
readonly value?: string;
|
|
35
|
+
/** The origin of its type. */
|
|
36
|
+
readonly type?: string;
|
|
37
|
+
}
|
|
38
|
+
/** The schema index of a Drizzle project and the files it re-exports, as far as they are read with certainty. */
|
|
39
|
+
export interface IndexReading {
|
|
40
|
+
/** The index, from the project root. */
|
|
41
|
+
readonly index: string;
|
|
42
|
+
readonly text: string;
|
|
43
|
+
/** The names the index declares itself, as values. */
|
|
44
|
+
readonly values: readonly string[];
|
|
45
|
+
/** The names it declares itself, as types. */
|
|
46
|
+
readonly types: readonly string[];
|
|
47
|
+
/** The names it exports from a module by name. */
|
|
48
|
+
readonly given: readonly GivenName[];
|
|
49
|
+
/** The files of the project it re-exports whole, in its order, each once. */
|
|
50
|
+
readonly stars: readonly StarModule[];
|
|
51
|
+
/** Those of `stars` that are the tables file of a context. */
|
|
52
|
+
readonly tables: readonly TablesOfContext[];
|
|
53
|
+
/** The code of each `export` of the index that is not read. */
|
|
54
|
+
readonly doubts: readonly string[];
|
|
55
|
+
/** Why the index, or a file it re-exports, is not read with certainty; empty when all of it is. */
|
|
56
|
+
readonly unread: readonly string[];
|
|
57
|
+
/** What the index re-exports whole and the kit does not look into, each file or module once: it may export any name. */
|
|
58
|
+
readonly blind: readonly string[];
|
|
59
|
+
/** What is not read with certainty, each once: the index itself, a file of the project, or a module as the index names it. */
|
|
60
|
+
readonly unreadFiles: readonly string[];
|
|
61
|
+
}
|
|
62
|
+
/** Where the index and the tables files are read. */
|
|
63
|
+
export interface IndexSource {
|
|
64
|
+
/** The index, from the project root. */
|
|
65
|
+
readonly index: string;
|
|
66
|
+
readonly read: FileReader;
|
|
67
|
+
/** The tables file of a context, from the project root. */
|
|
68
|
+
readonly tablesFile: (context: string) => string;
|
|
69
|
+
/** The path a file is read at, in the module of the model that holds it. */
|
|
70
|
+
readonly place?: (file: string) => string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Reads the schema index and every file of the project it re-exports whole or takes names from,
|
|
74
|
+
* each specifier resolved the one way (`sourcesOf`). A module it re-exports whole is the tables
|
|
75
|
+
* file of a context when it resolves to that file, whatever it is called and however it is named;
|
|
76
|
+
* any other file of the project is read for what it is, and its exports take part under their own
|
|
77
|
+
* origin. A package re-exported whole, a specifier that resolves to nothing, and any export the
|
|
78
|
+
* reader does not answer for, in the index or in a file it reads, make the reading uncertain. A
|
|
79
|
+
* file the index re-exports twice is read once.
|
|
80
|
+
*/
|
|
81
|
+
export declare function readIndex(config: Config, { index, read, tablesFile, place }: IndexSource): IndexReading;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=index-reading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-reading.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/same-name/index-reading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,KAAK,cAAc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AE,CAAC;IACnC,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAC5C,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,mGAAmG;IACnG,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,wHAAwH;IACxH,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,8HAA8H;IAC9H,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,WAAW,GAAG,YAAY,CA+BvG"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { readModule } from './read-module.js';
|
|
2
|
+
import { readTablesFile } from './read-tables-file.js';
|
|
3
|
+
import { sourcesOf } from './sources-of.js';
|
|
4
|
+
/**
|
|
5
|
+
* Reads the schema index and every file of the project it re-exports whole or takes names from,
|
|
6
|
+
* each specifier resolved the one way (`sourcesOf`). A module it re-exports whole is the tables
|
|
7
|
+
* file of a context when it resolves to that file, whatever it is called and however it is named;
|
|
8
|
+
* any other file of the project is read for what it is, and its exports take part under their own
|
|
9
|
+
* origin. A package re-exported whole, a specifier that resolves to nothing, and any export the
|
|
10
|
+
* reader does not answer for, in the index or in a file it reads, make the reading uncertain. A
|
|
11
|
+
* file the index re-exports twice is read once.
|
|
12
|
+
*/
|
|
13
|
+
export function readIndex(config, { index, read, tablesFile, place }) {
|
|
14
|
+
const sources = sourcesOf(config, read, place);
|
|
15
|
+
const text = read(index) ?? '';
|
|
16
|
+
const own = readModule(text);
|
|
17
|
+
const contexts = new Map(Object.keys(config.contexts).map((context) => [tablesFile(context), context]));
|
|
18
|
+
const whole = [...new Set(own.whole)].map((source) => starOf(sources, { index, source, contexts }));
|
|
19
|
+
const files = byFile(whole);
|
|
20
|
+
const given = own.named.flatMap(({ source, names }) => names.map((taken) => givenBy(sources, { index, source, ...taken })));
|
|
21
|
+
return {
|
|
22
|
+
index,
|
|
23
|
+
text,
|
|
24
|
+
values: own.values,
|
|
25
|
+
types: own.types,
|
|
26
|
+
given,
|
|
27
|
+
stars: [...files.values()],
|
|
28
|
+
tables: [...files.values()].filter((star) => star.context !== undefined),
|
|
29
|
+
doubts: own.doubts,
|
|
30
|
+
blind: blindOf(whole),
|
|
31
|
+
unreadFiles: unreadFilesOf(index, { own: own.unread, whole, given }),
|
|
32
|
+
unread: [
|
|
33
|
+
...new Set([
|
|
34
|
+
...own.unread.map((what) => `${index}, ${what}`),
|
|
35
|
+
...whole.flatMap(({ unread }) => unread),
|
|
36
|
+
...given.flatMap((one) => one.unread ?? []),
|
|
37
|
+
]),
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** The files the index re-exports whole, each once: a file two specifiers of the index name, an alias and a relative path, is one file. */
|
|
42
|
+
function byFile(whole) {
|
|
43
|
+
const files = new Map();
|
|
44
|
+
for (const star of whole.flatMap((one) => ('file' in one ? [one] : []))) {
|
|
45
|
+
files.set(star.file, files.get(star.file) ?? star);
|
|
46
|
+
}
|
|
47
|
+
return files;
|
|
48
|
+
}
|
|
49
|
+
/** What the index re-exports whole and the kit does not look into: a file by its path, a module it does not follow as the index names it. */
|
|
50
|
+
function blindOf(whole) {
|
|
51
|
+
return [
|
|
52
|
+
...new Set(whole.flatMap((star) => ('file' in star ? (star.isBlind === true ? [star.file] : []) : [star.source]))),
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
/** What is not read with certainty: the index, what it re-exports whole, what it takes names from. */
|
|
56
|
+
function unreadFilesOf(index, { own, whole, given, }) {
|
|
57
|
+
return [
|
|
58
|
+
...new Set([
|
|
59
|
+
...(own.length > 0 ? [index] : []),
|
|
60
|
+
...whole.flatMap((star) => (star.unread.length === 0 ? [] : ['file' in star ? star.file : star.source])),
|
|
61
|
+
...given.flatMap((one) => (one.unread === undefined ? [] : [one.file ?? one.source])),
|
|
62
|
+
]),
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
function starOf(sources, { index, source, contexts }) {
|
|
66
|
+
const resolved = sources.resolve(index, source);
|
|
67
|
+
if (resolved.kind !== 'file') {
|
|
68
|
+
return { source, unread: [`${index}, which re-exports '${source}', a module the kit does not follow`] };
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
context: contexts.get(resolved.path),
|
|
72
|
+
source,
|
|
73
|
+
file: resolved.path,
|
|
74
|
+
...readTablesFile(sources, resolved.path),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** What a name the index exports by name is: read in the file it comes from, or that name of a package. */
|
|
78
|
+
function givenBy(sources, { index, source, name, local, isType }) {
|
|
79
|
+
const resolved = sources.resolve(index, source);
|
|
80
|
+
// A module the kit does not read: the name and its kind are written here, and the module is the place of what it names.
|
|
81
|
+
if (resolved.kind !== 'file') {
|
|
82
|
+
const origin = `${resolved.kind === 'package' ? resolved.name : source}#${name}`;
|
|
83
|
+
return { local, name, source, file: undefined, type: origin, ...(isType ? {} : { value: origin }) };
|
|
84
|
+
}
|
|
85
|
+
return givenByFile(sources, { index, source, name, local, isType }, resolved.path);
|
|
86
|
+
}
|
|
87
|
+
/** A name the index takes from a file of the project: what that file exports under it, or why it is not read. */
|
|
88
|
+
function givenByFile(sources, { index, source, name, local, isType }, file) {
|
|
89
|
+
const { symbols, unread } = readTablesFile(sources, file);
|
|
90
|
+
const origin = (kind) => symbols.find((symbol) => symbol.name === name && symbol.kind === kind)?.origin;
|
|
91
|
+
const value = origin('value');
|
|
92
|
+
const type = origin('type') ?? value;
|
|
93
|
+
const unknown = `${index}, which exports \`${name}\` from '${source}', where the kit does not read what it is`;
|
|
94
|
+
const why = unread.length > 0 ? [...unread] : type === undefined ? [unknown] : [];
|
|
95
|
+
return {
|
|
96
|
+
local,
|
|
97
|
+
name,
|
|
98
|
+
source,
|
|
99
|
+
file,
|
|
100
|
+
...(isType || value === undefined ? {} : { value }),
|
|
101
|
+
...(type === undefined ? {} : { type }),
|
|
102
|
+
...(why.length > 0 ? { unread: why } : {}),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=index-reading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-reading.js","sourceRoot":"","sources":["../../../../src/generate/kinds/same-name/index-reading.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAuB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAiC,SAAS,EAAE,MAAM,cAAc,CAAC;AA2ExE;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAe;IACvF,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAA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,EAAE,IAAI,CAAC,CAAC;IAE1D,MAAM,MAAM,GAAG,CAAC,IAAsB,EAAsB,EAAE,CAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,MAAM,CAAC;IAEjF,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC;IACrC,MAAM,OAAO,GAAG,GAAG,KAAK,qBAAqB,IAAI,YAAY,MAAM,2CAA2C,CAAC;IAC/G,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAElF,OAAO;QACL,KAAK;QACL,IAAI;QACJ,MAAM;QACN,IAAI;QACJ,GAAG,CAAC,MAAM,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;QACnD,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QACvC,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Config } from '../../../config/index.js';
|
|
2
|
+
import { Workspace } from '../../../workspace/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The last word of a command on the schema index, said once, on the state the command ends in:
|
|
5
|
+
* what the index gave on disk before the command is compared with what the workspace holds when
|
|
6
|
+
* every generator has run. A name the index exported before and exports no more, an entry of
|
|
7
|
+
* `entities` on TypeORM listed no more, or a name that exported one value and exports another: the
|
|
8
|
+
* index is left as it stood on disk, reported as left, the sentences the command noted about its
|
|
9
|
+
* names are taken back, and one note names every name concerned and says what to do. Nothing is done when the picture is
|
|
10
|
+
* kept, nor when an earlier step of the command already left the index. While a file the index
|
|
11
|
+
* re-exports is not read with certainty, before the command or after it, the index is never left:
|
|
12
|
+
* each name lost and each name moved is said hedged, and the command goes on as before; a name
|
|
13
|
+
* files read share is the settle's, whose note says it. Names are compared, not the tables behind
|
|
14
|
+
* them: a table still exported under another name is a name lost.
|
|
15
|
+
*/
|
|
16
|
+
export declare function keepThePicture(ws: Workspace, config: Config, command: 'generate' | 'init'): void;
|
|
17
|
+
//# sourceMappingURL=keep-the-picture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keep-the-picture.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/same-name/keep-the-picture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAgB/C;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAsChG"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { workspaceSources } from './workspace-sources.js';
|
|
2
|
+
import { Workspace } from '../../../workspace/index.js';
|
|
3
|
+
import { contextOfSource } from './context-of-source.js';
|
|
4
|
+
import { indexPicture } from './index-picture.js';
|
|
5
|
+
import { readTablesFile } from './read-tables-file.js';
|
|
6
|
+
/** What a region of the kit holds, between its markers. */
|
|
7
|
+
const REGION = /\/\/ ddd-ts-kit:[\w-]+\n([\s\S]*?)\/\/ \/ddd-ts-kit:[\w-]+/g;
|
|
8
|
+
/**
|
|
9
|
+
* The last word of a command on the schema index, said once, on the state the command ends in:
|
|
10
|
+
* what the index gave on disk before the command is compared with what the workspace holds when
|
|
11
|
+
* every generator has run. A name the index exported before and exports no more, an entry of
|
|
12
|
+
* `entities` on TypeORM listed no more, or a name that exported one value and exports another: the
|
|
13
|
+
* index is left as it stood on disk, reported as left, the sentences the command noted about its
|
|
14
|
+
* names are taken back, and one note names every name concerned and says what to do. Nothing is done when the picture is
|
|
15
|
+
* kept, nor when an earlier step of the command already left the index. While a file the index
|
|
16
|
+
* re-exports is not read with certainty, before the command or after it, the index is never left:
|
|
17
|
+
* each name lost and each name moved is said hedged, and the command goes on as before; a name
|
|
18
|
+
* files read share is the settle's, whose note says it. Names are compared, not the tables behind
|
|
19
|
+
* them: a table still exported under another name is a name lost.
|
|
20
|
+
*/
|
|
21
|
+
export function keepThePicture(ws, config, command) {
|
|
22
|
+
const index = `${config.platformDir}/database/schema.ts`;
|
|
23
|
+
const before = indexPicture(new Workspace(ws.root, false), config);
|
|
24
|
+
const after = indexPicture(ws, config);
|
|
25
|
+
if (before.text === undefined || after.text === undefined) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// An earlier step left the index as it stood: what a later one wrote in it goes too.
|
|
29
|
+
if (ws.notes.some((note) => note.startsWith(`${index} is left as it stood`))) {
|
|
30
|
+
ws.leave(index, before.text);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const { rewritten, why, hedged } = whatChanged(ws, config, { before, after, command });
|
|
34
|
+
// A table the command wrote out of its tables file is not kept by leaving the index: it is said, and the command goes
|
|
35
|
+
// on. What hangs on a module not read is said hedged, when nothing certain leaves the index.
|
|
36
|
+
[...rewritten, ...(why.length === 0 ? hedged : [])].forEach((sentence) => {
|
|
37
|
+
ws.note(`${index}: ${sentence}.`);
|
|
38
|
+
});
|
|
39
|
+
if (why.length === 0) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const told = ws.notes.filter((note) => TOLD.some((said) => note.startsWith(`${index}${said}`)));
|
|
43
|
+
const byHand = told.flatMap((note) => note.match(/^ {2}export .*$/gm) ?? []).map((line) => line.trim());
|
|
44
|
+
const lines = command === 'init' ? [] : [...new Set([...written(before, after), ...byHand])];
|
|
45
|
+
ws.notes.splice(0, ws.notes.length, ...ws.notes.filter((note) => !told.includes(note)));
|
|
46
|
+
ws.leave(index, before.text);
|
|
47
|
+
ws.note(`${index} is left as it stood before the command: ${why.join('; ')}.${toDo(ws, config, { command, lines, names: why.length })}`);
|
|
48
|
+
}
|
|
49
|
+
/** How the notes a step of the command wrote about the names of the index start, after the path of the index: taken back with it. */
|
|
50
|
+
const TOLD = [' lists the ', ': the kit wrote no name in it'];
|
|
51
|
+
/** What a name lost, said once after the last one: the comparison is of names, not of the tables behind them. */
|
|
52
|
+
const NAMES_ONLY = ' (a table still exported under another name is not seen: the kit compares names)';
|
|
53
|
+
/**
|
|
54
|
+
* What the command would change: the names the index exports, compared, not the tables behind
|
|
55
|
+
* them. Every file the index re-exports read with certainty, a name lost or a name moved is
|
|
56
|
+
* certain. While one is not, before the command or after it, what the index exports after it is
|
|
57
|
+
* not known: each is said hedged, and the index is not left.
|
|
58
|
+
*/
|
|
59
|
+
function whatChanged(ws, config, { before, after }) {
|
|
60
|
+
const sources = workspaceSources(ws, config);
|
|
61
|
+
const lost = namesLost(config, { before, after });
|
|
62
|
+
const isRewritten = ({ was }) => isWrittenOut(ws, sources, was);
|
|
63
|
+
const losses = lost.filter((named) => !isRewritten(named) && !after.toTheSettle.has(named.name));
|
|
64
|
+
const moves = [...before.names].flatMap(([name, was]) => {
|
|
65
|
+
const is = after.names.get(name);
|
|
66
|
+
return is === undefined || is === was ? [] : [{ name, was, is, from: before.givers.get(name) ?? fileOf(was) }];
|
|
67
|
+
});
|
|
68
|
+
const unread = { still: after.unread, gone: before.unread.filter((file) => !after.unread.includes(file)) };
|
|
69
|
+
const rewritten = [...new Set(lost.filter(isRewritten).map(({ was }) => was))].map((table) => rewrittenOut(config, table));
|
|
70
|
+
if (unread.still.length + unread.gone.length > 0) {
|
|
71
|
+
return { rewritten, why: [], hedged: [...losses.map(hedgedLoss(unread)), ...moves.map(hedgedMove(unread))] };
|
|
72
|
+
}
|
|
73
|
+
return { rewritten, why: [...moves.map(movedName), ...lossesSaid(config, losses)], hedged: [] };
|
|
74
|
+
}
|
|
75
|
+
/** The names the index exported before the command and exports no more; on TypeORM the entries `entities` lists no more. */
|
|
76
|
+
function namesLost(config, { before, after }) {
|
|
77
|
+
if (config.stack.orm === 'typeorm') {
|
|
78
|
+
return [...before.reachable]
|
|
79
|
+
.filter((table) => !after.reachable.has(table))
|
|
80
|
+
.map((table) => ({ name: table.slice(table.lastIndexOf('#') + 1), was: table, from: fileOf(table) }));
|
|
81
|
+
}
|
|
82
|
+
return [...before.names]
|
|
83
|
+
.filter(([name]) => !after.names.has(name))
|
|
84
|
+
.map(([name, was]) => ({ name, was, from: before.givers.get(name) ?? fileOf(was) }));
|
|
85
|
+
}
|
|
86
|
+
function lossesSaid(config, losses) {
|
|
87
|
+
if (config.stack.orm === 'typeorm') {
|
|
88
|
+
return losses.map(({ name, from }) => `the entity \`${name}\`, which '${from}' gives \`entities\`, would be listed no more`);
|
|
89
|
+
}
|
|
90
|
+
return losses.map(({ name, from }, at) => `the name \`${name}\`, which '${from}' gives the index, would be exported by no line after it${at === losses.length - 1 ? NAMES_ONLY : ''}`);
|
|
91
|
+
}
|
|
92
|
+
function movedName({ name, was, is }) {
|
|
93
|
+
return `\`${name}\`, which named ${named(was)}, would name ${named(is)}`;
|
|
94
|
+
}
|
|
95
|
+
/** A name lost while something is not read: it may still come through what the index still names; plainly lost when the index names none of it any more. */
|
|
96
|
+
function hedgedLoss({ still, gone }) {
|
|
97
|
+
return ({ name, from }) => {
|
|
98
|
+
if (still.length === 0) {
|
|
99
|
+
return `the name \`${name}\`, which '${from}' gave the index, is exported by no line after the command (${noMoreNamed(gone)})`;
|
|
100
|
+
}
|
|
101
|
+
const which = still.length === 1 ? 'it exports' : 'one of them exports';
|
|
102
|
+
return `the name \`${name}\`, which '${from}' gives the index, is exported by no line the kit can read after the command; it may still be exported through ${quotedFiles(still)} if ${which} it`;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function hedgedMove({ still, gone }) {
|
|
106
|
+
return ({ name, was, is }) => still.length === 0
|
|
107
|
+
? `\`${name}\`, which named ${named(was)} by the lines the kit read, names ${named(is)} after the command (${noMoreNamed(gone)})`
|
|
108
|
+
: `\`${name}\`, which named ${named(was)}, may name another table after the command (the kit does not read ${quotedFiles(still)})`;
|
|
109
|
+
}
|
|
110
|
+
function noMoreNamed(gone) {
|
|
111
|
+
return `${quotedFiles(gone)}, which the kit does not read with certainty, ${gone.length === 1 ? 'is' : 'are'} no more named by the index`;
|
|
112
|
+
}
|
|
113
|
+
/** A table by the name its file gives it and its file: the \`orders\` of '<file>'. */
|
|
114
|
+
function named(table) {
|
|
115
|
+
return `the \`${table.slice(table.lastIndexOf('#') + 1)}\` of '${fileOf(table)}'`;
|
|
116
|
+
}
|
|
117
|
+
function fileOf(table) {
|
|
118
|
+
return table.slice(0, Math.max(table.lastIndexOf('#'), 0));
|
|
119
|
+
}
|
|
120
|
+
function quotedFiles(files) {
|
|
121
|
+
return files.map((file) => `'${file}'`).join(', ');
|
|
122
|
+
}
|
|
123
|
+
/** A table the command wrote out of its tables file, and what restores it. */
|
|
124
|
+
function rewrittenOut(config, table) {
|
|
125
|
+
const [file = '', name = ''] = table.split('#');
|
|
126
|
+
return `\`${name}\` is no more in ${file}, which the command wrote again without it: restore its declaration there, as git holds it${config.stack.orm === 'typeorm' ? ', or the index, which still imports it, does not compile' : ''}`;
|
|
127
|
+
}
|
|
128
|
+
/** With --force a tables file is written again whole: a table it held and the command does not declare is gone from it, the file read with certainty. */
|
|
129
|
+
function isWrittenOut(ws, sources, table) {
|
|
130
|
+
const [file = '', name = ''] = table.split('#');
|
|
131
|
+
const read = readTablesFile(sources, file);
|
|
132
|
+
return (ws.read(file) !== undefined && read.unread.length === 0 && !read.symbols.some((symbol) => symbol.name === name));
|
|
133
|
+
}
|
|
134
|
+
/** What to do about it: the lines of a generation, to write by hand, and what leaving them out costs; for `init --force`, where the line belongs. */
|
|
135
|
+
function toDo(ws, config, { command, lines, names }) {
|
|
136
|
+
if (command === 'init') {
|
|
137
|
+
const where = config.stack.orm === 'typeorm'
|
|
138
|
+
? 'its import inside the `// ddd-ts-kit:imports` region and its entry inside the `// ddd-ts-kit:schemas` region of `entities`, which the rewrite keeps,'
|
|
139
|
+
: `${names === 1 ? 'the line that keeps this name' : 'what keeps these names'} inside the \`// ddd-ts-kit:schemas\` region, which the rewrite keeps,`;
|
|
140
|
+
return ` \`init --force\` writes the index again from its template, and a line written outside the regions of the kit goes with it: move ${where} and run the command again. Until then every \`init --force\` leaves the index as it stood and exits 3.`;
|
|
141
|
+
}
|
|
142
|
+
if (lines.length === 0) {
|
|
143
|
+
return '';
|
|
144
|
+
}
|
|
145
|
+
const unlisted = lines.flatMap((line) => {
|
|
146
|
+
const context = contextOfSource(ws, config, /^export \* from '([^']+)'/.exec(line)?.[1] ?? '');
|
|
147
|
+
return context === undefined ? [] : [context];
|
|
148
|
+
});
|
|
149
|
+
const cost = unlisted.length === 0
|
|
150
|
+
? ''
|
|
151
|
+
: ` Until these lines are written, the tables of ${unlisted.join(', ')} are listed nowhere: no migration will create them.`;
|
|
152
|
+
return ` To write by hand, where it is right:\n${lines.map((line) => ` ${line}`).join('\n')}\n${cost.trimStart()}`.trimEnd();
|
|
153
|
+
}
|
|
154
|
+
/** The lines the command wrote in the regions of the index, or anywhere in it. */
|
|
155
|
+
function written(before, after) {
|
|
156
|
+
const linesOf = (text) => text
|
|
157
|
+
.split('\n')
|
|
158
|
+
.map((line) => line.trim())
|
|
159
|
+
.filter((line) => line !== '');
|
|
160
|
+
const stood = new Set(linesOf(before.text ?? ''));
|
|
161
|
+
const held = [...(after.text ?? '').matchAll(REGION)].map(([, lines = '']) => lines).join('\n');
|
|
162
|
+
return linesOf(held).filter((line) => !stood.has(line));
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=keep-the-picture.js.map
|