@living-architecture/riviere-builder 0.7.11 → 0.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/dist/features/building/domain/builder-facade.d.ts +30 -2
- package/dist/features/building/domain/builder-facade.d.ts.map +1 -1
- package/dist/features/building/domain/builder-facade.js +21 -0
- package/dist/features/building/domain/construction/construction-errors.d.ts +12 -0
- package/dist/features/building/domain/construction/construction-errors.d.ts.map +1 -1
- package/dist/features/building/domain/construction/construction-errors.js +22 -0
- package/dist/features/building/domain/construction/construction-types.d.ts +4 -0
- package/dist/features/building/domain/construction/construction-types.d.ts.map +1 -1
- package/dist/features/building/domain/construction/graph-construction.d.ts +40 -2
- package/dist/features/building/domain/construction/graph-construction.d.ts.map +1 -1
- package/dist/features/building/domain/construction/graph-construction.js +111 -33
- package/dist/features/building/domain/enrichment/upsert-merge.d.ts +6 -0
- package/dist/features/building/domain/enrichment/upsert-merge.d.ts.map +1 -0
- package/dist/features/building/domain/enrichment/upsert-merge.js +200 -0
- package/dist/features/building/domain/index.d.ts +1 -1
- package/dist/features/building/domain/index.d.ts.map +1 -1
- package/dist/features/building/domain/index.js +1 -1
- package/dist/features/building/domain/inspection/graph-inspection.d.ts +2 -1
- package/dist/features/building/domain/inspection/graph-inspection.d.ts.map +1 -1
- package/dist/features/building/domain/inspection/graph-inspection.js +4 -2
- package/dist/features/building/domain/inspection/inspection-types.d.ts +9 -1
- package/dist/features/building/domain/inspection/inspection-types.d.ts.map +1 -1
- package/dist/features/building/domain/linking/graph-linking.d.ts +3 -1
- package/dist/features/building/domain/linking/graph-linking.d.ts.map +1 -1
- package/dist/features/building/domain/linking/graph-linking.js +30 -1
- package/dist/features/building/domain/riviere-builder.d.ts.map +1 -1
- package/dist/features/building/domain/riviere-builder.js +4 -3
- package/package.json +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { APIComponent, CustomComponent, DomainOpComponent, EventComponent, EventHandlerComponent, ExternalLink, Link, RiviereGraph, SourceInfo, UIComponent, UseCaseComponent } from '@living-architecture/riviere-schema';
|
|
2
2
|
import type { ValidationResult } from '@living-architecture/riviere-query';
|
|
3
|
-
import type { APIInput, BuilderOptions, CustomInput, CustomTypeInput, DomainInput, DomainOpInput, EventHandlerInput, EventInput, UIInput, UseCaseInput } from './construction/construction-types';
|
|
3
|
+
import type { APIInput, BuilderOptions, CustomInput, CustomTypeInput, DomainInput, DomainOpInput, EventHandlerInput, EventInput, UpsertOptions, UIInput, UseCaseInput } from './construction/construction-types';
|
|
4
4
|
import type { EnrichmentInput } from './enrichment/enrichment-types';
|
|
5
5
|
import type { NearMatchMismatch, NearMatchOptions, NearMatchQuery, NearMatchResult } from './error-recovery/match-types';
|
|
6
6
|
import type { BuilderStats, BuilderWarning } from './inspection/inspection-types';
|
|
7
7
|
import type { ExternalLinkInput, LinkInput } from './linking/linking-types';
|
|
8
|
-
export type { APIInput, BuilderOptions, BuilderStats, BuilderWarning, CustomInput, CustomTypeInput, DomainInput, DomainOpInput, EnrichmentInput, EventHandlerInput, EventInput, ExternalLinkInput, LinkInput, NearMatchMismatch, NearMatchOptions, NearMatchQuery, NearMatchResult, UIInput, UseCaseInput, };
|
|
8
|
+
export type { APIInput, BuilderOptions, BuilderStats, BuilderWarning, CustomInput, CustomTypeInput, DomainInput, DomainOpInput, EnrichmentInput, EventHandlerInput, EventInput, ExternalLinkInput, LinkInput, NearMatchMismatch, NearMatchOptions, NearMatchQuery, NearMatchResult, UpsertOptions, UIInput, UseCaseInput, };
|
|
9
9
|
/**
|
|
10
10
|
* Programmatically construct Riviere architecture graphs.
|
|
11
11
|
*
|
|
@@ -53,6 +53,10 @@ export declare class RiviereBuilder {
|
|
|
53
53
|
* @returns The created UI component
|
|
54
54
|
*/
|
|
55
55
|
addUI(input: UIInput): UIComponent;
|
|
56
|
+
upsertUI(input: UIInput, options?: UpsertOptions): {
|
|
57
|
+
component: UIComponent;
|
|
58
|
+
created: boolean;
|
|
59
|
+
};
|
|
56
60
|
/**
|
|
57
61
|
* Adds an API component to the graph.
|
|
58
62
|
*
|
|
@@ -60,6 +64,10 @@ export declare class RiviereBuilder {
|
|
|
60
64
|
* @returns The created API component
|
|
61
65
|
*/
|
|
62
66
|
addApi(input: APIInput): APIComponent;
|
|
67
|
+
upsertApi(input: APIInput, options?: UpsertOptions): {
|
|
68
|
+
component: APIComponent;
|
|
69
|
+
created: boolean;
|
|
70
|
+
};
|
|
63
71
|
/**
|
|
64
72
|
* Adds a UseCase component to the graph.
|
|
65
73
|
*
|
|
@@ -67,6 +75,10 @@ export declare class RiviereBuilder {
|
|
|
67
75
|
* @returns The created UseCase component
|
|
68
76
|
*/
|
|
69
77
|
addUseCase(input: UseCaseInput): UseCaseComponent;
|
|
78
|
+
upsertUseCase(input: UseCaseInput, options?: UpsertOptions): {
|
|
79
|
+
component: UseCaseComponent;
|
|
80
|
+
created: boolean;
|
|
81
|
+
};
|
|
70
82
|
/**
|
|
71
83
|
* Adds a DomainOp component to the graph.
|
|
72
84
|
*
|
|
@@ -74,6 +86,10 @@ export declare class RiviereBuilder {
|
|
|
74
86
|
* @returns The created DomainOp component
|
|
75
87
|
*/
|
|
76
88
|
addDomainOp(input: DomainOpInput): DomainOpComponent;
|
|
89
|
+
upsertDomainOp(input: DomainOpInput, options?: UpsertOptions): {
|
|
90
|
+
component: DomainOpComponent;
|
|
91
|
+
created: boolean;
|
|
92
|
+
};
|
|
77
93
|
/**
|
|
78
94
|
* Adds an Event component to the graph.
|
|
79
95
|
*
|
|
@@ -81,6 +97,10 @@ export declare class RiviereBuilder {
|
|
|
81
97
|
* @returns The created Event component
|
|
82
98
|
*/
|
|
83
99
|
addEvent(input: EventInput): EventComponent;
|
|
100
|
+
upsertEvent(input: EventInput, options?: UpsertOptions): {
|
|
101
|
+
component: EventComponent;
|
|
102
|
+
created: boolean;
|
|
103
|
+
};
|
|
84
104
|
/**
|
|
85
105
|
* Adds an EventHandler component to the graph.
|
|
86
106
|
*
|
|
@@ -88,6 +108,10 @@ export declare class RiviereBuilder {
|
|
|
88
108
|
* @returns The created EventHandler component
|
|
89
109
|
*/
|
|
90
110
|
addEventHandler(input: EventHandlerInput): EventHandlerComponent;
|
|
111
|
+
upsertEventHandler(input: EventHandlerInput, options?: UpsertOptions): {
|
|
112
|
+
component: EventHandlerComponent;
|
|
113
|
+
created: boolean;
|
|
114
|
+
};
|
|
91
115
|
/**
|
|
92
116
|
* Defines a custom component type for the graph.
|
|
93
117
|
*
|
|
@@ -101,6 +125,10 @@ export declare class RiviereBuilder {
|
|
|
101
125
|
* @returns The created Custom component
|
|
102
126
|
*/
|
|
103
127
|
addCustom(input: CustomInput): CustomComponent;
|
|
128
|
+
upsertCustom(input: CustomInput, options?: UpsertOptions): {
|
|
129
|
+
component: CustomComponent;
|
|
130
|
+
created: boolean;
|
|
131
|
+
};
|
|
104
132
|
/**
|
|
105
133
|
* Enriches a DomainOp component with additional domain details.
|
|
106
134
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder-facade.d.ts","sourceRoot":"","sources":["../../../../src/features/building/domain/builder-facade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,gBAAgB,EACjB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAE1E,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,YAAY,EACb,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe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,KAAK,EAAE,iBAAiB,GAAG,qBAAqB;IAIhE;;;;OAIG;IACH,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAI9C;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,eAAe;IAI9C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,GAAG,IAAI;IAI9D;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,eAAe,EAAE;IAIjF;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAI5B;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY;IAIpD;;;;OAIG;IACH,QAAQ,IAAI,cAAc,EAAE;IAI5B;;;;OAIG;IACH,KAAK,IAAI,YAAY;IAIrB;;;;OAIG;IACH,QAAQ,IAAI,gBAAgB;IAI5B;;;;OAIG;IACH,OAAO,IAAI,MAAM,EAAE;IAInB;;;;OAIG;IACH,KAAK,IAAI,OAAO,oCAAoC,EAAE,YAAY;IAIlE;;;;OAIG;IACH,SAAS,IAAI,MAAM;IAInB;;;;OAIG;IACH,KAAK,IAAI,YAAY;CAGtB"}
|
|
1
|
+
{"version":3,"file":"builder-facade.d.ts","sourceRoot":"","sources":["../../../../src/features/building/domain/builder-facade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,gBAAgB,EACjB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAE1E,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa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AAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB;QACD,SAAS,EAAE,eAAe,CAAA;QAC1B,OAAO,EAAE,OAAO,CAAA;KACjB;IAID;;;;;OAKG;IACH,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,GAAG,IAAI;IAI9D;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,eAAe,EAAE;IAIjF;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAI5B;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY;IAIpD;;;;OAIG;IACH,QAAQ,IAAI,cAAc,EAAE;IAI5B;;;;OAIG;IACH,KAAK,IAAI,YAAY;IAIrB;;;;OAIG;IACH,QAAQ,IAAI,gBAAgB;IAI5B;;;;OAIG;IACH,OAAO,IAAI,MAAM,EAAE;IAInB;;;;OAIG;IACH,KAAK,IAAI,OAAO,oCAAoC,EAAE,YAAY;IAIlE;;;;OAIG;IACH,SAAS,IAAI,MAAM;IAInB;;;;OAIG;IACH,KAAK,IAAI,YAAY;CAGtB"}
|
|
@@ -59,6 +59,9 @@ export class RiviereBuilder {
|
|
|
59
59
|
addUI(input) {
|
|
60
60
|
return this.delegate.construction.addUI(input);
|
|
61
61
|
}
|
|
62
|
+
upsertUI(input, options) {
|
|
63
|
+
return this.delegate.construction.upsertUI(input, options);
|
|
64
|
+
}
|
|
62
65
|
/**
|
|
63
66
|
* Adds an API component to the graph.
|
|
64
67
|
*
|
|
@@ -68,6 +71,9 @@ export class RiviereBuilder {
|
|
|
68
71
|
addApi(input) {
|
|
69
72
|
return this.delegate.construction.addApi(input);
|
|
70
73
|
}
|
|
74
|
+
upsertApi(input, options) {
|
|
75
|
+
return this.delegate.construction.upsertApi(input, options);
|
|
76
|
+
}
|
|
71
77
|
/**
|
|
72
78
|
* Adds a UseCase component to the graph.
|
|
73
79
|
*
|
|
@@ -77,6 +83,9 @@ export class RiviereBuilder {
|
|
|
77
83
|
addUseCase(input) {
|
|
78
84
|
return this.delegate.construction.addUseCase(input);
|
|
79
85
|
}
|
|
86
|
+
upsertUseCase(input, options) {
|
|
87
|
+
return this.delegate.construction.upsertUseCase(input, options);
|
|
88
|
+
}
|
|
80
89
|
/**
|
|
81
90
|
* Adds a DomainOp component to the graph.
|
|
82
91
|
*
|
|
@@ -86,6 +95,9 @@ export class RiviereBuilder {
|
|
|
86
95
|
addDomainOp(input) {
|
|
87
96
|
return this.delegate.construction.addDomainOp(input);
|
|
88
97
|
}
|
|
98
|
+
upsertDomainOp(input, options) {
|
|
99
|
+
return this.delegate.construction.upsertDomainOp(input, options);
|
|
100
|
+
}
|
|
89
101
|
/**
|
|
90
102
|
* Adds an Event component to the graph.
|
|
91
103
|
*
|
|
@@ -95,6 +107,9 @@ export class RiviereBuilder {
|
|
|
95
107
|
addEvent(input) {
|
|
96
108
|
return this.delegate.construction.addEvent(input);
|
|
97
109
|
}
|
|
110
|
+
upsertEvent(input, options) {
|
|
111
|
+
return this.delegate.construction.upsertEvent(input, options);
|
|
112
|
+
}
|
|
98
113
|
/**
|
|
99
114
|
* Adds an EventHandler component to the graph.
|
|
100
115
|
*
|
|
@@ -104,6 +119,9 @@ export class RiviereBuilder {
|
|
|
104
119
|
addEventHandler(input) {
|
|
105
120
|
return this.delegate.construction.addEventHandler(input);
|
|
106
121
|
}
|
|
122
|
+
upsertEventHandler(input, options) {
|
|
123
|
+
return this.delegate.construction.upsertEventHandler(input, options);
|
|
124
|
+
}
|
|
107
125
|
/**
|
|
108
126
|
* Defines a custom component type for the graph.
|
|
109
127
|
*
|
|
@@ -121,6 +139,9 @@ export class RiviereBuilder {
|
|
|
121
139
|
addCustom(input) {
|
|
122
140
|
return this.delegate.construction.addCustom(input);
|
|
123
141
|
}
|
|
142
|
+
upsertCustom(input, options) {
|
|
143
|
+
return this.delegate.construction.upsertCustom(input, options);
|
|
144
|
+
}
|
|
124
145
|
/**
|
|
125
146
|
* Enriches a DomainOp component with additional domain details.
|
|
126
147
|
*
|
|
@@ -4,6 +4,11 @@ export declare class DuplicateDomainError extends Error {
|
|
|
4
4
|
constructor(domainName: string);
|
|
5
5
|
}
|
|
6
6
|
/** @riviere-role domain-error */
|
|
7
|
+
export declare class SourceConflictError extends Error {
|
|
8
|
+
readonly repository: string;
|
|
9
|
+
constructor(repository: string);
|
|
10
|
+
}
|
|
11
|
+
/** @riviere-role domain-error */
|
|
7
12
|
export declare class DomainNotFoundError extends Error {
|
|
8
13
|
readonly domainName: string;
|
|
9
14
|
constructor(domainName: string);
|
|
@@ -20,6 +25,13 @@ export declare class DuplicateComponentError extends Error {
|
|
|
20
25
|
constructor(componentId: string);
|
|
21
26
|
}
|
|
22
27
|
/** @riviere-role domain-error */
|
|
28
|
+
export declare class ComponentTypeMismatchError extends Error {
|
|
29
|
+
readonly componentId: string;
|
|
30
|
+
readonly existingType: string;
|
|
31
|
+
readonly incomingType: string;
|
|
32
|
+
constructor(componentId: string, existingType: string, incomingType: string);
|
|
33
|
+
}
|
|
34
|
+
/** @riviere-role domain-error */
|
|
23
35
|
export declare class ComponentNotFoundError extends Error {
|
|
24
36
|
readonly componentId: string;
|
|
25
37
|
readonly suggestions: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construction-errors.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/construction/construction-errors.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;gBAEf,UAAU,EAAE,MAAM;CAK/B;AAED,iCAAiC;AACjC,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;gBAEf,UAAU,EAAE,MAAM;CAK/B;AAED,iCAAiC;AACjC,qBAAa,uBAAwB,SAAQ,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,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;gBAEb,QAAQ,EAAE,MAAM;CAK7B;AAED,iCAAiC;AACjC,qBAAa,8BAA+B,SAAQ,KAAK;IACvD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAA;gBAElB,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE;CAM1D;AAED,iCAAiC;AACjC,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,MAAM,EAAE,MAAM;CAI3B;AAED,iCAAiC;AACjC,qBAAa,mBAAoB,SAAQ,KAAK;;CAK7C;AAED,iCAAiC;AACjC,qBAAa,mBAAoB,SAAQ,KAAK;;CAK7C;AAED,iCAAiC;AACjC,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAA;gBAEzB,QAAQ,EAAE,MAAM,EAAE;CAK/B"}
|
|
@@ -8,6 +8,15 @@ export class DuplicateDomainError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
/** @riviere-role domain-error */
|
|
11
|
+
export class SourceConflictError extends Error {
|
|
12
|
+
repository;
|
|
13
|
+
constructor(repository) {
|
|
14
|
+
super(`Source '${repository}' already exists with different values`);
|
|
15
|
+
this.name = 'SourceConflictError';
|
|
16
|
+
this.repository = repository;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** @riviere-role domain-error */
|
|
11
20
|
export class DomainNotFoundError extends Error {
|
|
12
21
|
domainName;
|
|
13
22
|
constructor(domainName) {
|
|
@@ -40,6 +49,19 @@ export class DuplicateComponentError extends Error {
|
|
|
40
49
|
}
|
|
41
50
|
}
|
|
42
51
|
/** @riviere-role domain-error */
|
|
52
|
+
export class ComponentTypeMismatchError extends Error {
|
|
53
|
+
componentId;
|
|
54
|
+
existingType;
|
|
55
|
+
incomingType;
|
|
56
|
+
constructor(componentId, existingType, incomingType) {
|
|
57
|
+
super(`Component '${componentId}' already exists as type '${existingType}'; cannot upsert as '${incomingType}'`);
|
|
58
|
+
this.name = 'ComponentTypeMismatchError';
|
|
59
|
+
this.componentId = componentId;
|
|
60
|
+
this.existingType = existingType;
|
|
61
|
+
this.incomingType = incomingType;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** @riviere-role domain-error */
|
|
43
65
|
export class ComponentNotFoundError extends Error {
|
|
44
66
|
componentId;
|
|
45
67
|
suggestions;
|
|
@@ -13,6 +13,10 @@ export interface DomainInput {
|
|
|
13
13
|
systemType: SystemType;
|
|
14
14
|
}
|
|
15
15
|
/** @riviere-role value-object */
|
|
16
|
+
export interface UpsertOptions {
|
|
17
|
+
noOverwrite?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** @riviere-role value-object */
|
|
16
20
|
export interface UIInput {
|
|
17
21
|
name: string;
|
|
18
22
|
domain: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construction-types.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/construction/construction-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,wBAAwB,EACxB,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,eAAe,EACf,UAAU,EACX,MAAM,qCAAqC,CAAA;AAE5C,iCAAiC;AACjC,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CACxC;AAED,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,UAAU,CAAA;C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Z,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC"}
|
|
1
|
+
{"version":3,"file":"construction-types.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/construction/construction-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,wBAAwB,EACxB,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,eAAe,EACf,UAAU,EACX,MAAM,qCAAqC,CAAA;AAE5C,iCAAiC;AACjC,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CACxC;AAED,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,iCAAiC;AACjC,MAAM,WAAW,aAAa;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAC;AAEtD,iCAAiC;AACjC,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,iCAAiC;AACjC,MAAM,WAAW,QAAQ;IACvB,IAAI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,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,iCAAiC;AACjC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,iCAAiC;AACjC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAA;IAC7D,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAA;CAC9D;AAED,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC"}
|
|
@@ -1,20 +1,58 @@
|
|
|
1
1
|
import type { APIComponent, CustomComponent, DomainOpComponent, EventComponent, EventHandlerComponent, SourceInfo, UIComponent, UseCaseComponent } from '@living-architecture/riviere-schema';
|
|
2
2
|
import type { BuilderGraph } from '../builder-graph';
|
|
3
|
-
import type { APIInput, CustomInput, CustomTypeInput, DomainInput, DomainOpInput, EventHandlerInput, EventInput, UIInput, UseCaseInput } from './construction-types';
|
|
3
|
+
import type { APIInput, CustomInput, CustomTypeInput, DomainInput, DomainOpInput, EventHandlerInput, EventInput, UpsertOptions, UIInput, UseCaseInput } from './construction-types';
|
|
4
|
+
import type { BuilderWarning } from '../inspection/inspection-types';
|
|
4
5
|
/** @riviere-role domain-service */
|
|
5
6
|
export declare class GraphConstruction {
|
|
6
7
|
private readonly graph;
|
|
7
|
-
|
|
8
|
+
private readonly operationWarnings;
|
|
9
|
+
constructor(graph: BuilderGraph, operationWarnings: BuilderWarning[]);
|
|
8
10
|
addSource(source: SourceInfo): void;
|
|
9
11
|
addDomain(input: DomainInput): void;
|
|
10
12
|
addUI(input: UIInput): UIComponent;
|
|
13
|
+
upsertUI(input: UIInput, options?: UpsertOptions): {
|
|
14
|
+
component: UIComponent;
|
|
15
|
+
created: boolean;
|
|
16
|
+
};
|
|
11
17
|
addApi(input: APIInput): APIComponent;
|
|
18
|
+
upsertApi(input: APIInput, options?: UpsertOptions): {
|
|
19
|
+
component: APIComponent;
|
|
20
|
+
created: boolean;
|
|
21
|
+
};
|
|
12
22
|
addUseCase(input: UseCaseInput): UseCaseComponent;
|
|
23
|
+
upsertUseCase(input: UseCaseInput, options?: UpsertOptions): {
|
|
24
|
+
component: UseCaseComponent;
|
|
25
|
+
created: boolean;
|
|
26
|
+
};
|
|
13
27
|
addDomainOp(input: DomainOpInput): DomainOpComponent;
|
|
28
|
+
upsertDomainOp(input: DomainOpInput, options?: UpsertOptions): {
|
|
29
|
+
component: DomainOpComponent;
|
|
30
|
+
created: boolean;
|
|
31
|
+
};
|
|
14
32
|
addEvent(input: EventInput): EventComponent;
|
|
33
|
+
upsertEvent(input: EventInput, options?: UpsertOptions): {
|
|
34
|
+
component: EventComponent;
|
|
35
|
+
created: boolean;
|
|
36
|
+
};
|
|
15
37
|
addEventHandler(input: EventHandlerInput): EventHandlerComponent;
|
|
38
|
+
upsertEventHandler(input: EventHandlerInput, options?: UpsertOptions): {
|
|
39
|
+
component: EventHandlerComponent;
|
|
40
|
+
created: boolean;
|
|
41
|
+
};
|
|
16
42
|
defineCustomType(input: CustomTypeInput): void;
|
|
17
43
|
addCustom(input: CustomInput): CustomComponent;
|
|
44
|
+
upsertCustom(input: CustomInput, options?: UpsertOptions): {
|
|
45
|
+
component: CustomComponent;
|
|
46
|
+
created: boolean;
|
|
47
|
+
};
|
|
48
|
+
private buildUIComponent;
|
|
49
|
+
private buildAPIComponent;
|
|
50
|
+
private buildUseCaseComponent;
|
|
51
|
+
private buildDomainOpComponent;
|
|
52
|
+
private buildEventComponent;
|
|
53
|
+
private buildEventHandlerComponent;
|
|
54
|
+
private buildCustomComponent;
|
|
18
55
|
private registerComponent;
|
|
56
|
+
private upsertTypedComponent;
|
|
19
57
|
}
|
|
20
58
|
//# sourceMappingURL=graph-construction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-construction.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/construction/graph-construction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAEZ,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,gBAAgB,EACjB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,YAAY,EACb,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"graph-construction.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/construction/graph-construction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAEZ,eAAe,EACf,iBAA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,EAAE,aAAa,GAAG,iBAAiB;IAIpD,cAAc,CACZ,KAAK,EAAE,aAAa,EACpB,OAAO,CAAC,EAAE,aAAa,GACtB;QACD,SAAS,EAAE,iBAAiB,CAAA;QAC5B,OAAO,EAAE,OAAO,CAAA;KACjB;IAID,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc;IAI3C,WAAW,CACT,KAAK,EAAE,UAAU,EACjB,OAAO,CAAC,EAAE,aAAa,GACtB;QACD,SAAS,EAAE,cAAc,CAAA;QACzB,OAAO,EAAE,OAAO,CAAA;KACjB;IAID,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,qBAAqB;IAIhE,kBAAkB,CAChB,KAAK,EAAE,iBAAiB,EACxB,OAAO,CAAC,EAAE,aAAa,GACtB;QACD,SAAS,EAAE,qBAAqB,CAAA;QAChC,OAAO,EAAE,OAAO,CAAA;KACjB;IAID,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAc9C,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,eAAe;IAI9C,YAAY,CACV,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB;QACD,SAAS,EAAE,eAAe,CAAA;QAC1B,OAAO,EAAE,OAAO,CAAA;KACjB;IAID,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,0BAA0B;IAgBlC,OAAO,CAAC,oBAAoB;IAyB5B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,oBAAoB;CAiC7B"}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
import { CustomTypeAlreadyDefinedError, DuplicateComponentError, DuplicateDomainError, } from './construction-errors';
|
|
1
|
+
import { ComponentTypeMismatchError, CustomTypeAlreadyDefinedError, DuplicateComponentError, DuplicateDomainError, SourceConflictError, } from './construction-errors';
|
|
2
2
|
import { generateComponentId, validateCustomType, validateDomainExists, validateRequiredProperties, } from './builder-internals';
|
|
3
|
+
import { mergeComponentForUpsert } from '../enrichment/upsert-merge';
|
|
3
4
|
/** @riviere-role domain-service */
|
|
4
5
|
export class GraphConstruction {
|
|
5
6
|
graph;
|
|
6
|
-
|
|
7
|
+
operationWarnings;
|
|
8
|
+
constructor(graph, operationWarnings) {
|
|
7
9
|
this.graph = graph;
|
|
10
|
+
this.operationWarnings = operationWarnings;
|
|
8
11
|
}
|
|
9
12
|
addSource(source) {
|
|
13
|
+
const existing = this.graph.metadata.sources.find((item) => item.repository === source.repository);
|
|
14
|
+
if (existing) {
|
|
15
|
+
if (areSourcesEqual(existing, source)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
throw new SourceConflictError(source.repository);
|
|
19
|
+
}
|
|
10
20
|
this.graph.metadata.sources.push(source);
|
|
11
21
|
}
|
|
12
22
|
addDomain(input) {
|
|
13
|
-
|
|
23
|
+
const existing = this.graph.metadata.domains[input.name];
|
|
24
|
+
if (existing) {
|
|
25
|
+
if (existing.description === input.description && existing.systemType === input.systemType) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
14
28
|
throw new DuplicateDomainError(input.name);
|
|
15
29
|
}
|
|
16
30
|
this.graph.metadata.domains[input.name] = {
|
|
@@ -19,9 +33,62 @@ export class GraphConstruction {
|
|
|
19
33
|
};
|
|
20
34
|
}
|
|
21
35
|
addUI(input) {
|
|
36
|
+
return this.registerComponent(this.buildUIComponent(input));
|
|
37
|
+
}
|
|
38
|
+
upsertUI(input, options) {
|
|
39
|
+
return this.upsertTypedComponent(this.buildUIComponent(input), options);
|
|
40
|
+
}
|
|
41
|
+
addApi(input) {
|
|
42
|
+
return this.registerComponent(this.buildAPIComponent(input));
|
|
43
|
+
}
|
|
44
|
+
upsertApi(input, options) {
|
|
45
|
+
return this.upsertTypedComponent(this.buildAPIComponent(input), options);
|
|
46
|
+
}
|
|
47
|
+
addUseCase(input) {
|
|
48
|
+
return this.registerComponent(this.buildUseCaseComponent(input));
|
|
49
|
+
}
|
|
50
|
+
upsertUseCase(input, options) {
|
|
51
|
+
return this.upsertTypedComponent(this.buildUseCaseComponent(input), options);
|
|
52
|
+
}
|
|
53
|
+
addDomainOp(input) {
|
|
54
|
+
return this.registerComponent(this.buildDomainOpComponent(input));
|
|
55
|
+
}
|
|
56
|
+
upsertDomainOp(input, options) {
|
|
57
|
+
return this.upsertTypedComponent(this.buildDomainOpComponent(input), options);
|
|
58
|
+
}
|
|
59
|
+
addEvent(input) {
|
|
60
|
+
return this.registerComponent(this.buildEventComponent(input));
|
|
61
|
+
}
|
|
62
|
+
upsertEvent(input, options) {
|
|
63
|
+
return this.upsertTypedComponent(this.buildEventComponent(input), options);
|
|
64
|
+
}
|
|
65
|
+
addEventHandler(input) {
|
|
66
|
+
return this.registerComponent(this.buildEventHandlerComponent(input));
|
|
67
|
+
}
|
|
68
|
+
upsertEventHandler(input, options) {
|
|
69
|
+
return this.upsertTypedComponent(this.buildEventHandlerComponent(input), options);
|
|
70
|
+
}
|
|
71
|
+
defineCustomType(input) {
|
|
72
|
+
const customTypes = this.graph.metadata.customTypes;
|
|
73
|
+
if (customTypes[input.name]) {
|
|
74
|
+
throw new CustomTypeAlreadyDefinedError(input.name);
|
|
75
|
+
}
|
|
76
|
+
customTypes[input.name] = {
|
|
77
|
+
...(input.requiredProperties !== undefined && { requiredProperties: input.requiredProperties, }),
|
|
78
|
+
...(input.optionalProperties !== undefined && { optionalProperties: input.optionalProperties, }),
|
|
79
|
+
...(input.description !== undefined && { description: input.description }),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
addCustom(input) {
|
|
83
|
+
return this.registerComponent(this.buildCustomComponent(input));
|
|
84
|
+
}
|
|
85
|
+
upsertCustom(input, options) {
|
|
86
|
+
return this.upsertTypedComponent(this.buildCustomComponent(input), options);
|
|
87
|
+
}
|
|
88
|
+
buildUIComponent(input) {
|
|
22
89
|
validateDomainExists(this.graph.metadata.domains, input.domain);
|
|
23
90
|
const id = generateComponentId(input.domain, input.module, 'ui', input.name);
|
|
24
|
-
|
|
91
|
+
return {
|
|
25
92
|
id,
|
|
26
93
|
type: 'UI',
|
|
27
94
|
name: input.name,
|
|
@@ -31,12 +98,11 @@ export class GraphConstruction {
|
|
|
31
98
|
sourceLocation: input.sourceLocation,
|
|
32
99
|
...(input.description !== undefined && { description: input.description }),
|
|
33
100
|
};
|
|
34
|
-
return this.registerComponent(component);
|
|
35
101
|
}
|
|
36
|
-
|
|
102
|
+
buildAPIComponent(input) {
|
|
37
103
|
validateDomainExists(this.graph.metadata.domains, input.domain);
|
|
38
104
|
const id = generateComponentId(input.domain, input.module, 'api', input.name);
|
|
39
|
-
|
|
105
|
+
return {
|
|
40
106
|
id,
|
|
41
107
|
type: 'API',
|
|
42
108
|
name: input.name,
|
|
@@ -49,12 +115,11 @@ export class GraphConstruction {
|
|
|
49
115
|
...(input.operationName !== undefined && { operationName: input.operationName }),
|
|
50
116
|
...(input.description !== undefined && { description: input.description }),
|
|
51
117
|
};
|
|
52
|
-
return this.registerComponent(component);
|
|
53
118
|
}
|
|
54
|
-
|
|
119
|
+
buildUseCaseComponent(input) {
|
|
55
120
|
validateDomainExists(this.graph.metadata.domains, input.domain);
|
|
56
121
|
const id = generateComponentId(input.domain, input.module, 'usecase', input.name);
|
|
57
|
-
|
|
122
|
+
return {
|
|
58
123
|
id,
|
|
59
124
|
type: 'UseCase',
|
|
60
125
|
name: input.name,
|
|
@@ -63,12 +128,11 @@ export class GraphConstruction {
|
|
|
63
128
|
sourceLocation: input.sourceLocation,
|
|
64
129
|
...(input.description !== undefined && { description: input.description }),
|
|
65
130
|
};
|
|
66
|
-
return this.registerComponent(component);
|
|
67
131
|
}
|
|
68
|
-
|
|
132
|
+
buildDomainOpComponent(input) {
|
|
69
133
|
validateDomainExists(this.graph.metadata.domains, input.domain);
|
|
70
134
|
const id = generateComponentId(input.domain, input.module, 'domainop', input.name);
|
|
71
|
-
|
|
135
|
+
return {
|
|
72
136
|
id,
|
|
73
137
|
type: 'DomainOp',
|
|
74
138
|
name: input.name,
|
|
@@ -83,12 +147,11 @@ export class GraphConstruction {
|
|
|
83
147
|
...(input.businessRules !== undefined && { businessRules: input.businessRules }),
|
|
84
148
|
...(input.description !== undefined && { description: input.description }),
|
|
85
149
|
};
|
|
86
|
-
return this.registerComponent(component);
|
|
87
150
|
}
|
|
88
|
-
|
|
151
|
+
buildEventComponent(input) {
|
|
89
152
|
validateDomainExists(this.graph.metadata.domains, input.domain);
|
|
90
153
|
const id = generateComponentId(input.domain, input.module, 'event', input.name);
|
|
91
|
-
|
|
154
|
+
return {
|
|
92
155
|
id,
|
|
93
156
|
type: 'Event',
|
|
94
157
|
name: input.name,
|
|
@@ -99,12 +162,11 @@ export class GraphConstruction {
|
|
|
99
162
|
...(input.eventSchema !== undefined && { eventSchema: input.eventSchema }),
|
|
100
163
|
...(input.description !== undefined && { description: input.description }),
|
|
101
164
|
};
|
|
102
|
-
return this.registerComponent(component);
|
|
103
165
|
}
|
|
104
|
-
|
|
166
|
+
buildEventHandlerComponent(input) {
|
|
105
167
|
validateDomainExists(this.graph.metadata.domains, input.domain);
|
|
106
168
|
const id = generateComponentId(input.domain, input.module, 'eventhandler', input.name);
|
|
107
|
-
|
|
169
|
+
return {
|
|
108
170
|
id,
|
|
109
171
|
type: 'EventHandler',
|
|
110
172
|
name: input.name,
|
|
@@ -114,20 +176,8 @@ export class GraphConstruction {
|
|
|
114
176
|
sourceLocation: input.sourceLocation,
|
|
115
177
|
...(input.description !== undefined && { description: input.description }),
|
|
116
178
|
};
|
|
117
|
-
return this.registerComponent(component);
|
|
118
179
|
}
|
|
119
|
-
|
|
120
|
-
const customTypes = this.graph.metadata.customTypes;
|
|
121
|
-
if (customTypes[input.name]) {
|
|
122
|
-
throw new CustomTypeAlreadyDefinedError(input.name);
|
|
123
|
-
}
|
|
124
|
-
customTypes[input.name] = {
|
|
125
|
-
...(input.requiredProperties !== undefined && { requiredProperties: input.requiredProperties, }),
|
|
126
|
-
...(input.optionalProperties !== undefined && { optionalProperties: input.optionalProperties, }),
|
|
127
|
-
...(input.description !== undefined && { description: input.description }),
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
addCustom(input) {
|
|
180
|
+
buildCustomComponent(input) {
|
|
131
181
|
validateDomainExists(this.graph.metadata.domains, input.domain);
|
|
132
182
|
validateCustomType(this.graph.metadata.customTypes, input.customTypeName);
|
|
133
183
|
validateRequiredProperties(this.graph.metadata.customTypes, input.customTypeName, input.metadata);
|
|
@@ -143,7 +193,7 @@ export class GraphConstruction {
|
|
|
143
193
|
...(input.description !== undefined && { description: input.description }),
|
|
144
194
|
...input.metadata,
|
|
145
195
|
};
|
|
146
|
-
return
|
|
196
|
+
return component;
|
|
147
197
|
}
|
|
148
198
|
registerComponent(component) {
|
|
149
199
|
if (this.graph.components.some((c) => c.id === component.id)) {
|
|
@@ -152,4 +202,32 @@ export class GraphConstruction {
|
|
|
152
202
|
this.graph.components.push(component);
|
|
153
203
|
return component;
|
|
154
204
|
}
|
|
205
|
+
upsertTypedComponent(incoming, options) {
|
|
206
|
+
const existingIndex = this.graph.components.findIndex((component) => component.id === incoming.id);
|
|
207
|
+
if (existingIndex === -1) {
|
|
208
|
+
this.graph.components.push(incoming);
|
|
209
|
+
return {
|
|
210
|
+
component: incoming,
|
|
211
|
+
created: true,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const existing = this.graph.components[existingIndex];
|
|
215
|
+
if (!isSameTypeComponent(existing, incoming)) {
|
|
216
|
+
throw new ComponentTypeMismatchError(incoming.id, existing?.type ?? 'unknown', incoming.type);
|
|
217
|
+
}
|
|
218
|
+
const merged = mergeComponentForUpsert(existing, incoming, options, this.operationWarnings);
|
|
219
|
+
this.graph.components[existingIndex] = merged;
|
|
220
|
+
return {
|
|
221
|
+
component: merged,
|
|
222
|
+
created: false,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function areSourcesEqual(existing, incoming) {
|
|
227
|
+
return (existing.repository === incoming.repository &&
|
|
228
|
+
existing.commit === incoming.commit &&
|
|
229
|
+
existing.extractedAt === incoming.extractedAt);
|
|
230
|
+
}
|
|
231
|
+
function isSameTypeComponent(existing, incoming) {
|
|
232
|
+
return existing?.type === incoming.type;
|
|
155
233
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Component } from '@living-architecture/riviere-schema';
|
|
2
|
+
import type { UpsertOptions } from '../construction/construction-types';
|
|
3
|
+
import type { BuilderWarning } from '../inspection/inspection-types';
|
|
4
|
+
/** @riviere-role domain-service */
|
|
5
|
+
export declare function mergeComponentForUpsert<T extends Component>(existing: T, incoming: T, options: UpsertOptions | undefined, warnings: BuilderWarning[]): T;
|
|
6
|
+
//# sourceMappingURL=upsert-merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsert-merge.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/enrichment/upsert-merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAGV,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAiBpE,mCAAmC;AACnC,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,SAAS,EACzD,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,aAAa,GAAG,SAAS,EAClC,QAAQ,EAAE,cAAc,EAAE,GACzB,CAAC,CAmBH"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { mergeBehavior } from './merge-behavior';
|
|
2
|
+
const IDENTITY_FIELDS = new Set(['id', 'type', 'name', 'domain', 'module']);
|
|
3
|
+
const CUSTOM_BASE_FIELDS = new Set([
|
|
4
|
+
'id',
|
|
5
|
+
'type',
|
|
6
|
+
'customTypeName',
|
|
7
|
+
'name',
|
|
8
|
+
'domain',
|
|
9
|
+
'module',
|
|
10
|
+
'description',
|
|
11
|
+
'sourceLocation',
|
|
12
|
+
]);
|
|
13
|
+
/** @riviere-role domain-service */
|
|
14
|
+
export function mergeComponentForUpsert(existing, incoming, options, warnings) {
|
|
15
|
+
const merged = { ...existing };
|
|
16
|
+
for (const [field, incomingValue] of Object.entries(incoming)) {
|
|
17
|
+
if (shouldSkipTopLevelField(field, incomingValue)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
mergeTopLevelField(merged, existing.id, field, incomingValue, options, warnings);
|
|
21
|
+
}
|
|
22
|
+
if (isCustomComponent(existing) && isCustomComponent(incoming)) {
|
|
23
|
+
const mergedMetadata = mergeCustomMetadata(existing, incoming, options, warnings);
|
|
24
|
+
for (const [key, value] of Object.entries(mergedMetadata)) {
|
|
25
|
+
setField(merged, key, value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return merged;
|
|
29
|
+
}
|
|
30
|
+
function mergeTopLevelField(target, componentId, field, incomingValue, options, warnings) {
|
|
31
|
+
if (Array.isArray(incomingValue)) {
|
|
32
|
+
mergeArrayField(target, field, incomingValue);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (field === 'behavior' && isRecord(incomingValue)) {
|
|
36
|
+
mergeBehaviorField(target, incomingValue);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (isRecord(incomingValue) && shouldRecursivelyMergeTopLevelObject(field)) {
|
|
40
|
+
const existingValue = getField(target, field);
|
|
41
|
+
const existingRecord = isRecord(existingValue) ? existingValue : undefined;
|
|
42
|
+
setField(target, field, mergeNestedObject(existingRecord, incomingValue, options, warnings, componentId, field));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
mergeScalarLikeField(target, field, incomingValue, options, warnings, componentId);
|
|
46
|
+
}
|
|
47
|
+
function mergeCustomMetadata(existing, incoming, options, warnings) {
|
|
48
|
+
const existingMetadata = extractCustomMetadata(existing);
|
|
49
|
+
const incomingMetadata = extractCustomMetadata(incoming);
|
|
50
|
+
return mergeNestedObject(existingMetadata, incomingMetadata, options, warnings, existing.id, 'metadata');
|
|
51
|
+
}
|
|
52
|
+
function extractCustomMetadata(component) {
|
|
53
|
+
const metadata = {};
|
|
54
|
+
for (const [key, value] of Object.entries(component)) {
|
|
55
|
+
if (CUSTOM_BASE_FIELDS.has(key)) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
metadata[key] = value;
|
|
59
|
+
}
|
|
60
|
+
return metadata;
|
|
61
|
+
}
|
|
62
|
+
function shouldSkipTopLevelField(field, value) {
|
|
63
|
+
return IDENTITY_FIELDS.has(field) || !isDefined(value);
|
|
64
|
+
}
|
|
65
|
+
function shouldRecursivelyMergeTopLevelObject(field) {
|
|
66
|
+
return field !== 'sourceLocation' && field !== 'signature';
|
|
67
|
+
}
|
|
68
|
+
function mergeArrayField(target, field, incomingValue) {
|
|
69
|
+
if (incomingValue.length === 0) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const existingValue = getField(target, field);
|
|
73
|
+
const existingArray = Array.isArray(existingValue) ? existingValue : [];
|
|
74
|
+
setField(target, field, mergeArrayUnion(existingArray, incomingValue));
|
|
75
|
+
}
|
|
76
|
+
function mergeBehaviorField(target, incomingValue) {
|
|
77
|
+
const existingValue = getField(target, 'behavior');
|
|
78
|
+
const existingBehavior = toOperationBehavior(existingValue);
|
|
79
|
+
const incomingBehavior = toOperationBehaviorFromRecord(incomingValue);
|
|
80
|
+
setField(target, 'behavior', mergeBehavior(existingBehavior, incomingBehavior));
|
|
81
|
+
}
|
|
82
|
+
function mergeScalarLikeField(target, field, incomingValue, options, warnings, componentId) {
|
|
83
|
+
const existingValue = getField(target, field);
|
|
84
|
+
if (options?.noOverwrite && isDefined(existingValue)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
maybePushScalarOverwriteWarning(warnings, componentId, field, existingValue, incomingValue);
|
|
88
|
+
setField(target, field, incomingValue);
|
|
89
|
+
}
|
|
90
|
+
function maybePushScalarOverwriteWarning(warnings, componentId, field, existingValue, incomingValue) {
|
|
91
|
+
if (!isPrimitive(existingValue) ||
|
|
92
|
+
!isPrimitive(incomingValue) ||
|
|
93
|
+
existingValue === incomingValue) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
warnings.push({
|
|
97
|
+
code: 'SCALAR_OVERWRITE',
|
|
98
|
+
message: `Scalar field '${field}' on component '${componentId}' overwritten`,
|
|
99
|
+
componentId,
|
|
100
|
+
field,
|
|
101
|
+
oldValue: existingValue,
|
|
102
|
+
newValue: incomingValue,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function mergeNestedObject(existing, incoming, options, warnings, componentId, pathPrefix) {
|
|
106
|
+
const merged = { ...(existing ?? {}) };
|
|
107
|
+
for (const [field, incomingValue] of Object.entries(incoming)) {
|
|
108
|
+
if (!isDefined(incomingValue)) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (Array.isArray(incomingValue)) {
|
|
112
|
+
mergeArrayField(merged, field, incomingValue);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (isRecord(incomingValue)) {
|
|
116
|
+
const existingValue = merged[field];
|
|
117
|
+
const existingRecord = isRecord(existingValue) ? existingValue : undefined;
|
|
118
|
+
merged[field] = mergeNestedObject(existingRecord, incomingValue, options, warnings, componentId, `${pathPrefix}.${field}`);
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (options?.noOverwrite && isDefined(merged[field])) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
maybePushScalarOverwriteWarning(warnings, componentId, `${pathPrefix}.${field}`, merged[field], incomingValue);
|
|
125
|
+
merged[field] = incomingValue;
|
|
126
|
+
}
|
|
127
|
+
return merged;
|
|
128
|
+
}
|
|
129
|
+
function toOperationBehavior(value) {
|
|
130
|
+
if (!isRecord(value)) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
return toOperationBehaviorFromRecord(value);
|
|
134
|
+
}
|
|
135
|
+
function toOperationBehaviorFromRecord(value) {
|
|
136
|
+
const behavior = {};
|
|
137
|
+
const reads = toStringArray(value['reads']);
|
|
138
|
+
if (reads !== undefined) {
|
|
139
|
+
behavior.reads = reads;
|
|
140
|
+
}
|
|
141
|
+
const validates = toStringArray(value['validates']);
|
|
142
|
+
if (validates !== undefined) {
|
|
143
|
+
behavior.validates = validates;
|
|
144
|
+
}
|
|
145
|
+
const modifies = toStringArray(value['modifies']);
|
|
146
|
+
if (modifies !== undefined) {
|
|
147
|
+
behavior.modifies = modifies;
|
|
148
|
+
}
|
|
149
|
+
const emits = toStringArray(value['emits']);
|
|
150
|
+
if (emits !== undefined) {
|
|
151
|
+
behavior.emits = emits;
|
|
152
|
+
}
|
|
153
|
+
return behavior;
|
|
154
|
+
}
|
|
155
|
+
function toStringArray(value) {
|
|
156
|
+
if (!Array.isArray(value)) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
return value.filter(isString);
|
|
160
|
+
}
|
|
161
|
+
function mergeArrayUnion(existing, incoming) {
|
|
162
|
+
const merged = [...existing];
|
|
163
|
+
const seen = new Set(existing.map((item) => toStableKey(item)));
|
|
164
|
+
for (const item of incoming) {
|
|
165
|
+
const key = toStableKey(item);
|
|
166
|
+
if (seen.has(key)) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
seen.add(key);
|
|
170
|
+
merged.push(item);
|
|
171
|
+
}
|
|
172
|
+
return merged;
|
|
173
|
+
}
|
|
174
|
+
function getField(target, field) {
|
|
175
|
+
return Reflect.get(target, field);
|
|
176
|
+
}
|
|
177
|
+
function setField(target, field, value) {
|
|
178
|
+
Reflect.set(target, field, value);
|
|
179
|
+
}
|
|
180
|
+
function toStableKey(value) {
|
|
181
|
+
if (isPrimitive(value)) {
|
|
182
|
+
return `${typeof value}:${String(value)}`;
|
|
183
|
+
}
|
|
184
|
+
return `json:${JSON.stringify(value)}`;
|
|
185
|
+
}
|
|
186
|
+
function isDefined(value) {
|
|
187
|
+
return value !== undefined && value !== null;
|
|
188
|
+
}
|
|
189
|
+
function isPrimitive(value) {
|
|
190
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
|
|
191
|
+
}
|
|
192
|
+
function isRecord(value) {
|
|
193
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
194
|
+
}
|
|
195
|
+
function isString(value) {
|
|
196
|
+
return typeof value === 'string';
|
|
197
|
+
}
|
|
198
|
+
function isCustomComponent(component) {
|
|
199
|
+
return component.type === 'Custom';
|
|
200
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './builder-facade';
|
|
2
2
|
export { ComponentId, type ComponentIdParts } from '@living-architecture/riviere-schema';
|
|
3
|
-
export { DuplicateDomainError, DomainNotFoundError, CustomTypeNotFoundError, DuplicateComponentError, ComponentNotFoundError, CustomTypeAlreadyDefinedError, MissingRequiredPropertiesError, InvalidGraphError, MissingSourcesError, MissingDomainsError, BuildValidationError, } from './construction/construction-errors';
|
|
3
|
+
export { DuplicateDomainError, SourceConflictError, DomainNotFoundError, CustomTypeNotFoundError, DuplicateComponentError, ComponentTypeMismatchError, ComponentNotFoundError, CustomTypeAlreadyDefinedError, MissingRequiredPropertiesError, InvalidGraphError, MissingSourcesError, MissingDomainsError, BuildValidationError, } from './construction/construction-errors';
|
|
4
4
|
export { InvalidEnrichmentTargetError } from './enrichment/enrichment-errors';
|
|
5
5
|
export { findNearMatches } from './error-recovery/component-suggestion';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/building/domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,WAAW,EAAE,KAAK,gBAAgB,EACnC,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,EAC7B,8BAA8B,EAC9B,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/building/domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,WAAW,EAAE,KAAK,gBAAgB,EACnC,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,EAC7B,8BAA8B,EAC9B,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './builder-facade';
|
|
2
2
|
export { ComponentId } from '@living-architecture/riviere-schema';
|
|
3
|
-
export { DuplicateDomainError, DomainNotFoundError, CustomTypeNotFoundError, DuplicateComponentError, ComponentNotFoundError, CustomTypeAlreadyDefinedError, MissingRequiredPropertiesError, InvalidGraphError, MissingSourcesError, MissingDomainsError, BuildValidationError, } from './construction/construction-errors';
|
|
3
|
+
export { DuplicateDomainError, SourceConflictError, DomainNotFoundError, CustomTypeNotFoundError, DuplicateComponentError, ComponentTypeMismatchError, ComponentNotFoundError, CustomTypeAlreadyDefinedError, MissingRequiredPropertiesError, InvalidGraphError, MissingSourcesError, MissingDomainsError, BuildValidationError, } from './construction/construction-errors';
|
|
4
4
|
export { InvalidEnrichmentTargetError } from './enrichment/enrichment-errors';
|
|
5
5
|
export { findNearMatches } from './error-recovery/component-suggestion';
|
|
@@ -5,7 +5,8 @@ import type { BuilderStats, BuilderWarning } from './inspection-types';
|
|
|
5
5
|
/** @riviere-role domain-service */
|
|
6
6
|
export declare class GraphInspection {
|
|
7
7
|
private readonly graph;
|
|
8
|
-
|
|
8
|
+
private readonly operationWarnings;
|
|
9
|
+
constructor(graph: BuilderGraph, operationWarnings: readonly BuilderWarning[]);
|
|
9
10
|
warnings(): BuilderWarning[];
|
|
10
11
|
stats(): BuilderStats;
|
|
11
12
|
orphans(): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-inspection.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/inspection/graph-inspection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EACV,YAAY,EAAE,cAAc,EAC7B,MAAM,oBAAoB,CAAA;AAS3B,mCAAmC;AACnC,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;
|
|
1
|
+
{"version":3,"file":"graph-inspection.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/inspection/graph-inspection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EACV,YAAY,EAAE,cAAc,EAC7B,MAAM,oBAAoB,CAAA;AAS3B,mCAAmC;AACnC,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA2B;gBAEjD,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,cAAc,EAAE;IAK7E,QAAQ,IAAI,cAAc,EAAE;IAI5B,KAAK,IAAI,YAAY;IAIrB,OAAO,IAAI,MAAM,EAAE;IAInB,QAAQ,IAAI,gBAAgB;IAI5B,KAAK,IAAI,YAAY;CAGtB"}
|
|
@@ -3,11 +3,13 @@ import { calculateStats, findOrphans, findWarnings, toRiviereGraph, validateGrap
|
|
|
3
3
|
/** @riviere-role domain-service */
|
|
4
4
|
export class GraphInspection {
|
|
5
5
|
graph;
|
|
6
|
-
|
|
6
|
+
operationWarnings;
|
|
7
|
+
constructor(graph, operationWarnings) {
|
|
7
8
|
this.graph = graph;
|
|
9
|
+
this.operationWarnings = operationWarnings;
|
|
8
10
|
}
|
|
9
11
|
warnings() {
|
|
10
|
-
return findWarnings(this.graph);
|
|
12
|
+
return [...findWarnings(this.graph), ...this.operationWarnings];
|
|
11
13
|
}
|
|
12
14
|
stats() {
|
|
13
15
|
return calculateStats(this.graph);
|
|
@@ -15,12 +15,20 @@ export interface BuilderStats {
|
|
|
15
15
|
domainCount: number;
|
|
16
16
|
}
|
|
17
17
|
/** @riviere-role value-object */
|
|
18
|
-
export type WarningCode = 'ORPHAN_COMPONENT' | 'UNUSED_DOMAIN';
|
|
18
|
+
export type WarningCode = 'ORPHAN_COMPONENT' | 'UNUSED_DOMAIN' | 'SCALAR_OVERWRITE' | 'DUPLICATE_LINK_SKIPPED';
|
|
19
19
|
/** @riviere-role value-object */
|
|
20
20
|
export interface BuilderWarning {
|
|
21
21
|
code: WarningCode;
|
|
22
22
|
message: string;
|
|
23
23
|
componentId?: string;
|
|
24
24
|
domainName?: string;
|
|
25
|
+
field?: string;
|
|
26
|
+
oldValue?: string | number | boolean;
|
|
27
|
+
newValue?: string | number | boolean;
|
|
28
|
+
source?: string;
|
|
29
|
+
target?: string;
|
|
30
|
+
linkType?: string;
|
|
31
|
+
targetRepository?: string;
|
|
32
|
+
targetName?: string;
|
|
25
33
|
}
|
|
26
34
|
//# sourceMappingURL=inspection-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspection-types.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/inspection/inspection-types.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE;QAChB,EAAE,EAAE,MAAM,CAAA;QACV,GAAG,EAAE,MAAM,CAAA;QACX,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,MAAM,CAAA;QAChB,KAAK,EAAE,MAAM,CAAA;QACb,YAAY,EAAE,MAAM,CAAA;QACpB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,iCAAiC;AACjC,MAAM,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"inspection-types.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/inspection/inspection-types.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE;QAChB,EAAE,EAAE,MAAM,CAAA;QACV,GAAG,EAAE,MAAM,CAAA;QACX,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,MAAM,CAAA;QAChB,KAAK,EAAE,MAAM,CAAA;QACb,YAAY,EAAE,MAAM,CAAA;QACpB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,iCAAiC;AACjC,MAAM,MAAM,WAAW,GACnB,kBAAkB,GAClB,eAAe,GACf,kBAAkB,GAClB,wBAAwB,CAAA;AAE5B,iCAAiC;AACjC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ExternalLink, Link } from '@living-architecture/riviere-schema';
|
|
2
2
|
import type { BuilderGraph } from '../builder-graph';
|
|
3
|
+
import type { BuilderWarning } from '../inspection/inspection-types';
|
|
3
4
|
import type { ExternalLinkInput, LinkInput } from './linking-types';
|
|
4
5
|
/** @riviere-role domain-service */
|
|
5
6
|
export declare class GraphLinking {
|
|
6
7
|
private readonly graph;
|
|
7
|
-
|
|
8
|
+
private readonly operationWarnings;
|
|
9
|
+
constructor(graph: BuilderGraph, operationWarnings: BuilderWarning[]);
|
|
8
10
|
link(input: LinkInput): Link;
|
|
9
11
|
linkExternal(input: ExternalLinkInput): ExternalLink;
|
|
10
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-linking.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/linking/graph-linking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAAE,IAAI,EACnB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EACV,iBAAiB,EAAE,SAAS,EAC7B,MAAM,iBAAiB,CAAA;AAGxB,mCAAmC;AACnC,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;
|
|
1
|
+
{"version":3,"file":"graph-linking.d.ts","sourceRoot":"","sources":["../../../../../src/features/building/domain/linking/graph-linking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAAE,IAAI,EACnB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EACV,iBAAiB,EAAE,SAAS,EAC7B,MAAM,iBAAiB,CAAA;AAGxB,mCAAmC;AACnC,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkB;gBAExC,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE;IAKpE,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IA+B5B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY;CAsCrD"}
|
|
@@ -2,14 +2,27 @@ import { createComponentNotFoundError } from '../construction/builder-internals'
|
|
|
2
2
|
/** @riviere-role domain-service */
|
|
3
3
|
export class GraphLinking {
|
|
4
4
|
graph;
|
|
5
|
-
|
|
5
|
+
operationWarnings;
|
|
6
|
+
constructor(graph, operationWarnings) {
|
|
6
7
|
this.graph = graph;
|
|
8
|
+
this.operationWarnings = operationWarnings;
|
|
7
9
|
}
|
|
8
10
|
link(input) {
|
|
9
11
|
const sourceExists = this.graph.components.some((c) => c.id === input.from);
|
|
10
12
|
if (!sourceExists) {
|
|
11
13
|
throw createComponentNotFoundError(this.graph.components, input.from);
|
|
12
14
|
}
|
|
15
|
+
const duplicate = this.graph.links.find((link) => link.source === input.from && link.target === input.to && link.type === input.type);
|
|
16
|
+
if (duplicate) {
|
|
17
|
+
this.operationWarnings.push({
|
|
18
|
+
code: 'DUPLICATE_LINK_SKIPPED',
|
|
19
|
+
message: `Duplicate link '${input.from}' -> '${input.to}' (${input.type ?? 'unspecified'}) skipped`,
|
|
20
|
+
source: input.from,
|
|
21
|
+
target: input.to,
|
|
22
|
+
...(input.type !== undefined && { linkType: input.type }),
|
|
23
|
+
});
|
|
24
|
+
return duplicate;
|
|
25
|
+
}
|
|
13
26
|
const link = {
|
|
14
27
|
source: input.from,
|
|
15
28
|
target: input.to,
|
|
@@ -23,6 +36,22 @@ export class GraphLinking {
|
|
|
23
36
|
if (!sourceExists) {
|
|
24
37
|
throw createComponentNotFoundError(this.graph.components, input.from);
|
|
25
38
|
}
|
|
39
|
+
const duplicate = this.graph.externalLinks.find((link) => link.source === input.from &&
|
|
40
|
+
link.target.repository === input.target.repository &&
|
|
41
|
+
link.target.name === input.target.name &&
|
|
42
|
+
link.type === input.type);
|
|
43
|
+
if (duplicate) {
|
|
44
|
+
this.operationWarnings.push({
|
|
45
|
+
code: 'DUPLICATE_LINK_SKIPPED',
|
|
46
|
+
message: `Duplicate external link '${input.from}' -> '${input.target.name}' (${input.type ?? 'unspecified'}) skipped`,
|
|
47
|
+
source: input.from,
|
|
48
|
+
target: input.target.name,
|
|
49
|
+
...(input.type !== undefined && { linkType: input.type }),
|
|
50
|
+
...(input.target.repository !== undefined && { targetRepository: input.target.repository }),
|
|
51
|
+
targetName: input.target.name,
|
|
52
|
+
});
|
|
53
|
+
return duplicate;
|
|
54
|
+
}
|
|
26
55
|
const externalLink = {
|
|
27
56
|
source: input.from,
|
|
28
57
|
target: input.target,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"riviere-builder.d.ts","sourceRoot":"","sources":["../../../../src/features/building/domain/riviere-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"riviere-builder.d.ts","sourceRoot":"","sources":["../../../../src/features/building/domain/riviere-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAUvE,mCAAmC;AACnC,qBAAa,cAAc;IACzB,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAA;IACxC,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;IAC9B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAA;IACpC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAA;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IAEpC,OAAO;IAWP,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,SAAK,GAAG,cAAc;IAmBlE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,SAAK,GAAG,cAAc;IA0BnE,SAAS,IAAI,MAAM;IAInB,KAAK,IAAI,YAAY;CAQtB"}
|
|
@@ -17,10 +17,11 @@ export class RiviereBuilder {
|
|
|
17
17
|
constructor(graph, graphPath) {
|
|
18
18
|
this.graph = graph;
|
|
19
19
|
this.graphPath = graphPath;
|
|
20
|
-
|
|
20
|
+
const operationWarnings = [];
|
|
21
|
+
this.construction = new GraphConstruction(graph, operationWarnings);
|
|
21
22
|
this.enrichment = new GraphEnrichment(graph);
|
|
22
|
-
this.linking = new GraphLinking(graph);
|
|
23
|
-
this.inspection = new GraphInspection(graph);
|
|
23
|
+
this.linking = new GraphLinking(graph, operationWarnings);
|
|
24
|
+
this.inspection = new GraphInspection(graph, operationWarnings);
|
|
24
25
|
this.errorRecovery = new NearMatch(graph);
|
|
25
26
|
}
|
|
26
27
|
static resume(graph, graphPath = '') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@living-architecture/riviere-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"!**/*.tsbuildinfo"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@living-architecture/riviere-query": "0.6.
|
|
26
|
-
"@living-architecture/riviere-schema": "0.6.
|
|
25
|
+
"@living-architecture/riviere-query": "0.6.12",
|
|
26
|
+
"@living-architecture/riviere-schema": "0.6.12"
|
|
27
27
|
}
|
|
28
28
|
}
|