@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.
Files changed (49) hide show
  1. package/LICENSE.txt +3 -0
  2. package/README.md +80 -2
  3. package/dist/DmnFactory-VWZOSZHH-jkpbxz3n.js +42 -0
  4. package/dist/DmnModelTypes-ATR7FVKZ-jp35cecy.js +18 -0
  5. package/dist/KieDmnMarshaller-6TTUU5B4-47q50gk4.js +20 -0
  6. package/dist/THIRD-PARTY-NOTICES.md +1054 -0
  7. package/dist/business-rules-bnr581tz.js +26 -0
  8. package/dist/constants-9pa118cj.js +29 -0
  9. package/dist/embedded-file-reader-rf2g1kfj.js +114 -0
  10. package/dist/first-party-service-sd8yaf73.js +27 -0
  11. package/dist/hitPolicyResult-4WDHTX4A-gk103w84.js +33 -0
  12. package/dist/index-2hzp9b97.js +116 -0
  13. package/dist/index-34pj9f36.js +48 -0
  14. package/dist/index-4c4exdzw.js +3035 -0
  15. package/dist/index-dqa169gp.js +25 -0
  16. package/dist/index-fs1nd5ap.js +200 -0
  17. package/dist/index-sby22td6.js +634 -0
  18. package/dist/index-t4mx1a5e.js +17 -0
  19. package/dist/index.js +17 -0
  20. package/dist/jmespath-231m3hyn.js +1485 -0
  21. package/dist/js-yaml-88tdqrtd.js +3153 -0
  22. package/dist/rule-catalog-5gzpe93c.js +46 -0
  23. package/dist/rules-command-error-20gp2dv9.js +14 -0
  24. package/dist/rules-debug-service-cmgmbhyh.js +193 -0
  25. package/dist/rules-init-service-b74thek5.js +104 -0
  26. package/dist/rules-refresh-service-jgk2kq9d.js +66 -0
  27. package/dist/rules-validate-service-mr2fk58k.js +63 -0
  28. package/dist/tool-19b4ect0.js +754 -0
  29. package/dist/tool-1de529jm.js +39 -0
  30. package/dist/tool-2cky8jwp.js +17878 -0
  31. package/dist/tool-4dfpdepw.js +55 -0
  32. package/dist/tool-53w8skv5.js +262 -0
  33. package/dist/tool-7haj67tr.js +19 -0
  34. package/dist/tool-8h4er38s.js +11063 -0
  35. package/dist/tool-8qy8pkp4.js +40 -0
  36. package/dist/tool-av4mmsef.js +73 -0
  37. package/dist/tool-eymjx05p.js +6396 -0
  38. package/dist/tool-gdtpsdn7.js +342 -0
  39. package/dist/tool-jd313s2x.js +10 -0
  40. package/dist/tool-jxvk6306.js +574 -0
  41. package/dist/tool-m41px07w.js +49 -0
  42. package/dist/tool-mkn83w88.js +111 -0
  43. package/dist/tool-pm3ewdxc.js +1115 -0
  44. package/dist/tool-qgqscsjc.js +46 -0
  45. package/dist/tool-tkcx6png.js +6558 -0
  46. package/dist/tool-wmh645tm.js +4022 -0
  47. package/dist/tool-x0z7hxqr.js +916 -0
  48. package/dist/tool.js +12 -0
  49. package/package.json +30 -5
