domain-knowledge-kit 0.1.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/LICENSE +94 -0
- package/README.md +266 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +40 -0
- package/dist/cli.js.map +1 -0
- package/dist/features/adr/commands/adr-related.d.ts +14 -0
- package/dist/features/adr/commands/adr-related.d.ts.map +1 -0
- package/dist/features/adr/commands/adr-related.js +146 -0
- package/dist/features/adr/commands/adr-related.js.map +1 -0
- package/dist/features/adr/commands/adr-show.d.ts +10 -0
- package/dist/features/adr/commands/adr-show.d.ts.map +1 -0
- package/dist/features/adr/commands/adr-show.js +30 -0
- package/dist/features/adr/commands/adr-show.js.map +1 -0
- package/dist/features/pipeline/commands/render.d.ts +10 -0
- package/dist/features/pipeline/commands/render.d.ts.map +1 -0
- package/dist/features/pipeline/commands/render.js +71 -0
- package/dist/features/pipeline/commands/render.js.map +1 -0
- package/dist/features/pipeline/commands/validate.d.ts +10 -0
- package/dist/features/pipeline/commands/validate.d.ts.map +1 -0
- package/dist/features/pipeline/commands/validate.js +48 -0
- package/dist/features/pipeline/commands/validate.js.map +1 -0
- package/dist/features/pipeline/indexer.d.ts +36 -0
- package/dist/features/pipeline/indexer.d.ts.map +1 -0
- package/dist/features/pipeline/indexer.js +279 -0
- package/dist/features/pipeline/indexer.js.map +1 -0
- package/dist/features/pipeline/renderer.d.ts +42 -0
- package/dist/features/pipeline/renderer.d.ts.map +1 -0
- package/dist/features/pipeline/renderer.js +239 -0
- package/dist/features/pipeline/renderer.js.map +1 -0
- package/dist/features/pipeline/tests/indexer.test.d.ts +2 -0
- package/dist/features/pipeline/tests/indexer.test.d.ts.map +1 -0
- package/dist/features/pipeline/tests/indexer.test.js +224 -0
- package/dist/features/pipeline/tests/indexer.test.js.map +1 -0
- package/dist/features/pipeline/tests/renderer.test.d.ts +2 -0
- package/dist/features/pipeline/tests/renderer.test.d.ts.map +1 -0
- package/dist/features/pipeline/tests/renderer.test.js +252 -0
- package/dist/features/pipeline/tests/renderer.test.js.map +1 -0
- package/dist/features/pipeline/tests/validate-schemas.test.d.ts +2 -0
- package/dist/features/pipeline/tests/validate-schemas.test.d.ts.map +1 -0
- package/dist/features/pipeline/tests/validate-schemas.test.js +183 -0
- package/dist/features/pipeline/tests/validate-schemas.test.js.map +1 -0
- package/dist/features/pipeline/tests/validator.test.d.ts +2 -0
- package/dist/features/pipeline/tests/validator.test.d.ts.map +1 -0
- package/dist/features/pipeline/tests/validator.test.js +371 -0
- package/dist/features/pipeline/tests/validator.test.js.map +1 -0
- package/dist/features/pipeline/validator.d.ts +44 -0
- package/dist/features/pipeline/validator.d.ts.map +1 -0
- package/dist/features/pipeline/validator.js +289 -0
- package/dist/features/pipeline/validator.js.map +1 -0
- package/dist/features/query/commands/list.d.ts +10 -0
- package/dist/features/query/commands/list.d.ts.map +1 -0
- package/dist/features/query/commands/list.js +123 -0
- package/dist/features/query/commands/list.js.map +1 -0
- package/dist/features/query/commands/related.d.ts +10 -0
- package/dist/features/query/commands/related.d.ts.map +1 -0
- package/dist/features/query/commands/related.js +61 -0
- package/dist/features/query/commands/related.js.map +1 -0
- package/dist/features/query/commands/search.d.ts +10 -0
- package/dist/features/query/commands/search.d.ts.map +1 -0
- package/dist/features/query/commands/search.js +55 -0
- package/dist/features/query/commands/search.js.map +1 -0
- package/dist/features/query/commands/show.d.ts +10 -0
- package/dist/features/query/commands/show.d.ts.map +1 -0
- package/dist/features/query/commands/show.js +96 -0
- package/dist/features/query/commands/show.js.map +1 -0
- package/dist/features/query/searcher.d.ts +58 -0
- package/dist/features/query/searcher.d.ts.map +1 -0
- package/dist/features/query/searcher.js +185 -0
- package/dist/features/query/searcher.js.map +1 -0
- package/dist/features/query/tests/searcher.test.d.ts +2 -0
- package/dist/features/query/tests/searcher.test.d.ts.map +1 -0
- package/dist/features/query/tests/searcher.test.js +320 -0
- package/dist/features/query/tests/searcher.test.js.map +1 -0
- package/dist/shared/adr-parser.d.ts +14 -0
- package/dist/shared/adr-parser.d.ts.map +1 -0
- package/dist/shared/adr-parser.js +72 -0
- package/dist/shared/adr-parser.js.map +1 -0
- package/dist/shared/errors.d.ts +43 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/errors.js +60 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/graph.d.ts +71 -0
- package/dist/shared/graph.d.ts.map +1 -0
- package/dist/shared/graph.js +250 -0
- package/dist/shared/graph.js.map +1 -0
- package/dist/shared/index.d.ts +16 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +24 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/item-visitor.d.ts +62 -0
- package/dist/shared/item-visitor.d.ts.map +1 -0
- package/dist/shared/item-visitor.js +95 -0
- package/dist/shared/item-visitor.js.map +1 -0
- package/dist/shared/loader.d.ts +19 -0
- package/dist/shared/loader.d.ts.map +1 -0
- package/dist/shared/loader.js +166 -0
- package/dist/shared/loader.js.map +1 -0
- package/dist/shared/paths.d.ts +32 -0
- package/dist/shared/paths.d.ts.map +1 -0
- package/dist/shared/paths.js +62 -0
- package/dist/shared/paths.js.map +1 -0
- package/dist/shared/tests/graph.test.d.ts +2 -0
- package/dist/shared/tests/graph.test.d.ts.map +1 -0
- package/dist/shared/tests/graph.test.js +291 -0
- package/dist/shared/tests/graph.test.js.map +1 -0
- package/dist/shared/tests/loader.test.d.ts +2 -0
- package/dist/shared/tests/loader.test.d.ts.map +1 -0
- package/dist/shared/tests/loader.test.js +239 -0
- package/dist/shared/tests/loader.test.js.map +1 -0
- package/dist/shared/tests/verify-collision-fix.test.d.ts +2 -0
- package/dist/shared/tests/verify-collision-fix.test.d.ts.map +1 -0
- package/dist/shared/tests/verify-collision-fix.test.js +114 -0
- package/dist/shared/tests/verify-collision-fix.test.js.map +1 -0
- package/dist/shared/types/domain.d.ts +244 -0
- package/dist/shared/types/domain.d.ts.map +1 -0
- package/dist/shared/types/domain.js +6 -0
- package/dist/shared/types/domain.js.map +1 -0
- package/dist/shared/types/index.d.ts +34 -0
- package/dist/shared/types/index.d.ts.map +1 -0
- package/dist/shared/types/index.js +9 -0
- package/dist/shared/types/index.js.map +1 -0
- package/dist/shared/yaml.d.ts +13 -0
- package/dist/shared/yaml.d.ts.map +1 -0
- package/dist/shared/yaml.js +29 -0
- package/dist/shared/yaml.js.map +1 -0
- package/package.json +48 -0
- package/tools/domain-pack/schema/.gitkeep +0 -0
- package/tools/domain-pack/schema/actors.schema.json +42 -0
- package/tools/domain-pack/schema/adr-frontmatter.schema.json +51 -0
- package/tools/domain-pack/schema/aggregate.schema.json +58 -0
- package/tools/domain-pack/schema/command.schema.json +76 -0
- package/tools/domain-pack/schema/context.schema.json +51 -0
- package/tools/domain-pack/schema/event.schema.json +66 -0
- package/tools/domain-pack/schema/glossary.schema.json +33 -0
- package/tools/domain-pack/schema/index.schema.json +76 -0
- package/tools/domain-pack/schema/policy.schema.json +53 -0
- package/tools/domain-pack/schema/read-model.schema.json +39 -0
- package/tools/domain-pack/templates/.gitkeep +0 -0
- package/tools/domain-pack/templates/context.md.hbs +89 -0
- package/tools/domain-pack/templates/index.md.hbs +60 -0
- package/tools/domain-pack/templates/item.md.hbs +85 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the domain model loader and supporting utilities.
|
|
3
|
+
*
|
|
4
|
+
* Uses a temporary directory tree that mirrors the real layout:
|
|
5
|
+
* tmp/
|
|
6
|
+
* domain/
|
|
7
|
+
* index.yml
|
|
8
|
+
* actors.yml
|
|
9
|
+
* contexts/
|
|
10
|
+
* ordering.yml (flat context)
|
|
11
|
+
* shipping/
|
|
12
|
+
* context.yml (directory context)
|
|
13
|
+
* docs/
|
|
14
|
+
* adr/
|
|
15
|
+
* 0001-use-yaml.md
|
|
16
|
+
*/
|
|
17
|
+
import { mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
import { tmpdir } from "node:os";
|
|
20
|
+
import { loadDomainModel } from "../loader.js";
|
|
21
|
+
import { parseAdrFrontmatter } from "../adr-parser.js";
|
|
22
|
+
import { parseYaml, stringifyYaml } from "../yaml.js";
|
|
23
|
+
// ── Test scaffolding fixtures ─────────────────────────────────────────
|
|
24
|
+
const TMP = join(tmpdir(), `dkk-test-${Date.now()}`);
|
|
25
|
+
const DOMAIN = join(TMP, "domain");
|
|
26
|
+
const CONTEXTS = join(DOMAIN, "contexts");
|
|
27
|
+
const ADR_DIR = join(TMP, "docs", "adr");
|
|
28
|
+
function setup() {
|
|
29
|
+
// Create directory tree (per-item structure)
|
|
30
|
+
mkdirSync(join(CONTEXTS, "ordering", "events"), { recursive: true });
|
|
31
|
+
mkdirSync(join(CONTEXTS, "ordering", "commands"), { recursive: true });
|
|
32
|
+
mkdirSync(join(CONTEXTS, "ordering", "aggregates"), { recursive: true });
|
|
33
|
+
mkdirSync(join(CONTEXTS, "shipping", "commands"), { recursive: true });
|
|
34
|
+
mkdirSync(join(CONTEXTS, "shipping", "read-models"), { recursive: true });
|
|
35
|
+
mkdirSync(ADR_DIR, { recursive: true });
|
|
36
|
+
// domain/index.yml
|
|
37
|
+
writeFileSync(join(DOMAIN, "index.yml"), [
|
|
38
|
+
"contexts:",
|
|
39
|
+
" - name: ordering",
|
|
40
|
+
' description: "Order management"',
|
|
41
|
+
" - name: shipping",
|
|
42
|
+
' description: "Shipping logistics"',
|
|
43
|
+
"flows:",
|
|
44
|
+
" - name: PlaceAndShip",
|
|
45
|
+
' description: "Order to shipment"',
|
|
46
|
+
" steps:",
|
|
47
|
+
" - ref: ordering.PlaceOrder",
|
|
48
|
+
" type: command",
|
|
49
|
+
" - ref: ordering.OrderPlaced",
|
|
50
|
+
" type: event",
|
|
51
|
+
" - ref: shipping.ShipOrder",
|
|
52
|
+
" type: command",
|
|
53
|
+
].join("\n"));
|
|
54
|
+
// domain/actors.yml
|
|
55
|
+
writeFileSync(join(DOMAIN, "actors.yml"), [
|
|
56
|
+
"actors:",
|
|
57
|
+
" - name: Customer",
|
|
58
|
+
" type: human",
|
|
59
|
+
' description: "A paying customer"',
|
|
60
|
+
" - name: WarehouseBot",
|
|
61
|
+
" type: system",
|
|
62
|
+
' description: "Automated warehouse robot"',
|
|
63
|
+
].join("\n"));
|
|
64
|
+
// domain/contexts/ordering/context.yml — identity + glossary
|
|
65
|
+
writeFileSync(join(CONTEXTS, "ordering", "context.yml"), [
|
|
66
|
+
"name: ordering",
|
|
67
|
+
'description: "Handles the order lifecycle"',
|
|
68
|
+
"glossary:",
|
|
69
|
+
" - term: Order",
|
|
70
|
+
' definition: "A customer purchase request"',
|
|
71
|
+
].join("\n"));
|
|
72
|
+
// domain/contexts/ordering/events/OrderPlaced.yml
|
|
73
|
+
writeFileSync(join(CONTEXTS, "ordering", "events", "OrderPlaced.yml"), [
|
|
74
|
+
"name: OrderPlaced",
|
|
75
|
+
'description: "Raised when an order is placed"',
|
|
76
|
+
"fields:",
|
|
77
|
+
" - name: orderId",
|
|
78
|
+
" type: UUID",
|
|
79
|
+
"raised_by: Order",
|
|
80
|
+
].join("\n"));
|
|
81
|
+
// domain/contexts/ordering/commands/PlaceOrder.yml
|
|
82
|
+
writeFileSync(join(CONTEXTS, "ordering", "commands", "PlaceOrder.yml"), [
|
|
83
|
+
"name: PlaceOrder",
|
|
84
|
+
'description: "Submit a new order"',
|
|
85
|
+
"actor: Customer",
|
|
86
|
+
"handled_by: Order",
|
|
87
|
+
].join("\n"));
|
|
88
|
+
// domain/contexts/ordering/aggregates/Order.yml
|
|
89
|
+
writeFileSync(join(CONTEXTS, "ordering", "aggregates", "Order.yml"), [
|
|
90
|
+
"name: Order",
|
|
91
|
+
'description: "Order aggregate root"',
|
|
92
|
+
"handles:",
|
|
93
|
+
" commands:",
|
|
94
|
+
" - PlaceOrder",
|
|
95
|
+
"emits:",
|
|
96
|
+
" events:",
|
|
97
|
+
" - OrderPlaced",
|
|
98
|
+
].join("\n"));
|
|
99
|
+
// domain/contexts/shipping/context.yml — identity only
|
|
100
|
+
writeFileSync(join(CONTEXTS, "shipping", "context.yml"), [
|
|
101
|
+
"name: shipping",
|
|
102
|
+
'description: "Handles shipment tracking"',
|
|
103
|
+
].join("\n"));
|
|
104
|
+
// domain/contexts/shipping/commands/ShipOrder.yml
|
|
105
|
+
writeFileSync(join(CONTEXTS, "shipping", "commands", "ShipOrder.yml"), [
|
|
106
|
+
"name: ShipOrder",
|
|
107
|
+
'description: "Initiate shipment for an order"',
|
|
108
|
+
"handled_by: Shipment",
|
|
109
|
+
].join("\n"));
|
|
110
|
+
// domain/contexts/shipping/read-models/ShipmentStatus.yml
|
|
111
|
+
writeFileSync(join(CONTEXTS, "shipping", "read-models", "ShipmentStatus.yml"), [
|
|
112
|
+
"name: ShipmentStatus",
|
|
113
|
+
'description: "Current status of a shipment"',
|
|
114
|
+
"subscribes_to:",
|
|
115
|
+
" - ShipmentDispatched",
|
|
116
|
+
"used_by:",
|
|
117
|
+
" - Customer",
|
|
118
|
+
].join("\n"));
|
|
119
|
+
// docs/adr/0001-use-yaml.md
|
|
120
|
+
writeFileSync(join(ADR_DIR, "0001-use-yaml.md"), [
|
|
121
|
+
"---",
|
|
122
|
+
"id: adr-0001",
|
|
123
|
+
"title: Use YAML for domain models",
|
|
124
|
+
"status: accepted",
|
|
125
|
+
"date: 2026-01-15",
|
|
126
|
+
"deciders:",
|
|
127
|
+
" - Alice",
|
|
128
|
+
" - Bob",
|
|
129
|
+
"domain_refs:",
|
|
130
|
+
" - ordering.Order",
|
|
131
|
+
"---",
|
|
132
|
+
"",
|
|
133
|
+
"# ADR-0001 — Use YAML for domain models",
|
|
134
|
+
"",
|
|
135
|
+
"## Context",
|
|
136
|
+
"We need a format...",
|
|
137
|
+
].join("\n"));
|
|
138
|
+
// docs/adr/README.md — should be skipped
|
|
139
|
+
writeFileSync(join(ADR_DIR, "README.md"), "# ADRs\n");
|
|
140
|
+
}
|
|
141
|
+
function teardown() {
|
|
142
|
+
rmSync(TMP, { recursive: true, force: true });
|
|
143
|
+
}
|
|
144
|
+
// ── Assertions ────────────────────────────────────────────────────────
|
|
145
|
+
let passed = 0;
|
|
146
|
+
let failed = 0;
|
|
147
|
+
function assert(label, condition, detail) {
|
|
148
|
+
if (condition) {
|
|
149
|
+
console.log(` OK: ${label}`);
|
|
150
|
+
passed++;
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
console.error(`FAIL: ${label}${detail ? ` — ${detail}` : ""}`);
|
|
154
|
+
failed++;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// ── Run tests ─────────────────────────────────────────────────────────
|
|
158
|
+
setup();
|
|
159
|
+
try {
|
|
160
|
+
// yaml.ts
|
|
161
|
+
console.log("\n=== yaml.ts ===");
|
|
162
|
+
const parsed = parseYaml("key: value\n");
|
|
163
|
+
assert("parseYaml parses scalar", parsed.key === "value");
|
|
164
|
+
const dumped = stringifyYaml({ a: 1, b: [2, 3] });
|
|
165
|
+
assert("stringifyYaml returns string", typeof dumped === "string" && dumped.includes("a: 1"));
|
|
166
|
+
// adr-parser.ts
|
|
167
|
+
console.log("\n=== adr-parser.ts ===");
|
|
168
|
+
const adr = parseAdrFrontmatter("---\nid: adr-0042\ntitle: Test\nstatus: proposed\ndate: 2026-02-20\n---\n# Hello\n");
|
|
169
|
+
assert("parseAdrFrontmatter returns record", adr !== null);
|
|
170
|
+
assert("parseAdrFrontmatter id correct", adr?.id === "adr-0042");
|
|
171
|
+
assert("parseAdrFrontmatter status correct", adr?.status === "proposed");
|
|
172
|
+
assert("parseAdrFrontmatter extracts body", adr?.body === "Hello");
|
|
173
|
+
const adrWithBody = parseAdrFrontmatter("---\nid: adr-0099\ntitle: Rich\nstatus: accepted\ndate: 2026-03-01\n---\n\n## Context\n\nWe need a [search engine](https://example.com) for **full-text** queries.\n\n## Decision\n\nUse `SQLite FTS5` for indexing.\n");
|
|
174
|
+
assert("parseAdrFrontmatter with rich body returns record", adrWithBody !== null);
|
|
175
|
+
assert("body strips markdown formatting", adrWithBody?.body !== undefined &&
|
|
176
|
+
adrWithBody.body.includes("search engine") &&
|
|
177
|
+
adrWithBody.body.includes("full-text") &&
|
|
178
|
+
adrWithBody.body.includes("SQLite FTS5") &&
|
|
179
|
+
!adrWithBody.body.includes("##") &&
|
|
180
|
+
!adrWithBody.body.includes("**") &&
|
|
181
|
+
!adrWithBody.body.includes("`"));
|
|
182
|
+
const adrNoBody = parseAdrFrontmatter("---\nid: adr-0050\ntitle: Empty\nstatus: proposed\ndate: 2026-02-20\n---\n");
|
|
183
|
+
assert("parseAdrFrontmatter with no body has undefined body", adrNoBody?.body === undefined);
|
|
184
|
+
const noFront = parseAdrFrontmatter("# No frontmatter here\n");
|
|
185
|
+
assert("parseAdrFrontmatter returns null for missing frontmatter", noFront === null);
|
|
186
|
+
const incompleteFront = parseAdrFrontmatter("---\nid: adr-0042\n---\n");
|
|
187
|
+
assert("parseAdrFrontmatter returns null for incomplete frontmatter", incompleteFront === null);
|
|
188
|
+
// loader.ts
|
|
189
|
+
console.log("\n=== loader.ts ===");
|
|
190
|
+
const model = loadDomainModel({ root: TMP });
|
|
191
|
+
// Index
|
|
192
|
+
assert("index.contexts has 2 entries", model.index.contexts.length === 2);
|
|
193
|
+
assert("index.flows has 1 entry", model.index.flows?.length === 1);
|
|
194
|
+
assert("flow has 3 steps", model.index.flows?.[0].steps.length === 3);
|
|
195
|
+
// Actors
|
|
196
|
+
assert("actors has 2 entries", model.actors.length === 2);
|
|
197
|
+
assert("first actor is Customer", model.actors[0].name === "Customer");
|
|
198
|
+
// Contexts
|
|
199
|
+
assert("contexts map has 2 entries", model.contexts.size === 2);
|
|
200
|
+
const ordering = model.contexts.get("ordering");
|
|
201
|
+
assert("ordering context loaded", ordering !== undefined);
|
|
202
|
+
assert("ordering has 1 event", ordering?.events?.length === 1);
|
|
203
|
+
assert("ordering event name", ordering?.events?.[0].name === "OrderPlaced");
|
|
204
|
+
assert("ordering has 1 command", ordering?.commands?.length === 1);
|
|
205
|
+
assert("ordering has 1 aggregate", ordering?.aggregates?.length === 1);
|
|
206
|
+
assert("ordering has 1 glossary entry", ordering?.glossary?.length === 1);
|
|
207
|
+
const shipping = model.contexts.get("shipping");
|
|
208
|
+
assert("shipping context loaded", shipping !== undefined);
|
|
209
|
+
assert("shipping has 1 command", shipping?.commands?.length === 1);
|
|
210
|
+
assert("shipping has 1 read model", shipping?.read_models?.length === 1);
|
|
211
|
+
// ADRs
|
|
212
|
+
assert("adrs map has 1 entry", model.adrs.size === 1);
|
|
213
|
+
const adrRec = model.adrs.get("adr-0001");
|
|
214
|
+
assert("adr-0001 loaded", adrRec !== undefined);
|
|
215
|
+
assert("adr-0001 title correct", adrRec?.title === "Use YAML for domain models");
|
|
216
|
+
assert("adr-0001 status correct", adrRec?.status === "accepted");
|
|
217
|
+
assert("adr-0001 has deciders", adrRec?.deciders?.length === 2);
|
|
218
|
+
assert("adr-0001 has domain_refs", adrRec?.domain_refs?.length === 1);
|
|
219
|
+
// Edge: load with empty domain
|
|
220
|
+
console.log("\n=== loader.ts (empty domain) ===");
|
|
221
|
+
const emptyTmp = join(tmpdir(), `dkk-empty-${Date.now()}`);
|
|
222
|
+
mkdirSync(join(emptyTmp, "domain", "contexts"), { recursive: true });
|
|
223
|
+
mkdirSync(join(emptyTmp, "docs", "adr"), { recursive: true });
|
|
224
|
+
writeFileSync(join(emptyTmp, "domain", "index.yml"), "contexts: []\n");
|
|
225
|
+
writeFileSync(join(emptyTmp, "domain", "actors.yml"), "actors: []\n");
|
|
226
|
+
const emptyModel = loadDomainModel({ root: emptyTmp });
|
|
227
|
+
assert("empty: contexts map is empty", emptyModel.contexts.size === 0);
|
|
228
|
+
assert("empty: actors is empty", emptyModel.actors.length === 0);
|
|
229
|
+
assert("empty: adrs is empty", emptyModel.adrs.size === 0);
|
|
230
|
+
rmSync(emptyTmp, { recursive: true, force: true });
|
|
231
|
+
}
|
|
232
|
+
finally {
|
|
233
|
+
teardown();
|
|
234
|
+
}
|
|
235
|
+
// ── Summary ───────────────────────────────────────────────────────────
|
|
236
|
+
console.log(`\n${passed} passed, ${failed} failed`);
|
|
237
|
+
if (failed > 0)
|
|
238
|
+
process.exit(1);
|
|
239
|
+
//# sourceMappingURL=loader.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.test.js","sourceRoot":"","sources":["../../../src/shared/tests/loader.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEtD,yEAAyE;AAEzE,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,YAAY,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACrD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAEzC,SAAS,KAAK;IACZ,6CAA6C;IAC7C,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrE,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,EAAE,SAA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AC;AAErD,CAAC;QAAS,CAAC;IACT,QAAQ,EAAE,CAAC;AACb,CAAC;AAED,yEAAyE;AACzE,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,YAAY,MAAM,SAAS,CAAC,CAAC;AACpD,IAAI,MAAM,GAAG,CAAC;IAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-collision-fix.test.d.ts","sourceRoot":"","sources":["../../../src/shared/tests/verify-collision-fix.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E verification: glossary-aggregate namespace collision is resolved
|
|
3
|
+
* in DomainGraph — structural kinds take precedence over glossary.
|
|
4
|
+
*/
|
|
5
|
+
import { mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { tmpdir } from "node:os";
|
|
8
|
+
import { loadDomainModel } from "../loader.js";
|
|
9
|
+
import { DomainGraph } from "../graph.js";
|
|
10
|
+
const TMP = join(tmpdir(), `dkk-collision-fix-${Date.now()}`);
|
|
11
|
+
const DOMAIN = join(TMP, "domain");
|
|
12
|
+
const CONTEXTS = join(DOMAIN, "contexts");
|
|
13
|
+
const ADR_DIR = join(TMP, "docs", "adr");
|
|
14
|
+
let passed = 0;
|
|
15
|
+
let failed = 0;
|
|
16
|
+
function assert(label, condition, detail) {
|
|
17
|
+
if (condition) {
|
|
18
|
+
console.log(` OK: ${label}`);
|
|
19
|
+
passed++;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.error(`FAIL: ${label}${detail ? ` — ${detail}` : ""}`);
|
|
23
|
+
failed++;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function setup() {
|
|
27
|
+
mkdirSync(join(CONTEXTS, "ordering", "events"), { recursive: true });
|
|
28
|
+
mkdirSync(join(CONTEXTS, "ordering", "commands"), { recursive: true });
|
|
29
|
+
mkdirSync(join(CONTEXTS, "ordering", "aggregates"), { recursive: true });
|
|
30
|
+
mkdirSync(ADR_DIR, { recursive: true });
|
|
31
|
+
writeFileSync(join(DOMAIN, "index.yml"), [
|
|
32
|
+
"contexts:",
|
|
33
|
+
" - name: ordering",
|
|
34
|
+
' description: "Order management"',
|
|
35
|
+
].join("\n"));
|
|
36
|
+
writeFileSync(join(DOMAIN, "actors.yml"), ["actors:", " - name: Customer", " type: human", ' description: "A customer"'].join("\n"));
|
|
37
|
+
// Context where glossary term "Order" collides with aggregate "Order"
|
|
38
|
+
writeFileSync(join(CONTEXTS, "ordering", "context.yml"), [
|
|
39
|
+
"name: ordering",
|
|
40
|
+
'description: "Handles orders"',
|
|
41
|
+
"glossary:",
|
|
42
|
+
" - term: Order",
|
|
43
|
+
' definition: "A customer purchase request"',
|
|
44
|
+
" - term: LineItem",
|
|
45
|
+
' definition: "An item within an order"',
|
|
46
|
+
].join("\n"));
|
|
47
|
+
writeFileSync(join(CONTEXTS, "ordering", "events", "OrderPlaced.yml"), [
|
|
48
|
+
"name: OrderPlaced",
|
|
49
|
+
'description: "Raised when an order is placed"',
|
|
50
|
+
"raised_by: Order",
|
|
51
|
+
].join("\n"));
|
|
52
|
+
writeFileSync(join(CONTEXTS, "ordering", "commands", "PlaceOrder.yml"), [
|
|
53
|
+
"name: PlaceOrder",
|
|
54
|
+
'description: "Submit a new order"',
|
|
55
|
+
"actor: Customer",
|
|
56
|
+
"handled_by: Order",
|
|
57
|
+
].join("\n"));
|
|
58
|
+
writeFileSync(join(CONTEXTS, "ordering", "aggregates", "Order.yml"), [
|
|
59
|
+
"name: Order",
|
|
60
|
+
'description: "Order aggregate root"',
|
|
61
|
+
"handles:",
|
|
62
|
+
" commands:",
|
|
63
|
+
" - PlaceOrder",
|
|
64
|
+
"emits:",
|
|
65
|
+
" events:",
|
|
66
|
+
" - OrderPlaced",
|
|
67
|
+
].join("\n"));
|
|
68
|
+
writeFileSync(join(ADR_DIR, "README.md"), "# ADRs\n");
|
|
69
|
+
}
|
|
70
|
+
function teardown() {
|
|
71
|
+
rmSync(TMP, { recursive: true, force: true });
|
|
72
|
+
}
|
|
73
|
+
// ── Tests ─────────────────────────────────────────────────────────────
|
|
74
|
+
setup();
|
|
75
|
+
try {
|
|
76
|
+
const model = loadDomainModel({ root: TMP });
|
|
77
|
+
const graph = DomainGraph.from(model);
|
|
78
|
+
console.log("\n=== Glossary-aggregate collision fix ===");
|
|
79
|
+
// The key assertion: ordering.Order should be kind "aggregate", not "glossary"
|
|
80
|
+
const orderNode = graph.nodes.get("ordering.Order");
|
|
81
|
+
assert("ordering.Order node exists", orderNode !== undefined);
|
|
82
|
+
assert("ordering.Order kind is 'aggregate' (not 'glossary')", orderNode?.kind === "aggregate", `got kind="${orderNode?.kind}"`);
|
|
83
|
+
// Glossary-only terms should retain glossary kind
|
|
84
|
+
const lineItemNode = graph.nodes.get("ordering.LineItem");
|
|
85
|
+
assert("ordering.LineItem node exists", lineItemNode !== undefined);
|
|
86
|
+
assert("ordering.LineItem kind is 'glossary' (no collision)", lineItemNode?.kind === "glossary", `got kind="${lineItemNode?.kind}"`);
|
|
87
|
+
// Edges from glossary processing should still be wired
|
|
88
|
+
const orderNeighbours = graph.getNeighbours("ordering.Order");
|
|
89
|
+
assert("Order aggregate neighbours include PlaceOrder", orderNeighbours.has("ordering.PlaceOrder"));
|
|
90
|
+
assert("Order aggregate neighbours include OrderPlaced", orderNeighbours.has("ordering.OrderPlaced"));
|
|
91
|
+
assert("Order neighbours include context.ordering (from both glossary and aggregate contains edges)", orderNeighbours.has("context.ordering"));
|
|
92
|
+
// The related command should show aggregate kind
|
|
93
|
+
console.log("\n=== Related command output grouping ===");
|
|
94
|
+
const related = graph.getRelated("ordering.PlaceOrder", 1);
|
|
95
|
+
assert("PlaceOrder related includes ordering.Order", related.has("ordering.Order"));
|
|
96
|
+
// Verify that grouped output would show "aggregate" not "glossary"
|
|
97
|
+
const grouped = new Map();
|
|
98
|
+
for (const nId of related) {
|
|
99
|
+
const node = graph.nodes.get(nId);
|
|
100
|
+
const kind = node?.kind ?? "unknown";
|
|
101
|
+
if (!grouped.has(kind))
|
|
102
|
+
grouped.set(kind, []);
|
|
103
|
+
grouped.get(kind).push(nId);
|
|
104
|
+
}
|
|
105
|
+
assert("related grouping shows 'aggregate' category", grouped.has("aggregate"), `categories: ${[...grouped.keys()].join(", ")}`);
|
|
106
|
+
assert("related grouping does NOT show 'glossary' for Order", !(grouped.get("glossary") ?? []).includes("ordering.Order"));
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
teardown();
|
|
110
|
+
}
|
|
111
|
+
console.log(`\n${passed} passed, ${failed} failed`);
|
|
112
|
+
if (failed > 0)
|
|
113
|
+
process.exit(1);
|
|
114
|
+
//# sourceMappingURL=verify-collision-fix.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-collision-fix.test.js","sourceRoot":"","sources":["../../../src/shared/tests/verify-collision-fix.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,qBAAqB,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,EA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AAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,IAAI,EAAE,IAAI,IAAI,SAAS,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,MAAM,CACJ,6CAA6C,EAC7C,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EACxB,eAAe,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChD,CAAC;IACF,MAAM,CACJ,qDAAqD,EACrD,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAC5D,CAAC;AACJ,CAAC;QAAS,CAAC;IACT,QAAQ,EAAE,CAAC;AACb,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,YAAY,MAAM,SAAS,CAAC,CAAC;AACpD,IAAI,MAAM,GAAG,CAAC;IAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for all domain item types.
|
|
3
|
+
* These align with the JSON Schemas under tools/domain-pack/schema/.
|
|
4
|
+
*/
|
|
5
|
+
/** A typed field carried by events or commands. */
|
|
6
|
+
export interface Field {
|
|
7
|
+
/** Field name. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Field type (e.g. "string", "UUID", "Money"). */
|
|
10
|
+
type: string;
|
|
11
|
+
/** Optional human-readable description. */
|
|
12
|
+
description?: string;
|
|
13
|
+
}
|
|
14
|
+
/** ADR reference in the form "adr-NNNN". */
|
|
15
|
+
export type AdrRef = `adr-${string}`;
|
|
16
|
+
/** A given/when/then scenario example for an event or command. */
|
|
17
|
+
export interface Example {
|
|
18
|
+
/** Short human-readable description of the scenario. */
|
|
19
|
+
description: string;
|
|
20
|
+
/** Pre-conditions (given). */
|
|
21
|
+
given?: string[];
|
|
22
|
+
/** Trigger / action (when). */
|
|
23
|
+
when?: string[];
|
|
24
|
+
/** Expected outcomes (then). */
|
|
25
|
+
then?: string[];
|
|
26
|
+
}
|
|
27
|
+
/** Domain item reference in context.Name format (e.g. "ordering.OrderPlaced"). */
|
|
28
|
+
export type DomainRef = `${string}.${string}`;
|
|
29
|
+
/** A ubiquitous-language term within a bounded context. */
|
|
30
|
+
export interface GlossaryEntry {
|
|
31
|
+
/** The canonical term name. */
|
|
32
|
+
term: string;
|
|
33
|
+
/** Plain-language definition. */
|
|
34
|
+
definition: string;
|
|
35
|
+
/** Alternative names for this term. */
|
|
36
|
+
aliases?: string[];
|
|
37
|
+
/** Related ADR identifiers. */
|
|
38
|
+
adr_refs?: AdrRef[];
|
|
39
|
+
}
|
|
40
|
+
/** Whether the actor is a person, internal system, or external system. */
|
|
41
|
+
export type ActorType = "human" | "system" | "external";
|
|
42
|
+
/** A person or system that interacts with the domain. */
|
|
43
|
+
export interface Actor {
|
|
44
|
+
/** Actor display name (e.g. "Customer", "Payment Gateway"). */
|
|
45
|
+
name: string;
|
|
46
|
+
/** Kind of actor. */
|
|
47
|
+
type: ActorType;
|
|
48
|
+
/** What role this actor plays in the domain. */
|
|
49
|
+
description: string;
|
|
50
|
+
/** Related ADR identifiers. */
|
|
51
|
+
adr_refs?: AdrRef[];
|
|
52
|
+
}
|
|
53
|
+
/** Top-level actors definition file shape (domain/actors.yml). */
|
|
54
|
+
export interface ActorsFile {
|
|
55
|
+
actors: Actor[];
|
|
56
|
+
}
|
|
57
|
+
/** A domain event raised within a bounded context. */
|
|
58
|
+
export interface DomainEvent {
|
|
59
|
+
/** PascalCase event name (e.g. "OrderPlaced"). */
|
|
60
|
+
name: string;
|
|
61
|
+
/** What this event signifies in the domain. */
|
|
62
|
+
description: string;
|
|
63
|
+
/** Payload fields carried by this event. */
|
|
64
|
+
fields?: Field[];
|
|
65
|
+
/** Name of the aggregate that raises this event. */
|
|
66
|
+
raised_by?: string;
|
|
67
|
+
/** Given/when/then usage scenarios. */
|
|
68
|
+
examples?: Example[];
|
|
69
|
+
/** Business invariants / rules that must hold when this event is raised. */
|
|
70
|
+
invariants?: string[];
|
|
71
|
+
/** Related ADR identifiers. */
|
|
72
|
+
adr_refs?: AdrRef[];
|
|
73
|
+
}
|
|
74
|
+
/** A command handled by an aggregate within a bounded context. */
|
|
75
|
+
export interface Command {
|
|
76
|
+
/** PascalCase command name (e.g. "PlaceOrder"). */
|
|
77
|
+
name: string;
|
|
78
|
+
/** What this command instructs the system to do. */
|
|
79
|
+
description: string;
|
|
80
|
+
/** Input fields for this command. */
|
|
81
|
+
fields?: Field[];
|
|
82
|
+
/** Name of the actor that initiates this command. */
|
|
83
|
+
actor?: string;
|
|
84
|
+
/** Name of the aggregate that handles this command. */
|
|
85
|
+
handled_by?: string;
|
|
86
|
+
/** Conditions that must be true before this command can be accepted. */
|
|
87
|
+
preconditions?: string[];
|
|
88
|
+
/** Reasons this command may be rejected. */
|
|
89
|
+
rejections?: string[];
|
|
90
|
+
/** Business invariants / rules that must hold when this event is raised. */
|
|
91
|
+
invariants?: string[];
|
|
92
|
+
/** Given/when/then usage scenarios. */
|
|
93
|
+
examples?: Example[];
|
|
94
|
+
/** Related ADR identifiers. */
|
|
95
|
+
adr_refs?: AdrRef[];
|
|
96
|
+
}
|
|
97
|
+
/** A reactive policy that listens to events and emits commands. */
|
|
98
|
+
export interface Policy {
|
|
99
|
+
/** PascalCase policy name (e.g. "SendConfirmationEmail"). */
|
|
100
|
+
name: string;
|
|
101
|
+
/** What this policy does in response to events. */
|
|
102
|
+
description: string;
|
|
103
|
+
/** Conditions that activate this policy (nested: when.events). */
|
|
104
|
+
when?: {
|
|
105
|
+
events?: string[];
|
|
106
|
+
};
|
|
107
|
+
/** Actions taken by this policy (nested: then.commands). */
|
|
108
|
+
then?: {
|
|
109
|
+
commands?: string[];
|
|
110
|
+
};
|
|
111
|
+
/** Related ADR identifiers. */
|
|
112
|
+
adr_refs?: AdrRef[];
|
|
113
|
+
}
|
|
114
|
+
/** A domain aggregate that handles commands and emits events. */
|
|
115
|
+
export interface Aggregate {
|
|
116
|
+
/** PascalCase aggregate name (e.g. "Order"). */
|
|
117
|
+
name: string;
|
|
118
|
+
/** What this aggregate represents in the domain. */
|
|
119
|
+
description: string;
|
|
120
|
+
/** Commands handled by this aggregate (nested: handles.commands). */
|
|
121
|
+
handles?: {
|
|
122
|
+
commands?: string[];
|
|
123
|
+
};
|
|
124
|
+
/** Events emitted by this aggregate (nested: emits.events). */
|
|
125
|
+
emits?: {
|
|
126
|
+
events?: string[];
|
|
127
|
+
};
|
|
128
|
+
/** Business invariants / rules enforced by this aggregate. */
|
|
129
|
+
invariants?: string[];
|
|
130
|
+
/** Related ADR identifiers. */
|
|
131
|
+
adr_refs?: AdrRef[];
|
|
132
|
+
}
|
|
133
|
+
/** A read model (projection) built from domain events. */
|
|
134
|
+
export interface ReadModel {
|
|
135
|
+
/** PascalCase read model name (e.g. "OrderSummary"). */
|
|
136
|
+
name: string;
|
|
137
|
+
/** What data this read model exposes. */
|
|
138
|
+
description: string;
|
|
139
|
+
/** Event names this read model subscribes to. */
|
|
140
|
+
subscribes_to?: string[];
|
|
141
|
+
/** Actor names that consume this read model. */
|
|
142
|
+
used_by?: string[];
|
|
143
|
+
/** Related ADR identifiers. */
|
|
144
|
+
adr_refs?: AdrRef[];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Context metadata file shape (domain/contexts/<name>/context.yml).
|
|
148
|
+
* Contains only identity and glossary; item arrays live in typed
|
|
149
|
+
* sub-directories (events/, commands/, policies/, aggregates/, read-models/).
|
|
150
|
+
*/
|
|
151
|
+
export interface ContextMetaFile {
|
|
152
|
+
/** Kebab-case context identifier (e.g. "ordering"). */
|
|
153
|
+
name: string;
|
|
154
|
+
/** What this bounded context is responsible for. */
|
|
155
|
+
description: string;
|
|
156
|
+
/** Ubiquitous-language terms scoped to this context. */
|
|
157
|
+
glossary?: GlossaryEntry[];
|
|
158
|
+
}
|
|
159
|
+
/** A bounded context assembled from per-item YAML files. */
|
|
160
|
+
export interface DomainContext {
|
|
161
|
+
/** Kebab-case context identifier (e.g. "ordering"). */
|
|
162
|
+
name: string;
|
|
163
|
+
/** What this bounded context is responsible for. */
|
|
164
|
+
description: string;
|
|
165
|
+
/** Ubiquitous-language terms scoped to this context. */
|
|
166
|
+
glossary?: GlossaryEntry[];
|
|
167
|
+
/** Domain events raised within this context. */
|
|
168
|
+
events?: DomainEvent[];
|
|
169
|
+
/** Commands handled within this context. */
|
|
170
|
+
commands?: Command[];
|
|
171
|
+
/** Reactive policies within this context. */
|
|
172
|
+
policies?: Policy[];
|
|
173
|
+
/** Aggregates within this context. */
|
|
174
|
+
aggregates?: Aggregate[];
|
|
175
|
+
/** Read models (projections) within this context. */
|
|
176
|
+
read_models?: ReadModel[];
|
|
177
|
+
}
|
|
178
|
+
/** Lifecycle status of an Architecture Decision Record. */
|
|
179
|
+
export type AdrStatus = "proposed" | "accepted" | "deprecated" | "superseded";
|
|
180
|
+
/** Frontmatter metadata for an Architecture Decision Record. */
|
|
181
|
+
export interface AdrRecord {
|
|
182
|
+
/** Stable ADR identifier (e.g. "adr-0001"). */
|
|
183
|
+
id: AdrRef;
|
|
184
|
+
/** Human-readable title of the decision. */
|
|
185
|
+
title: string;
|
|
186
|
+
/** Current lifecycle status. */
|
|
187
|
+
status: AdrStatus;
|
|
188
|
+
/** ISO-8601 date when the decision was recorded (YYYY-MM-DD). */
|
|
189
|
+
date: string;
|
|
190
|
+
/** People involved in making this decision. */
|
|
191
|
+
deciders?: string[];
|
|
192
|
+
/** Domain items related to this decision. */
|
|
193
|
+
domain_refs?: DomainRef[];
|
|
194
|
+
/** ID of the ADR that supersedes this one. */
|
|
195
|
+
superseded_by?: AdrRef;
|
|
196
|
+
/** Markdown body text (everything after the closing ---), with formatting stripped. */
|
|
197
|
+
body?: string;
|
|
198
|
+
}
|
|
199
|
+
/** A reference to a registered bounded context in the index. */
|
|
200
|
+
export interface ContextEntry {
|
|
201
|
+
/** Context identifier matching a file under domain/contexts/. */
|
|
202
|
+
name: string;
|
|
203
|
+
/** Short summary of the bounded context. */
|
|
204
|
+
description?: string;
|
|
205
|
+
}
|
|
206
|
+
/** Step type within a cross-context flow. */
|
|
207
|
+
export type FlowStepType = "command" | "event" | "policy" | "read_model";
|
|
208
|
+
/** A single step in a cross-context flow. */
|
|
209
|
+
export interface FlowStep {
|
|
210
|
+
/** Domain item reference in context.Name format. */
|
|
211
|
+
ref: DomainRef;
|
|
212
|
+
/** Type of the referenced domain item. */
|
|
213
|
+
type: FlowStepType;
|
|
214
|
+
/** Optional annotation for this step. */
|
|
215
|
+
note?: string;
|
|
216
|
+
}
|
|
217
|
+
/** A cross-context flow linking domain items in sequence. */
|
|
218
|
+
export interface Flow {
|
|
219
|
+
/** Flow name. */
|
|
220
|
+
name: string;
|
|
221
|
+
/** What this flow accomplishes. */
|
|
222
|
+
description?: string;
|
|
223
|
+
/** Ordered sequence of domain item references forming the flow. */
|
|
224
|
+
steps: FlowStep[];
|
|
225
|
+
}
|
|
226
|
+
/** Top-level domain index file shape (domain/index.yml). */
|
|
227
|
+
export interface DomainIndex {
|
|
228
|
+
/** Registered bounded contexts. */
|
|
229
|
+
contexts: ContextEntry[];
|
|
230
|
+
/** Cross-context flows linking domain items in sequence. */
|
|
231
|
+
flows?: Flow[];
|
|
232
|
+
}
|
|
233
|
+
/** Complete domain model loaded from all YAML and ADR files. */
|
|
234
|
+
export interface DomainModel {
|
|
235
|
+
/** Top-level domain index. */
|
|
236
|
+
index: DomainIndex;
|
|
237
|
+
/** All actors. */
|
|
238
|
+
actors: Actor[];
|
|
239
|
+
/** All bounded contexts keyed by context name. */
|
|
240
|
+
contexts: Map<string, DomainContext>;
|
|
241
|
+
/** All ADR records keyed by ADR id. */
|
|
242
|
+
adrs: Map<string, AdrRecord>;
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../src/shared/types/domain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,mDAAmD;AACnD,MAAM,WAAW,KAAK;IACpB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,4CAA4C;AAC5C,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,EAAE,CAAC;AAErC,kEAAkE;AAClE,MAAM,WAAW,OAAO;IACtB,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAI9C,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAID,0EAA0E;AAC1E,MAAM,MAAM,S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