eventmodeler 0.2.3 → 0.2.5
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 +63 -0
- package/dist/lib/element-lookup.d.ts +47 -0
- package/dist/lib/element-lookup.js +86 -0
- package/dist/lib/slice-utils.d.ts +83 -0
- package/dist/lib/slice-utils.js +135 -0
- package/dist/slices/add-field/index.js +4 -33
- package/dist/slices/add-scenario/index.js +15 -77
- package/dist/slices/create-automation-slice/index.d.ts +2 -0
- package/dist/slices/create-automation-slice/index.js +217 -0
- package/dist/slices/create-flow/index.d.ts +2 -0
- package/dist/slices/create-flow/index.js +177 -0
- package/dist/slices/create-state-change-slice/index.d.ts +2 -0
- package/dist/slices/create-state-change-slice/index.js +239 -0
- package/dist/slices/create-state-view-slice/index.d.ts +2 -0
- package/dist/slices/create-state-view-slice/index.js +120 -0
- package/dist/slices/list-chapters/index.js +2 -2
- package/dist/slices/list-commands/index.js +2 -2
- package/dist/slices/list-events/index.js +3 -2
- package/dist/slices/list-slices/index.js +2 -2
- package/dist/slices/mark-slice-status/index.js +2 -11
- package/dist/slices/remove-field/index.js +4 -33
- package/dist/slices/remove-scenario/index.js +45 -11
- package/dist/slices/show-actor/index.js +2 -11
- package/dist/slices/show-aggregate-completeness/index.js +2 -11
- package/dist/slices/show-chapter/index.js +6 -14
- package/dist/slices/show-command/index.js +4 -12
- package/dist/slices/show-completeness/index.js +378 -32
- package/dist/slices/show-event/index.js +4 -12
- package/dist/slices/show-slice/index.js +14 -17
- package/dist/slices/update-field/index.js +4 -33
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { appendEvent } from '../../lib/file-loader.js';
|
|
2
|
+
import { findElementOrExit } from '../../lib/element-lookup.js';
|
|
2
3
|
function findFieldByName(fields, fieldName) {
|
|
3
4
|
const nameLower = fieldName.toLowerCase();
|
|
4
5
|
for (const field of fields) {
|
|
@@ -52,17 +53,7 @@ export function updateField(model, filePath, options, fieldName, updates) {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
function updateCommandField(model, filePath, commandName, fieldName, updates) {
|
|
55
|
-
const
|
|
56
|
-
const commands = [...model.commands.values()];
|
|
57
|
-
const command = commands.find(c => c.name.toLowerCase() === nameLower || c.name.toLowerCase().includes(nameLower));
|
|
58
|
-
if (!command) {
|
|
59
|
-
console.error(`Error: Command not found: ${commandName}`);
|
|
60
|
-
console.error('Available commands:');
|
|
61
|
-
for (const c of commands) {
|
|
62
|
-
console.error(` - ${c.name}`);
|
|
63
|
-
}
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
56
|
+
const command = findElementOrExit(model.commands, commandName, 'command');
|
|
66
57
|
const field = findFieldByName(command.fields, fieldName);
|
|
67
58
|
if (!field) {
|
|
68
59
|
console.error(`Error: Field "${fieldName}" not found on command "${command.name}"`);
|
|
@@ -86,17 +77,7 @@ function updateCommandField(model, filePath, commandName, fieldName, updates) {
|
|
|
86
77
|
logUpdates(updates);
|
|
87
78
|
}
|
|
88
79
|
function updateEventField(model, filePath, eventName, fieldName, updates) {
|
|
89
|
-
const
|
|
90
|
-
const events = [...model.events.values()];
|
|
91
|
-
const event = events.find(e => e.name.toLowerCase() === nameLower || e.name.toLowerCase().includes(nameLower));
|
|
92
|
-
if (!event) {
|
|
93
|
-
console.error(`Error: Event not found: ${eventName}`);
|
|
94
|
-
console.error('Available events:');
|
|
95
|
-
for (const e of events) {
|
|
96
|
-
console.error(` - ${e.name}`);
|
|
97
|
-
}
|
|
98
|
-
process.exit(1);
|
|
99
|
-
}
|
|
80
|
+
const event = findElementOrExit(model.events, eventName, 'event');
|
|
100
81
|
const field = findFieldByName(event.fields, fieldName);
|
|
101
82
|
if (!field) {
|
|
102
83
|
console.error(`Error: Field "${fieldName}" not found on event "${event.name}"`);
|
|
@@ -120,17 +101,7 @@ function updateEventField(model, filePath, eventName, fieldName, updates) {
|
|
|
120
101
|
logUpdates(updates);
|
|
121
102
|
}
|
|
122
103
|
function updateReadModelField(model, filePath, readModelName, fieldName, updates) {
|
|
123
|
-
const
|
|
124
|
-
const readModels = [...model.readModels.values()];
|
|
125
|
-
const readModel = readModels.find(rm => rm.name.toLowerCase() === nameLower || rm.name.toLowerCase().includes(nameLower));
|
|
126
|
-
if (!readModel) {
|
|
127
|
-
console.error(`Error: Read model not found: ${readModelName}`);
|
|
128
|
-
console.error('Available read models:');
|
|
129
|
-
for (const rm of readModels) {
|
|
130
|
-
console.error(` - ${rm.name}`);
|
|
131
|
-
}
|
|
132
|
-
process.exit(1);
|
|
133
|
-
}
|
|
104
|
+
const readModel = findElementOrExit(model.readModels, readModelName, 'read model');
|
|
134
105
|
const field = findFieldByName(readModel.fields, fieldName);
|
|
135
106
|
if (!field) {
|
|
136
107
|
console.error(`Error: Field "${fieldName}" not found on read model "${readModel.name}"`);
|