@xxrandr/conecta-diagram 0.0.0-stage → 0.1.4
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/LICENSE +21 -0
- package/README.md +319 -2
- package/dist/chunk-3QGSCPWL.cjs +663 -0
- package/dist/chunk-43VYPB4U.js +2136 -0
- package/dist/chunk-6ADTOXBT.cjs +626 -0
- package/dist/chunk-B2RLLFGC.js +0 -0
- package/dist/chunk-GXOBW2BK.js +290 -0
- package/dist/chunk-HZER5BPR.js +1122 -0
- package/dist/chunk-IT5H6WO2.js +626 -0
- package/dist/chunk-LKOWNTPR.cjs +1 -0
- package/dist/chunk-Q62JPMJH.js +663 -0
- package/dist/chunk-QI4NNFRQ.cjs +290 -0
- package/dist/chunk-VD32JNDO.cjs +2136 -0
- package/dist/chunk-ZMSQTBVW.cjs +1122 -0
- package/dist/core/index.cjs +56 -0
- package/dist/core/index.d.cts +65 -0
- package/dist/core/index.d.ts +65 -0
- package/dist/core/index.js +56 -0
- package/dist/d3/index.cjs +8 -0
- package/dist/d3/index.d.cts +46 -0
- package/dist/d3/index.d.ts +46 -0
- package/dist/d3/index.js +8 -0
- package/dist/index.cjs +71 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +71 -0
- package/dist/photon.css +339 -0
- package/dist/runner-display-BkBJpBY-.d.ts +151 -0
- package/dist/runner-display-DHHtavSX.d.cts +151 -0
- package/dist/store-CtOInpPu.d.cts +242 -0
- package/dist/store-CtOInpPu.d.ts +242 -0
- package/dist/svg/index.cjs +15 -0
- package/dist/svg/index.d.cts +172 -0
- package/dist/svg/index.d.ts +172 -0
- package/dist/svg/index.js +15 -0
- package/docs/devtools-refactor.md +93 -0
- package/docs/java-runtime-integration.md +268 -0
- package/docs/photon-template.html +547 -0
- package/docs/presentation-architecture.md +30 -0
- package/docs/runner-display.md +109 -0
- package/package.json +130 -4
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk3QGSCPWLcjs = require('./chunk-3QGSCPWL.cjs');
|
|
9
|
+
|
|
10
|
+
// src/core/conditions.ts
|
|
11
|
+
function evaluateCondition(condition, context) {
|
|
12
|
+
if (condition.op === "all" || condition.op === "any") {
|
|
13
|
+
return condition.op === "all" ? condition.conditions.every((item) => evaluateCondition(item, context)) : condition.conditions.some((item) => evaluateCondition(item, context));
|
|
14
|
+
}
|
|
15
|
+
if (condition.op === "not")
|
|
16
|
+
return !evaluateCondition(condition.condition, context);
|
|
17
|
+
if (!("path" in condition)) return false;
|
|
18
|
+
let actual = context;
|
|
19
|
+
for (const key of condition.path) {
|
|
20
|
+
if (actual === null || typeof actual !== "object" || !Object.hasOwn(actual, key)) {
|
|
21
|
+
actual = void 0;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
actual = actual[key];
|
|
25
|
+
}
|
|
26
|
+
if (condition.op === "exists") return actual !== void 0;
|
|
27
|
+
if (actual === void 0) return false;
|
|
28
|
+
switch (condition.op) {
|
|
29
|
+
case "eq":
|
|
30
|
+
return _chunk3QGSCPWLcjs.equal.call(void 0, actual, condition.value);
|
|
31
|
+
case "neq":
|
|
32
|
+
return !_chunk3QGSCPWLcjs.equal.call(void 0, actual, condition.value);
|
|
33
|
+
case "in":
|
|
34
|
+
return Array.isArray(condition.value) && condition.value.some((item) => _chunk3QGSCPWLcjs.equal.call(void 0, actual, item));
|
|
35
|
+
case "gt":
|
|
36
|
+
return typeof actual === "number" && typeof condition.value === "number" && actual > condition.value;
|
|
37
|
+
case "gte":
|
|
38
|
+
return typeof actual === "number" && typeof condition.value === "number" && actual >= condition.value;
|
|
39
|
+
case "lt":
|
|
40
|
+
return typeof actual === "number" && typeof condition.value === "number" && actual < condition.value;
|
|
41
|
+
case "lte":
|
|
42
|
+
return typeof actual === "number" && typeof condition.value === "number" && actual <= condition.value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function visibleElements(document, context) {
|
|
46
|
+
const nodes = document.nodes.filter(
|
|
47
|
+
(node) => !node.visibleWhen || evaluateCondition(node.visibleWhen, context)
|
|
48
|
+
);
|
|
49
|
+
const ids = new Set(nodes.map((node) => node.id));
|
|
50
|
+
const edges = document.edges.filter(
|
|
51
|
+
(edge) => ids.has(edge.source) && ids.has(edge.target) && (!edge.visibleWhen || evaluateCondition(edge.visibleWhen, context))
|
|
52
|
+
);
|
|
53
|
+
return { nodes, edges };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/core/runner-display.ts
|
|
57
|
+
var statuses = [
|
|
58
|
+
"ACCEPTED",
|
|
59
|
+
"RUNNING",
|
|
60
|
+
"STREAMING",
|
|
61
|
+
"SUCCEEDED",
|
|
62
|
+
"FAILED",
|
|
63
|
+
"CANCELLED",
|
|
64
|
+
"TIMED_OUT",
|
|
65
|
+
"REJECTED"
|
|
66
|
+
];
|
|
67
|
+
var terminals = [
|
|
68
|
+
"SUCCEEDED",
|
|
69
|
+
"FAILED",
|
|
70
|
+
"CANCELLED",
|
|
71
|
+
"TIMED_OUT",
|
|
72
|
+
"REJECTED"
|
|
73
|
+
];
|
|
74
|
+
var uint64 = (value) => typeof value === "string" && /^(0|[1-9][0-9]*)$/.test(value) && value.length <= 20 && BigInt(value) <= 18446744073709551615n;
|
|
75
|
+
var validText = (value) => typeof value === "string" && value.trim().length > 0;
|
|
76
|
+
function simulationOverlay(snapshot) {
|
|
77
|
+
const nodes = /* @__PURE__ */ Object.create(null);
|
|
78
|
+
for (const id of snapshot.completedNodes) nodes[id] = { status: "completed" };
|
|
79
|
+
for (const token of snapshot.tokens) {
|
|
80
|
+
const status = snapshot.status === "failed" ? "failed" : token.status === "ready" ? "active" : "waiting";
|
|
81
|
+
nodes[token.nodeId] = {
|
|
82
|
+
status,
|
|
83
|
+
detail: token.status === "signal" ? "Awaiting external signal" : token.status === "async" ? "Awaiting async result" : token.status === "joining" ? "Waiting for parallel branches" : ""
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const edges = /* @__PURE__ */ Object.create(null);
|
|
87
|
+
for (const id of snapshot.traversedEdges) edges[id] = "taken";
|
|
88
|
+
return { nodes, edges };
|
|
89
|
+
}
|
|
90
|
+
var RunnerDisplay = (_class = class {
|
|
91
|
+
constructor(document, observationLimit = 200) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);
|
|
92
|
+
this.observationLimit = observationLimit;
|
|
93
|
+
_chunk3QGSCPWLcjs.assertFlow.call(void 0, document);
|
|
94
|
+
if (!Number.isSafeInteger(observationLimit) || observationLimit < 1 || observationLimit > 1e4)
|
|
95
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
96
|
+
"INVALID_LIMIT",
|
|
97
|
+
"observationLimit must be between 1 and 10000."
|
|
98
|
+
);
|
|
99
|
+
this.document = _chunk3QGSCPWLcjs.freeze.call(void 0, _chunk3QGSCPWLcjs.clone.call(void 0, document));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
__init() {this.commands = /* @__PURE__ */ new Map()}
|
|
104
|
+
__init2() {this.latest = /* @__PURE__ */ new Map()}
|
|
105
|
+
__init3() {this.decisions = /* @__PURE__ */ new Map()}
|
|
106
|
+
__init4() {this.signals = []}
|
|
107
|
+
__init5() {this.seen = /* @__PURE__ */ new Map()}
|
|
108
|
+
/** Register correlation only. This does not dispatch, accept or execute a command. */
|
|
109
|
+
track(commandId, nodeId) {
|
|
110
|
+
const node = this.document.nodes.find((node2) => node2.id === nodeId);
|
|
111
|
+
if (!validText(commandId) || !node || !["task", "decision"].includes(node.type))
|
|
112
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
113
|
+
"INVALID_COMMAND_BINDING",
|
|
114
|
+
"A command id must target an existing task or decision."
|
|
115
|
+
);
|
|
116
|
+
const existing = this.commands.get(commandId);
|
|
117
|
+
if (existing) {
|
|
118
|
+
if (existing.nodeId !== nodeId)
|
|
119
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
120
|
+
"COMMAND_BINDING_CONFLICT",
|
|
121
|
+
"A command cannot move to a different node."
|
|
122
|
+
);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (this.commands.size >= 1e4)
|
|
126
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
127
|
+
"DISPLAY_LIMIT",
|
|
128
|
+
"Create a new display projection after 10000 tracked commands."
|
|
129
|
+
);
|
|
130
|
+
this.commands.set(commandId, { commandId, nodeId });
|
|
131
|
+
this.latest.set(nodeId, commandId);
|
|
132
|
+
}
|
|
133
|
+
applyResult(input) {
|
|
134
|
+
_chunk3QGSCPWLcjs.assertJson.call(void 0, input);
|
|
135
|
+
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
136
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
137
|
+
"INVALID_RESULT",
|
|
138
|
+
"Expected a result preview object."
|
|
139
|
+
);
|
|
140
|
+
const status = typeof input.status === "number" ? statuses[input.status - 1] : input.status;
|
|
141
|
+
if (!status || !statuses.includes(status) || !uint64(input.sequence) || typeof input.success !== "boolean" || typeof input.final !== "boolean" || [input.summary, input.error].some(
|
|
142
|
+
(item) => item !== void 0 && typeof item !== "string"
|
|
143
|
+
))
|
|
144
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
145
|
+
"INVALID_RESULT",
|
|
146
|
+
"Invalid result status, sequence, finality or display summary."
|
|
147
|
+
);
|
|
148
|
+
const terminal = terminals.includes(status);
|
|
149
|
+
if (input.final !== terminal || terminal && input.success !== (status === "SUCCEEDED"))
|
|
150
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
151
|
+
"INVALID_RESULT",
|
|
152
|
+
"Terminal status, final and success must agree; intermediate success=false is not a failure."
|
|
153
|
+
);
|
|
154
|
+
if (input.progress !== void 0 && (!input.progress || !uint64(input.progress.current) || input.progress.total !== void 0 && (!uint64(input.progress.total) || BigInt(input.progress.current) > BigInt(input.progress.total)) || !["bytes", "rows", "items"].includes(input.progress.unit)))
|
|
155
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
156
|
+
"INVALID_PROGRESS",
|
|
157
|
+
"Expected bounded uint64 decimal progress values and a known unit."
|
|
158
|
+
);
|
|
159
|
+
const transfer = input.transfer;
|
|
160
|
+
if (transfer !== void 0 && (!transfer || !validText(transfer.id) || !uint64(transfer.offset) || !uint64(transfer.chunkSequence) || !uint64(transfer.size) || typeof transfer.final !== "boolean" || BigInt(transfer.offset) + BigInt(transfer.size) > 18446744073709551615n || transfer.totalSize !== void 0 && (!uint64(transfer.totalSize) || BigInt(transfer.offset) + BigInt(transfer.size) > BigInt(transfer.totalSize))))
|
|
161
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
162
|
+
"INVALID_TRANSFER",
|
|
163
|
+
"Expected valid uint64 transfer metadata without binary data."
|
|
164
|
+
);
|
|
165
|
+
const command = this.commands.get(input.commandId);
|
|
166
|
+
if (!command)
|
|
167
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
168
|
+
"UNKNOWN_COMMAND",
|
|
169
|
+
`No display binding for command ${input.commandId}.`
|
|
170
|
+
);
|
|
171
|
+
const result = {
|
|
172
|
+
commandId: input.commandId,
|
|
173
|
+
status,
|
|
174
|
+
sequence: input.sequence,
|
|
175
|
+
success: input.success,
|
|
176
|
+
final: input.final,
|
|
177
|
+
...input.summary !== void 0 ? { summary: input.summary } : {},
|
|
178
|
+
...input.error !== void 0 ? { error: input.error } : {},
|
|
179
|
+
...input.progress ? { progress: _chunk3QGSCPWLcjs.clone.call(void 0, input.progress) } : {},
|
|
180
|
+
...transfer ? { transfer: _chunk3QGSCPWLcjs.clone.call(void 0, transfer) } : {}
|
|
181
|
+
};
|
|
182
|
+
const previous = command.result;
|
|
183
|
+
if (previous && BigInt(result.sequence) <= BigInt(previous.sequence)) {
|
|
184
|
+
if (result.sequence === previous.sequence && !_chunk3QGSCPWLcjs.equal.call(void 0, result, previous))
|
|
185
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
186
|
+
"RESULT_CONFLICT",
|
|
187
|
+
"Conflicting results at the same command sequence."
|
|
188
|
+
);
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
if (_optionalChain([previous, 'optionalAccess', _ => _.final]))
|
|
192
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
193
|
+
"COMMAND_FINISHED",
|
|
194
|
+
"A final command result cannot be overwritten; track a new command id for a retry."
|
|
195
|
+
);
|
|
196
|
+
command.result = result;
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
observeSignal(observation) {
|
|
200
|
+
_chunk3QGSCPWLcjs.assertJson.call(void 0, observation);
|
|
201
|
+
if (!observation || typeof observation !== "object")
|
|
202
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
203
|
+
"INVALID_SIGNAL_OBSERVATION",
|
|
204
|
+
"Expected an observation object."
|
|
205
|
+
);
|
|
206
|
+
const node = this.document.nodes.find(
|
|
207
|
+
(node2) => node2.id === observation.nodeId
|
|
208
|
+
);
|
|
209
|
+
if (!node || !validText(observation.id) || !validText(observation.name) || !["in", "out"].includes(observation.direction) || observation.summary !== void 0 && typeof observation.summary !== "string")
|
|
210
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
211
|
+
"INVALID_SIGNAL_OBSERVATION",
|
|
212
|
+
"Invalid observed signal."
|
|
213
|
+
);
|
|
214
|
+
if (!this.remember(observation)) return;
|
|
215
|
+
this.signals.push(_chunk3QGSCPWLcjs.clone.call(void 0, observation));
|
|
216
|
+
if (this.signals.length > this.observationLimit) this.signals.shift();
|
|
217
|
+
}
|
|
218
|
+
observeDecision(observation) {
|
|
219
|
+
_chunk3QGSCPWLcjs.assertJson.call(void 0, observation);
|
|
220
|
+
if (!observation || typeof observation !== "object")
|
|
221
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
222
|
+
"INVALID_DECISION_OBSERVATION",
|
|
223
|
+
"Expected an observation object."
|
|
224
|
+
);
|
|
225
|
+
const node = this.document.nodes.find(
|
|
226
|
+
(node2) => node2.id === observation.nodeId
|
|
227
|
+
);
|
|
228
|
+
if (_optionalChain([node, 'optionalAccess', _2 => _2.type]) !== "decision" || !validText(observation.id) || typeof observation.reason !== "string" || !this.document.edges.some(
|
|
229
|
+
(edge) => edge.id === observation.edgeId && edge.source === node.id
|
|
230
|
+
))
|
|
231
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
232
|
+
"INVALID_DECISION_OBSERVATION",
|
|
233
|
+
"Decision observation must select an output edge of that decision."
|
|
234
|
+
);
|
|
235
|
+
if (!this.remember(observation)) return;
|
|
236
|
+
this.decisions.set(observation.nodeId, _chunk3QGSCPWLcjs.clone.call(void 0, observation));
|
|
237
|
+
}
|
|
238
|
+
getOverlay() {
|
|
239
|
+
const nodes = /* @__PURE__ */ Object.create(null);
|
|
240
|
+
for (const [nodeId, commandId] of this.latest) {
|
|
241
|
+
const result = this.commands.get(commandId).result;
|
|
242
|
+
nodes[nodeId] = result ? {
|
|
243
|
+
status: String(result.status).toLowerCase(),
|
|
244
|
+
commandId,
|
|
245
|
+
sequence: result.sequence,
|
|
246
|
+
final: result.final,
|
|
247
|
+
detail: result.error || result.summary || String(result.status),
|
|
248
|
+
...result.progress ? { progress: _chunk3QGSCPWLcjs.clone.call(void 0, result.progress) } : {},
|
|
249
|
+
...result.transfer ? { transfer: _chunk3QGSCPWLcjs.clone.call(void 0, result.transfer) } : {}
|
|
250
|
+
} : { status: "idle", commandId, detail: "Awaiting runner observation" };
|
|
251
|
+
}
|
|
252
|
+
const edges = /* @__PURE__ */ Object.create(null);
|
|
253
|
+
const decisions = /* @__PURE__ */ Object.create(null);
|
|
254
|
+
for (const [nodeId, observation] of this.decisions) {
|
|
255
|
+
decisions[nodeId] = _chunk3QGSCPWLcjs.clone.call(void 0, observation);
|
|
256
|
+
nodes[nodeId] = {
|
|
257
|
+
...nodes[nodeId],
|
|
258
|
+
status: "succeeded",
|
|
259
|
+
detail: observation.reason
|
|
260
|
+
};
|
|
261
|
+
for (const edge of this.document.edges.filter(
|
|
262
|
+
(edge2) => edge2.source === nodeId
|
|
263
|
+
))
|
|
264
|
+
edges[edge.id] = edge.id === observation.edgeId ? "taken" : "skipped";
|
|
265
|
+
}
|
|
266
|
+
return _chunk3QGSCPWLcjs.freeze.call(void 0, { nodes, edges, decisions, signals: _chunk3QGSCPWLcjs.clone.call(void 0, this.signals) });
|
|
267
|
+
}
|
|
268
|
+
remember(observation) {
|
|
269
|
+
const previous = this.seen.get(observation.id);
|
|
270
|
+
if (previous) {
|
|
271
|
+
if (!_chunk3QGSCPWLcjs.equal.call(void 0, previous, observation))
|
|
272
|
+
throw new (0, _chunk3QGSCPWLcjs.FlowError)(
|
|
273
|
+
"OBSERVATION_CONFLICT",
|
|
274
|
+
"An observation id was reused with different content."
|
|
275
|
+
);
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
this.seen.set(observation.id, _chunk3QGSCPWLcjs.clone.call(void 0, observation));
|
|
279
|
+
if (this.seen.size > this.observationLimit)
|
|
280
|
+
this.seen.delete(this.seen.keys().next().value);
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
}, _class);
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
exports.evaluateCondition = evaluateCondition; exports.visibleElements = visibleElements; exports.simulationOverlay = simulationOverlay; exports.RunnerDisplay = RunnerDisplay;
|