eventmodeler 0.5.0 → 0.6.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/dist/index.js +6776 -2132
- package/package.json +11 -5
- package/dist/api/index.d.ts +0 -285
- package/dist/api/index.js +0 -323
- package/dist/cloud/slices/index.d.ts +0 -276
- package/dist/cloud/slices/index.js +0 -406
- package/dist/eventmodeler.js +0 -5646
- package/dist/formatters.d.ts +0 -17
- package/dist/formatters.js +0 -482
- package/dist/index.d.ts +0 -2
- package/dist/lib/auth.d.ts +0 -24
- package/dist/lib/auth.js +0 -331
- package/dist/lib/backend.d.ts +0 -43
- package/dist/lib/backend.js +0 -73
- package/dist/lib/chapter-utils.d.ts +0 -13
- package/dist/lib/chapter-utils.js +0 -71
- package/dist/lib/cloud-client.d.ts +0 -69
- package/dist/lib/cloud-client.js +0 -364
- package/dist/lib/config.d.ts +0 -30
- package/dist/lib/config.js +0 -95
- package/dist/lib/diff/merge-rules.d.ts +0 -45
- package/dist/lib/diff/merge-rules.js +0 -210
- package/dist/lib/diff/model-differ.d.ts +0 -8
- package/dist/lib/diff/model-differ.js +0 -568
- package/dist/lib/diff/three-way-merge.d.ts +0 -7
- package/dist/lib/diff/three-way-merge.js +0 -390
- package/dist/lib/diff/types.d.ts +0 -75
- package/dist/lib/diff/types.js +0 -1
- package/dist/lib/element-lookup.d.ts +0 -58
- package/dist/lib/element-lookup.js +0 -126
- package/dist/lib/file-loader.d.ts +0 -8
- package/dist/lib/file-loader.js +0 -108
- package/dist/lib/flow-utils.d.ts +0 -53
- package/dist/lib/flow-utils.js +0 -348
- package/dist/lib/format.d.ts +0 -10
- package/dist/lib/format.js +0 -23
- package/dist/lib/project-config.d.ts +0 -27
- package/dist/lib/project-config.js +0 -83
- package/dist/lib/slice-utils.d.ts +0 -59
- package/dist/lib/slice-utils.js +0 -140
- package/dist/local/slices/index.d.ts +0 -11
- package/dist/local/slices/index.js +0 -13
- package/dist/projection.d.ts +0 -3
- package/dist/projection.js +0 -828
- package/dist/slices/add-field/index.d.ts +0 -8
- package/dist/slices/add-field/index.js +0 -211
- package/dist/slices/add-scenario/index.d.ts +0 -27
- package/dist/slices/add-scenario/index.js +0 -307
- package/dist/slices/codegen-chapter-events/index.d.ts +0 -2
- package/dist/slices/codegen-chapter-events/index.js +0 -145
- package/dist/slices/codegen-slice/index.d.ts +0 -2
- package/dist/slices/codegen-slice/index.js +0 -448
- package/dist/slices/create-automation-slice/index.d.ts +0 -2
- package/dist/slices/create-automation-slice/index.js +0 -304
- package/dist/slices/create-flow/index.d.ts +0 -2
- package/dist/slices/create-flow/index.js +0 -183
- package/dist/slices/create-state-change-slice/index.d.ts +0 -2
- package/dist/slices/create-state-change-slice/index.js +0 -263
- package/dist/slices/create-state-view-slice/index.d.ts +0 -2
- package/dist/slices/create-state-view-slice/index.js +0 -128
- package/dist/slices/diff/index.d.ts +0 -11
- package/dist/slices/diff/index.js +0 -293
- package/dist/slices/export-eventmodel-to-json/index.d.ts +0 -2
- package/dist/slices/export-eventmodel-to-json/index.js +0 -355
- package/dist/slices/git/index.d.ts +0 -2
- package/dist/slices/git/index.js +0 -125
- package/dist/slices/guide/guides/codegen.d.ts +0 -5
- package/dist/slices/guide/guides/codegen.js +0 -339
- package/dist/slices/guide/guides/connect-slices.d.ts +0 -5
- package/dist/slices/guide/guides/connect-slices.js +0 -202
- package/dist/slices/guide/guides/create-slices.d.ts +0 -5
- package/dist/slices/guide/guides/create-slices.js +0 -303
- package/dist/slices/guide/guides/explore.d.ts +0 -5
- package/dist/slices/guide/guides/explore.js +0 -251
- package/dist/slices/guide/guides/information-flow.d.ts +0 -5
- package/dist/slices/guide/guides/information-flow.js +0 -318
- package/dist/slices/guide/guides/scenarios.d.ts +0 -5
- package/dist/slices/guide/guides/scenarios.js +0 -269
- package/dist/slices/guide/index.d.ts +0 -1
- package/dist/slices/guide/index.js +0 -40
- package/dist/slices/import/index.d.ts +0 -8
- package/dist/slices/import/index.js +0 -63
- package/dist/slices/init/index.d.ts +0 -5
- package/dist/slices/init/index.js +0 -80
- package/dist/slices/list-chapters/index.d.ts +0 -3
- package/dist/slices/list-chapters/index.js +0 -21
- package/dist/slices/list-commands/index.d.ts +0 -3
- package/dist/slices/list-commands/index.js +0 -20
- package/dist/slices/list-events/index.d.ts +0 -3
- package/dist/slices/list-events/index.js +0 -98
- package/dist/slices/list-processors/index.d.ts +0 -3
- package/dist/slices/list-processors/index.js +0 -20
- package/dist/slices/list-readmodels/index.d.ts +0 -3
- package/dist/slices/list-readmodels/index.js +0 -21
- package/dist/slices/list-scenarios/index.d.ts +0 -3
- package/dist/slices/list-scenarios/index.js +0 -35
- package/dist/slices/list-screens/index.d.ts +0 -3
- package/dist/slices/list-screens/index.js +0 -47
- package/dist/slices/list-slices/index.d.ts +0 -3
- package/dist/slices/list-slices/index.js +0 -35
- package/dist/slices/login/index.d.ts +0 -1
- package/dist/slices/login/index.js +0 -20
- package/dist/slices/logout/index.d.ts +0 -1
- package/dist/slices/logout/index.js +0 -14
- package/dist/slices/map-fields/index.d.ts +0 -2
- package/dist/slices/map-fields/index.js +0 -269
- package/dist/slices/mark-slice-status/index.d.ts +0 -2
- package/dist/slices/mark-slice-status/index.js +0 -31
- package/dist/slices/merge/index.d.ts +0 -19
- package/dist/slices/merge/index.js +0 -147
- package/dist/slices/open-app/index.d.ts +0 -1
- package/dist/slices/open-app/index.js +0 -36
- package/dist/slices/remove-field/index.d.ts +0 -8
- package/dist/slices/remove-field/index.js +0 -167
- package/dist/slices/remove-scenario/index.d.ts +0 -2
- package/dist/slices/remove-scenario/index.js +0 -77
- package/dist/slices/search/index.d.ts +0 -3
- package/dist/slices/search/index.js +0 -302
- package/dist/slices/show-actor/index.d.ts +0 -4
- package/dist/slices/show-actor/index.js +0 -115
- package/dist/slices/show-aggregate/index.d.ts +0 -3
- package/dist/slices/show-aggregate/index.js +0 -108
- package/dist/slices/show-aggregate-completeness/index.d.ts +0 -4
- package/dist/slices/show-aggregate-completeness/index.js +0 -181
- package/dist/slices/show-chapter/index.d.ts +0 -3
- package/dist/slices/show-chapter/index.js +0 -195
- package/dist/slices/show-command/index.d.ts +0 -3
- package/dist/slices/show-command/index.js +0 -133
- package/dist/slices/show-completeness/index.d.ts +0 -4
- package/dist/slices/show-completeness/index.js +0 -731
- package/dist/slices/show-event/index.d.ts +0 -3
- package/dist/slices/show-event/index.js +0 -118
- package/dist/slices/show-model-summary/index.d.ts +0 -3
- package/dist/slices/show-model-summary/index.js +0 -31
- package/dist/slices/show-processor/index.d.ts +0 -3
- package/dist/slices/show-processor/index.js +0 -111
- package/dist/slices/show-readmodel/index.d.ts +0 -3
- package/dist/slices/show-readmodel/index.js +0 -158
- package/dist/slices/show-scenario/index.d.ts +0 -3
- package/dist/slices/show-scenario/index.js +0 -196
- package/dist/slices/show-screen/index.d.ts +0 -3
- package/dist/slices/show-screen/index.js +0 -139
- package/dist/slices/show-slice/index.d.ts +0 -3
- package/dist/slices/show-slice/index.js +0 -696
- package/dist/slices/update-field/index.d.ts +0 -15
- package/dist/slices/update-field/index.js +0 -208
- package/dist/slices/whoami/index.d.ts +0 -2
- package/dist/slices/whoami/index.js +0 -44
- package/dist/types.d.ts +0 -195
- package/dist/types.js +0 -1
|
@@ -1,568 +0,0 @@
|
|
|
1
|
-
// Flatten nested Custom fields into dot-notation paths
|
|
2
|
-
function flattenFields(fields, prefix = '') {
|
|
3
|
-
const result = [];
|
|
4
|
-
for (const field of fields) {
|
|
5
|
-
const path = prefix ? `${prefix}.${field.name}` : field.name;
|
|
6
|
-
result.push({ path, field });
|
|
7
|
-
if (field.fieldType === 'Custom' && field.subfields) {
|
|
8
|
-
result.push(...flattenFields(field.subfields, path));
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
// Compare two fields for semantic equality (ignoring id)
|
|
14
|
-
function fieldsEqual(a, b) {
|
|
15
|
-
if (a.name !== b.name)
|
|
16
|
-
return false;
|
|
17
|
-
if (a.fieldType !== b.fieldType)
|
|
18
|
-
return false;
|
|
19
|
-
if (a.isList !== b.isList)
|
|
20
|
-
return false;
|
|
21
|
-
if (a.isGenerated !== b.isGenerated)
|
|
22
|
-
return false;
|
|
23
|
-
if (a.isOptional !== b.isOptional)
|
|
24
|
-
return false;
|
|
25
|
-
if (a.isUserInput !== b.isUserInput)
|
|
26
|
-
return false;
|
|
27
|
-
// Compare subfields recursively
|
|
28
|
-
const aSubfields = a.subfields ?? [];
|
|
29
|
-
const bSubfields = b.subfields ?? [];
|
|
30
|
-
if (aSubfields.length !== bSubfields.length)
|
|
31
|
-
return false;
|
|
32
|
-
for (let i = 0; i < aSubfields.length; i++) {
|
|
33
|
-
if (!fieldsEqual(aSubfields[i], bSubfields[i]))
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
// Compare field arrays and return changes
|
|
39
|
-
function compareFields(baseFields, compareFields) {
|
|
40
|
-
const changes = [];
|
|
41
|
-
const baseFlat = flattenFields(baseFields);
|
|
42
|
-
const compareFlat = flattenFields(compareFields);
|
|
43
|
-
const baseByPath = new Map(baseFlat.map((f) => [f.path, f]));
|
|
44
|
-
const compareByPath = new Map(compareFlat.map((f) => [f.path, f]));
|
|
45
|
-
// Find removed and modified fields
|
|
46
|
-
for (const [path, baseEntry] of baseByPath) {
|
|
47
|
-
const compareEntry = compareByPath.get(path);
|
|
48
|
-
if (!compareEntry) {
|
|
49
|
-
changes.push({
|
|
50
|
-
fieldPath: path,
|
|
51
|
-
changeType: 'removed',
|
|
52
|
-
oldValue: baseEntry.field,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
else if (!fieldsEqual(baseEntry.field, compareEntry.field)) {
|
|
56
|
-
changes.push({
|
|
57
|
-
fieldPath: path,
|
|
58
|
-
changeType: 'modified',
|
|
59
|
-
oldValue: baseEntry.field,
|
|
60
|
-
newValue: compareEntry.field,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
// Find added fields
|
|
65
|
-
for (const [path, compareEntry] of compareByPath) {
|
|
66
|
-
if (!baseByPath.has(path)) {
|
|
67
|
-
changes.push({
|
|
68
|
-
fieldPath: path,
|
|
69
|
-
changeType: 'added',
|
|
70
|
-
newValue: compareEntry.field,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return changes;
|
|
75
|
-
}
|
|
76
|
-
// Get canonical ID for an entity (for linked copies)
|
|
77
|
-
function getCanonicalId(entity) {
|
|
78
|
-
// If it's a linked copy, use the originalNodeId as the canonical reference
|
|
79
|
-
// If it has a canonicalId, use that
|
|
80
|
-
// Otherwise use its own id
|
|
81
|
-
return entity.originalNodeId ?? entity.canonicalId ?? entity.id;
|
|
82
|
-
}
|
|
83
|
-
// Build a map of canonical entities (deduplicating linked copies)
|
|
84
|
-
function buildCanonicalMap(entities) {
|
|
85
|
-
const canonical = new Map();
|
|
86
|
-
for (const entity of entities.values()) {
|
|
87
|
-
// Skip linked copies - only use originals
|
|
88
|
-
if (entity.originalNodeId)
|
|
89
|
-
continue;
|
|
90
|
-
canonical.set(entity.id, entity);
|
|
91
|
-
}
|
|
92
|
-
return canonical;
|
|
93
|
-
}
|
|
94
|
-
// Compare entities with fields (commands, events, readModels, screens, processors)
|
|
95
|
-
function compareEntitiesWithFields(baseEntities, compareEntities, entityType) {
|
|
96
|
-
const changes = [];
|
|
97
|
-
// Build canonical maps (filter out linked copies)
|
|
98
|
-
const baseCanonical = buildCanonicalMap(baseEntities);
|
|
99
|
-
const compareCanonical = buildCanonicalMap(compareEntities);
|
|
100
|
-
// Find removed entities
|
|
101
|
-
for (const [id, baseEntity] of baseCanonical) {
|
|
102
|
-
if (!compareCanonical.has(id)) {
|
|
103
|
-
changes.push({
|
|
104
|
-
entityType,
|
|
105
|
-
entityId: id,
|
|
106
|
-
entityName: baseEntity.name,
|
|
107
|
-
canonicalId: baseEntity.canonicalId,
|
|
108
|
-
changeType: 'removed',
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// Find added entities
|
|
113
|
-
for (const [id, compareEntity] of compareCanonical) {
|
|
114
|
-
if (!baseCanonical.has(id)) {
|
|
115
|
-
changes.push({
|
|
116
|
-
entityType,
|
|
117
|
-
entityId: id,
|
|
118
|
-
entityName: compareEntity.name,
|
|
119
|
-
canonicalId: compareEntity.canonicalId,
|
|
120
|
-
changeType: 'added',
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// Find modified entities
|
|
125
|
-
for (const [id, baseEntity] of baseCanonical) {
|
|
126
|
-
const compareEntity = compareCanonical.get(id);
|
|
127
|
-
if (!compareEntity)
|
|
128
|
-
continue;
|
|
129
|
-
const propertyChanges = [];
|
|
130
|
-
const fieldChanges = compareFields(baseEntity.fields, compareEntity.fields);
|
|
131
|
-
// Check name change
|
|
132
|
-
if (baseEntity.name !== compareEntity.name) {
|
|
133
|
-
propertyChanges.push({
|
|
134
|
-
property: 'name',
|
|
135
|
-
oldValue: baseEntity.name,
|
|
136
|
-
newValue: compareEntity.name,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
if (propertyChanges.length > 0 || fieldChanges.length > 0) {
|
|
140
|
-
changes.push({
|
|
141
|
-
entityType,
|
|
142
|
-
entityId: id,
|
|
143
|
-
entityName: compareEntity.name,
|
|
144
|
-
canonicalId: compareEntity.canonicalId,
|
|
145
|
-
changeType: 'modified',
|
|
146
|
-
propertyChanges: propertyChanges.length > 0 ? propertyChanges : undefined,
|
|
147
|
-
fieldChanges: fieldChanges.length > 0 ? fieldChanges : undefined,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return changes;
|
|
152
|
-
}
|
|
153
|
-
// Compare slices
|
|
154
|
-
function compareSlices(baseSlices, compareSlices) {
|
|
155
|
-
const changes = [];
|
|
156
|
-
// Find removed slices
|
|
157
|
-
for (const [id, baseSlice] of baseSlices) {
|
|
158
|
-
if (!compareSlices.has(id)) {
|
|
159
|
-
changes.push({
|
|
160
|
-
entityType: 'slice',
|
|
161
|
-
entityId: id,
|
|
162
|
-
entityName: baseSlice.name,
|
|
163
|
-
changeType: 'removed',
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
// Find added slices
|
|
168
|
-
for (const [id, compareSlice] of compareSlices) {
|
|
169
|
-
if (!baseSlices.has(id)) {
|
|
170
|
-
changes.push({
|
|
171
|
-
entityType: 'slice',
|
|
172
|
-
entityId: id,
|
|
173
|
-
entityName: compareSlice.name,
|
|
174
|
-
changeType: 'added',
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
// Find modified slices
|
|
179
|
-
for (const [id, baseSlice] of baseSlices) {
|
|
180
|
-
const compareSlice = compareSlices.get(id);
|
|
181
|
-
if (!compareSlice)
|
|
182
|
-
continue;
|
|
183
|
-
const propertyChanges = [];
|
|
184
|
-
if (baseSlice.name !== compareSlice.name) {
|
|
185
|
-
propertyChanges.push({
|
|
186
|
-
property: 'name',
|
|
187
|
-
oldValue: baseSlice.name,
|
|
188
|
-
newValue: compareSlice.name,
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
if (baseSlice.status !== compareSlice.status) {
|
|
192
|
-
propertyChanges.push({
|
|
193
|
-
property: 'status',
|
|
194
|
-
oldValue: baseSlice.status,
|
|
195
|
-
newValue: compareSlice.status,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
// Compare nodeIds (membership)
|
|
199
|
-
const baseNodes = new Set(baseSlice.nodeIds);
|
|
200
|
-
const compareNodes = new Set(compareSlice.nodeIds);
|
|
201
|
-
const addedNodes = [...compareNodes].filter((n) => !baseNodes.has(n));
|
|
202
|
-
const removedNodes = [...baseNodes].filter((n) => !compareNodes.has(n));
|
|
203
|
-
if (addedNodes.length > 0 || removedNodes.length > 0) {
|
|
204
|
-
propertyChanges.push({
|
|
205
|
-
property: 'nodeIds',
|
|
206
|
-
oldValue: baseSlice.nodeIds,
|
|
207
|
-
newValue: compareSlice.nodeIds,
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
if (propertyChanges.length > 0) {
|
|
211
|
-
changes.push({
|
|
212
|
-
entityType: 'slice',
|
|
213
|
-
entityId: id,
|
|
214
|
-
entityName: compareSlice.name,
|
|
215
|
-
changeType: 'modified',
|
|
216
|
-
propertyChanges,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return changes;
|
|
221
|
-
}
|
|
222
|
-
// Compare chapters
|
|
223
|
-
function compareChapters(baseChapters, compareChapters) {
|
|
224
|
-
const changes = [];
|
|
225
|
-
for (const [id, baseChapter] of baseChapters) {
|
|
226
|
-
if (!compareChapters.has(id)) {
|
|
227
|
-
changes.push({
|
|
228
|
-
entityType: 'chapter',
|
|
229
|
-
entityId: id,
|
|
230
|
-
entityName: baseChapter.name,
|
|
231
|
-
changeType: 'removed',
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
for (const [id, compareChapter] of compareChapters) {
|
|
236
|
-
if (!baseChapters.has(id)) {
|
|
237
|
-
changes.push({
|
|
238
|
-
entityType: 'chapter',
|
|
239
|
-
entityId: id,
|
|
240
|
-
entityName: compareChapter.name,
|
|
241
|
-
changeType: 'added',
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
for (const [id, baseChapter] of baseChapters) {
|
|
246
|
-
const compareChapter = compareChapters.get(id);
|
|
247
|
-
if (!compareChapter)
|
|
248
|
-
continue;
|
|
249
|
-
if (baseChapter.name !== compareChapter.name) {
|
|
250
|
-
changes.push({
|
|
251
|
-
entityType: 'chapter',
|
|
252
|
-
entityId: id,
|
|
253
|
-
entityName: compareChapter.name,
|
|
254
|
-
changeType: 'modified',
|
|
255
|
-
propertyChanges: [
|
|
256
|
-
{ property: 'name', oldValue: baseChapter.name, newValue: compareChapter.name },
|
|
257
|
-
],
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return changes;
|
|
262
|
-
}
|
|
263
|
-
// Compare aggregates
|
|
264
|
-
function compareAggregates(baseAggregates, compareAggregates) {
|
|
265
|
-
const changes = [];
|
|
266
|
-
for (const [id, baseAggregate] of baseAggregates) {
|
|
267
|
-
if (!compareAggregates.has(id)) {
|
|
268
|
-
changes.push({
|
|
269
|
-
entityType: 'aggregate',
|
|
270
|
-
entityId: id,
|
|
271
|
-
entityName: baseAggregate.name,
|
|
272
|
-
changeType: 'removed',
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
for (const [id, compareAggregate] of compareAggregates) {
|
|
277
|
-
if (!baseAggregates.has(id)) {
|
|
278
|
-
changes.push({
|
|
279
|
-
entityType: 'aggregate',
|
|
280
|
-
entityId: id,
|
|
281
|
-
entityName: compareAggregate.name,
|
|
282
|
-
changeType: 'added',
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
for (const [id, baseAggregate] of baseAggregates) {
|
|
287
|
-
const compareAggregate = compareAggregates.get(id);
|
|
288
|
-
if (!compareAggregate)
|
|
289
|
-
continue;
|
|
290
|
-
const propertyChanges = [];
|
|
291
|
-
if (baseAggregate.name !== compareAggregate.name) {
|
|
292
|
-
propertyChanges.push({
|
|
293
|
-
property: 'name',
|
|
294
|
-
oldValue: baseAggregate.name,
|
|
295
|
-
newValue: compareAggregate.name,
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
if (baseAggregate.aggregateIdFieldName !== compareAggregate.aggregateIdFieldName) {
|
|
299
|
-
propertyChanges.push({
|
|
300
|
-
property: 'aggregateIdFieldName',
|
|
301
|
-
oldValue: baseAggregate.aggregateIdFieldName,
|
|
302
|
-
newValue: compareAggregate.aggregateIdFieldName,
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
if (baseAggregate.aggregateIdFieldType !== compareAggregate.aggregateIdFieldType) {
|
|
306
|
-
propertyChanges.push({
|
|
307
|
-
property: 'aggregateIdFieldType',
|
|
308
|
-
oldValue: baseAggregate.aggregateIdFieldType,
|
|
309
|
-
newValue: compareAggregate.aggregateIdFieldType,
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
// Compare eventIds
|
|
313
|
-
const baseEvents = new Set(baseAggregate.eventIds);
|
|
314
|
-
const compareEvents = new Set(compareAggregate.eventIds);
|
|
315
|
-
if (baseEvents.size !== compareEvents.size ||
|
|
316
|
-
[...baseEvents].some((e) => !compareEvents.has(e))) {
|
|
317
|
-
propertyChanges.push({
|
|
318
|
-
property: 'eventIds',
|
|
319
|
-
oldValue: baseAggregate.eventIds,
|
|
320
|
-
newValue: compareAggregate.eventIds,
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
if (propertyChanges.length > 0) {
|
|
324
|
-
changes.push({
|
|
325
|
-
entityType: 'aggregate',
|
|
326
|
-
entityId: id,
|
|
327
|
-
entityName: compareAggregate.name,
|
|
328
|
-
changeType: 'modified',
|
|
329
|
-
propertyChanges,
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return changes;
|
|
334
|
-
}
|
|
335
|
-
// Compare actors
|
|
336
|
-
function compareActors(baseActors, compareActors) {
|
|
337
|
-
const changes = [];
|
|
338
|
-
for (const [id, baseActor] of baseActors) {
|
|
339
|
-
if (!compareActors.has(id)) {
|
|
340
|
-
changes.push({
|
|
341
|
-
entityType: 'actor',
|
|
342
|
-
entityId: id,
|
|
343
|
-
entityName: baseActor.name,
|
|
344
|
-
changeType: 'removed',
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
for (const [id, compareActor] of compareActors) {
|
|
349
|
-
if (!baseActors.has(id)) {
|
|
350
|
-
changes.push({
|
|
351
|
-
entityType: 'actor',
|
|
352
|
-
entityId: id,
|
|
353
|
-
entityName: compareActor.name,
|
|
354
|
-
changeType: 'added',
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
for (const [id, baseActor] of baseActors) {
|
|
359
|
-
const compareActor = compareActors.get(id);
|
|
360
|
-
if (!compareActor)
|
|
361
|
-
continue;
|
|
362
|
-
const propertyChanges = [];
|
|
363
|
-
if (baseActor.name !== compareActor.name) {
|
|
364
|
-
propertyChanges.push({
|
|
365
|
-
property: 'name',
|
|
366
|
-
oldValue: baseActor.name,
|
|
367
|
-
newValue: compareActor.name,
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
// Compare screenIds
|
|
371
|
-
const baseScreens = new Set(baseActor.screenIds);
|
|
372
|
-
const compareScreens = new Set(compareActor.screenIds);
|
|
373
|
-
if (baseScreens.size !== compareScreens.size ||
|
|
374
|
-
[...baseScreens].some((s) => !compareScreens.has(s))) {
|
|
375
|
-
propertyChanges.push({
|
|
376
|
-
property: 'screenIds',
|
|
377
|
-
oldValue: baseActor.screenIds,
|
|
378
|
-
newValue: compareActor.screenIds,
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
if (propertyChanges.length > 0) {
|
|
382
|
-
changes.push({
|
|
383
|
-
entityType: 'actor',
|
|
384
|
-
entityId: id,
|
|
385
|
-
entityName: compareActor.name,
|
|
386
|
-
changeType: 'modified',
|
|
387
|
-
propertyChanges,
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
return changes;
|
|
392
|
-
}
|
|
393
|
-
// Compare scenarios
|
|
394
|
-
function compareScenarios(baseScenarios, compareScenarios) {
|
|
395
|
-
const changes = [];
|
|
396
|
-
for (const [id, baseScenario] of baseScenarios) {
|
|
397
|
-
if (!compareScenarios.has(id)) {
|
|
398
|
-
changes.push({
|
|
399
|
-
entityType: 'scenario',
|
|
400
|
-
entityId: id,
|
|
401
|
-
entityName: baseScenario.name,
|
|
402
|
-
changeType: 'removed',
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
for (const [id, compareScenario] of compareScenarios) {
|
|
407
|
-
if (!baseScenarios.has(id)) {
|
|
408
|
-
changes.push({
|
|
409
|
-
entityType: 'scenario',
|
|
410
|
-
entityId: id,
|
|
411
|
-
entityName: compareScenario.name,
|
|
412
|
-
changeType: 'added',
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
for (const [id, baseScenario] of baseScenarios) {
|
|
417
|
-
const compareScenario = compareScenarios.get(id);
|
|
418
|
-
if (!compareScenario)
|
|
419
|
-
continue;
|
|
420
|
-
const propertyChanges = [];
|
|
421
|
-
if (baseScenario.name !== compareScenario.name) {
|
|
422
|
-
propertyChanges.push({
|
|
423
|
-
property: 'name',
|
|
424
|
-
oldValue: baseScenario.name,
|
|
425
|
-
newValue: compareScenario.name,
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
if (baseScenario.description !== compareScenario.description) {
|
|
429
|
-
propertyChanges.push({
|
|
430
|
-
property: 'description',
|
|
431
|
-
oldValue: baseScenario.description,
|
|
432
|
-
newValue: compareScenario.description,
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
// Compare givenEvents, whenCommand, then (deep comparison)
|
|
436
|
-
if (JSON.stringify(baseScenario.givenEvents) !== JSON.stringify(compareScenario.givenEvents)) {
|
|
437
|
-
propertyChanges.push({
|
|
438
|
-
property: 'givenEvents',
|
|
439
|
-
oldValue: baseScenario.givenEvents,
|
|
440
|
-
newValue: compareScenario.givenEvents,
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
if (JSON.stringify(baseScenario.whenCommand) !== JSON.stringify(compareScenario.whenCommand)) {
|
|
444
|
-
propertyChanges.push({
|
|
445
|
-
property: 'whenCommand',
|
|
446
|
-
oldValue: baseScenario.whenCommand,
|
|
447
|
-
newValue: compareScenario.whenCommand,
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
if (JSON.stringify(baseScenario.then) !== JSON.stringify(compareScenario.then)) {
|
|
451
|
-
propertyChanges.push({
|
|
452
|
-
property: 'then',
|
|
453
|
-
oldValue: baseScenario.then,
|
|
454
|
-
newValue: compareScenario.then,
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
if (propertyChanges.length > 0) {
|
|
458
|
-
changes.push({
|
|
459
|
-
entityType: 'scenario',
|
|
460
|
-
entityId: id,
|
|
461
|
-
entityName: compareScenario.name,
|
|
462
|
-
changeType: 'modified',
|
|
463
|
-
propertyChanges,
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
return changes;
|
|
468
|
-
}
|
|
469
|
-
// Compare flows
|
|
470
|
-
function compareFlows(baseFlows, compareFlows, baseModel, compareModel) {
|
|
471
|
-
const changes = [];
|
|
472
|
-
// Helper to get entity name by ID
|
|
473
|
-
const getEntityName = (model, id) => {
|
|
474
|
-
return (model.commands.get(id)?.name ??
|
|
475
|
-
model.events.get(id)?.name ??
|
|
476
|
-
model.readModels.get(id)?.name ??
|
|
477
|
-
model.screens.get(id)?.name ??
|
|
478
|
-
model.processors.get(id)?.name ??
|
|
479
|
-
id);
|
|
480
|
-
};
|
|
481
|
-
for (const [id, baseFlow] of baseFlows) {
|
|
482
|
-
if (!compareFlows.has(id)) {
|
|
483
|
-
changes.push({
|
|
484
|
-
flowId: id,
|
|
485
|
-
flowType: baseFlow.flowType,
|
|
486
|
-
changeType: 'removed',
|
|
487
|
-
sourceName: getEntityName(baseModel, baseFlow.sourceId),
|
|
488
|
-
targetName: getEntityName(baseModel, baseFlow.targetId),
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
for (const [id, compareFlow] of compareFlows) {
|
|
493
|
-
if (!baseFlows.has(id)) {
|
|
494
|
-
changes.push({
|
|
495
|
-
flowId: id,
|
|
496
|
-
flowType: compareFlow.flowType,
|
|
497
|
-
changeType: 'added',
|
|
498
|
-
sourceName: getEntityName(compareModel, compareFlow.sourceId),
|
|
499
|
-
targetName: getEntityName(compareModel, compareFlow.targetId),
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
// Check for modified flows (mapping changes)
|
|
504
|
-
for (const [id, baseFlow] of baseFlows) {
|
|
505
|
-
const compareFlow = compareFlows.get(id);
|
|
506
|
-
if (!compareFlow)
|
|
507
|
-
continue;
|
|
508
|
-
const mappingChanges = [];
|
|
509
|
-
// Build mapping sets for comparison
|
|
510
|
-
const baseMappings = new Map(baseFlow.fieldMappings.map((m) => [`${m.sourceFieldId}->${m.targetFieldId}`, m]));
|
|
511
|
-
const compareMappings = new Map(compareFlow.fieldMappings.map((m) => [`${m.sourceFieldId}->${m.targetFieldId}`, m]));
|
|
512
|
-
for (const [key] of baseMappings) {
|
|
513
|
-
if (!compareMappings.has(key)) {
|
|
514
|
-
mappingChanges.push({ changeType: 'removed' });
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
for (const [key] of compareMappings) {
|
|
518
|
-
if (!baseMappings.has(key)) {
|
|
519
|
-
mappingChanges.push({ changeType: 'added' });
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
if (mappingChanges.length > 0) {
|
|
523
|
-
changes.push({
|
|
524
|
-
flowId: id,
|
|
525
|
-
flowType: compareFlow.flowType,
|
|
526
|
-
changeType: 'modified',
|
|
527
|
-
sourceName: getEntityName(compareModel, compareFlow.sourceId),
|
|
528
|
-
targetName: getEntityName(compareModel, compareFlow.targetId),
|
|
529
|
-
mappingChanges,
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
return changes;
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Compare two EventModels and return semantic differences.
|
|
537
|
-
* Ignores layout properties (position, size) and linked copies.
|
|
538
|
-
*/
|
|
539
|
-
export function diffModels(baseModel, compareModel) {
|
|
540
|
-
const entityChanges = [];
|
|
541
|
-
const flowChanges = [];
|
|
542
|
-
// Compare entities with fields
|
|
543
|
-
entityChanges.push(...compareEntitiesWithFields(baseModel.commands, compareModel.commands, 'command'));
|
|
544
|
-
entityChanges.push(...compareEntitiesWithFields(baseModel.events, compareModel.events, 'event'));
|
|
545
|
-
entityChanges.push(...compareEntitiesWithFields(baseModel.readModels, compareModel.readModels, 'readModel'));
|
|
546
|
-
entityChanges.push(...compareEntitiesWithFields(baseModel.screens, compareModel.screens, 'screen'));
|
|
547
|
-
entityChanges.push(...compareEntitiesWithFields(baseModel.processors, compareModel.processors, 'processor'));
|
|
548
|
-
// Compare organizational entities
|
|
549
|
-
entityChanges.push(...compareSlices(baseModel.slices, compareModel.slices));
|
|
550
|
-
entityChanges.push(...compareChapters(baseModel.chapters, compareModel.chapters));
|
|
551
|
-
entityChanges.push(...compareAggregates(baseModel.aggregates, compareModel.aggregates));
|
|
552
|
-
entityChanges.push(...compareActors(baseModel.actors, compareModel.actors));
|
|
553
|
-
entityChanges.push(...compareScenarios(baseModel.scenarios, compareModel.scenarios));
|
|
554
|
-
// Compare flows
|
|
555
|
-
flowChanges.push(...compareFlows(baseModel.flows, compareModel.flows, baseModel, compareModel));
|
|
556
|
-
// Calculate summary
|
|
557
|
-
const added = entityChanges.filter((c) => c.changeType === 'added').length +
|
|
558
|
-
flowChanges.filter((c) => c.changeType === 'added').length;
|
|
559
|
-
const removed = entityChanges.filter((c) => c.changeType === 'removed').length +
|
|
560
|
-
flowChanges.filter((c) => c.changeType === 'removed').length;
|
|
561
|
-
const modified = entityChanges.filter((c) => c.changeType === 'modified').length +
|
|
562
|
-
flowChanges.filter((c) => c.changeType === 'modified').length;
|
|
563
|
-
return {
|
|
564
|
-
summary: { added, removed, modified },
|
|
565
|
-
entityChanges,
|
|
566
|
-
flowChanges,
|
|
567
|
-
};
|
|
568
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { EventModel, RawEvent } from '../../types.js';
|
|
2
|
-
import type { MergeResult, MergeConflict, AutoResolution } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Perform a three-way merge of event models.
|
|
5
|
-
*/
|
|
6
|
-
export declare function threeWayMerge(baseModel: EventModel, oursModel: EventModel, theirsModel: EventModel, baseEvents: RawEvent[], oursEvents: RawEvent[], theirsEvents: RawEvent[], strategy?: 'ours' | 'theirs'): MergeResult;
|
|
7
|
-
export type { MergeResult, MergeConflict, AutoResolution };
|