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.
Files changed (150) hide show
  1. package/dist/index.js +6776 -2132
  2. package/package.json +11 -5
  3. package/dist/api/index.d.ts +0 -285
  4. package/dist/api/index.js +0 -323
  5. package/dist/cloud/slices/index.d.ts +0 -276
  6. package/dist/cloud/slices/index.js +0 -406
  7. package/dist/eventmodeler.js +0 -5646
  8. package/dist/formatters.d.ts +0 -17
  9. package/dist/formatters.js +0 -482
  10. package/dist/index.d.ts +0 -2
  11. package/dist/lib/auth.d.ts +0 -24
  12. package/dist/lib/auth.js +0 -331
  13. package/dist/lib/backend.d.ts +0 -43
  14. package/dist/lib/backend.js +0 -73
  15. package/dist/lib/chapter-utils.d.ts +0 -13
  16. package/dist/lib/chapter-utils.js +0 -71
  17. package/dist/lib/cloud-client.d.ts +0 -69
  18. package/dist/lib/cloud-client.js +0 -364
  19. package/dist/lib/config.d.ts +0 -30
  20. package/dist/lib/config.js +0 -95
  21. package/dist/lib/diff/merge-rules.d.ts +0 -45
  22. package/dist/lib/diff/merge-rules.js +0 -210
  23. package/dist/lib/diff/model-differ.d.ts +0 -8
  24. package/dist/lib/diff/model-differ.js +0 -568
  25. package/dist/lib/diff/three-way-merge.d.ts +0 -7
  26. package/dist/lib/diff/three-way-merge.js +0 -390
  27. package/dist/lib/diff/types.d.ts +0 -75
  28. package/dist/lib/diff/types.js +0 -1
  29. package/dist/lib/element-lookup.d.ts +0 -58
  30. package/dist/lib/element-lookup.js +0 -126
  31. package/dist/lib/file-loader.d.ts +0 -8
  32. package/dist/lib/file-loader.js +0 -108
  33. package/dist/lib/flow-utils.d.ts +0 -53
  34. package/dist/lib/flow-utils.js +0 -348
  35. package/dist/lib/format.d.ts +0 -10
  36. package/dist/lib/format.js +0 -23
  37. package/dist/lib/project-config.d.ts +0 -27
  38. package/dist/lib/project-config.js +0 -83
  39. package/dist/lib/slice-utils.d.ts +0 -59
  40. package/dist/lib/slice-utils.js +0 -140
  41. package/dist/local/slices/index.d.ts +0 -11
  42. package/dist/local/slices/index.js +0 -13
  43. package/dist/projection.d.ts +0 -3
  44. package/dist/projection.js +0 -828
  45. package/dist/slices/add-field/index.d.ts +0 -8
  46. package/dist/slices/add-field/index.js +0 -211
  47. package/dist/slices/add-scenario/index.d.ts +0 -27
  48. package/dist/slices/add-scenario/index.js +0 -307
  49. package/dist/slices/codegen-chapter-events/index.d.ts +0 -2
  50. package/dist/slices/codegen-chapter-events/index.js +0 -145
  51. package/dist/slices/codegen-slice/index.d.ts +0 -2
  52. package/dist/slices/codegen-slice/index.js +0 -448
  53. package/dist/slices/create-automation-slice/index.d.ts +0 -2
  54. package/dist/slices/create-automation-slice/index.js +0 -304
  55. package/dist/slices/create-flow/index.d.ts +0 -2
  56. package/dist/slices/create-flow/index.js +0 -183
  57. package/dist/slices/create-state-change-slice/index.d.ts +0 -2
  58. package/dist/slices/create-state-change-slice/index.js +0 -263
  59. package/dist/slices/create-state-view-slice/index.d.ts +0 -2
  60. package/dist/slices/create-state-view-slice/index.js +0 -128
  61. package/dist/slices/diff/index.d.ts +0 -11
  62. package/dist/slices/diff/index.js +0 -293
  63. package/dist/slices/export-eventmodel-to-json/index.d.ts +0 -2
  64. package/dist/slices/export-eventmodel-to-json/index.js +0 -355
  65. package/dist/slices/git/index.d.ts +0 -2
  66. package/dist/slices/git/index.js +0 -125
  67. package/dist/slices/guide/guides/codegen.d.ts +0 -5
  68. package/dist/slices/guide/guides/codegen.js +0 -339
  69. package/dist/slices/guide/guides/connect-slices.d.ts +0 -5
  70. package/dist/slices/guide/guides/connect-slices.js +0 -202
  71. package/dist/slices/guide/guides/create-slices.d.ts +0 -5
  72. package/dist/slices/guide/guides/create-slices.js +0 -303
  73. package/dist/slices/guide/guides/explore.d.ts +0 -5
  74. package/dist/slices/guide/guides/explore.js +0 -251
  75. package/dist/slices/guide/guides/information-flow.d.ts +0 -5
  76. package/dist/slices/guide/guides/information-flow.js +0 -318
  77. package/dist/slices/guide/guides/scenarios.d.ts +0 -5
  78. package/dist/slices/guide/guides/scenarios.js +0 -269
  79. package/dist/slices/guide/index.d.ts +0 -1
  80. package/dist/slices/guide/index.js +0 -40
  81. package/dist/slices/import/index.d.ts +0 -8
  82. package/dist/slices/import/index.js +0 -63
  83. package/dist/slices/init/index.d.ts +0 -5
  84. package/dist/slices/init/index.js +0 -80
  85. package/dist/slices/list-chapters/index.d.ts +0 -3
  86. package/dist/slices/list-chapters/index.js +0 -21
  87. package/dist/slices/list-commands/index.d.ts +0 -3
  88. package/dist/slices/list-commands/index.js +0 -20
  89. package/dist/slices/list-events/index.d.ts +0 -3
  90. package/dist/slices/list-events/index.js +0 -98
  91. package/dist/slices/list-processors/index.d.ts +0 -3
  92. package/dist/slices/list-processors/index.js +0 -20
  93. package/dist/slices/list-readmodels/index.d.ts +0 -3
  94. package/dist/slices/list-readmodels/index.js +0 -21
  95. package/dist/slices/list-scenarios/index.d.ts +0 -3
  96. package/dist/slices/list-scenarios/index.js +0 -35
  97. package/dist/slices/list-screens/index.d.ts +0 -3
  98. package/dist/slices/list-screens/index.js +0 -47
  99. package/dist/slices/list-slices/index.d.ts +0 -3
  100. package/dist/slices/list-slices/index.js +0 -35
  101. package/dist/slices/login/index.d.ts +0 -1
  102. package/dist/slices/login/index.js +0 -20
  103. package/dist/slices/logout/index.d.ts +0 -1
  104. package/dist/slices/logout/index.js +0 -14
  105. package/dist/slices/map-fields/index.d.ts +0 -2
  106. package/dist/slices/map-fields/index.js +0 -269
  107. package/dist/slices/mark-slice-status/index.d.ts +0 -2
  108. package/dist/slices/mark-slice-status/index.js +0 -31
  109. package/dist/slices/merge/index.d.ts +0 -19
  110. package/dist/slices/merge/index.js +0 -147
  111. package/dist/slices/open-app/index.d.ts +0 -1
  112. package/dist/slices/open-app/index.js +0 -36
  113. package/dist/slices/remove-field/index.d.ts +0 -8
  114. package/dist/slices/remove-field/index.js +0 -167
  115. package/dist/slices/remove-scenario/index.d.ts +0 -2
  116. package/dist/slices/remove-scenario/index.js +0 -77
  117. package/dist/slices/search/index.d.ts +0 -3
  118. package/dist/slices/search/index.js +0 -302
  119. package/dist/slices/show-actor/index.d.ts +0 -4
  120. package/dist/slices/show-actor/index.js +0 -115
  121. package/dist/slices/show-aggregate/index.d.ts +0 -3
  122. package/dist/slices/show-aggregate/index.js +0 -108
  123. package/dist/slices/show-aggregate-completeness/index.d.ts +0 -4
  124. package/dist/slices/show-aggregate-completeness/index.js +0 -181
  125. package/dist/slices/show-chapter/index.d.ts +0 -3
  126. package/dist/slices/show-chapter/index.js +0 -195
  127. package/dist/slices/show-command/index.d.ts +0 -3
  128. package/dist/slices/show-command/index.js +0 -133
  129. package/dist/slices/show-completeness/index.d.ts +0 -4
  130. package/dist/slices/show-completeness/index.js +0 -731
  131. package/dist/slices/show-event/index.d.ts +0 -3
  132. package/dist/slices/show-event/index.js +0 -118
  133. package/dist/slices/show-model-summary/index.d.ts +0 -3
  134. package/dist/slices/show-model-summary/index.js +0 -31
  135. package/dist/slices/show-processor/index.d.ts +0 -3
  136. package/dist/slices/show-processor/index.js +0 -111
  137. package/dist/slices/show-readmodel/index.d.ts +0 -3
  138. package/dist/slices/show-readmodel/index.js +0 -158
  139. package/dist/slices/show-scenario/index.d.ts +0 -3
  140. package/dist/slices/show-scenario/index.js +0 -196
  141. package/dist/slices/show-screen/index.d.ts +0 -3
  142. package/dist/slices/show-screen/index.js +0 -139
  143. package/dist/slices/show-slice/index.d.ts +0 -3
  144. package/dist/slices/show-slice/index.js +0 -696
  145. package/dist/slices/update-field/index.d.ts +0 -15
  146. package/dist/slices/update-field/index.js +0 -208
  147. package/dist/slices/whoami/index.d.ts +0 -2
  148. package/dist/slices/whoami/index.js +0 -44
  149. package/dist/types.d.ts +0 -195
  150. package/dist/types.js +0 -1
