eventmodeler 0.5.0 → 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 +38 -38
  52. package/dist/slices/guide/guides/create-slices.js +110 -140
  53. package/dist/slices/guide/guides/explore.js +37 -50
  54. package/dist/slices/guide/guides/information-flow.js +70 -84
  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
package/dist/api/index.js DELETED
@@ -1,323 +0,0 @@
1
- // API client — thin wrappers that call backend CLI endpoints.
2
- // The backend does all the heavy lifting (name resolution, data denormalization).
3
- import { getBackendUrl } from '../lib/config.js';
4
- import { getValidAccessToken } from '../lib/auth.js';
5
- // =============================================================================
6
- // HTTP Client for CLI endpoints
7
- // =============================================================================
8
- /**
9
- * Handle HTTP error responses with user-friendly messages.
10
- * Tries to extract error detail from response body, falls back to status-based messages.
11
- */
12
- async function handleHttpError(response, path) {
13
- const text = await response.text().catch(() => '');
14
- const errorDetail = extractErrorDetail(text);
15
- switch (response.status) {
16
- case 401:
17
- throw new Error(`Authentication required. Run 'eventmodeler login' to authenticate.` +
18
- (errorDetail ? `\n\nOriginal error: ${errorDetail}` : ''));
19
- case 403:
20
- throw new Error(`Permission denied. You may not have access to this model, or you need editor permission for this action.` +
21
- (errorDetail ? `\n\nOriginal error: ${errorDetail}` : ''));
22
- case 404:
23
- throw new Error(errorDetail || `Not found: ${path}`);
24
- default:
25
- throw new Error(errorDetail || `HTTP ${response.status}: ${response.statusText}`);
26
- }
27
- }
28
- const GENERIC_ERROR_MESSAGES = new Set([
29
- 'internal server error',
30
- 'bad request',
31
- 'unauthorized',
32
- 'forbidden',
33
- 'not found',
34
- ]);
35
- function isGenericErrorMessage(value) {
36
- return GENERIC_ERROR_MESSAGES.has(value.trim().toLowerCase());
37
- }
38
- function toStringValue(value) {
39
- return typeof value === 'string' ? value.trim() : '';
40
- }
41
- function collectCandidateMessages(node, out) {
42
- if (!node || typeof node !== 'object')
43
- return;
44
- const obj = node;
45
- // Prefer richer fields before generic "error".
46
- for (const key of ['message', 'detail', 'reason', 'description', 'title', 'error']) {
47
- const value = toStringValue(obj[key]);
48
- if (value)
49
- out.push(value);
50
- }
51
- const errors = obj.errors;
52
- if (Array.isArray(errors)) {
53
- for (const entry of errors) {
54
- if (typeof entry === 'string') {
55
- const value = entry.trim();
56
- if (value)
57
- out.push(value);
58
- }
59
- else if (entry && typeof entry === 'object') {
60
- collectCandidateMessages(entry, out);
61
- }
62
- }
63
- }
64
- const cause = obj.cause;
65
- if (cause && typeof cause === 'object') {
66
- collectCandidateMessages(cause, out);
67
- }
68
- }
69
- function extractErrorDetail(text) {
70
- const body = text.trim();
71
- if (!body)
72
- return '';
73
- try {
74
- const parsed = JSON.parse(body);
75
- if (typeof parsed === 'string') {
76
- return parsed.trim();
77
- }
78
- const candidates = [];
79
- collectCandidateMessages(parsed, candidates);
80
- if (candidates.length > 0) {
81
- const specific = candidates.find((value) => !isGenericErrorMessage(value));
82
- return specific ?? candidates[0];
83
- }
84
- }
85
- catch {
86
- // Not JSON. Fall back to plain text below.
87
- }
88
- // Avoid dumping entire HTML pages from reverse proxies.
89
- if (body.startsWith('<')) {
90
- const title = body.match(/<title>([^<]+)<\/title>/i)?.[1]?.trim();
91
- return title && !isGenericErrorMessage(title) ? title : '';
92
- }
93
- return body;
94
- }
95
- async function cliGet(path, params) {
96
- const backendUrl = getBackendUrl();
97
- const accessToken = await getValidAccessToken();
98
- // Build query string manually using encodeURIComponent (uses %20 for spaces, not +)
99
- const queryParts = Object.entries(params)
100
- .filter(([_, value]) => value !== undefined)
101
- .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
102
- const queryString = queryParts.length > 0 ? `?${queryParts.join('&')}` : '';
103
- const fullUrl = `${backendUrl}${path}${queryString}`;
104
- const response = await fetch(fullUrl, {
105
- method: 'GET',
106
- headers: {
107
- Accept: 'application/json',
108
- ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),
109
- },
110
- });
111
- if (!response.ok) {
112
- await handleHttpError(response, path);
113
- }
114
- const text = await response.text();
115
- if (!text.trim()) {
116
- throw new Error(`Empty response from ${path}`);
117
- }
118
- try {
119
- return JSON.parse(text);
120
- }
121
- catch (error) {
122
- const message = error instanceof Error ? error.message : String(error);
123
- const snippet = text.slice(0, 200);
124
- throw new Error(`Invalid JSON from ${path}: ${message}. Body: ${snippet}`);
125
- }
126
- }
127
- async function cliPost(path, body) {
128
- const backendUrl = getBackendUrl();
129
- const accessToken = await getValidAccessToken();
130
- const response = await fetch(`${backendUrl}${path}`, {
131
- method: 'POST',
132
- headers: {
133
- 'Content-Type': 'application/json',
134
- Accept: 'application/json',
135
- ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),
136
- },
137
- body: JSON.stringify(body),
138
- });
139
- if (!response.ok) {
140
- await handleHttpError(response, path);
141
- }
142
- const text = await response.text();
143
- if (!text.trim()) {
144
- throw new Error(`Empty response from ${path}`);
145
- }
146
- try {
147
- return JSON.parse(text);
148
- }
149
- catch (error) {
150
- const message = error instanceof Error ? error.message : String(error);
151
- const snippet = text.slice(0, 200);
152
- throw new Error(`Invalid JSON from ${path}: ${message}. Body: ${snippet}`);
153
- }
154
- }
155
- export async function listModels() {
156
- return cliGet('/cli/list-models', {});
157
- }
158
- // =============================================================================
159
- // Query Functions (read-only, return denormalized data)
160
- // =============================================================================
161
- export async function listSlices(modelId, format = 'xml', chapterFilter) {
162
- const params = { modelId };
163
- if (chapterFilter)
164
- params.chapter = chapterFilter;
165
- return cliGetText('/cli/list-slices', params, format);
166
- }
167
- export async function listEvents(modelId, format = 'xml') {
168
- return cliGetText('/cli/list-events', { modelId }, format);
169
- }
170
- export async function listCommands(modelId, format = 'xml') {
171
- return cliGetText('/cli/list-commands', { modelId }, format);
172
- }
173
- export async function listChapters(modelId, format = 'xml') {
174
- return cliGetText('/cli/list-chapters', { modelId }, format);
175
- }
176
- export async function listActors(modelId, format = 'xml') {
177
- return cliGetText('/cli/list-actors', { modelId }, format);
178
- }
179
- export async function search(modelId, term) {
180
- return cliGet('/cli/search', { modelId, term });
181
- }
182
- export async function getSummary(modelId) {
183
- return cliGet('/cli/summary', { modelId });
184
- }
185
- export async function markSliceStatus(modelId, sliceName, status) {
186
- return cliPost('/cli/mark-slice-status', { modelId, sliceName, status });
187
- }
188
- export async function addField(modelId, elementName, field) {
189
- return cliPost('/cli/add-field', { modelId, elementName, field });
190
- }
191
- export async function removeField(modelId, elementName, fieldName) {
192
- return cliPost('/cli/remove-field', { modelId, elementName, fieldName });
193
- }
194
- export async function updateField(modelId, elementName, fieldName, updates) {
195
- return cliPost('/cli/update-field', { modelId, elementName, fieldName, updates });
196
- }
197
- export async function mapFields(modelId, sourceName, targetName, mappings) {
198
- return cliPost('/cli/map-fields', { modelId, sourceName, targetName, mappings });
199
- }
200
- export async function createScenario(modelId, sliceName, scenario) {
201
- return cliPost('/cli/create-scenario', { modelId, sliceName, scenario });
202
- }
203
- export async function removeScenario(modelId, scenarioName, sliceName) {
204
- return cliPost('/cli/remove-scenario', { modelId, scenarioName, sliceName });
205
- }
206
- export async function createFlow(modelId, fromName, toName) {
207
- return cliPost('/cli/create-flow', { modelId, fromName, toName });
208
- }
209
- export async function removeFlow(modelId, fromName, toName) {
210
- return cliPost('/cli/remove-flow', { modelId, fromName, toName });
211
- }
212
- export async function createStateChangeSlice(modelId, input) {
213
- return cliPost('/cli/create-state-change-slice', { modelId, ...input });
214
- }
215
- export async function createAutomationSlice(modelId, input) {
216
- return cliPost('/cli/create-automation-slice', { modelId, ...input });
217
- }
218
- export async function createStateViewSlice(modelId, input) {
219
- return cliPost('/cli/create-state-view-slice', { modelId, ...input });
220
- }
221
- // =============================================================================
222
- // View Functions (read-only, return formatted XML/JSON strings)
223
- // =============================================================================
224
- // Maps format to Accept header media type for content negotiation with the backend
225
- function formatToMediaType(format) {
226
- return format === 'xml' ? 'application/xml' : 'application/json';
227
- }
228
- // Helper for view queries that return text (XML or JSON string).
229
- // Uses Accept header for content negotiation instead of a format query param.
230
- async function cliGetText(path, params, format) {
231
- const backendUrl = getBackendUrl();
232
- const accessToken = await getValidAccessToken();
233
- // Build query string manually using encodeURIComponent (uses %20 for spaces, not +)
234
- // Some servers don't decode + as space in query parameters
235
- const queryParts = Object.entries(params)
236
- .filter(([_, value]) => value !== undefined)
237
- .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
238
- const queryString = queryParts.length > 0 ? `?${queryParts.join('&')}` : '';
239
- const fullUrl = `${backendUrl}${path}${queryString}`;
240
- const response = await fetch(fullUrl, {
241
- method: 'GET',
242
- headers: {
243
- Accept: formatToMediaType(format),
244
- ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),
245
- },
246
- });
247
- if (!response.ok) {
248
- await handleHttpError(response, path);
249
- }
250
- const text = await response.text();
251
- return text.trimEnd();
252
- }
253
- export async function showSlice(modelId, sliceName, format = 'xml') {
254
- return cliGetText('/cli/show-slice', { modelId, name: sliceName }, format);
255
- }
256
- export async function showEvent(modelId, eventName, format = 'xml') {
257
- return cliGetText('/cli/show-event', { modelId, name: eventName }, format);
258
- }
259
- export async function showCommand(modelId, commandName, format = 'xml') {
260
- return cliGetText('/cli/show-command', { modelId, name: commandName }, format);
261
- }
262
- export async function showChapter(modelId, chapterName, format = 'xml') {
263
- return cliGetText('/cli/show-chapter', { modelId, name: chapterName }, format);
264
- }
265
- export async function showActor(modelId, actorName, format = 'xml') {
266
- return cliGetText('/cli/show-actor', { modelId, name: actorName }, format);
267
- }
268
- export async function exportJson(modelId) {
269
- return cliGetText('/cli/export-json', { modelId });
270
- }
271
- export async function codegenSlice(modelId, sliceName) {
272
- return cliGetText('/cli/codegen-slice', { modelId, name: sliceName });
273
- }
274
- export async function codegenEvents(modelId, chapterName) {
275
- const params = { modelId };
276
- if (chapterName)
277
- params.chapter = chapterName;
278
- return cliGet('/cli/codegen-events', params);
279
- }
280
- export async function listAggregates(modelId, format = 'xml') {
281
- return cliGetText('/cli/list-aggregates', { modelId }, format);
282
- }
283
- export async function listReadModels(modelId, format = 'xml') {
284
- return cliGetText('/cli/list-readmodels', { modelId }, format);
285
- }
286
- export async function listScreens(modelId, format = 'xml') {
287
- return cliGetText('/cli/list-screens', { modelId }, format);
288
- }
289
- export async function listProcessors(modelId, format = 'xml') {
290
- return cliGetText('/cli/list-processors', { modelId }, format);
291
- }
292
- export async function showElementCompleteness(modelId, elementName, format = 'xml') {
293
- return cliGetText('/cli/show-element-completeness', { modelId, name: elementName }, format);
294
- }
295
- export async function showInformationCompleteness(modelId, format = 'xml', sliceName, chapterName) {
296
- const params = { modelId };
297
- if (sliceName)
298
- params.sliceName = sliceName;
299
- if (chapterName)
300
- params.chapterName = chapterName;
301
- return cliGetText('/cli/show-information-completeness', params, format);
302
- }
303
- export async function showAggregateCompleteness(modelId, aggregateName, format = 'xml') {
304
- return cliGetText('/cli/show-aggregate-completeness', { modelId, name: aggregateName }, format);
305
- }
306
- export async function showReadModel(modelId, name, format = 'xml') {
307
- return cliGetText('/cli/show-readmodel', { modelId, name }, format);
308
- }
309
- export async function showScreen(modelId, name, format = 'xml') {
310
- return cliGetText('/cli/show-screen', { modelId, name }, format);
311
- }
312
- export async function showProcessor(modelId, name, format = 'xml') {
313
- return cliGetText('/cli/show-processor', { modelId, name }, format);
314
- }
315
- export async function showAggregate(modelId, name, format = 'xml') {
316
- return cliGetText('/cli/show-aggregate', { modelId, name }, format);
317
- }
318
- export async function showScenario(modelId, name, format = 'xml') {
319
- return cliGetText('/cli/show-scenario', { modelId, name }, format);
320
- }
321
- export async function listScenarios(modelId, format = 'xml') {
322
- return cliGetText('/cli/list-scenarios', { modelId }, format);
323
- }
@@ -1,276 +0,0 @@
1
- export declare function listSlices(modelId: string, format?: OutputFormat, chapterFilter?: string): Promise<string>;
2
- export declare function listEvents(modelId: string, format?: OutputFormat): Promise<string>;
3
- export declare function listCommands(modelId: string, format?: OutputFormat): Promise<string>;
4
- export declare function listChapters(modelId: string, format?: OutputFormat): Promise<string>;
5
- export declare function listActors(modelId: string, format?: OutputFormat): Promise<string>;
6
- export interface SearchResult {
7
- type: string;
8
- id: string;
9
- name: string;
10
- chapterId?: string;
11
- chapterName?: string;
12
- sliceId?: string;
13
- sliceName?: string;
14
- sliceStatus?: string;
15
- parentChapterId?: string;
16
- parentChapterName?: string;
17
- }
18
- export interface SearchResponse {
19
- query: string;
20
- count: number;
21
- results: SearchResult[];
22
- }
23
- export declare function search(modelId: string, term: string): Promise<SearchResponse>;
24
- export interface ModelSummary {
25
- modelName: string;
26
- slices: {
27
- total: number;
28
- byStatus: {
29
- created: number;
30
- inProgress: number;
31
- blocked: number;
32
- done: number;
33
- };
34
- byType: {
35
- stateChange: number;
36
- automation: number;
37
- stateView: number;
38
- unknown: number;
39
- };
40
- };
41
- events: number;
42
- commands: number;
43
- readModels: number;
44
- screens: number;
45
- processors: number;
46
- chapters: number;
47
- aggregates: number;
48
- actors: number;
49
- flows: number;
50
- scenarios: number;
51
- }
52
- export declare function getSummary(modelId: string): Promise<ModelSummary>;
53
- export type SliceStatus = 'created' | 'in-progress' | 'blocked' | 'done';
54
- export declare function markSliceStatus(modelId: string, sliceName: string, status: SliceStatus): Promise<{
55
- success: boolean;
56
- }>;
57
- export type ElementType = 'command' | 'event' | 'readModel' | 'screen' | 'processor';
58
- export interface FieldInput {
59
- name: string;
60
- fieldType: string;
61
- isList?: boolean;
62
- isOptional?: boolean;
63
- isGenerated?: boolean;
64
- isUserInput?: boolean;
65
- subfields?: FieldInput[];
66
- }
67
- export declare function addField(modelId: string, elementType: ElementType, elementName: string, field: FieldInput): Promise<{
68
- success: boolean;
69
- }>;
70
- export declare function removeField(modelId: string, elementType: ElementType, elementName: string, fieldName: string): Promise<{
71
- success: boolean;
72
- }>;
73
- export interface FieldUpdates {
74
- name?: string;
75
- fieldType?: string;
76
- isList?: boolean;
77
- isOptional?: boolean;
78
- isGenerated?: boolean;
79
- isUserInput?: boolean;
80
- }
81
- export declare function updateField(modelId: string, elementType: ElementType, elementName: string, fieldName: string, updates: FieldUpdates): Promise<{
82
- success: boolean;
83
- }>;
84
- export interface FieldMappingInput {
85
- from: string;
86
- to: string;
87
- }
88
- export declare function mapFields(modelId: string, sourceName: string, targetName: string, mappings: FieldMappingInput[]): Promise<{
89
- success: boolean;
90
- }>;
91
- export interface ScenarioInput {
92
- name: string;
93
- description?: string;
94
- given?: Array<{
95
- event: string;
96
- fieldValues?: Record<string, unknown>;
97
- }>;
98
- when?: {
99
- command?: {
100
- command: string;
101
- fieldValues?: Record<string, unknown>;
102
- };
103
- events?: Array<{
104
- event: string;
105
- fieldValues?: Record<string, unknown>;
106
- }>;
107
- };
108
- then: {
109
- type: 'events' | 'error' | 'command' | 'readModelAssertion' | 'noCommand';
110
- events?: Array<{
111
- event: string;
112
- fieldValues?: Record<string, unknown>;
113
- }>;
114
- errorMessage?: string;
115
- errorType?: string;
116
- command?: {
117
- command: string;
118
- fieldValues?: Record<string, unknown>;
119
- };
120
- readModelAssertion?: {
121
- readModel: string;
122
- givenEvents?: Array<{
123
- event: string;
124
- fieldValues?: Record<string, unknown>;
125
- }>;
126
- expectedFieldValues?: Record<string, unknown>;
127
- };
128
- };
129
- }
130
- export declare function createScenario(modelId: string, sliceName: string, scenario: ScenarioInput): Promise<{
131
- success: boolean;
132
- scenarioId: string;
133
- }>;
134
- export declare function removeScenario(modelId: string, scenarioName: string, sliceName?: string): Promise<{
135
- success: boolean;
136
- }>;
137
- export declare function createFlow(modelId: string, fromName: string, toName: string): Promise<{
138
- success: boolean;
139
- }>;
140
- export interface CompoundFieldInput {
141
- name: string;
142
- fieldType: string;
143
- isList?: boolean;
144
- isOptional?: boolean;
145
- isGenerated?: boolean;
146
- isUserInput?: boolean;
147
- subfields?: CompoundFieldInput[];
148
- }
149
- export interface StateChangeSliceInput {
150
- sliceName: string;
151
- after?: string;
152
- before?: string;
153
- screen: {
154
- name: string;
155
- fields: CompoundFieldInput[];
156
- };
157
- command: {
158
- name: string;
159
- fields: CompoundFieldInput[];
160
- };
161
- event: {
162
- name: string;
163
- fields: CompoundFieldInput[];
164
- };
165
- }
166
- export interface StateChangeSliceResult {
167
- success: boolean;
168
- sliceId: string;
169
- screenId: string;
170
- commandId: string;
171
- eventId: string;
172
- screenToCommandMappings: number;
173
- commandToEventMappings: number;
174
- }
175
- export declare function createStateChangeSlice(modelId: string, input: StateChangeSliceInput): Promise<StateChangeSliceResult>;
176
- export interface AutomationSliceInput {
177
- sliceName: string;
178
- after?: string;
179
- before?: string;
180
- readModel: {
181
- name: string;
182
- fields: CompoundFieldInput[];
183
- };
184
- processor: {
185
- name: string;
186
- };
187
- command: {
188
- name: string;
189
- fields: CompoundFieldInput[];
190
- };
191
- event: {
192
- name: string;
193
- fields: CompoundFieldInput[];
194
- };
195
- }
196
- export interface AutomationSliceResult {
197
- success: boolean;
198
- sliceId: string;
199
- readModelId: string;
200
- processorId: string;
201
- commandId: string;
202
- eventId: string;
203
- readModelToCommandMappings: number;
204
- commandToEventMappings: number;
205
- }
206
- export declare function createAutomationSlice(modelId: string, input: AutomationSliceInput): Promise<AutomationSliceResult>;
207
- export interface StateViewSliceInput {
208
- sliceName: string;
209
- after?: string;
210
- before?: string;
211
- readModel: {
212
- name: string;
213
- fields: CompoundFieldInput[];
214
- };
215
- }
216
- export interface StateViewSliceResult {
217
- success: boolean;
218
- sliceId: string;
219
- readModelId: string;
220
- }
221
- export declare function createStateViewSlice(modelId: string, input: StateViewSliceInput): Promise<StateViewSliceResult>;
222
- export type OutputFormat = 'xml' | 'json';
223
- export declare function showSlice(modelId: string, sliceName: string, format?: OutputFormat): Promise<string>;
224
- export declare function showEvent(modelId: string, eventName: string, format?: OutputFormat): Promise<string>;
225
- export declare function showCommand(modelId: string, commandName: string, format?: OutputFormat): Promise<string>;
226
- export declare function showChapter(modelId: string, chapterName: string, format?: OutputFormat): Promise<string>;
227
- export declare function showActor(modelId: string, actorName: string, format?: OutputFormat): Promise<string>;
228
- export declare function exportJson(modelId: string): Promise<string>;
229
- export declare function codegenSlice(modelId: string, sliceName: string): Promise<string>;
230
- export interface CodegenChapterEventsField {
231
- name: string;
232
- type: string;
233
- list?: boolean;
234
- generated?: boolean;
235
- optional?: boolean;
236
- userInput?: boolean;
237
- subfields?: CodegenChapterEventsField[];
238
- }
239
- export interface CodegenChapterEventsChapter {
240
- id: string;
241
- name: string;
242
- parent?: CodegenChapterEventsChapter | null;
243
- }
244
- export interface CodegenChapterEventsSlice {
245
- id: string;
246
- name: string;
247
- sliceType: string;
248
- }
249
- export interface CodegenChapterEventsEvent {
250
- id: string;
251
- name: string;
252
- fields: CodegenChapterEventsField[];
253
- aggregate?: string;
254
- sourceSlices: string[];
255
- }
256
- export interface CodegenChapterEventsResponse {
257
- chapter: CodegenChapterEventsChapter | null;
258
- sliceCount: number;
259
- eventCount: number;
260
- slices: CodegenChapterEventsSlice[];
261
- events: CodegenChapterEventsEvent[];
262
- }
263
- export declare function codegenEvents(modelId: string, chapterName?: string): Promise<CodegenChapterEventsResponse>;
264
- export declare function listAggregates(modelId: string, format?: OutputFormat): Promise<string>;
265
- export declare function listReadModels(modelId: string, format?: OutputFormat): Promise<string>;
266
- export declare function listScreens(modelId: string, format?: OutputFormat): Promise<string>;
267
- export declare function listProcessors(modelId: string, format?: OutputFormat): Promise<string>;
268
- export declare function showCompleteness(modelId: string, elementName: string, format?: OutputFormat): Promise<string>;
269
- export declare function showModelCompleteness(modelId: string, format?: OutputFormat): Promise<string>;
270
- export declare function showAggregateCompleteness(modelId: string, aggregateName: string, format?: OutputFormat): Promise<string>;
271
- export declare function showReadModel(modelId: string, name: string, format?: OutputFormat): Promise<string>;
272
- export declare function showScreen(modelId: string, name: string, format?: OutputFormat): Promise<string>;
273
- export declare function showProcessor(modelId: string, name: string, format?: OutputFormat): Promise<string>;
274
- export declare function showAggregate(modelId: string, name: string, format?: OutputFormat): Promise<string>;
275
- export declare function showScenario(modelId: string, name: string, format?: OutputFormat): Promise<string>;
276
- export declare function listScenarios(modelId: string, format?: OutputFormat): Promise<string>;