d5-mermaid 0.3.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.
@@ -0,0 +1,280 @@
1
+ type Direction = 'LR' | 'RL' | 'TB' | 'BT';
2
+
3
+ type SubdomainType$1 = 'core' | 'supporting' | 'generic';
4
+ interface Domain {
5
+ id: string;
6
+ label: string;
7
+ }
8
+ interface Subdomain$1 {
9
+ id: string;
10
+ label: string;
11
+ type: SubdomainType$1;
12
+ }
13
+ interface Relationship$2 {
14
+ source: string;
15
+ target: string;
16
+ label: string;
17
+ }
18
+ declare class D5DomainDb {
19
+ private domain;
20
+ private subdomains;
21
+ private relationships;
22
+ private direction;
23
+ private title;
24
+ private accTitle;
25
+ private accDescription;
26
+ getDomain(): Domain | undefined;
27
+ setDomain(id: string, label: string): void;
28
+ getSubdomains(): Subdomain$1[];
29
+ addSubdomain(id: string, label: string, type: SubdomainType$1): void;
30
+ getRelationships(): Relationship$2[];
31
+ addRelationship(source: string, target: string, label: string): void;
32
+ /** Accepts `LR` / `RL` / `TB` / `TD` / `BT` (case-insensitive); `TD` is stored as `TB`. */
33
+ setDirection(dir: string): void;
34
+ getDirection(): Direction;
35
+ clear(): void;
36
+ setTitle(title: string): void;
37
+ getTitle(): string | undefined;
38
+ setDiagramTitle(title: string): void;
39
+ getDiagramTitle(): string;
40
+ setAccTitle(title: string): void;
41
+ getAccTitle(): string;
42
+ setAccDescription(desc: string): void;
43
+ getAccDescription(): string;
44
+ }
45
+
46
+ type SubdomainType = 'core' | 'supporting' | 'generic';
47
+ interface Subdomain {
48
+ id: string;
49
+ label: string;
50
+ type: SubdomainType;
51
+ }
52
+ interface BoundedContext$1 {
53
+ id: string;
54
+ label: string;
55
+ subdomainId: string;
56
+ team: string | undefined;
57
+ }
58
+ interface Relationship$1 {
59
+ source: string;
60
+ target: string;
61
+ label: string;
62
+ }
63
+ declare class D5SubdomainDb {
64
+ private subdomains;
65
+ private boundedContexts;
66
+ private relationships;
67
+ private direction;
68
+ private title;
69
+ private accTitle;
70
+ private accDescription;
71
+ setTitle(title: string): void;
72
+ getTitle(): string | undefined;
73
+ /** Accepts `LR` / `RL` / `TB` / `TD` / `BT` (case-insensitive); `TD` is stored as `TB`. */
74
+ setDirection(dir: string): void;
75
+ getDirection(): Direction;
76
+ addSubdomain(id: string, label: string, type: SubdomainType): void;
77
+ getSubdomains(): Subdomain[];
78
+ addBoundedContext(id: string, label: string, subdomainId: string, team?: string): void;
79
+ getBoundedContexts(): BoundedContext$1[];
80
+ addRelationship(source: string, target: string, label: string): void;
81
+ getRelationships(): Relationship$1[];
82
+ clear(): void;
83
+ setDiagramTitle(title: string): void;
84
+ getDiagramTitle(): string;
85
+ setAccTitle(title: string): void;
86
+ getAccTitle(): string;
87
+ setAccDescription(desc: string): void;
88
+ getAccDescription(): string;
89
+ }
90
+
91
+ interface BoundedContext {
92
+ id: string;
93
+ label: string;
94
+ team: string | undefined;
95
+ }
96
+ interface Aggregate$1 {
97
+ id: string;
98
+ label: string;
99
+ root: string;
100
+ fields?: string[];
101
+ }
102
+ /** A denormalised query-side view built from domain events (CQRS read model). */
103
+ interface ReadModel {
104
+ id: string;
105
+ label: string;
106
+ }
107
+ interface Term {
108
+ term: string;
109
+ definition: string;
110
+ }
111
+ interface Relationship {
112
+ source: string;
113
+ target: string;
114
+ label: string;
115
+ }
116
+ /** A domain event flowing from one aggregate to another: `source` emits, `target` reacts. */
117
+ interface DomainEvent {
118
+ source: string;
119
+ target: string;
120
+ name: string;
121
+ }
122
+ /**
123
+ * A reactive policy ("whenever … then …"). `source` is the aggregate whose activity
124
+ * triggers it, `target` the aggregate that reacts (they may be the same for a
125
+ * scheduled / self-directed policy). `rule` is the free-text statement.
126
+ */
127
+ interface Policy {
128
+ source: string;
129
+ target: string;
130
+ rule: string;
131
+ }
132
+ declare class D5ContextDb {
133
+ private boundedContext;
134
+ private aggregates;
135
+ private readModels;
136
+ private terms;
137
+ private relationships;
138
+ private events;
139
+ private policies;
140
+ private direction;
141
+ private title;
142
+ private accTitle;
143
+ private accDescription;
144
+ setTitle(title: string): void;
145
+ getTitle(): string | undefined;
146
+ /** Accepts `LR` / `RL` / `TB` / `TD` / `BT` (case-insensitive); `TD` is stored as `TB`. */
147
+ setDirection(dir: string): void;
148
+ getDirection(): Direction;
149
+ setBoundedContext(id: string, label: string, team?: string): void;
150
+ getBoundedContext(): BoundedContext | undefined;
151
+ addAggregate(id: string, label: string, root: string, fields?: string[]): void;
152
+ getAggregates(): Aggregate$1[];
153
+ addReadModel(id: string, label: string): void;
154
+ getReadModels(): ReadModel[];
155
+ addTerm(term: string, definition: string): void;
156
+ getTerms(): Term[];
157
+ addRelationship(source: string, target: string, label: string): void;
158
+ getRelationships(): Relationship[];
159
+ addEvent(source: string, target: string, name: string): void;
160
+ getEvents(): DomainEvent[];
161
+ addPolicy(source: string, target: string, rule: string): void;
162
+ getPolicies(): Policy[];
163
+ clear(): void;
164
+ setDiagramTitle(title: string): void;
165
+ getDiagramTitle(): string;
166
+ setAccTitle(title: string): void;
167
+ getAccTitle(): string;
168
+ setAccDescription(desc: string): void;
169
+ getAccDescription(): string;
170
+ }
171
+
172
+ interface Aggregate {
173
+ id: string;
174
+ label: string;
175
+ root: string;
176
+ }
177
+ interface Entity {
178
+ id: string;
179
+ label: string;
180
+ }
181
+ interface ValueObject {
182
+ id: string;
183
+ label: string;
184
+ }
185
+ interface Invariant {
186
+ /** optional short name / subject */
187
+ name: string | undefined;
188
+ /** the rule statement */
189
+ text: string;
190
+ }
191
+ declare class D5AggregateDb {
192
+ private aggregate;
193
+ private entities;
194
+ private valueObjects;
195
+ private invariants;
196
+ private title;
197
+ private accTitle;
198
+ private accDescription;
199
+ getAggregate(): Aggregate | undefined;
200
+ setAggregate(id: string, label: string, root: string): void;
201
+ getEntities(): Entity[];
202
+ addEntity(id: string, label: string): void;
203
+ getValueObjects(): ValueObject[];
204
+ addValueObject(id: string, label: string): void;
205
+ getInvariants(): Invariant[];
206
+ addInvariant(text: string, name?: string): void;
207
+ clear(): void;
208
+ setTitle(title: string): void;
209
+ getTitle(): string | undefined;
210
+ setDiagramTitle(title: string): void;
211
+ getDiagramTitle(): string;
212
+ setAccTitle(title: string): void;
213
+ getAccTitle(): string;
214
+ setAccDescription(desc: string): void;
215
+ getAccDescription(): string;
216
+ }
217
+
218
+ declare const d5Diagrams: ({
219
+ id: string;
220
+ detector: (text: string, _config?: unknown) => boolean;
221
+ loader: () => Promise<{
222
+ id: "d5-domain";
223
+ diagram: {
224
+ db: D5DomainDb;
225
+ renderer: {
226
+ draw(_text: string, id: string, _version: string, _diagramObject: unknown): void;
227
+ };
228
+ parser: {
229
+ parse(text: string): void;
230
+ };
231
+ };
232
+ }>;
233
+ } | {
234
+ id: string;
235
+ detector: (text: string, _config?: unknown) => boolean;
236
+ loader: () => Promise<{
237
+ id: "d5-subdomain";
238
+ diagram: {
239
+ db: D5SubdomainDb;
240
+ renderer: {
241
+ draw(_text: string, id: string, _version: string, _diagramObject: unknown): void;
242
+ };
243
+ parser: {
244
+ parse(text: string): void;
245
+ };
246
+ };
247
+ }>;
248
+ } | {
249
+ id: string;
250
+ detector: (text: string, _config?: unknown) => boolean;
251
+ loader: () => Promise<{
252
+ id: "d5-context";
253
+ diagram: {
254
+ db: D5ContextDb;
255
+ renderer: {
256
+ draw(_text: string, id: string, _version: string, _diagramObject: unknown): void;
257
+ };
258
+ parser: {
259
+ parse(text: string): void;
260
+ };
261
+ };
262
+ }>;
263
+ } | {
264
+ id: string;
265
+ detector: (text: string, _config?: unknown) => boolean;
266
+ loader: () => Promise<{
267
+ id: "d5-aggregate";
268
+ diagram: {
269
+ db: D5AggregateDb;
270
+ renderer: {
271
+ draw(_text: string, id: string, _version: string, _diagramObject: unknown): void;
272
+ };
273
+ parser: {
274
+ parse(text: string): void;
275
+ };
276
+ };
277
+ }>;
278
+ })[];
279
+
280
+ export { d5Diagrams };
@@ -0,0 +1,280 @@
1
+ type Direction = 'LR' | 'RL' | 'TB' | 'BT';
2
+
3
+ type SubdomainType$1 = 'core' | 'supporting' | 'generic';
4
+ interface Domain {
5
+ id: string;
6
+ label: string;
7
+ }
8
+ interface Subdomain$1 {
9
+ id: string;
10
+ label: string;
11
+ type: SubdomainType$1;
12
+ }
13
+ interface Relationship$2 {
14
+ source: string;
15
+ target: string;
16
+ label: string;
17
+ }
18
+ declare class D5DomainDb {
19
+ private domain;
20
+ private subdomains;
21
+ private relationships;
22
+ private direction;
23
+ private title;
24
+ private accTitle;
25
+ private accDescription;
26
+ getDomain(): Domain | undefined;
27
+ setDomain(id: string, label: string): void;
28
+ getSubdomains(): Subdomain$1[];
29
+ addSubdomain(id: string, label: string, type: SubdomainType$1): void;
30
+ getRelationships(): Relationship$2[];
31
+ addRelationship(source: string, target: string, label: string): void;
32
+ /** Accepts `LR` / `RL` / `TB` / `TD` / `BT` (case-insensitive); `TD` is stored as `TB`. */
33
+ setDirection(dir: string): void;
34
+ getDirection(): Direction;
35
+ clear(): void;
36
+ setTitle(title: string): void;
37
+ getTitle(): string | undefined;
38
+ setDiagramTitle(title: string): void;
39
+ getDiagramTitle(): string;
40
+ setAccTitle(title: string): void;
41
+ getAccTitle(): string;
42
+ setAccDescription(desc: string): void;
43
+ getAccDescription(): string;
44
+ }
45
+
46
+ type SubdomainType = 'core' | 'supporting' | 'generic';
47
+ interface Subdomain {
48
+ id: string;
49
+ label: string;
50
+ type: SubdomainType;
51
+ }
52
+ interface BoundedContext$1 {
53
+ id: string;
54
+ label: string;
55
+ subdomainId: string;
56
+ team: string | undefined;
57
+ }
58
+ interface Relationship$1 {
59
+ source: string;
60
+ target: string;
61
+ label: string;
62
+ }
63
+ declare class D5SubdomainDb {
64
+ private subdomains;
65
+ private boundedContexts;
66
+ private relationships;
67
+ private direction;
68
+ private title;
69
+ private accTitle;
70
+ private accDescription;
71
+ setTitle(title: string): void;
72
+ getTitle(): string | undefined;
73
+ /** Accepts `LR` / `RL` / `TB` / `TD` / `BT` (case-insensitive); `TD` is stored as `TB`. */
74
+ setDirection(dir: string): void;
75
+ getDirection(): Direction;
76
+ addSubdomain(id: string, label: string, type: SubdomainType): void;
77
+ getSubdomains(): Subdomain[];
78
+ addBoundedContext(id: string, label: string, subdomainId: string, team?: string): void;
79
+ getBoundedContexts(): BoundedContext$1[];
80
+ addRelationship(source: string, target: string, label: string): void;
81
+ getRelationships(): Relationship$1[];
82
+ clear(): void;
83
+ setDiagramTitle(title: string): void;
84
+ getDiagramTitle(): string;
85
+ setAccTitle(title: string): void;
86
+ getAccTitle(): string;
87
+ setAccDescription(desc: string): void;
88
+ getAccDescription(): string;
89
+ }
90
+
91
+ interface BoundedContext {
92
+ id: string;
93
+ label: string;
94
+ team: string | undefined;
95
+ }
96
+ interface Aggregate$1 {
97
+ id: string;
98
+ label: string;
99
+ root: string;
100
+ fields?: string[];
101
+ }
102
+ /** A denormalised query-side view built from domain events (CQRS read model). */
103
+ interface ReadModel {
104
+ id: string;
105
+ label: string;
106
+ }
107
+ interface Term {
108
+ term: string;
109
+ definition: string;
110
+ }
111
+ interface Relationship {
112
+ source: string;
113
+ target: string;
114
+ label: string;
115
+ }
116
+ /** A domain event flowing from one aggregate to another: `source` emits, `target` reacts. */
117
+ interface DomainEvent {
118
+ source: string;
119
+ target: string;
120
+ name: string;
121
+ }
122
+ /**
123
+ * A reactive policy ("whenever … then …"). `source` is the aggregate whose activity
124
+ * triggers it, `target` the aggregate that reacts (they may be the same for a
125
+ * scheduled / self-directed policy). `rule` is the free-text statement.
126
+ */
127
+ interface Policy {
128
+ source: string;
129
+ target: string;
130
+ rule: string;
131
+ }
132
+ declare class D5ContextDb {
133
+ private boundedContext;
134
+ private aggregates;
135
+ private readModels;
136
+ private terms;
137
+ private relationships;
138
+ private events;
139
+ private policies;
140
+ private direction;
141
+ private title;
142
+ private accTitle;
143
+ private accDescription;
144
+ setTitle(title: string): void;
145
+ getTitle(): string | undefined;
146
+ /** Accepts `LR` / `RL` / `TB` / `TD` / `BT` (case-insensitive); `TD` is stored as `TB`. */
147
+ setDirection(dir: string): void;
148
+ getDirection(): Direction;
149
+ setBoundedContext(id: string, label: string, team?: string): void;
150
+ getBoundedContext(): BoundedContext | undefined;
151
+ addAggregate(id: string, label: string, root: string, fields?: string[]): void;
152
+ getAggregates(): Aggregate$1[];
153
+ addReadModel(id: string, label: string): void;
154
+ getReadModels(): ReadModel[];
155
+ addTerm(term: string, definition: string): void;
156
+ getTerms(): Term[];
157
+ addRelationship(source: string, target: string, label: string): void;
158
+ getRelationships(): Relationship[];
159
+ addEvent(source: string, target: string, name: string): void;
160
+ getEvents(): DomainEvent[];
161
+ addPolicy(source: string, target: string, rule: string): void;
162
+ getPolicies(): Policy[];
163
+ clear(): void;
164
+ setDiagramTitle(title: string): void;
165
+ getDiagramTitle(): string;
166
+ setAccTitle(title: string): void;
167
+ getAccTitle(): string;
168
+ setAccDescription(desc: string): void;
169
+ getAccDescription(): string;
170
+ }
171
+
172
+ interface Aggregate {
173
+ id: string;
174
+ label: string;
175
+ root: string;
176
+ }
177
+ interface Entity {
178
+ id: string;
179
+ label: string;
180
+ }
181
+ interface ValueObject {
182
+ id: string;
183
+ label: string;
184
+ }
185
+ interface Invariant {
186
+ /** optional short name / subject */
187
+ name: string | undefined;
188
+ /** the rule statement */
189
+ text: string;
190
+ }
191
+ declare class D5AggregateDb {
192
+ private aggregate;
193
+ private entities;
194
+ private valueObjects;
195
+ private invariants;
196
+ private title;
197
+ private accTitle;
198
+ private accDescription;
199
+ getAggregate(): Aggregate | undefined;
200
+ setAggregate(id: string, label: string, root: string): void;
201
+ getEntities(): Entity[];
202
+ addEntity(id: string, label: string): void;
203
+ getValueObjects(): ValueObject[];
204
+ addValueObject(id: string, label: string): void;
205
+ getInvariants(): Invariant[];
206
+ addInvariant(text: string, name?: string): void;
207
+ clear(): void;
208
+ setTitle(title: string): void;
209
+ getTitle(): string | undefined;
210
+ setDiagramTitle(title: string): void;
211
+ getDiagramTitle(): string;
212
+ setAccTitle(title: string): void;
213
+ getAccTitle(): string;
214
+ setAccDescription(desc: string): void;
215
+ getAccDescription(): string;
216
+ }
217
+
218
+ declare const d5Diagrams: ({
219
+ id: string;
220
+ detector: (text: string, _config?: unknown) => boolean;
221
+ loader: () => Promise<{
222
+ id: "d5-domain";
223
+ diagram: {
224
+ db: D5DomainDb;
225
+ renderer: {
226
+ draw(_text: string, id: string, _version: string, _diagramObject: unknown): void;
227
+ };
228
+ parser: {
229
+ parse(text: string): void;
230
+ };
231
+ };
232
+ }>;
233
+ } | {
234
+ id: string;
235
+ detector: (text: string, _config?: unknown) => boolean;
236
+ loader: () => Promise<{
237
+ id: "d5-subdomain";
238
+ diagram: {
239
+ db: D5SubdomainDb;
240
+ renderer: {
241
+ draw(_text: string, id: string, _version: string, _diagramObject: unknown): void;
242
+ };
243
+ parser: {
244
+ parse(text: string): void;
245
+ };
246
+ };
247
+ }>;
248
+ } | {
249
+ id: string;
250
+ detector: (text: string, _config?: unknown) => boolean;
251
+ loader: () => Promise<{
252
+ id: "d5-context";
253
+ diagram: {
254
+ db: D5ContextDb;
255
+ renderer: {
256
+ draw(_text: string, id: string, _version: string, _diagramObject: unknown): void;
257
+ };
258
+ parser: {
259
+ parse(text: string): void;
260
+ };
261
+ };
262
+ }>;
263
+ } | {
264
+ id: string;
265
+ detector: (text: string, _config?: unknown) => boolean;
266
+ loader: () => Promise<{
267
+ id: "d5-aggregate";
268
+ diagram: {
269
+ db: D5AggregateDb;
270
+ renderer: {
271
+ draw(_text: string, id: string, _version: string, _diagramObject: unknown): void;
272
+ };
273
+ parser: {
274
+ parse(text: string): void;
275
+ };
276
+ };
277
+ }>;
278
+ })[];
279
+
280
+ export { d5Diagrams };