@@ -1,210 +0,0 @@
1
- /**
2
- * Merge rules for Event Model conflicts.
3
- *
4
- * Based on analysis of user workflows, these rules define how to handle
5
- * different types of conflicts when merging two branches.
6
- */
7
- /**
8
- * Slice status priority order.
9
- * Higher priority wins in auto-resolution.
10
- */
11
- const SLICE_STATUS_PRIORITY = {
12
- 'done': 4,
13
- 'in-progress': 3,
14
- 'blocked': 2,
15
- 'created': 1,
16
- };
17
- /**
18
- * Properties that can be auto-resolved with last-write-wins.
19
- * These are layout/visual properties that don't affect semantics.
20
- */
21
- const LAYOUT_PROPERTIES = new Set([
22
- 'position',
23
- 'width',
24
- 'height',
25
- 'size',
26
- 'x',
27
- 'y',
28
- ]);
29
- /**
30
- * Determine how to resolve a property conflict.
31
- */
32
- export function resolvePropertyConflict(property, oursValue, theirsValue, entityType) {
33
- // Layout properties: auto-resolve with theirs (last-write-wins)
34
- if (LAYOUT_PROPERTIES.has(property)) {
35
- return { type: 'auto', action: 'layout-use-theirs' };
36
- }
37
- // Slice status: use priority order
38
- if (property === 'status' && entityType === 'slice') {
39
- const oursPriority = SLICE_STATUS_PRIORITY[oursValue] ?? 0;
40
- const theirsPriority = SLICE_STATUS_PRIORITY[theirsValue] ?? 0;
41
- if (oursPriority >= theirsPriority) {
42
- return { type: 'auto', action: 'status-priority-ours' };
43
- }
44
- else {
45
- return { type: 'auto', action: 'status-priority-theirs' };
46
- }
47
- }
48
- // Name conflicts: hard conflict
49
- if (property === 'name') {
50
- return { type: 'hard', reason: `Both renamed to different values` };
51
- }
52
- // nodeIds/eventIds/screenIds: can merge (include both)
53
- if (property === 'nodeIds' || property === 'eventIds' || property === 'screenIds') {
54
- return { type: 'auto', action: 'merge-arrays' };
55
- }
56
- // Scenario parts: hard conflict
57
- if (property === 'givenEvents' || property === 'whenCommand' || property === 'then' || property === 'description') {
58
- return { type: 'hard', reason: `Both modified ${property}` };
59
- }
60
- // Default: hard conflict
61
- return { type: 'hard', reason: `Both modified ${property}` };
62
- }
63
- /**
64
- * Determine how to resolve a field conflict.
65
- */
66
- export function resolveFieldConflict(oursChange, theirsChange) {
67
- const fieldPath = oursChange.fieldPath;
68
- // Both added same field
69
- if (oursChange.changeType === 'added' && theirsChange.changeType === 'added') {
70
- const oursField = oursChange.newValue;
71
- const theirsField = theirsChange.newValue;
72
- // Same type: auto-resolve (keep one)
73
- if (oursField && theirsField && fieldsCompatible(oursField, theirsField)) {
74
- return { type: 'auto', action: 'both-added-compatible' };
75
- }
76
- // Different types: hard conflict
77
- return { type: 'hard', reason: `Both added field "${fieldPath}" with different types` };
78
- }
79
- // Both removed same field
80
- if (oursChange.changeType === 'removed' && theirsChange.changeType === 'removed') {
81
- return { type: 'auto', action: 'both-removed' };
82
- }
83
- // One removed, other modified
84
- if ((oursChange.changeType === 'removed' && theirsChange.changeType === 'modified') ||
85
- (oursChange.changeType === 'modified' && theirsChange.changeType === 'removed')) {
86
- return { type: 'hard', reason: `Field "${fieldPath}": one removed, other modified` };
87
- }
88
- // Both modified same field
89
- if (oursChange.changeType === 'modified' && theirsChange.changeType === 'modified') {
90
- const oursField = oursChange.newValue;
91
- const theirsField = theirsChange.newValue;
92
- // Same change: auto-resolve
93
- if (oursField && theirsField && fieldsEqual(oursField, theirsField)) {
94
- return { type: 'auto', action: 'both-modified-identically' };
95
- }
96
- // Different changes: hard conflict
97
- return { type: 'hard', reason: `Both modified field "${fieldPath}" differently` };
98
- }
99
- return { type: 'hard', reason: `Unexpected field conflict on "${fieldPath}"` };
100
- }
101
- /**
102
- * Check if two fields are semantically equal.
103
- */
104
- function fieldsEqual(a, b) {
105
- if (a.name !== b.name)
106
- return false;
107
- if (a.fieldType !== b.fieldType)
108
- return false;
109
- if (a.isList !== b.isList)
110
- return false;
111
- if (a.isGenerated !== b.isGenerated)
112
- return false;
113
- if (a.isOptional !== b.isOptional)
114
- return false;
115
- if (a.isUserInput !== b.isUserInput)
116
- return false;
117
- // Compare subfields
118
- const aSubfields = a.subfields ?? [];
119
- const bSubfields = b.subfields ?? [];
120
- if (aSubfields.length !== bSubfields.length)
121
- return false;
122
- for (let i = 0; i < aSubfields.length; i++) {
123
- if (!fieldsEqual(aSubfields[i], bSubfields[i]))
124
- return false;
125
- }
126
- return true;
127
- }
128
- /**
129
- * Check if two fields are compatible (can be merged).
130
- * Compatible means same name and type, even if other properties differ.
131
- */
132
- function fieldsCompatible(a, b) {
133
- if (a.name !== b.name)
134
- return false;
135
- if (a.fieldType !== b.fieldType)
136
- return false;
137
- if (a.isList !== b.isList)
138
- return false;
139
- return true;
140
- }
141
- /**
142
- * Merge two arrays (e.g., nodeIds) removing duplicates.
143
- */
144
- export function mergeArrays(base, ours, theirs) {
145
- const baseSet = new Set(base);
146
- const result = new Set(base);
147
- // Add items from ours that weren't in base
148
- for (const item of ours) {
149
- if (!baseSet.has(item)) {
150
- result.add(item);
151
- }
152
- }
153
- // Add items from theirs that weren't in base
154
- for (const item of theirs) {
155
- if (!baseSet.has(item)) {
156
- result.add(item);
157
- }
158
- }
159
- // Remove items deleted in ours
160
- for (const item of base) {
161
- if (!ours.includes(item)) {
162
- result.delete(item);
163
- }
164
- }
165
- // Remove items deleted in theirs
166
- for (const item of base) {
167
- if (!theirs.includes(item)) {
168
- result.delete(item);
169
- }
170
- }
171
- return [...result];
172
- }
173
- /**
174
- * Check if an entity change affects only layout properties.
175
- */
176
- export function isLayoutOnlyChange(change) {
177
- if (change.changeType !== 'modified')
178
- return false;
179
- if (change.fieldChanges && change.fieldChanges.length > 0)
180
- return false;
181
- if (!change.propertyChanges)
182
- return true;
183
- return change.propertyChanges.every(p => LAYOUT_PROPERTIES.has(p.property));
184
- }
185
- /**
186
- * Categorize fields changes for merge.
187
- */
188
- export function categorizeFieldChanges(oursChanges, theirsChanges) {
189
- const oursMap = new Map(oursChanges.map(c => [c.fieldPath, c]));
190
- const theirsMap = new Map(theirsChanges.map(c => [c.fieldPath, c]));
191
- const oursOnly = [];
192
- const theirsOnly = [];
193
- const conflicts = [];
194
- for (const [path, oursChange] of oursMap) {
195
- const theirsChange = theirsMap.get(path);
196
- if (theirsChange) {
197
- const resolution = resolveFieldConflict(oursChange, theirsChange);
198
- conflicts.push({ ours: oursChange, theirs: theirsChange, resolution });
199
- }
200
- else {
201
- oursOnly.push(oursChange);
202
- }
203
- }
204
- for (const [path, theirsChange] of theirsMap) {
205
- if (!oursMap.has(path)) {
206
- theirsOnly.push(theirsChange);
207
- }
208
- }
209
- return { oursOnly, theirsOnly, conflicts };
210
- }
@@ -1,8 +0,0 @@
1
- import type { EventModel } from '../../types.js';
2
- import type { DiffResult, EntityChange, FieldChange, FlowChange } from './types.js';
3
- /**
4
- * Compare two EventModels and return semantic differences.
5
- * Ignores layout properties (position, size) and linked copies.
6
- */
7
- export declare function diffModels(baseModel: EventModel, compareModel: EventModel): DiffResult;
8
- export type { DiffResult, EntityChange, FieldChange, FlowChange };