eventmodeler 0.3.9 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1293,8 +1293,16 @@ EXAMPLES:
1293
1293
  `);
1294
1294
  process.exit(0);
1295
1295
  }
1296
- const scenarioName = target;
1297
1296
  const sliceArg = getNamedArg(filteredArgs, '--slice');
1297
+ // Filter out --slice and its value from remaining args to get scenario name
1298
+ const scenarioArgs = filteredArgs.slice(2).filter((arg, i, arr) => {
1299
+ if (arg === '--slice')
1300
+ return false;
1301
+ if (i > 0 && arr[i - 1] === '--slice')
1302
+ return false;
1303
+ return true;
1304
+ });
1305
+ const scenarioName = scenarioArgs.length > 0 ? scenarioArgs.join(' ') : undefined;
1298
1306
  if (!scenarioName) {
1299
1307
  console.error('Usage: eventmodeler remove scenario <name> [--slice <slice-name>]');
1300
1308
  console.error('Run "eventmodeler remove scenario --help" for more information.');
@@ -14,11 +14,13 @@ function getSliceComponents(model, slice) {
14
14
  const centerY = pos.y + height / 2;
15
15
  return centerX >= bounds.left && centerX <= bounds.right && centerY >= bounds.top && centerY <= bounds.bottom;
16
16
  }
17
+ // Only include canonical elements - linked copies are UI-only conveniences
18
+ // and should not appear as slice contents in codegen output
17
19
  return {
18
20
  commands: [...model.commands.values()].filter(c => isInSlice(c.position, c.width, c.height)),
19
- events: [...model.events.values()].filter(e => isInSlice(e.position, e.width, e.height)),
20
- readModels: [...model.readModels.values()].filter(rm => isInSlice(rm.position, rm.width, rm.height)),
21
- screens: [...model.screens.values()].filter(s => isInSlice(s.position, s.width, s.height)),
21
+ events: [...model.events.values()].filter(e => !e.originalNodeId && isInSlice(e.position, e.width, e.height)),
22
+ readModels: [...model.readModels.values()].filter(rm => !rm.originalNodeId && isInSlice(rm.position, rm.width, rm.height)),
23
+ screens: [...model.screens.values()].filter(s => !s.originalNodeId && isInSlice(s.position, s.width, s.height)),
22
24
  processors: [...model.processors.values()].filter(p => isInSlice(p.position, p.width, p.height)),
23
25
  };
24
26
  }
@@ -261,6 +263,11 @@ function formatScenarioThen(model, then) {
261
263
  },
262
264
  };
263
265
  }
266
+ if (then.type === 'noCommand') {
267
+ return {
268
+ type: 'noCommand',
269
+ };
270
+ }
264
271
  if (then.type === 'readModelAssertion' && then.readModelAssertion) {
265
272
  const rm = model.readModels.get(then.readModelAssertion.readModelStickyId);
266
273
  return {
@@ -367,6 +367,9 @@ function formatSliceXml(model, slice) {
367
367
  ? ` <command type="${escapeXml(name)}">${escapeXmlText(values)}</command>\n`
368
368
  : ` <command type="${escapeXml(name)}"/>\n`;
369
369
  }
370
+ else if (scenario.then.type === 'noCommand') {
371
+ xml += ' <no-command/>\n';
372
+ }
370
373
  else if (scenario.then.type === 'readModelAssertion' && scenario.then.readModelAssertion) {
371
374
  const assertion = scenario.then.readModelAssertion;
372
375
  const rm = model.readModels.get(assertion.readModelStickyId);
@@ -629,6 +632,11 @@ function formatSliceJson(model, slice) {
629
632
  ...(scenario.then.expectedCommand.fieldValues && Object.keys(scenario.then.expectedCommand.fieldValues).length > 0 ? { fieldValues: scenario.then.expectedCommand.fieldValues } : {})
630
633
  };
631
634
  }
635
+ else if (scenario.then.type === 'noCommand') {
636
+ scenarioObj.then = {
637
+ type: 'noCommand'
638
+ };
639
+ }
632
640
  else if (scenario.then.type === 'readModelAssertion' && scenario.then.readModelAssertion) {
633
641
  const assertion = scenario.then.readModelAssertion;
634
642
  const rm = model.readModels.get(assertion.readModelStickyId);
package/dist/types.d.ts CHANGED
@@ -22,7 +22,7 @@ export interface ReadModelAssertion {
22
22
  givenEvents: EventReference[];
23
23
  expectedFieldValues: Record<string, unknown>;
24
24
  }
25
- export type ScenarioThenType = 'error' | 'events' | 'readModelAssertion' | 'command';
25
+ export type ScenarioThenType = 'error' | 'events' | 'readModelAssertion' | 'command' | 'noCommand';
26
26
  export interface ScenarioThen {
27
27
  type: ScenarioThenType;
28
28
  errorMessage?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eventmodeler",
3
- "version": "0.3.9",
3
+ "version": "0.4.0",
4
4
  "description": "CLI tool for interacting with Event Model files - query, update, and export event models from the terminal",
5
5
  "type": "module",
6
6
  "bin": {