@uipath/rules-tool 0.0.0-stage → 1.204.0-preview.250
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.txt +3 -0
- package/README.md +80 -2
- package/dist/DmnFactory-VWZOSZHH-jkpbxz3n.js +42 -0
- package/dist/DmnModelTypes-ATR7FVKZ-jp35cecy.js +18 -0
- package/dist/KieDmnMarshaller-6TTUU5B4-47q50gk4.js +20 -0
- package/dist/THIRD-PARTY-NOTICES.md +1054 -0
- package/dist/business-rules-bnr581tz.js +26 -0
- package/dist/constants-9pa118cj.js +29 -0
- package/dist/embedded-file-reader-rf2g1kfj.js +114 -0
- package/dist/first-party-service-sd8yaf73.js +27 -0
- package/dist/hitPolicyResult-4WDHTX4A-gk103w84.js +33 -0
- package/dist/index-2hzp9b97.js +116 -0
- package/dist/index-34pj9f36.js +48 -0
- package/dist/index-4c4exdzw.js +3035 -0
- package/dist/index-dqa169gp.js +25 -0
- package/dist/index-fs1nd5ap.js +200 -0
- package/dist/index-sby22td6.js +634 -0
- package/dist/index-t4mx1a5e.js +17 -0
- package/dist/index.js +17 -0
- package/dist/jmespath-231m3hyn.js +1485 -0
- package/dist/js-yaml-88tdqrtd.js +3153 -0
- package/dist/rule-catalog-5gzpe93c.js +46 -0
- package/dist/rules-command-error-20gp2dv9.js +14 -0
- package/dist/rules-debug-service-cmgmbhyh.js +193 -0
- package/dist/rules-init-service-b74thek5.js +104 -0
- package/dist/rules-refresh-service-jgk2kq9d.js +66 -0
- package/dist/rules-validate-service-mr2fk58k.js +63 -0
- package/dist/tool-19b4ect0.js +754 -0
- package/dist/tool-1de529jm.js +39 -0
- package/dist/tool-2cky8jwp.js +17878 -0
- package/dist/tool-4dfpdepw.js +55 -0
- package/dist/tool-53w8skv5.js +262 -0
- package/dist/tool-7haj67tr.js +19 -0
- package/dist/tool-8h4er38s.js +11063 -0
- package/dist/tool-8qy8pkp4.js +40 -0
- package/dist/tool-av4mmsef.js +73 -0
- package/dist/tool-eymjx05p.js +6396 -0
- package/dist/tool-gdtpsdn7.js +342 -0
- package/dist/tool-jd313s2x.js +10 -0
- package/dist/tool-jxvk6306.js +574 -0
- package/dist/tool-m41px07w.js +49 -0
- package/dist/tool-mkn83w88.js +111 -0
- package/dist/tool-pm3ewdxc.js +1115 -0
- package/dist/tool-qgqscsjc.js +46 -0
- package/dist/tool-tkcx6png.js +6558 -0
- package/dist/tool-wmh645tm.js +4022 -0
- package/dist/tool-x0z7hxqr.js +916 -0
- package/dist/tool.js +12 -0
- package/package.json +30 -5
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Ft,
|
|
3
|
+
Is,
|
|
4
|
+
Ot,
|
|
5
|
+
_t,
|
|
6
|
+
bs,
|
|
7
|
+
hs,
|
|
8
|
+
m
|
|
9
|
+
} from "./tool-8h4er38s.js";
|
|
10
|
+
import {
|
|
11
|
+
$,
|
|
12
|
+
A,
|
|
13
|
+
B,
|
|
14
|
+
C,
|
|
15
|
+
K,
|
|
16
|
+
S,
|
|
17
|
+
X,
|
|
18
|
+
_,
|
|
19
|
+
j,
|
|
20
|
+
re,
|
|
21
|
+
s,
|
|
22
|
+
se
|
|
23
|
+
} from "./tool-wmh645tm.js";
|
|
24
|
+
import {
|
|
25
|
+
x
|
|
26
|
+
} from "./tool-4dfpdepw.js";
|
|
27
|
+
import {
|
|
28
|
+
e,
|
|
29
|
+
t
|
|
30
|
+
} from "./tool-jd313s2x.js";
|
|
31
|
+
|
|
32
|
+
// ../../node_modules/@uipath/dmn-editor-utils/dist/chunks/chunk-DKARK3JU.js
|
|
33
|
+
var oe = { "dmn:decision": { element: "decision", name: _, prefix: "decision" }, "dmn:inputData": { element: "inputData", name: "Input data", prefix: "inputData" }, "dmn:businessKnowledgeModel": { element: "businessKnowledgeModel", name: "Knowledge model", prefix: "bkm" }, "dmn:knowledgeSource": { element: "knowledgeSource", name: "Knowledge source", prefix: "knowledgeSource" } };
|
|
34
|
+
function Pe(e2) {
|
|
35
|
+
return e2 in oe;
|
|
36
|
+
}
|
|
37
|
+
function se2(e2) {
|
|
38
|
+
return e2["@_label"] ?? e2["@_name"] ?? "";
|
|
39
|
+
}
|
|
40
|
+
function M(e2) {
|
|
41
|
+
return ("variable" in e2 ? e2.variable?.["@_name"] : undefined) || e2["@_name"];
|
|
42
|
+
}
|
|
43
|
+
function ae(e2) {
|
|
44
|
+
let [n = "", ...r] = e2.split(/[^\p{L}\p{N}_]+/u).filter(Boolean), i = [n.charAt(0).toLowerCase() + n.slice(1), ...r.map((o) => o.charAt(0).toUpperCase() + o.slice(1))].join("") || "element";
|
|
45
|
+
return /^[\p{L}_]/u.test(i) ? i : `_${i}`;
|
|
46
|
+
}
|
|
47
|
+
function O(e2, n) {
|
|
48
|
+
let r = new Set((e2.drgElement ?? []).map(M)), t2 = ae(n);
|
|
49
|
+
if (!r.has(t2))
|
|
50
|
+
return t2;
|
|
51
|
+
for (let i = 2;; i++) {
|
|
52
|
+
let o = `${t2}${i}`;
|
|
53
|
+
if (!r.has(o))
|
|
54
|
+
return o;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function qe(e2, n) {
|
|
58
|
+
let r = new Set((e2.drgElement ?? []).map(M)), t2 = ae(n);
|
|
59
|
+
for (let i = 1;; i++) {
|
|
60
|
+
let o = `${t2}${i}`;
|
|
61
|
+
if (!r.has(o))
|
|
62
|
+
return o;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function de(e2, n) {
|
|
66
|
+
if (n.length === 0)
|
|
67
|
+
return;
|
|
68
|
+
let r = "expression" in e2 ? e2.expression : undefined, t2 = (i, o) => {
|
|
69
|
+
if (i === undefined)
|
|
70
|
+
return;
|
|
71
|
+
let s2 = n.reduce((a, [l, f, c]) => c === "callee" ? K(a, l, f, o) : j(a, l, f, o), i);
|
|
72
|
+
return s2 === i ? undefined : s2;
|
|
73
|
+
};
|
|
74
|
+
if (r?.__$$element === "literalExpression") {
|
|
75
|
+
let i = t2(r.text?.__$$text, "expression");
|
|
76
|
+
i !== undefined && (r.text = { ...r.text, __$$text: i });
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (r?.__$$element === "decisionTable") {
|
|
80
|
+
for (let i of r.input ?? []) {
|
|
81
|
+
let o = t2(i.inputExpression.text?.__$$text, "expression");
|
|
82
|
+
o !== undefined && (i.inputExpression.text = { ...i.inputExpression.text, __$$text: o });
|
|
83
|
+
let s2 = i.inputValues && t2(i.inputValues.text?.__$$text, "unaryTests");
|
|
84
|
+
i.inputValues && s2 !== undefined && (i.inputValues.text = { ...i.inputValues.text, __$$text: s2 });
|
|
85
|
+
}
|
|
86
|
+
for (let i of r.output ?? []) {
|
|
87
|
+
let o = i.outputValues && t2(i.outputValues.text?.__$$text, "unaryTests");
|
|
88
|
+
i.outputValues && o !== undefined && (i.outputValues.text = { ...i.outputValues.text, __$$text: o });
|
|
89
|
+
}
|
|
90
|
+
for (let i of r.rule ?? []) {
|
|
91
|
+
for (let o of i.inputEntry ?? []) {
|
|
92
|
+
let s2 = t2(o.text?.__$$text, "unaryTests");
|
|
93
|
+
s2 !== undefined && (o.text = { ...o.text, __$$text: s2 });
|
|
94
|
+
}
|
|
95
|
+
for (let o of i.outputEntry ?? []) {
|
|
96
|
+
let s2 = t2(o.text?.__$$text, "expression");
|
|
97
|
+
s2 !== undefined && (o.text = { ...o.text, __$$text: s2 });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function an(e2) {
|
|
103
|
+
if (e2.definitions["@_exporter"] === A || (e2.definitions.drgElement ?? []).length === 0)
|
|
104
|
+
return e2;
|
|
105
|
+
let n = structuredClone(e2), r = [], t2 = new Set((e2.definitions.drgElement ?? []).map(M).filter((i) => !!i));
|
|
106
|
+
for (let i of n.definitions.drgElement ?? []) {
|
|
107
|
+
if (i["@_label"] !== undefined)
|
|
108
|
+
continue;
|
|
109
|
+
let o = `dmn:${i.__$$element}`;
|
|
110
|
+
if (!Pe(o))
|
|
111
|
+
continue;
|
|
112
|
+
let s2 = M(i);
|
|
113
|
+
if (!s2 || [s2, i["@_name"]].every((f) => !f || ae(f) === f))
|
|
114
|
+
continue;
|
|
115
|
+
let a = oe[o], l = qe(n.definitions, a.name);
|
|
116
|
+
i["@_label"] = se2(i), i["@_name"] = l, "variable" in i && i.variable && (i.variable["@_name"] = l), r.push([s2, l, i.__$$element === "businessKnowledgeModel" ? "callee" : "reference"]);
|
|
117
|
+
}
|
|
118
|
+
for (let i of n.definitions.drgElement ?? []) {
|
|
119
|
+
let o = i["@_id"], s2 = M(i);
|
|
120
|
+
!o || !s2 || o === s2 || t2.has(o) || r.push([o, s2, i.__$$element === "businessKnowledgeModel" ? "callee" : "reference"]);
|
|
121
|
+
}
|
|
122
|
+
for (let i of n.definitions.drgElement ?? [])
|
|
123
|
+
de(i, r);
|
|
124
|
+
return n.definitions["@_exporter"] = A, n;
|
|
125
|
+
}
|
|
126
|
+
var ue = "http://uipath.com/schema/1.0/business-rules/uninitialized";
|
|
127
|
+
var ce = "business-rule-uninitialized";
|
|
128
|
+
var at = `<?xml version="1.0" encoding="UTF-8"?>
|
|
129
|
+
<definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" id="${ce}" name="" namespace="${ue}" />
|
|
130
|
+
`;
|
|
131
|
+
var Le = `<?xml version="1.0" encoding="UTF-8"?>
|
|
132
|
+
<definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:kie="https://kie.org/dmn/extensions/1.0" id="definitions_1" name="definitions" namespace="http://uipath.com/schema/1.0/dmn">
|
|
133
|
+
<decision id="decision_1" name="">
|
|
134
|
+
<decisionTable id="decisionTable_1">
|
|
135
|
+
<input id="input1" label="">
|
|
136
|
+
<inputExpression id="inputExpression1" typeRef="string">
|
|
137
|
+
<text></text>
|
|
138
|
+
</inputExpression>
|
|
139
|
+
</input>
|
|
140
|
+
<output id="output1" label="" name="" typeRef="string" />
|
|
141
|
+
</decisionTable>
|
|
142
|
+
</decision>
|
|
143
|
+
<dmndi:DMNDI>
|
|
144
|
+
<dmndi:DMNDiagram id="DMNDiagram_1">
|
|
145
|
+
<dmndi:DMNShape id="DMNShape_1" dmnElementRef="decision_1">
|
|
146
|
+
<dc:Bounds height="80" width="180" x="0" y="0" />
|
|
147
|
+
</dmndi:DMNShape>
|
|
148
|
+
</dmndi:DMNDiagram>
|
|
149
|
+
</dmndi:DMNDI>
|
|
150
|
+
</definitions>
|
|
151
|
+
`;
|
|
152
|
+
var le = "http://uipath.com/schema/1.0/dmn/authoring";
|
|
153
|
+
var Oe = "uipath";
|
|
154
|
+
var k = "authoring";
|
|
155
|
+
var dn = ["condition-rule", "decision-table", "decision-graph"];
|
|
156
|
+
var un = ["condition-rule", "decision-table", "literal-expression"];
|
|
157
|
+
var ke = new Set(dn);
|
|
158
|
+
var cn = new Set(un);
|
|
159
|
+
function Ce(e2) {
|
|
160
|
+
return Object.entries(e2.definitions).flatMap(([n, r]) => r === le && (n === "@_xmlns" || n.startsWith("@_xmlns:")) ? [n === "@_xmlns" ? "" : `${n.slice(8)}:`] : []);
|
|
161
|
+
}
|
|
162
|
+
function C2(e2, n) {
|
|
163
|
+
let r = e2?.[n === "" ? "@_xmlns" : `@_xmlns:${n.slice(0, -1)}`];
|
|
164
|
+
return r !== undefined && r !== le;
|
|
165
|
+
}
|
|
166
|
+
function Ve(e2, n) {
|
|
167
|
+
let r = n.extensionElements;
|
|
168
|
+
for (let t2 of Ce(e2)) {
|
|
169
|
+
if (C2(r, t2))
|
|
170
|
+
continue;
|
|
171
|
+
let i = `${t2}${k}`, o = r?.[i];
|
|
172
|
+
if (o && !C2(Array.isArray(o) ? o[0] : o, t2))
|
|
173
|
+
return { key: i, entry: o };
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function me(e2, n) {
|
|
177
|
+
let r = Ve(e2, n)?.entry;
|
|
178
|
+
return Array.isArray(r) ? r[0] : r;
|
|
179
|
+
}
|
|
180
|
+
function ln(e2, n) {
|
|
181
|
+
let { definitions: r } = e2, t2 = Oe, i = 2;
|
|
182
|
+
for (;r[`@_xmlns:${t2}`] || C2(n, `${t2}:`) || n[`${t2}:${k}`] !== undefined; )
|
|
183
|
+
t2 = `${Oe}${i++}`;
|
|
184
|
+
return r[`@_xmlns:${t2}`] = le, `${t2}:`;
|
|
185
|
+
}
|
|
186
|
+
function mn(e2, n) {
|
|
187
|
+
return Ce(e2).filter((t2) => !C2(n, t2)).map((t2) => `${t2}${k}`).find((t2) => n[t2] === undefined) ?? `${ln(e2, n)}${k}`;
|
|
188
|
+
}
|
|
189
|
+
function Be(e2, n, r, t2) {
|
|
190
|
+
let i = Ve(e2, n), o = n.extensionElements ?? {};
|
|
191
|
+
n.extensionElements = o;
|
|
192
|
+
let s2 = i?.key ?? mn(e2, o), a = o[s2], f = { ...Array.isArray(a) ? a[0] : a, [r]: t2 };
|
|
193
|
+
Array.isArray(a) ? a[0] = f : o[s2] = f;
|
|
194
|
+
}
|
|
195
|
+
function Ue(e2) {
|
|
196
|
+
let n = me(e2, e2.definitions)?.["@_surface"];
|
|
197
|
+
return typeof n == "string" && ke.has(n) ? n : undefined;
|
|
198
|
+
}
|
|
199
|
+
function Fe(e2) {
|
|
200
|
+
let n = me(e2, e2.definitions)?.["@_surface"];
|
|
201
|
+
return typeof n != "string" || ke.has(n);
|
|
202
|
+
}
|
|
203
|
+
function je(e2, n) {
|
|
204
|
+
let r = me(e2, n)?.["@_editor"];
|
|
205
|
+
return typeof r != "string" || cn.has(r);
|
|
206
|
+
}
|
|
207
|
+
function ze(e2, n) {
|
|
208
|
+
Be(e2, e2.definitions, "@_surface", n);
|
|
209
|
+
}
|
|
210
|
+
function He(e2, n, r) {
|
|
211
|
+
Be(e2, n, "@_editor", r);
|
|
212
|
+
}
|
|
213
|
+
var E = { nodeWidth: 288, nodeHeight: 96, horizontalGap: 48, verticalGap: 72 };
|
|
214
|
+
var fe = E.nodeHeight + E.verticalGap;
|
|
215
|
+
var V = E.nodeWidth + E.horizontalGap;
|
|
216
|
+
var Ke = E.nodeWidth * 0.75;
|
|
217
|
+
function fn(e2, n) {
|
|
218
|
+
return !(e2.x + e2.width + E.horizontalGap <= n.x || n.x + n.width + E.horizontalGap <= e2.x || e2.y + e2.height + E.verticalGap <= n.y || n.y + n.height + E.verticalGap <= e2.y);
|
|
219
|
+
}
|
|
220
|
+
function pn(e2, n) {
|
|
221
|
+
let r = ({ x: o, y: s2 }) => [Math.abs(o) + Math.abs(s2), Math.abs(s2), -o, -s2], [t2, i] = [r(e2), r(n)];
|
|
222
|
+
for (let [o, s2] of t2.entries())
|
|
223
|
+
if (s2 !== i[o])
|
|
224
|
+
return s2 - i[o];
|
|
225
|
+
return 0;
|
|
226
|
+
}
|
|
227
|
+
function Dn(e2) {
|
|
228
|
+
let n = [];
|
|
229
|
+
for (let r = -e2;r <= e2; r++)
|
|
230
|
+
for (let t2 = -e2;t2 <= e2; t2++)
|
|
231
|
+
(Math.abs(r) === e2 || Math.abs(t2) === e2) && n.push({ x: r, y: t2 });
|
|
232
|
+
return n.sort(pn);
|
|
233
|
+
}
|
|
234
|
+
function Ge(e2, n) {
|
|
235
|
+
let r = ({ x: t2, y: i }) => !n.some((o) => fn({ x: t2, y: i, width: E.nodeWidth, height: E.nodeHeight }, o));
|
|
236
|
+
if (r(e2))
|
|
237
|
+
return e2;
|
|
238
|
+
for (let t2 = 1;t2 <= n.length; t2++)
|
|
239
|
+
for (let i of Dn(t2)) {
|
|
240
|
+
let o = { x: e2.x + i.x * V, y: e2.y + i.y * fe };
|
|
241
|
+
if (r(o))
|
|
242
|
+
return o;
|
|
243
|
+
}
|
|
244
|
+
return { x: Math.max(...n.map((t2) => t2.x + t2.width)) + E.horizontalGap, y: e2.y };
|
|
245
|
+
}
|
|
246
|
+
var _n = "https://www.omg.org/spec/DMN/20230324/MODEL/";
|
|
247
|
+
function gn(e2) {
|
|
248
|
+
return e2.__$$element === "decision";
|
|
249
|
+
}
|
|
250
|
+
function R(e2) {
|
|
251
|
+
return (e2.drgElement ?? []).filter(gn);
|
|
252
|
+
}
|
|
253
|
+
function _2(e2) {
|
|
254
|
+
return e2["@_id"] ?? "";
|
|
255
|
+
}
|
|
256
|
+
function D(e2, n) {
|
|
257
|
+
return e2["@_id"] || (e2["@_id"] = s(n)), e2["@_id"];
|
|
258
|
+
}
|
|
259
|
+
function $2(e2) {
|
|
260
|
+
if (e2)
|
|
261
|
+
return e2.startsWith("#") ? e2.slice(1) : e2.includes("#") || e2.includes(":") || e2.includes("/") ? undefined : e2;
|
|
262
|
+
}
|
|
263
|
+
function pe(e2, n, r) {
|
|
264
|
+
if (!e2)
|
|
265
|
+
return;
|
|
266
|
+
if (!e2.includes(":"))
|
|
267
|
+
return e2.includes("#") || e2.includes("/") ? undefined : e2;
|
|
268
|
+
let [t2, i, ...o] = e2.split(":");
|
|
269
|
+
if (!t2 || !i || o.length > 0)
|
|
270
|
+
return;
|
|
271
|
+
let s2 = `@_xmlns:${t2}`, a = r.map((l) => l[s2]).find((l) => typeof l == "string");
|
|
272
|
+
return a === _n || a === n["@_namespace"] ? i : undefined;
|
|
273
|
+
}
|
|
274
|
+
function xn(e2, n, r) {
|
|
275
|
+
let t2 = r.indexOf(":");
|
|
276
|
+
if (t2 >= 0)
|
|
277
|
+
return `${r.slice(0, t2)}:${e2}`;
|
|
278
|
+
let i = n["@_namespace"];
|
|
279
|
+
if (!i || n["@_xmlns"] === i)
|
|
280
|
+
return e2;
|
|
281
|
+
let o = Object.entries(n).find(([l, f]) => l.startsWith("@_xmlns:") && f === i)?.[0];
|
|
282
|
+
if (o)
|
|
283
|
+
return `${o.slice(8)}:${e2}`;
|
|
284
|
+
let s2 = "tns", a = 2;
|
|
285
|
+
for (;n[`@_xmlns:${s2}`]; )
|
|
286
|
+
s2 = `tns${a++}`;
|
|
287
|
+
return n[`@_xmlns:${s2}`] = i, `${s2}:${e2}`;
|
|
288
|
+
}
|
|
289
|
+
function We(e2, n, r) {
|
|
290
|
+
let t2 = e2["dmndi:DMNDI"];
|
|
291
|
+
if (t2)
|
|
292
|
+
for (let i of t2["dmndi:DMNDiagram"] ?? [])
|
|
293
|
+
i["dmndi:DMNDiagramElement"] = i["dmndi:DMNDiagramElement"]?.flatMap((o) => {
|
|
294
|
+
let s2 = o["@_dmnElementRef"], a = pe(s2, e2, [o, i, t2, e2]);
|
|
295
|
+
if (!a)
|
|
296
|
+
return [o];
|
|
297
|
+
let l = r?.get(a);
|
|
298
|
+
return l ? [{ ...o, "@_dmnElementRef": xn(l, e2, s2 ?? "") }] : n.has(a) ? [] : [o];
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function Ye(e2, n) {
|
|
302
|
+
return e2.drgElement?.find((t2) => t2["@_id"] === n)?.__$$element === "inputData" ? Ke : E.nodeWidth;
|
|
303
|
+
}
|
|
304
|
+
function En(e2, n, r) {
|
|
305
|
+
return { __$$element: "dmndi:DMNShape", "@_id": s("DMNShape"), "@_dmnElementRef": n, "dc:Bounds": { "@_x": r.x, "@_y": r.y, "@_width": Ye(e2, n), "@_height": E.nodeHeight } };
|
|
306
|
+
}
|
|
307
|
+
function Xe(e2, n) {
|
|
308
|
+
return e2.drgElement?.find((r) => r["@_id"] === n)?.__$$element;
|
|
309
|
+
}
|
|
310
|
+
function yn(e2) {
|
|
311
|
+
return e2["dc:Bounds"];
|
|
312
|
+
}
|
|
313
|
+
function bn(e2, n) {
|
|
314
|
+
let r = e2["dmndi:DMNDI"];
|
|
315
|
+
return r ? (r["dmndi:DMNDiagram"] ?? []).flatMap((t2) => (t2["dmndi:DMNDiagramElement"] ?? []).flatMap((i) => {
|
|
316
|
+
let o = yn(i), s2 = pe(i["@_dmnElementRef"], e2, [i, t2, r, e2]);
|
|
317
|
+
return !o || n && s2 === n ? [] : [{ x: o["@_x"], y: o["@_y"], width: Ye(e2, s2 ?? ""), height: Math.max(o["@_height"] ?? 0, E.nodeHeight), kind: s2 ? Xe(e2, s2) : undefined }];
|
|
318
|
+
})) : [];
|
|
319
|
+
}
|
|
320
|
+
function $n(e2, n) {
|
|
321
|
+
let r = bn(e2);
|
|
322
|
+
return r.length === 0 ? { x: 0, y: 0 } : Ge(hn(e2, r, n), r);
|
|
323
|
+
}
|
|
324
|
+
function hn(e2, n, r) {
|
|
325
|
+
if (r && Xe(e2, r) === "inputData") {
|
|
326
|
+
let t2 = n.filter((i) => i.kind === "inputData");
|
|
327
|
+
if (t2.length > 0) {
|
|
328
|
+
let i = t2.reduce((o, s2) => s2.x > o.x ? s2 : o, t2[0]);
|
|
329
|
+
return { x: i.x + V, y: i.y };
|
|
330
|
+
}
|
|
331
|
+
return { x: Math.min(...n.map((i) => i.x)), y: Math.max(...n.map((i) => i.y)) + fe };
|
|
332
|
+
}
|
|
333
|
+
return { x: Math.max(...n.map((t2) => t2.x)) + V, y: Math.min(...n.map((t2) => t2.y)) };
|
|
334
|
+
}
|
|
335
|
+
function Ze(e2, n) {
|
|
336
|
+
let r = e2["dmndi:DMNDI"]?.["dmndi:DMNDiagram"]?.[0]?.["dmndi:DMNDiagramElement"];
|
|
337
|
+
r?.length && r.push(En(e2, n, $n(e2, n)));
|
|
338
|
+
}
|
|
339
|
+
var Rn = e.First;
|
|
340
|
+
function In(e2 = "string") {
|
|
341
|
+
return { __$$element: "decisionTable", "@_id": s("decisionTable"), "@_hitPolicy": Rn, input: [{ "@_id": s("input"), "@_label": "Input 1", inputExpression: { "@_id": s("inputExpression"), "@_typeRef": "string", text: { __$$text: "" } } }], output: [{ "@_id": s("output"), "@_label": "Output 1", "@_name": "output1", "@_typeRef": e2 }], rule: [{ "@_id": s("rule"), inputEntry: [{ "@_id": s("inputEntry"), text: { __$$text: "-" } }], outputEntry: [{ "@_id": s("outputEntry"), text: { __$$text: S } }] }] };
|
|
342
|
+
}
|
|
343
|
+
function wn(e2) {
|
|
344
|
+
return { __$$element: "literalExpression", "@_id": s("literalExpression"), ...e2 ? { "@_typeRef": e2 } : {}, text: { __$$text: "" } };
|
|
345
|
+
}
|
|
346
|
+
var Mn = { decisionTable: { editor: "decision-table", create: In, labelKey: "drd_logic_decision_table", icon: "table" }, literalExpression: { editor: "literal-expression", create: wn, labelKey: "drd_logic_literal_expression", icon: "braces" } };
|
|
347
|
+
var Et = Object.keys(Mn);
|
|
348
|
+
function De(e2, n, r) {
|
|
349
|
+
let t2 = Tn(r);
|
|
350
|
+
for (let i of e2.drgElement ?? [])
|
|
351
|
+
i["@_id"] !== n && de(i, t2);
|
|
352
|
+
}
|
|
353
|
+
function Tn(e2) {
|
|
354
|
+
let n = new Map(e2), r = [];
|
|
355
|
+
for (;n.size > 0; ) {
|
|
356
|
+
let t2 = [...n].find(([, i]) => !n.has(i));
|
|
357
|
+
if (!t2)
|
|
358
|
+
return [...r, ...n];
|
|
359
|
+
r.push(t2), n.delete(t2[0]);
|
|
360
|
+
}
|
|
361
|
+
return r;
|
|
362
|
+
}
|
|
363
|
+
var Qe = ["informationRequirement", "knowledgeRequirement", "authorityRequirement"];
|
|
364
|
+
function Je(e2, n) {
|
|
365
|
+
let r = new Map((e2.drgElement ?? []).map((o) => [o["@_id"] ?? "", o])), t2 = new Set, i = [n];
|
|
366
|
+
for (;i.length > 0; ) {
|
|
367
|
+
let o = r.get(i.shift() ?? "");
|
|
368
|
+
if (!o)
|
|
369
|
+
continue;
|
|
370
|
+
let s2 = [...o.informationRequirement ?? [], ...o.knowledgeRequirement ?? [], ...o.authorityRequirement ?? []];
|
|
371
|
+
for (let a of s2) {
|
|
372
|
+
let l = a.requiredInput?.["@_href"] ?? a.requiredDecision?.["@_href"] ?? a.requiredKnowledge?.["@_href"] ?? a.requiredAuthority?.["@_href"], f = $2(l);
|
|
373
|
+
!f || t2.has(f) || (t2.add(f), i.push(f));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return t2;
|
|
377
|
+
}
|
|
378
|
+
var Nn = new Set([..._t.map((e2) => m[e2]), "feel"]);
|
|
379
|
+
function N(e2) {
|
|
380
|
+
return !!e2 && !Nn.has(e2);
|
|
381
|
+
}
|
|
382
|
+
function I(e2) {
|
|
383
|
+
return e2?.__$$text ?? "";
|
|
384
|
+
}
|
|
385
|
+
function x2(e2, n) {
|
|
386
|
+
return { ...e2, __$$text: n };
|
|
387
|
+
}
|
|
388
|
+
function U(e2, n, r) {
|
|
389
|
+
let t2 = D(n, r);
|
|
390
|
+
return e2.has(t2) && (n["@_id"] = s(r), t2 = n["@_id"]), e2.add(t2), t2;
|
|
391
|
+
}
|
|
392
|
+
function S2(e2) {
|
|
393
|
+
return !(e2.import?.length || e2.elementCollection?.length || e2.businessContextElement?.length || [e2["@_expressionLanguage"], e2["@_typeLanguage"]].some(N));
|
|
394
|
+
}
|
|
395
|
+
function F(e2) {
|
|
396
|
+
return !(e2.supportedObjective?.length || e2.impactedPerformanceIndicator?.length || e2.decisionMaker?.length || e2.decisionOwner?.length || e2.usingProcess?.length || e2.usingTask?.length);
|
|
397
|
+
}
|
|
398
|
+
function Sn(e2) {
|
|
399
|
+
let n = "expression" in e2 ? e2.expression : undefined, r = n?.__$$element === "decisionTable" ? n.output ?? [] : [];
|
|
400
|
+
if (se(r.length))
|
|
401
|
+
return r.map((t2, i) => ({ name: B({ id: t2["@_id"] ?? "", label: t2["@_label"], name: t2["@_name"] }, i), typeRef: t2["@_typeRef"] }));
|
|
402
|
+
}
|
|
403
|
+
function j2(e2, n) {
|
|
404
|
+
let r = new Set([...(n.informationRequirement ?? []).map((i) => i.requiredDecision?.["@_href"]), ...(n.knowledgeRequirement ?? []).map((i) => i.requiredKnowledge?.["@_href"])].flatMap((i) => {
|
|
405
|
+
let o = $2(i);
|
|
406
|
+
return o ? [o] : [];
|
|
407
|
+
})), t2 = _2(n);
|
|
408
|
+
return (e2.drgElement ?? []).flatMap((i) => {
|
|
409
|
+
let o = _2(i), s2 = !r.has(o) && o !== t2 && i.__$$element === "decision" && !Je(e2, o).has(t2);
|
|
410
|
+
if (!r.has(o) && !s2)
|
|
411
|
+
return [];
|
|
412
|
+
let a = i.variable, l = a?.["@_name"] ?? i["@_name"];
|
|
413
|
+
return l ? [{ name: l, ...i["@_label"] && i["@_label"] !== l ? { label: i["@_label"] } : {}, typeRef: a?.["@_typeRef"], ...s2 ? { requirableId: o } : {}, members: Sn(i) }] : [];
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
function A2(e2) {
|
|
417
|
+
let n = new Set;
|
|
418
|
+
for (let [r, t2] of e2)
|
|
419
|
+
if (r)
|
|
420
|
+
for (let i of X(r, t2))
|
|
421
|
+
n.add(i.split(".")[0]);
|
|
422
|
+
return n;
|
|
423
|
+
}
|
|
424
|
+
function B2(e2) {
|
|
425
|
+
return e2.variable?.["@_name"] ?? e2["@_name"];
|
|
426
|
+
}
|
|
427
|
+
function z(e2, n, r) {
|
|
428
|
+
return e2.map((t2) => {
|
|
429
|
+
let i = D(t2, "inputData"), o = n.get(i), s2 = t2.variable?.["@_name"] ?? t2["@_name"];
|
|
430
|
+
return { id: i, name: t2["@_name"], label: t2["@_label"], variableId: t2.variable ? D(t2.variable, "variable") : s("variable"), variableName: t2.variable?.["@_name"], typeRef: t2.variable?.["@_typeRef"], description: t2.description?.__$$text, requirementId: o ? D(o, "informationRequirement") : undefined, requirementFromSource: !!o && !r.has(s2) };
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
function v(e2) {
|
|
434
|
+
let n = new Map;
|
|
435
|
+
for (let r of e2.informationRequirement ?? []) {
|
|
436
|
+
let t2 = $2(r.requiredInput?.["@_href"]);
|
|
437
|
+
t2 && n.set(t2, r);
|
|
438
|
+
}
|
|
439
|
+
return n;
|
|
440
|
+
}
|
|
441
|
+
function An(e2, n) {
|
|
442
|
+
let r = e2?.variable || n.variableId || n.variableName !== undefined || n.typeRef !== undefined ? { ...e2?.variable, "@_id": n.variableId, "@_name": n.variableName ?? n.name, "@_typeRef": n.typeRef } : undefined;
|
|
443
|
+
return { ...e2 ?? { __$$element: "inputData", "@_name": n.name }, __$$element: "inputData", "@_id": n.id, "@_name": n.name, "@_label": n.label, description: n.description ? x2(e2?.description, n.description) : undefined, variable: r };
|
|
444
|
+
}
|
|
445
|
+
function H(e2, n) {
|
|
446
|
+
return e2.variable || n.variableId || n.variableName !== undefined || n.variableTypeRef !== undefined ? { ...e2.variable, "@_id": n.variableId, "@_name": n.variableName ?? n.name, "@_typeRef": n.variableTypeRef } : undefined;
|
|
447
|
+
}
|
|
448
|
+
function K2(e2, n, r) {
|
|
449
|
+
let t2 = new Map(e2.informationRequirement?.map((u) => [_2(u), u]) ?? []), i = v(e2), o = (e2.informationRequirement ?? []).filter((u) => u.requiredDecision), s2 = (n.scopeVariables ?? []).filter((u) => u.requirableId), a = s2.length > 0 ? r() : new Set, l = new Set(o.flatMap((u) => $2(u.requiredDecision?.["@_href"]) ?? [])), f = s2.flatMap((u) => a.has(u.name) && !l.has(u.requirableId ?? "") ? [{ "@_id": s("informationRequirement"), requiredDecision: { "@_href": `#${u.requirableId}` } }] : []), c = n.inputData.flatMap((u) => {
|
|
450
|
+
if (!u.requirementId)
|
|
451
|
+
return [];
|
|
452
|
+
let m2 = t2.get(u.requirementId) ?? i.get(u.id);
|
|
453
|
+
return [{ ...m2, "@_id": u.requirementId, requiredDecision: undefined, requiredInput: { ...m2?.requiredInput, "@_href": `#${u.id}` } }];
|
|
454
|
+
});
|
|
455
|
+
return [...o, ...f, ...c];
|
|
456
|
+
}
|
|
457
|
+
function G(e2) {
|
|
458
|
+
let n = new Map;
|
|
459
|
+
for (let r of e2.drgElement ?? []) {
|
|
460
|
+
let t2 = r, i = t2["@_name"];
|
|
461
|
+
if (!i || t2["@_label"] || !/\s/.test(i))
|
|
462
|
+
continue;
|
|
463
|
+
let o = t2.variable?.["@_name"], s2 = o && !/\s/.test(o) ? o : O(e2, i);
|
|
464
|
+
t2["@_label"] = i, t2["@_name"] = s2, t2.variable && (t2.variable["@_name"] = s2), i !== s2 && n.set(i, s2);
|
|
465
|
+
}
|
|
466
|
+
for (let r of e2.drgElement ?? []) {
|
|
467
|
+
let t2 = r, i = t2["@_name"], o = t2.variable?.["@_name"];
|
|
468
|
+
!i || !o || o === i || o !== i.replace(/\s+/g, "") || (n.set(o, i), t2.variable && (t2.variable["@_name"] = i));
|
|
469
|
+
}
|
|
470
|
+
n.size > 0 && De(e2, "", n);
|
|
471
|
+
}
|
|
472
|
+
function vn(e2, n, r, t2) {
|
|
473
|
+
let i = [];
|
|
474
|
+
if (r.size === 0 && t2.size === 0 || (t2.size > 0 && De(e2, n, t2), r.size === 0))
|
|
475
|
+
return i;
|
|
476
|
+
for (let o of e2.drgElement ?? [])
|
|
477
|
+
o.__$$element !== "decision" || _2(o) === n || !o.informationRequirement || (o.informationRequirement = o.informationRequirement.filter((s2) => {
|
|
478
|
+
let a = $2(s2.requiredInput?.["@_href"]);
|
|
479
|
+
return !a || !r.has(a) ? true : (i.push(_2(s2)), false);
|
|
480
|
+
}));
|
|
481
|
+
return i;
|
|
482
|
+
}
|
|
483
|
+
function W(e2, n, r) {
|
|
484
|
+
let t2 = structuredClone(e2.document), i = t2.definitions, o = i.drgElement?.find((d) => d.__$$element === "decision" && _2(d) === e2.sourceDecisionId);
|
|
485
|
+
if (!o)
|
|
486
|
+
throw new Error("Business rule decision is missing");
|
|
487
|
+
let s2 = new Set(e2.sourceInputDataIds), a = i.drgElement?.filter((d) => d.__$$element === "inputData" && s2.has(_2(d))) ?? [], l = new Map(a.map((d) => [_2(d), d])), f = new Map(a.flatMap((d) => d.variable?.["@_id"] ? [[d.variable["@_id"], d]] : [])), c = n.inputData.map((d) => {
|
|
488
|
+
let y = l.get(d.id) ?? (d.variableId ? f.get(d.variableId) : undefined);
|
|
489
|
+
return { current: y, inputId: d.id, updated: An(y, d) };
|
|
490
|
+
}), u = new Map(c.flatMap(({ current: d, updated: y }) => d?.["@_id"] ? [[d["@_id"], y]] : [])), m2 = c.flatMap(({ current: d, updated: y }) => d ? [] : [y]), b = r(o, n), q = new Set((o.informationRequirement ?? []).filter((d) => !d.requiredDecision).map(_2)), ge = new Set(n.inputData.map((d) => d.requirementId).filter((d) => !!d)), xe = new Set([...[...q].filter((d) => !ge.has(d)), ...a.map(_2).filter((d) => !u.has(d))]), p = new Map;
|
|
491
|
+
o["@_id"] && o["@_id"] !== n.decision.id && p.set(o["@_id"], n.decision.id);
|
|
492
|
+
for (let { current: d, inputId: y } of c)
|
|
493
|
+
d?.["@_id"] && d["@_id"] !== y && p.set(d["@_id"], y);
|
|
494
|
+
i["@_id"] = n.id, i["@_name"] = n.name, i["@_namespace"] = n.namespace, i["@_exporter"] = n.exporter, i["@_exporterVersion"] = n.exporterVersion;
|
|
495
|
+
let h = new Set(a.map(_2).filter((d) => !u.has(d))), Ee = new Map(c.flatMap(({ current: d, updated: y }) => {
|
|
496
|
+
let T = d && B2(d), Q = B2(y);
|
|
497
|
+
return T && Q && T !== Q ? [[T, Q]] : [];
|
|
498
|
+
})), X2 = B2(o), Z = B2(b);
|
|
499
|
+
X2 && Z && X2 !== Z && Ee.set(X2, Z), i.drgElement = i.drgElement?.flatMap((d) => {
|
|
500
|
+
let y = _2(d);
|
|
501
|
+
if (y === e2.sourceDecisionId)
|
|
502
|
+
return [...m2, b];
|
|
503
|
+
if (s2.has(y)) {
|
|
504
|
+
let T = u.get(y);
|
|
505
|
+
return T ? [T] : [];
|
|
506
|
+
}
|
|
507
|
+
return [d];
|
|
508
|
+
});
|
|
509
|
+
let sn = vn(i, e2.sourceDecisionId, h, Ee);
|
|
510
|
+
We(i, new Set([...xe, ...sn]), p);
|
|
511
|
+
for (let d of m2)
|
|
512
|
+
Ze(i, _2(d));
|
|
513
|
+
return t2;
|
|
514
|
+
}
|
|
515
|
+
function Pn(e2) {
|
|
516
|
+
return t.includes(e2);
|
|
517
|
+
}
|
|
518
|
+
function en(e2, n) {
|
|
519
|
+
return e2 ? { id: D(e2, n), text: I(e2.text) } : undefined;
|
|
520
|
+
}
|
|
521
|
+
var qn = new Set(["decision", "inputData", "businessKnowledgeModel", "knowledgeSource"]);
|
|
522
|
+
var Ln = new Set(["textAnnotation", "association"]);
|
|
523
|
+
function _e(e2) {
|
|
524
|
+
let n = e2.definitions;
|
|
525
|
+
return S2(n) ? (n.drgElement ?? []).every((t2) => qn.has(t2.__$$element)) && (n.artifact ?? []).every((t2) => Ln.has(t2.__$$element)) : false;
|
|
526
|
+
}
|
|
527
|
+
function On(e2, n) {
|
|
528
|
+
let r = e2.definitions;
|
|
529
|
+
R(r).length > 1 && G(r);
|
|
530
|
+
let t2 = n !== undefined;
|
|
531
|
+
if (!S2(r) || !t2 && r.artifact?.length)
|
|
532
|
+
return;
|
|
533
|
+
let i = R(r), o = r.drgElement?.filter((p) => p.__$$element === "inputData") ?? [];
|
|
534
|
+
if (!t2 && (i.length !== 1 || i.length + o.length !== (r.drgElement?.length ?? 0)))
|
|
535
|
+
return;
|
|
536
|
+
let s2 = t2 ? i.find((p) => _2(p) === n) : i[0];
|
|
537
|
+
if (!s2)
|
|
538
|
+
return;
|
|
539
|
+
let a = s2.expression?.__$$element === "decisionTable" ? s2.expression : undefined, l = new Set(o.map(_2)), f = new Set;
|
|
540
|
+
if (!a || !t2 && (s2.knowledgeRequirement?.length || s2.authorityRequirement?.length) || !F(s2) || s2.informationRequirement?.some((p) => {
|
|
541
|
+
if (p.requiredDecision)
|
|
542
|
+
return !t2;
|
|
543
|
+
let h = $2(p.requiredInput?.["@_href"]);
|
|
544
|
+
return !h || !l.has(h) || f.has(h) ? true : (f.add(h), false);
|
|
545
|
+
}))
|
|
546
|
+
return;
|
|
547
|
+
let c = a["@_hitPolicy"] ?? e.Unique, u = a["@_aggregation"], m2 = a.input?.length ?? 0, b = a.output.length, q = a.annotation?.length ?? 0;
|
|
548
|
+
if (!(!Pn(c) || u !== undefined && (c !== e.Collect || !x(u)) || b === 0 || a.output.some((p) => p.defaultOutputEntry) || q > 1 || a.rule?.some((p) => (p.inputEntry?.length ?? 0) !== m2 || p.outputEntry.length !== b || (p.annotationEntry?.length ?? 0) !== q) || [...(a.input ?? []).flatMap((p) => [p.inputExpression["@_expressionLanguage"], p.inputValues?.["@_expressionLanguage"]]), ...a.output.map((p) => p.outputValues?.["@_expressionLanguage"]), ...a.rule?.flatMap((p) => [...p.inputEntry?.map((h) => h["@_expressionLanguage"]) ?? [], ...p.outputEntry.map((h) => h["@_expressionLanguage"])]) ?? []].some(N) || [...(a.input ?? []).map((p) => p.inputValues), ...a.output.map((p) => p.outputValues)].some((p) => p?.extensionElements !== undefined)))
|
|
549
|
+
return { definitions: r, decision: s2, table: a, inputData: o, scopeVariables: t2 ? j2(r, s2) : [], hitPolicy: c };
|
|
550
|
+
}
|
|
551
|
+
function kn(e2) {
|
|
552
|
+
let n = e2.decision.decisionTable, r = [...n.inputs.flatMap((t2) => [[t2.expressionText, "expression"], [t2.allowedValues?.text, "unaryTests"]]), ...n.outputs.map((t2) => [t2.allowedValues?.text, "unaryTests"]), ...n.rules.flatMap((t2) => [...t2.inputEntries.map((i) => [i.text, "unaryTests"]), ...t2.outputEntries.map((i) => [i.text, "expression"])])];
|
|
553
|
+
return A2(r);
|
|
554
|
+
}
|
|
555
|
+
function Cn(e2, n) {
|
|
556
|
+
let r = On(e2, n);
|
|
557
|
+
if (!r)
|
|
558
|
+
return;
|
|
559
|
+
let { definitions: t2, decision: i, table: o, inputData: s2, hitPolicy: a } = r, l = new Set, f = new Set, c = o.input?.map((m2) => ({ id: U(l, m2, "input"), label: m2["@_label"], expressionId: D(m2.inputExpression, "inputExpression"), expressionText: I(m2.inputExpression.text), typeRef: m2.inputExpression["@_typeRef"], allowedValues: en(m2.inputValues, "inputValues") })) ?? [], u = $(c);
|
|
560
|
+
return { id: D(t2, "definitions"), name: t2["@_name"], ...r.scopeVariables.length ? { scopeVariables: r.scopeVariables } : {}, namespace: t2["@_namespace"], exporter: t2["@_exporter"], exporterVersion: t2["@_exporterVersion"], itemDefinitions: t2.itemDefinition?.map((m2) => ({ name: m2["@_name"], isCollection: m2["@_isCollection"] === true, typeRef: m2.typeRef?.__$$text, allowedValues: m2.allowedValues?.text?.__$$text })), inputData: z(s2, v(i), u), decision: { id: D(i, "decision"), name: i["@_name"] ?? "", label: i["@_label"], variableId: i.variable ? D(i.variable, "variable") : s("variable"), variableName: i.variable?.["@_name"], variableTypeRef: i.variable?.["@_typeRef"], description: i.description?.__$$text, question: i.question?.__$$text, allowedAnswers: i.allowedAnswers?.__$$text, decisionTable: { id: D(o, "decisionTable"), label: o["@_label"], typeRef: o["@_typeRef"], outputLabel: o["@_outputLabel"], preferredOrientation: o["@_preferredOrientation"], hitPolicy: a, aggregation: x(o["@_aggregation"]) ? o["@_aggregation"] : undefined, inputs: c, outputs: o.output.map((m2) => ({ id: U(l, m2, "output"), label: m2["@_label"], name: m2["@_name"], typeRef: m2["@_typeRef"], allowedValues: en(m2.outputValues, "outputValues"), description: m2.description?.__$$text })), annotations: o.annotation?.length ? o.annotation.map((m2) => ({ name: m2["@_name"] })) : [{ name: C }], rules: o.rule?.map((m2) => ({ id: U(f, m2, "rule"), description: m2.description?.__$$text, inputEntries: m2.inputEntry?.map((b) => ({ id: D(b, "inputEntry"), text: I(b.text) })) ?? [], outputEntries: m2.outputEntry.map((b) => ({ id: D(b, "outputEntry"), text: zn(I(b.text)) })), annotationEntries: o.annotation?.length ? m2.annotationEntry?.map((b) => I(b.text)) ?? [] : [""] })) ?? [] } } };
|
|
561
|
+
}
|
|
562
|
+
function Vn(e2, n) {
|
|
563
|
+
let r = structuredClone(e2), t2 = Cn(r, n);
|
|
564
|
+
return t2 ? { document: r, model: t2, sourceDecisionId: t2.decision.id, sourceInputDataIds: t2.inputData.map((i) => i.id) } : undefined;
|
|
565
|
+
}
|
|
566
|
+
function nn(e2, n) {
|
|
567
|
+
return n ? { ...e2, "@_id": n.id, text: x2(e2?.text, n.text) } : undefined;
|
|
568
|
+
}
|
|
569
|
+
function Bn(e2) {
|
|
570
|
+
switch (e2) {
|
|
571
|
+
case "Rule-as-Row":
|
|
572
|
+
case "Rule-as-Column":
|
|
573
|
+
case "CrossTable":
|
|
574
|
+
return e2;
|
|
575
|
+
default:
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function Un(e2, n) {
|
|
580
|
+
let r = !e2.annotation?.length && n.annotations.length === 1 && n.annotations[0].name === C && n.rules.every((s2) => s2.annotationEntries.length === 1 && s2.annotationEntries[0] === ""), t2 = new Map(e2.input?.map((s2) => [s2["@_id"], s2]) ?? []), i = new Map(e2.output.map((s2) => [s2["@_id"], s2])), o = new Map(e2.rule?.map((s2) => [s2["@_id"], s2]) ?? []);
|
|
581
|
+
return { ...e2, "@_id": n.id, "@_label": n.label, "@_typeRef": n.typeRef, "@_outputLabel": n.outputLabel, "@_preferredOrientation": Bn(n.preferredOrientation), "@_hitPolicy": n.hitPolicy === e.Unique ? undefined : n.hitPolicy, "@_aggregation": n.hitPolicy === e.Collect ? n.aggregation : undefined, input: n.inputs.map((s2) => {
|
|
582
|
+
let a = t2.get(s2.id);
|
|
583
|
+
return { ...a, "@_id": s2.id, "@_label": s2.label, inputExpression: { ...a?.inputExpression, "@_id": s2.expressionId, "@_typeRef": s2.typeRef, text: x2(a?.inputExpression.text, s2.expressionText) }, inputValues: nn(a?.inputValues, s2.allowedValues) };
|
|
584
|
+
}), output: n.outputs.map((s2) => {
|
|
585
|
+
let a = i.get(s2.id);
|
|
586
|
+
return { ...a, "@_id": s2.id, "@_label": s2.label, "@_name": s2.name, "@_typeRef": s2.typeRef, description: s2.description ? x2(a?.description, s2.description) : undefined, outputValues: nn(a?.outputValues, s2.allowedValues) };
|
|
587
|
+
}), annotation: r ? undefined : n.annotations.map((s2, a) => ({ ...e2.annotation?.[a], "@_name": s2.name })), rule: n.rules.map((s2) => {
|
|
588
|
+
let a = o.get(s2.id), l = new Map(a?.inputEntry?.map((c) => [c["@_id"], c]) ?? []), f = new Map(a?.outputEntry.map((c) => [c["@_id"], c]) ?? []);
|
|
589
|
+
return { ...a, "@_id": s2.id, description: s2.description === undefined ? undefined : x2(a?.description, s2.description), inputEntry: s2.inputEntries.map((c) => {
|
|
590
|
+
let u = l.get(c.id);
|
|
591
|
+
return { ...u, "@_id": c.id, text: x2(u?.text, c.text) };
|
|
592
|
+
}), outputEntry: s2.outputEntries.map((c) => {
|
|
593
|
+
let u = f.get(c.id);
|
|
594
|
+
return { ...u, "@_id": c.id, text: x2(u?.text, jn(c.text)) };
|
|
595
|
+
}), annotationEntry: r ? undefined : s2.annotationEntries.map((c, u) => ({ ...a?.annotationEntry?.[u], text: x2(a?.annotationEntry?.[u]?.text, c) })) };
|
|
596
|
+
}) };
|
|
597
|
+
}
|
|
598
|
+
function Fn(e2, n) {
|
|
599
|
+
let r = e2.expression?.__$$element === "decisionTable" ? e2.expression : undefined;
|
|
600
|
+
if (!r)
|
|
601
|
+
throw new Error("Business rule decision table is missing");
|
|
602
|
+
return { ...e2, __$$element: "decision", "@_id": n.decision.id, "@_name": n.decision.name, "@_label": n.decision.label, description: n.decision.description === undefined ? undefined : x2(e2.description, n.decision.description), question: n.decision.question === undefined ? undefined : x2(e2.question, n.decision.question), allowedAnswers: n.decision.allowedAnswers === undefined ? undefined : x2(e2.allowedAnswers, n.decision.allowedAnswers), variable: H(e2, n.decision), informationRequirement: K2(e2, n, () => kn(n)), expression: Un(r, n.decision.decisionTable) };
|
|
603
|
+
}
|
|
604
|
+
var jn = (e2) => e2.trim() ? e2 : S;
|
|
605
|
+
var zn = (e2) => re(e2) ? "" : e2;
|
|
606
|
+
function Hn(e2, n) {
|
|
607
|
+
return W(e2, n, Fn);
|
|
608
|
+
}
|
|
609
|
+
var Y = { createEditorProjection: Vn, updateDmnDocument: Hn };
|
|
610
|
+
function Kn(e2, n) {
|
|
611
|
+
let r = e2.definitions;
|
|
612
|
+
R(r).length > 1 && G(r);
|
|
613
|
+
let t2 = n !== undefined;
|
|
614
|
+
if (!S2(r) || !t2 && r.artifact?.length)
|
|
615
|
+
return;
|
|
616
|
+
let i = R(r), o = r.drgElement?.filter((c) => c.__$$element === "inputData") ?? [];
|
|
617
|
+
if (!t2 && (i.length !== 1 || i.length + o.length !== (r.drgElement?.length ?? 0)))
|
|
618
|
+
return;
|
|
619
|
+
let s2 = t2 ? i.find((c) => _2(c) === n) : i[0];
|
|
620
|
+
if (!s2 || !F(s2))
|
|
621
|
+
return;
|
|
622
|
+
let a = new Set(o.map(_2)), l = new Set;
|
|
623
|
+
if (!t2 && (s2.knowledgeRequirement?.length || s2.authorityRequirement?.length) || s2.informationRequirement?.some((c) => {
|
|
624
|
+
if (c.requiredDecision)
|
|
625
|
+
return !t2;
|
|
626
|
+
let u = $2(c.requiredInput?.["@_href"]);
|
|
627
|
+
return !u || !a.has(u) || l.has(u) ? true : (l.add(u), false);
|
|
628
|
+
}))
|
|
629
|
+
return;
|
|
630
|
+
let f = s2.expression?.__$$element === "literalExpression" ? s2.expression : undefined;
|
|
631
|
+
if (f && f.importedValues === undefined && !N(f["@_expressionLanguage"]))
|
|
632
|
+
return { definitions: r, decision: s2, expression: f, inputData: o, scopeVariables: j2(r, s2) };
|
|
633
|
+
}
|
|
634
|
+
function Gn(e2, n) {
|
|
635
|
+
let r = Kn(e2, n);
|
|
636
|
+
if (!r)
|
|
637
|
+
return;
|
|
638
|
+
let { definitions: t2, decision: i, expression: o, inputData: s2 } = r;
|
|
639
|
+
return { id: D(t2, "definitions"), name: t2["@_name"], ...r.scopeVariables.length ? { scopeVariables: r.scopeVariables } : {}, namespace: t2["@_namespace"], exporter: t2["@_exporter"], exporterVersion: t2["@_exporterVersion"], inputData: z(s2, v(i), new Set), decision: { id: D(i, "decision"), name: i["@_name"] ?? "", label: i["@_label"], variableId: i.variable ? D(i.variable, "variable") : s("variable"), variableName: i.variable?.["@_name"], variableTypeRef: i.variable?.["@_typeRef"], description: i.description?.__$$text, question: i.question?.__$$text, allowedAnswers: i.allowedAnswers?.__$$text, literalExpression: { id: D(o, "literalExpression"), label: o["@_label"], typeRef: o["@_typeRef"], text: I(o.text), expressionLanguage: o["@_expressionLanguage"] } } };
|
|
640
|
+
}
|
|
641
|
+
function Wn(e2, n) {
|
|
642
|
+
let r = structuredClone(e2), t2 = Gn(r, n);
|
|
643
|
+
return t2 ? { document: r, model: t2, sourceDecisionId: t2.decision.id, sourceInputDataIds: t2.inputData.map((i) => i.id) } : undefined;
|
|
644
|
+
}
|
|
645
|
+
function Yn(e2, n) {
|
|
646
|
+
return { ...e2, "@_id": n.id, "@_label": n.label, "@_typeRef": n.typeRef, "@_expressionLanguage": n.expressionLanguage, text: x2(e2.text, n.text) };
|
|
647
|
+
}
|
|
648
|
+
function Xn(e2, n) {
|
|
649
|
+
let r = e2.expression?.__$$element === "literalExpression" ? e2.expression : undefined;
|
|
650
|
+
if (!r)
|
|
651
|
+
throw new Error("Business rule literal expression is missing");
|
|
652
|
+
return { ...e2, __$$element: "decision", "@_id": n.decision.id, "@_name": n.decision.name, "@_label": n.decision.label, description: n.decision.description === undefined ? undefined : x2(e2.description, n.decision.description), question: n.decision.question === undefined ? undefined : x2(e2.question, n.decision.question), allowedAnswers: n.decision.allowedAnswers === undefined ? undefined : x2(e2.allowedAnswers, n.decision.allowedAnswers), variable: H(e2, n.decision), informationRequirement: K2(e2, n, () => A2([[n.decision.literalExpression.text, "expression"]])), expression: Yn(r, n.decision.literalExpression) };
|
|
653
|
+
}
|
|
654
|
+
function Zn(e2) {
|
|
655
|
+
if (e2.inputData.every((t2) => t2.requirementId))
|
|
656
|
+
return e2;
|
|
657
|
+
let n = A2([[e2.decision.literalExpression.text, "expression"]]), r = e2.inputData.map((t2) => t2.requirementId || !n.has(t2.variableName ?? t2.name ?? "") ? t2 : { ...t2, requirementId: s("informationRequirement") });
|
|
658
|
+
return { ...e2, inputData: r };
|
|
659
|
+
}
|
|
660
|
+
function Qn(e2, n) {
|
|
661
|
+
return W(e2, Zn(n), Xn);
|
|
662
|
+
}
|
|
663
|
+
var tn = { createEditorProjection: Wn, updateDmnDocument: Qn };
|
|
664
|
+
var P;
|
|
665
|
+
function rn(e2) {
|
|
666
|
+
let n = e2.definitions;
|
|
667
|
+
for (let r of n.drgElement ?? []) {
|
|
668
|
+
D(r, r.__$$element);
|
|
669
|
+
for (let t2 of Qe) {
|
|
670
|
+
let i = r[t2];
|
|
671
|
+
if (Array.isArray(i))
|
|
672
|
+
for (let o of i)
|
|
673
|
+
D(o, t2);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
for (let r of n.artifact ?? [])
|
|
677
|
+
D(r, r.__$$element);
|
|
678
|
+
return { kind: "drd", document: e2 };
|
|
679
|
+
}
|
|
680
|
+
var Jn = { "condition-rule": true, "decision-table": true, "decision-graph": false };
|
|
681
|
+
function et(e2) {
|
|
682
|
+
let n = Ue(e2);
|
|
683
|
+
return n === undefined || Jn[n];
|
|
684
|
+
}
|
|
685
|
+
function on(e2, { allowDrdDocuments: n = false }) {
|
|
686
|
+
let r = e2.definitions;
|
|
687
|
+
if (r["@_namespace"] === ue && r["@_id"] === ce && r["@_name"] === "" && Object.keys(r).every((i) => i.startsWith("@_xmlns") || i === "@_id" || i === "@_name" || i === "@_namespace"))
|
|
688
|
+
return { kind: "uninitialized" };
|
|
689
|
+
if (n && !et(e2))
|
|
690
|
+
return _e(e2) ? rn(e2) : { kind: "unsupported", reason: "unsupported-profile" };
|
|
691
|
+
let t2 = Y.createEditorProjection(e2);
|
|
692
|
+
return t2 ? { kind: "decision-table", model: t2.model, context: { document: t2.document, sourceDecisionId: t2.sourceDecisionId, sourceInputDataIds: t2.sourceInputDataIds } } : n && _e(e2) ? rn(e2) : { kind: "unsupported", reason: "unsupported-profile" };
|
|
693
|
+
}
|
|
694
|
+
function nt(e2, n = {}) {
|
|
695
|
+
if (P?.xml === e2 && P.allowDrdDocuments === !!n.allowDrdDocuments) {
|
|
696
|
+
let { result: i } = P;
|
|
697
|
+
return P = undefined, i;
|
|
698
|
+
}
|
|
699
|
+
if (!e2.trim())
|
|
700
|
+
return { kind: "uninitialized" };
|
|
701
|
+
let r = Ft(e2);
|
|
702
|
+
if (r.status === "error")
|
|
703
|
+
return { kind: "unsupported", reason: r.reason };
|
|
704
|
+
let t2 = Is(r.losses);
|
|
705
|
+
if (t2)
|
|
706
|
+
return { kind: "unsupported", reason: t2 };
|
|
707
|
+
if (r.originalVersion !== "1.1")
|
|
708
|
+
try {
|
|
709
|
+
return on(Ot(e2), n);
|
|
710
|
+
} catch (i) {
|
|
711
|
+
return console.error("DMN: could not project a well-formed document", i), { kind: "unsupported", reason: "invalid-xml" };
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
async function tt(e2, n = {}) {
|
|
715
|
+
let r = nt(e2, n);
|
|
716
|
+
if (r)
|
|
717
|
+
return r;
|
|
718
|
+
let t2 = await bs(e2);
|
|
719
|
+
if (t2.status === "error")
|
|
720
|
+
return { kind: "unsupported", reason: t2.reason };
|
|
721
|
+
try {
|
|
722
|
+
return on(t2.document, n);
|
|
723
|
+
} catch (i) {
|
|
724
|
+
return console.error("DMN: could not project a well-formed document", i), { kind: "unsupported", reason: "invalid-xml" };
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
async function Wt(e2, n = {}) {
|
|
728
|
+
let r = await tt(e2, n);
|
|
729
|
+
return P = { xml: e2, allowDrdDocuments: !!n.allowDrdDocuments, result: r }, { supported: r.kind !== "unsupported" };
|
|
730
|
+
}
|
|
731
|
+
function it(e2, n, r) {
|
|
732
|
+
let t2 = R(e2.definitions).find((i) => _2(i) === n);
|
|
733
|
+
t2 && je(e2, t2) && He(e2, t2, r);
|
|
734
|
+
}
|
|
735
|
+
function Yt(e2) {
|
|
736
|
+
return tn.createEditorProjection(e2)?.model;
|
|
737
|
+
}
|
|
738
|
+
function Xt() {
|
|
739
|
+
let e2 = Y.createEditorProjection(Ot(Le));
|
|
740
|
+
if (!e2)
|
|
741
|
+
throw new Error("Default business rule is not a decision table");
|
|
742
|
+
return { document: e2.document, sourceDecisionId: e2.sourceDecisionId, sourceInputDataIds: e2.sourceInputDataIds };
|
|
743
|
+
}
|
|
744
|
+
function Zt(e2) {
|
|
745
|
+
return hs(e2);
|
|
746
|
+
}
|
|
747
|
+
function Qt(e2, n, r = "decision-table") {
|
|
748
|
+
let t2 = Y.updateDmnDocument(n, e2);
|
|
749
|
+
return Fe(t2) && ze(t2, r), it(t2, e2.decision.id, "decision-table"), { document: t2, xml: hs(t2) };
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
export { an, at, R, _2 as _, $2 as $, tt, Wt, Yt, Xt, Zt, Qt };
|
|
753
|
+
|
|
754
|
+
//# debugId=CC70D3EE5D8623A664756E2164756E21
|