@agilewallaby/c4-model 2.6.0 → 2.8.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/package.json +1 -1
- package/src/buildModel.d.ts +7 -4
- package/src/container.d.ts +11 -4
- package/src/core.d.ts +6 -3
- package/src/exportWorkspaceJson.d.ts +4 -0
- package/src/generateDiagrams.d.ts +1 -3
- package/src/index.cjs +355 -46
- package/src/index.d.ts +151 -55
- package/src/index.js +351 -44
- package/src/model.d.ts +14 -4
- package/src/softwareSystem.d.ts +11 -4
- package/src/structurizrDslWriter.d.ts +5 -0
- package/src/validateModel.d.ts +3 -0
- package/src/views.d.ts +63 -2
package/src/model.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Group } from './core';
|
|
|
2
2
|
import { SoftwareSystem, SoftwareSystemDefinition } from './softwareSystem';
|
|
3
3
|
import { Person, PersonDefinition } from './person';
|
|
4
4
|
import { ElementArchetype, RelationshipArchetype } from './archetype';
|
|
5
|
+
import { Views } from './views';
|
|
5
6
|
export type CatalogKeyOf<TRoot, TModule> = {
|
|
6
7
|
[K in keyof TRoot]: TRoot[K] extends TModule ? K : never;
|
|
7
8
|
}[keyof TRoot];
|
|
@@ -9,7 +10,8 @@ export type Dependencies<TRoot, TModule> = Omit<TRoot, CatalogKeyOf<TRoot, TModu
|
|
|
9
10
|
export interface C4Module<TRoot, TLocal, TArchetypes = Record<string, ElementArchetype | RelationshipArchetype>> {
|
|
10
11
|
readonly key: CatalogKeyOf<TRoot, TLocal>;
|
|
11
12
|
registerDefinitions(model: Model, archetypes: TArchetypes): TLocal;
|
|
12
|
-
|
|
13
|
+
addRelationships(local: TLocal, dependencies: Dependencies<TRoot, TLocal>, archetypes: TArchetypes): void;
|
|
14
|
+
addViews?(views: Views, local: TLocal, dependencies: Dependencies<TRoot, TLocal>): void;
|
|
13
15
|
}
|
|
14
16
|
interface DefineSoftwareSystem {
|
|
15
17
|
softwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
|
|
@@ -17,16 +19,24 @@ interface DefineSoftwareSystem {
|
|
|
17
19
|
interface DefinePerson {
|
|
18
20
|
person(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
|
|
19
21
|
}
|
|
20
|
-
export declare class ModelGroup extends Group implements DefineSoftwareSystem, DefinePerson {
|
|
22
|
+
export declare class ModelGroup extends Group<Person | SoftwareSystem> implements DefineSoftwareSystem, DefinePerson {
|
|
21
23
|
readonly name: string;
|
|
22
24
|
private readonly model;
|
|
25
|
+
private readonly pathSegments;
|
|
23
26
|
private softwareSystems;
|
|
24
27
|
private people;
|
|
25
|
-
|
|
28
|
+
private _groups;
|
|
29
|
+
constructor(name: string, model: DefineSoftwareSystem & DefinePerson, pathSegments?: string[]);
|
|
30
|
+
get canonicalName(): string;
|
|
31
|
+
get dslName(): string;
|
|
26
32
|
softwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
|
|
27
33
|
person(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
|
|
34
|
+
group(groupName: string): ModelGroup;
|
|
35
|
+
getGroups(): ReadonlyArray<ModelGroup>;
|
|
28
36
|
getSoftwareSystems(): ReadonlyArray<SoftwareSystem>;
|
|
29
37
|
getPeople(): ReadonlyArray<Person>;
|
|
38
|
+
getAllSoftwareSystems(): ReadonlyArray<SoftwareSystem>;
|
|
39
|
+
getAllPeople(): ReadonlyArray<Person>;
|
|
30
40
|
}
|
|
31
41
|
export interface ModelDefinitions {
|
|
32
42
|
softwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
|
|
@@ -39,7 +49,7 @@ export declare class Model {
|
|
|
39
49
|
private people;
|
|
40
50
|
private groups;
|
|
41
51
|
softwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
|
|
42
|
-
|
|
52
|
+
group(groupName: string): ModelGroup;
|
|
43
53
|
person(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
|
|
44
54
|
validate(): void;
|
|
45
55
|
getPeople(): ReadonlyArray<Person>;
|
package/src/softwareSystem.d.ts
CHANGED
|
@@ -8,21 +8,28 @@ interface DefineContainer {
|
|
|
8
8
|
export interface SoftwareSystemReference {
|
|
9
9
|
name: string;
|
|
10
10
|
}
|
|
11
|
-
export declare class SoftwareSystemGroup extends Group implements DefineContainer {
|
|
11
|
+
export declare class SoftwareSystemGroup extends Group<Container> implements DefineContainer {
|
|
12
12
|
readonly name: string;
|
|
13
13
|
private readonly softwareSystem;
|
|
14
|
+
private readonly pathSegments;
|
|
14
15
|
private _containers;
|
|
15
|
-
|
|
16
|
+
private _groups;
|
|
17
|
+
constructor(name: string, softwareSystem: DefineContainer, pathSegments?: string[]);
|
|
18
|
+
get canonicalName(): string;
|
|
19
|
+
get dslName(): string;
|
|
16
20
|
container(name: string, archetypeOrDef?: ElementArchetype | ContainerDefinition, override?: ContainerDefinition): Container;
|
|
21
|
+
group(groupName: string): SoftwareSystemGroup;
|
|
22
|
+
getGroups(): ReadonlyArray<SoftwareSystemGroup>;
|
|
17
23
|
getContainers(): ReadonlyArray<Container>;
|
|
24
|
+
getAllContainers(): ReadonlyArray<Container>;
|
|
18
25
|
}
|
|
19
|
-
export declare class SoftwareSystem extends Element implements DefineContainer {
|
|
26
|
+
export declare class SoftwareSystem extends Element<Container> implements DefineContainer {
|
|
20
27
|
readonly name: string;
|
|
21
28
|
private _containers;
|
|
22
29
|
private _groups;
|
|
23
30
|
constructor(name: string, definition?: SoftwareSystemDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
|
|
24
31
|
container(name: string, archetypeOrDef?: ElementArchetype | ContainerDefinition, override?: ContainerDefinition): Container;
|
|
25
|
-
|
|
32
|
+
group(groupName: string): SoftwareSystemGroup;
|
|
26
33
|
getGroups(): ReadonlyArray<SoftwareSystemGroup>;
|
|
27
34
|
getChildElements(): ReadonlyArray<Element>;
|
|
28
35
|
getContainersNotInGroups(): ReadonlyArray<Container>;
|
|
@@ -14,9 +14,14 @@ export declare class StructurizrDSLWriter {
|
|
|
14
14
|
private writeSoftwareSystem;
|
|
15
15
|
private writeRelationship;
|
|
16
16
|
private writeRelationships;
|
|
17
|
+
private hasNestedModelGroups;
|
|
18
|
+
private hasNestedSoftwareSystemGroups;
|
|
19
|
+
private hasNestedContainerGroups;
|
|
20
|
+
private hasNestedGroups;
|
|
17
21
|
private writeModelGroup;
|
|
18
22
|
private writeModel;
|
|
19
23
|
private writeView;
|
|
24
|
+
private writeStyles;
|
|
20
25
|
private writeViews;
|
|
21
26
|
write(): string;
|
|
22
27
|
private writeLine;
|
package/src/views.d.ts
CHANGED
|
@@ -6,33 +6,94 @@ interface ViewDefinition<T extends Element> {
|
|
|
6
6
|
description: string;
|
|
7
7
|
title?: string;
|
|
8
8
|
}
|
|
9
|
+
export type AutoLayoutDirection = 'tb' | 'bt' | 'lr' | 'rl';
|
|
10
|
+
export interface AutoLayout {
|
|
11
|
+
direction?: AutoLayoutDirection;
|
|
12
|
+
rankSeparation?: number;
|
|
13
|
+
nodeSeparation?: number;
|
|
14
|
+
}
|
|
15
|
+
export type ElementShape = 'Box' | 'RoundedBox' | 'Circle' | 'Ellipse' | 'Hexagon' | 'Diamond' | 'Cylinder' | 'Bucket' | 'Pipe' | 'Person' | 'Robot' | 'Folder' | 'WebBrowser' | 'Window' | 'Terminal' | 'Shell' | 'MobileDevicePortrait' | 'MobileDeviceLandscape' | 'Component';
|
|
16
|
+
export interface ElementStyleDefinition {
|
|
17
|
+
shape?: ElementShape;
|
|
18
|
+
icon?: string;
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
background?: string;
|
|
22
|
+
color?: string;
|
|
23
|
+
stroke?: string;
|
|
24
|
+
strokeWidth?: number;
|
|
25
|
+
fontSize?: number;
|
|
26
|
+
border?: 'solid' | 'dashed' | 'dotted';
|
|
27
|
+
opacity?: number;
|
|
28
|
+
metadata?: boolean;
|
|
29
|
+
description?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface RelationshipStyleDefinition {
|
|
32
|
+
thickness?: number;
|
|
33
|
+
color?: string;
|
|
34
|
+
style?: 'solid' | 'dashed' | 'dotted';
|
|
35
|
+
routing?: 'Direct' | 'Orthogonal' | 'Curved';
|
|
36
|
+
fontSize?: number;
|
|
37
|
+
width?: number;
|
|
38
|
+
position?: number;
|
|
39
|
+
opacity?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface ElementStyleEntry {
|
|
42
|
+
tag: string;
|
|
43
|
+
definition: ElementStyleDefinition;
|
|
44
|
+
}
|
|
45
|
+
export interface RelationshipStyleEntry {
|
|
46
|
+
tag: string;
|
|
47
|
+
definition: RelationshipStyleDefinition;
|
|
48
|
+
}
|
|
9
49
|
export declare class View<T extends Element> {
|
|
10
50
|
readonly key: string;
|
|
11
51
|
readonly subject?: T;
|
|
12
52
|
readonly description: string;
|
|
13
53
|
readonly title?: string;
|
|
14
54
|
private _scopes;
|
|
55
|
+
private _autoLayout?;
|
|
56
|
+
private _isDefault;
|
|
57
|
+
private _properties;
|
|
15
58
|
constructor(key: string, viewDefinition: ViewDefinition<T>);
|
|
16
59
|
includeAll(): void;
|
|
17
|
-
includeElement(element:
|
|
60
|
+
includeElement(element: Element): void;
|
|
18
61
|
includeExpression(expression: string): void;
|
|
19
62
|
excludeAll(): void;
|
|
20
|
-
excludeElement(element:
|
|
63
|
+
excludeElement(element: Element): void;
|
|
21
64
|
excludeExpression(expression: string): void;
|
|
65
|
+
autoLayout(direction?: AutoLayoutDirection, rankSeparation?: number, nodeSeparation?: number): void;
|
|
66
|
+
setDefault(): void;
|
|
67
|
+
addProperty(name: string, value: string): void;
|
|
22
68
|
get scopes(): ReadonlyArray<string>;
|
|
69
|
+
get autoLayoutConfig(): AutoLayout | undefined;
|
|
70
|
+
get isDefault(): boolean;
|
|
71
|
+
get properties(): ReadonlyMap<string, string>;
|
|
23
72
|
}
|
|
24
73
|
export declare class Views {
|
|
25
74
|
private readonly _systemLandscapeViews;
|
|
26
75
|
private readonly _systemContextViews;
|
|
27
76
|
private readonly _containerViews;
|
|
28
77
|
private readonly _componentViews;
|
|
78
|
+
private _elementStyles;
|
|
79
|
+
private _relationshipStyles;
|
|
80
|
+
private _themes;
|
|
81
|
+
private _properties;
|
|
29
82
|
addSystemLandscapeView(key: string, definition: ViewDefinition<Element>): View<Element>;
|
|
30
83
|
addSystemContextView(key: string, definition: ViewDefinition<SoftwareSystem>): View<SoftwareSystem>;
|
|
31
84
|
addContainerView(key: string, definition: ViewDefinition<SoftwareSystem>): View<SoftwareSystem>;
|
|
32
85
|
addComponentView(key: string, definition: ViewDefinition<Container>): View<Container>;
|
|
86
|
+
addElementStyle(tag: string, definition: ElementStyleDefinition): void;
|
|
87
|
+
addRelationshipStyle(tag: string, definition: RelationshipStyleDefinition): void;
|
|
88
|
+
addTheme(url: string): void;
|
|
89
|
+
addProperty(name: string, value: string): void;
|
|
33
90
|
get systemLandscapeViews(): ReadonlyArray<View<Element>>;
|
|
34
91
|
get systemContextViews(): ReadonlyArray<View<SoftwareSystem>>;
|
|
35
92
|
get containerViews(): ReadonlyArray<View<SoftwareSystem>>;
|
|
36
93
|
get componentViews(): ReadonlyArray<View<Container>>;
|
|
94
|
+
get elementStyles(): ReadonlyArray<ElementStyleEntry>;
|
|
95
|
+
get relationshipStyles(): ReadonlyArray<RelationshipStyleEntry>;
|
|
96
|
+
get themes(): ReadonlyArray<string>;
|
|
97
|
+
get properties(): ReadonlyMap<string, string>;
|
|
37
98
|
}
|
|
38
99
|
export {};
|