ddd-ts-kit 0.16.1 → 0.18.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.fr.md +14 -15
- package/README.md +13 -13
- package/dist/affected/reach-of.js +1 -1
- package/dist/affected/reach-of.js.map +1 -1
- package/dist/check/business-names/closing-parenthesis.d.ts +3 -0
- package/dist/check/business-names/closing-parenthesis.d.ts.map +1 -0
- package/dist/check/business-names/closing-parenthesis.js +16 -0
- package/dist/check/business-names/closing-parenthesis.js.map +1 -0
- package/dist/check/business-names/declared-bindings.d.ts +4 -0
- package/dist/check/business-names/declared-bindings.d.ts.map +1 -0
- package/dist/check/business-names/declared-bindings.js +41 -0
- package/dist/check/business-names/declared-bindings.js.map +1 -0
- package/dist/check/business-names/generic-words-of.d.ts +4 -0
- package/dist/check/business-names/generic-words-of.d.ts.map +1 -0
- package/dist/check/business-names/generic-words-of.js +7 -0
- package/dist/check/business-names/generic-words-of.js.map +1 -0
- package/dist/check/business-names/generic-words.d.ts +7 -0
- package/dist/check/business-names/generic-words.d.ts.map +1 -0
- package/dist/check/business-names/generic-words.js +26 -0
- package/dist/check/business-names/generic-words.js.map +1 -0
- package/dist/check/business-names/identifier-at.d.ts +3 -0
- package/dist/check/business-names/identifier-at.d.ts.map +1 -0
- package/dist/check/business-names/identifier-at.js +6 -0
- package/dist/check/business-names/identifier-at.js.map +1 -0
- package/dist/check/business-names/judges-names.d.ts +7 -0
- package/dist/check/business-names/judges-names.d.ts.map +1 -0
- package/dist/check/business-names/judges-names.js +14 -0
- package/dist/check/business-names/judges-names.js.map +1 -0
- package/dist/check/business-names/named-binding.d.ts +12 -0
- package/dist/check/business-names/named-binding.d.ts.map +1 -0
- package/dist/check/business-names/named-binding.js +2 -0
- package/dist/check/business-names/named-binding.js.map +1 -0
- package/dist/check/business-names/named-bindings.d.ts +4 -0
- package/dist/check/business-names/named-bindings.d.ts.map +1 -0
- package/dist/check/business-names/named-bindings.js +8 -0
- package/dist/check/business-names/named-bindings.js.map +1 -0
- package/dist/check/business-names/opening-bracket.d.ts +3 -0
- package/dist/check/business-names/opening-bracket.d.ts.map +1 -0
- package/dist/check/business-names/opening-bracket.js +16 -0
- package/dist/check/business-names/opening-bracket.js.map +1 -0
- package/dist/check/business-names/parameter-bindings.d.ts +4 -0
- package/dist/check/business-names/parameter-bindings.d.ts.map +1 -0
- package/dist/check/business-names/parameter-bindings.js +28 -0
- package/dist/check/business-names/parameter-bindings.js.map +1 -0
- package/dist/check/business-names/parameter-lists.d.ts +14 -0
- package/dist/check/business-names/parameter-lists.d.ts.map +1 -0
- package/dist/check/business-names/parameter-lists.js +109 -0
- package/dist/check/business-names/parameter-lists.js.map +1 -0
- package/dist/check/business-names/pattern-bindings.d.ts +7 -0
- package/dist/check/business-names/pattern-bindings.d.ts.map +1 -0
- package/dist/check/business-names/pattern-bindings.js +31 -0
- package/dist/check/business-names/pattern-bindings.js.map +1 -0
- package/dist/check/business-names/property-bindings.d.ts +7 -0
- package/dist/check/business-names/property-bindings.d.ts.map +1 -0
- package/dist/check/business-names/property-bindings.js +31 -0
- package/dist/check/business-names/property-bindings.js.map +1 -0
- package/dist/check/business-names/suggested-name.d.ts +8 -0
- package/dist/check/business-names/suggested-name.d.ts.map +1 -0
- package/dist/check/business-names/suggested-name.js +28 -0
- package/dist/check/business-names/suggested-name.js.map +1 -0
- package/dist/check/business-names/top-level-separator.d.ts +3 -0
- package/dist/check/business-names/top-level-separator.d.ts.map +1 -0
- package/dist/check/business-names/top-level-separator.js +23 -0
- package/dist/check/business-names/top-level-separator.js.map +1 -0
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +4 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/declarations/declared-event-handlers.d.ts +4 -9
- package/dist/check/declarations/declared-event-handlers.d.ts.map +1 -1
- package/dist/check/declarations/declared-event-handlers.js +5 -5
- package/dist/check/declarations/declared-event-handlers.js.map +1 -1
- package/dist/check/declarations/option-of.d.ts +0 -2
- package/dist/check/declarations/option-of.d.ts.map +1 -1
- package/dist/check/declarations/option-of.js +1 -7
- package/dist/check/declarations/option-of.js.map +1 -1
- package/dist/check/explain/authz-docs.d.ts.map +1 -1
- package/dist/check/explain/authz-docs.js +14 -1
- package/dist/check/explain/authz-docs.js.map +1 -1
- package/dist/check/explain/events-docs.d.ts.map +1 -1
- package/dist/check/explain/events-docs.js +31 -11
- package/dist/check/explain/events-docs.js.map +1 -1
- package/dist/check/explain/ports-docs.d.ts.map +1 -1
- package/dist/check/explain/ports-docs.js +11 -9
- package/dist/check/explain/ports-docs.js.map +1 -1
- package/dist/check/explain/scheduling-docs.d.ts.map +1 -1
- package/dist/check/explain/scheduling-docs.js +10 -5
- package/dist/check/explain/scheduling-docs.js.map +1 -1
- package/dist/check/explain/tree-docs.d.ts.map +1 -1
- package/dist/check/explain/tree-docs.js +11 -0
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/explain/wiring-docs.js +4 -4
- package/dist/check/explain/wiring-docs.js.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.d.ts +3 -0
- package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/authz-policy-fixtures.js +97 -0
- package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -0
- package/dist/check/fixtures/business-name-fixtures.d.ts +3 -0
- package/dist/check/fixtures/business-name-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/business-name-fixtures.js +98 -0
- package/dist/check/fixtures/business-name-fixtures.js.map +1 -0
- package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.js +2 -42
- package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
- package/dist/check/fixtures/declared.d.ts.map +1 -1
- package/dist/check/fixtures/declared.js +3 -3
- package/dist/check/fixtures/declared.js.map +1 -1
- package/dist/check/fixtures/domain-events-fixtures.js +1 -1
- package/dist/check/fixtures/domain-events-fixtures.js.map +1 -1
- 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/rules/authz-policy-asked.d.ts +3 -0
- package/dist/check/rules/authz-policy-asked.d.ts.map +1 -0
- package/dist/check/rules/authz-policy-asked.js +184 -0
- package/dist/check/rules/authz-policy-asked.js.map +1 -0
- package/dist/check/rules/declarations-role-declared.d.ts.map +1 -1
- package/dist/check/rules/declarations-role-declared.js +4 -35
- package/dist/check/rules/declarations-role-declared.js.map +1 -1
- package/dist/check/rules/events-consumer-idempotent.js +3 -3
- package/dist/check/rules/events-consumer-idempotent.js.map +1 -1
- package/dist/check/rules/naming-business-name.d.ts +3 -0
- package/dist/check/rules/naming-business-name.d.ts.map +1 -0
- package/dist/check/rules/naming-business-name.js +41 -0
- package/dist/check/rules/naming-business-name.js.map +1 -0
- package/dist/config/config.d.ts +8 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/parse-business-names.d.ts +4 -0
- package/dist/config/parse-business-names.d.ts.map +1 -0
- package/dist/config/parse-business-names.js +14 -0
- package/dist/config/parse-business-names.js.map +1 -0
- package/dist/config/parse-config.d.ts.map +1 -1
- package/dist/config/parse-config.js +2 -0
- package/dist/config/parse-config.js.map +1 -1
- package/dist/config/serialize-config.js +9 -1
- package/dist/config/serialize-config.js.map +1 -1
- package/dist/generate/emit.d.ts.map +1 -1
- package/dist/generate/emit.js +2 -14
- package/dist/generate/emit.js.map +1 -1
- package/dist/generate/kinds/ask-policy-in-generated-use-case.d.ts +9 -0
- package/dist/generate/kinds/ask-policy-in-generated-use-case.d.ts.map +1 -0
- package/dist/generate/kinds/ask-policy-in-generated-use-case.js +102 -0
- package/dist/generate/kinds/ask-policy-in-generated-use-case.js.map +1 -0
- package/dist/generate/kinds/assert-declares-its-name.d.ts +9 -0
- package/dist/generate/kinds/assert-declares-its-name.d.ts.map +1 -0
- package/dist/generate/kinds/assert-declares-its-name.js +16 -0
- package/dist/generate/kinds/assert-declares-its-name.js.map +1 -0
- package/dist/generate/kinds/command-context.d.ts +12 -0
- package/dist/generate/kinds/command-context.d.ts.map +1 -0
- package/dist/generate/kinds/command-context.js +18 -0
- package/dist/generate/kinds/command-context.js.map +1 -0
- package/dist/generate/kinds/command-kind.d.ts.map +1 -1
- package/dist/generate/kinds/command-kind.js +7 -24
- package/dist/generate/kinds/command-kind.js.map +1 -1
- package/dist/generate/kinds/command-outputs.d.ts +6 -0
- package/dist/generate/kinds/command-outputs.d.ts.map +1 -0
- package/dist/generate/kinds/command-outputs.js +13 -0
- package/dist/generate/kinds/command-outputs.js.map +1 -0
- package/dist/generate/kinds/declares-its-name.d.ts +5 -0
- package/dist/generate/kinds/declares-its-name.d.ts.map +1 -0
- package/dist/generate/kinds/declares-its-name.js +7 -0
- package/dist/generate/kinds/declares-its-name.js.map +1 -0
- package/dist/generate/kinds/event-file-of.d.ts +5 -0
- package/dist/generate/kinds/event-file-of.d.ts.map +1 -0
- package/dist/generate/kinds/event-file-of.js +5 -0
- package/dist/generate/kinds/event-file-of.js.map +1 -0
- package/dist/generate/kinds/event-handler-kind.d.ts.map +1 -1
- package/dist/generate/kinds/event-handler-kind.js +2 -0
- package/dist/generate/kinds/event-handler-kind.js.map +1 -1
- package/dist/generate/kinds/event-name-reference.d.ts +4 -3
- package/dist/generate/kinds/event-name-reference.d.ts.map +1 -1
- package/dist/generate/kinds/event-name-reference.js +6 -6
- package/dist/generate/kinds/event-name-reference.js.map +1 -1
- package/dist/generate/kinds/integration-event-kind.d.ts.map +1 -1
- package/dist/generate/kinds/integration-event-kind.js +2 -0
- package/dist/generate/kinds/integration-event-kind.js.map +1 -1
- package/dist/generate/kinds/policy-kind.d.ts.map +1 -1
- package/dist/generate/kinds/policy-kind.js +2 -0
- package/dist/generate/kinds/policy-kind.js.map +1 -1
- package/dist/generate/kinds/query-context.d.ts +9 -0
- package/dist/generate/kinds/query-context.d.ts.map +1 -0
- package/dist/generate/kinds/query-context.js +27 -0
- package/dist/generate/kinds/query-context.js.map +1 -0
- package/dist/generate/kinds/query-kind.d.ts.map +1 -1
- package/dist/generate/kinds/query-kind.js +16 -51
- package/dist/generate/kinds/query-kind.js.map +1 -1
- package/dist/generate/kinds/query-outputs.d.ts +8 -0
- package/dist/generate/kinds/query-outputs.d.ts.map +1 -0
- package/dist/generate/kinds/query-outputs.js +20 -0
- package/dist/generate/kinds/query-outputs.js.map +1 -0
- package/dist/generate/kinds/reader-file.d.ts +8 -0
- package/dist/generate/kinds/reader-file.d.ts.map +1 -0
- package/dist/generate/kinds/reader-file.js +9 -0
- package/dist/generate/kinds/reader-file.js.map +1 -0
- package/dist/generate/kinds/route/write-controller.d.ts.map +1 -1
- package/dist/generate/kinds/route/write-controller.js +2 -1
- package/dist/generate/kinds/route/write-controller.js.map +1 -1
- package/dist/generate/kinds/route-kind.d.ts.map +1 -1
- package/dist/generate/kinds/route-kind.js +2 -1
- package/dist/generate/kinds/route-kind.js.map +1 -1
- package/dist/generate/mark-policy-questions.d.ts +10 -0
- package/dist/generate/mark-policy-questions.d.ts.map +1 -0
- package/dist/generate/mark-policy-questions.js +76 -0
- package/dist/generate/mark-policy-questions.js.map +1 -0
- package/dist/generate/permission-pattern.d.ts +4 -0
- package/dist/generate/permission-pattern.d.ts.map +1 -0
- package/dist/generate/permission-pattern.js +7 -0
- package/dist/generate/permission-pattern.js.map +1 -0
- package/dist/generate/refined-by-policy.d.ts +4 -0
- package/dist/generate/refined-by-policy.d.ts.map +1 -0
- package/dist/generate/refined-by-policy.js +9 -0
- package/dist/generate/refined-by-policy.js.map +1 -0
- package/dist/generate/rendered.d.ts +5 -0
- package/dist/generate/rendered.d.ts.map +1 -0
- package/dist/generate/rendered.js +18 -0
- package/dist/generate/rendered.js.map +1 -0
- package/dist/generate/searched-elements.d.ts +13 -0
- package/dist/generate/searched-elements.d.ts.map +1 -0
- package/dist/generate/searched-elements.js +63 -0
- package/dist/generate/searched-elements.js.map +1 -0
- package/dist/generate/wire.d.ts.map +1 -1
- package/dist/generate/wire.js +3 -25
- package/dist/generate/wire.js.map +1 -1
- package/dist/generate/wirings.d.ts +8 -0
- package/dist/generate/wirings.d.ts.map +1 -0
- package/dist/generate/wirings.js +28 -0
- package/dist/generate/wirings.js.map +1 -0
- package/dist/init/copilot-instruction.d.ts +6 -0
- package/dist/init/copilot-instruction.d.ts.map +1 -0
- package/dist/init/copilot-instruction.js +15 -0
- package/dist/init/copilot-instruction.js.map +1 -0
- package/dist/init/files/guidance-files.d.ts +1 -0
- package/dist/init/files/guidance-files.d.ts.map +1 -1
- package/dist/init/files/guidance-files.js +4 -3
- package/dist/init/files/guidance-files.js.map +1 -1
- package/dist/init/files/layer-rules.d.ts +3 -0
- package/dist/init/files/layer-rules.d.ts.map +1 -0
- package/dist/init/files/layer-rules.js +11 -0
- package/dist/init/files/layer-rules.js.map +1 -0
- package/dist/init/files/pipeline-files.d.ts.map +1 -1
- package/dist/init/files/pipeline-files.js +2 -0
- package/dist/init/files/pipeline-files.js.map +1 -1
- package/dist/init/json-object.d.ts +3 -0
- package/dist/init/json-object.d.ts.map +1 -0
- package/dist/init/json-object.js +12 -0
- package/dist/init/json-object.js.map +1 -0
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +4 -0
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/write-agent-settings.d.ts.map +1 -1
- package/dist/init/write-agent-settings.js +3 -10
- package/dist/init/write-agent-settings.js.map +1 -1
- package/dist/init/write-copilot-instructions.d.ts +7 -0
- package/dist/init/write-copilot-instructions.d.ts.map +1 -0
- package/dist/init/write-copilot-instructions.js +16 -0
- package/dist/init/write-copilot-instructions.js.map +1 -0
- package/dist/init/write-copilot-settings.d.ts +8 -0
- package/dist/init/write-copilot-settings.d.ts.map +1 -0
- package/dist/init/write-copilot-settings.js +36 -0
- package/dist/init/write-copilot-settings.js.map +1 -0
- package/dist/markers/index.d.ts +1 -0
- package/dist/markers/index.d.ts.map +1 -1
- package/dist/markers/index.js +1 -0
- package/dist/markers/index.js.map +1 -1
- package/dist/markers/replace-in-region.d.ts +10 -0
- package/dist/markers/replace-in-region.d.ts.map +1 -0
- package/dist/markers/replace-in-region.js +30 -0
- package/dist/markers/replace-in-region.js.map +1 -0
- 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/plural.d.ts +3 -0
- package/dist/naming/plural.d.ts.map +1 -0
- package/dist/naming/plural.js +8 -0
- package/dist/naming/plural.js.map +1 -0
- package/dist/naming/singular.d.ts +3 -0
- package/dist/naming/singular.d.ts.map +1 -0
- package/dist/naming/singular.js +11 -0
- package/dist/naming/singular.js.map +1 -0
- package/dist/naming/to-name.d.ts.map +1 -1
- package/dist/naming/to-name.js +1 -6
- package/dist/naming/to-name.js.map +1 -1
- package/dist/sdk/agent-instruction.d.ts +1 -1
- package/dist/sdk/agent-instruction.js +1 -1
- package/dist/sdk/instruct-agents.d.ts +1 -1
- package/dist/sdk/instruct-agents.d.ts.map +1 -1
- package/dist/sdk/instruct-agents.js +12 -8
- package/dist/sdk/instruct-agents.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +24 -3
- package/templates/command/handler.declared.ts.tpl +32 -3
- package/templates/command/handler.spec.buses.ts.tpl +24 -1
- package/templates/command/handler.ts.tpl +32 -3
- package/templates/command/wiring.manual.tpl +2 -2
- package/templates/command/wiring.tsyringe.tpl +5 -2
- package/templates/controller/controller.search.ts.tpl +1 -1
- package/templates/event-handler/event-handler.declared.ts.tpl +1 -1
- package/templates/init/AGENTS.md.tpl +46 -0
- package/templates/init/CLAUDE.md.tpl +2 -45
- package/templates/init/README.md.tpl +1 -1
- package/templates/init/rules/application.md.tpl +2 -2
- package/templates/init/rules/domain.md.tpl +1 -1
- package/templates/init/scripts/events.ts.tpl +6 -6
- package/templates/init/scripts/openapi.ts.tpl +2 -2
- package/templates/integration-event/publisher.declared.ts.tpl +1 -1
- package/templates/pipeline/github/workflows/copilot-setup-steps.yml +26 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/policy/policy.declared.ts.tpl +1 -1
- package/templates/policy/policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/integration/publishers/account-deactivated.publisher.ts.tpl +1 -1
- package/templates/presets/identity/context/application/integration/publishers/delegation-granted.publisher.ts.tpl +1 -1
- package/templates/presets/identity/context/application/integration/publishers/delegation-revoked.publisher.ts.tpl +1 -1
- package/templates/presets/identity/context/application/integration/publishers/member-joined.publisher.ts.tpl +1 -1
- package/templates/presets/identity/context/application/integration/publishers/member-removed.publisher.ts.tpl +1 -1
- package/templates/presets/identity/context/application/integration/publishers/member-role-changed.publisher.ts.tpl +1 -1
- package/templates/presets/identity/context/application/integration/publishers/organisation-opened.publisher.ts.tpl +1 -1
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-search-members-reader.repository.drizzle.ts.tpl +2 -2
- package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.controller.ts.tpl +2 -2
- package/templates/presets/identity/context/test/integration/search-members-reader.spec.ts.tpl +1 -1
- package/templates/query/handler.declared.ts.tpl +19 -0
- package/templates/query/handler.spec.buses.ts.tpl +21 -0
- package/templates/query/handler.ts.tpl +19 -0
- package/templates/query/search.reader.fake.ts.tpl +1 -1
- package/templates/query/search.reader.in-memory.ts.tpl +20 -18
- package/templates/query/wiring.manual.tpl +1 -1
- package/templates/query/wiring.tsyringe.tpl +4 -1
- package/templates/route/route.search.ts.tpl +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { matchingBracket } from '../text/matching-bracket.js';
|
|
2
|
+
import { openingBracket } from './opening-bracket.js';
|
|
3
|
+
const FUNCTION = /(?<![\w$.])function\b\s*\*?\s*(?:[A-Za-z_$][\w$]*)?\s*(?:<[^(]*>)?\s*\(/g;
|
|
4
|
+
const MEMBER = /^[ \t]*(?:(?:public|private|protected|static|abstract|override|async|readonly|declare|get|set)\s+)*\*?\s*([A-Za-z_$][\w$]*)\??\s*(?:<[^()\n]*>)?\s*\(/gm;
|
|
5
|
+
const NOT_A_MEMBER = new Set([
|
|
6
|
+
'if',
|
|
7
|
+
'for',
|
|
8
|
+
'while',
|
|
9
|
+
'switch',
|
|
10
|
+
'catch',
|
|
11
|
+
'return',
|
|
12
|
+
'await',
|
|
13
|
+
'typeof',
|
|
14
|
+
'function',
|
|
15
|
+
'new',
|
|
16
|
+
'throw',
|
|
17
|
+
'super',
|
|
18
|
+
'this',
|
|
19
|
+
'void',
|
|
20
|
+
'delete',
|
|
21
|
+
'yield',
|
|
22
|
+
'with',
|
|
23
|
+
'do',
|
|
24
|
+
'else',
|
|
25
|
+
'case',
|
|
26
|
+
]);
|
|
27
|
+
const SIGNATURE_GOES_ON = /^\s*[:{]/;
|
|
28
|
+
const ARROW = /=>/g;
|
|
29
|
+
const IDENTIFIER_CHAR = /[\w$]/;
|
|
30
|
+
/**
|
|
31
|
+
* The parameter lists of a blanked source: functions, methods and signatures of classes,
|
|
32
|
+
* interfaces and object literals (a body or a return type follows their parentheses, which tells
|
|
33
|
+
* them from a call), arrows, and the function types of annotations.
|
|
34
|
+
*/
|
|
35
|
+
export function parameterLists(code) {
|
|
36
|
+
const functions = [...code.matchAll(FUNCTION)].map((match) => enclosed(code, match.index + match[0].length - 1));
|
|
37
|
+
const members = [...code.matchAll(MEMBER)]
|
|
38
|
+
.filter((match) => !NOT_A_MEMBER.has(match[1] ?? ''))
|
|
39
|
+
.map((match) => enclosed(code, match.index + match[0].length - 1))
|
|
40
|
+
.filter(({ close }) => SIGNATURE_GOES_ON.test(code.slice(close + 1, close + 40)));
|
|
41
|
+
const arrows = [...code.matchAll(ARROW)].flatMap((match) => arrowParameters(code, match.index));
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
return [...functions, ...members, ...arrows].filter((list) => {
|
|
44
|
+
const key = 'open' in list ? list.open : list.single;
|
|
45
|
+
const fresh = !seen.has(key);
|
|
46
|
+
seen.add(key);
|
|
47
|
+
return fresh;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function enclosed(code, open) {
|
|
51
|
+
return { open, close: matchingBracket(code, open) };
|
|
52
|
+
}
|
|
53
|
+
/** The parameters of the arrow at `arrow`: `(..) =>`, `(..): Type =>` or `name =>`. */
|
|
54
|
+
function arrowParameters(code, arrow) {
|
|
55
|
+
const last = previousCode(code, arrow - 1);
|
|
56
|
+
if (code.charAt(last) === ')') {
|
|
57
|
+
return listClosingAt(code, last);
|
|
58
|
+
}
|
|
59
|
+
const returnType = returnTypeColon(code, last);
|
|
60
|
+
if (returnType !== undefined) {
|
|
61
|
+
return listClosingAt(code, previousCode(code, returnType - 1));
|
|
62
|
+
}
|
|
63
|
+
if (!IDENTIFIER_CHAR.test(code.charAt(last))) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
let start = last;
|
|
67
|
+
while (start > 0 && IDENTIFIER_CHAR.test(code.charAt(start - 1))) {
|
|
68
|
+
start -= 1;
|
|
69
|
+
}
|
|
70
|
+
return code.charAt(previousCode(code, start - 1)) === '.' ? [] : [{ single: start }];
|
|
71
|
+
}
|
|
72
|
+
function listClosingAt(code, close) {
|
|
73
|
+
if (code.charAt(close) !== ')') {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const open = openingBracket(code, close);
|
|
77
|
+
return open === -1 ? [] : [{ open, close }];
|
|
78
|
+
}
|
|
79
|
+
/** The `:` of a return type written between the parentheses of an arrow and its `=>`. */
|
|
80
|
+
function returnTypeColon(code, from) {
|
|
81
|
+
let depth = 0;
|
|
82
|
+
for (let i = from; i >= Math.max(0, from - 300); i -= 1) {
|
|
83
|
+
const char = code.charAt(i);
|
|
84
|
+
depth += typeDepthChange(code, i);
|
|
85
|
+
if (depth < 0 || (depth === 0 && '=;,'.includes(char))) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
if (depth === 0 && char === ':') {
|
|
89
|
+
return code.charAt(previousCode(code, i - 1)) === ')' ? i : undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
/** Read backwards: a closing bracket of a type opens a level, an opening one closes it; the `>` of `=>` is no bracket. */
|
|
95
|
+
function typeDepthChange(code, at) {
|
|
96
|
+
const char = code.charAt(at);
|
|
97
|
+
if (')]}>'.includes(char)) {
|
|
98
|
+
return char === '>' && code.charAt(at - 1) === '=' ? 0 : 1;
|
|
99
|
+
}
|
|
100
|
+
return '([{<'.includes(char) ? -1 : 0;
|
|
101
|
+
}
|
|
102
|
+
function previousCode(code, from) {
|
|
103
|
+
let at = from;
|
|
104
|
+
while (at > 0 && /\s/.test(code.charAt(at))) {
|
|
105
|
+
at -= 1;
|
|
106
|
+
}
|
|
107
|
+
return at;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=parameter-lists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameter-lists.js","sourceRoot":"","sources":["../../../src/check/business-names/parameter-lists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAKtD,MAAM,QAAQ,GAAG,0EAA0E,CAAC;AAE5F,MAAM,MAAM,GACV,yJAAyJ,CAAC;AAE5J,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,IAAI;IACJ,KAAK;IACL,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,KAAK;IACL,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,QAAQ;IACR,OAAO;IACP,MAAM;IACN,IAAI;IACJ,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,iBA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G,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACxE,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,0HAA0H;AAC1H,SAAS,eAAe,CAAC,IAAY,EAAE,EAAU;IAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAE7B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,IAAY;IAC9C,IAAI,EAAE,GAAG,IAAI,CAAC;IAEd,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QAC5C,EAAE,IAAI,CAAC,CAAC;IACV,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NamedBinding } from './named-binding.js';
|
|
2
|
+
/**
|
|
3
|
+
* The names a destructuring pattern binds, the one opening at `open` (`{` or `[`): the alias of
|
|
4
|
+
* `key: alias`, a shorthand key, a rest element, at any depth. Defaults are not bindings.
|
|
5
|
+
*/
|
|
6
|
+
export declare function patternBindings(code: string, open: number): NamedBinding[];
|
|
7
|
+
//# sourceMappingURL=pattern-bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-bindings.d.ts","sourceRoot":"","sources":["../../../src/check/business-names/pattern-bindings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAU1E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { matchingBracket } from '../text/matching-bracket.js';
|
|
2
|
+
import { splitTopLevel } from '../text/split-top-level.js';
|
|
3
|
+
import { identifierAt } from './identifier-at.js';
|
|
4
|
+
import { topLevelSeparator } from './top-level-separator.js';
|
|
5
|
+
/**
|
|
6
|
+
* The names a destructuring pattern binds, the one opening at `open` (`{` or `[`): the alias of
|
|
7
|
+
* `key: alias`, a shorthand key, a rest element, at any depth. Defaults are not bindings.
|
|
8
|
+
*/
|
|
9
|
+
export function patternBindings(code, open) {
|
|
10
|
+
const close = matchingBracket(code, open);
|
|
11
|
+
const isObject = code.charAt(open) === '{';
|
|
12
|
+
return splitTopLevel(code.slice(open + 1, close)).flatMap((part) => {
|
|
13
|
+
const start = open + 1 + part.start;
|
|
14
|
+
const colon = isObject ? topLevelSeparator(part.code, ':') : -1;
|
|
15
|
+
return elementBindings(code, colon === -1 ? start : valueStart(code, start + colon + 1));
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** One element of a pattern, from its first character: a nested pattern, a rest, or a name with its default. */
|
|
19
|
+
function elementBindings(code, start) {
|
|
20
|
+
const at = code.startsWith('...', start) ? start + 3 : start;
|
|
21
|
+
const opener = code.charAt(at);
|
|
22
|
+
if (opener === '{' || opener === '[') {
|
|
23
|
+
return patternBindings(code, at);
|
|
24
|
+
}
|
|
25
|
+
const name = identifierAt(code, at);
|
|
26
|
+
return name === '' ? [] : [{ name, offset: at, kind: 'destructured binding' }];
|
|
27
|
+
}
|
|
28
|
+
function valueStart(code, from) {
|
|
29
|
+
return from + (/^\s*/.exec(code.slice(from, from + 200))?.[0].length ?? 0);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=pattern-bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-bindings.js","sourceRoot":"","sources":["../../../src/check/business-names/pattern-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAY;IACxD,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC;IAE3C,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACjE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhE,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;AACL,CAAC;AAED,gHAAgH;AAChH,SAAS,eAAe,CAAC,IAAY,EAAE,KAAa;IAClD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAE/B,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACrC,OAAO,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAEpC,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC,CAAC;AACjF,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,IAAY;IAC5C,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NamedBinding } from './named-binding.js';
|
|
2
|
+
/**
|
|
3
|
+
* The properties a source declares in a class, an interface or a type alias of an object: a key
|
|
4
|
+
* of an object literal follows the type it is written for, and is not one of them.
|
|
5
|
+
*/
|
|
6
|
+
export declare function propertyBindings(code: string): NamedBinding[];
|
|
7
|
+
//# sourceMappingURL=property-bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-bindings.d.ts","sourceRoot":"","sources":["../../../src/check/business-names/property-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQvD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAa7D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const PROPERTY = /^[ \t]*(?:(?:public|private|protected|static|readonly|declare|override|abstract)\s+)*([A-Za-z_$][\w$]*)\??\s*(?=:|;|=(?![=>]))/gm;
|
|
2
|
+
const DECLARES_A_SHAPE = /(?:(?<![\w$.])(?:class|interface)\s+[\w$]+[^{;]*|(?<![\w$.])type\s+[\w$]+(?:<[^=]*>)?\s*=\s*)$/;
|
|
3
|
+
/**
|
|
4
|
+
* The properties a source declares in a class, an interface or a type alias of an object: a key
|
|
5
|
+
* of an object literal follows the type it is written for, and is not one of them.
|
|
6
|
+
*/
|
|
7
|
+
export function propertyBindings(code) {
|
|
8
|
+
return [...code.matchAll(PROPERTY)].flatMap((match) => {
|
|
9
|
+
const brace = enclosingBrace(code, match.index);
|
|
10
|
+
const head = code.slice(Math.max(0, brace - 300), brace);
|
|
11
|
+
if (brace === -1 || !DECLARES_A_SHAPE.test(head)) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const name = match[1] ?? '';
|
|
15
|
+
return [{ name, offset: match.index + match[0].lastIndexOf(name), kind: 'property' }];
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function enclosingBrace(code, from) {
|
|
19
|
+
let depth = 0;
|
|
20
|
+
for (let i = from - 1; i >= 0; i -= 1) {
|
|
21
|
+
const char = code.charAt(i);
|
|
22
|
+
if (char === '}') {
|
|
23
|
+
depth += 1;
|
|
24
|
+
}
|
|
25
|
+
else if (char === '{' && (depth -= 1) < 0) {
|
|
26
|
+
return i;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return -1;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=property-bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-bindings.js","sourceRoot":"","sources":["../../../src/check/business-names/property-bindings.ts"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GACZ,kIAAkI,CAAC;AAErI,MAAM,gBAAgB,GACpB,gGAAgG,CAAC;AAEnG;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACpD,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAEzD,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACjD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAE5B,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAmB,EAAE,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,IAAY;IAChD,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAE5B,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;aAAM,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5C,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NamedBinding } from './named-binding.js';
|
|
2
|
+
/**
|
|
3
|
+
* The business name the code already gives to what a binding holds, as the checker reads it from
|
|
4
|
+
* the text: the class an initializer builds (on either side of `??`) or the repository it
|
|
5
|
+
* reads, the singular of the collection a loop walks through. Undefined when the text says nothing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function suggestedName(binding: NamedBinding): string | undefined;
|
|
8
|
+
//# sourceMappingURL=suggested-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggested-name.d.ts","sourceRoot":"","sources":["../../../src/check/business-names/suggested-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMvD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAiBvE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { plural, singular } from '../../naming/index.js';
|
|
2
|
+
const BUILT = /(?:^|\?\?\s*)(?:await\s+)?(?:new\s+([A-Z][\w$]*)\s*[(<]|([A-Z][\w$]*)\.create\s*[(<])/;
|
|
3
|
+
const READ = /^\(?(?:await\s+)?(?:this\s*\.\s*)?([a-z][\w$]*)Repository\s*\.\s*[\w$]+\s*\(/;
|
|
4
|
+
const LAST_WORD = /([A-Za-z][a-z\d]*)$/;
|
|
5
|
+
/**
|
|
6
|
+
* The business name the code already gives to what a binding holds, as the checker reads it from
|
|
7
|
+
* the text: the class an initializer builds (on either side of `??`) or the repository it
|
|
8
|
+
* reads, the singular of the collection a loop walks through. Undefined when the text says nothing.
|
|
9
|
+
*/
|
|
10
|
+
export function suggestedName(binding) {
|
|
11
|
+
const source = binding.source ?? '';
|
|
12
|
+
if (binding.kind === 'loop variable') {
|
|
13
|
+
return elementOf(source);
|
|
14
|
+
}
|
|
15
|
+
const built = BUILT.exec(source);
|
|
16
|
+
const concept = built?.[1] ?? built?.[2] ?? READ.exec(source)?.[1];
|
|
17
|
+
if (concept === undefined) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const camel = concept.charAt(0).toLowerCase() + concept.slice(1);
|
|
21
|
+
return singular(binding.name) === undefined ? camel : plural(camel);
|
|
22
|
+
}
|
|
23
|
+
/** `reminder` for `dueReminders` or `this.reminders`; nothing for a collection whose name is not a plural. */
|
|
24
|
+
function elementOf(collection) {
|
|
25
|
+
const last = LAST_WORD.exec(collection)?.[1];
|
|
26
|
+
return last === undefined ? undefined : singular(last.toLowerCase());
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=suggested-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggested-name.js","sourceRoot":"","sources":["../../../src/check/business-names/suggested-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGzD,MAAM,KAAK,GAAG,uFAAuF,CAAC;AACtG,MAAM,IAAI,GAAG,8EAA8E,CAAC;AAC5F,MAAM,SAAS,GAAG,qBAAqB,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAqB;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;IAEpC,IAAI,OAAO,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEnE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEjE,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,8GAA8G;AAC9G,SAAS,SAAS,CAAC,UAAkB;IACnC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAE7C,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top-level-separator.d.ts","sourceRoot":"","sources":["../../../src/check/business-names/top-level-separator.ts"],"names":[],"mappings":"AAEA,kHAAkH;AAClH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,MAAM,CAgB5E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BRACKETS } from '../text/brackets.js';
|
|
2
|
+
/** Offset of the first `separator` met outside brackets, or -1: the `:` of `key: alias`, the `=` of a default. */
|
|
3
|
+
export function topLevelSeparator(text, separator) {
|
|
4
|
+
let depth = 0;
|
|
5
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
6
|
+
const char = text.charAt(i);
|
|
7
|
+
if (BRACKETS.openers.includes(char)) {
|
|
8
|
+
depth += 1;
|
|
9
|
+
}
|
|
10
|
+
else if (BRACKETS.closers.includes(char)) {
|
|
11
|
+
depth -= 1;
|
|
12
|
+
}
|
|
13
|
+
else if (depth === 0 && char === separator && !isPartOfOperator(text, i)) {
|
|
14
|
+
return i;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return -1;
|
|
18
|
+
}
|
|
19
|
+
/** `=>`, `==`, `<=`: an `=` that is not alone. */
|
|
20
|
+
function isPartOfOperator(text, at) {
|
|
21
|
+
return text.charAt(at) === '=' && /[=<>!]/.test(text.charAt(at - 1) + text.charAt(at + 1));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=top-level-separator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top-level-separator.js","sourceRoot":"","sources":["../../../src/check/business-names/top-level-separator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,kHAAkH;AAClH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,SAAoB;IAClE,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAE5B,IAAI,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;aAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;aAAM,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;YAC3E,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC;AAED,kDAAkD;AAClD,SAAS,gBAAgB,CAAC,IAAY,EAAE,EAAU;IAChD,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAmF7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EAkF7C,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { authzActorExplicit } from '../rules/authz-actor-explicit.js';
|
|
|
3
3
|
import { authzFieldsBySchema } from '../rules/authz-fields-by-schema.js';
|
|
4
4
|
import { authzDeclared } from '../rules/authz-declared.js';
|
|
5
5
|
import { authzInApplication } from '../rules/authz-in-application.js';
|
|
6
|
+
import { authzPolicyAsked } from '../rules/authz-policy-asked.js';
|
|
6
7
|
import { cleanBlankLines } from '../rules/clean-blank-lines.js';
|
|
7
8
|
import { cleanBraces } from '../rules/clean-braces.js';
|
|
8
9
|
import { cleanFileSize } from '../rules/clean-file-size.js';
|
|
@@ -50,6 +51,7 @@ import { lifecycleStatusThroughMachine } from '../rules/lifecycle-status-through
|
|
|
50
51
|
import { layerDomainPurity } from '../rules/layer-domain-purity.js';
|
|
51
52
|
import { layerInfrastructureNoPresentation } from '../rules/layer-infrastructure-no-presentation.js';
|
|
52
53
|
import { layerPresentationNoInfrastructure } from '../rules/layer-presentation-no-infrastructure.js';
|
|
54
|
+
import { namingBusinessName } from '../rules/naming-business-name.js';
|
|
53
55
|
import { namingOneConceptPerFile } from '../rules/naming-one-concept-per-file.js';
|
|
54
56
|
import { namingSearchNotList } from '../rules/naming-search-not-list.js';
|
|
55
57
|
import { namingSuffix } from '../rules/naming-suffix.js';
|
|
@@ -92,6 +94,7 @@ export const ARCHITECTURE_RULES = [
|
|
|
92
94
|
namingSuffix,
|
|
93
95
|
namingOneConceptPerFile,
|
|
94
96
|
namingSearchNotList,
|
|
97
|
+
namingBusinessName,
|
|
95
98
|
schemaPresentationOnly,
|
|
96
99
|
schemaNoDuplicateShape,
|
|
97
100
|
testSpecRequired,
|
|
@@ -132,6 +135,7 @@ export const ARCHITECTURE_RULES = [
|
|
|
132
135
|
authzInApplication,
|
|
133
136
|
authzActorExplicit,
|
|
134
137
|
authzFieldsBySchema,
|
|
138
|
+
authzPolicyAsked,
|
|
135
139
|
aspectsOutsideIn,
|
|
136
140
|
tracingPlatformOnly,
|
|
137
141
|
tenancyScopedStatement,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4B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AClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,qBAAqB;CACtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3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gB;IAChB,gCAAgC;IAChC,WAAW;IACX,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,uBAAuB;IACvB,0BAA0B;IAC1B,mBAAmB;IACnB,yBAAyB;IACzB,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,qBAAqB;IACrB,aAAa;IACb,sBAAsB;IACtB,oBAAoB;IACpB,wBAAwB;IACxB,4BAA4B;IAC5B,qCAAqC;IACrC,yBAAyB;IACzB,sBAAsB;IACtB,kCAAkC;IAClC,mCAAmC;IACnC,6BAA6B;IAC7B,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,kBAAkB;IAClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,qBAAqB;CACtB,CAAC"}
|
|
@@ -4,16 +4,11 @@ export interface DeclaredEventHandler {
|
|
|
4
4
|
readonly className: string;
|
|
5
5
|
/** Line of the decorator. */
|
|
6
6
|
readonly line: number;
|
|
7
|
-
/** The first argument: the definition of
|
|
7
|
+
/** The first argument: the definition of the integration event. */
|
|
8
8
|
readonly event: string;
|
|
9
|
-
/** The `consumer` of `@IntegrationEventHandler
|
|
9
|
+
/** The `consumer` of `@IntegrationEventHandler`; undefined when the options hold no such key. */
|
|
10
10
|
readonly name: OptionValue | undefined;
|
|
11
11
|
}
|
|
12
|
-
declare
|
|
13
|
-
|
|
14
|
-
readonly DomainEventHandler: 'name';
|
|
15
|
-
};
|
|
16
|
-
/** The classes of a source that declare themselves handlers of an event, with the name their decorator gives. */
|
|
17
|
-
export declare function declaredEventHandlers(scan: Scan, decorator: keyof typeof NAME_KEYS): DeclaredEventHandler[];
|
|
18
|
-
export {};
|
|
12
|
+
/** The classes of a source that declare themselves handlers of an integration event, with the consumer name their decorator gives. */
|
|
13
|
+
export declare function declaredEventHandlers(scan: Scan): DeclaredEventHandler[];
|
|
19
14
|
//# sourceMappingURL=declared-event-handlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declared-event-handlers.d.ts","sourceRoot":"","sources":["../../../src/check/declarations/declared-event-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE5D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,
|
|
1
|
+
{"version":3,"file":"declared-event-handlers.d.ts","sourceRoot":"","sources":["../../../src/check/declarations/declared-event-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE5D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iGAAiG;IACjG,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;CACxC;AAID,sIAAsI;AACtI,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,oBAAoB,EAAE,CAWxE"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { argumentsOf } from './arguments-of.js';
|
|
2
2
|
import { classesOf } from './classes-of.js';
|
|
3
3
|
import { optionOf } from './option-of.js';
|
|
4
|
-
const
|
|
5
|
-
/** The classes of a source that declare themselves handlers of an event, with the name their decorator gives. */
|
|
6
|
-
export function declaredEventHandlers(scan
|
|
4
|
+
const DECORATOR = 'IntegrationEventHandler';
|
|
5
|
+
/** The classes of a source that declare themselves handlers of an integration event, with the consumer name their decorator gives. */
|
|
6
|
+
export function declaredEventHandlers(scan) {
|
|
7
7
|
return classesOf(scan).flatMap((declared) => declared.decorations
|
|
8
|
-
.filter(({ name }) => name ===
|
|
8
|
+
.filter(({ name }) => name === DECORATOR)
|
|
9
9
|
.map((decoration) => ({
|
|
10
10
|
className: declared.name,
|
|
11
11
|
line: decoration.line,
|
|
12
12
|
event: argumentsOf(scan, decoration)[0]?.code ?? '',
|
|
13
|
-
name: optionOf(scan, decoration,
|
|
13
|
+
name: optionOf(scan, decoration, 'consumer'),
|
|
14
14
|
})));
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=declared-event-handlers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declared-event-handlers.js","sourceRoot":"","sources":["../../../src/check/declarations/declared-event-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAoB,MAAM,gBAAgB,CAAC;AAY5D,MAAM,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"declared-event-handlers.js","sourceRoot":"","sources":["../../../src/check/declarations/declared-event-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAoB,MAAM,gBAAgB,CAAC;AAY5D,MAAM,SAAS,GAAG,yBAAyB,CAAC;AAE5C,sIAAsI;AACtI,MAAM,UAAU,qBAAqB,CAAC,IAAU;IAC9C,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC1C,QAAQ,CAAC,WAAW;SACjB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC;SACxC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACpB,SAAS,EAAE,QAAQ,CAAC,IAAI;QACxB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE;QACnD,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC;KAC7C,CAAC,CAAC,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -4,8 +4,6 @@ import type { Decoration } from './decoration.js';
|
|
|
4
4
|
export interface OptionValue {
|
|
5
5
|
/** Undefined when the value is a variable, a template with substitutions, a concatenation or a shorthand. */
|
|
6
6
|
readonly literal: string | undefined;
|
|
7
|
-
/** The value when it reads a member of a name, `InvoiceIssued.eventName`; undefined otherwise. */
|
|
8
|
-
readonly reference?: string;
|
|
9
7
|
readonly line: number;
|
|
10
8
|
}
|
|
11
9
|
/** The value of `key` in an options object given directly to the decorator, or undefined when no such key is written. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-of.d.ts","sourceRoot":"","sources":["../../../src/check/declarations/option-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IAC1B,6GAA6G;IAC7G,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,
|
|
1
|
+
{"version":3,"file":"option-of.d.ts","sourceRoot":"","sources":["../../../src/check/declarations/option-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IAC1B,6GAA6G;IAC7G,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,yHAAyH;AACzH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAmBjG"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const MEMBER = /^\s*([A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*)\s*[,}]/;
|
|
2
1
|
/** The value of `key` in an options object given directly to the decorator, or undefined when no such key is written. */
|
|
3
2
|
export function optionOf(scan, decoration, key) {
|
|
4
3
|
const { code } = scan;
|
|
@@ -11,12 +10,7 @@ export function optionOf(scan, decoration, key) {
|
|
|
11
10
|
const valueStart = match.index + match[0].length;
|
|
12
11
|
const literal = scan.strings.find((candidate) => candidate.start === valueStart);
|
|
13
12
|
const complete = literal !== undefined && /^\s*[,}]/.test(code.slice(literal.end, decoration.close + 1));
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
literal: complete ? literal.value : undefined,
|
|
17
|
-
line: scan.lineAt(match.index),
|
|
18
|
-
...(reference === undefined ? {} : { reference }),
|
|
19
|
-
};
|
|
13
|
+
return { literal: complete ? literal.value : undefined, line: scan.lineAt(match.index) };
|
|
20
14
|
}
|
|
21
15
|
return undefined;
|
|
22
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-of.js","sourceRoot":"","sources":["../../../src/check/declarations/option-of.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"option-of.js","sourceRoot":"","sources":["../../../src/check/declarations/option-of.ts"],"names":[],"mappings":"AAUA,yHAAyH;AACzH,MAAM,UAAU,QAAQ,CAAC,IAAU,EAAE,UAAsB,EAAE,GAAW;IACtE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,eAAe,GAAG,wBAAwB,EAAE,GAAG,CAAC,CAAC;IAE5E,OAAO,CAAC,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC;IAEpC,KAAK,IAAI,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClH,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAClE,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACjD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC;QACjF,MAAM,QAAQ,GAAG,OAAO,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QAEzG,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3F,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,mGAAmG;AACnG,SAAS,cAAc,CAAC,MAAc;IACpC,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IAE5G,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"authz-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqExD,CAAC"}
|
|
@@ -27,11 +27,24 @@ await this.access.authorize(command.actor, billingPermissions['invoice.void'], i
|
|
|
27
27
|
// application/authorization/only-issuer-voids.policy.ts
|
|
28
28
|
@Policy(billingPermissions['invoice.void'], { name: 'billing.only-issuer-voids' })
|
|
29
29
|
export class OnlyIssuerVoidsPolicy {}`,
|
|
30
|
+
},
|
|
31
|
+
'authz/policy-asked': {
|
|
32
|
+
why: 'The bus checks the permission of a use case before its handler runs, with the identifier of the element at most: it cannot read the element. A policy is the part of the right that needs the element (only the issuer, not after closing), and it is evaluated only when the handler asks Access once the element is loaded. A handler that forgets to ask leaves the policy declared, tested and never applied, and nothing at run time says so. Judged: for every permission refined by a policy (@Policy or definePolicy in application/authorization/), the handlers in the folder of each command or query that requires it (@Requires, .requires(...) or requires(X, ...)) call authorize, decide or decideOn and name that permission in their code. The TODO(domain) the generator leaves in such a handler, naming the permission, is accepted: `ddd-ts-kit todo` lists it, and until it is done the authorization module refuses the result of the handler at run time (PolicyNotAskedError).',
|
|
33
|
+
bad: `// application/authorization/only-issuer-voids.policy.ts
|
|
34
|
+
@Policy(billingPermissions['invoice.void'], { name: 'billing.only-issuer-voids' })
|
|
35
|
+
export class OnlyIssuerVoidsPolicy {}
|
|
36
|
+
// application/commands/void-invoice/void-invoice.handler.ts
|
|
37
|
+
const invoice = await this.invoices.get(command.invoiceId);
|
|
38
|
+
invoice.void(this.clock.now());`,
|
|
39
|
+
good: `// application/commands/void-invoice/void-invoice.handler.ts
|
|
40
|
+
const invoice = await this.invoices.get(command.invoiceId);
|
|
41
|
+
await this.access.authorize(command.actor, billingPermissions['invoice.void'], invoice);
|
|
42
|
+
invoice.void(this.clock.now());`,
|
|
30
43
|
},
|
|
31
44
|
'authz/actor-explicit': {
|
|
32
45
|
why: 'A handler that reads "the current user" from an ambient context depends on something no signature shows: a consumer or a job that forgot to set it fails at run time, and a test has to set a global. With the actor as data of the command, the use case says who acts, and any caller can send it. The ExecutionScope port (and ActorContext, a view of it) is named and read by infrastructure and the platform alone, as a type or as a value in a dependency list, for audit columns, tenant scoping and correlation: stampCreation, stampUpdate and tenantScopeOf belong in a repository adapter.',
|
|
33
46
|
bad: `// application/commands/void-invoice/void-invoice.handler.ts
|
|
34
|
-
|
|
47
|
+
constructor(private readonly invoices: InvoiceRepository, private readonly scope: ExecutionScope) {}
|
|
35
48
|
const actor = this.actors.require();
|
|
36
49
|
const { tenantId } = this.scope.require();
|
|
37
50
|
const stamp = stampCreation(this.scope, this.clock);`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-docs.js","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAsC;IAC3D,gBAAgB,EAAE;QAChB,GAAG,EAAE,mvBAAmvB;QACxvB,GAAG,EAAE;;;mEAG0D;QAC/D,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,q0BAAq0B;QAC10B,GAAG,EAAE;;;;;4DAKmD;QACxD,IAAI,EAAE;;;;;;sCAM4B;KACnC;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,ykBAAykB;QAC9kB,GAAG,EAAE;;;;qDAI4C;QACjD,IAAI,EAAE;;;;;2GAKiG;KACxG;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,i1BAAi1B;QACt1B,GAAG,EAAE;;+FAEsF;QAC3F,IAAI,EAAE;;;;;IAKN;KACD;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"authz-docs.js","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAsC;IAC3D,gBAAgB,EAAE;QAChB,GAAG,EAAE,mvBAAmvB;QACxvB,GAAG,EAAE;;;mEAG0D;QAC/D,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,q0BAAq0B;QAC10B,GAAG,EAAE;;;;;4DAKmD;QACxD,IAAI,EAAE;;;;;;sCAM4B;KACnC;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,08BAA08B;QAC/8B,GAAG,EAAE;;;;;gCAKuB;QAC5B,IAAI,EAAE;;;gCAGsB;KAC7B;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,ykBAAykB;QAC9kB,GAAG,EAAE;;;;qDAI4C;QACjD,IAAI,EAAE;;;;;2GAKiG;KACxG;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,i1BAAi1B;QACt1B,GAAG,EAAE;;+FAEsF;QAC3F,IAAI,EAAE;;;;;IAKN;KACD;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/events-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"events-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/events-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA6FzD,CAAC"}
|
|
@@ -29,23 +29,27 @@ eventPublisher: new OutboxPublisher(persistence.outbox),`,
|
|
|
29
29
|
bad: `// billing.module.ts
|
|
30
30
|
subscriber.subscribe('catalog.product.listed', (event) => productListedHandler.handle(event));
|
|
31
31
|
// application/integration/handlers/product-listed.integration-handler.ts
|
|
32
|
-
@IntegrationEventHandler(productListedV1, { consumer: CONSUMER_NAME }
|
|
32
|
+
@IntegrationEventHandler(productListedV1, { consumer: CONSUMER_NAME })`,
|
|
33
33
|
good: `// billing.module.ts
|
|
34
34
|
builder.on(productListedV1, { consumer: 'billing.product-listed' }).handledBy(ProductListedHandler, [CommandBus]);
|
|
35
35
|
// or, wired by hand
|
|
36
36
|
consume(productListedV1, { consumer: 'billing.product-listed', processed, unitOfWork }, (event) => productListedHandler.handle(event));
|
|
37
37
|
// or declared on the class
|
|
38
|
-
@IntegrationEventHandler(productListedV1, { consumer: 'billing.product-listed' }
|
|
39
|
-
export class ProductListedHandler {
|
|
38
|
+
@IntegrationEventHandler(productListedV1, { consumer: 'billing.product-listed' })
|
|
39
|
+
export class ProductListedHandler {
|
|
40
|
+
constructor(private readonly commands: CommandBus) {}
|
|
41
|
+
}`,
|
|
40
42
|
},
|
|
41
43
|
'domain-events/dispatched-on-save': {
|
|
42
44
|
why: 'Domain events leave with the save. Once a repository method that was handed an aggregate resolves, the events the aggregate recorded are dispatched in order, inside the unit of work of the command, so their handlers and the outbox commit or roll back with the state. A handler that pulls the events and dispatches them itself announces them twice or outside the transaction, and a repository adapter that dispatches mixes persistence with wiring. Reported: a call to pullEvents() in application/ or infrastructure/ of a context, and DomainEventDispatcher imported, listed as a dependency or received by a constructor in application/commands, application/queries and a repository adapter. The module file, the tests, the platform and main.ts are left alone.',
|
|
43
45
|
bad: `// application/commands/issue-invoice/issue-invoice.handler.ts
|
|
44
|
-
@CommandHandler(IssueInvoiceCommand
|
|
46
|
+
@CommandHandler(IssueInvoiceCommand)
|
|
47
|
+
constructor(private readonly invoices: InvoiceRepository, private readonly dispatcher: DomainEventDispatcher) {}
|
|
45
48
|
await this.invoices.save(invoice);
|
|
46
49
|
await this.dispatcher.dispatch(invoice.pullEvents());`,
|
|
47
50
|
good: `// application/commands/issue-invoice/issue-invoice.handler.ts
|
|
48
|
-
@CommandHandler(IssueInvoiceCommand
|
|
51
|
+
@CommandHandler(IssueInvoiceCommand)
|
|
52
|
+
constructor(private readonly invoices: InvoiceRepository) {}
|
|
49
53
|
await this.invoices.save(invoice);
|
|
50
54
|
// a removal that announces an event takes the aggregate
|
|
51
55
|
await this.invoices.remove(invoice);`,
|
|
@@ -54,13 +58,24 @@ await this.invoices.remove(invoice);`,
|
|
|
54
58
|
why: "An effect of a domain event exists only if the state change that recorded the event is committed. A handler that runs before the commit runs inside the transaction, and the commit can still fail after it ran (a deferred constraint, a serialization failure, a lost connection): that is safe only when the rollback undoes everything the handler did, so a before-commit handler has transactional effects only. Judged: every production class of application/event-handlers/*.event-handler.ts and application/integration/publishers/*.publisher.ts, and any class carrying @DomainEventHandler. Its phase is after-commit when its decorator says phase: 'after-commit', or, without a decorator, when every .on(..) of <context>.module.ts whose callback mentions it has a third argument holding phase: 'after-commit'; otherwise it is before-commit. Its dependencies are the names of its dependency list, of .toClass(Handler, [..]) and the types of its constructor parameters, resolved through the imports. Before the commit it may depend on the domain/ of its context, on the kernel ports except Cache, CachePurger, Lock, RateLimiter, JobScheduler and EventBus (CacheInvalidation is allowed: the purge it asks for commits with the work), on @ddd-ts-kit/auth, on application helpers of its context, and on a port of application/ports/ only when it is a persistence port: at least one production class implements it under infrastructure/persistence/ and none anywhere else under infrastructure/. Refused: those five kernel ports, any other port of application/ports/, anything of infrastructure/, of another context, of the platform or of another package. An after-commit handler is refused IntegrationEventPublisher alone: after the commit nothing makes the outbox row atomic with a state change, so it sends a command instead.",
|
|
55
59
|
bad: `// application/event-handlers/invoice-issued.event-handler.ts
|
|
56
60
|
// Mailer is implemented under infrastructure/external/: the mail leaves even when the commit fails
|
|
57
|
-
@DomainEventHandler(InvoiceIssued
|
|
61
|
+
@DomainEventHandler(InvoiceIssued)
|
|
62
|
+
constructor(
|
|
63
|
+
private readonly invoiceRepository: InvoiceRepository,
|
|
64
|
+
private readonly mailer: Mailer,
|
|
65
|
+
private readonly cache: Cache,
|
|
66
|
+
) {}
|
|
58
67
|
// after the commit the outbox row would be written in no transaction
|
|
59
|
-
@DomainEventHandler(InvoiceIssued, {
|
|
68
|
+
@DomainEventHandler(InvoiceIssued, { phase: 'after-commit' })
|
|
69
|
+
constructor(private readonly integrationEventPublisher: IntegrationEventPublisher) {}`,
|
|
60
70
|
good: `// application/event-handlers/invoice-issued.event-handler.ts: repositories, persistence ports, buses
|
|
61
|
-
@DomainEventHandler(InvoiceIssued
|
|
71
|
+
@DomainEventHandler(InvoiceIssued)
|
|
72
|
+
constructor(
|
|
73
|
+
private readonly invoiceRepository: InvoiceRepository,
|
|
74
|
+
private readonly commandBus: CommandBus,
|
|
75
|
+
) {}
|
|
62
76
|
// an effect that may be lost on a crash runs after the commit, at most once
|
|
63
|
-
@DomainEventHandler(InvoiceIssued, {
|
|
77
|
+
@DomainEventHandler(InvoiceIssued, { phase: 'after-commit' })
|
|
78
|
+
constructor(private readonly cache: Cache) {}
|
|
64
79
|
// explicit style, in billing.module.ts
|
|
65
80
|
platform.domainEvents.on('billing.invoice.issued', async (event) => {
|
|
66
81
|
if (event instanceof InvoiceIssued) {
|
|
@@ -68,8 +83,13 @@ platform.domainEvents.on('billing.invoice.issued', async (event) => {
|
|
|
68
83
|
}
|
|
69
84
|
}, { phase: 'after-commit' });
|
|
70
85
|
// an effect that must not be lost: a publisher writes to the outbox, the handler of that event does the work
|
|
71
|
-
@DomainEventHandler(InvoiceIssued
|
|
72
|
-
export class InvoiceIssuedPublisher {
|
|
86
|
+
@DomainEventHandler(InvoiceIssued)
|
|
87
|
+
export class InvoiceIssuedPublisher {
|
|
88
|
+
constructor(
|
|
89
|
+
private readonly integrationEventPublisher: IntegrationEventPublisher,
|
|
90
|
+
private readonly idGenerator: IdGenerator,
|
|
91
|
+
) {}
|
|
92
|
+
}`,
|
|
73
93
|
},
|
|
74
94
|
};
|
|
75
95
|
//# sourceMappingURL=events-docs.js.map
|