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