aact 1.0.0 → 2.0.1
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/LICENSE +674 -0
- package/README.md +171 -0
- package/dist/cli/index.d.mts +2 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.mjs +506 -0
- package/dist/index.d.mts +248 -0
- package/dist/index.d.ts +248 -0
- package/dist/index.mjs +91 -0
- package/dist/shared/aact.Dqryafrg.mjs +744 -0
- package/package.json +82 -8
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { UMLElement } from 'plantuml-parser';
|
|
3
|
+
|
|
4
|
+
interface Relation {
|
|
5
|
+
readonly to: Container;
|
|
6
|
+
readonly technology?: string;
|
|
7
|
+
readonly tags?: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Container {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly type?: string;
|
|
14
|
+
readonly tags?: string[];
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly relations: Relation[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Boundary {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly label: string;
|
|
22
|
+
readonly type?: string;
|
|
23
|
+
boundaries: Boundary[];
|
|
24
|
+
readonly containers: Container[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ArchitectureModel {
|
|
28
|
+
readonly boundaries: Boundary[];
|
|
29
|
+
readonly allContainers: Container[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface Section {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly prod_value: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface CouplingRelation {
|
|
38
|
+
from: string;
|
|
39
|
+
to: string;
|
|
40
|
+
}
|
|
41
|
+
interface BoundaryAnalysis {
|
|
42
|
+
name: string;
|
|
43
|
+
label: string;
|
|
44
|
+
cohesion: number;
|
|
45
|
+
coupling: number;
|
|
46
|
+
couplingRelations: CouplingRelation[];
|
|
47
|
+
}
|
|
48
|
+
interface AnalysisReport {
|
|
49
|
+
elementsCount: number;
|
|
50
|
+
syncApiCalls: number;
|
|
51
|
+
asyncApiCalls: number;
|
|
52
|
+
databases: DatabasesInfo;
|
|
53
|
+
boundaries: BoundaryAnalysis[];
|
|
54
|
+
}
|
|
55
|
+
interface AnalyzedArchitecture {
|
|
56
|
+
model: ArchitectureModel;
|
|
57
|
+
report: AnalysisReport;
|
|
58
|
+
}
|
|
59
|
+
interface DatabasesInfo {
|
|
60
|
+
count: number;
|
|
61
|
+
consumes: number;
|
|
62
|
+
}
|
|
63
|
+
declare const analyzeArchitecture: (model: ArchitectureModel) => AnalyzedArchitecture;
|
|
64
|
+
|
|
65
|
+
declare const AactConfigSchema: v.StrictObjectSchema<{
|
|
66
|
+
readonly source: v.StrictObjectSchema<{
|
|
67
|
+
readonly type: v.PicklistSchema<["plantuml", "structurizr"], undefined>;
|
|
68
|
+
readonly path: v.StringSchema<undefined>;
|
|
69
|
+
}, undefined>;
|
|
70
|
+
readonly rules: v.OptionalSchema<v.StrictObjectSchema<{
|
|
71
|
+
readonly acl: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
72
|
+
tag: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
73
|
+
externalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
74
|
+
}, undefined>], undefined>, undefined>;
|
|
75
|
+
readonly acyclic: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
76
|
+
readonly apiGateway: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
77
|
+
aclTag: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
78
|
+
externalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
79
|
+
gatewayPattern: v.OptionalSchema<v.InstanceSchema<RegExpConstructor, undefined>, undefined>;
|
|
80
|
+
}, undefined>], undefined>, undefined>;
|
|
81
|
+
readonly crud: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
82
|
+
repoTags: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
83
|
+
dbType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
84
|
+
}, undefined>], undefined>, undefined>;
|
|
85
|
+
readonly dbPerService: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
86
|
+
dbType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
87
|
+
}, undefined>], undefined>, undefined>;
|
|
88
|
+
readonly cohesion: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
89
|
+
externalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
90
|
+
internalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
91
|
+
}, undefined>], undefined>, undefined>;
|
|
92
|
+
readonly stableDependencies: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
93
|
+
externalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
94
|
+
}, undefined>], undefined>, undefined>;
|
|
95
|
+
}, undefined>, undefined>;
|
|
96
|
+
readonly generate: v.OptionalSchema<v.StrictObjectSchema<{
|
|
97
|
+
readonly kubernetes: v.OptionalSchema<v.StrictObjectSchema<{
|
|
98
|
+
readonly path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
99
|
+
readonly exclude: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
100
|
+
}, undefined>, undefined>;
|
|
101
|
+
readonly boundaryLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
102
|
+
}, undefined>, undefined>;
|
|
103
|
+
}, undefined>;
|
|
104
|
+
type AactConfig = v.InferOutput<typeof AactConfigSchema>;
|
|
105
|
+
declare const defineConfig: (config: AactConfig) => AactConfig;
|
|
106
|
+
|
|
107
|
+
interface KubernetesGenerateOptions {
|
|
108
|
+
defaultPort?: number;
|
|
109
|
+
dbConnectionTemplate?: string;
|
|
110
|
+
}
|
|
111
|
+
interface KubernetesOutput {
|
|
112
|
+
fileName: string;
|
|
113
|
+
content: string;
|
|
114
|
+
}
|
|
115
|
+
declare const generateKubernetes: (model: ArchitectureModel, options?: KubernetesGenerateOptions) => KubernetesOutput[];
|
|
116
|
+
|
|
117
|
+
interface PlantumlFromModelOptions {
|
|
118
|
+
boundaryLabel?: string;
|
|
119
|
+
}
|
|
120
|
+
declare const generatePlantumlFromModel: (model: ArchitectureModel, options?: PlantumlFromModelOptions) => string;
|
|
121
|
+
|
|
122
|
+
interface EnvValue {
|
|
123
|
+
prod?: string;
|
|
124
|
+
default?: string;
|
|
125
|
+
}
|
|
126
|
+
interface DeployConfig {
|
|
127
|
+
name: string;
|
|
128
|
+
fileName?: string;
|
|
129
|
+
readonly environment?: Record<string, EnvValue>;
|
|
130
|
+
sections: Section[];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface LoadDeployConfigsOptions {
|
|
134
|
+
path?: string;
|
|
135
|
+
exclude?: string[];
|
|
136
|
+
}
|
|
137
|
+
declare const loadMicroserviceDeployConfigs: (options?: LoadDeployConfigsOptions) => Promise<DeployConfig[]>;
|
|
138
|
+
|
|
139
|
+
declare const mapFromConfigs: (deployConfigs: DeployConfig[]) => DeployConfig[];
|
|
140
|
+
|
|
141
|
+
declare const loadPlantumlElements: (filePath: string) => Promise<UMLElement[]>;
|
|
142
|
+
|
|
143
|
+
declare const mapContainersFromPlantumlElements: (elements: UMLElement[]) => ArchitectureModel;
|
|
144
|
+
|
|
145
|
+
interface StructurizrWorkspace {
|
|
146
|
+
id?: number;
|
|
147
|
+
name: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
model: StructurizrModel;
|
|
150
|
+
}
|
|
151
|
+
interface StructurizrModel {
|
|
152
|
+
enterprise?: {
|
|
153
|
+
name: string;
|
|
154
|
+
};
|
|
155
|
+
people?: StructurizrPerson[];
|
|
156
|
+
softwareSystems?: StructurizrSoftwareSystem[];
|
|
157
|
+
}
|
|
158
|
+
interface StructurizrPerson {
|
|
159
|
+
id: string;
|
|
160
|
+
name: string;
|
|
161
|
+
description?: string;
|
|
162
|
+
tags?: string;
|
|
163
|
+
relationships?: StructurizrRelationship[];
|
|
164
|
+
}
|
|
165
|
+
interface StructurizrSoftwareSystem {
|
|
166
|
+
id: string;
|
|
167
|
+
name: string;
|
|
168
|
+
description?: string;
|
|
169
|
+
location?: "External" | "Internal" | "Unspecified";
|
|
170
|
+
tags?: string;
|
|
171
|
+
containers?: StructurizrContainer[];
|
|
172
|
+
relationships?: StructurizrRelationship[];
|
|
173
|
+
}
|
|
174
|
+
interface StructurizrContainer {
|
|
175
|
+
id: string;
|
|
176
|
+
name: string;
|
|
177
|
+
description?: string;
|
|
178
|
+
technology?: string;
|
|
179
|
+
tags?: string;
|
|
180
|
+
components?: StructurizrComponent[];
|
|
181
|
+
relationships?: StructurizrRelationship[];
|
|
182
|
+
}
|
|
183
|
+
interface StructurizrComponent {
|
|
184
|
+
id: string;
|
|
185
|
+
name: string;
|
|
186
|
+
description?: string;
|
|
187
|
+
technology?: string;
|
|
188
|
+
tags?: string;
|
|
189
|
+
relationships?: StructurizrRelationship[];
|
|
190
|
+
}
|
|
191
|
+
interface StructurizrRelationship {
|
|
192
|
+
id: string;
|
|
193
|
+
description?: string;
|
|
194
|
+
sourceId: string;
|
|
195
|
+
destinationId: string;
|
|
196
|
+
technology?: string;
|
|
197
|
+
interactionStyle?: "Synchronous" | "Asynchronous";
|
|
198
|
+
tags?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
declare const loadStructurizrWorkspace: (filePath: string) => Promise<StructurizrWorkspace>;
|
|
202
|
+
declare const mapContainersFromStructurizr: (workspace: StructurizrWorkspace) => ArchitectureModel;
|
|
203
|
+
declare const loadStructurizrElements: (filePath: string) => Promise<ArchitectureModel>;
|
|
204
|
+
|
|
205
|
+
interface Violation {
|
|
206
|
+
container: string;
|
|
207
|
+
message: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface AclOptions {
|
|
211
|
+
tag?: string;
|
|
212
|
+
externalType?: string;
|
|
213
|
+
}
|
|
214
|
+
declare const checkAcl: (containers: Container[], options?: AclOptions) => Violation[];
|
|
215
|
+
|
|
216
|
+
declare const checkAcyclic: (containers: Container[]) => Violation[];
|
|
217
|
+
|
|
218
|
+
interface ApiGatewayOptions {
|
|
219
|
+
aclTag?: string;
|
|
220
|
+
externalType?: string;
|
|
221
|
+
gatewayPattern?: RegExp;
|
|
222
|
+
}
|
|
223
|
+
declare const checkApiGateway: (containers: Container[], options?: ApiGatewayOptions) => Violation[];
|
|
224
|
+
|
|
225
|
+
interface CohesionOptions {
|
|
226
|
+
externalType?: string;
|
|
227
|
+
internalType?: string;
|
|
228
|
+
}
|
|
229
|
+
declare const checkCohesion: (model: ArchitectureModel, options?: CohesionOptions) => Violation[];
|
|
230
|
+
|
|
231
|
+
interface CrudOptions {
|
|
232
|
+
repoTags?: string[];
|
|
233
|
+
dbType?: string;
|
|
234
|
+
}
|
|
235
|
+
declare const checkCrud: (containers: Container[], options?: CrudOptions) => Violation[];
|
|
236
|
+
|
|
237
|
+
interface DbPerServiceOptions {
|
|
238
|
+
dbType?: string;
|
|
239
|
+
}
|
|
240
|
+
declare const checkDbPerService: (containers: Container[], options?: DbPerServiceOptions) => Violation[];
|
|
241
|
+
|
|
242
|
+
interface StableDependenciesOptions {
|
|
243
|
+
externalType?: string;
|
|
244
|
+
}
|
|
245
|
+
declare const checkStableDependencies: (containers: Container[], options?: StableDependenciesOptions) => Violation[];
|
|
246
|
+
|
|
247
|
+
export { AactConfigSchema, analyzeArchitecture, checkAcl, checkAcyclic, checkApiGateway, checkCohesion, checkCrud, checkDbPerService, checkStableDependencies, defineConfig, generateKubernetes, generatePlantumlFromModel, loadMicroserviceDeployConfigs, loadPlantumlElements, loadStructurizrElements, loadStructurizrWorkspace, mapContainersFromPlantumlElements, mapContainersFromStructurizr, mapFromConfigs };
|
|
248
|
+
export type { AactConfig, AclOptions, AnalysisReport, AnalyzedArchitecture, ApiGatewayOptions, ArchitectureModel, Boundary, BoundaryAnalysis, CohesionOptions, Container, CouplingRelation, CrudOptions, DbPerServiceOptions, DeployConfig, EnvValue, KubernetesGenerateOptions, KubernetesOutput, LoadDeployConfigsOptions, PlantumlFromModelOptions, Relation, Section, StableDependenciesOptions, StructurizrComponent, StructurizrContainer, StructurizrModel, StructurizrPerson, StructurizrRelationship, StructurizrSoftwareSystem, StructurizrWorkspace, Violation };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { UMLElement } from 'plantuml-parser';
|
|
3
|
+
|
|
4
|
+
interface Relation {
|
|
5
|
+
readonly to: Container;
|
|
6
|
+
readonly technology?: string;
|
|
7
|
+
readonly tags?: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Container {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly type?: string;
|
|
14
|
+
readonly tags?: string[];
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly relations: Relation[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Boundary {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly label: string;
|
|
22
|
+
readonly type?: string;
|
|
23
|
+
boundaries: Boundary[];
|
|
24
|
+
readonly containers: Container[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ArchitectureModel {
|
|
28
|
+
readonly boundaries: Boundary[];
|
|
29
|
+
readonly allContainers: Container[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface Section {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly prod_value: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface CouplingRelation {
|
|
38
|
+
from: string;
|
|
39
|
+
to: string;
|
|
40
|
+
}
|
|
41
|
+
interface BoundaryAnalysis {
|
|
42
|
+
name: string;
|
|
43
|
+
label: string;
|
|
44
|
+
cohesion: number;
|
|
45
|
+
coupling: number;
|
|
46
|
+
couplingRelations: CouplingRelation[];
|
|
47
|
+
}
|
|
48
|
+
interface AnalysisReport {
|
|
49
|
+
elementsCount: number;
|
|
50
|
+
syncApiCalls: number;
|
|
51
|
+
asyncApiCalls: number;
|
|
52
|
+
databases: DatabasesInfo;
|
|
53
|
+
boundaries: BoundaryAnalysis[];
|
|
54
|
+
}
|
|
55
|
+
interface AnalyzedArchitecture {
|
|
56
|
+
model: ArchitectureModel;
|
|
57
|
+
report: AnalysisReport;
|
|
58
|
+
}
|
|
59
|
+
interface DatabasesInfo {
|
|
60
|
+
count: number;
|
|
61
|
+
consumes: number;
|
|
62
|
+
}
|
|
63
|
+
declare const analyzeArchitecture: (model: ArchitectureModel) => AnalyzedArchitecture;
|
|
64
|
+
|
|
65
|
+
declare const AactConfigSchema: v.StrictObjectSchema<{
|
|
66
|
+
readonly source: v.StrictObjectSchema<{
|
|
67
|
+
readonly type: v.PicklistSchema<["plantuml", "structurizr"], undefined>;
|
|
68
|
+
readonly path: v.StringSchema<undefined>;
|
|
69
|
+
}, undefined>;
|
|
70
|
+
readonly rules: v.OptionalSchema<v.StrictObjectSchema<{
|
|
71
|
+
readonly acl: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
72
|
+
tag: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
73
|
+
externalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
74
|
+
}, undefined>], undefined>, undefined>;
|
|
75
|
+
readonly acyclic: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
76
|
+
readonly apiGateway: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
77
|
+
aclTag: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
78
|
+
externalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
79
|
+
gatewayPattern: v.OptionalSchema<v.InstanceSchema<RegExpConstructor, undefined>, undefined>;
|
|
80
|
+
}, undefined>], undefined>, undefined>;
|
|
81
|
+
readonly crud: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
82
|
+
repoTags: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
83
|
+
dbType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
84
|
+
}, undefined>], undefined>, undefined>;
|
|
85
|
+
readonly dbPerService: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
86
|
+
dbType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
87
|
+
}, undefined>], undefined>, undefined>;
|
|
88
|
+
readonly cohesion: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
89
|
+
externalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
90
|
+
internalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
91
|
+
}, undefined>], undefined>, undefined>;
|
|
92
|
+
readonly stableDependencies: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StrictObjectSchema<{
|
|
93
|
+
externalType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
94
|
+
}, undefined>], undefined>, undefined>;
|
|
95
|
+
}, undefined>, undefined>;
|
|
96
|
+
readonly generate: v.OptionalSchema<v.StrictObjectSchema<{
|
|
97
|
+
readonly kubernetes: v.OptionalSchema<v.StrictObjectSchema<{
|
|
98
|
+
readonly path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
99
|
+
readonly exclude: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
100
|
+
}, undefined>, undefined>;
|
|
101
|
+
readonly boundaryLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
102
|
+
}, undefined>, undefined>;
|
|
103
|
+
}, undefined>;
|
|
104
|
+
type AactConfig = v.InferOutput<typeof AactConfigSchema>;
|
|
105
|
+
declare const defineConfig: (config: AactConfig) => AactConfig;
|
|
106
|
+
|
|
107
|
+
interface KubernetesGenerateOptions {
|
|
108
|
+
defaultPort?: number;
|
|
109
|
+
dbConnectionTemplate?: string;
|
|
110
|
+
}
|
|
111
|
+
interface KubernetesOutput {
|
|
112
|
+
fileName: string;
|
|
113
|
+
content: string;
|
|
114
|
+
}
|
|
115
|
+
declare const generateKubernetes: (model: ArchitectureModel, options?: KubernetesGenerateOptions) => KubernetesOutput[];
|
|
116
|
+
|
|
117
|
+
interface PlantumlFromModelOptions {
|
|
118
|
+
boundaryLabel?: string;
|
|
119
|
+
}
|
|
120
|
+
declare const generatePlantumlFromModel: (model: ArchitectureModel, options?: PlantumlFromModelOptions) => string;
|
|
121
|
+
|
|
122
|
+
interface EnvValue {
|
|
123
|
+
prod?: string;
|
|
124
|
+
default?: string;
|
|
125
|
+
}
|
|
126
|
+
interface DeployConfig {
|
|
127
|
+
name: string;
|
|
128
|
+
fileName?: string;
|
|
129
|
+
readonly environment?: Record<string, EnvValue>;
|
|
130
|
+
sections: Section[];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface LoadDeployConfigsOptions {
|
|
134
|
+
path?: string;
|
|
135
|
+
exclude?: string[];
|
|
136
|
+
}
|
|
137
|
+
declare const loadMicroserviceDeployConfigs: (options?: LoadDeployConfigsOptions) => Promise<DeployConfig[]>;
|
|
138
|
+
|
|
139
|
+
declare const mapFromConfigs: (deployConfigs: DeployConfig[]) => DeployConfig[];
|
|
140
|
+
|
|
141
|
+
declare const loadPlantumlElements: (filePath: string) => Promise<UMLElement[]>;
|
|
142
|
+
|
|
143
|
+
declare const mapContainersFromPlantumlElements: (elements: UMLElement[]) => ArchitectureModel;
|
|
144
|
+
|
|
145
|
+
interface StructurizrWorkspace {
|
|
146
|
+
id?: number;
|
|
147
|
+
name: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
model: StructurizrModel;
|
|
150
|
+
}
|
|
151
|
+
interface StructurizrModel {
|
|
152
|
+
enterprise?: {
|
|
153
|
+
name: string;
|
|
154
|
+
};
|
|
155
|
+
people?: StructurizrPerson[];
|
|
156
|
+
softwareSystems?: StructurizrSoftwareSystem[];
|
|
157
|
+
}
|
|
158
|
+
interface StructurizrPerson {
|
|
159
|
+
id: string;
|
|
160
|
+
name: string;
|
|
161
|
+
description?: string;
|
|
162
|
+
tags?: string;
|
|
163
|
+
relationships?: StructurizrRelationship[];
|
|
164
|
+
}
|
|
165
|
+
interface StructurizrSoftwareSystem {
|
|
166
|
+
id: string;
|
|
167
|
+
name: string;
|
|
168
|
+
description?: string;
|
|
169
|
+
location?: "External" | "Internal" | "Unspecified";
|
|
170
|
+
tags?: string;
|
|
171
|
+
containers?: StructurizrContainer[];
|
|
172
|
+
relationships?: StructurizrRelationship[];
|
|
173
|
+
}
|
|
174
|
+
interface StructurizrContainer {
|
|
175
|
+
id: string;
|
|
176
|
+
name: string;
|
|
177
|
+
description?: string;
|
|
178
|
+
technology?: string;
|
|
179
|
+
tags?: string;
|
|
180
|
+
components?: StructurizrComponent[];
|
|
181
|
+
relationships?: StructurizrRelationship[];
|
|
182
|
+
}
|
|
183
|
+
interface StructurizrComponent {
|
|
184
|
+
id: string;
|
|
185
|
+
name: string;
|
|
186
|
+
description?: string;
|
|
187
|
+
technology?: string;
|
|
188
|
+
tags?: string;
|
|
189
|
+
relationships?: StructurizrRelationship[];
|
|
190
|
+
}
|
|
191
|
+
interface StructurizrRelationship {
|
|
192
|
+
id: string;
|
|
193
|
+
description?: string;
|
|
194
|
+
sourceId: string;
|
|
195
|
+
destinationId: string;
|
|
196
|
+
technology?: string;
|
|
197
|
+
interactionStyle?: "Synchronous" | "Asynchronous";
|
|
198
|
+
tags?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
declare const loadStructurizrWorkspace: (filePath: string) => Promise<StructurizrWorkspace>;
|
|
202
|
+
declare const mapContainersFromStructurizr: (workspace: StructurizrWorkspace) => ArchitectureModel;
|
|
203
|
+
declare const loadStructurizrElements: (filePath: string) => Promise<ArchitectureModel>;
|
|
204
|
+
|
|
205
|
+
interface Violation {
|
|
206
|
+
container: string;
|
|
207
|
+
message: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface AclOptions {
|
|
211
|
+
tag?: string;
|
|
212
|
+
externalType?: string;
|
|
213
|
+
}
|
|
214
|
+
declare const checkAcl: (containers: Container[], options?: AclOptions) => Violation[];
|
|
215
|
+
|
|
216
|
+
declare const checkAcyclic: (containers: Container[]) => Violation[];
|
|
217
|
+
|
|
218
|
+
interface ApiGatewayOptions {
|
|
219
|
+
aclTag?: string;
|
|
220
|
+
externalType?: string;
|
|
221
|
+
gatewayPattern?: RegExp;
|
|
222
|
+
}
|
|
223
|
+
declare const checkApiGateway: (containers: Container[], options?: ApiGatewayOptions) => Violation[];
|
|
224
|
+
|
|
225
|
+
interface CohesionOptions {
|
|
226
|
+
externalType?: string;
|
|
227
|
+
internalType?: string;
|
|
228
|
+
}
|
|
229
|
+
declare const checkCohesion: (model: ArchitectureModel, options?: CohesionOptions) => Violation[];
|
|
230
|
+
|
|
231
|
+
interface CrudOptions {
|
|
232
|
+
repoTags?: string[];
|
|
233
|
+
dbType?: string;
|
|
234
|
+
}
|
|
235
|
+
declare const checkCrud: (containers: Container[], options?: CrudOptions) => Violation[];
|
|
236
|
+
|
|
237
|
+
interface DbPerServiceOptions {
|
|
238
|
+
dbType?: string;
|
|
239
|
+
}
|
|
240
|
+
declare const checkDbPerService: (containers: Container[], options?: DbPerServiceOptions) => Violation[];
|
|
241
|
+
|
|
242
|
+
interface StableDependenciesOptions {
|
|
243
|
+
externalType?: string;
|
|
244
|
+
}
|
|
245
|
+
declare const checkStableDependencies: (containers: Container[], options?: StableDependenciesOptions) => Violation[];
|
|
246
|
+
|
|
247
|
+
export { AactConfigSchema, analyzeArchitecture, checkAcl, checkAcyclic, checkApiGateway, checkCohesion, checkCrud, checkDbPerService, checkStableDependencies, defineConfig, generateKubernetes, generatePlantumlFromModel, loadMicroserviceDeployConfigs, loadPlantumlElements, loadStructurizrElements, loadStructurizrWorkspace, mapContainersFromPlantumlElements, mapContainersFromStructurizr, mapFromConfigs };
|
|
248
|
+
export type { AactConfig, AclOptions, AnalysisReport, AnalyzedArchitecture, ApiGatewayOptions, ArchitectureModel, Boundary, BoundaryAnalysis, CohesionOptions, Container, CouplingRelation, CrudOptions, DbPerServiceOptions, DeployConfig, EnvValue, KubernetesGenerateOptions, KubernetesOutput, LoadDeployConfigsOptions, PlantumlFromModelOptions, Relation, Section, StableDependenciesOptions, StructurizrComponent, StructurizrContainer, StructurizrModel, StructurizrPerson, StructurizrRelationship, StructurizrSoftwareSystem, StructurizrWorkspace, Violation };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export { A as AactConfigSchema, a as analyzeArchitecture, c as checkAcl, b as checkAcyclic, d as checkApiGateway, e as checkCohesion, f as checkCrud, g as checkDbPerService, h as checkStableDependencies, i as defineConfig, j as generateKubernetes, k as generatePlantumlFromModel, l as loadPlantumlElements, m as loadStructurizrElements, n as loadStructurizrWorkspace, o as mapContainersFromPlantumlElements, p as mapContainersFromStructurizr } from './shared/aact.Dqryafrg.mjs';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import YAML from 'yaml';
|
|
5
|
+
import 'valibot';
|
|
6
|
+
import 'plantuml-parser';
|
|
7
|
+
|
|
8
|
+
const DEFAULT_DEPLOYS_PATH = path.join("resources/kubernetes", "microservices");
|
|
9
|
+
const DEFAULT_EXCLUDE = ["migrator", "platform", "citest", "tests"];
|
|
10
|
+
const getMicroserviceFilepaths = async (options) => {
|
|
11
|
+
const exclude = options?.exclude ?? DEFAULT_EXCLUDE;
|
|
12
|
+
const resolvedPath = path.resolve(
|
|
13
|
+
process.cwd(),
|
|
14
|
+
options?.path ?? DEFAULT_DEPLOYS_PATH
|
|
15
|
+
);
|
|
16
|
+
const filenames = (await fs.readdir(resolvedPath, "utf8")).filter(
|
|
17
|
+
(filename) => (/* @__PURE__ */ new Set([".yml", ".yaml"])).has(path.extname(filename))
|
|
18
|
+
).filter(
|
|
19
|
+
(filename) => exclude.every((toExclude) => !filename.includes(toExclude))
|
|
20
|
+
);
|
|
21
|
+
return filenames.map((filename) => path.join(resolvedPath, filename));
|
|
22
|
+
};
|
|
23
|
+
const loadMicroserviceDeployConfigs = async (options) => {
|
|
24
|
+
const filepaths = await getMicroserviceFilepaths(options);
|
|
25
|
+
return Promise.all(
|
|
26
|
+
filepaths.map(async (filePath) => {
|
|
27
|
+
const content = await fs.readFile(filePath, "utf8");
|
|
28
|
+
let parsed = YAML.parse(
|
|
29
|
+
content.replaceAll("env:", "environment:")
|
|
30
|
+
);
|
|
31
|
+
if (parsed.microservice) parsed = parsed.microservice;
|
|
32
|
+
parsed.fileName = path.parse(filePath).name;
|
|
33
|
+
return parsed;
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const mapFromConfig = (deployConfig) => {
|
|
39
|
+
const envWhitelist = [
|
|
40
|
+
"BASE_URL",
|
|
41
|
+
"PROTOCOL",
|
|
42
|
+
"_TOPIC",
|
|
43
|
+
"__BaseAddress",
|
|
44
|
+
"__BaseAddress",
|
|
45
|
+
"__Endpoint",
|
|
46
|
+
"__SmtpServer",
|
|
47
|
+
"QueueName"
|
|
48
|
+
];
|
|
49
|
+
const envNamePartsToCleanup = [
|
|
50
|
+
"_BASE_URL",
|
|
51
|
+
"_API",
|
|
52
|
+
"_CLIENT",
|
|
53
|
+
"_PROTOCOL",
|
|
54
|
+
/_KAFKA_(?:[A-Z]+_)+TOPIC/
|
|
55
|
+
];
|
|
56
|
+
const synonymes = /* @__PURE__ */ new Map([]);
|
|
57
|
+
const environment = deployConfig?.environment ?? {};
|
|
58
|
+
const envKeys = Object.keys(environment);
|
|
59
|
+
const filteredEnvKeys = envKeys.filter(
|
|
60
|
+
(envName) => envWhitelist.some(
|
|
61
|
+
(white) => typeof white === "string" ? envName.includes(white) : white.exec(envName) !== null
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
const sections = filteredEnvKeys.map((envName) => {
|
|
65
|
+
const value = environment[envName];
|
|
66
|
+
return {
|
|
67
|
+
prod_value: value?.prod ?? value?.default ?? "",
|
|
68
|
+
name: envNamePartsToCleanup.reduce(
|
|
69
|
+
(acc, partToCleanup) => acc.replace(partToCleanup, ""),
|
|
70
|
+
envName
|
|
71
|
+
)
|
|
72
|
+
};
|
|
73
|
+
}).map((relation) => {
|
|
74
|
+
relation.name = relation.name.toLowerCase();
|
|
75
|
+
for (const entry of synonymes.entries()) {
|
|
76
|
+
if (entry[1].includes(relation.name)) relation.name = entry[0];
|
|
77
|
+
}
|
|
78
|
+
return relation;
|
|
79
|
+
});
|
|
80
|
+
deployConfig.name = (deployConfig.name ?? deployConfig.fileName).replaceAll(
|
|
81
|
+
/[\s\-()]/g,
|
|
82
|
+
"_"
|
|
83
|
+
);
|
|
84
|
+
deployConfig.sections = sections;
|
|
85
|
+
return deployConfig;
|
|
86
|
+
};
|
|
87
|
+
const mapFromConfigs = (deployConfigs) => {
|
|
88
|
+
return deployConfigs.map(mapFromConfig).sort((a, b) => a.name.localeCompare(b.name));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { loadMicroserviceDeployConfigs, mapFromConfigs };
|