@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/package.json
CHANGED
package/src/buildModel.d.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { Model } from './model';
|
|
2
2
|
import { ElementArchetype, RelationshipArchetype } from './archetype';
|
|
3
|
+
import { Views } from './views';
|
|
3
4
|
type Catalog = Record<string, unknown>;
|
|
4
5
|
type RootCatalog = Record<string, Catalog>;
|
|
5
6
|
export interface AnyC4Module {
|
|
6
7
|
readonly key: string;
|
|
7
8
|
registerDefinitions(model: Model, archetypes: Record<string, ElementArchetype | RelationshipArchetype>): Catalog;
|
|
8
|
-
|
|
9
|
+
addRelationships(local: Catalog, dependencies: RootCatalog, archetypes: Record<string, ElementArchetype | RelationshipArchetype>): void;
|
|
10
|
+
addViews?(views: Views, local: Catalog, dependencies: RootCatalog): void;
|
|
9
11
|
}
|
|
10
|
-
export interface BuildModelOptions {
|
|
12
|
+
export interface BuildModelOptions<TRoot = Record<string, unknown>> {
|
|
11
13
|
modelName?: string;
|
|
12
14
|
modules?: ReadonlyArray<AnyC4Module>;
|
|
13
15
|
globPath?: string;
|
|
14
16
|
searchRoot?: string;
|
|
15
17
|
archetypes?: Record<string, ElementArchetype | RelationshipArchetype>;
|
|
18
|
+
addViews?: (views: Views, catalog: TRoot) => void;
|
|
16
19
|
}
|
|
17
|
-
export declare function
|
|
20
|
+
export declare function buildModel<TRoot>(options?: BuildModelOptions<TRoot>): Promise<{
|
|
18
21
|
model: Model;
|
|
19
22
|
catalog: TRoot;
|
|
23
|
+
views: Views;
|
|
20
24
|
}>;
|
|
21
|
-
export declare function buildModel(options?: BuildModelOptions): Promise<Model>;
|
|
22
25
|
export {};
|
package/src/container.d.ts
CHANGED
|
@@ -5,21 +5,28 @@ export type ContainerDefinition = TechnologyDefinition;
|
|
|
5
5
|
interface DefineComponent {
|
|
6
6
|
component(name: string, archetypeOrDef?: ElementArchetype | ComponentDefinition, override?: ComponentDefinition): Component;
|
|
7
7
|
}
|
|
8
|
-
export declare class ContainerGroup extends Group implements DefineComponent {
|
|
8
|
+
export declare class ContainerGroup extends Group<Component> implements DefineComponent {
|
|
9
9
|
readonly name: string;
|
|
10
10
|
private readonly container;
|
|
11
|
+
private readonly pathSegments;
|
|
11
12
|
private _components;
|
|
12
|
-
|
|
13
|
+
private _groups;
|
|
14
|
+
constructor(name: string, container: DefineComponent, pathSegments?: string[]);
|
|
15
|
+
get canonicalName(): string;
|
|
16
|
+
get dslName(): string;
|
|
13
17
|
component(name: string, archetypeOrDef?: ElementArchetype | ComponentDefinition, override?: ComponentDefinition): Component;
|
|
18
|
+
group(groupName: string): ContainerGroup;
|
|
19
|
+
getGroups(): ReadonlyArray<ContainerGroup>;
|
|
14
20
|
getComponents(): ReadonlyArray<Component>;
|
|
21
|
+
getAllComponents(): ReadonlyArray<Component>;
|
|
15
22
|
}
|
|
16
|
-
export declare class Container extends TechnicalElement implements DefineComponent {
|
|
23
|
+
export declare class Container extends TechnicalElement<Component> implements DefineComponent {
|
|
17
24
|
readonly name: string;
|
|
18
25
|
private _components;
|
|
19
26
|
private _groups;
|
|
20
27
|
constructor(name: string, definition?: ContainerDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
|
|
21
28
|
component(name: string, archetypeOrDef?: ElementArchetype | ComponentDefinition, override?: ComponentDefinition): Component;
|
|
22
|
-
|
|
29
|
+
group(groupName: string): ContainerGroup;
|
|
23
30
|
getGroups(): ReadonlyArray<ContainerGroup>;
|
|
24
31
|
getComponentsNotInGroups(): ReadonlyArray<Component>;
|
|
25
32
|
getChildElements(): ReadonlyArray<Element>;
|
package/src/core.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface Definition {
|
|
|
6
6
|
export interface TechnologyDefinition extends Definition {
|
|
7
7
|
technology?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare abstract class Element {
|
|
9
|
+
export declare abstract class Element<TChild extends Element = never> {
|
|
10
10
|
readonly name: string;
|
|
11
11
|
readonly description?: string;
|
|
12
12
|
readonly tags: ReadonlyArray<string>;
|
|
@@ -17,11 +17,12 @@ export declare abstract class Element {
|
|
|
17
17
|
get canonicalName(): string;
|
|
18
18
|
uses(otherElement: Element, archetypeOrDef?: RelationshipArchetype | TechnologyDefinition, override?: TechnologyDefinition): void;
|
|
19
19
|
get relationships(): ReadonlyArray<Relationship>;
|
|
20
|
+
with<TChildren extends Record<string, TChild>>(callback: (self: this) => TChildren): this & TChildren;
|
|
20
21
|
abstract getChildElements(): ReadonlyArray<Element>;
|
|
21
22
|
getRelationshipsInHierarchy(): ReadonlyArray<Relationship>;
|
|
22
23
|
getChildElementNames(path?: string): ReadonlyArray<string>;
|
|
23
24
|
}
|
|
24
|
-
export declare abstract class TechnicalElement extends Element {
|
|
25
|
+
export declare abstract class TechnicalElement<TChild extends Element = never> extends Element<TChild> {
|
|
25
26
|
readonly technology?: string;
|
|
26
27
|
constructor(name: string, defaultTags?: string[], definition?: TechnologyDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
|
|
27
28
|
}
|
|
@@ -35,7 +36,9 @@ export declare class Relationship {
|
|
|
35
36
|
readonly overrideDefinition?: TechnologyDefinition;
|
|
36
37
|
constructor(source: Element, destination: Element, definition?: TechnologyDefinition, archetype?: RelationshipArchetype, overrideDefinition?: TechnologyDefinition);
|
|
37
38
|
}
|
|
38
|
-
export declare class Group {
|
|
39
|
+
export declare class Group<TChild extends Element | Group = never> {
|
|
39
40
|
readonly name: string;
|
|
40
41
|
constructor(name: string);
|
|
42
|
+
get canonicalName(): string;
|
|
43
|
+
with<TChildren extends Record<string, TChild>>(callback: (self: this) => TChildren): this & TChildren;
|
|
41
44
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { BuildModelOptions } from './buildModel';
|
|
2
|
-
|
|
3
|
-
export interface GenerateDiagramsOptions<TRoot> extends BuildModelOptions {
|
|
4
|
-
views: (catalog: TRoot) => Views;
|
|
2
|
+
export interface GenerateDiagramsOptions<TRoot> extends BuildModelOptions<TRoot> {
|
|
5
3
|
outputDir: string;
|
|
6
4
|
}
|
|
7
5
|
export declare function generateDiagrams<TRoot>(options: GenerateDiagramsOptions<TRoot>): Promise<string[]>;
|