@agilewallaby/c4-model 2.0.0 → 2.2.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 +3 -9
- package/src/archetype.d.ts +30 -0
- package/src/buildModel.d.ts +20 -0
- package/src/component.d.ts +2 -1
- package/src/container.d.ts +5 -4
- package/src/core.d.ts +9 -4
- package/src/generateDiagrams.d.ts +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +813 -9
- package/src/model.d.ts +9 -18
- package/src/person.d.ts +3 -2
- package/src/softwareSystem.d.ts +6 -5
- package/src/structurizrDslWriter.d.ts +3 -0
- package/src/component.js +0 -12
- package/src/component.js.map +0 -1
- package/src/container.js +0 -57
- package/src/container.js.map +0 -1
- package/src/core.js +0 -60
- package/src/core.js.map +0 -1
- package/src/generateDiagrams.js +0 -47
- package/src/generateDiagrams.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/model.js +0 -121
- package/src/model.js.map +0 -1
- package/src/person.js +0 -12
- package/src/person.js.map +0 -1
- package/src/softwareSystem.js +0 -57
- package/src/softwareSystem.js.map +0 -1
- package/src/structurizrDslWriter.js +0 -162
- package/src/structurizrDslWriter.js.map +0 -1
- package/src/views.js +0 -73
- package/src/views.js.map +0 -1
package/src/model.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Group } from './core';
|
|
2
2
|
import { SoftwareSystem, SoftwareSystemDefinition } from './softwareSystem';
|
|
3
3
|
import { Person, PersonDefinition } from './person';
|
|
4
|
+
import { ElementArchetype } from './archetype';
|
|
4
5
|
export type CatalogKeyOf<TRoot, TModule> = {
|
|
5
6
|
[K in keyof TRoot]: TRoot[K] extends TModule ? K : never;
|
|
6
7
|
}[keyof TRoot];
|
|
@@ -11,10 +12,10 @@ export interface C4Module<TRoot, TLocal> {
|
|
|
11
12
|
buildRelationships(local: TLocal, dependencies: Dependencies<TRoot, TLocal>): void;
|
|
12
13
|
}
|
|
13
14
|
interface DefineSoftwareSystem {
|
|
14
|
-
defineSoftwareSystem(name: string,
|
|
15
|
+
defineSoftwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
|
|
15
16
|
}
|
|
16
17
|
interface DefinePerson {
|
|
17
|
-
definePerson(name: string,
|
|
18
|
+
definePerson(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
|
|
18
19
|
}
|
|
19
20
|
export declare class ModelGroup extends Group implements DefineSoftwareSystem, DefinePerson {
|
|
20
21
|
readonly name: string;
|
|
@@ -22,14 +23,14 @@ export declare class ModelGroup extends Group implements DefineSoftwareSystem, D
|
|
|
22
23
|
private softwareSystems;
|
|
23
24
|
private people;
|
|
24
25
|
constructor(name: string, model: DefineSoftwareSystem & DefinePerson);
|
|
25
|
-
defineSoftwareSystem(name: string,
|
|
26
|
-
definePerson(name: string,
|
|
26
|
+
defineSoftwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
|
|
27
|
+
definePerson(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
|
|
27
28
|
getSoftwareSystems(): ReadonlyArray<SoftwareSystem>;
|
|
28
29
|
getPeople(): ReadonlyArray<Person>;
|
|
29
30
|
}
|
|
30
31
|
export interface ModelDefinitions {
|
|
31
|
-
defineSoftwareSystem(name: string,
|
|
32
|
-
definePerson(name: string,
|
|
32
|
+
defineSoftwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
|
|
33
|
+
definePerson(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
|
|
33
34
|
}
|
|
34
35
|
export declare class Model {
|
|
35
36
|
name: string;
|
|
@@ -37,9 +38,9 @@ export declare class Model {
|
|
|
37
38
|
private softwareSystems;
|
|
38
39
|
private people;
|
|
39
40
|
private groups;
|
|
40
|
-
defineSoftwareSystem(name: string,
|
|
41
|
+
defineSoftwareSystem(name: string, archetypeOrDef?: ElementArchetype | SoftwareSystemDefinition, override?: SoftwareSystemDefinition): SoftwareSystem;
|
|
41
42
|
addGroup(groupName: string): Group & ModelDefinitions;
|
|
42
|
-
definePerson(name: string,
|
|
43
|
+
definePerson(name: string, archetypeOrDef?: ElementArchetype | PersonDefinition, override?: PersonDefinition): Person;
|
|
43
44
|
validate(): void;
|
|
44
45
|
getPeople(): ReadonlyArray<Person>;
|
|
45
46
|
getSoftwareSystems(): ReadonlyArray<SoftwareSystem>;
|
|
@@ -47,14 +48,4 @@ export declare class Model {
|
|
|
47
48
|
getSoftwareSystemsNotInGroups(): ReadonlyArray<SoftwareSystem>;
|
|
48
49
|
getGroups(): ReadonlyArray<ModelGroup>;
|
|
49
50
|
}
|
|
50
|
-
export interface BuildModelOptions {
|
|
51
|
-
modelName?: string;
|
|
52
|
-
globPath?: string;
|
|
53
|
-
searchRoot?: string;
|
|
54
|
-
}
|
|
55
|
-
export declare function buildModelWithCatalog<TRoot>(options?: BuildModelOptions): Promise<{
|
|
56
|
-
model: Model;
|
|
57
|
-
catalog: TRoot;
|
|
58
|
-
}>;
|
|
59
|
-
export declare function buildModel(options?: BuildModelOptions): Promise<Model>;
|
|
60
51
|
export {};
|
package/src/person.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Definition, Element } from './core';
|
|
1
|
+
import { Definition, Element, TechnologyDefinition } from './core';
|
|
2
|
+
import { ElementArchetype } from './archetype';
|
|
2
3
|
export type PersonDefinition = Definition;
|
|
3
4
|
export declare class Person extends Element {
|
|
4
5
|
readonly name: string;
|
|
5
|
-
constructor(name: string, definition?: PersonDefinition);
|
|
6
|
+
constructor(name: string, definition?: PersonDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
|
|
6
7
|
getChildElements(): ReadonlyArray<Element>;
|
|
7
8
|
}
|
package/src/softwareSystem.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Definition, Element, Group } from './core';
|
|
1
|
+
import { Definition, Element, Group, TechnologyDefinition } from './core';
|
|
2
2
|
import { Container, ContainerDefinition } from './container';
|
|
3
|
+
import { ElementArchetype } from './archetype';
|
|
3
4
|
export type SoftwareSystemDefinition = Definition;
|
|
4
5
|
interface DefineContainer {
|
|
5
|
-
defineContainer(name: string,
|
|
6
|
+
defineContainer(name: string, archetypeOrDef?: ElementArchetype | ContainerDefinition, override?: ContainerDefinition): Container;
|
|
6
7
|
}
|
|
7
8
|
export interface SoftwareSystemReference {
|
|
8
9
|
name: string;
|
|
@@ -12,15 +13,15 @@ export declare class SoftwareSystemGroup extends Group implements DefineContaine
|
|
|
12
13
|
private readonly softwareSystem;
|
|
13
14
|
private _containers;
|
|
14
15
|
constructor(name: string, softwareSystem: DefineContainer);
|
|
15
|
-
defineContainer(name: string,
|
|
16
|
+
defineContainer(name: string, archetypeOrDef?: ElementArchetype | ContainerDefinition, override?: ContainerDefinition): Container;
|
|
16
17
|
getContainers(): ReadonlyArray<Container>;
|
|
17
18
|
}
|
|
18
19
|
export declare class SoftwareSystem extends Element implements DefineContainer {
|
|
19
20
|
readonly name: string;
|
|
20
21
|
private _containers;
|
|
21
22
|
private _groups;
|
|
22
|
-
constructor(name: string, definition?: SoftwareSystemDefinition);
|
|
23
|
-
defineContainer(name: string,
|
|
23
|
+
constructor(name: string, definition?: SoftwareSystemDefinition, archetype?: ElementArchetype, overrideDefinition?: TechnologyDefinition);
|
|
24
|
+
defineContainer(name: string, archetypeOrDef?: ElementArchetype | ContainerDefinition, override?: ContainerDefinition): Container;
|
|
24
25
|
addGroup(groupName: string): SoftwareSystemGroup;
|
|
25
26
|
getGroups(): ReadonlyArray<SoftwareSystemGroup>;
|
|
26
27
|
getChildElements(): ReadonlyArray<Element>;
|
|
@@ -4,12 +4,15 @@ export declare class StructurizrDSLWriter {
|
|
|
4
4
|
private readonly model;
|
|
5
5
|
private readonly views;
|
|
6
6
|
constructor(model: Model, views: Views);
|
|
7
|
+
private collectArchetypes;
|
|
8
|
+
private writeArchetypes;
|
|
7
9
|
private writeElement;
|
|
8
10
|
private writeComponent;
|
|
9
11
|
private writeContainerGroup;
|
|
10
12
|
private writeContainer;
|
|
11
13
|
private writeSoftwareSystemGroup;
|
|
12
14
|
private writeSoftwareSystem;
|
|
15
|
+
private writeRelationship;
|
|
13
16
|
private writeRelationships;
|
|
14
17
|
private writeModelGroup;
|
|
15
18
|
private writeModel;
|
package/src/component.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TechnicalElement } from './core';
|
|
2
|
-
export class Component extends TechnicalElement {
|
|
3
|
-
name;
|
|
4
|
-
constructor(name, definition) {
|
|
5
|
-
super(name, ['Component'], definition);
|
|
6
|
-
this.name = name;
|
|
7
|
-
}
|
|
8
|
-
getChildElements() {
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=component.js.map
|
package/src/component.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../libs/c4-model/src/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,gBAAgB,EAAwB,MAAM,QAAQ,CAAA;AAIxE,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IAEd;IAD7B,YAC6B,IAAY,EACrC,UAAgC;QAEhC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,CAAA;QAHb,SAAI,GAAJ,IAAI,CAAQ;IAIzC,CAAC;IAEM,gBAAgB;QACnB,OAAO,EAAE,CAAA;IACb,CAAC;CACJ"}
|
package/src/container.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Group, TechnicalElement } from './core';
|
|
2
|
-
import { Component } from './component';
|
|
3
|
-
// TODO: This will be a Group<Container> if that is added back in
|
|
4
|
-
export class ContainerGroup extends Group {
|
|
5
|
-
name;
|
|
6
|
-
container;
|
|
7
|
-
_components = new Map();
|
|
8
|
-
constructor(name, container) {
|
|
9
|
-
super(name);
|
|
10
|
-
this.name = name;
|
|
11
|
-
this.container = container;
|
|
12
|
-
}
|
|
13
|
-
defineComponent(name, definition) {
|
|
14
|
-
const component = this.container.defineComponent(name, definition);
|
|
15
|
-
this._components.set(name, component);
|
|
16
|
-
return component;
|
|
17
|
-
}
|
|
18
|
-
getComponents() {
|
|
19
|
-
return Array.from(this._components.values());
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export class Container extends TechnicalElement {
|
|
23
|
-
name;
|
|
24
|
-
_components = new Map();
|
|
25
|
-
_groups = new Map();
|
|
26
|
-
constructor(name, definition) {
|
|
27
|
-
super(name, ['Container'], definition);
|
|
28
|
-
this.name = name;
|
|
29
|
-
}
|
|
30
|
-
defineComponent(name, definition) {
|
|
31
|
-
if (this._components.has(name)) {
|
|
32
|
-
throw Error(`A Component named '${name}' is defined elsewhere in this Container. A Component can be defined only once.`);
|
|
33
|
-
}
|
|
34
|
-
const component = new Component(name, definition);
|
|
35
|
-
this._components.set(name, component);
|
|
36
|
-
return component;
|
|
37
|
-
}
|
|
38
|
-
addGroup(groupName) {
|
|
39
|
-
let group = this._groups.get(groupName);
|
|
40
|
-
if (!group) {
|
|
41
|
-
group = new ContainerGroup(groupName, this);
|
|
42
|
-
this._groups.set(groupName, group);
|
|
43
|
-
}
|
|
44
|
-
return group;
|
|
45
|
-
}
|
|
46
|
-
getGroups() {
|
|
47
|
-
return Array.from(this._groups.values());
|
|
48
|
-
}
|
|
49
|
-
getComponentsNotInGroups() {
|
|
50
|
-
const componentsInGroups = this.getGroups().flatMap((group) => group.getComponents());
|
|
51
|
-
return Array.from(this._components.values()).filter((component) => !componentsInGroups.includes(component));
|
|
52
|
-
}
|
|
53
|
-
getChildElements() {
|
|
54
|
-
return Array.from(this._components.values());
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=container.js.map
|
package/src/container.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../../../libs/c4-model/src/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,gBAAgB,EAAwB,MAAM,QAAQ,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAA;AAQ5D,iEAAiE;AACjE,MAAM,OAAO,cAAe,SAAQ,KAAK;IAIR;IACR;IAJb,WAAW,GAAG,IAAI,GAAG,EAAqB,CAAA;IAElD,YAC6B,IAAY,EACpB,SAA0B;QAE3C,KAAK,CAAC,IAAI,CAAC,CAAA;QAHc,SAAI,GAAJ,IAAI,CAAQ;QACpB,cAAS,GAAT,SAAS,CAAiB;IAG/C,CAAC;IAEM,eAAe,CAAC,IAAY,EAAE,UAAgC;QACjE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QAClE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;QACrC,OAAO,SAAS,CAAA;IACpB,CAAC;IAEM,aAAa;QAChB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAA;IAChD,CAAC;CACJ;AAED,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IAKd;IAJrB,WAAW,GAAG,IAAI,GAAG,EAAqB,CAAA;IAC1C,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAA;IAEnD,YAC6B,IAAY,EACrC,UAAgC;QAEhC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,CAAA;QAHb,SAAI,GAAJ,IAAI,CAAQ;IAIzC,CAAC;IAEM,eAAe,CAAC,IAAY,EAAE,UAAgC;QACjE,IAAI,IAAI,CAAC,WAAW,CA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 @@
|
|
|
1
|
-
import { camelCase } from 'change-case';
|
|
2
|
-
export class Element {
|
|
3
|
-
name;
|
|
4
|
-
description;
|
|
5
|
-
tags;
|
|
6
|
-
_relationships = [];
|
|
7
|
-
constructor(name, defaultTags = [], definition) {
|
|
8
|
-
this.name = name;
|
|
9
|
-
this.description = definition?.description;
|
|
10
|
-
this.tags = (definition?.tags ?? []).concat(['Element']).concat(defaultTags);
|
|
11
|
-
}
|
|
12
|
-
get canonicalName() {
|
|
13
|
-
return camelCase(this.name);
|
|
14
|
-
}
|
|
15
|
-
uses(otherElement, definition) {
|
|
16
|
-
const relationship = new Relationship(this, otherElement, definition);
|
|
17
|
-
this._relationships.push(relationship);
|
|
18
|
-
}
|
|
19
|
-
get relationships() {
|
|
20
|
-
return this._relationships;
|
|
21
|
-
}
|
|
22
|
-
getRelationshipsInHierarchy() {
|
|
23
|
-
return this._relationships.concat(this.getChildElements().flatMap((element) => element.getRelationshipsInHierarchy()));
|
|
24
|
-
}
|
|
25
|
-
getChildElementNames(path) {
|
|
26
|
-
const result = Array.from(this.getChildElements()).flatMap((reference) => {
|
|
27
|
-
const currentPath = `${path ? path : '' + this.name}.${reference.name}`;
|
|
28
|
-
return [currentPath, ...reference.getChildElementNames(currentPath)];
|
|
29
|
-
});
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export class TechnicalElement extends Element {
|
|
34
|
-
technology;
|
|
35
|
-
constructor(name, defaultTags = [], definition) {
|
|
36
|
-
super(name, defaultTags, definition);
|
|
37
|
-
this.technology = definition?.technology;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export class Relationship {
|
|
41
|
-
source;
|
|
42
|
-
destination;
|
|
43
|
-
description;
|
|
44
|
-
tags;
|
|
45
|
-
technology;
|
|
46
|
-
constructor(source, destination, definition) {
|
|
47
|
-
this.source = source;
|
|
48
|
-
this.destination = destination;
|
|
49
|
-
this.description = definition?.description;
|
|
50
|
-
this.technology = definition?.technology;
|
|
51
|
-
this.tags = (definition?.tags ?? []).concat(['Relationship']);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
export class Group {
|
|
55
|
-
name;
|
|
56
|
-
constructor(name) {
|
|
57
|
-
this.name = name;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=core.js.map
|
package/src/core.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../libs/c4-model/src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAWvC,MAAM,OAAgB,OAAO;IAOL;IANJ,WAAW,CAAS;IACpB,IAAI,CAAuB;IAEnC,cAAc,GAAmB,EAAE,CAAA;IAE3C,YACoB,IAAY,EAC5B,cAAwB,EAAE,EAC1B,UAAuB;QAFP,SAAI,GAAJ,IAAI,CAAQ;QAI5B,IAAI,CAAC,WAAW,GAAG,UAAU,EAAE,WAAW,CAAA;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IAChF,CAAC;IAED,IAAW,aAAa;QACpB,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;IAEM,IAAI,CAAC,YAAqB,EAAE,UAAiC;QAChE,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;QACrE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IAC1C,CAAC;IAED,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CAAA;IAC9B,CAAC;IAIM,2BAA2B;QAC9B,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,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;CACJ;AAED,MAAM,OAAO,KAAK;IACqB;IAAnC,YAAmC,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;CAItD"}
|
package/src/generateDiagrams.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as os from 'os';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import { GenericContainer, Wait } from 'testcontainers';
|
|
5
|
-
import { buildModelWithCatalog } from './model';
|
|
6
|
-
import { StructurizrDSLWriter } from './structurizrDslWriter';
|
|
7
|
-
export async function generateDiagrams(options) {
|
|
8
|
-
const { views: viewsFactory, outputDir, ...buildOptions } = options;
|
|
9
|
-
// a) Build model + catalog
|
|
10
|
-
const { model, catalog } = await buildModelWithCatalog(buildOptions);
|
|
11
|
-
// b) Build views from catalog via callback
|
|
12
|
-
const views = viewsFactory(catalog);
|
|
13
|
-
// c) Generate DSL string
|
|
14
|
-
const dsl = new StructurizrDSLWriter(model, views).write();
|
|
15
|
-
// d) Write DSL to a temp directory (resolve symlinks so Docker bind mounts work on macOS)
|
|
16
|
-
const tmpDir = await fs.promises.mkdtemp(path.join(fs.realpathSync(os.tmpdir()), 'c4-diagrams-'));
|
|
17
|
-
await fs.promises.writeFile(path.join(tmpDir, 'workspace.dsl'), dsl, 'utf8');
|
|
18
|
-
// e) Run Structurizr CLI container to export .mmd files
|
|
19
|
-
await new GenericContainer('structurizr/structurizr')
|
|
20
|
-
.withBindMounts([{ source: tmpDir, target: '/workspace', mode: 'rw' }])
|
|
21
|
-
.withCommand(['export', '-w', '/workspace/workspace.dsl', '-f', 'mermaid', '-o', '/workspace'])
|
|
22
|
-
.withWaitStrategy(Wait.forOneShotStartup())
|
|
23
|
-
.start();
|
|
24
|
-
// f) Copy .mmd files to outputDir
|
|
25
|
-
await fs.promises.mkdir(outputDir, { recursive: true });
|
|
26
|
-
const tmpFiles = await fs.promises.readdir(tmpDir);
|
|
27
|
-
const mmdFiles = tmpFiles.filter((f) => f.endsWith('.mmd'));
|
|
28
|
-
for (const file of mmdFiles) {
|
|
29
|
-
await fs.promises.copyFile(path.join(tmpDir, file), path.join(outputDir, file));
|
|
30
|
-
}
|
|
31
|
-
const generatedFiles = mmdFiles.map((f) => path.join(outputDir, f));
|
|
32
|
-
// g) For each .mmd file, render to .png via minlag/mermaid-cli container
|
|
33
|
-
for (const file of mmdFiles) {
|
|
34
|
-
const baseName = path.basename(file, '.mmd');
|
|
35
|
-
const pngFile = `${baseName}.png`;
|
|
36
|
-
await new GenericContainer('minlag/mermaid-cli')
|
|
37
|
-
.withBindMounts([{ source: tmpDir, target: '/data', mode: 'rw' }])
|
|
38
|
-
.withCommand(['-i', `/data/${file}`, '-o', `/data/${pngFile}`])
|
|
39
|
-
.withWaitStrategy(Wait.forOneShotStartup())
|
|
40
|
-
.start();
|
|
41
|
-
await fs.promises.copyFile(path.join(tmpDir, pngFile), path.join(outputDir, pngFile));
|
|
42
|
-
generatedFiles.push(path.join(outputDir, pngFile));
|
|
43
|
-
}
|
|
44
|
-
// h) Return all generated file paths
|
|
45
|
-
return generatedFiles;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=generateDiagrams.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateDiagrams.js","sourceRoot":"","sources":["../../../../libs/c4-model/src/generateDiagrams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,EAAqB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAQ7D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAQ,OAAuC;IACjF,MAA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AAC,CAAA;QACrF,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAA;IACtD,CAAC;IAED,qCAAqC;IACrC,OAAO,cAAc,CAAA;AACzB,CAAC"}
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/c4-model/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA"}
|
package/src/model.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { glob } from 'glob';
|
|
2
|
-
import { join, dirname } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
-
import { Group } from './core';
|
|
6
|
-
import { SoftwareSystem } from './softwareSystem';
|
|
7
|
-
import { Person } from './person';
|
|
8
|
-
// TODO: This will be a Group of type <SoftwareSystem | Person> if that is added back in
|
|
9
|
-
export class ModelGroup extends Group {
|
|
10
|
-
name;
|
|
11
|
-
model;
|
|
12
|
-
softwareSystems = new Map();
|
|
13
|
-
people = new Map();
|
|
14
|
-
constructor(name, model) {
|
|
15
|
-
super(name);
|
|
16
|
-
this.name = name;
|
|
17
|
-
this.model = model;
|
|
18
|
-
}
|
|
19
|
-
defineSoftwareSystem(name, definition) {
|
|
20
|
-
const softwareSystem = this.model.defineSoftwareSystem(name, definition);
|
|
21
|
-
this.softwareSystems.set(name, softwareSystem);
|
|
22
|
-
return softwareSystem;
|
|
23
|
-
}
|
|
24
|
-
definePerson(name, definition) {
|
|
25
|
-
const person = this.model.definePerson(name, definition);
|
|
26
|
-
this.people.set(name, person);
|
|
27
|
-
return person;
|
|
28
|
-
}
|
|
29
|
-
getSoftwareSystems() {
|
|
30
|
-
return Array.from(this.softwareSystems.values());
|
|
31
|
-
}
|
|
32
|
-
getPeople() {
|
|
33
|
-
return Array.from(this.people.values());
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export class Model {
|
|
37
|
-
name;
|
|
38
|
-
constructor(name) {
|
|
39
|
-
this.name = name;
|
|
40
|
-
}
|
|
41
|
-
softwareSystems = new Map();
|
|
42
|
-
people = new Map();
|
|
43
|
-
groups = new Map();
|
|
44
|
-
defineSoftwareSystem(name, definition) {
|
|
45
|
-
if (this.softwareSystems.has(name)) {
|
|
46
|
-
throw Error(`A SoftwareSystem named '${name}' is defined elsewhere in this Model. A SoftwareSystem can be defined only once.`);
|
|
47
|
-
}
|
|
48
|
-
const system = new SoftwareSystem(name, definition);
|
|
49
|
-
this.softwareSystems.set(name, system);
|
|
50
|
-
return system;
|
|
51
|
-
}
|
|
52
|
-
// TODO:Should be a Group<SoftwareSystem | Person> if that is added back in
|
|
53
|
-
addGroup(groupName) {
|
|
54
|
-
let group = this.groups.get(groupName);
|
|
55
|
-
if (!group) {
|
|
56
|
-
group = new ModelGroup(groupName, this);
|
|
57
|
-
this.groups.set(groupName, group);
|
|
58
|
-
}
|
|
59
|
-
return group;
|
|
60
|
-
}
|
|
61
|
-
definePerson(name, definition) {
|
|
62
|
-
if (this.people.has(name)) {
|
|
63
|
-
throw Error(`A Person named '${name}' is defined elsewhere in this Model. A Person can be defined only once.`);
|
|
64
|
-
}
|
|
65
|
-
const person = new Person(name, definition);
|
|
66
|
-
this.people.set(name, person);
|
|
67
|
-
return person;
|
|
68
|
-
}
|
|
69
|
-
validate() { }
|
|
70
|
-
getPeople() {
|
|
71
|
-
return Array.from(this.people.values());
|
|
72
|
-
}
|
|
73
|
-
getSoftwareSystems() {
|
|
74
|
-
return Array.from(this.softwareSystems.values());
|
|
75
|
-
}
|
|
76
|
-
getPeopleNotInGroups() {
|
|
77
|
-
const peopleInGroups = Array.from(this.groups.values()).flatMap((group) => group.getPeople());
|
|
78
|
-
return Array.from(this.people.values()).filter((person) => !peopleInGroups.includes(person));
|
|
79
|
-
}
|
|
80
|
-
getSoftwareSystemsNotInGroups() {
|
|
81
|
-
const systemsInGroups = Array.from(this.groups.values()).flatMap((group) => group.getSoftwareSystems());
|
|
82
|
-
return Array.from(this.softwareSystems.values()).filter((system) => !systemsInGroups.includes(system));
|
|
83
|
-
}
|
|
84
|
-
getGroups() {
|
|
85
|
-
return Array.from(this.groups.values());
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
export async function buildModelWithCatalog(options = {}) {
|
|
89
|
-
const { modelName = 'model', globPath = 'c4.dsl.ts', searchRoot = __dirname } = options;
|
|
90
|
-
const model = new Model(modelName);
|
|
91
|
-
const result = await glob(`**/${globPath}`, { cwd: searchRoot });
|
|
92
|
-
if (result.length === 0) {
|
|
93
|
-
throw new Error(`No ${globPath} files found`);
|
|
94
|
-
}
|
|
95
|
-
const modules = await Promise.all(result.map((file) => import(join(searchRoot, file))));
|
|
96
|
-
const registrations = [];
|
|
97
|
-
const rootCatalog = {};
|
|
98
|
-
// Phase 1: each module registers its own definitions; results are nested under the module's key
|
|
99
|
-
for (const module of modules) {
|
|
100
|
-
if (!module.c4Module) {
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
const instance = module.c4Module;
|
|
104
|
-
const local = instance.registerDefinitions(model);
|
|
105
|
-
rootCatalog[instance.key] = local;
|
|
106
|
-
registrations.push({ instance, key: instance.key, local });
|
|
107
|
-
}
|
|
108
|
-
if (registrations.length === 0) {
|
|
109
|
-
throw new Error(`No c4Module exports found in any ${globPath} files`);
|
|
110
|
-
}
|
|
111
|
-
// Phase 2: each module receives its own slice (local) and every other module's slice (dependencies) to build relationships
|
|
112
|
-
for (const { instance, key, local } of registrations) {
|
|
113
|
-
const dependencies = Object.fromEntries(Object.entries(rootCatalog).filter(([k]) => k !== key));
|
|
114
|
-
instance.buildRelationships(local, dependencies);
|
|
115
|
-
}
|
|
116
|
-
return { model, catalog: rootCatalog };
|
|
117
|
-
}
|
|
118
|
-
export async function buildModel(options = {}) {
|
|
119
|
-
return (await buildModelWithCatalog(options)).model;
|
|
120
|
-
}
|
|
121
|
-
//# sourceMappingURL=model.js.map
|
package/src/model.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../libs/c4-model/src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,cAAc,EAA4B,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AAyBnD,wFAAwF;AACxF,MAAM,OAAO,UAAW,SAAQ,KAAK;IAKJ;IACR;IALb,eAAe,GAAG,IAAI,GAAG,EAA0B,CAAA;IACnD,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IAE1C,YAC6B,IAAY,EACpB,KAA0C;QAE3D,KAAK,CAAC,IAAI,CAAC,CAAA;QAHc,SAAI,GAAJ,IAAI,CAAQ;QACpB,UAAK,GAAL,KAAK,CAAqC;IAG/D,CAAC;IAEM,oBAAoB,CAAC,IAAY,EAAE,UAAqC;QAC3E,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QACxE,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,EAA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or(name, definition) {
|
|
5
|
-
super(name, ['Person'], definition);
|
|
6
|
-
this.name = name;
|
|
7
|
-
}
|
|
8
|
-
getChildElements() {
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=person.js.map
|
package/src/person.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"person.js","sourceRoot":"","sources":["../../../../libs/c4-model/src/person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,QAAQ,CAAA;AAI5C,MAAM,OAAO,MAAO,SAAQ,OAAO;IAEF;IAD7B,YAC6B,IAAY,EACrC,UAA6B;QAE7B,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAA;QAHV,SAAI,GAAJ,IAAI,CAAQ;IAIzC,CAAC;IAEM,gBAAgB;QACnB,OAAO,EAAE,CAAA;IACb,CAAC;CACJ"}
|
package/src/softwareSystem.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Element, Group } from './core';
|
|
2
|
-
import { Container } from './container';
|
|
3
|
-
// TODO: This will be a Group<Container> if that is added back in
|
|
4
|
-
export class SoftwareSystemGroup extends Group {
|
|
5
|
-
name;
|
|
6
|
-
softwareSystem;
|
|
7
|
-
_containers = new Map();
|
|
8
|
-
constructor(name, softwareSystem) {
|
|
9
|
-
super(name);
|
|
10
|
-
this.name = name;
|
|
11
|
-
this.softwareSystem = softwareSystem;
|
|
12
|
-
}
|
|
13
|
-
defineContainer(name, definition) {
|
|
14
|
-
const container = this.softwareSystem.defineContainer(name, definition);
|
|
15
|
-
this._containers.set(name, container);
|
|
16
|
-
return container;
|
|
17
|
-
}
|
|
18
|
-
getContainers() {
|
|
19
|
-
return Array.from(this._containers.values());
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export class SoftwareSystem extends Element {
|
|
23
|
-
name;
|
|
24
|
-
_containers = new Map();
|
|
25
|
-
_groups = new Map();
|
|
26
|
-
constructor(name, definition) {
|
|
27
|
-
super(name, ['Software System'], definition);
|
|
28
|
-
this.name = name;
|
|
29
|
-
}
|
|
30
|
-
defineContainer(name, definition) {
|
|
31
|
-
if (this._containers.has(name)) {
|
|
32
|
-
throw Error(`A Container named '${name}' is defined elsewhere in this SoftwareSystem. A Container can be defined only once.`);
|
|
33
|
-
}
|
|
34
|
-
const container = new Container(name, definition);
|
|
35
|
-
this._containers.set(name, container);
|
|
36
|
-
return container;
|
|
37
|
-
}
|
|
38
|
-
addGroup(groupName) {
|
|
39
|
-
let group = this._groups.get(groupName);
|
|
40
|
-
if (!group) {
|
|
41
|
-
group = new SoftwareSystemGroup(groupName, this);
|
|
42
|
-
this._groups.set(groupName, group);
|
|
43
|
-
}
|
|
44
|
-
return group;
|
|
45
|
-
}
|
|
46
|
-
getGroups() {
|
|
47
|
-
return Array.from(this._groups.values());
|
|
48
|
-
}
|
|
49
|
-
getChildElements() {
|
|
50
|
-
return Array.from(this._containers.values());
|
|
51
|
-
}
|
|
52
|
-
getContainersNotInGroups() {
|
|
53
|
-
const containersInGroups = Array.from(this._groups.values()).flatMap((group) => group.getContainers());
|
|
54
|
-
return Array.from(this._containers.values()).filter((container) => !containersInGroups.includes(container));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=softwareSystem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"softwareSystem.js","sourceRoot":"","sources":["../../../../libs/c4-model/src/softwareSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACnD,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAA;AAY5D,iEAAiE;AACjE,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAIb;IACR;IAJb,WAAW,GAAG,IAAI,GAAG,EAAqB,CAAA;IAElD,YAC6B,IAAY,EACpB,cAA+B;QAEhD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