eventmodeler 0.4.7 → 0.6.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.
Files changed (204) hide show
  1. package/dist/api/client-config.js +10 -0
  2. package/dist/api/generated/client/client.gen.js +235 -0
  3. package/dist/api/generated/client/index.js +6 -0
  4. package/dist/api/generated/client/types.gen.js +2 -0
  5. package/dist/api/generated/client/utils.gen.js +228 -0
  6. package/dist/api/generated/client.gen.js +4 -0
  7. package/dist/api/generated/core/auth.gen.js +14 -0
  8. package/dist/api/generated/core/bodySerializer.gen.js +57 -0
  9. package/dist/api/generated/core/params.gen.js +100 -0
  10. package/dist/api/generated/core/pathSerializer.gen.js +106 -0
  11. package/dist/api/generated/core/queryKeySerializer.gen.js +92 -0
  12. package/dist/api/generated/core/serverSentEvents.gen.js +133 -0
  13. package/dist/api/generated/core/types.gen.js +2 -0
  14. package/dist/api/generated/core/utils.gen.js +87 -0
  15. package/dist/api/generated/index.js +2 -0
  16. package/dist/api/generated/sdk.gen.js +4222 -0
  17. package/dist/api/generated/types.gen.js +2 -0
  18. package/dist/api/generated/zod.gen.js +7217 -0
  19. package/dist/commands/add.js +315 -0
  20. package/dist/commands/auth.js +14 -0
  21. package/dist/commands/create.js +192 -0
  22. package/dist/commands/design.js +108 -0
  23. package/dist/commands/guide.js +15 -0
  24. package/dist/commands/init.js +21 -0
  25. package/dist/commands/list-schemas.js +177 -0
  26. package/dist/commands/list.js +39 -0
  27. package/dist/commands/loop.js +101 -0
  28. package/dist/commands/map.js +40 -0
  29. package/dist/commands/mark.js +27 -0
  30. package/dist/commands/move.js +35 -0
  31. package/dist/commands/remove.js +170 -0
  32. package/dist/commands/rename.js +53 -0
  33. package/dist/commands/resize.js +30 -0
  34. package/dist/commands/search.js +14 -0
  35. package/dist/commands/set.js +199 -0
  36. package/dist/commands/show-schemas.js +259 -0
  37. package/dist/commands/show.js +56 -0
  38. package/dist/commands/summary.js +13 -0
  39. package/dist/commands/update.js +240 -0
  40. package/dist/index.js +46 -2379
  41. package/dist/lib/auth.js +1 -1
  42. package/dist/lib/config.js +0 -15
  43. package/dist/lib/excalidraw-schema.js +66 -0
  44. package/dist/lib/globals.js +8 -0
  45. package/dist/lib/model.js +11 -0
  46. package/dist/lib/project-config.js +20 -0
  47. package/dist/lib/resolve.js +59 -0
  48. package/dist/lib/scenario.js +15 -0
  49. package/dist/slices/add-scenario/index.js +2 -206
  50. package/dist/slices/guide/guides/codegen.js +1 -1
  51. package/dist/slices/guide/guides/connect-slices.js +12 -37
  52. package/dist/slices/guide/guides/create-slices.js +110 -140
  53. package/dist/slices/guide/guides/explore.js +37 -26
  54. package/dist/slices/guide/guides/information-flow.js +70 -82
  55. package/dist/slices/guide/guides/scenarios.js +82 -137
  56. package/dist/slices/guide/index.js +6 -6
  57. package/dist/slices/help/index.js +96 -0
  58. package/dist/slices/help/topics/build-codegen.js +109 -0
  59. package/dist/slices/help/topics/build-slice.js +147 -0
  60. package/dist/slices/help/topics/check-completeness.js +57 -0
  61. package/dist/slices/help/topics/connect-slices.js +99 -0
  62. package/dist/slices/help/topics/explore-model.js +112 -0
  63. package/dist/slices/help/topics/json-reference.js +188 -0
  64. package/dist/slices/help/topics/linked-copies.js +89 -0
  65. package/dist/slices/help/topics/manipulate-canvas.js +150 -0
  66. package/dist/slices/help/topics/write-scenarios.js +162 -0
  67. package/dist/slices/init/index.js +10 -4
  68. package/dist/slices/init/loop.js +60 -0
  69. package/dist/slices/login/index.js +2 -2
  70. package/dist/slices/logout/index.js +2 -2
  71. package/dist/slices/whoami/index.js +11 -36
  72. package/package.json +8 -3
  73. package/dist/api/index.d.ts +0 -285
  74. package/dist/api/index.js +0 -323
  75. package/dist/cloud/slices/index.d.ts +0 -276
  76. package/dist/cloud/slices/index.js +0 -406
  77. package/dist/eventmodeler.js +0 -5646
  78. package/dist/formatters.d.ts +0 -17
  79. package/dist/formatters.js +0 -482
  80. package/dist/index.d.ts +0 -2
  81. package/dist/lib/auth.d.ts +0 -24
  82. package/dist/lib/backend.d.ts +0 -43
  83. package/dist/lib/backend.js +0 -73
  84. package/dist/lib/chapter-utils.d.ts +0 -13
  85. package/dist/lib/chapter-utils.js +0 -71
  86. package/dist/lib/cloud-client.d.ts +0 -69
  87. package/dist/lib/cloud-client.js +0 -364
  88. package/dist/lib/config.d.ts +0 -30
  89. package/dist/lib/diff/merge-rules.d.ts +0 -45
  90. package/dist/lib/diff/merge-rules.js +0 -210
  91. package/dist/lib/diff/model-differ.d.ts +0 -8
  92. package/dist/lib/diff/model-differ.js +0 -568
  93. package/dist/lib/diff/three-way-merge.d.ts +0 -7
  94. package/dist/lib/diff/three-way-merge.js +0 -390
  95. package/dist/lib/diff/types.d.ts +0 -75
  96. package/dist/lib/diff/types.js +0 -1
  97. package/dist/lib/element-lookup.d.ts +0 -58
  98. package/dist/lib/element-lookup.js +0 -126
  99. package/dist/lib/file-loader.d.ts +0 -8
  100. package/dist/lib/file-loader.js +0 -108
  101. package/dist/lib/flow-utils.d.ts +0 -53
  102. package/dist/lib/flow-utils.js +0 -348
  103. package/dist/lib/format.d.ts +0 -10
  104. package/dist/lib/format.js +0 -23
  105. package/dist/lib/project-config.d.ts +0 -27
  106. package/dist/lib/slice-utils.d.ts +0 -59
  107. package/dist/lib/slice-utils.js +0 -140
  108. package/dist/local/slices/index.d.ts +0 -11
  109. package/dist/local/slices/index.js +0 -13
  110. package/dist/projection.d.ts +0 -3
  111. package/dist/projection.js +0 -828
  112. package/dist/slices/add-field/index.d.ts +0 -8
  113. package/dist/slices/add-field/index.js +0 -211
  114. package/dist/slices/add-scenario/index.d.ts +0 -27
  115. package/dist/slices/codegen-chapter-events/index.d.ts +0 -2
  116. package/dist/slices/codegen-chapter-events/index.js +0 -145
  117. package/dist/slices/codegen-slice/index.d.ts +0 -2
  118. package/dist/slices/codegen-slice/index.js +0 -448
  119. package/dist/slices/create-automation-slice/index.d.ts +0 -2
  120. package/dist/slices/create-automation-slice/index.js +0 -304
  121. package/dist/slices/create-flow/index.d.ts +0 -2
  122. package/dist/slices/create-flow/index.js +0 -183
  123. package/dist/slices/create-state-change-slice/index.d.ts +0 -2
  124. package/dist/slices/create-state-change-slice/index.js +0 -263
  125. package/dist/slices/create-state-view-slice/index.d.ts +0 -2
  126. package/dist/slices/create-state-view-slice/index.js +0 -128
  127. package/dist/slices/diff/index.d.ts +0 -11
  128. package/dist/slices/diff/index.js +0 -293
  129. package/dist/slices/export-eventmodel-to-json/index.d.ts +0 -2
  130. package/dist/slices/export-eventmodel-to-json/index.js +0 -355
  131. package/dist/slices/git/index.d.ts +0 -2
  132. package/dist/slices/git/index.js +0 -125
  133. package/dist/slices/guide/guides/codegen.d.ts +0 -5
  134. package/dist/slices/guide/guides/connect-slices.d.ts +0 -5
  135. package/dist/slices/guide/guides/create-slices.d.ts +0 -5
  136. package/dist/slices/guide/guides/explore.d.ts +0 -5
  137. package/dist/slices/guide/guides/information-flow.d.ts +0 -5
  138. package/dist/slices/guide/guides/scenarios.d.ts +0 -5
  139. package/dist/slices/guide/index.d.ts +0 -1
  140. package/dist/slices/import/index.d.ts +0 -8
  141. package/dist/slices/import/index.js +0 -63
  142. package/dist/slices/init/index.d.ts +0 -5
  143. package/dist/slices/list-chapters/index.d.ts +0 -3
  144. package/dist/slices/list-chapters/index.js +0 -21
  145. package/dist/slices/list-commands/index.d.ts +0 -3
  146. package/dist/slices/list-commands/index.js +0 -20
  147. package/dist/slices/list-events/index.d.ts +0 -3
  148. package/dist/slices/list-events/index.js +0 -98
  149. package/dist/slices/list-processors/index.d.ts +0 -3
  150. package/dist/slices/list-processors/index.js +0 -20
  151. package/dist/slices/list-readmodels/index.d.ts +0 -3
  152. package/dist/slices/list-readmodels/index.js +0 -21
  153. package/dist/slices/list-scenarios/index.d.ts +0 -3
  154. package/dist/slices/list-scenarios/index.js +0 -35
  155. package/dist/slices/list-screens/index.d.ts +0 -3
  156. package/dist/slices/list-screens/index.js +0 -47
  157. package/dist/slices/list-slices/index.d.ts +0 -3
  158. package/dist/slices/list-slices/index.js +0 -35
  159. package/dist/slices/login/index.d.ts +0 -1
  160. package/dist/slices/logout/index.d.ts +0 -1
  161. package/dist/slices/map-fields/index.d.ts +0 -2
  162. package/dist/slices/map-fields/index.js +0 -269
  163. package/dist/slices/mark-slice-status/index.d.ts +0 -2
  164. package/dist/slices/mark-slice-status/index.js +0 -31
  165. package/dist/slices/merge/index.d.ts +0 -19
  166. package/dist/slices/merge/index.js +0 -147
  167. package/dist/slices/open-app/index.d.ts +0 -1
  168. package/dist/slices/remove-field/index.d.ts +0 -8
  169. package/dist/slices/remove-field/index.js +0 -167
  170. package/dist/slices/remove-scenario/index.d.ts +0 -2
  171. package/dist/slices/remove-scenario/index.js +0 -77
  172. package/dist/slices/search/index.d.ts +0 -3
  173. package/dist/slices/search/index.js +0 -302
  174. package/dist/slices/show-actor/index.d.ts +0 -4
  175. package/dist/slices/show-actor/index.js +0 -115
  176. package/dist/slices/show-aggregate/index.d.ts +0 -3
  177. package/dist/slices/show-aggregate/index.js +0 -108
  178. package/dist/slices/show-aggregate-completeness/index.d.ts +0 -4
  179. package/dist/slices/show-aggregate-completeness/index.js +0 -181
  180. package/dist/slices/show-chapter/index.d.ts +0 -3
  181. package/dist/slices/show-chapter/index.js +0 -195
  182. package/dist/slices/show-command/index.d.ts +0 -3
  183. package/dist/slices/show-command/index.js +0 -133
  184. package/dist/slices/show-completeness/index.d.ts +0 -4
  185. package/dist/slices/show-completeness/index.js +0 -731
  186. package/dist/slices/show-event/index.d.ts +0 -3
  187. package/dist/slices/show-event/index.js +0 -118
  188. package/dist/slices/show-model-summary/index.d.ts +0 -3
  189. package/dist/slices/show-model-summary/index.js +0 -31
  190. package/dist/slices/show-processor/index.d.ts +0 -3
  191. package/dist/slices/show-processor/index.js +0 -111
  192. package/dist/slices/show-readmodel/index.d.ts +0 -3
  193. package/dist/slices/show-readmodel/index.js +0 -158
  194. package/dist/slices/show-scenario/index.d.ts +0 -3
  195. package/dist/slices/show-scenario/index.js +0 -196
  196. package/dist/slices/show-screen/index.d.ts +0 -3
  197. package/dist/slices/show-screen/index.js +0 -139
  198. package/dist/slices/show-slice/index.d.ts +0 -3
  199. package/dist/slices/show-slice/index.js +0 -696
  200. package/dist/slices/update-field/index.d.ts +0 -15
  201. package/dist/slices/update-field/index.js +0 -208
  202. package/dist/slices/whoami/index.d.ts +0 -2
  203. package/dist/types.d.ts +0 -195
  204. 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 };