ddd-ts-kit 0.9.0 → 0.11.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 +17 -3
- package/dist/check/canonical/roles.d.ts.map +1 -1
- package/dist/check/canonical/roles.js +18 -0
- package/dist/check/canonical/roles.js.map +1 -1
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +14 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/event-sourcing/declared-shape.d.ts +13 -0
- package/dist/check/event-sourcing/declared-shape.d.ts.map +1 -0
- package/dist/check/event-sourcing/declared-shape.js +100 -0
- package/dist/check/event-sourcing/declared-shape.js.map +1 -0
- package/dist/check/event-sourcing/event-sourced-classes.d.ts +5 -0
- package/dist/check/event-sourcing/event-sourced-classes.d.ts.map +1 -0
- package/dist/check/event-sourcing/event-sourced-classes.js +13 -0
- package/dist/check/event-sourcing/event-sourced-classes.js.map +1 -0
- package/dist/check/event-sourcing/fact-words.d.ts +6 -0
- package/dist/check/event-sourcing/fact-words.d.ts.map +1 -0
- package/dist/check/event-sourcing/fact-words.js +10 -0
- package/dist/check/event-sourcing/fact-words.js.map +1 -0
- package/dist/check/event-sourcing/is-apply-method.d.ts +3 -0
- package/dist/check/event-sourcing/is-apply-method.d.ts.map +1 -0
- package/dist/check/event-sourcing/is-apply-method.js +6 -0
- package/dist/check/event-sourcing/is-apply-method.js.map +1 -0
- package/dist/check/event-sourcing/kernel-names.d.ts +8 -0
- package/dist/check/event-sourcing/kernel-names.d.ts.map +1 -0
- package/dist/check/event-sourcing/kernel-names.js +7 -0
- package/dist/check/event-sourcing/kernel-names.js.map +1 -0
- package/dist/check/event-sourcing/read-stored-events-lock.d.ts +5 -0
- package/dist/check/event-sourcing/read-stored-events-lock.d.ts.map +1 -0
- package/dist/check/event-sourcing/read-stored-events-lock.js +25 -0
- package/dist/check/event-sourcing/read-stored-events-lock.js.map +1 -0
- package/dist/check/event-sourcing/read-stored-shape.d.ts +12 -0
- package/dist/check/event-sourcing/read-stored-shape.d.ts.map +1 -0
- package/dist/check/event-sourcing/read-stored-shape.js +46 -0
- package/dist/check/event-sourcing/read-stored-shape.js.map +1 -0
- package/dist/check/event-sourcing/state-writes.d.ts +3 -0
- package/dist/check/event-sourcing/state-writes.d.ts.map +1 -0
- package/dist/check/event-sourcing/state-writes.js +11 -0
- package/dist/check/event-sourcing/state-writes.js.map +1 -0
- package/dist/check/event-sourcing/stored-event-declaration.d.ts +18 -0
- package/dist/check/event-sourcing/stored-event-declaration.d.ts.map +1 -0
- package/dist/check/event-sourcing/stored-event-declaration.js +2 -0
- package/dist/check/event-sourcing/stored-event-declaration.js.map +1 -0
- package/dist/check/event-sourcing/stored-event-declarations.d.ts +9 -0
- package/dist/check/event-sourcing/stored-event-declarations.d.ts.map +1 -0
- package/dist/check/event-sourcing/stored-event-declarations.js +64 -0
- package/dist/check/event-sourcing/stored-event-declarations.js.map +1 -0
- package/dist/check/event-sourcing/stored-events-lock-file.d.ts +3 -0
- package/dist/check/event-sourcing/stored-events-lock-file.d.ts.map +1 -0
- package/dist/check/event-sourcing/stored-events-lock-file.js +3 -0
- package/dist/check/event-sourcing/stored-events-lock-file.js.map +1 -0
- package/dist/check/event-sourcing/stored-shape.d.ts +7 -0
- package/dist/check/event-sourcing/stored-shape.d.ts.map +1 -0
- package/dist/check/event-sourcing/stored-shape.js +2 -0
- package/dist/check/event-sourcing/stored-shape.js.map +1 -0
- package/dist/check/event-sourcing/words-of.d.ts +3 -0
- package/dist/check/event-sourcing/words-of.d.ts.map +1 -0
- package/dist/check/event-sourcing/words-of.js +9 -0
- package/dist/check/event-sourcing/words-of.js.map +1 -0
- package/dist/check/events/event-name-resolver.d.ts +6 -0
- package/dist/check/events/event-name-resolver.d.ts.map +1 -0
- package/dist/check/events/event-name-resolver.js +21 -0
- package/dist/check/events/event-name-resolver.js.map +1 -0
- package/dist/check/explain/event-sourcing-docs.d.ts +3 -0
- package/dist/check/explain/event-sourcing-docs.d.ts.map +1 -0
- package/dist/check/explain/event-sourcing-docs.js +62 -0
- package/dist/check/explain/event-sourcing-docs.js.map +1 -0
- package/dist/check/explain/lifecycle-docs.d.ts +3 -0
- package/dist/check/explain/lifecycle-docs.d.ts.map +1 -0
- package/dist/check/explain/lifecycle-docs.js +33 -0
- package/dist/check/explain/lifecycle-docs.js.map +1 -0
- package/dist/check/explain/rule-docs.d.ts.map +1 -1
- package/dist/check/explain/rule-docs.js +4 -0
- package/dist/check/explain/rule-docs.js.map +1 -1
- package/dist/check/fixtures/event-sourcing-fixtures.d.ts +3 -0
- package/dist/check/fixtures/event-sourcing-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/event-sourcing-fixtures.js +199 -0
- package/dist/check/fixtures/event-sourcing-fixtures.js.map +1 -0
- package/dist/check/fixtures/event-sourcing-projection-fixtures.d.ts +3 -0
- package/dist/check/fixtures/event-sourcing-projection-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/event-sourcing-projection-fixtures.js +48 -0
- package/dist/check/fixtures/event-sourcing-projection-fixtures.js.map +1 -0
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +4 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/lifecycle-fixtures.d.ts +3 -0
- package/dist/check/fixtures/lifecycle-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/lifecycle-fixtures.js +90 -0
- package/dist/check/fixtures/lifecycle-fixtures.js.map +1 -0
- package/dist/check/lifecycle/is-aggregate-file.d.ts +4 -0
- package/dist/check/lifecycle/is-aggregate-file.d.ts.map +1 -0
- package/dist/check/lifecycle/is-aggregate-file.js +6 -0
- package/dist/check/lifecycle/is-aggregate-file.js.map +1 -0
- package/dist/check/lifecycle/machines-imported.d.ts +4 -0
- package/dist/check/lifecycle/machines-imported.d.ts.map +1 -0
- package/dist/check/lifecycle/machines-imported.js +11 -0
- package/dist/check/lifecycle/machines-imported.js.map +1 -0
- package/dist/check/lifecycle/shorthand-status-writes.d.ts +7 -0
- package/dist/check/lifecycle/shorthand-status-writes.d.ts.map +1 -0
- package/dist/check/lifecycle/shorthand-status-writes.js +34 -0
- package/dist/check/lifecycle/shorthand-status-writes.js.map +1 -0
- package/dist/check/lifecycle/status-writes.d.ts +14 -0
- package/dist/check/lifecycle/status-writes.d.ts.map +1 -0
- package/dist/check/lifecycle/status-writes.js +29 -0
- package/dist/check/lifecycle/status-writes.js.map +1 -0
- package/dist/check/rules/event-sourcing-past-tense.d.ts +3 -0
- package/dist/check/rules/event-sourcing-past-tense.d.ts.map +1 -0
- package/dist/check/rules/event-sourcing-past-tense.js +31 -0
- package/dist/check/rules/event-sourcing-past-tense.js.map +1 -0
- package/dist/check/rules/event-sourcing-projection-never-appends.d.ts +3 -0
- package/dist/check/rules/event-sourcing-projection-never-appends.d.ts.map +1 -0
- package/dist/check/rules/event-sourcing-projection-never-appends.js +54 -0
- package/dist/check/rules/event-sourcing-projection-never-appends.js.map +1 -0
- package/dist/check/rules/event-sourcing-state-in-apply.d.ts +3 -0
- package/dist/check/rules/event-sourcing-state-in-apply.d.ts.map +1 -0
- package/dist/check/rules/event-sourcing-state-in-apply.js +34 -0
- package/dist/check/rules/event-sourcing-state-in-apply.js.map +1 -0
- package/dist/check/rules/event-sourcing-store-behind-repository.d.ts +3 -0
- package/dist/check/rules/event-sourcing-store-behind-repository.d.ts.map +1 -0
- package/dist/check/rules/event-sourcing-store-behind-repository.js +34 -0
- package/dist/check/rules/event-sourcing-store-behind-repository.js.map +1 -0
- package/dist/check/rules/event-sourcing-upcaster-required.d.ts +3 -0
- package/dist/check/rules/event-sourcing-upcaster-required.d.ts.map +1 -0
- package/dist/check/rules/event-sourcing-upcaster-required.js +79 -0
- package/dist/check/rules/event-sourcing-upcaster-required.js.map +1 -0
- package/dist/check/rules/lifecycle-status-through-machine.d.ts +3 -0
- package/dist/check/rules/lifecycle-status-through-machine.d.ts.map +1 -0
- package/dist/check/rules/lifecycle-status-through-machine.js +55 -0
- package/dist/check/rules/lifecycle-status-through-machine.js.map +1 -0
- package/dist/check/rules/process-sends-commands-only.d.ts +3 -0
- package/dist/check/rules/process-sends-commands-only.d.ts.map +1 -0
- package/dist/check/rules/process-sends-commands-only.js +39 -0
- package/dist/check/rules/process-sends-commands-only.js.map +1 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +44 -11
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/format-context.d.ts.map +1 -1
- package/dist/commands/format-context.js +1 -1
- package/dist/commands/format-context.js.map +1 -1
- package/dist/commands/generate.js +4 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +1 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/parse-stack.d.ts.map +1 -1
- package/dist/config/parse-stack.js +2 -1
- package/dist/config/parse-stack.js.map +1 -1
- package/dist/config/stack.d.ts +10 -0
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -0
- package/dist/config/stack.js.map +1 -1
- package/dist/declared/declared-role.d.ts.map +1 -1
- package/dist/declared/declared-role.js +1 -0
- package/dist/declared/declared-role.js.map +1 -1
- package/dist/describe/context-description.d.ts +8 -0
- package/dist/describe/context-description.d.ts.map +1 -1
- package/dist/describe/describe-context.d.ts.map +1 -1
- package/dist/describe/describe-context.js +4 -0
- package/dist/describe/describe-context.js.map +1 -1
- package/dist/describe/format-description.d.ts.map +1 -1
- package/dist/describe/format-description.js +17 -2
- package/dist/describe/format-description.js.map +1 -1
- package/dist/docs/background-job-facts.d.ts +7 -0
- package/dist/docs/background-job-facts.d.ts.map +1 -0
- package/dist/docs/background-job-facts.js +2 -0
- package/dist/docs/background-job-facts.js.map +1 -0
- package/dist/docs/context-facts.d.ts +11 -0
- package/dist/docs/context-facts.d.ts.map +1 -1
- package/dist/docs/declared-stored-events.d.ts +9 -0
- package/dist/docs/declared-stored-events.d.ts.map +1 -0
- package/dist/docs/declared-stored-events.js +22 -0
- package/dist/docs/declared-stored-events.js.map +1 -0
- package/dist/docs/object-properties.d.ts +11 -0
- package/dist/docs/object-properties.d.ts.map +1 -0
- package/dist/docs/object-properties.js +21 -0
- package/dist/docs/object-properties.js.map +1 -0
- package/dist/docs/process-facts.d.ts +8 -0
- package/dist/docs/process-facts.d.ts.map +1 -0
- package/dist/docs/process-facts.js +2 -0
- package/dist/docs/process-facts.js.map +1 -0
- package/dist/docs/read-background-jobs.d.ts +5 -0
- package/dist/docs/read-background-jobs.d.ts.map +1 -0
- package/dist/docs/read-background-jobs.js +16 -0
- package/dist/docs/read-background-jobs.js.map +1 -0
- package/dist/docs/read-context.d.ts.map +1 -1
- package/dist/docs/read-context.js +16 -0
- package/dist/docs/read-context.js.map +1 -1
- package/dist/docs/read-processes.d.ts +5 -0
- package/dist/docs/read-processes.d.ts.map +1 -0
- package/dist/docs/read-processes.js +22 -0
- package/dist/docs/read-processes.js.map +1 -0
- package/dist/docs/read-state-machines.d.ts +10 -0
- package/dist/docs/read-state-machines.d.ts.map +1 -0
- package/dist/docs/read-state-machines.js +81 -0
- package/dist/docs/read-state-machines.js.map +1 -0
- package/dist/docs/read-vocabularies.d.ts +4 -0
- package/dist/docs/read-vocabularies.d.ts.map +1 -0
- package/dist/docs/read-vocabularies.js +14 -0
- package/dist/docs/read-vocabularies.js.map +1 -0
- package/dist/docs/refresh-context-doc.d.ts +1 -1
- package/dist/docs/refresh-context-doc.d.ts.map +1 -1
- package/dist/docs/refresh-context-doc.js +33 -4
- package/dist/docs/refresh-context-doc.js.map +1 -1
- package/dist/docs/state-machine-facts.d.ts +18 -0
- package/dist/docs/state-machine-facts.d.ts.map +1 -0
- package/dist/docs/state-machine-facts.js +2 -0
- package/dist/docs/state-machine-facts.js.map +1 -0
- package/dist/docs/state-machine-lines.d.ts +8 -0
- package/dist/docs/state-machine-lines.d.ts.map +1 -0
- package/dist/docs/state-machine-lines.js +32 -0
- package/dist/docs/state-machine-lines.js.map +1 -0
- package/dist/docs/unrecorded-stored-events.d.ts +9 -0
- package/dist/docs/unrecorded-stored-events.d.ts.map +1 -0
- package/dist/docs/unrecorded-stored-events.js +17 -0
- package/dist/docs/unrecorded-stored-events.js.map +1 -0
- package/dist/docs/write-docs.d.ts +1 -2
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +1 -2
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/docs/write-stored-events-lock.d.ts +12 -0
- package/dist/docs/write-stored-events-lock.d.ts.map +1 -0
- package/dist/docs/write-stored-events-lock.js +41 -0
- package/dist/docs/write-stored-events-lock.js.map +1 -0
- package/dist/generate/event-names.d.ts +2 -0
- package/dist/generate/event-names.d.ts.map +1 -1
- package/dist/generate/event-names.js +1 -0
- package/dist/generate/event-names.js.map +1 -1
- package/dist/generate/kind.d.ts +4 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/aggregate-kind.d.ts.map +1 -1
- package/dist/generate/kinds/aggregate-kind.js +8 -2
- package/dist/generate/kinds/aggregate-kind.js.map +1 -1
- package/dist/generate/kinds/background/background-job-vars.d.ts +7 -0
- package/dist/generate/kinds/background/background-job-vars.d.ts.map +1 -0
- package/dist/generate/kinds/background/background-job-vars.js +29 -0
- package/dist/generate/kinds/background/background-job-vars.js.map +1 -0
- package/dist/generate/kinds/background/job-import.d.ts +8 -0
- package/dist/generate/kinds/background/job-import.d.ts.map +1 -0
- package/dist/generate/kinds/background/job-import.js +17 -0
- package/dist/generate/kinds/background/job-import.js.map +1 -0
- package/dist/generate/kinds/background/payload-field.d.ts +18 -0
- package/dist/generate/kinds/background/payload-field.d.ts.map +1 -0
- package/dist/generate/kinds/background/payload-field.js +52 -0
- package/dist/generate/kinds/background/payload-field.js.map +1 -0
- package/dist/generate/kinds/background/require-container.d.ts +7 -0
- package/dist/generate/kinds/background/require-container.d.ts.map +1 -0
- package/dist/generate/kinds/background/require-container.js +13 -0
- package/dist/generate/kinds/background/require-container.js.map +1 -0
- package/dist/generate/kinds/background-job-kind.d.ts +3 -0
- package/dist/generate/kinds/background-job-kind.d.ts.map +1 -0
- package/dist/generate/kinds/background-job-kind.js +49 -0
- package/dist/generate/kinds/background-job-kind.js.map +1 -0
- package/dist/generate/kinds/domain-event-kind.d.ts.map +1 -1
- package/dist/generate/kinds/domain-event-kind.js +5 -2
- package/dist/generate/kinds/domain-event-kind.js.map +1 -1
- package/dist/generate/kinds/event-vars.d.ts.map +1 -1
- package/dist/generate/kinds/event-vars.js +6 -1
- package/dist/generate/kinds/event-vars.js.map +1 -1
- package/dist/generate/kinds/extend-event-sourced-aggregate.d.ts +9 -0
- package/dist/generate/kinds/extend-event-sourced-aggregate.d.ts.map +1 -0
- package/dist/generate/kinds/extend-event-sourced-aggregate.js +67 -0
- package/dist/generate/kinds/extend-event-sourced-aggregate.js.map +1 -0
- package/dist/generate/kinds/job/command-input.d.ts +11 -0
- package/dist/generate/kinds/job/command-input.d.ts.map +1 -0
- package/dist/generate/kinds/job/command-input.js +13 -0
- package/dist/generate/kinds/job/command-input.js.map +1 -0
- package/dist/generate/kinds/job/granted-in-spec.d.ts +6 -0
- package/dist/generate/kinds/job/granted-in-spec.d.ts.map +1 -0
- package/dist/generate/kinds/job/granted-in-spec.js +18 -0
- package/dist/generate/kinds/job/granted-in-spec.js.map +1 -0
- package/dist/generate/kinds/job/job-vars.d.ts.map +1 -1
- package/dist/generate/kinds/job/job-vars.js +1 -17
- package/dist/generate/kinds/job/job-vars.js.map +1 -1
- package/dist/generate/kinds/job/read-sent-command.d.ts +8 -2
- package/dist/generate/kinds/job/read-sent-command.d.ts.map +1 -1
- package/dist/generate/kinds/job/read-sent-command.js +18 -12
- package/dist/generate/kinds/job/read-sent-command.js.map +1 -1
- package/dist/generate/kinds/job/sent-command.d.ts +4 -1
- package/dist/generate/kinds/job/sent-command.d.ts.map +1 -1
- package/dist/generate/kinds/process-kind.d.ts +3 -0
- package/dist/generate/kinds/process-kind.d.ts.map +1 -0
- package/dist/generate/kinds/process-kind.js +39 -0
- package/dist/generate/kinds/process-kind.js.map +1 -0
- package/dist/generate/kinds/state-machine/parse-transitions.d.ts +4 -0
- package/dist/generate/kinds/state-machine/parse-transitions.d.ts.map +1 -0
- package/dist/generate/kinds/state-machine/parse-transitions.js +24 -0
- package/dist/generate/kinds/state-machine/parse-transitions.js.map +1 -0
- package/dist/generate/kinds/state-machine/requested-transition.d.ts +9 -0
- package/dist/generate/kinds/state-machine/requested-transition.d.ts.map +1 -0
- package/dist/generate/kinds/state-machine/requested-transition.js +2 -0
- package/dist/generate/kinds/state-machine/requested-transition.js.map +1 -0
- package/dist/generate/kinds/state-machine/state-machine-vars.d.ts +12 -0
- package/dist/generate/kinds/state-machine/state-machine-vars.d.ts.map +1 -0
- package/dist/generate/kinds/state-machine/state-machine-vars.js +44 -0
- package/dist/generate/kinds/state-machine/state-machine-vars.js.map +1 -0
- package/dist/generate/kinds/state-machine/status-vocabulary.d.ts +9 -0
- package/dist/generate/kinds/state-machine/status-vocabulary.d.ts.map +1 -0
- package/dist/generate/kinds/state-machine/status-vocabulary.js +26 -0
- package/dist/generate/kinds/state-machine/status-vocabulary.js.map +1 -0
- package/dist/generate/kinds/state-machine-kind.d.ts +3 -0
- package/dist/generate/kinds/state-machine-kind.d.ts.map +1 -0
- package/dist/generate/kinds/state-machine-kind.js +33 -0
- package/dist/generate/kinds/state-machine-kind.js.map +1 -0
- package/dist/generate/kinds/write-event-sourced-aggregate.d.ts +8 -0
- package/dist/generate/kinds/write-event-sourced-aggregate.d.ts.map +1 -0
- package/dist/generate/kinds/write-event-sourced-aggregate.js +24 -0
- package/dist/generate/kinds/write-event-sourced-aggregate.js.map +1 -0
- package/dist/generate/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +6 -0
- package/dist/generate/kinds.js.map +1 -1
- package/dist/generate/vocabulary/held-entries.d.ts +4 -0
- package/dist/generate/vocabulary/held-entries.d.ts.map +1 -0
- package/dist/generate/vocabulary/held-entries.js +6 -0
- package/dist/generate/vocabulary/held-entries.js.map +1 -0
- package/dist/generate/vocabulary/vocabulary-text.d.ts.map +1 -1
- package/dist/generate/vocabulary/vocabulary-text.js +2 -2
- package/dist/generate/vocabulary/vocabulary-text.js.map +1 -1
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +3 -0
- package/dist/help/notes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +2 -2
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +2 -0
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/manifest/versions.js.map +1 -1
- package/dist/init/stack/resolve-queue.d.ts +13 -0
- package/dist/init/stack/resolve-queue.d.ts.map +1 -0
- package/dist/init/stack/resolve-queue.js +25 -0
- package/dist/init/stack/resolve-queue.js.map +1 -0
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +2 -0
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +2 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/naming/index.d.ts +2 -0
- package/dist/naming/index.d.ts.map +1 -1
- package/dist/naming/index.js +2 -0
- package/dist/naming/index.js.map +1 -1
- package/dist/naming/is-past-fact.d.ts +7 -0
- package/dist/naming/is-past-fact.d.ts.map +1 -0
- package/dist/naming/is-past-fact.js +18 -0
- package/dist/naming/is-past-fact.js.map +1 -0
- package/dist/naming/is-past-word.d.ts +3 -0
- package/dist/naming/is-past-word.d.ts.map +1 -0
- package/dist/naming/is-past-word.js +113 -0
- package/dist/naming/is-past-word.js.map +1 -0
- package/dist/naming/looks-like-past-fact.d.ts +1 -1
- package/dist/naming/looks-like-past-fact.d.ts.map +1 -1
- package/dist/naming/looks-like-past-fact.js +3 -66
- package/dist/naming/looks-like-past-fact.js.map +1 -1
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +13 -0
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/templates/aggregate/event-sourced.aggregate.spec.ts.tpl +26 -0
- package/templates/aggregate/event-sourced.aggregate.ts.tpl +61 -0
- package/templates/aggregate/event-sourced.events.mapper.ts.tpl +15 -0
- package/templates/background-job/background-job.declared.ts.tpl +26 -0
- package/templates/background-job/background-job.spec.ts.tpl +63 -0
- package/templates/background-job/background-job.ts.tpl +24 -0
- package/templates/background-job/wiring.tsyringe.tpl +5 -0
- package/templates/builder/event-sourced.builder.ts.tpl +36 -0
- package/templates/context/CONTEXT.md.tpl +15 -0
- package/templates/init/CLAUDE.md.tpl +1 -1
- package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +20 -1
- package/templates/init/platform/database/persistence-over.knex.ts.tpl +18 -1
- package/templates/init/platform/database/persistence.orm.ts.tpl +12 -1
- package/templates/init/platform/database/schema.drizzle.ts.tpl +12 -2
- package/templates/init/platform/database/schema.knex.ts.tpl +7 -1
- package/templates/init/platform/platform.module.tsyringe.ts.tpl +43 -3
- package/templates/init/platform/redis/open-redis.ts.tpl +37 -1
- package/templates/init/rules/application.md.tpl +4 -2
- package/templates/init/rules/domain.md.tpl +2 -0
- package/templates/init/rules/infrastructure.md.tpl +1 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/process/process.spec.ts.tpl +44 -0
- package/templates/process/process.ts.tpl +41 -0
- package/templates/process/timeout-job.declared.ts.tpl +18 -0
- package/templates/process/timeout-job.spec.ts.tpl +43 -0
- package/templates/process/timeout-job.ts.tpl +16 -0
- package/templates/process/timeout-job.wiring.tsyringe.tpl +5 -0
- package/templates/state-machine/state-machine.spec.ts.tpl +16 -0
- package/templates/state-machine/state-machine.ts.tpl +16 -0
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { CliError } from '../../../cli-error.js';
|
|
2
2
|
import { concept } from '../../concept.js';
|
|
3
3
|
import { requireFile } from '../../require-file.js';
|
|
4
|
+
import { commandInputOf } from './command-input.js';
|
|
4
5
|
import { constructorParameters } from './constructor-parameters.js';
|
|
5
6
|
const OPTIONAL = /^[^:=]*\?\s*:|=/;
|
|
6
7
|
const INSTANT = /:\s*Date\b/;
|
|
7
|
-
/**
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The command `--command` names: it has to exist, and its sender has to be able to build it. A
|
|
10
|
+
* scheduled job knows its actor and the instant it was due; a background job hands it, past its
|
|
11
|
+
* actor, the fields of its payload.
|
|
12
|
+
*/
|
|
13
|
+
export function readSentCommand(scope, input, sender = 'job') {
|
|
9
14
|
const name = concept({ ...scope, flags: { ...scope.flags, allowName: true } }, input, {
|
|
10
15
|
what: 'use case',
|
|
11
16
|
strip: ['command', 'handler'],
|
|
@@ -18,15 +23,15 @@ export function readSentCommand(scope, input) {
|
|
|
18
23
|
});
|
|
19
24
|
const source = withoutComments(scope.ws.read(`${scope.dir}/${file}`) ?? '');
|
|
20
25
|
const isProtected = /extends\s+AuthorizedCommand\b/.test(source);
|
|
21
|
-
const
|
|
26
|
+
const parameters = constructorParameters(source).slice(isProtected ? 1 : 0);
|
|
27
|
+
const permission = isProtected ? requiredPermission(scope, name, source) : undefined;
|
|
28
|
+
if (sender === 'background job') {
|
|
29
|
+
return { name, isProtected, permission, takesInstant: false, inputs: parameters.map(commandInputOf) };
|
|
30
|
+
}
|
|
31
|
+
const [first = '', ...others] = parameters;
|
|
22
32
|
const takesInstant = INSTANT.test(first);
|
|
23
|
-
refuseUnknownInput(scope, name, [...(takesInstant ? [] : [first]), ...others]);
|
|
24
|
-
return {
|
|
25
|
-
name,
|
|
26
|
-
isProtected,
|
|
27
|
-
permission: isProtected ? requiredPermission(scope, name, source) : undefined,
|
|
28
|
-
takesInstant,
|
|
29
|
-
};
|
|
33
|
+
refuseUnknownInput({ scope, name }, [...(takesInstant ? [] : [first]), ...others]);
|
|
34
|
+
return { name, isProtected, permission, takesInstant, inputs: [] };
|
|
30
35
|
}
|
|
31
36
|
/** A generated command describes its constructor in a `TODO(domain)` comment before it has one. */
|
|
32
37
|
function withoutComments(source) {
|
|
@@ -36,12 +41,13 @@ function withoutComments(source) {
|
|
|
36
41
|
.join('\n');
|
|
37
42
|
}
|
|
38
43
|
/** A job knows its actor and the instant it was due, nothing else: a command that needs more cannot be built by it. */
|
|
39
|
-
function refuseUnknownInput(scope, name, parameters) {
|
|
44
|
+
function refuseUnknownInput({ scope, name }, parameters) {
|
|
40
45
|
const unknown = parameters.filter((parameter) => parameter !== '' && !OPTIONAL.test(parameter)).map(nameOf);
|
|
41
46
|
if (unknown.length === 0) {
|
|
42
47
|
return;
|
|
43
48
|
}
|
|
44
|
-
|
|
49
|
+
const needs = unknown.map((parameter) => `\`${parameter}\``).join(', ');
|
|
50
|
+
throw new CliError(`The constructor of ${name.pascal}Command needs ${needs}, which a job cannot know.`, `A job only says that the time has come: it sends a command that takes its actor and, at most, the instant the work is for (\`readonly dueBefore: Date\`), and the handler finds what to act on. Create that use case with \`ddd-ts-kit generate command ${scope.context.kebab} <UseCaseName>\` and pass it to --command, or make ${unknown.length === 1 ? 'this parameter' : 'these parameters'} optional.`);
|
|
45
51
|
}
|
|
46
52
|
function nameOf(parameter) {
|
|
47
53
|
return /([A-Za-z_$][\w$]*)\s*\??\s*(?::|$)/.exec(parameter)?.[1] ?? parameter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-sent-command.js","sourceRoot":"","sources":["../../../../src/generate/kinds/job/read-sent-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA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C,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,YAAY,CAAC,IAAI,EAAE,CAAC;IACpF,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA,8CAA8C,CAAC;IACzE,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,KAAK,IAAI,CAAC,MAAM,YAAY,OAAO,6BAA6B,CAAC,CAAC;IAC5G,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,2CAA2C,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/E,MAAM,UAAU,GAAG,QAAQ,IAAI,UAAU,CAAC;IAE1C,OAAO,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC;AACvF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Name } from '../../../naming/index.js';
|
|
2
|
+
import type { CommandInput } from './command-input.js';
|
|
2
3
|
/** The command a job sends, as its file and the wiring of its context say it. */
|
|
3
4
|
export interface SentCommand {
|
|
4
5
|
readonly name: Name;
|
|
@@ -6,7 +7,9 @@ export interface SentCommand {
|
|
|
6
7
|
readonly isProtected: boolean;
|
|
7
8
|
/** The permission the command requires, as `<context>:<aggregate>.<action>`; undefined when it is not written where the generator reads it. */
|
|
8
9
|
readonly permission: string | undefined;
|
|
9
|
-
/** The constructor of the command takes the instant the work is for, right after the actor. */
|
|
10
|
+
/** The constructor of the command takes the instant the work is for, right after the actor: what a scheduled job hands it. */
|
|
10
11
|
readonly takesInstant: boolean;
|
|
12
|
+
/** For a background job: every parameter of the constructor past the actor, which its payload carries. */
|
|
13
|
+
readonly inputs: readonly CommandInput[];
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=sent-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sent-command.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/job/sent-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"sent-command.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/job/sent-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,iHAAiH;IACjH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,+IAA+I;IAC/I,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,8HAA8H;IAC9H,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,0GAA0G;IAC1G,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/process-kind.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AASvC,eAAO,MAAM,WAAW,EAAE,IAkCzB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { concept } from '../concept.js';
|
|
2
|
+
import { emit } from '../emit.js';
|
|
3
|
+
import { learnTerms } from '../learn-terms.js';
|
|
4
|
+
import { named } from '../named.js';
|
|
5
|
+
import { openScope } from '../open-scope.js';
|
|
6
|
+
import { specVars } from '../spec-vars.js';
|
|
7
|
+
import { vars } from '../vars.js';
|
|
8
|
+
import { wire } from '../wire.js';
|
|
9
|
+
import { requireContainer } from './background/require-container.js';
|
|
10
|
+
export const processKind = {
|
|
11
|
+
name: 'process',
|
|
12
|
+
aliases: ['process-manager'],
|
|
13
|
+
usage: 'process <context> <Name> [--term "<Term>=<meaning>"]...',
|
|
14
|
+
summary: 'A process manager: its state kept with optimistic concurrency, a first step that arms a deadline, a step that ends it in time, the step of the deadline, the background job that delivers its timeouts and the specs of both, given/when/then on the decisions.',
|
|
15
|
+
positionals: ['context', 'Name'],
|
|
16
|
+
writesShared: false,
|
|
17
|
+
run: (request) => {
|
|
18
|
+
const scope = openScope(request);
|
|
19
|
+
requireContainer(scope, 'process manager');
|
|
20
|
+
learnTerms(scope);
|
|
21
|
+
const name = concept(scope, request.args[1] ?? '', { what: 'process', strip: ['process', 'saga'] });
|
|
22
|
+
const context = vars(scope, {
|
|
23
|
+
name: named(name),
|
|
24
|
+
spec: specVars(scope, { protected: false }),
|
|
25
|
+
process: {
|
|
26
|
+
name: `${scope.context.kebab}.${name.kebab}`,
|
|
27
|
+
timeoutJob: `${scope.context.kebab}.${name.kebab}-timeout`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
emit(scope, context, [
|
|
31
|
+
['process/process.ts.tpl', `application/processes/${name.kebab}.process.ts`],
|
|
32
|
+
['process/timeout-job.ts.tpl', `application/background/${name.kebab}-timeout.background-job.ts`],
|
|
33
|
+
['process/process.spec.ts.tpl', `test/unit/${name.kebab}.process.spec.ts`],
|
|
34
|
+
['process/timeout-job.spec.ts.tpl', `test/unit/${name.kebab}-timeout.background-job.spec.ts`],
|
|
35
|
+
]);
|
|
36
|
+
wire(scope, 'process/timeout-job', context);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=process-kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/process-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAA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AAI,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE;gBAC5C,UAAU,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,UAAU;aAC3D;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;YACnB,CAAC,wBAAwB,EAAE,yBAAyB,IAAI,CAAC,KAAK,aAAa,CAAC;YAC5E,CAAC,4BAA4B,EAAE,0BAA0B,IAAI,CAAC,KAAK,4BAA4B,CAAC;YAChG,CAAC,6BAA6B,EAAE,aAAa,IAAI,CAAC,KAAK,kBAAkB,CAAC;YAC1E,CAAC,iCAAiC,EAAE,aAAa,IAAI,CAAC,KAAK,iCAAiC,CAAC;SAC9F,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RequestedTransition } from './requested-transition.js';
|
|
2
|
+
/** The transitions of `--transition`, each leaving and reaching states the machine lists. */
|
|
3
|
+
export declare function parseTransitions(written: readonly string[], states: readonly string[]): RequestedTransition[];
|
|
4
|
+
//# sourceMappingURL=parse-transitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-transitions.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/state-machine/parse-transitions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIrE,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,mBAAmB,EAAE,CAY7G"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CliError } from '../../../cli-error.js';
|
|
2
|
+
import { toName } from '../../../naming/index.js';
|
|
3
|
+
const WRITTEN = /^\s*([A-Za-z][\w-]*)\s*:\s*([^>]+?)\s*(?:>\s*(\S+)\s*)?$/;
|
|
4
|
+
/** The transitions of `--transition`, each leaving and reaching states the machine lists. */
|
|
5
|
+
export function parseTransitions(written, states) {
|
|
6
|
+
const transitions = written.map((text) => parsed(text, states));
|
|
7
|
+
const twice = transitions.find(({ name }, index) => transitions.findIndex((other) => other.name === name) !== index);
|
|
8
|
+
if (twice !== undefined) {
|
|
9
|
+
throw new CliError(`The transition ${twice.name} is given twice.`, 'Name each transition once and list every state it leaves: --transition "cancel:draft,issued>cancelled".');
|
|
10
|
+
}
|
|
11
|
+
return transitions;
|
|
12
|
+
}
|
|
13
|
+
function parsed(text, states) {
|
|
14
|
+
const [, name = '', from = '', to] = WRITTEN.exec(text) ?? [];
|
|
15
|
+
const left = from.split(',').map((state) => state.trim());
|
|
16
|
+
const unknown = [...left, ...(to === undefined ? [] : [to])].filter((state) => !states.includes(state));
|
|
17
|
+
if (name === '' || unknown.length > 0) {
|
|
18
|
+
throw new CliError(name === ''
|
|
19
|
+
? `"${text}" is not a transition.`
|
|
20
|
+
: `The transition ${name} names ${unknown.map((state) => `"${state}"`).join(', ')}, which the status does not list.`, `Write each transition as "<intention>:<from>[,<from>]...[><to>]", its states among ${states.join(', ')}: --transition "issue:draft>issued". Add a state with --value.`);
|
|
21
|
+
}
|
|
22
|
+
return { name: toName(name).camel, from: left, ...(to === undefined ? {} : { to }) };
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=parse-transitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-transitions.js","sourceRoot":"","sources":["../../../../src/generate/kinds/state-machine/parse-transitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,MAAM,OAAO,GAAG,0DAA0D,CAAC;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MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,QAAQ,CAChB,IAAI,KAAK,EAAE;YACT,CAAC,CAAC,IAAI,IAAI,wBAAwB;YAClC,CAAC,CAAC,kBAAkB,IAAI,UAAU,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,mCAAmC,EACtH,sFAAsF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gEAAgE,CACxK,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** One transition asked with `--transition "<name>:<from>[,<from>]...[><to>]"`, its states as values of the vocabulary. */
|
|
2
|
+
export interface RequestedTransition {
|
|
3
|
+
/** The intention method of the aggregate that performs it, in camelCase. */
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly from: readonly string[];
|
|
6
|
+
/** Absent: the transition keeps the state it leaves. */
|
|
7
|
+
readonly to?: string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=requested-transition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requested-transition.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/state-machine/requested-transition.ts"],"names":[],"mappings":"AAAA,2HAA2H;AAC3H,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,wDAAwD;IACxD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requested-transition.js","sourceRoot":"","sources":["../../../../src/generate/kinds/state-machine/requested-transition.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Name } from '../../../naming/index.js';
|
|
2
|
+
import type { RenderContext } from '../../../templating/index.js';
|
|
3
|
+
import type { VocabularyEntry } from '../../vocabulary/vocabulary-entry.js';
|
|
4
|
+
import type { RequestedTransition } from './requested-transition.js';
|
|
5
|
+
export interface MachineParts {
|
|
6
|
+
readonly aggregate: Name;
|
|
7
|
+
readonly states: readonly VocabularyEntry[];
|
|
8
|
+
readonly transitions: readonly RequestedTransition[];
|
|
9
|
+
}
|
|
10
|
+
/** The declaration of a lifecycle and the cases of its spec, written from the states and the transitions asked. */
|
|
11
|
+
export declare function stateMachineVars({ aggregate, states, transitions }: MachineParts): RenderContext;
|
|
12
|
+
//# sourceMappingURL=state-machine-vars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-machine-vars.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/state-machine/state-machine-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACtD;AAED,mHAAmH;AACnH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,YAAY,GAAG,aAAa,CAgBhG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** The declaration of a lifecycle and the cases of its spec, written from the states and the transitions asked. */
|
|
2
|
+
export function stateMachineVars({ aggregate, states, transitions }) {
|
|
3
|
+
const status = `${aggregate.pascal}Status`;
|
|
4
|
+
const machine = `${aggregate.camel}Lifecycle`;
|
|
5
|
+
const member = (value) => `${status}.${states.find((entry) => entry.value === value)?.key ?? value}`;
|
|
6
|
+
const [initial] = states;
|
|
7
|
+
return {
|
|
8
|
+
status,
|
|
9
|
+
statusKebab: `${aggregate.kebab}-status`,
|
|
10
|
+
constant: machine,
|
|
11
|
+
initial: member(initial?.value ?? ''),
|
|
12
|
+
initialValue: initial?.value ?? '',
|
|
13
|
+
hasTransitions: transitions.length > 0,
|
|
14
|
+
transitions: transitions.map((transition) => ` ${declared(transition, member)},`).join('\n'),
|
|
15
|
+
cases: transitions.flatMap((transition) => cases({ machine, transition, states, member })).join('\n\n'),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function declared({ name, from, to }, member) {
|
|
19
|
+
const leaves = `from: [${from.map(member).join(', ')}]`;
|
|
20
|
+
return `${name}: { ${to === undefined ? leaves : `${leaves}, to: ${member(to)}`} }`;
|
|
21
|
+
}
|
|
22
|
+
/** The transition leads where it says from the first state it leaves, and is refused from the first state it does not. */
|
|
23
|
+
function cases({ machine, transition, states, member }) {
|
|
24
|
+
const { name, from, to } = transition;
|
|
25
|
+
const [first = ''] = from;
|
|
26
|
+
const outside = states.find(({ value }) => !from.includes(value))?.value;
|
|
27
|
+
const allowed = [
|
|
28
|
+
` it('${name} leads from ${first} to ${to ?? first}', () => {`,
|
|
29
|
+
` expect(${machine}.next(${member(first)}, '${name}')).toBe(${member(to ?? first)});`,
|
|
30
|
+
' });',
|
|
31
|
+
].join('\n');
|
|
32
|
+
if (outside === undefined) {
|
|
33
|
+
return [allowed];
|
|
34
|
+
}
|
|
35
|
+
return [
|
|
36
|
+
allowed,
|
|
37
|
+
[
|
|
38
|
+
` it('refuses ${name} from ${outside}', () => {`,
|
|
39
|
+
` expect(() => ${machine}.next(${member(outside)}, '${name}')).toThrow('is not allowed from the state');`,
|
|
40
|
+
' });',
|
|
41
|
+
].join('\n'),
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=state-machine-vars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-machine-vars.js","sourceRoot":"","sources":["../../../../src/generate/kinds/state-machine/state-machine-vars.ts"],"names":[],"mappings":"AAWA,mHAAmH;AACnH,MAAM,UAAU,gBAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAgB;IAC/E,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,QAAQ,CAAC;IAC3C,MAAM,OAAO,GAAG,GAAG,SAAS,CAAC,KAAK,WAAW,CAAC;IAC9C,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;IACrH,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;IAEzB,OAAO;QACL,MAAM;QACN,WAAW,EAAE,GAAG,SAAS,CAAC,KAAK,SAAS;QACxC,QAAQ,EAAE,OAAO;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;QACrC,YAAY,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE;QAClC,cAAc,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC;QACtC,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,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,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,OAAO;QACL,OAAO;QACP;YACE,iBAAiB,IAAI,SAAS,OAAO,YAAY;YACjD,oBAAoB,OAAO,SAAS,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,+CAA+C;YAC5G,OAAO;SACR,CAAC,IAAI,CAAC,IAAI,CAAC;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Name } from '../../../naming/index.js';
|
|
2
|
+
import type { Scope } from '../../scope.js';
|
|
3
|
+
import type { VocabularyEntry } from '../../vocabulary/vocabulary-entry.js';
|
|
4
|
+
/**
|
|
5
|
+
* The closed vocabulary of the status of an aggregate, `<Aggregate>Status`: created from the
|
|
6
|
+
* values of `--value`, or extended with the ones it does not hold. Answers every entry, in order.
|
|
7
|
+
*/
|
|
8
|
+
export declare function statusVocabulary(scope: Scope, aggregate: Name): VocabularyEntry[];
|
|
9
|
+
//# sourceMappingURL=status-vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-vocabulary.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/state-machine/status-vocabulary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAG5E;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,GAAG,eAAe,EAAE,CAsBjF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CliError } from '../../../cli-error.js';
|
|
2
|
+
import { entriesOf } from '../../vocabulary/entries-of.js';
|
|
3
|
+
import { heldEntries } from '../../vocabulary/held-entries.js';
|
|
4
|
+
import { vocabularyText } from '../../vocabulary/vocabulary-text.js';
|
|
5
|
+
/**
|
|
6
|
+
* The closed vocabulary of the status of an aggregate, `<Aggregate>Status`: created from the
|
|
7
|
+
* values of `--value`, or extended with the ones it does not hold. Answers every entry, in order.
|
|
8
|
+
*/
|
|
9
|
+
export function statusVocabulary(scope, aggregate) {
|
|
10
|
+
const name = `${aggregate.pascal}Status`;
|
|
11
|
+
const file = `${scope.dir}/domain/vocabularies/${aggregate.kebab}-status.vocabulary.ts`;
|
|
12
|
+
const existing = scope.ws.read(file);
|
|
13
|
+
const asked = scope.flags.value.length === 0 ? [] : entriesOf(scope.flags.value);
|
|
14
|
+
if (existing === undefined && asked.length < 2) {
|
|
15
|
+
throw new CliError(`${name} does not exist, and a lifecycle needs two states at least.`, `Pass each state with --value, the initial one first: \`ddd-ts-kit generate state-machine ${scope.context.kebab} ${aggregate.pascal} --value draft --value issued --transition "issue:draft>issued"\`.`);
|
|
16
|
+
}
|
|
17
|
+
const text = vocabularyText(name, asked, existing);
|
|
18
|
+
if (existing === undefined) {
|
|
19
|
+
scope.ws.create(file, text);
|
|
20
|
+
}
|
|
21
|
+
else if (text !== existing) {
|
|
22
|
+
scope.ws.update(file, text);
|
|
23
|
+
}
|
|
24
|
+
return heldEntries(text);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=status-vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-vocabulary.js","sourceRoot":"","sources":["../../../../src/generate/kinds/state-machine/status-vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE;;;GAGG;AACH,MAAM,UAAU,gBAAgB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AC;AAUvC,eAAO,MAAM,gBAAgB,EAAE,IAgC9B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { emit } from '../emit.js';
|
|
2
|
+
import { learnTerms } from '../learn-terms.js';
|
|
3
|
+
import { named } from '../named.js';
|
|
4
|
+
import { openScope } from '../open-scope.js';
|
|
5
|
+
import { vars } from '../vars.js';
|
|
6
|
+
import { existingAggregate } from './existing-aggregate.js';
|
|
7
|
+
import { parseTransitions } from './state-machine/parse-transitions.js';
|
|
8
|
+
import { stateMachineVars } from './state-machine/state-machine-vars.js';
|
|
9
|
+
import { statusVocabulary } from './state-machine/status-vocabulary.js';
|
|
10
|
+
export const stateMachineKind = {
|
|
11
|
+
name: 'state-machine',
|
|
12
|
+
aliases: [],
|
|
13
|
+
usage: 'state-machine <context> <Aggregate> [--value <state>]... [--transition "<intention>:<from>[,<from>]...[><to>]"]... [--term "<Term>=<meaning>"]...',
|
|
14
|
+
summary: 'The lifecycle of an aggregate: its status as the closed vocabulary <Aggregate>Status (created, or extended with the --value it misses, the first one initial), the machine of domain/state-machines/ with the transitions asked, and its spec. CONTEXT.md draws it.',
|
|
15
|
+
positionals: ['context', 'Aggregate'],
|
|
16
|
+
writesShared: false,
|
|
17
|
+
run: (request) => {
|
|
18
|
+
const scope = openScope(request);
|
|
19
|
+
learnTerms(scope);
|
|
20
|
+
const aggregate = existingAggregate(scope, request.args[1] ?? '');
|
|
21
|
+
const states = statusVocabulary(scope, aggregate);
|
|
22
|
+
const transitions = parseTransitions(request.flags.transition, states.map(({ value }) => value));
|
|
23
|
+
const context = vars(scope, {
|
|
24
|
+
aggregate: named(aggregate),
|
|
25
|
+
machine: stateMachineVars({ aggregate, states, transitions }),
|
|
26
|
+
});
|
|
27
|
+
emit(scope, context, [
|
|
28
|
+
['state-machine/state-machine.ts.tpl', `domain/state-machines/${aggregate.kebab}.state-machine.ts`],
|
|
29
|
+
['state-machine/state-machine.spec.ts.tpl', `test/unit/${aggregate.kebab}.state-machine.spec.ts`],
|
|
30
|
+
]);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=state-machine-kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-machine-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/state-machine-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,MAAM,CAAC,MAAM,gBAAgB,GAAS;IACpC,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,EAAE;IACX,KAAK,EACH,mJAAmJ;IACrJ,OAAO,EACL,qQAAqQ;IACvQ,WAAW,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;IACrC,YAAY,EAAE,KAAK;IACnB,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAEjC,UAAU,CAAC,KAAK,CAAC,CAAC;QAElB,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAElD,MAAM,WAAW,GAAG,gBAAgB,CAClC,OAAO,CAAC,KAAK,CAAC,UAAU,EACxB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CACjC,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE;YAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;YAC3B,OAAO,EAAE,gBAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;SAC9D,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;YACnB,CAAC,oCAAoC,EAAE,yBAAyB,SAAS,CAAC,KAAK,mBAAmB,CAAC;YACnG,CAAC,yCAAyC,EAAE,aAAa,SAAS,CAAC,KAAK,wBAAwB,CAAC;SAClG,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Name } from '../../naming/index.js';
|
|
2
|
+
import type { Scope } from '../scope.js';
|
|
3
|
+
/**
|
|
4
|
+
* An event-sourced aggregate: the class with its birth event and the apply method of it, the codec
|
|
5
|
+
* of its stored events, a builder that replays a history and a given-events spec.
|
|
6
|
+
*/
|
|
7
|
+
export declare function writeEventSourcedAggregate(scope: Scope, name: Name): void;
|
|
8
|
+
//# sourceMappingURL=write-event-sourced-aggregate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-event-sourced-aggregate.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/write-event-sourced-aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAIlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAOzC;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAgBzE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { emit } from '../emit.js';
|
|
2
|
+
import { eventNames } from '../event-names.js';
|
|
3
|
+
import { named } from '../named.js';
|
|
4
|
+
import { vars } from '../vars.js';
|
|
5
|
+
import { writeDomainEvent } from './write-domain-event.js';
|
|
6
|
+
/** The fact every event-sourced aggregate is born with: its stream starts with it. */
|
|
7
|
+
const BIRTH = 'Created';
|
|
8
|
+
/**
|
|
9
|
+
* An event-sourced aggregate: the class with its birth event and the apply method of it, the codec
|
|
10
|
+
* of its stored events, a builder that replays a history and a given-events spec.
|
|
11
|
+
*/
|
|
12
|
+
export function writeEventSourcedAggregate(scope, name) {
|
|
13
|
+
const names = eventNames(scope, name.pascal, BIRTH);
|
|
14
|
+
const event = { ...named(names.event), name: names.eventName, fact: names.fact.pascal };
|
|
15
|
+
emit(scope, vars(scope, { name: named(name), aggregate: named(name), event }), [
|
|
16
|
+
['aggregate/event-sourced.aggregate.ts.tpl', `domain/aggregates/${name.kebab}.aggregate.ts`],
|
|
17
|
+
['aggregate/event-sourced.events.mapper.ts.tpl', `infrastructure/persistence/${name.kebab}-events.mapper.ts`],
|
|
18
|
+
['builder/event-sourced.builder.ts.tpl', `test/builders/${name.kebab}.builder.ts`],
|
|
19
|
+
['aggregate/event-sourced.aggregate.spec.ts.tpl', `test/unit/${name.kebab}.aggregate.spec.ts`],
|
|
20
|
+
]);
|
|
21
|
+
writeDomainEvent(scope, names);
|
|
22
|
+
scope.ws.note(`${name.pascal} is event-sourced: its repository adapter delegates to EventSourcedRepository of @ddd-ts-kit/kernel over the EventStore of the ORM adapter (createKnexEventSourcing, createDrizzleEventSourcing, createPrismaEventSourcing, createTypeOrmEventSourcing), and its stored events are declared in infrastructure/persistence/${name.kebab}-events.mapper.ts. See docs/concepts/event-sourcing.md of ddd-ts-kit.`);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=write-event-sourced-aggregate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-event-sourced-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AAI,CACX,GAAG,IAAI,CAAC,MAAM,6TAA6T,IAAI,CAAC,KAAK,uEAAuE,CAC7Z,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../src/generate/kinds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../src/generate/kinds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAoCtC,qEAAqE;AACrE,eAAO,MAAM,KAAK,EAAE,SAAS,IAAI,EAoChC,CAAC"}
|
package/dist/generate/kinds.js
CHANGED
|
@@ -2,6 +2,7 @@ import { aclKind } from './kinds/acl-kind.js';
|
|
|
2
2
|
import { adapterKind } from './kinds/adapter-kind.js';
|
|
3
3
|
import { adrKind } from './kinds/adr-kind.js';
|
|
4
4
|
import { aggregateKind } from './kinds/aggregate-kind.js';
|
|
5
|
+
import { backgroundJobKind } from './kinds/background-job-kind.js';
|
|
5
6
|
import { builderKind } from './kinds/builder-kind.js';
|
|
6
7
|
import { commandKind } from './kinds/command-kind.js';
|
|
7
8
|
import { contextKind } from './kinds/context-kind.js';
|
|
@@ -20,12 +21,14 @@ import { integrationHandlerKind } from './kinds/integration-handler-kind.js';
|
|
|
20
21
|
import { jobKind } from './kinds/job-kind.js';
|
|
21
22
|
import { policyKind } from './kinds/policy-kind.js';
|
|
22
23
|
import { portKind } from './kinds/port-kind.js';
|
|
24
|
+
import { processKind } from './kinds/process-kind.js';
|
|
23
25
|
import { projectionKind } from './kinds/projection-kind.js';
|
|
24
26
|
import { queryKind } from './kinds/query-kind.js';
|
|
25
27
|
import { repositoryKind } from './kinds/repository-kind.js';
|
|
26
28
|
import { routeGroupKind } from './kinds/route-group-kind.js';
|
|
27
29
|
import { controllerKind, routeKind } from './kinds/route-kind.js';
|
|
28
30
|
import { serviceKind } from './kinds/service-kind.js';
|
|
31
|
+
import { stateMachineKind } from './kinds/state-machine-kind.js';
|
|
29
32
|
import { valueObjectKind } from './kinds/value-object-kind.js';
|
|
30
33
|
import { vocabularyKind } from './kinds/vocabulary-kind.js';
|
|
31
34
|
import { workerKind } from './kinds/worker-kind.js';
|
|
@@ -37,6 +40,7 @@ export const KINDS = [
|
|
|
37
40
|
entityKind,
|
|
38
41
|
valueObjectKind,
|
|
39
42
|
vocabularyKind,
|
|
43
|
+
stateMachineKind,
|
|
40
44
|
domainEventKind,
|
|
41
45
|
errorKind,
|
|
42
46
|
domainErrorKind,
|
|
@@ -55,6 +59,8 @@ export const KINDS = [
|
|
|
55
59
|
eventHandlerKind,
|
|
56
60
|
projectionKind,
|
|
57
61
|
jobKind,
|
|
62
|
+
backgroundJobKind,
|
|
63
|
+
processKind,
|
|
58
64
|
aclKind,
|
|
59
65
|
e2eKind,
|
|
60
66
|
policyKind,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.js","sourceRoot":"","sources":["../../src/generate/kinds.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAA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IACP,iBAAiB;IACjB,WAAW;IACX,OAAO;IACP,OAAO;IACP,UAAU;IACV,WAAW;IACX,WAAW;IACX,WAAW;IACX,UAAU;IACV,OAAO;CACR,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { VocabularyEntry } from './vocabulary-entry.js';
|
|
2
|
+
/** The entries the file of a closed vocabulary holds, in their order: `NoShow: 'no-show',` one per line. */
|
|
3
|
+
export declare function heldEntries(text: string): VocabularyEntry[];
|
|
4
|
+
//# sourceMappingURL=held-entries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"held-entries.d.ts","sourceRoot":"","sources":["../../../src/generate/vocabulary/held-entries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,4GAA4G;AAC5G,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CAE3D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const DECLARED_VALUE = /^\s*([A-Za-z_$][\w$]*)\s*:\s*'([^']*)',?\s*$/gm;
|
|
2
|
+
/** The entries the file of a closed vocabulary holds, in their order: `NoShow: 'no-show',` one per line. */
|
|
3
|
+
export function heldEntries(text) {
|
|
4
|
+
return [...text.matchAll(DECLARED_VALUE)].map(([, key = '', value = '']) => ({ key, value }));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=held-entries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"held-entries.js","sourceRoot":"","sources":["../../../src/generate/vocabulary/held-entries.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,gDAAgD,CAAC;AAExE,4GAA4G;AAC5G,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAChG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary-text.d.ts","sourceRoot":"","sources":["../../../src/generate/vocabulary/vocabulary-text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vocabulary-text.d.ts","sourceRoot":"","sources":["../../../src/generate/vocabulary/vocabulary-text.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,eAAe,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAuB3G"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { heldEntries } from './held-entries.js';
|
|
2
2
|
/**
|
|
3
3
|
* The file of a closed vocabulary: an object `as const` of its values and the union type of the
|
|
4
4
|
* same name, so that `AppointmentStatus.NoShow` is completed by the editor and a parameter typed
|
|
@@ -16,7 +16,7 @@ export function vocabularyText(name, entries, existing) {
|
|
|
16
16
|
'',
|
|
17
17
|
].join('\n');
|
|
18
18
|
}
|
|
19
|
-
const held = new Set(
|
|
19
|
+
const held = new Set(heldEntries(existing).map(({ value }) => value));
|
|
20
20
|
const missing = entries.filter(({ value }) => !held.has(value));
|
|
21
21
|
const end = existing.indexOf('} as const;');
|
|
22
22
|
if (missing.length === 0 || end === -1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary-text.js","sourceRoot":"","sources":["../../../src/generate/vocabulary/vocabulary-text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vocabulary-text.js","sourceRoot":"","sources":["../../../src/generate/vocabulary/vocabulary-text.ts"],"names":[],"mappings":"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C,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;AACnE,CAAC"}
|
package/dist/help/notes.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** What a line of the usage cannot say about a command or a flag. */
|
|
2
|
-
export declare const NOTES = " affected what a pull request has to run: the contexts a change set reaches through the context\n map (a changed context and the contexts downstream of it), as filters for the test\n runner and the linter; everything when a shared path changed or without --base\n build-aliases after the compiler: rewrites the import aliases left in the emitted .js and .d.ts files\n into relative paths, so that plain node runs the output (tsconfig.build.json by default)\n error-factories moves a project from one class per error to static factories on one error class per\n concept: --plan writes error-factories.plan.json, where each class is given its concept;\n --apply follows it (classes, specs, every usage, \"stack.refusals\" in the config)\n value-objects moves the value objects of a project from a Result to factories that return the value or\n throw: every create returning Result<T, E> returns T, err(..) is thrown, unwrap(..) of\n them goes, specs assert expectRefusal(() => ..), \"stack.valueObjects\" becomes throwing\n controllers moves the function routes of a project, or of one context, to controller classes: each\n <name>.route.ts becomes <resource>/<name>/<name>.controller.ts behind the route group of\n its resource, its schema files and its spec follow; a context is turned whole or not at all\n describe one context as facts: use cases, routes, events, ports, policies, gateways, dependencies\n status the next step of docs/architecture/plan.md, the slices of docs/architecture/slices.md by\n status and by owner, and the TODO(domain), TODO(platform) and it.todo left in each context\n sdk the typed client of each document of the contract, a workspace package under\n clients/<document> without runtime dependency: typed errors keyed by the error codes,\n credentials per security scheme; records \"sdk\" in the config the first time, wires the\n scripts (docs:generate regenerates it, docs:check compares it, ci:build builds it);\n --check writes nothing and exits 1 while a client differs from its contract\n todo those markers as file:line, in the project or in one context\n worker-scope a git worktree on the branch build/<context> (by default ../<project>-<context>), its\n .ddd-ts-kit/worker.json, and the briefing of the worker of that context\n --commit-size the files and lines about to be committed against \"commit\" in the config (20 files and\n 600 lines by default, generated files not counted); --staged reads the index only;\n advisory, --strict exits 1 when over\n --sdk init records \"sdk\" in the config and generates the clients with the project\n --local-only generate refuses, and writes nothing, when the kind would write outside its context;\n \"generate --help --json\" says which kinds do";
|
|
2
|
+
export declare const NOTES = " affected what a pull request has to run: the contexts a change set reaches through the context\n map (a changed context and the contexts downstream of it), as filters for the test\n runner and the linter; everything when a shared path changed or without --base\n build-aliases after the compiler: rewrites the import aliases left in the emitted .js and .d.ts files\n into relative paths, so that plain node runs the output (tsconfig.build.json by default)\n error-factories moves a project from one class per error to static factories on one error class per\n concept: --plan writes error-factories.plan.json, where each class is given its concept;\n --apply follows it (classes, specs, every usage, \"stack.refusals\" in the config)\n value-objects moves the value objects of a project from a Result to factories that return the value or\n throw: every create returning Result<T, E> returns T, err(..) is thrown, unwrap(..) of\n them goes, specs assert expectRefusal(() => ..), \"stack.valueObjects\" becomes throwing\n controllers moves the function routes of a project, or of one context, to controller classes: each\n <name>.route.ts becomes <resource>/<name>/<name>.controller.ts behind the route group of\n its resource, its schema files and its spec follow; a context is turned whole or not at all\n describe one context as facts: use cases, routes, events, ports, policies, gateways, dependencies\n status the next step of docs/architecture/plan.md, the slices of docs/architecture/slices.md by\n status and by owner, and the TODO(domain), TODO(platform) and it.todo left in each context\n sdk the typed client of each document of the contract, a workspace package under\n clients/<document> without runtime dependency: typed errors keyed by the error codes,\n credentials per security scheme; records \"sdk\" in the config the first time, wires the\n scripts (docs:generate regenerates it, docs:check compares it, ci:build builds it);\n --check writes nothing and exits 1 while a client differs from its contract\n todo those markers as file:line, in the project or in one context\n worker-scope a git worktree on the branch build/<context> (by default ../<project>-<context>), its\n .ddd-ts-kit/worker.json, and the briefing of the worker of that context\n --commit-size the files and lines about to be committed against \"commit\" in the config (20 files and\n 600 lines by default, generated files not counted); --staged reads the index only;\n advisory, --strict exits 1 when over\n --stored-events docs records the shape of each version of the stored events in stored-events.lock.json,\n never rewriting a recorded one: run it once the shape of a version is the one to store;\n docs --check fails while a declared version is not recorded\n --sdk init records \"sdk\" in the config and generates the clients with the project\n --local-only generate refuses, and writes nothing, when the kind would write outside its context;\n \"generate --help --json\" says which kinds do";
|
|
3
3
|
//# sourceMappingURL=notes.d.ts.map
|
package/dist/help/notes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notes.d.ts","sourceRoot":"","sources":["../../src/help/notes.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"notes.d.ts","sourceRoot":"","sources":["../../src/help/notes.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,eAAO,MAAM,KAAK,43GAiC8C,CAAC"}
|
package/dist/help/notes.js
CHANGED
|
@@ -27,6 +27,9 @@ export const NOTES = ` affected what a pull request has to run: the con
|
|
|
27
27
|
--commit-size the files and lines about to be committed against "commit" in the config (20 files and
|
|
28
28
|
600 lines by default, generated files not counted); --staged reads the index only;
|
|
29
29
|
advisory, --strict exits 1 when over
|
|
30
|
+
--stored-events docs records the shape of each version of the stored events in stored-events.lock.json,
|
|
31
|
+
never rewriting a recorded one: run it once the shape of a version is the one to store;
|
|
32
|
+
docs --check fails while a declared version is not recorded
|
|
30
33
|
--sdk init records "sdk" in the config and generates the clients with the project
|
|
31
34
|
--local-only generate refuses, and writes nothing, when the kind would write outside its context;
|
|
32
35
|
"generate --help --json" says which kinds do`;
|
package/dist/help/notes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notes.js","sourceRoot":"","sources":["../../src/help/notes.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,CAAC,MAAM,KAAK,GAAG
|
|
1
|
+
{"version":3,"file":"notes.js","sourceRoot":"","sources":["../../src/help/notes.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEAiC2C,CAAC"}
|