emviz 0.3.0 → 0.3.2
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/app/assets/index-BuZINukD.js +171 -0
- package/dist/app/index.html +1 -1
- package/dist/index.js +107 -152
- package/dist/index.js.map +4 -4
- package/package.json +3 -3
- package/dist/app/assets/index-4-teQs8m.js +0 -171
package/dist/app/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>emviz</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-BuZINukD.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-CrgcGOJd.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -13150,6 +13150,112 @@ function edgeId(kind, source, target) {
|
|
|
13150
13150
|
return `${kind}:${source}->${target}`;
|
|
13151
13151
|
}
|
|
13152
13152
|
|
|
13153
|
+
// ../parser/dist/graph.js
|
|
13154
|
+
function graphIds(project) {
|
|
13155
|
+
const identities = /* @__PURE__ */ new Map();
|
|
13156
|
+
const register = (base, identity) => {
|
|
13157
|
+
const keys = identities.get(base) ?? /* @__PURE__ */ new Set();
|
|
13158
|
+
keys.add(JSON.stringify(identity));
|
|
13159
|
+
identities.set(base, keys);
|
|
13160
|
+
};
|
|
13161
|
+
for (const story of project.stories)
|
|
13162
|
+
register(storyId(story.path), [story.path]);
|
|
13163
|
+
for (const event of project.events)
|
|
13164
|
+
register(eventId(event.name), [event.name]);
|
|
13165
|
+
for (const slice of project.slices) {
|
|
13166
|
+
register(sliceId(slice.path), [slice.path]);
|
|
13167
|
+
register(screenId(slice.path), [slice.path]);
|
|
13168
|
+
slice.commands.forEach((command2, index) => {
|
|
13169
|
+
register(commandId(command2.name), localIdentity(slice.path, slice.commands, index));
|
|
13170
|
+
for (const name of command2.produces)
|
|
13171
|
+
register(eventId(name), [name]);
|
|
13172
|
+
});
|
|
13173
|
+
slice.queries.forEach((query, index) => {
|
|
13174
|
+
register(queryId(query.name), localIdentity(slice.path, slice.queries, index));
|
|
13175
|
+
for (const name of query.fromEvents)
|
|
13176
|
+
register(eventId(name), [name]);
|
|
13177
|
+
});
|
|
13178
|
+
slice.gwt.forEach((scenario, index) => {
|
|
13179
|
+
register(gwtId(slice.path, index, scenario.name), localIdentity(slice.path, slice.gwt, index));
|
|
13180
|
+
});
|
|
13181
|
+
}
|
|
13182
|
+
return (base, identity) => identities.get(base).size === 1 ? base : `${base}~${encodeURIComponent(JSON.stringify(identity))}`;
|
|
13183
|
+
}
|
|
13184
|
+
function localIdentity(sourcePath, items, index) {
|
|
13185
|
+
const name = items[index].name;
|
|
13186
|
+
const occurrence = items.slice(0, index).filter((item) => item.name === name).length;
|
|
13187
|
+
return [sourcePath, name ?? "", String(occurrence)];
|
|
13188
|
+
}
|
|
13189
|
+
function buildGraph(project) {
|
|
13190
|
+
const nodes = [];
|
|
13191
|
+
const edges = /* @__PURE__ */ new Map();
|
|
13192
|
+
const id = graphIds(project);
|
|
13193
|
+
const eventNodeId = (name) => id(eventId(name), [name]);
|
|
13194
|
+
const storyIdsBySlicePath = /* @__PURE__ */ new Map();
|
|
13195
|
+
const connect = (kind, source, target, label) => {
|
|
13196
|
+
const key = edgeId(kind, source, target);
|
|
13197
|
+
edges.set(key, { id: key, kind, source, target, ...label === void 0 ? {} : { label } });
|
|
13198
|
+
};
|
|
13199
|
+
for (const story of project.stories) {
|
|
13200
|
+
const currentId = id(storyId(story.path), [story.path]);
|
|
13201
|
+
for (const slicePath of new Set(story.slices)) {
|
|
13202
|
+
storyIdsBySlicePath.set(slicePath, [...storyIdsBySlicePath.get(slicePath) ?? [], currentId]);
|
|
13203
|
+
}
|
|
13204
|
+
nodes.push({ id: currentId, type: "story", label: story.name, sourcePath: story.path, description: story.description });
|
|
13205
|
+
}
|
|
13206
|
+
for (const event of project.events) {
|
|
13207
|
+
nodes.push({ id: eventNodeId(event.name), type: "event", label: event.name, sourceName: event.name, sourcePath: event.sourcePath, fields: event.fields, description: event.description });
|
|
13208
|
+
}
|
|
13209
|
+
for (const slice of project.slices) {
|
|
13210
|
+
const currentSliceId = id(sliceId(slice.path), [slice.path]);
|
|
13211
|
+
const currentScreenId = id(screenId(slice.path), [slice.path]);
|
|
13212
|
+
const shared = { storyName: slice.storyName, sliceTitle: slice.title, sourcePath: slice.path, raw: slice.raw };
|
|
13213
|
+
nodes.push({ ...shared, id: currentSliceId, type: "slice", label: slice.title });
|
|
13214
|
+
for (const story of storyIdsBySlicePath.get(slice.path) ?? []) {
|
|
13215
|
+
connect("story-slice", story, currentSliceId);
|
|
13216
|
+
}
|
|
13217
|
+
nodes.push({
|
|
13218
|
+
...shared,
|
|
13219
|
+
id: currentScreenId,
|
|
13220
|
+
type: slice.screen.type === "system" ? "processor" : "screen",
|
|
13221
|
+
label: slice.screen.name ?? (slice.screen.type === "system" ? "Processor" : "Screen"),
|
|
13222
|
+
actors: slice.screen.actors,
|
|
13223
|
+
screenType: slice.screen.type
|
|
13224
|
+
});
|
|
13225
|
+
connect("slice-screen", currentSliceId, currentScreenId);
|
|
13226
|
+
slice.queries.forEach((query, index) => {
|
|
13227
|
+
const currentId = id(queryId(query.name), localIdentity(slice.path, slice.queries, index));
|
|
13228
|
+
nodes.push({ ...shared, id: currentId, type: "query", label: query.name, sourceName: query.name, fields: query.fields });
|
|
13229
|
+
if (slice.screen.reads.includes(query.name))
|
|
13230
|
+
connect("query-screen", currentId, currentScreenId);
|
|
13231
|
+
for (const name of query.fromEvents)
|
|
13232
|
+
connect("event-query", eventNodeId(name), currentId, name);
|
|
13233
|
+
});
|
|
13234
|
+
slice.commands.forEach((command2, index) => {
|
|
13235
|
+
const currentId = id(commandId(command2.name), localIdentity(slice.path, slice.commands, index));
|
|
13236
|
+
nodes.push({ ...shared, id: currentId, type: "command", label: command2.name, sourceName: command2.name, fields: command2.fields });
|
|
13237
|
+
if (slice.screen.executes.includes(command2.name))
|
|
13238
|
+
connect("screen-command", currentScreenId, currentId);
|
|
13239
|
+
for (const name of command2.produces)
|
|
13240
|
+
connect("command-event", currentId, eventNodeId(name), name);
|
|
13241
|
+
});
|
|
13242
|
+
slice.gwt.forEach((scenario, index) => {
|
|
13243
|
+
nodes.push({
|
|
13244
|
+
...shared,
|
|
13245
|
+
id: id(gwtId(slice.path, index, scenario.name), localIdentity(slice.path, slice.gwt, index)),
|
|
13246
|
+
type: "gwt",
|
|
13247
|
+
label: scenario.name ?? `Case ${index + 1}`,
|
|
13248
|
+
sourceName: scenario.name,
|
|
13249
|
+
description: scenario.description,
|
|
13250
|
+
given: scenario.given,
|
|
13251
|
+
when: scenario.when,
|
|
13252
|
+
then: scenario.then
|
|
13253
|
+
});
|
|
13254
|
+
});
|
|
13255
|
+
}
|
|
13256
|
+
return { nodes, edges: [...edges.values()] };
|
|
13257
|
+
}
|
|
13258
|
+
|
|
13153
13259
|
// ../parser/dist/config.js
|
|
13154
13260
|
var import_yaml = __toESM(require_dist(), 1);
|
|
13155
13261
|
import fs from "node:fs";
|
|
@@ -13300,157 +13406,6 @@ function parseSlices(projectRoot, stories, sliceGlob) {
|
|
|
13300
13406
|
const paths = [.../* @__PURE__ */ new Set([...storySlices, ...discoveredSlices])].sort();
|
|
13301
13407
|
return paths.filter((slicePath) => fs2.existsSync(resolveProjectPath(projectRoot, slicePath))).map((slicePath) => parseSliceText(slicePath, fs2.readFileSync(resolveProjectPath(projectRoot, slicePath), "utf8"), storyBySlice));
|
|
13302
13408
|
}
|
|
13303
|
-
function buildGraph(project) {
|
|
13304
|
-
const nodes = [];
|
|
13305
|
-
const edges = [];
|
|
13306
|
-
const eventNodeIds = /* @__PURE__ */ new Map();
|
|
13307
|
-
const storyNodeIds = /* @__PURE__ */ new Map();
|
|
13308
|
-
for (const story of project.stories) {
|
|
13309
|
-
const id = storyId(story.path);
|
|
13310
|
-
storyNodeIds.set(story.name, id);
|
|
13311
|
-
nodes.push({
|
|
13312
|
-
id,
|
|
13313
|
-
type: "story",
|
|
13314
|
-
label: story.name,
|
|
13315
|
-
sourcePath: story.path,
|
|
13316
|
-
description: story.description
|
|
13317
|
-
});
|
|
13318
|
-
}
|
|
13319
|
-
for (const event of project.events) {
|
|
13320
|
-
const id = eventId(event.name);
|
|
13321
|
-
eventNodeIds.set(event.name, id);
|
|
13322
|
-
nodes.push({
|
|
13323
|
-
id,
|
|
13324
|
-
type: "event",
|
|
13325
|
-
label: event.name,
|
|
13326
|
-
sourceName: event.name,
|
|
13327
|
-
sourcePath: event.sourcePath,
|
|
13328
|
-
fields: event.fields,
|
|
13329
|
-
description: event.description
|
|
13330
|
-
});
|
|
13331
|
-
}
|
|
13332
|
-
for (const slice of project.slices) {
|
|
13333
|
-
const currentSliceId = sliceId(slice.path);
|
|
13334
|
-
const currentScreenId = screenId(slice.path);
|
|
13335
|
-
const screenType = slice.screen.type === "system" ? "processor" : "screen";
|
|
13336
|
-
nodes.push({
|
|
13337
|
-
id: currentSliceId,
|
|
13338
|
-
type: "slice",
|
|
13339
|
-
label: slice.title,
|
|
13340
|
-
storyName: slice.storyName,
|
|
13341
|
-
sliceTitle: slice.title,
|
|
13342
|
-
sourcePath: slice.path,
|
|
13343
|
-
raw: slice.raw
|
|
13344
|
-
});
|
|
13345
|
-
if (slice.storyName) {
|
|
13346
|
-
const currentStoryId = storyNodeIds.get(slice.storyName) ?? storyId(slice.storyName);
|
|
13347
|
-
edges.push({
|
|
13348
|
-
id: edgeId("story-slice", currentStoryId, currentSliceId),
|
|
13349
|
-
kind: "story-slice",
|
|
13350
|
-
source: currentStoryId,
|
|
13351
|
-
target: currentSliceId
|
|
13352
|
-
});
|
|
13353
|
-
}
|
|
13354
|
-
nodes.push({
|
|
13355
|
-
id: currentScreenId,
|
|
13356
|
-
type: screenType,
|
|
13357
|
-
label: slice.screen.name ?? (slice.screen.type === "system" ? "Processor" : "Screen"),
|
|
13358
|
-
storyName: slice.storyName,
|
|
13359
|
-
sliceTitle: slice.title,
|
|
13360
|
-
sourcePath: slice.path,
|
|
13361
|
-
actors: slice.screen.actors,
|
|
13362
|
-
screenType: slice.screen.type,
|
|
13363
|
-
raw: slice.raw
|
|
13364
|
-
});
|
|
13365
|
-
edges.push({
|
|
13366
|
-
id: edgeId("slice-screen", currentSliceId, currentScreenId),
|
|
13367
|
-
kind: "slice-screen",
|
|
13368
|
-
source: currentSliceId,
|
|
13369
|
-
target: currentScreenId
|
|
13370
|
-
});
|
|
13371
|
-
for (const query of slice.queries) {
|
|
13372
|
-
const currentQueryId = queryId(query.name);
|
|
13373
|
-
nodes.push({
|
|
13374
|
-
id: currentQueryId,
|
|
13375
|
-
type: "query",
|
|
13376
|
-
label: query.name,
|
|
13377
|
-
storyName: slice.storyName,
|
|
13378
|
-
sliceTitle: slice.title,
|
|
13379
|
-
sourceName: query.name,
|
|
13380
|
-
sourcePath: slice.path,
|
|
13381
|
-
fields: query.fields,
|
|
13382
|
-
raw: slice.raw
|
|
13383
|
-
});
|
|
13384
|
-
if (slice.screen.reads.includes(query.name)) {
|
|
13385
|
-
edges.push({
|
|
13386
|
-
id: edgeId("query-screen", currentQueryId, currentScreenId),
|
|
13387
|
-
kind: "query-screen",
|
|
13388
|
-
source: currentQueryId,
|
|
13389
|
-
target: currentScreenId
|
|
13390
|
-
});
|
|
13391
|
-
}
|
|
13392
|
-
for (const eventName of query.fromEvents) {
|
|
13393
|
-
const currentEventId = eventNodeIds.get(eventName) ?? eventId(eventName);
|
|
13394
|
-
edges.push({
|
|
13395
|
-
id: edgeId("event-query", currentEventId, currentQueryId),
|
|
13396
|
-
kind: "event-query",
|
|
13397
|
-
source: currentEventId,
|
|
13398
|
-
target: currentQueryId,
|
|
13399
|
-
label: eventName
|
|
13400
|
-
});
|
|
13401
|
-
}
|
|
13402
|
-
}
|
|
13403
|
-
for (const command2 of slice.commands) {
|
|
13404
|
-
const currentCommandId = commandId(command2.name);
|
|
13405
|
-
nodes.push({
|
|
13406
|
-
id: currentCommandId,
|
|
13407
|
-
type: "command",
|
|
13408
|
-
label: command2.name,
|
|
13409
|
-
storyName: slice.storyName,
|
|
13410
|
-
sliceTitle: slice.title,
|
|
13411
|
-
sourceName: command2.name,
|
|
13412
|
-
sourcePath: slice.path,
|
|
13413
|
-
fields: command2.fields,
|
|
13414
|
-
raw: slice.raw
|
|
13415
|
-
});
|
|
13416
|
-
if (slice.screen.executes.includes(command2.name)) {
|
|
13417
|
-
edges.push({
|
|
13418
|
-
id: edgeId("screen-command", currentScreenId, currentCommandId),
|
|
13419
|
-
kind: "screen-command",
|
|
13420
|
-
source: currentScreenId,
|
|
13421
|
-
target: currentCommandId
|
|
13422
|
-
});
|
|
13423
|
-
}
|
|
13424
|
-
for (const eventName of command2.produces) {
|
|
13425
|
-
const currentEventId = eventNodeIds.get(eventName) ?? eventId(eventName);
|
|
13426
|
-
edges.push({
|
|
13427
|
-
id: edgeId("command-event", currentCommandId, currentEventId),
|
|
13428
|
-
kind: "command-event",
|
|
13429
|
-
source: currentCommandId,
|
|
13430
|
-
target: currentEventId,
|
|
13431
|
-
label: eventName
|
|
13432
|
-
});
|
|
13433
|
-
}
|
|
13434
|
-
}
|
|
13435
|
-
slice.gwt.forEach((scenario, index) => {
|
|
13436
|
-
nodes.push({
|
|
13437
|
-
id: gwtId(slice.path, index, scenario.name),
|
|
13438
|
-
type: "gwt",
|
|
13439
|
-
label: scenario.name ?? `Case ${index + 1}`,
|
|
13440
|
-
storyName: slice.storyName,
|
|
13441
|
-
sliceTitle: slice.title,
|
|
13442
|
-
sourceName: scenario.name,
|
|
13443
|
-
sourcePath: slice.path,
|
|
13444
|
-
description: scenario.description,
|
|
13445
|
-
given: scenario.given,
|
|
13446
|
-
when: scenario.when,
|
|
13447
|
-
then: scenario.then,
|
|
13448
|
-
raw: slice.raw
|
|
13449
|
-
});
|
|
13450
|
-
});
|
|
13451
|
-
}
|
|
13452
|
-
return { nodes, edges };
|
|
13453
|
-
}
|
|
13454
13409
|
function loadEventModelProject(startDir) {
|
|
13455
13410
|
const root = findProjectRoot(startDir);
|
|
13456
13411
|
const config = readConfig(root);
|
|
@@ -13685,7 +13640,7 @@ function diffEventModelProjects(base, target, labels = {}) {
|
|
|
13685
13640
|
const diffKeys = (project) => {
|
|
13686
13641
|
const occurrences = /* @__PURE__ */ new Map();
|
|
13687
13642
|
return new Map(project.nodes.map((node) => {
|
|
13688
|
-
if (node.type
|
|
13643
|
+
if (node.type === "event")
|
|
13689
13644
|
return [node.id, nodeKey(node)];
|
|
13690
13645
|
const key = stableJson({ selector: nodeKey(node), sourcePath: node.sourcePath });
|
|
13691
13646
|
const occurrence = occurrences.get(key) ?? 0;
|