@@ -0,0 +1,25 @@
1
+ import {
2
+ CAMEL_CASE_ENUM_PROPERTIES,
3
+ JsonSerializer,
4
+ JsonSerializerFactory,
5
+ JsonSerializerNames,
6
+ JsonSerializerProxy,
7
+ PASCAL_CASE_ENUM_PROPERTIES,
8
+ RESOURCE_BUILDER_PASCAL_CASE_PROPERTIES,
9
+ SHARED_CORE_ABSTRACTIONS_PASCAL_CASE_PROPERTIES,
10
+ StreamSerializer
11
+ } from "./tool-gdtpsdn7.js";
12
+ import"./tool-1de529jm.js";
13
+ export {
14
+ CAMEL_CASE_ENUM_PROPERTIES,
15
+ JsonSerializer,
16
+ JsonSerializerFactory,
17
+ JsonSerializerNames,
18
+ JsonSerializerProxy,
19
+ PASCAL_CASE_ENUM_PROPERTIES,
20
+ RESOURCE_BUILDER_PASCAL_CASE_PROPERTIES,
21
+ SHARED_CORE_ABSTRACTIONS_PASCAL_CASE_PROPERTIES,
22
+ StreamSerializer
23
+ };
24
+
25
+ //# debugId=A79DD62A6A37B41864756E2164756E21
@@ -0,0 +1,200 @@
1
+ import {
2
+ v4_default
3
+ } from "./tool-qgqscsjc.js";
4
+ import"./tool-7haj67tr.js";
5
+ import {
6
+ __require
7
+ } from "./tool-1de529jm.js";
8
+
9
+ // ../../node_modules/@uipath/dmn-editor-utils/dist/entry-points/index.js
10
+ function T(e) {
11
+ switch (e.toLowerCase()) {
12
+ case "boolean":
13
+ return "boolean";
14
+ case "number":
15
+ case "integer":
16
+ case "long":
17
+ case "double":
18
+ case "decimal":
19
+ return "number";
20
+ case "date":
21
+ return "date";
22
+ case "time":
23
+ return "time";
24
+ case "date and time":
25
+ case "datetime":
26
+ return "datetime";
27
+ case "array":
28
+ return "array";
29
+ case "any":
30
+ case "object":
31
+ return "object";
32
+ default:
33
+ return "string";
34
+ }
35
+ }
36
+ var j = "x-uipath-decision-keyed";
37
+ var L = (e) => {
38
+ try {
39
+ return JSON.parse(e);
40
+ } catch {
41
+ return;
42
+ }
43
+ };
44
+ var B = (e) => {
45
+ let t = typeof e == "string" ? L(e) : e;
46
+ if (!(!t || typeof t != "object" || t[j] !== true))
47
+ return Object.keys(t.properties ?? {}).length > 0 ? t : undefined;
48
+ };
49
+ var Y = (e) => {
50
+ let t = B(e);
51
+ if (!t)
52
+ return e;
53
+ let s = {};
54
+ for (let m of Object.values(t.properties ?? {}))
55
+ for (let [a, c] of Object.entries(m.properties ?? {}))
56
+ s[a] ??= c;
57
+ let { definitions: r, $defs: u } = t;
58
+ return { type: "object", properties: s, ...r ? { definitions: r } : {}, ...u ? { $defs: u } : {} };
59
+ };
60
+ var J = { "invalid-xml": "The rule is not valid XML.", "unsafe-xml": "The rule declares a document type, which is not allowed.", "lossy-xml": "The rule contains comments or processing instructions that cannot be preserved.", "unsupported-version": "The rule uses a DMN version that is not supported.", "migration-failed": "The rule could not be migrated to a supported DMN version.", "unsupported-profile": "The rule uses DMN constructs that are not supported." };
61
+ var $ = class extends Error {
62
+ constructor(s) {
63
+ super(J[s] ?? "The rule could not be read.");
64
+ this.reason = s;
65
+ this.name = "UnreadableDmnError";
66
+ }
67
+ };
68
+ var q = (e) => e.__$$element === "decision";
69
+ var H = (e) => e.__$$element === "inputData";
70
+ var N = (e) => e.expression?.__$$element === "decisionTable" ? e.expression : undefined;
71
+ var A = (e) => e.expression?.__$$element === "literalExpression" ? e.expression : undefined;
72
+ var C = (e) => !!N(e) || !!A(e);
73
+ var W = (e, t) => {
74
+ let s = e.variable?.["@_name"] || e["@_name"] || "";
75
+ return { name: s, displayName: e["@_label"] || s, type: T(t["@_typeRef"] ?? e.variable?.["@_typeRef"] ?? ""), source: `=result.${s}` };
76
+ };
77
+ var G = (e) => ({ name: e.variable?.["@_name"] || e["@_name"] || "", displayName: e["@_name"] || e.variable?.["@_name"] || "", type: T(e.variable?.["@_typeRef"] ?? ""), required: true });
78
+ async function U(e) {
79
+ let [{ importDmnDocument: t }, { outputArgumentName: s }, { aggregateTypeRef: r, isCollectAggregation: u, LIST_HIT_POLICIES: m }, { DmnHitPolicy: a }] = await Promise.all([import("./KieDmnMarshaller-6TTUU5B4-47q50gk4.js"), import("./DmnFactory-VWZOSZHH-jkpbxz3n.js"), import("./hitPolicyResult-4WDHTX4A-gk103w84.js"), import("./DmnModelTypes-ATR7FVKZ-jp35cecy.js")]), c = await t(e);
80
+ if (c.status === "error")
81
+ throw new $(c.reason);
82
+ let y = c.document.definitions, p = y.drgElement ?? [], g = p.filter(q), _ = p.filter(H), E = (n, o) => {
83
+ let l = n["@_aggregation"];
84
+ return n["@_hitPolicy"] === a.Collect && u(l) ? r(l, { typeRef: o["@_typeRef"] }) ?? "Any" : o["@_typeRef"];
85
+ }, R = (n, o, l) => {
86
+ let d = s({ id: o["@_id"] ?? "", name: o["@_name"], label: o["@_label"] }, l);
87
+ return { name: d, displayName: o["@_label"] || d, type: T(E(n, o) ?? ""), source: `=result.${d}` };
88
+ }, O = (n) => {
89
+ let o = A(n);
90
+ if (o)
91
+ return [W(n, o)];
92
+ let l = N(n);
93
+ if (!l)
94
+ return [];
95
+ let d = (l.output ?? []).map((S, P) => R(l, S, P)), D = n["@_name"];
96
+ return d.length !== 1 || l.output?.[0]?.["@_name"]?.trim() || !D ? d : [{ ...d[0], name: D, displayName: l.output?.[0]?.["@_label"] || D, source: `=result.${D}` }];
97
+ }, x = (n = () => true) => _.filter(n).map(G), k = new Map((y.itemDefinition ?? []).map((n) => [n["@_name"], n])), i = (n) => !n["@_aggregation"] && m.has(n["@_hitPolicy"] ?? a.Unique), f = (n) => {
98
+ let o = n["@_name"] ?? "", l = O(n).map((b) => b.name), d = A(n), D = N(n), S = D ? (D.output ?? []).map((b) => I(E(D, b), k)) : [], P;
99
+ return d ? P = [[l[0], I(d["@_typeRef"] ?? n.variable?.["@_typeRef"], k)]] : D && i(D) ? P = S.length > 1 ? [[o, { type: "array", items: { type: "object", properties: Object.fromEntries(l.map((b, w) => [b, S[w]])) } }]] : S.map((b, w) => [l[w], { type: "array", items: b }]) : P = l.map((b, w) => [b, S[w]]), { name: o, displayName: o, type: "jsonSchema", source: `=result.${o}`, _jsonSchema: { type: "object", properties: Object.fromEntries(P) } };
100
+ }, h = g.every((n) => !C(n) || !!n["@_name"]?.trim());
101
+ return { definitions: y, decisions: g, declared: _, inputsFor: x, outputsOf: O, toKeyedOutput: f, keyable: h };
102
+ }
103
+ async function X(e, t = false) {
104
+ let { decisions: s, inputsFor: r, outputsOf: u, toKeyedOutput: m, keyable: a } = await U(e), c = s.filter(C), y = t && a && c.length > 0, p = y ? c.map(m) : c.flatMap(u).filter((g, _, E) => E.findIndex((R) => R.name === g.name) === _);
105
+ return { inputs: r(), outputs: p, ...y ? { decisionKeyed: true } : {} };
106
+ }
107
+ function I(e, t, s = new Set) {
108
+ let r = e && !s.has(e) ? t.get(e) : undefined;
109
+ if (!r)
110
+ return { type: T(e ?? "") };
111
+ let u = new Set(s).add(e ?? ""), m = r.itemComponent ?? [], a = m.length ? { type: "object", properties: Object.fromEntries(m.map((c) => [c["@_name"], I(c.typeRef?.__$$text, t, u)])) } : I(r.typeRef?.__$$text, t, u);
112
+ return r["@_isCollection"] ? { type: "array", items: a } : a;
113
+ }
114
+ var v = (e) => e?.startsWith("#") ? e.slice(1) : e || undefined;
115
+ var z = (e, t) => new RegExp(`(^|[^\\w.$])${t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}([^\\w$]|$)`).test(e);
116
+ function Q(e, t) {
117
+ let s = new Set([e]), r = [e];
118
+ for (;r.length > 0; ) {
119
+ let u = t.get(r.shift() ?? "");
120
+ if (!u)
121
+ continue;
122
+ let m = [...(u.informationRequirement ?? []).flatMap((a) => [a.requiredInput?.["@_href"], a.requiredDecision?.["@_href"]]), ...(u.knowledgeRequirement ?? []).map((a) => a.requiredKnowledge?.["@_href"])];
123
+ for (let a of m) {
124
+ let c = v(a);
125
+ !c || s.has(c) || (s.add(c), r.push(c));
126
+ }
127
+ }
128
+ return s;
129
+ }
130
+ async function M(e, t = false) {
131
+ let { definitions: s, decisions: r, declared: u, inputsFor: m, outputsOf: a, toKeyedOutput: c, keyable: y } = await U(e), p = t && y, g = new Map([...r, ...u].flatMap((i) => i["@_id"] ? [[i["@_id"], i]] : [])), _ = new Set(r.flatMap((i) => (i.informationRequirement ?? []).flatMap((f) => {
132
+ let h = v(f.requiredDecision?.["@_href"]);
133
+ return h ? [h] : [];
134
+ }))), E = [...r.filter((i) => !_.has(i["@_id"] ?? "")), ...r.filter((i) => _.has(i["@_id"] ?? ""))], R = E.map((i) => {
135
+ let f = Q(i["@_id"] ?? "", g), h = [...f].flatMap((n) => {
136
+ let o = g.get(n);
137
+ if (!o || !q(o))
138
+ return [];
139
+ let l = A(o);
140
+ return l ? [l.text?.__$$text ?? ""] : (N(o)?.input ?? []).map((d) => d.inputExpression?.text?.__$$text ?? "");
141
+ });
142
+ return (n) => {
143
+ if (f.has(n["@_id"] ?? ""))
144
+ return true;
145
+ let o = n.variable?.["@_name"] || n["@_name"] || "";
146
+ return !!o && h.some((l) => z(l, o));
147
+ };
148
+ }), O = new Set(u.filter((i) => R.some((f) => f(i)))), x = E.flatMap((i, f) => {
149
+ if (!C(i))
150
+ return [];
151
+ let h = (n) => R[f](n) || !O.has(n);
152
+ return [{ id: i["@_id"] ?? "", name: i["@_label"] ?? i["@_name"] ?? "", inputs: m(h), outputs: p ? [c(i)] : a(i), ...p ? { decisionKeyed: true } : {} }];
153
+ });
154
+ return !p || x.length < 2 ? x : [{ name: s["@_label"] ?? s["@_name"] ?? "", inputs: m(), outputs: x.flatMap((i) => i.outputs), decisionKeyed: true }, ...x];
155
+ }
156
+ var Z = JSON.stringify({ version: "2.0", resources: [] }, null, 2);
157
+ var ee = { date: { type: "string", format: "date" }, datetime: { type: "string", format: "date-time" }, time: { type: "string", format: "time" } };
158
+ var te = (e) => {
159
+ if (e.type === "jsonSchema") {
160
+ let { $schema: t, ...s } = e._jsonSchema ?? {};
161
+ return e._jsonSchema ? s : {};
162
+ }
163
+ return e.type === "array" ? { type: "array", items: {}, title: e.name } : { ...ee[e.type] ?? { type: e.type }, title: e.name };
164
+ };
165
+ var K = (e) => e.length === 0 ? { type: "object", properties: {} } : { type: "object", properties: Object.fromEntries(e.map((t) => [t.name, te(t)])), required: [] };
166
+ var F = (e) => typeof e == "string" && e !== "";
167
+ var ne = (e) => {
168
+ let t = Array.isArray(e?.entryPoints) ? e.entryPoints : [], s = new Map;
169
+ for (let r of t)
170
+ F(r?.filePath) && F(r.uniqueId) && s.set(r.filePath, r.uniqueId);
171
+ return s;
172
+ };
173
+ async function se(e, t, s = false) {
174
+ let r = ne(t), u = [], m = [];
175
+ for (let { name: a, contents: c } of e) {
176
+ let y;
177
+ try {
178
+ y = await M(c, s);
179
+ } catch (p) {
180
+ m.push({ name: a, error: p });
181
+ continue;
182
+ }
183
+ for (let p of y) {
184
+ let g = p.id ? `/${a}#${p.id}` : `/${a}`;
185
+ u.push({ filePath: g, uniqueId: r.get(g) ?? v4_default(), type: "BusinessRules", ...p.name ? { displayName: p.name } : {}, input: K(p.inputs), output: { ...K(p.outputs), ...p.decisionKeyed ? { [j]: true } : {} } });
186
+ }
187
+ }
188
+ return { entryPoints: u, entryPointsContent: JSON.stringify({ $schema: "https://cloud.uipath.com/draft/2024-12/entry-point", $id: "entry-points.json", entryPoints: u }, null, 2), bindingContent: Z, unreadable: m, entryPointsChanged: JSON.stringify(t?.entryPoints) !== JSON.stringify(u) };
189
+ }
190
+ export {
191
+ j as DECISION_KEYED_SCHEMA_KEY,
192
+ $ as UnreadableDmnError,
193
+ B as asDecisionKeyedSchema,
194
+ se as buildBusinessRulePackagingFiles,
195
+ Y as flatOutputSchema,
196
+ X as readDmnArguments,
197
+ M as readDmnCallableUnits
198
+ };
199
+
200
+ //# debugId=FDDD7FA2DDE7E0DA64756E2164756E21