@agilewallaby/c4-model 2.3.0 → 2.4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.ts +258 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agilewallaby/c4-model",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/index.d.ts CHANGED
@@ -1,10 +1,258 @@
1
- export * from './archetype';
2
- export * from './model';
3
- export * from './person';
4
- export * from './softwareSystem';
5
- export * from './container';
6
- export * from './component';
7
- export * from './views';
8
- export * from './structurizrDslWriter';
9
- export * from './buildModel';
10
- export * from './generateDiagrams';
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ export interface Definition {
4
+ description?: string;
5
+ tags?: string[];
6
+ }
7
+ export interface TechnologyDefinition extends Definition {
8
+ technology?: string;
9
+ }
10
+ declare abstract class Element$1 {
11
+ readonly name: string;
12
+ readonly description?: string;
13
+ readonly tags: ReadonlyArray<string>;
14
+ readonly archetype?: ElementArchetype;
15
+ readonly overrideDefinition?: TechnologyDefinition;
16
+ private _relationships;
17
+ constructor(name: string, defaultTags?: string[], definition?: Definition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
18
+ get canonicalName(): string;
19
+ uses(otherElement: Element$1, archetypeOrDef?: RelationshipArchetype | TechnologyDefinition, override?: TechnologyDefinition): void;
20
+ get relationships(): ReadonlyArray<Relationship>;
21
+ abstract getChildElements(): ReadonlyArray<Element$1>;
22
+ getRelationshipsInHierarchy(): ReadonlyArray<Relationship>;
23
+ getChildElementNames(path?: string): ReadonlyArray<string>;
24
+ }
25
+ declare abstract class TechnicalElement extends Element$1 {
26
+ readonly technology?: string;
27
+ constructor(name: string, defaultTags?: string[], definition?: TechnologyDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
28
+ }
29
+ declare class Relationship {
30
+ readonly source: Element$1;
31
+ readonly destination: Element$1;
32
+ readonly description?: string;
33
+ readonly tags: ReadonlyArray<string>;
34
+ readonly technology?: string;
35
+ readonly archetype?: RelationshipArchetype;
36
+ readonly overrideDefinition?: TechnologyDefinition;
37
+ constructor(source: Element$1, destination: Element$1, definition?: TechnologyDefinition, archetype?: RelationshipArchetype, overrideDefinition?: TechnologyDefinition);
38
+ }
39
+ declare class Group {
40
+ readonly name: string;
41
+ constructor(name: string);
42
+ }
43
+ export type ElementKind = "person" | "softwareSystem" | "container" | "component";
44
+ export declare class ElementArchetype {
45
+ readonly name: string;
46
+ readonly elementKind: ElementKind;
47
+ readonly parent?: ElementArchetype | undefined;
48
+ readonly ownDescription?: string;
49
+ readonly ownTechnology?: string;
50
+ readonly ownTags: ReadonlyArray<string>;
51
+ readonly description?: string;
52
+ readonly technology?: string;
53
+ readonly tags: ReadonlyArray<string>;
54
+ constructor(name: string, elementKind: ElementKind, definition?: TechnologyDefinition, parent?: ElementArchetype | undefined);
55
+ }
56
+ export declare class RelationshipArchetype {
57
+ readonly name: string;
58
+ readonly parent?: RelationshipArchetype | undefined;
59
+ readonly ownDescription?: string;
60
+ readonly ownTechnology?: string;
61
+ readonly ownTags: ReadonlyArray<string>;
62
+ readonly description?: string;
63
+ readonly technology?: string;
64
+ readonly tags: ReadonlyArray<string>;
65
+ constructor(name: string, definition?: TechnologyDefinition, parent?: RelationshipArchetype | undefined);
66
+ }
67
+ export declare function mergeArchetypeWithOverride(archetype: {
68
+ description?: string;
69
+ technology?: string;
70
+ tags: ReadonlyArray<string>;
71
+ }, override?: TechnologyDefinition): TechnologyDefinition;
72
+ export type ComponentDefinition = TechnologyDefinition;
73
+ export declare class Component extends TechnicalElement {
74
+ readonly name: string;
75
+ constructor(name: string, definition?: ComponentDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
76
+ getChildElements(): ReadonlyArray<Element$1>;
77
+ }
78
+ export type ContainerDefinition = TechnologyDefinition;
79
+ export interface DefineComponent {
80
+ defineComponent(name: string, archetypeOrDef?: ElementArchetype | ComponentDefinition, override?: ComponentDefinition): Component;
81
+ }
82
+ export declare class ContainerGroup extends Group implements DefineComponent {
83
+ readonly name: string;
84
+ private readonly container;
85
+ private _components;
86
+ constructor(name: string, container: DefineComponent);
87
+ defineComponent(name: string, archetypeOrDef?: ElementArchetype | ComponentDefinition, override?: ComponentDefinition): Component;
88
+ getComponents(): ReadonlyArray<Component>;
89
+ }
90
+ export declare class Container extends TechnicalElement implements DefineComponent {
91
+ readonly name: string;
92
+ private _components;
93
+ private _groups;
94
+ constructor(name: string, definition?: ContainerDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
95
+ defineComponent(name: string, archetypeOrDef?: ElementArchetype | ComponentDefinition, override?: ComponentDefinition): Component;
96
+ addGroup(groupName: string): ContainerGroup;
97
+ getGroups(): ReadonlyArray<ContainerGroup>;
98
+ getComponentsNotInGroups(): ReadonlyArray<Component>;
99
+ getChildElements(): ReadonlyArray<Element$1>;
100
+ }
101
+ export type SoftwareSystemDefinition = Definition;
102
+ export interface DefineContainer {
103
+ defineContainer(name: string, archetypeOrDef?: ElementArchetype | ContainerDefinition, override?: ContainerDefinition): Container;
104
+ }
105
+ export interface SoftwareSystemReference {
106
+ name: string;
107
+ }
108
+ export declare class SoftwareSystemGroup extends Group implements DefineContainer {
109
+ readonly name: string;
110
+ private readonly softwareSystem;
111
+ private _containers;
112
+ constructor(name: string, softwareSystem: DefineContainer);
113
+ defineContainer(name: string, archetypeOrDef?: ElementArchetype | ContainerDefinition, override?: ContainerDefinition): Container;
114
+ getContainers(): ReadonlyArray<Container>;
115
+ }
116
+ export declare class SoftwareSystem extends Element$1 implements DefineContainer {
117
+ readonly name: string;
118
+ private _containers;
119
+ private _groups;
120
+ constructor(name: string, definition?: SoftwareSystemDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
121
+ defineContainer(name: string, archetypeOrDef?: ElementArchetype | ContainerDefinition, override?: ContainerDefinition): Container;
122
+ addGroup(groupName: string): SoftwareSystemGroup;
123
+ getGroups(): ReadonlyArray<SoftwareSystemGroup>;
124
+ getChildElements(): ReadonlyArray<Element$1>;
125
+ getContainersNotInGroups(): ReadonlyArray<Container>;
126
+ }
127
+ export type PersonDefinition = Definition;
128
+ export declare class Person extends Element$1 {
129
+ readonly name: string;
130
+ constructor(name: string, definition?: PersonDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
131
+ getChildElements(): ReadonlyArray<Element$1>;
132
+ }
133
+ export type CatalogKeyOf<TRoot, TModule> = {
134
+ [K in keyof TRoot]: TRoot[K] extends TModule ? K : never;
135
+ }[keyof TRoot];
136
+ export type Dependencies<TRoot, TModule> = Omit<TRoot, CatalogKeyOf<TRoot, TModule>>;
137
+ export interface C4Module<TRoot, TLocal> {
138
+ readonly key: CatalogKeyOf<TRoot, TLocal>;
139
+ registerDefinitions(model: Model): TLocal;
140
+ buildRelationships(local: TLocal, dependencies: Dependencies<TRoot, TLocal>): void;
141
+ }
142
+ export interface DefineSoftwareSystem {
143
+ defineSoftwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
144
+ }
145
+ export interface DefinePerson {
146
+ definePerson(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
147
+ }
148
+ export declare class ModelGroup extends Group implements DefineSoftwareSystem, DefinePerson {
149
+ readonly name: string;
150
+ private readonly model;
151
+ private softwareSystems;
152
+ private people;
153
+ constructor(name: string, model: DefineSoftwareSystem & DefinePerson);
154
+ defineSoftwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
155
+ definePerson(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
156
+ getSoftwareSystems(): ReadonlyArray<SoftwareSystem>;
157
+ getPeople(): ReadonlyArray<Person>;
158
+ }
159
+ export interface ModelDefinitions {
160
+ defineSoftwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
161
+ definePerson(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
162
+ }
163
+ export declare class Model {
164
+ name: string;
165
+ constructor(name: string);
166
+ private softwareSystems;
167
+ private people;
168
+ private groups;
169
+ defineSoftwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
170
+ addGroup(groupName: string): Group & ModelDefinitions;
171
+ definePerson(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
172
+ validate(): void;
173
+ getPeople(): ReadonlyArray<Person>;
174
+ getSoftwareSystems(): ReadonlyArray<SoftwareSystem>;
175
+ getPeopleNotInGroups(): ReadonlyArray<Person>;
176
+ getSoftwareSystemsNotInGroups(): ReadonlyArray<SoftwareSystem>;
177
+ getGroups(): ReadonlyArray<ModelGroup>;
178
+ }
179
+ export interface ViewDefinition<T extends Element$1> {
180
+ subject?: T;
181
+ description: string;
182
+ title?: string;
183
+ }
184
+ export declare class View<T extends Element$1> {
185
+ readonly key: string;
186
+ readonly subject?: T;
187
+ readonly description: string;
188
+ readonly title?: string;
189
+ private _scopes;
190
+ constructor(key: string, viewDefinition: ViewDefinition<T>);
191
+ includeAll(): void;
192
+ includeElement(element: T): void;
193
+ includeExpression(expression: string): void;
194
+ excludeAll(): void;
195
+ excludeElement(element: T): void;
196
+ excludeExpression(expression: string): void;
197
+ get scopes(): ReadonlyArray<string>;
198
+ }
199
+ export declare class Views {
200
+ private readonly _systemLandscapeViews;
201
+ private readonly _systemContextViews;
202
+ private readonly _containerViews;
203
+ private readonly _componentViews;
204
+ addSystemLandscapeView(key: string, definition: ViewDefinition<Element$1>): View<Element$1>;
205
+ addSystemContextView(key: string, definition: ViewDefinition<SoftwareSystem>): View<SoftwareSystem>;
206
+ addContainerView(key: string, definition: ViewDefinition<SoftwareSystem>): View<SoftwareSystem>;
207
+ addComponentView(key: string, definition: ViewDefinition<Container>): View<Container>;
208
+ get systemLandscapeViews(): ReadonlyArray<View<Element$1>>;
209
+ get systemContextViews(): ReadonlyArray<View<SoftwareSystem>>;
210
+ get containerViews(): ReadonlyArray<View<SoftwareSystem>>;
211
+ get componentViews(): ReadonlyArray<View<Container>>;
212
+ }
213
+ export declare class StructurizrDSLWriter {
214
+ private readonly model;
215
+ private readonly views;
216
+ constructor(model: Model, views: Views);
217
+ private collectArchetypes;
218
+ private writeArchetypes;
219
+ private writeElement;
220
+ private writeComponent;
221
+ private writeContainerGroup;
222
+ private writeContainer;
223
+ private writeSoftwareSystemGroup;
224
+ private writeSoftwareSystem;
225
+ private writeRelationship;
226
+ private writeRelationships;
227
+ private writeModelGroup;
228
+ private writeModel;
229
+ private writeView;
230
+ private writeViews;
231
+ write(): string;
232
+ private writeLine;
233
+ }
234
+ export type Catalog = Record<string, unknown>;
235
+ export type RootCatalog = Record<string, Catalog>;
236
+ export interface AnyC4Module {
237
+ readonly key: string;
238
+ registerDefinitions(model: Model): Catalog;
239
+ buildRelationships(local: Catalog, dependencies: RootCatalog): void;
240
+ }
241
+ export interface BuildModelOptions {
242
+ modelName?: string;
243
+ modules?: ReadonlyArray<AnyC4Module>;
244
+ globPath?: string;
245
+ searchRoot?: string;
246
+ }
247
+ export declare function buildModelWithCatalog<TRoot>(options?: BuildModelOptions): Promise<{
248
+ model: Model;
249
+ catalog: TRoot;
250
+ }>;
251
+ export declare function buildModel(options?: BuildModelOptions): Promise<Model>;
252
+ export interface GenerateDiagramsOptions<TRoot> extends BuildModelOptions {
253
+ views: (catalog: TRoot) => Views;
254
+ outputDir: string;
255
+ }
256
+ export declare function generateDiagrams<TRoot>(options: GenerateDiagramsOptions<TRoot>): Promise<string[]>;
257
+
258
+ export {};