@uipath/rules-tool 0.0.0-stage → 1.204.0-preview.249
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-SG3RP3T3-cr8e7mxz.js +8 -0
- package/dist/DmnFactory-VWZOSZHH-azx0zqcn.js +8 -0
- package/dist/DmnModelTypes-ATR7FVKZ-vkv7n0jn.js +8 -0
- package/dist/KieDmnMarshaller-6TTUU5B4-rsxhvw7a.js +8 -0
- package/dist/business-rules-d51977r1.js +25 -0
- package/dist/business-rules-dekge24t.js +23 -0
- package/dist/business-rules-ew76mbwg.js +25 -0
- package/dist/business-rules-jmwx05k2.js +25 -0
- package/dist/business-rules-zpzqxyce.js +26 -0
- package/dist/constants-4r8pfr16.js +22 -0
- package/dist/constants-za5vbzp8.js +22 -0
- package/dist/embedded-file-reader-0228j82a.js +111 -0
- package/dist/embedded-file-reader-wmsg31a8.js +111 -0
- package/dist/first-party-service-1qa6cp4d.js +8 -0
- package/dist/first-party-service-28dkctkz.js +8 -0
- package/dist/first-party-service-4fsz3cnj.js +8 -0
- package/dist/first-party-service-ahcc6xc6.js +8 -0
- package/dist/first-party-service-y1ccmsvp.js +8 -0
- package/dist/first-party-service-zpr1q3nd.js +8 -0
- package/dist/hitPolicyResult-4WDHTX4A-dbtkgpqp.js +12 -0
- package/dist/index-2zxy6zgp.js +23 -0
- package/dist/index-3nx77wfh.js +23 -0
- package/dist/index-43zg1wqe.js +19621 -0
- package/dist/index-47jera73.js +23 -0
- package/dist/index-70jn7cz1.js +19631 -0
- package/dist/index-7wc0g78k.js +14 -0
- package/dist/index-8kb5kc5y.js +24 -0
- package/dist/index-97yad7ms.js +8 -0
- package/dist/index-dfn83hxf.js +14 -0
- package/dist/index-e301h23h.js +24 -0
- package/dist/index-frd259yv.js +24 -0
- package/dist/index-gc7cw2jh.js +23 -0
- package/dist/index-gya2v502.js +8 -0
- package/dist/index-hb3gk1wf.js +24 -0
- package/dist/index-nsnfdqd5.js +24 -0
- package/dist/index-nzr4mx5p.js +614 -0
- package/dist/index-vffktc0w.js +166 -0
- package/dist/index-we6zjs66.js +164 -0
- package/dist/index-xymrydfw.js +3095 -0
- package/dist/index-z2qk2qn6.js +24 -0
- package/dist/index-zdwhfpt1.js +3071 -0
- package/dist/index-zecwgvg7.js +23 -0
- package/dist/index.js +16 -0
- package/dist/jmespath-ab6tdc42.js +1485 -0
- package/dist/js-yaml-a2bk27p6.js +3151 -0
- package/dist/rule-catalog-a5w86qns.js +43 -0
- package/dist/rule-catalog-etpf962f.js +69 -0
- package/dist/rule-catalog-q5cr17hf.js +58 -0
- package/dist/rule-catalog-vc98yg4n.js +43 -0
- package/dist/rule-catalog-z3h66kh5.js +56 -0
- package/dist/rules-command-error-10qmb5w7.js +13 -0
- package/dist/rules-command-error-5bdv4bcx.js +13 -0
- package/dist/rules-command-error-cmssf0w4.js +13 -0
- package/dist/rules-command-error-fsm3b1mv.js +13 -0
- package/dist/rules-debug-service-5rcdh3pj.js +192 -0
- package/dist/rules-debug-service-8q7mkd0r.js +199 -0
- package/dist/rules-debug-service-b9j29ejz.js +192 -0
- package/dist/rules-debug-service-h1ahd6p3.js +192 -0
- package/dist/rules-debug-service-v3jr3r1n.js +192 -0
- package/dist/rules-init-service-3c2yfa7p.js +687 -0
- package/dist/rules-init-service-3wgd9cqp.js +100 -0
- package/dist/rules-init-service-8fqytxq0.js +685 -0
- package/dist/rules-init-service-pspt7sje.js +100 -0
- package/dist/rules-init-service-sbtzw93j.js +102 -0
- package/dist/rules-init-service-x7paqa63.js +687 -0
- package/dist/rules-init-service-y678kjje.js +100 -0
- package/dist/rules-init-service-y7qzmxx0.js +102 -0
- package/dist/rules-refresh-service-4xxj6ex6.js +65 -0
- package/dist/rules-refresh-service-ba5jk1y9.js +65 -0
- package/dist/rules-refresh-service-btn64j8j.js +65 -0
- package/dist/rules-refresh-service-qkmphj53.js +65 -0
- package/dist/rules-validate-service-dmgnfne7.js +60 -0
- package/dist/rules-validate-service-hk2d006t.js +60 -0
- package/dist/rules-validate-service-sppr4x13.js +60 -0
- package/dist/rules-validate-service-xp05n2d9.js +60 -0
- package/dist/tool-0bthsb3x.js +55 -0
- package/dist/tool-1dycs173.js +4014 -0
- package/dist/tool-1pkqxwwd.js +17472 -0
- package/dist/tool-24mr6g8c.js +1556 -0
- package/dist/tool-2trg1fpx.js +40 -0
- package/dist/tool-39fmkx2d.js +611 -0
- package/dist/tool-3e2q1x2y.js +6578 -0
- package/dist/tool-3j0747gg.js +17077 -0
- package/dist/tool-4z7zcq4z.js +6058 -0
- package/dist/tool-56smnjrh.js +73 -0
- package/dist/tool-5qygptrc.js +6171 -0
- package/dist/tool-5xx6x8pe.js +6596 -0
- package/dist/tool-6rp0gx98.js +6578 -0
- package/dist/tool-6sqt4zrx.js +571 -0
- package/dist/tool-7fkrd618.js +1556 -0
- package/dist/tool-7xmarr97.js +17077 -0
- package/dist/tool-89xzeteg.js +361 -0
- package/dist/tool-8j9f6ns5.js +6396 -0
- package/dist/tool-911s9czz.js +570 -0
- package/dist/tool-97x3zjcm.js +709 -0
- package/dist/tool-9bz2x04j.js +40 -0
- package/dist/tool-akh7nnqs.js +704 -0
- package/dist/tool-axfzew45.js +1555 -0
- package/dist/tool-b71jq9pt.js +389 -0
- package/dist/tool-bfj846v8.js +141 -0
- package/dist/tool-bvmc017m.js +96 -0
- package/dist/tool-bykz5ryf.js +454 -0
- package/dist/tool-c76qb8ap.js +17052 -0
- package/dist/tool-ca15515v.js +570 -0
- package/dist/tool-e1mmqsjr.js +11048 -0
- package/dist/tool-epsr41wx.js +48 -0
- package/dist/tool-f9qs255w.js +70 -0
- package/dist/tool-fbqnqf9k.js +10 -0
- package/dist/tool-ga79rety.js +389 -0
- package/dist/tool-gb547mcn.js +141 -0
- package/dist/tool-gta9rr4h.js +68 -0
- package/dist/tool-h2dfnxdq.js +6486 -0
- package/dist/tool-hg6vr5y9.js +3769 -0
- package/dist/tool-hgvnm4vh.js +1843 -0
- package/dist/tool-hjbf9aay.js +571 -0
- package/dist/tool-k2s349kn.js +108 -0
- package/dist/tool-k5jm64n3.js +5650 -0
- package/dist/tool-ketztpgf.js +73 -0
- package/dist/tool-mm1x18d6.js +537 -0
- package/dist/tool-n1d88ryb.js +6396 -0
- package/dist/tool-nmqpwh9m.js +6166 -0
- package/dist/tool-pb80pswx.js +73 -0
- package/dist/tool-pcsgwpfw.js +40 -0
- package/dist/tool-q3c1bjyb.js +454 -0
- package/dist/tool-rwp1skmf.js +40 -0
- package/dist/tool-s3fbt22r.js +454 -0
- package/dist/tool-tmbst1r8.js +68 -0
- package/dist/tool-v6w109p0.js +455 -0
- package/dist/tool-vyx8fpft.js +46 -0
- package/dist/tool-w2js05qv.js +389 -0
- package/dist/tool-x67kek1m.js +1838 -0
- package/dist/tool-x89947ah.js +17052 -0
- package/dist/tool-xhksjdka.js +4005 -0
- package/dist/tool-yv3t4gg5.js +108 -0
- package/dist/tool-zbyb1ttx.js +5650 -0
- package/dist/tool.js +11 -0
- package/package.json +43 -5
|
@@ -0,0 +1,3095 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bs
|
|
3
|
+
} from "./tool-e1mmqsjr.js";
|
|
4
|
+
import {
|
|
5
|
+
trackVariables,
|
|
6
|
+
parser,
|
|
7
|
+
g2,
|
|
8
|
+
b,
|
|
9
|
+
L,
|
|
10
|
+
v
|
|
11
|
+
} from "./tool-xhksjdka.js";
|
|
12
|
+
import {
|
|
13
|
+
ot,
|
|
14
|
+
R,
|
|
15
|
+
g,
|
|
16
|
+
h,
|
|
17
|
+
Xn,
|
|
18
|
+
zt
|
|
19
|
+
} from "./tool-akh7nnqs.js";
|
|
20
|
+
|
|
21
|
+
// ../../node_modules/@uipath/dmn-editor-utils/dist/chunks/chunk-TU426LZ5.js
|
|
22
|
+
var l = (e) => e.includes(":") ? e.split(":").pop() ?? e : e;
|
|
23
|
+
var m = new Set(["number", "integer", "long", "double", "decimal"]);
|
|
24
|
+
var T = (e) => m.has(l(e));
|
|
25
|
+
var r = (e) => T(e) ? "number" : l(e);
|
|
26
|
+
var y = new Set(["COLLECT", "RULE ORDER", "OUTPUT ORDER"]);
|
|
27
|
+
var O = new Set(["PRIORITY", "OUTPUT ORDER"]);
|
|
28
|
+
var P = (e) => e.hitPolicy === "COLLECT" && e.aggregation ? e.outputs.length === 1 ? e.aggregation : "value" : y.has(e.hitPolicy) ? "list" : "value";
|
|
29
|
+
var U = (e, n) => n === "SUM" || n === "COUNT" ? "number" : e.outputs[0]?.typeRef;
|
|
30
|
+
var d = (e, n) => n.typeRef ?? (e.decision.decisionTable.outputs.length === 1 ? e.decision.variableTypeRef : undefined);
|
|
31
|
+
var a = (e, n) => {
|
|
32
|
+
let t = [], i = n;
|
|
33
|
+
for (;i !== undefined; ) {
|
|
34
|
+
let s = l(i), o = e.itemDefinitions?.find((c) => c.name === s);
|
|
35
|
+
if (!o || t.includes(o))
|
|
36
|
+
break;
|
|
37
|
+
t.push(o), i = o.typeRef;
|
|
38
|
+
}
|
|
39
|
+
return t;
|
|
40
|
+
};
|
|
41
|
+
var D = (e, n) => a(e, n).some((t) => t.isCollection);
|
|
42
|
+
var h2 = (e) => ot.includes(r(e));
|
|
43
|
+
var C = (e, n) => {
|
|
44
|
+
let t = a(e, n);
|
|
45
|
+
if (t.some((s) => s.isCollection))
|
|
46
|
+
return false;
|
|
47
|
+
let i = t.length === 0 ? n : t[t.length - 1].typeRef;
|
|
48
|
+
return i === undefined || h2(i) && r(i) !== "Any";
|
|
49
|
+
};
|
|
50
|
+
var g3 = (e, n) => {
|
|
51
|
+
let t = a(e, n), i = t[t.length - 1], s = i ? i.typeRef ?? i.name : n;
|
|
52
|
+
return s === undefined ? undefined : r(s);
|
|
53
|
+
};
|
|
54
|
+
var L2 = (e, n) => {
|
|
55
|
+
let t = d(e, n), i = n.allowedValues?.text.trim() || a(e, t).find((s) => s.allowedValues?.trim())?.allowedValues;
|
|
56
|
+
return i ? { text: i, typeRef: g3(e, t) } : undefined;
|
|
57
|
+
};
|
|
58
|
+
var I = (e, n, t) => {
|
|
59
|
+
if (n === "COUNT")
|
|
60
|
+
return true;
|
|
61
|
+
let i = d(e, t), s = g3(e, i);
|
|
62
|
+
return !D(e, i) && (!s || ["number", "Any"].includes(r(s)));
|
|
63
|
+
};
|
|
64
|
+
var E = String.raw`\"`;
|
|
65
|
+
var f = (e) => e.length >= 2 && e.startsWith('"') && e.endsWith('"');
|
|
66
|
+
var x = (e) => {
|
|
67
|
+
if (!f(e))
|
|
68
|
+
return e;
|
|
69
|
+
try {
|
|
70
|
+
let n = JSON.parse(e);
|
|
71
|
+
return typeof n == "string" ? n : e;
|
|
72
|
+
} catch {
|
|
73
|
+
return e.slice(1, -1).replaceAll(E, '"');
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var p = (e) => {
|
|
77
|
+
let n = [], t = "", i = false;
|
|
78
|
+
for (let s = 0;s < e.length; s += 1) {
|
|
79
|
+
let o = e[s];
|
|
80
|
+
if (i && o === "\\" && s + 1 < e.length) {
|
|
81
|
+
t += o + e[s + 1], s += 1;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (o === '"' && (i = !i), o === "," && !i) {
|
|
85
|
+
n.push(t), t = "";
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
t += o;
|
|
89
|
+
}
|
|
90
|
+
return n.push(t), n;
|
|
91
|
+
};
|
|
92
|
+
var N = (e) => p(e).map((n) => n.trim()).filter((n) => n.length > 0).map(x);
|
|
93
|
+
var w = (e, n) => {
|
|
94
|
+
let t = p(e.text).map((i) => i.trim()).filter(Boolean);
|
|
95
|
+
if (t.length === 0)
|
|
96
|
+
return false;
|
|
97
|
+
switch (n ?? "string") {
|
|
98
|
+
case "string":
|
|
99
|
+
return t.every(f);
|
|
100
|
+
case "number":
|
|
101
|
+
return t.every((i) => /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(i));
|
|
102
|
+
case "boolean":
|
|
103
|
+
return t.every((i) => i === "true" || i === "false");
|
|
104
|
+
default:
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// ../../node_modules/@bpmn-io/feel-analyzer/dist/index.js
|
|
110
|
+
function stripBackticks(text) {
|
|
111
|
+
return text.replace(/^`|`$/g, "");
|
|
112
|
+
}
|
|
113
|
+
function nodeText(node, source) {
|
|
114
|
+
return stripBackticks(source.substring(node.from, node.to));
|
|
115
|
+
}
|
|
116
|
+
function isInScope(varName, scopes) {
|
|
117
|
+
return scopes.some((scope) => scope.has(varName));
|
|
118
|
+
}
|
|
119
|
+
function withScope(scopes, initialNames, fn) {
|
|
120
|
+
const scope = new Set(initialNames);
|
|
121
|
+
scopes.push(scope);
|
|
122
|
+
const result = fn(scope);
|
|
123
|
+
scopes.pop();
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
function forEachChild(node, callback) {
|
|
127
|
+
let child = node.firstChild;
|
|
128
|
+
while (child) {
|
|
129
|
+
callback(child);
|
|
130
|
+
child = child.nextSibling;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function collectPathParts(node, source) {
|
|
134
|
+
const parts = [];
|
|
135
|
+
forEachChild(node, (child) => {
|
|
136
|
+
if (child.name === "PathExpression") {
|
|
137
|
+
parts.push(...collectPathParts(child, source));
|
|
138
|
+
} else if (child.name === "VariableName" || child.name === "PathName") {
|
|
139
|
+
parts.push(nodeText(child, source));
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return parts;
|
|
143
|
+
}
|
|
144
|
+
function getFilterBase(node) {
|
|
145
|
+
const firstChild = node.firstChild;
|
|
146
|
+
if (!firstChild)
|
|
147
|
+
return null;
|
|
148
|
+
if (firstChild.name === "FilterExpression")
|
|
149
|
+
return firstChild;
|
|
150
|
+
if (firstChild.name === "PathExpression")
|
|
151
|
+
return getFilterBase(firstChild);
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
function hasContextBase(node) {
|
|
155
|
+
const firstChild = node.firstChild;
|
|
156
|
+
if (!firstChild)
|
|
157
|
+
return false;
|
|
158
|
+
if (firstChild.name === "Context")
|
|
159
|
+
return true;
|
|
160
|
+
if (firstChild.name === "PathExpression")
|
|
161
|
+
return hasContextBase(firstChild);
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
function extractContextKeys(contextNode, source) {
|
|
165
|
+
const keys = [];
|
|
166
|
+
forEachChild(contextNode, (child) => {
|
|
167
|
+
if (child.name === "ContextEntry") {
|
|
168
|
+
const keyName = child.getChild("Key")?.getChild("Name");
|
|
169
|
+
if (keyName) {
|
|
170
|
+
keys.push(nodeText(keyName, source));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
return keys;
|
|
175
|
+
}
|
|
176
|
+
function collectIterationVariables(node, source) {
|
|
177
|
+
const vars = [];
|
|
178
|
+
const inExpressions = node.getChild("InExpressions");
|
|
179
|
+
if (inExpressions) {
|
|
180
|
+
forEachChild(inExpressions, (child) => {
|
|
181
|
+
if (child.name === "InExpression") {
|
|
182
|
+
const id = child.getChild("Name")?.getChild("Identifier");
|
|
183
|
+
if (id)
|
|
184
|
+
vars.push(source.substring(id.from, id.to));
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return vars;
|
|
189
|
+
}
|
|
190
|
+
function collectFunctionParameters(node, source) {
|
|
191
|
+
const params = [];
|
|
192
|
+
const formalParams = node.getChild("FormalParameters");
|
|
193
|
+
if (formalParams) {
|
|
194
|
+
forEachChild(formalParams, (child) => {
|
|
195
|
+
if (child.name === "FormalParameter") {
|
|
196
|
+
const id = child.getChild("ParameterName")?.getChild("Name")?.getChild("Identifier");
|
|
197
|
+
if (id)
|
|
198
|
+
params.push(source.substring(id.from, id.to));
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return params;
|
|
203
|
+
}
|
|
204
|
+
function findVariable(variables, name) {
|
|
205
|
+
return variables.find((v) => v.name === name);
|
|
206
|
+
}
|
|
207
|
+
function findOrCreateVariable(variables, name) {
|
|
208
|
+
let variable = findVariable(variables, name);
|
|
209
|
+
if (!variable) {
|
|
210
|
+
variable = { name };
|
|
211
|
+
variables.push(variable);
|
|
212
|
+
}
|
|
213
|
+
return variable;
|
|
214
|
+
}
|
|
215
|
+
function buildNestedEntries(variables, pathParts) {
|
|
216
|
+
const rootVar = findOrCreateVariable(variables, pathParts[0]);
|
|
217
|
+
if (pathParts.length <= 1)
|
|
218
|
+
return;
|
|
219
|
+
if (!rootVar.type) {
|
|
220
|
+
rootVar.type = "Context";
|
|
221
|
+
rootVar.entries = rootVar.entries || [];
|
|
222
|
+
}
|
|
223
|
+
if (rootVar.type !== "Context")
|
|
224
|
+
return;
|
|
225
|
+
let currentLevel = rootVar.entries;
|
|
226
|
+
for (let i = 1;i < pathParts.length; i++) {
|
|
227
|
+
const part = pathParts[i];
|
|
228
|
+
const isLast = i === pathParts.length - 1;
|
|
229
|
+
let entry = findVariable(currentLevel, part);
|
|
230
|
+
if (!entry) {
|
|
231
|
+
entry = isLast ? { name: part } : { name: part, type: "Context", entries: [] };
|
|
232
|
+
currentLevel.push(entry);
|
|
233
|
+
} else if (!isLast && !entry.type) {
|
|
234
|
+
entry.type = "Context";
|
|
235
|
+
entry.entries = entry.entries || [];
|
|
236
|
+
}
|
|
237
|
+
if (!isLast) {
|
|
238
|
+
entry.entries = entry.entries || [];
|
|
239
|
+
currentLevel = entry.entries;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function sortEntries(variable) {
|
|
244
|
+
if (variable.entries) {
|
|
245
|
+
variable.entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
246
|
+
for (const entry of variable.entries) {
|
|
247
|
+
sortEntries(entry);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
var ITERATION_KEYWORDS$1 = new Set(["for", "return", "some", "every", "InExpressions", "satisfies"]);
|
|
252
|
+
function extractInputNames(node, source, builtinNames) {
|
|
253
|
+
const inputs = new Set;
|
|
254
|
+
const localScopes = [new Set];
|
|
255
|
+
function isExternal(name, filterCtx) {
|
|
256
|
+
return !isInScope(name, localScopes) && !builtinNames.has(name) && !(filterCtx !== "none" && name === "item");
|
|
257
|
+
}
|
|
258
|
+
const collectInputs = (node, filterCtx = "none") => {
|
|
259
|
+
const { name: nodeName } = node;
|
|
260
|
+
if (node.type.isError) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (nodeName === "FunctionInvocation") {
|
|
264
|
+
const funcNameNode = node.getChild("VariableName");
|
|
265
|
+
if (funcNameNode) {
|
|
266
|
+
const funcName = nodeText(funcNameNode, source);
|
|
267
|
+
if (isExternal(funcName, filterCtx)) {
|
|
268
|
+
inputs.add(funcName);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
forEachChild(node, (child) => {
|
|
272
|
+
if (child.name !== "VariableName" && child.name !== "(" && child.name !== ")") {
|
|
273
|
+
collectInputs(child, filterCtx);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (nodeName === "PathExpression") {
|
|
279
|
+
const filterBase = getFilterBase(node);
|
|
280
|
+
if (hasContextBase(node)) {
|
|
281
|
+
forEachChild(node, (child) => collectInputs(child, filterCtx));
|
|
282
|
+
} else if (filterBase) {
|
|
283
|
+
collectInputs(filterBase, filterCtx);
|
|
284
|
+
} else {
|
|
285
|
+
const pathParts = collectPathParts(node, source);
|
|
286
|
+
if (pathParts.length > 0 && isExternal(pathParts[0], filterCtx)) {
|
|
287
|
+
inputs.add(pathParts.join("."));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (nodeName === "VariableName" && node.parent?.name !== "PathExpression" && node.parent?.name !== "FunctionInvocation") {
|
|
293
|
+
const varName = nodeText(node, source);
|
|
294
|
+
const isImplicitFilterProp = filterCtx === "variable-list" && varName !== "item";
|
|
295
|
+
if (isExternal(varName, filterCtx) && !isImplicitFilterProp) {
|
|
296
|
+
inputs.add(varName);
|
|
297
|
+
}
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (nodeName === "Context" && node.parent?.name !== "List") {
|
|
301
|
+
withScope(localScopes, [], (scope) => {
|
|
302
|
+
forEachChild(node, (child) => {
|
|
303
|
+
if (child.name === "ContextEntry") {
|
|
304
|
+
forEachChild(child, (entryChild) => {
|
|
305
|
+
if (entryChild.name !== "Key")
|
|
306
|
+
collectInputs(entryChild, filterCtx);
|
|
307
|
+
});
|
|
308
|
+
const keyName = child.getChild("Key")?.getChild("Name");
|
|
309
|
+
if (keyName)
|
|
310
|
+
scope.add(nodeText(keyName, source));
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
if (nodeName === "FilterExpression") {
|
|
317
|
+
let newFilterCtx = "none";
|
|
318
|
+
const scopeNames = ["item"];
|
|
319
|
+
const listNode = node.getChild("List");
|
|
320
|
+
if (listNode) {
|
|
321
|
+
forEachChild(listNode, (child) => {
|
|
322
|
+
if (child.name === "Context") {
|
|
323
|
+
scopeNames.push(...extractContextKeys(child, source));
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
newFilterCtx = "list-literal";
|
|
327
|
+
} else {
|
|
328
|
+
forEachChild(node, (child) => {
|
|
329
|
+
if (child.name === "VariableName") {
|
|
330
|
+
collectInputs(child, "none");
|
|
331
|
+
newFilterCtx = "variable-list";
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
withScope(localScopes, scopeNames, () => {
|
|
336
|
+
forEachChild(node, (child) => {
|
|
337
|
+
if (child.name === "Comparison" || child.name === "Expression") {
|
|
338
|
+
collectInputs(child, newFilterCtx);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (nodeName === "ForExpression" || nodeName === "QuantifiedExpression") {
|
|
345
|
+
const iterVars = collectIterationVariables(node, source);
|
|
346
|
+
const inExp = node.getChild("InExpressions");
|
|
347
|
+
if (inExp) {
|
|
348
|
+
forEachChild(inExp, (child) => {
|
|
349
|
+
if (child.name === "InExpression") {
|
|
350
|
+
forEachChild(child, (innerChild) => {
|
|
351
|
+
if (innerChild.name !== "Name" && innerChild.name !== "in" && innerChild.name !== "Identifier") {
|
|
352
|
+
collectInputs(innerChild, filterCtx);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
withScope(localScopes, iterVars, () => {
|
|
359
|
+
forEachChild(node, (child) => {
|
|
360
|
+
if (!ITERATION_KEYWORDS$1.has(child.name)) {
|
|
361
|
+
collectInputs(child, "none");
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (nodeName === "FunctionDefinition") {
|
|
368
|
+
const params = collectFunctionParameters(node, source);
|
|
369
|
+
withScope(localScopes, params, () => {
|
|
370
|
+
const body = node.getChild("FunctionBody");
|
|
371
|
+
if (body)
|
|
372
|
+
collectInputs(body, "none");
|
|
373
|
+
});
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
forEachChild(node, (child) => collectInputs(child, filterCtx));
|
|
377
|
+
};
|
|
378
|
+
collectInputs(node);
|
|
379
|
+
return Array.from(inputs).sort();
|
|
380
|
+
}
|
|
381
|
+
function initializeInputVariables(collectedInputs) {
|
|
382
|
+
const variables = [];
|
|
383
|
+
for (const input of collectedInputs) {
|
|
384
|
+
buildNestedEntries(variables, input.split("."));
|
|
385
|
+
}
|
|
386
|
+
return variables;
|
|
387
|
+
}
|
|
388
|
+
function checkLiteralsInNode(node) {
|
|
389
|
+
let hasString = false;
|
|
390
|
+
let hasNumber = false;
|
|
391
|
+
forEachChild(node, (child) => {
|
|
392
|
+
if (child.name === "StringLiteral")
|
|
393
|
+
hasString = true;
|
|
394
|
+
else if (child.name === "NumericLiteral")
|
|
395
|
+
hasNumber = true;
|
|
396
|
+
else if (child.name === "ArithmeticExpression") {
|
|
397
|
+
const nested = checkLiteralsInNode(child);
|
|
398
|
+
hasString = hasString || nested.hasString;
|
|
399
|
+
hasNumber = hasNumber || nested.hasNumber;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
return { hasString, hasNumber };
|
|
403
|
+
}
|
|
404
|
+
function inferTypeForVariablesInNode(node, source, inputs, localScopes, inferredType) {
|
|
405
|
+
if (node.name === "VariableName" && node.parent?.name !== "PathExpression") {
|
|
406
|
+
const varName = nodeText(node, source);
|
|
407
|
+
const variable = findVariable(inputs, varName);
|
|
408
|
+
if (!isInScope(varName, localScopes) && variable && !variable.type) {
|
|
409
|
+
variable.type = inferredType;
|
|
410
|
+
}
|
|
411
|
+
} else if (node.name === "PathExpression") {
|
|
412
|
+
const pathParts = collectPathParts(node, source);
|
|
413
|
+
if (pathParts.length > 0) {
|
|
414
|
+
const rootVar = pathParts[0];
|
|
415
|
+
const variable = findVariable(inputs, rootVar);
|
|
416
|
+
if (!isInScope(rootVar, localScopes) && variable && !variable.type) {
|
|
417
|
+
variable.type = inferredType;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
} else {
|
|
421
|
+
forEachChild(node, (child) => {
|
|
422
|
+
inferTypeForVariablesInNode(child, source, inputs, localScopes, inferredType);
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
function trackFilterItemProperties(node, source, listVarName, inputs, localScopes) {
|
|
427
|
+
const listVar = listVarName ? findVariable(inputs, listVarName) : null;
|
|
428
|
+
if (!listVar)
|
|
429
|
+
return;
|
|
430
|
+
const visit = (node) => {
|
|
431
|
+
if (listVar.type !== "List")
|
|
432
|
+
return;
|
|
433
|
+
if (node.name === "PathExpression") {
|
|
434
|
+
const pathParts = collectPathParts(node, source);
|
|
435
|
+
if (pathParts.length > 1 && pathParts[0] === "item") {
|
|
436
|
+
const entries = listVar.entries || [];
|
|
437
|
+
for (let i = 1;i < pathParts.length; i++) {
|
|
438
|
+
if (!findVariable(entries, pathParts[i])) {
|
|
439
|
+
entries.push({ name: pathParts[i] });
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
listVar.entries = entries;
|
|
443
|
+
}
|
|
444
|
+
} else if (node.name === "VariableName") {
|
|
445
|
+
const varName = nodeText(node, source);
|
|
446
|
+
if (!isInScope(varName, localScopes) && varName !== "item" && node.parent?.name !== "PathExpression") {
|
|
447
|
+
const entries = listVar.entries || [];
|
|
448
|
+
if (!findVariable(entries, varName)) {
|
|
449
|
+
entries.push({ name: varName });
|
|
450
|
+
}
|
|
451
|
+
listVar.entries = entries;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
forEachChild(node, visit);
|
|
455
|
+
};
|
|
456
|
+
visit(node);
|
|
457
|
+
}
|
|
458
|
+
function inferTypeFromComparison(varNode, literalNode, source, inputs, localScopes) {
|
|
459
|
+
if (varNode.name !== "VariableName")
|
|
460
|
+
return;
|
|
461
|
+
const varName = nodeText(varNode, source);
|
|
462
|
+
const variable = findVariable(inputs, varName);
|
|
463
|
+
if (isInScope(varName, localScopes) || !variable)
|
|
464
|
+
return;
|
|
465
|
+
if (variable.type)
|
|
466
|
+
return;
|
|
467
|
+
const literalTypeMap = {
|
|
468
|
+
NumericLiteral: "Number",
|
|
469
|
+
StringLiteral: "String",
|
|
470
|
+
BooleanLiteral: "Boolean"
|
|
471
|
+
};
|
|
472
|
+
const inferred = literalTypeMap[literalNode.name];
|
|
473
|
+
if (inferred)
|
|
474
|
+
variable.type = inferred;
|
|
475
|
+
}
|
|
476
|
+
function inferTypes(node, source, inputs, localScopes, filterCtx = "none") {
|
|
477
|
+
const { name: nodeName } = node;
|
|
478
|
+
if (nodeName === "PathExpression") {
|
|
479
|
+
const first = node.firstChild;
|
|
480
|
+
if (first?.name === "Context" || first?.name === "PathExpression" || first?.name === "FilterExpression") {
|
|
481
|
+
inferTypes(first, source, inputs, localScopes, filterCtx);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const pathParts = collectPathParts(node, source);
|
|
485
|
+
if (pathParts.length > 0) {
|
|
486
|
+
const rootVar = pathParts[0];
|
|
487
|
+
if (!isInScope(rootVar, localScopes) && !(filterCtx !== "none" && rootVar === "item") && findVariable(inputs, rootVar)) {
|
|
488
|
+
buildNestedEntries(inputs, pathParts);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
if (nodeName === "Context" && node.parent?.name !== "List") {
|
|
494
|
+
withScope(localScopes, [], (scope) => {
|
|
495
|
+
forEachChild(node, (child) => {
|
|
496
|
+
if (child.name === "ContextEntry") {
|
|
497
|
+
forEachChild(child, (innerChild) => {
|
|
498
|
+
if (innerChild.name !== "Key") {
|
|
499
|
+
inferTypes(innerChild, source, inputs, localScopes, filterCtx);
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
const keyName = child.getChild("Key")?.getChild("Name");
|
|
503
|
+
if (keyName)
|
|
504
|
+
scope.add(nodeText(keyName, source));
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
});
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
if (nodeName === "FilterExpression") {
|
|
511
|
+
let newFilterCtx = "none";
|
|
512
|
+
let listVarName = null;
|
|
513
|
+
const scopeNames = ["item"];
|
|
514
|
+
const listNode = node.getChild("List");
|
|
515
|
+
if (listNode) {
|
|
516
|
+
forEachChild(listNode, (child) => {
|
|
517
|
+
if (child.name === "Context") {
|
|
518
|
+
scopeNames.push(...extractContextKeys(child, source));
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
newFilterCtx = "list-literal";
|
|
522
|
+
} else {
|
|
523
|
+
forEachChild(node, (child) => {
|
|
524
|
+
if (child.name === "VariableName") {
|
|
525
|
+
listVarName = nodeText(child, source);
|
|
526
|
+
const variable = findVariable(inputs, listVarName);
|
|
527
|
+
if (!isInScope(listVarName, localScopes) && variable) {
|
|
528
|
+
if (!variable.type) {
|
|
529
|
+
variable.type = "List";
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
newFilterCtx = "variable-list";
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
withScope(localScopes, scopeNames, () => {
|
|
537
|
+
forEachChild(node, (child) => {
|
|
538
|
+
if (child.name === "Comparison" || child.name === "Expression") {
|
|
539
|
+
trackFilterItemProperties(child, source, listVarName, inputs, localScopes);
|
|
540
|
+
inferTypes(child, source, inputs, localScopes, newFilterCtx);
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (nodeName === "Comparison") {
|
|
547
|
+
const operands = [];
|
|
548
|
+
forEachChild(node, (child) => {
|
|
549
|
+
if (child.name !== "CompareOp")
|
|
550
|
+
operands.push(child);
|
|
551
|
+
});
|
|
552
|
+
if (operands.length === 2) {
|
|
553
|
+
inferTypeFromComparison(operands[0], operands[1], source, inputs, localScopes);
|
|
554
|
+
inferTypeFromComparison(operands[1], operands[0], source, inputs, localScopes);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (nodeName === "ArithmeticExpression") {
|
|
558
|
+
const { hasString, hasNumber } = checkLiteralsInNode(node);
|
|
559
|
+
const inferredType = hasString && !hasNumber ? "String" : !hasString && hasNumber ? "Number" : null;
|
|
560
|
+
if (inferredType) {
|
|
561
|
+
inferTypeForVariablesInNode(node, source, inputs, localScopes, inferredType);
|
|
562
|
+
}
|
|
563
|
+
forEachChild(node, (child) => {
|
|
564
|
+
if (!["ArithmeticExpression", "ArithOp", "NumericLiteral", "StringLiteral"].includes(child.name)) {
|
|
565
|
+
inferTypes(child, source, inputs, localScopes, filterCtx);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
if (nodeName === "ForExpression" || nodeName === "QuantifiedExpression") {
|
|
571
|
+
const iterVars = collectIterationVariables(node, source);
|
|
572
|
+
const inExp = node.getChild("InExpressions");
|
|
573
|
+
if (inExp) {
|
|
574
|
+
forEachChild(inExp, (child) => {
|
|
575
|
+
if (child.name === "InExpression") {
|
|
576
|
+
forEachChild(child, (innerChild) => {
|
|
577
|
+
if (!["Name", "in", "Identifier"].includes(innerChild.name)) {
|
|
578
|
+
inferTypes(innerChild, source, inputs, localScopes, filterCtx);
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
withScope(localScopes, iterVars, () => {
|
|
585
|
+
forEachChild(node, (child) => {
|
|
586
|
+
if (!ITERATION_KEYWORDS$1.has(child.name)) {
|
|
587
|
+
inferTypes(child, source, inputs, localScopes, "none");
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
});
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
if (nodeName === "FunctionDefinition") {
|
|
594
|
+
const params = collectFunctionParameters(node, source);
|
|
595
|
+
withScope(localScopes, params, () => {
|
|
596
|
+
const body = node.getChild("FunctionBody");
|
|
597
|
+
if (body)
|
|
598
|
+
inferTypes(body, source, inputs, localScopes, "none");
|
|
599
|
+
});
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
forEachChild(node, (child) => {
|
|
603
|
+
inferTypes(child, source, inputs, localScopes, filterCtx);
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
function analyzeForInputs(node, source, builtinNames) {
|
|
607
|
+
const collectedInputs = extractInputNames(node, source, builtinNames);
|
|
608
|
+
const inputs = initializeInputVariables(collectedInputs);
|
|
609
|
+
const localScopes = [new Set];
|
|
610
|
+
inferTypes(node, source, inputs, localScopes);
|
|
611
|
+
for (const variable of inputs) {
|
|
612
|
+
sortEntries(variable);
|
|
613
|
+
}
|
|
614
|
+
inputs.sort((a, b) => a.name.localeCompare(b.name));
|
|
615
|
+
return inputs;
|
|
616
|
+
}
|
|
617
|
+
var ITERATION_KEYWORDS = new Set(["for", "return", "some", "every", "InExpressions", "satisfies"]);
|
|
618
|
+
function analyzeForFunctions(node, source, builtinNames) {
|
|
619
|
+
const functions = [];
|
|
620
|
+
const scopes = [];
|
|
621
|
+
const recordInvocation = (funcNameNode) => {
|
|
622
|
+
const name = nodeText(funcNameNode, source);
|
|
623
|
+
const type = !isInScope(name, scopes) && builtinNames.has(name) ? "builtin" : "user";
|
|
624
|
+
const { from, to } = funcNameNode;
|
|
625
|
+
functions.push({ name, type, from, to });
|
|
626
|
+
};
|
|
627
|
+
const walk = (n) => {
|
|
628
|
+
const { name: nodeName } = n;
|
|
629
|
+
if (nodeName === "Context") {
|
|
630
|
+
withScope(scopes, [], (scope) => {
|
|
631
|
+
forEachChild(n, (child) => {
|
|
632
|
+
if (child.name !== "ContextEntry")
|
|
633
|
+
return;
|
|
634
|
+
forEachChild(child, (entryChild) => {
|
|
635
|
+
if (entryChild.name !== "Key")
|
|
636
|
+
walk(entryChild);
|
|
637
|
+
});
|
|
638
|
+
const keyName = child.getChild("Key")?.getChild("Name");
|
|
639
|
+
if (keyName)
|
|
640
|
+
scope.add(nodeText(keyName, source));
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
if (nodeName === "FunctionDefinition") {
|
|
646
|
+
const params = collectFunctionParameters(n, source);
|
|
647
|
+
withScope(scopes, params, () => {
|
|
648
|
+
const body = n.getChild("FunctionBody");
|
|
649
|
+
if (body)
|
|
650
|
+
walk(body);
|
|
651
|
+
});
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
if (nodeName === "ForExpression" || nodeName === "QuantifiedExpression") {
|
|
655
|
+
const inExp = n.getChild("InExpressions");
|
|
656
|
+
if (inExp) {
|
|
657
|
+
forEachChild(inExp, (child) => {
|
|
658
|
+
if (child.name === "InExpression") {
|
|
659
|
+
forEachChild(child, (innerChild) => {
|
|
660
|
+
if (innerChild.name !== "Name" && innerChild.name !== "in" && innerChild.name !== "Identifier") {
|
|
661
|
+
walk(innerChild);
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
withScope(scopes, collectIterationVariables(n, source), () => {
|
|
668
|
+
forEachChild(n, (child) => {
|
|
669
|
+
if (!ITERATION_KEYWORDS.has(child.name))
|
|
670
|
+
walk(child);
|
|
671
|
+
});
|
|
672
|
+
});
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
if (nodeName === "FunctionInvocation") {
|
|
676
|
+
const funcNameNode = n.getChild("VariableName");
|
|
677
|
+
if (funcNameNode)
|
|
678
|
+
recordInvocation(funcNameNode);
|
|
679
|
+
}
|
|
680
|
+
forEachChild(n, walk);
|
|
681
|
+
};
|
|
682
|
+
walk(node);
|
|
683
|
+
return functions.sort((a, b) => a.from - b.from);
|
|
684
|
+
}
|
|
685
|
+
function analyzeForValidity(node) {
|
|
686
|
+
return !containsErrorNodes(node);
|
|
687
|
+
}
|
|
688
|
+
function containsErrorNodes(node) {
|
|
689
|
+
if (node.type.isError) {
|
|
690
|
+
return true;
|
|
691
|
+
}
|
|
692
|
+
let child = node.firstChild;
|
|
693
|
+
while (child) {
|
|
694
|
+
if (containsErrorNodes(child)) {
|
|
695
|
+
return true;
|
|
696
|
+
}
|
|
697
|
+
child = child.nextSibling;
|
|
698
|
+
}
|
|
699
|
+
return false;
|
|
700
|
+
}
|
|
701
|
+
function createContext(variables) {
|
|
702
|
+
return variables.reduce((context, variable) => {
|
|
703
|
+
context[variable.name] = () => {};
|
|
704
|
+
return context;
|
|
705
|
+
}, {});
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
class FeelAnalyzer {
|
|
709
|
+
constructor(options = {}) {
|
|
710
|
+
this.builtinNames = new Set(options.builtins?.map((b) => b.name) ?? []);
|
|
711
|
+
const config = {
|
|
712
|
+
top: options.dialect === "unaryTests" ? "UnaryTests" : "Expression",
|
|
713
|
+
dialect: options.parserDialect
|
|
714
|
+
};
|
|
715
|
+
if (options.reservedNameBuiltins && options.reservedNameBuiltins.length > 0) {
|
|
716
|
+
config.contextTracker = trackVariables(createContext(options.reservedNameBuiltins));
|
|
717
|
+
}
|
|
718
|
+
this.parser = parser.configure(config);
|
|
719
|
+
}
|
|
720
|
+
analyzeExpression(expression) {
|
|
721
|
+
const tree = this.parser.parse(expression);
|
|
722
|
+
return this.analyzeTree(tree, expression);
|
|
723
|
+
}
|
|
724
|
+
analyzeTree(tree, source) {
|
|
725
|
+
const node = tree.topNode;
|
|
726
|
+
return {
|
|
727
|
+
valid: analyzeForValidity(node),
|
|
728
|
+
inputs: analyzeForInputs(node, source, this.builtinNames),
|
|
729
|
+
functions: analyzeForFunctions(node, source, this.builtinNames)
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
// ../../node_modules/@bpmn-io/semver-compat/dist/index.js
|
|
735
|
+
var re = { exports: {} };
|
|
736
|
+
var constants;
|
|
737
|
+
var hasRequiredConstants;
|
|
738
|
+
function requireConstants() {
|
|
739
|
+
if (hasRequiredConstants)
|
|
740
|
+
return constants;
|
|
741
|
+
hasRequiredConstants = 1;
|
|
742
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
743
|
+
const MAX_LENGTH = 256;
|
|
744
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
745
|
+
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
746
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
747
|
+
const RELEASE_TYPES = [
|
|
748
|
+
"major",
|
|
749
|
+
"premajor",
|
|
750
|
+
"minor",
|
|
751
|
+
"preminor",
|
|
752
|
+
"patch",
|
|
753
|
+
"prepatch",
|
|
754
|
+
"prerelease"
|
|
755
|
+
];
|
|
756
|
+
constants = {
|
|
757
|
+
MAX_LENGTH,
|
|
758
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
759
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
760
|
+
MAX_SAFE_INTEGER,
|
|
761
|
+
RELEASE_TYPES,
|
|
762
|
+
SEMVER_SPEC_VERSION,
|
|
763
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
764
|
+
FLAG_LOOSE: 2
|
|
765
|
+
};
|
|
766
|
+
return constants;
|
|
767
|
+
}
|
|
768
|
+
var debug_1;
|
|
769
|
+
var hasRequiredDebug;
|
|
770
|
+
function requireDebug() {
|
|
771
|
+
if (hasRequiredDebug)
|
|
772
|
+
return debug_1;
|
|
773
|
+
hasRequiredDebug = 1;
|
|
774
|
+
const debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
775
|
+
debug_1 = debug;
|
|
776
|
+
return debug_1;
|
|
777
|
+
}
|
|
778
|
+
var hasRequiredRe;
|
|
779
|
+
function requireRe() {
|
|
780
|
+
if (hasRequiredRe)
|
|
781
|
+
return re.exports;
|
|
782
|
+
hasRequiredRe = 1;
|
|
783
|
+
(function(module, exports$1) {
|
|
784
|
+
const {
|
|
785
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
786
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
787
|
+
MAX_LENGTH
|
|
788
|
+
} = requireConstants();
|
|
789
|
+
const debug = requireDebug();
|
|
790
|
+
exports$1 = module.exports = {};
|
|
791
|
+
const re = exports$1.re = [];
|
|
792
|
+
const safeRe = exports$1.safeRe = [];
|
|
793
|
+
const src = exports$1.src = [];
|
|
794
|
+
const safeSrc = exports$1.safeSrc = [];
|
|
795
|
+
const t = exports$1.t = {};
|
|
796
|
+
let R = 0;
|
|
797
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
798
|
+
const safeRegexReplacements = [
|
|
799
|
+
["\\s", 1],
|
|
800
|
+
["\\d", MAX_LENGTH],
|
|
801
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
802
|
+
];
|
|
803
|
+
const makeSafeRegex = (value) => {
|
|
804
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
805
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
806
|
+
}
|
|
807
|
+
return value;
|
|
808
|
+
};
|
|
809
|
+
const createToken = (name, value, isGlobal) => {
|
|
810
|
+
const safe = makeSafeRegex(value);
|
|
811
|
+
const index = R++;
|
|
812
|
+
debug(name, index, value);
|
|
813
|
+
t[name] = index;
|
|
814
|
+
src[index] = value;
|
|
815
|
+
safeSrc[index] = safe;
|
|
816
|
+
re[index] = new RegExp(value, isGlobal ? "g" : undefined);
|
|
817
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined);
|
|
818
|
+
};
|
|
819
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
820
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
821
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
822
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
|
|
823
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
824
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
825
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
826
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
827
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
828
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
829
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
830
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
831
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
832
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
833
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
834
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
835
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
836
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
837
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
838
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
839
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
840
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
841
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])" + "(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
842
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
843
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
|
|
844
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
845
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
846
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
847
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
848
|
+
exports$1.tildeTrimReplace = "$1~";
|
|
849
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
850
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
851
|
+
createToken("LONECARET", "(?:\\^)");
|
|
852
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
853
|
+
exports$1.caretTrimReplace = "$1^";
|
|
854
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
855
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
856
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
857
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
858
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
859
|
+
exports$1.comparatorTrimReplace = "$1$2$3";
|
|
860
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
|
|
861
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`);
|
|
862
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
863
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
864
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
865
|
+
})(re, re.exports);
|
|
866
|
+
return re.exports;
|
|
867
|
+
}
|
|
868
|
+
var parseOptions_1;
|
|
869
|
+
var hasRequiredParseOptions;
|
|
870
|
+
function requireParseOptions() {
|
|
871
|
+
if (hasRequiredParseOptions)
|
|
872
|
+
return parseOptions_1;
|
|
873
|
+
hasRequiredParseOptions = 1;
|
|
874
|
+
const looseOption = Object.freeze({ loose: true });
|
|
875
|
+
const emptyOpts = Object.freeze({});
|
|
876
|
+
const parseOptions = (options) => {
|
|
877
|
+
if (!options) {
|
|
878
|
+
return emptyOpts;
|
|
879
|
+
}
|
|
880
|
+
if (typeof options !== "object") {
|
|
881
|
+
return looseOption;
|
|
882
|
+
}
|
|
883
|
+
return options;
|
|
884
|
+
};
|
|
885
|
+
parseOptions_1 = parseOptions;
|
|
886
|
+
return parseOptions_1;
|
|
887
|
+
}
|
|
888
|
+
var identifiers;
|
|
889
|
+
var hasRequiredIdentifiers;
|
|
890
|
+
function requireIdentifiers() {
|
|
891
|
+
if (hasRequiredIdentifiers)
|
|
892
|
+
return identifiers;
|
|
893
|
+
hasRequiredIdentifiers = 1;
|
|
894
|
+
const numeric = /^[0-9]+$/;
|
|
895
|
+
const compareIdentifiers = (a, b) => {
|
|
896
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
897
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
898
|
+
}
|
|
899
|
+
const anum = numeric.test(a);
|
|
900
|
+
const bnum = numeric.test(b);
|
|
901
|
+
if (anum && bnum) {
|
|
902
|
+
a = +a;
|
|
903
|
+
b = +b;
|
|
904
|
+
}
|
|
905
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
906
|
+
};
|
|
907
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
908
|
+
identifiers = {
|
|
909
|
+
compareIdentifiers,
|
|
910
|
+
rcompareIdentifiers
|
|
911
|
+
};
|
|
912
|
+
return identifiers;
|
|
913
|
+
}
|
|
914
|
+
var semver$1;
|
|
915
|
+
var hasRequiredSemver$1;
|
|
916
|
+
function requireSemver$1() {
|
|
917
|
+
if (hasRequiredSemver$1)
|
|
918
|
+
return semver$1;
|
|
919
|
+
hasRequiredSemver$1 = 1;
|
|
920
|
+
const debug = requireDebug();
|
|
921
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
|
|
922
|
+
const { safeRe: re, t } = requireRe();
|
|
923
|
+
const parseOptions = requireParseOptions();
|
|
924
|
+
const { compareIdentifiers } = requireIdentifiers();
|
|
925
|
+
|
|
926
|
+
class SemVer {
|
|
927
|
+
constructor(version, options) {
|
|
928
|
+
options = parseOptions(options);
|
|
929
|
+
if (version instanceof SemVer) {
|
|
930
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
931
|
+
return version;
|
|
932
|
+
} else {
|
|
933
|
+
version = version.version;
|
|
934
|
+
}
|
|
935
|
+
} else if (typeof version !== "string") {
|
|
936
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
937
|
+
}
|
|
938
|
+
if (version.length > MAX_LENGTH) {
|
|
939
|
+
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
940
|
+
}
|
|
941
|
+
debug("SemVer", version, options);
|
|
942
|
+
this.options = options;
|
|
943
|
+
this.loose = !!options.loose;
|
|
944
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
945
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
946
|
+
if (!m) {
|
|
947
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
948
|
+
}
|
|
949
|
+
this.raw = version;
|
|
950
|
+
this.major = +m[1];
|
|
951
|
+
this.minor = +m[2];
|
|
952
|
+
this.patch = +m[3];
|
|
953
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
954
|
+
throw new TypeError("Invalid major version");
|
|
955
|
+
}
|
|
956
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
957
|
+
throw new TypeError("Invalid minor version");
|
|
958
|
+
}
|
|
959
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
960
|
+
throw new TypeError("Invalid patch version");
|
|
961
|
+
}
|
|
962
|
+
if (!m[4]) {
|
|
963
|
+
this.prerelease = [];
|
|
964
|
+
} else {
|
|
965
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
966
|
+
if (/^[0-9]+$/.test(id)) {
|
|
967
|
+
const num = +id;
|
|
968
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
969
|
+
return num;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
return id;
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
976
|
+
this.format();
|
|
977
|
+
}
|
|
978
|
+
format() {
|
|
979
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
980
|
+
if (this.prerelease.length) {
|
|
981
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
982
|
+
}
|
|
983
|
+
return this.version;
|
|
984
|
+
}
|
|
985
|
+
toString() {
|
|
986
|
+
return this.version;
|
|
987
|
+
}
|
|
988
|
+
compare(other) {
|
|
989
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
990
|
+
if (!(other instanceof SemVer)) {
|
|
991
|
+
if (typeof other === "string" && other === this.version) {
|
|
992
|
+
return 0;
|
|
993
|
+
}
|
|
994
|
+
other = new SemVer(other, this.options);
|
|
995
|
+
}
|
|
996
|
+
if (other.version === this.version) {
|
|
997
|
+
return 0;
|
|
998
|
+
}
|
|
999
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
1000
|
+
}
|
|
1001
|
+
compareMain(other) {
|
|
1002
|
+
if (!(other instanceof SemVer)) {
|
|
1003
|
+
other = new SemVer(other, this.options);
|
|
1004
|
+
}
|
|
1005
|
+
if (this.major < other.major) {
|
|
1006
|
+
return -1;
|
|
1007
|
+
}
|
|
1008
|
+
if (this.major > other.major) {
|
|
1009
|
+
return 1;
|
|
1010
|
+
}
|
|
1011
|
+
if (this.minor < other.minor) {
|
|
1012
|
+
return -1;
|
|
1013
|
+
}
|
|
1014
|
+
if (this.minor > other.minor) {
|
|
1015
|
+
return 1;
|
|
1016
|
+
}
|
|
1017
|
+
if (this.patch < other.patch) {
|
|
1018
|
+
return -1;
|
|
1019
|
+
}
|
|
1020
|
+
if (this.patch > other.patch) {
|
|
1021
|
+
return 1;
|
|
1022
|
+
}
|
|
1023
|
+
return 0;
|
|
1024
|
+
}
|
|
1025
|
+
comparePre(other) {
|
|
1026
|
+
if (!(other instanceof SemVer)) {
|
|
1027
|
+
other = new SemVer(other, this.options);
|
|
1028
|
+
}
|
|
1029
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
1030
|
+
return -1;
|
|
1031
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
1032
|
+
return 1;
|
|
1033
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
1034
|
+
return 0;
|
|
1035
|
+
}
|
|
1036
|
+
let i = 0;
|
|
1037
|
+
do {
|
|
1038
|
+
const a = this.prerelease[i];
|
|
1039
|
+
const b = other.prerelease[i];
|
|
1040
|
+
debug("prerelease compare", i, a, b);
|
|
1041
|
+
if (a === undefined && b === undefined) {
|
|
1042
|
+
return 0;
|
|
1043
|
+
} else if (b === undefined) {
|
|
1044
|
+
return 1;
|
|
1045
|
+
} else if (a === undefined) {
|
|
1046
|
+
return -1;
|
|
1047
|
+
} else if (a === b) {
|
|
1048
|
+
continue;
|
|
1049
|
+
} else {
|
|
1050
|
+
return compareIdentifiers(a, b);
|
|
1051
|
+
}
|
|
1052
|
+
} while (++i);
|
|
1053
|
+
}
|
|
1054
|
+
compareBuild(other) {
|
|
1055
|
+
if (!(other instanceof SemVer)) {
|
|
1056
|
+
other = new SemVer(other, this.options);
|
|
1057
|
+
}
|
|
1058
|
+
let i = 0;
|
|
1059
|
+
do {
|
|
1060
|
+
const a = this.build[i];
|
|
1061
|
+
const b = other.build[i];
|
|
1062
|
+
debug("build compare", i, a, b);
|
|
1063
|
+
if (a === undefined && b === undefined) {
|
|
1064
|
+
return 0;
|
|
1065
|
+
} else if (b === undefined) {
|
|
1066
|
+
return 1;
|
|
1067
|
+
} else if (a === undefined) {
|
|
1068
|
+
return -1;
|
|
1069
|
+
} else if (a === b) {
|
|
1070
|
+
continue;
|
|
1071
|
+
} else {
|
|
1072
|
+
return compareIdentifiers(a, b);
|
|
1073
|
+
}
|
|
1074
|
+
} while (++i);
|
|
1075
|
+
}
|
|
1076
|
+
inc(release, identifier, identifierBase) {
|
|
1077
|
+
if (release.startsWith("pre")) {
|
|
1078
|
+
if (!identifier && identifierBase === false) {
|
|
1079
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
1080
|
+
}
|
|
1081
|
+
if (identifier) {
|
|
1082
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
1083
|
+
if (!match || match[1] !== identifier) {
|
|
1084
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
switch (release) {
|
|
1089
|
+
case "premajor":
|
|
1090
|
+
this.prerelease.length = 0;
|
|
1091
|
+
this.patch = 0;
|
|
1092
|
+
this.minor = 0;
|
|
1093
|
+
this.major++;
|
|
1094
|
+
this.inc("pre", identifier, identifierBase);
|
|
1095
|
+
break;
|
|
1096
|
+
case "preminor":
|
|
1097
|
+
this.prerelease.length = 0;
|
|
1098
|
+
this.patch = 0;
|
|
1099
|
+
this.minor++;
|
|
1100
|
+
this.inc("pre", identifier, identifierBase);
|
|
1101
|
+
break;
|
|
1102
|
+
case "prepatch":
|
|
1103
|
+
this.prerelease.length = 0;
|
|
1104
|
+
this.inc("patch", identifier, identifierBase);
|
|
1105
|
+
this.inc("pre", identifier, identifierBase);
|
|
1106
|
+
break;
|
|
1107
|
+
case "prerelease":
|
|
1108
|
+
if (this.prerelease.length === 0) {
|
|
1109
|
+
this.inc("patch", identifier, identifierBase);
|
|
1110
|
+
}
|
|
1111
|
+
this.inc("pre", identifier, identifierBase);
|
|
1112
|
+
break;
|
|
1113
|
+
case "release":
|
|
1114
|
+
if (this.prerelease.length === 0) {
|
|
1115
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
1116
|
+
}
|
|
1117
|
+
this.prerelease.length = 0;
|
|
1118
|
+
break;
|
|
1119
|
+
case "major":
|
|
1120
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
1121
|
+
this.major++;
|
|
1122
|
+
}
|
|
1123
|
+
this.minor = 0;
|
|
1124
|
+
this.patch = 0;
|
|
1125
|
+
this.prerelease = [];
|
|
1126
|
+
break;
|
|
1127
|
+
case "minor":
|
|
1128
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
1129
|
+
this.minor++;
|
|
1130
|
+
}
|
|
1131
|
+
this.patch = 0;
|
|
1132
|
+
this.prerelease = [];
|
|
1133
|
+
break;
|
|
1134
|
+
case "patch":
|
|
1135
|
+
if (this.prerelease.length === 0) {
|
|
1136
|
+
this.patch++;
|
|
1137
|
+
}
|
|
1138
|
+
this.prerelease = [];
|
|
1139
|
+
break;
|
|
1140
|
+
case "pre": {
|
|
1141
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
1142
|
+
if (this.prerelease.length === 0) {
|
|
1143
|
+
this.prerelease = [base];
|
|
1144
|
+
} else {
|
|
1145
|
+
let i = this.prerelease.length;
|
|
1146
|
+
while (--i >= 0) {
|
|
1147
|
+
if (typeof this.prerelease[i] === "number") {
|
|
1148
|
+
this.prerelease[i]++;
|
|
1149
|
+
i = -2;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
if (i === -1) {
|
|
1153
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
1154
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
1155
|
+
}
|
|
1156
|
+
this.prerelease.push(base);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
if (identifier) {
|
|
1160
|
+
let prerelease = [identifier, base];
|
|
1161
|
+
if (identifierBase === false) {
|
|
1162
|
+
prerelease = [identifier];
|
|
1163
|
+
}
|
|
1164
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
1165
|
+
if (isNaN(this.prerelease[1])) {
|
|
1166
|
+
this.prerelease = prerelease;
|
|
1167
|
+
}
|
|
1168
|
+
} else {
|
|
1169
|
+
this.prerelease = prerelease;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
break;
|
|
1173
|
+
}
|
|
1174
|
+
default:
|
|
1175
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
1176
|
+
}
|
|
1177
|
+
this.raw = this.format();
|
|
1178
|
+
if (this.build.length) {
|
|
1179
|
+
this.raw += `+${this.build.join(".")}`;
|
|
1180
|
+
}
|
|
1181
|
+
return this;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
semver$1 = SemVer;
|
|
1185
|
+
return semver$1;
|
|
1186
|
+
}
|
|
1187
|
+
var parse_1;
|
|
1188
|
+
var hasRequiredParse;
|
|
1189
|
+
function requireParse() {
|
|
1190
|
+
if (hasRequiredParse)
|
|
1191
|
+
return parse_1;
|
|
1192
|
+
hasRequiredParse = 1;
|
|
1193
|
+
const SemVer = requireSemver$1();
|
|
1194
|
+
const parse = (version, options, throwErrors = false) => {
|
|
1195
|
+
if (version instanceof SemVer) {
|
|
1196
|
+
return version;
|
|
1197
|
+
}
|
|
1198
|
+
try {
|
|
1199
|
+
return new SemVer(version, options);
|
|
1200
|
+
} catch (er) {
|
|
1201
|
+
if (!throwErrors) {
|
|
1202
|
+
return null;
|
|
1203
|
+
}
|
|
1204
|
+
throw er;
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
parse_1 = parse;
|
|
1208
|
+
return parse_1;
|
|
1209
|
+
}
|
|
1210
|
+
var valid_1;
|
|
1211
|
+
var hasRequiredValid$1;
|
|
1212
|
+
function requireValid$1() {
|
|
1213
|
+
if (hasRequiredValid$1)
|
|
1214
|
+
return valid_1;
|
|
1215
|
+
hasRequiredValid$1 = 1;
|
|
1216
|
+
const parse = requireParse();
|
|
1217
|
+
const valid = (version, options) => {
|
|
1218
|
+
const v = parse(version, options);
|
|
1219
|
+
return v ? v.version : null;
|
|
1220
|
+
};
|
|
1221
|
+
valid_1 = valid;
|
|
1222
|
+
return valid_1;
|
|
1223
|
+
}
|
|
1224
|
+
var clean_1;
|
|
1225
|
+
var hasRequiredClean;
|
|
1226
|
+
function requireClean() {
|
|
1227
|
+
if (hasRequiredClean)
|
|
1228
|
+
return clean_1;
|
|
1229
|
+
hasRequiredClean = 1;
|
|
1230
|
+
const parse = requireParse();
|
|
1231
|
+
const clean = (version, options) => {
|
|
1232
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
1233
|
+
return s ? s.version : null;
|
|
1234
|
+
};
|
|
1235
|
+
clean_1 = clean;
|
|
1236
|
+
return clean_1;
|
|
1237
|
+
}
|
|
1238
|
+
var inc_1;
|
|
1239
|
+
var hasRequiredInc;
|
|
1240
|
+
function requireInc() {
|
|
1241
|
+
if (hasRequiredInc)
|
|
1242
|
+
return inc_1;
|
|
1243
|
+
hasRequiredInc = 1;
|
|
1244
|
+
const SemVer = requireSemver$1();
|
|
1245
|
+
const inc = (version, release, options, identifier, identifierBase) => {
|
|
1246
|
+
if (typeof options === "string") {
|
|
1247
|
+
identifierBase = identifier;
|
|
1248
|
+
identifier = options;
|
|
1249
|
+
options = undefined;
|
|
1250
|
+
}
|
|
1251
|
+
try {
|
|
1252
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
1253
|
+
} catch (er) {
|
|
1254
|
+
return null;
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
inc_1 = inc;
|
|
1258
|
+
return inc_1;
|
|
1259
|
+
}
|
|
1260
|
+
var diff_1;
|
|
1261
|
+
var hasRequiredDiff;
|
|
1262
|
+
function requireDiff() {
|
|
1263
|
+
if (hasRequiredDiff)
|
|
1264
|
+
return diff_1;
|
|
1265
|
+
hasRequiredDiff = 1;
|
|
1266
|
+
const parse = requireParse();
|
|
1267
|
+
const diff = (version1, version2) => {
|
|
1268
|
+
const v1 = parse(version1, null, true);
|
|
1269
|
+
const v2 = parse(version2, null, true);
|
|
1270
|
+
const comparison = v1.compare(v2);
|
|
1271
|
+
if (comparison === 0) {
|
|
1272
|
+
return null;
|
|
1273
|
+
}
|
|
1274
|
+
const v1Higher = comparison > 0;
|
|
1275
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
1276
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
1277
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
1278
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
1279
|
+
if (lowHasPre && !highHasPre) {
|
|
1280
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
1281
|
+
return "major";
|
|
1282
|
+
}
|
|
1283
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
1284
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
1285
|
+
return "minor";
|
|
1286
|
+
}
|
|
1287
|
+
return "patch";
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
const prefix = highHasPre ? "pre" : "";
|
|
1291
|
+
if (v1.major !== v2.major) {
|
|
1292
|
+
return prefix + "major";
|
|
1293
|
+
}
|
|
1294
|
+
if (v1.minor !== v2.minor) {
|
|
1295
|
+
return prefix + "minor";
|
|
1296
|
+
}
|
|
1297
|
+
if (v1.patch !== v2.patch) {
|
|
1298
|
+
return prefix + "patch";
|
|
1299
|
+
}
|
|
1300
|
+
return "prerelease";
|
|
1301
|
+
};
|
|
1302
|
+
diff_1 = diff;
|
|
1303
|
+
return diff_1;
|
|
1304
|
+
}
|
|
1305
|
+
var major_1;
|
|
1306
|
+
var hasRequiredMajor;
|
|
1307
|
+
function requireMajor() {
|
|
1308
|
+
if (hasRequiredMajor)
|
|
1309
|
+
return major_1;
|
|
1310
|
+
hasRequiredMajor = 1;
|
|
1311
|
+
const SemVer = requireSemver$1();
|
|
1312
|
+
const major = (a, loose) => new SemVer(a, loose).major;
|
|
1313
|
+
major_1 = major;
|
|
1314
|
+
return major_1;
|
|
1315
|
+
}
|
|
1316
|
+
var minor_1;
|
|
1317
|
+
var hasRequiredMinor;
|
|
1318
|
+
function requireMinor() {
|
|
1319
|
+
if (hasRequiredMinor)
|
|
1320
|
+
return minor_1;
|
|
1321
|
+
hasRequiredMinor = 1;
|
|
1322
|
+
const SemVer = requireSemver$1();
|
|
1323
|
+
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
1324
|
+
minor_1 = minor;
|
|
1325
|
+
return minor_1;
|
|
1326
|
+
}
|
|
1327
|
+
var patch_1;
|
|
1328
|
+
var hasRequiredPatch;
|
|
1329
|
+
function requirePatch() {
|
|
1330
|
+
if (hasRequiredPatch)
|
|
1331
|
+
return patch_1;
|
|
1332
|
+
hasRequiredPatch = 1;
|
|
1333
|
+
const SemVer = requireSemver$1();
|
|
1334
|
+
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
1335
|
+
patch_1 = patch;
|
|
1336
|
+
return patch_1;
|
|
1337
|
+
}
|
|
1338
|
+
var prerelease_1;
|
|
1339
|
+
var hasRequiredPrerelease;
|
|
1340
|
+
function requirePrerelease() {
|
|
1341
|
+
if (hasRequiredPrerelease)
|
|
1342
|
+
return prerelease_1;
|
|
1343
|
+
hasRequiredPrerelease = 1;
|
|
1344
|
+
const parse = requireParse();
|
|
1345
|
+
const prerelease = (version, options) => {
|
|
1346
|
+
const parsed = parse(version, options);
|
|
1347
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
1348
|
+
};
|
|
1349
|
+
prerelease_1 = prerelease;
|
|
1350
|
+
return prerelease_1;
|
|
1351
|
+
}
|
|
1352
|
+
var compare_1;
|
|
1353
|
+
var hasRequiredCompare;
|
|
1354
|
+
function requireCompare() {
|
|
1355
|
+
if (hasRequiredCompare)
|
|
1356
|
+
return compare_1;
|
|
1357
|
+
hasRequiredCompare = 1;
|
|
1358
|
+
const SemVer = requireSemver$1();
|
|
1359
|
+
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
1360
|
+
compare_1 = compare;
|
|
1361
|
+
return compare_1;
|
|
1362
|
+
}
|
|
1363
|
+
var rcompare_1;
|
|
1364
|
+
var hasRequiredRcompare;
|
|
1365
|
+
function requireRcompare() {
|
|
1366
|
+
if (hasRequiredRcompare)
|
|
1367
|
+
return rcompare_1;
|
|
1368
|
+
hasRequiredRcompare = 1;
|
|
1369
|
+
const compare = requireCompare();
|
|
1370
|
+
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
1371
|
+
rcompare_1 = rcompare;
|
|
1372
|
+
return rcompare_1;
|
|
1373
|
+
}
|
|
1374
|
+
var compareLoose_1;
|
|
1375
|
+
var hasRequiredCompareLoose;
|
|
1376
|
+
function requireCompareLoose() {
|
|
1377
|
+
if (hasRequiredCompareLoose)
|
|
1378
|
+
return compareLoose_1;
|
|
1379
|
+
hasRequiredCompareLoose = 1;
|
|
1380
|
+
const compare = requireCompare();
|
|
1381
|
+
const compareLoose = (a, b) => compare(a, b, true);
|
|
1382
|
+
compareLoose_1 = compareLoose;
|
|
1383
|
+
return compareLoose_1;
|
|
1384
|
+
}
|
|
1385
|
+
var compareBuild_1;
|
|
1386
|
+
var hasRequiredCompareBuild;
|
|
1387
|
+
function requireCompareBuild() {
|
|
1388
|
+
if (hasRequiredCompareBuild)
|
|
1389
|
+
return compareBuild_1;
|
|
1390
|
+
hasRequiredCompareBuild = 1;
|
|
1391
|
+
const SemVer = requireSemver$1();
|
|
1392
|
+
const compareBuild = (a, b, loose) => {
|
|
1393
|
+
const versionA = new SemVer(a, loose);
|
|
1394
|
+
const versionB = new SemVer(b, loose);
|
|
1395
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
1396
|
+
};
|
|
1397
|
+
compareBuild_1 = compareBuild;
|
|
1398
|
+
return compareBuild_1;
|
|
1399
|
+
}
|
|
1400
|
+
var sort_1;
|
|
1401
|
+
var hasRequiredSort;
|
|
1402
|
+
function requireSort() {
|
|
1403
|
+
if (hasRequiredSort)
|
|
1404
|
+
return sort_1;
|
|
1405
|
+
hasRequiredSort = 1;
|
|
1406
|
+
const compareBuild = requireCompareBuild();
|
|
1407
|
+
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
1408
|
+
sort_1 = sort;
|
|
1409
|
+
return sort_1;
|
|
1410
|
+
}
|
|
1411
|
+
var rsort_1;
|
|
1412
|
+
var hasRequiredRsort;
|
|
1413
|
+
function requireRsort() {
|
|
1414
|
+
if (hasRequiredRsort)
|
|
1415
|
+
return rsort_1;
|
|
1416
|
+
hasRequiredRsort = 1;
|
|
1417
|
+
const compareBuild = requireCompareBuild();
|
|
1418
|
+
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
1419
|
+
rsort_1 = rsort;
|
|
1420
|
+
return rsort_1;
|
|
1421
|
+
}
|
|
1422
|
+
var gt_1;
|
|
1423
|
+
var hasRequiredGt;
|
|
1424
|
+
function requireGt() {
|
|
1425
|
+
if (hasRequiredGt)
|
|
1426
|
+
return gt_1;
|
|
1427
|
+
hasRequiredGt = 1;
|
|
1428
|
+
const compare = requireCompare();
|
|
1429
|
+
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
1430
|
+
gt_1 = gt;
|
|
1431
|
+
return gt_1;
|
|
1432
|
+
}
|
|
1433
|
+
var lt_1;
|
|
1434
|
+
var hasRequiredLt;
|
|
1435
|
+
function requireLt() {
|
|
1436
|
+
if (hasRequiredLt)
|
|
1437
|
+
return lt_1;
|
|
1438
|
+
hasRequiredLt = 1;
|
|
1439
|
+
const compare = requireCompare();
|
|
1440
|
+
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
1441
|
+
lt_1 = lt;
|
|
1442
|
+
return lt_1;
|
|
1443
|
+
}
|
|
1444
|
+
var eq_1;
|
|
1445
|
+
var hasRequiredEq;
|
|
1446
|
+
function requireEq() {
|
|
1447
|
+
if (hasRequiredEq)
|
|
1448
|
+
return eq_1;
|
|
1449
|
+
hasRequiredEq = 1;
|
|
1450
|
+
const compare = requireCompare();
|
|
1451
|
+
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
1452
|
+
eq_1 = eq;
|
|
1453
|
+
return eq_1;
|
|
1454
|
+
}
|
|
1455
|
+
var neq_1;
|
|
1456
|
+
var hasRequiredNeq;
|
|
1457
|
+
function requireNeq() {
|
|
1458
|
+
if (hasRequiredNeq)
|
|
1459
|
+
return neq_1;
|
|
1460
|
+
hasRequiredNeq = 1;
|
|
1461
|
+
const compare = requireCompare();
|
|
1462
|
+
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
1463
|
+
neq_1 = neq;
|
|
1464
|
+
return neq_1;
|
|
1465
|
+
}
|
|
1466
|
+
var gte_1;
|
|
1467
|
+
var hasRequiredGte;
|
|
1468
|
+
function requireGte() {
|
|
1469
|
+
if (hasRequiredGte)
|
|
1470
|
+
return gte_1;
|
|
1471
|
+
hasRequiredGte = 1;
|
|
1472
|
+
const compare = requireCompare();
|
|
1473
|
+
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
1474
|
+
gte_1 = gte;
|
|
1475
|
+
return gte_1;
|
|
1476
|
+
}
|
|
1477
|
+
var lte_1;
|
|
1478
|
+
var hasRequiredLte;
|
|
1479
|
+
function requireLte() {
|
|
1480
|
+
if (hasRequiredLte)
|
|
1481
|
+
return lte_1;
|
|
1482
|
+
hasRequiredLte = 1;
|
|
1483
|
+
const compare = requireCompare();
|
|
1484
|
+
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
1485
|
+
lte_1 = lte;
|
|
1486
|
+
return lte_1;
|
|
1487
|
+
}
|
|
1488
|
+
var cmp_1;
|
|
1489
|
+
var hasRequiredCmp;
|
|
1490
|
+
function requireCmp() {
|
|
1491
|
+
if (hasRequiredCmp)
|
|
1492
|
+
return cmp_1;
|
|
1493
|
+
hasRequiredCmp = 1;
|
|
1494
|
+
const eq = requireEq();
|
|
1495
|
+
const neq = requireNeq();
|
|
1496
|
+
const gt = requireGt();
|
|
1497
|
+
const gte = requireGte();
|
|
1498
|
+
const lt = requireLt();
|
|
1499
|
+
const lte = requireLte();
|
|
1500
|
+
const cmp = (a, op, b, loose) => {
|
|
1501
|
+
switch (op) {
|
|
1502
|
+
case "===":
|
|
1503
|
+
if (typeof a === "object") {
|
|
1504
|
+
a = a.version;
|
|
1505
|
+
}
|
|
1506
|
+
if (typeof b === "object") {
|
|
1507
|
+
b = b.version;
|
|
1508
|
+
}
|
|
1509
|
+
return a === b;
|
|
1510
|
+
case "!==":
|
|
1511
|
+
if (typeof a === "object") {
|
|
1512
|
+
a = a.version;
|
|
1513
|
+
}
|
|
1514
|
+
if (typeof b === "object") {
|
|
1515
|
+
b = b.version;
|
|
1516
|
+
}
|
|
1517
|
+
return a !== b;
|
|
1518
|
+
case "":
|
|
1519
|
+
case "=":
|
|
1520
|
+
case "==":
|
|
1521
|
+
return eq(a, b, loose);
|
|
1522
|
+
case "!=":
|
|
1523
|
+
return neq(a, b, loose);
|
|
1524
|
+
case ">":
|
|
1525
|
+
return gt(a, b, loose);
|
|
1526
|
+
case ">=":
|
|
1527
|
+
return gte(a, b, loose);
|
|
1528
|
+
case "<":
|
|
1529
|
+
return lt(a, b, loose);
|
|
1530
|
+
case "<=":
|
|
1531
|
+
return lte(a, b, loose);
|
|
1532
|
+
default:
|
|
1533
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
cmp_1 = cmp;
|
|
1537
|
+
return cmp_1;
|
|
1538
|
+
}
|
|
1539
|
+
var coerce_1;
|
|
1540
|
+
var hasRequiredCoerce;
|
|
1541
|
+
function requireCoerce() {
|
|
1542
|
+
if (hasRequiredCoerce)
|
|
1543
|
+
return coerce_1;
|
|
1544
|
+
hasRequiredCoerce = 1;
|
|
1545
|
+
const SemVer = requireSemver$1();
|
|
1546
|
+
const parse = requireParse();
|
|
1547
|
+
const { safeRe: re, t } = requireRe();
|
|
1548
|
+
const coerce = (version, options) => {
|
|
1549
|
+
if (version instanceof SemVer) {
|
|
1550
|
+
return version;
|
|
1551
|
+
}
|
|
1552
|
+
if (typeof version === "number") {
|
|
1553
|
+
version = String(version);
|
|
1554
|
+
}
|
|
1555
|
+
if (typeof version !== "string") {
|
|
1556
|
+
return null;
|
|
1557
|
+
}
|
|
1558
|
+
options = options || {};
|
|
1559
|
+
let match = null;
|
|
1560
|
+
if (!options.rtl) {
|
|
1561
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
1562
|
+
} else {
|
|
1563
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
1564
|
+
let next;
|
|
1565
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
1566
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
1567
|
+
match = next;
|
|
1568
|
+
}
|
|
1569
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
1570
|
+
}
|
|
1571
|
+
coerceRtlRegex.lastIndex = -1;
|
|
1572
|
+
}
|
|
1573
|
+
if (match === null) {
|
|
1574
|
+
return null;
|
|
1575
|
+
}
|
|
1576
|
+
const major = match[2];
|
|
1577
|
+
const minor = match[3] || "0";
|
|
1578
|
+
const patch = match[4] || "0";
|
|
1579
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
1580
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
1581
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
1582
|
+
};
|
|
1583
|
+
coerce_1 = coerce;
|
|
1584
|
+
return coerce_1;
|
|
1585
|
+
}
|
|
1586
|
+
var lrucache;
|
|
1587
|
+
var hasRequiredLrucache;
|
|
1588
|
+
function requireLrucache() {
|
|
1589
|
+
if (hasRequiredLrucache)
|
|
1590
|
+
return lrucache;
|
|
1591
|
+
hasRequiredLrucache = 1;
|
|
1592
|
+
|
|
1593
|
+
class LRUCache {
|
|
1594
|
+
constructor() {
|
|
1595
|
+
this.max = 1000;
|
|
1596
|
+
this.map = new Map;
|
|
1597
|
+
}
|
|
1598
|
+
get(key) {
|
|
1599
|
+
const value = this.map.get(key);
|
|
1600
|
+
if (value === undefined) {
|
|
1601
|
+
return;
|
|
1602
|
+
} else {
|
|
1603
|
+
this.map.delete(key);
|
|
1604
|
+
this.map.set(key, value);
|
|
1605
|
+
return value;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
delete(key) {
|
|
1609
|
+
return this.map.delete(key);
|
|
1610
|
+
}
|
|
1611
|
+
set(key, value) {
|
|
1612
|
+
const deleted = this.delete(key);
|
|
1613
|
+
if (!deleted && value !== undefined) {
|
|
1614
|
+
if (this.map.size >= this.max) {
|
|
1615
|
+
const firstKey = this.map.keys().next().value;
|
|
1616
|
+
this.delete(firstKey);
|
|
1617
|
+
}
|
|
1618
|
+
this.map.set(key, value);
|
|
1619
|
+
}
|
|
1620
|
+
return this;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
lrucache = LRUCache;
|
|
1624
|
+
return lrucache;
|
|
1625
|
+
}
|
|
1626
|
+
var range;
|
|
1627
|
+
var hasRequiredRange;
|
|
1628
|
+
function requireRange() {
|
|
1629
|
+
if (hasRequiredRange)
|
|
1630
|
+
return range;
|
|
1631
|
+
hasRequiredRange = 1;
|
|
1632
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
1633
|
+
|
|
1634
|
+
class Range {
|
|
1635
|
+
constructor(range, options) {
|
|
1636
|
+
options = parseOptions(options);
|
|
1637
|
+
if (range instanceof Range) {
|
|
1638
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
1639
|
+
return range;
|
|
1640
|
+
} else {
|
|
1641
|
+
return new Range(range.raw, options);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
if (range instanceof Comparator) {
|
|
1645
|
+
this.raw = range.value;
|
|
1646
|
+
this.set = [[range]];
|
|
1647
|
+
this.formatted = undefined;
|
|
1648
|
+
return this;
|
|
1649
|
+
}
|
|
1650
|
+
this.options = options;
|
|
1651
|
+
this.loose = !!options.loose;
|
|
1652
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
1653
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
1654
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
1655
|
+
if (!this.set.length) {
|
|
1656
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
1657
|
+
}
|
|
1658
|
+
if (this.set.length > 1) {
|
|
1659
|
+
const first = this.set[0];
|
|
1660
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
1661
|
+
if (this.set.length === 0) {
|
|
1662
|
+
this.set = [first];
|
|
1663
|
+
} else if (this.set.length > 1) {
|
|
1664
|
+
for (const c of this.set) {
|
|
1665
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
1666
|
+
this.set = [c];
|
|
1667
|
+
break;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
this.formatted = undefined;
|
|
1673
|
+
}
|
|
1674
|
+
get range() {
|
|
1675
|
+
if (this.formatted === undefined) {
|
|
1676
|
+
this.formatted = "";
|
|
1677
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
1678
|
+
if (i > 0) {
|
|
1679
|
+
this.formatted += "||";
|
|
1680
|
+
}
|
|
1681
|
+
const comps = this.set[i];
|
|
1682
|
+
for (let k = 0;k < comps.length; k++) {
|
|
1683
|
+
if (k > 0) {
|
|
1684
|
+
this.formatted += " ";
|
|
1685
|
+
}
|
|
1686
|
+
this.formatted += comps[k].toString().trim();
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
return this.formatted;
|
|
1691
|
+
}
|
|
1692
|
+
format() {
|
|
1693
|
+
return this.range;
|
|
1694
|
+
}
|
|
1695
|
+
toString() {
|
|
1696
|
+
return this.range;
|
|
1697
|
+
}
|
|
1698
|
+
parseRange(range) {
|
|
1699
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
1700
|
+
const memoKey = memoOpts + ":" + range;
|
|
1701
|
+
const cached = cache.get(memoKey);
|
|
1702
|
+
if (cached) {
|
|
1703
|
+
return cached;
|
|
1704
|
+
}
|
|
1705
|
+
const loose = this.options.loose;
|
|
1706
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1707
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1708
|
+
debug("hyphen replace", range);
|
|
1709
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
1710
|
+
debug("comparator trim", range);
|
|
1711
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1712
|
+
debug("tilde trim", range);
|
|
1713
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1714
|
+
debug("caret trim", range);
|
|
1715
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1716
|
+
if (loose) {
|
|
1717
|
+
rangeList = rangeList.filter((comp) => {
|
|
1718
|
+
debug("loose invalid filter", comp, this.options);
|
|
1719
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
debug("range list", rangeList);
|
|
1723
|
+
const rangeMap = new Map;
|
|
1724
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1725
|
+
for (const comp of comparators) {
|
|
1726
|
+
if (isNullSet(comp)) {
|
|
1727
|
+
return [comp];
|
|
1728
|
+
}
|
|
1729
|
+
rangeMap.set(comp.value, comp);
|
|
1730
|
+
}
|
|
1731
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
1732
|
+
rangeMap.delete("");
|
|
1733
|
+
}
|
|
1734
|
+
const result = [...rangeMap.values()];
|
|
1735
|
+
cache.set(memoKey, result);
|
|
1736
|
+
return result;
|
|
1737
|
+
}
|
|
1738
|
+
intersects(range, options) {
|
|
1739
|
+
if (!(range instanceof Range)) {
|
|
1740
|
+
throw new TypeError("a Range is required");
|
|
1741
|
+
}
|
|
1742
|
+
return this.set.some((thisComparators) => {
|
|
1743
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
1744
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
1745
|
+
return rangeComparators.every((rangeComparator) => {
|
|
1746
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
1747
|
+
});
|
|
1748
|
+
});
|
|
1749
|
+
});
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
test(version) {
|
|
1753
|
+
if (!version) {
|
|
1754
|
+
return false;
|
|
1755
|
+
}
|
|
1756
|
+
if (typeof version === "string") {
|
|
1757
|
+
try {
|
|
1758
|
+
version = new SemVer(version, this.options);
|
|
1759
|
+
} catch (er) {
|
|
1760
|
+
return false;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
1764
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
1765
|
+
return true;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
return false;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
range = Range;
|
|
1772
|
+
const LRU = requireLrucache();
|
|
1773
|
+
const cache = new LRU;
|
|
1774
|
+
const parseOptions = requireParseOptions();
|
|
1775
|
+
const Comparator = requireComparator();
|
|
1776
|
+
const debug = requireDebug();
|
|
1777
|
+
const SemVer = requireSemver$1();
|
|
1778
|
+
const {
|
|
1779
|
+
safeRe: re,
|
|
1780
|
+
t,
|
|
1781
|
+
comparatorTrimReplace,
|
|
1782
|
+
tildeTrimReplace,
|
|
1783
|
+
caretTrimReplace
|
|
1784
|
+
} = requireRe();
|
|
1785
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
|
|
1786
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
1787
|
+
const isAny = (c) => c.value === "";
|
|
1788
|
+
const isSatisfiable = (comparators, options) => {
|
|
1789
|
+
let result = true;
|
|
1790
|
+
const remainingComparators = comparators.slice();
|
|
1791
|
+
let testComparator = remainingComparators.pop();
|
|
1792
|
+
while (result && remainingComparators.length) {
|
|
1793
|
+
result = remainingComparators.every((otherComparator) => {
|
|
1794
|
+
return testComparator.intersects(otherComparator, options);
|
|
1795
|
+
});
|
|
1796
|
+
testComparator = remainingComparators.pop();
|
|
1797
|
+
}
|
|
1798
|
+
return result;
|
|
1799
|
+
};
|
|
1800
|
+
const parseComparator = (comp, options) => {
|
|
1801
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
1802
|
+
debug("comp", comp, options);
|
|
1803
|
+
comp = replaceCarets(comp, options);
|
|
1804
|
+
debug("caret", comp);
|
|
1805
|
+
comp = replaceTildes(comp, options);
|
|
1806
|
+
debug("tildes", comp);
|
|
1807
|
+
comp = replaceXRanges(comp, options);
|
|
1808
|
+
debug("xrange", comp);
|
|
1809
|
+
comp = replaceStars(comp, options);
|
|
1810
|
+
debug("stars", comp);
|
|
1811
|
+
return comp;
|
|
1812
|
+
};
|
|
1813
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1814
|
+
const replaceTildes = (comp, options) => {
|
|
1815
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
1816
|
+
};
|
|
1817
|
+
const replaceTilde = (comp, options) => {
|
|
1818
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
1819
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1820
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
1821
|
+
let ret;
|
|
1822
|
+
if (isX(M)) {
|
|
1823
|
+
ret = "";
|
|
1824
|
+
} else if (isX(m)) {
|
|
1825
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
1826
|
+
} else if (isX(p)) {
|
|
1827
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
1828
|
+
} else if (pr) {
|
|
1829
|
+
debug("replaceTilde pr", pr);
|
|
1830
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1831
|
+
} else {
|
|
1832
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1833
|
+
}
|
|
1834
|
+
debug("tilde return", ret);
|
|
1835
|
+
return ret;
|
|
1836
|
+
});
|
|
1837
|
+
};
|
|
1838
|
+
const replaceCarets = (comp, options) => {
|
|
1839
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
1840
|
+
};
|
|
1841
|
+
const replaceCaret = (comp, options) => {
|
|
1842
|
+
debug("caret", comp, options);
|
|
1843
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
1844
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1845
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1846
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
1847
|
+
let ret;
|
|
1848
|
+
if (isX(M)) {
|
|
1849
|
+
ret = "";
|
|
1850
|
+
} else if (isX(m)) {
|
|
1851
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1852
|
+
} else if (isX(p)) {
|
|
1853
|
+
if (M === "0") {
|
|
1854
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1855
|
+
} else {
|
|
1856
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
1857
|
+
}
|
|
1858
|
+
} else if (pr) {
|
|
1859
|
+
debug("replaceCaret pr", pr);
|
|
1860
|
+
if (M === "0") {
|
|
1861
|
+
if (m === "0") {
|
|
1862
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
1863
|
+
} else {
|
|
1864
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1865
|
+
}
|
|
1866
|
+
} else {
|
|
1867
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
1868
|
+
}
|
|
1869
|
+
} else {
|
|
1870
|
+
debug("no pr");
|
|
1871
|
+
if (M === "0") {
|
|
1872
|
+
if (m === "0") {
|
|
1873
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
1874
|
+
} else {
|
|
1875
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
1876
|
+
}
|
|
1877
|
+
} else {
|
|
1878
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
debug("caret return", ret);
|
|
1882
|
+
return ret;
|
|
1883
|
+
});
|
|
1884
|
+
};
|
|
1885
|
+
const replaceXRanges = (comp, options) => {
|
|
1886
|
+
debug("replaceXRanges", comp, options);
|
|
1887
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
1888
|
+
};
|
|
1889
|
+
const replaceXRange = (comp, options) => {
|
|
1890
|
+
comp = comp.trim();
|
|
1891
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
1892
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
1893
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
1894
|
+
const xM = isX(M);
|
|
1895
|
+
const xm = xM || isX(m);
|
|
1896
|
+
const xp = xm || isX(p);
|
|
1897
|
+
const anyX = xp;
|
|
1898
|
+
if (gtlt === "=" && anyX) {
|
|
1899
|
+
gtlt = "";
|
|
1900
|
+
}
|
|
1901
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
1902
|
+
if (xM) {
|
|
1903
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
1904
|
+
ret = "<0.0.0-0";
|
|
1905
|
+
} else {
|
|
1906
|
+
ret = "*";
|
|
1907
|
+
}
|
|
1908
|
+
} else if (gtlt && anyX) {
|
|
1909
|
+
if (xm) {
|
|
1910
|
+
m = 0;
|
|
1911
|
+
}
|
|
1912
|
+
p = 0;
|
|
1913
|
+
if (gtlt === ">") {
|
|
1914
|
+
gtlt = ">=";
|
|
1915
|
+
if (xm) {
|
|
1916
|
+
M = +M + 1;
|
|
1917
|
+
m = 0;
|
|
1918
|
+
p = 0;
|
|
1919
|
+
} else {
|
|
1920
|
+
m = +m + 1;
|
|
1921
|
+
p = 0;
|
|
1922
|
+
}
|
|
1923
|
+
} else if (gtlt === "<=") {
|
|
1924
|
+
gtlt = "<";
|
|
1925
|
+
if (xm) {
|
|
1926
|
+
M = +M + 1;
|
|
1927
|
+
} else {
|
|
1928
|
+
m = +m + 1;
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
if (gtlt === "<") {
|
|
1932
|
+
pr = "-0";
|
|
1933
|
+
}
|
|
1934
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1935
|
+
} else if (xm) {
|
|
1936
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1937
|
+
} else if (xp) {
|
|
1938
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
1939
|
+
}
|
|
1940
|
+
debug("xRange return", ret);
|
|
1941
|
+
return ret;
|
|
1942
|
+
});
|
|
1943
|
+
};
|
|
1944
|
+
const replaceStars = (comp, options) => {
|
|
1945
|
+
debug("replaceStars", comp, options);
|
|
1946
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
1947
|
+
};
|
|
1948
|
+
const replaceGTE0 = (comp, options) => {
|
|
1949
|
+
debug("replaceGTE0", comp, options);
|
|
1950
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
1951
|
+
};
|
|
1952
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
1953
|
+
if (isX(fM)) {
|
|
1954
|
+
from = "";
|
|
1955
|
+
} else if (isX(fm)) {
|
|
1956
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
1957
|
+
} else if (isX(fp)) {
|
|
1958
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
1959
|
+
} else if (fpr) {
|
|
1960
|
+
from = `>=${from}`;
|
|
1961
|
+
} else {
|
|
1962
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
1963
|
+
}
|
|
1964
|
+
if (isX(tM)) {
|
|
1965
|
+
to = "";
|
|
1966
|
+
} else if (isX(tm)) {
|
|
1967
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
1968
|
+
} else if (isX(tp)) {
|
|
1969
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
1970
|
+
} else if (tpr) {
|
|
1971
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1972
|
+
} else if (incPr) {
|
|
1973
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1974
|
+
} else {
|
|
1975
|
+
to = `<=${to}`;
|
|
1976
|
+
}
|
|
1977
|
+
return `${from} ${to}`.trim();
|
|
1978
|
+
};
|
|
1979
|
+
const testSet = (set, version, options) => {
|
|
1980
|
+
for (let i = 0;i < set.length; i++) {
|
|
1981
|
+
if (!set[i].test(version)) {
|
|
1982
|
+
return false;
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
1986
|
+
for (let i = 0;i < set.length; i++) {
|
|
1987
|
+
debug(set[i].semver);
|
|
1988
|
+
if (set[i].semver === Comparator.ANY) {
|
|
1989
|
+
continue;
|
|
1990
|
+
}
|
|
1991
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
1992
|
+
const allowed = set[i].semver;
|
|
1993
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
1994
|
+
return true;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
return false;
|
|
1999
|
+
}
|
|
2000
|
+
return true;
|
|
2001
|
+
};
|
|
2002
|
+
return range;
|
|
2003
|
+
}
|
|
2004
|
+
var comparator;
|
|
2005
|
+
var hasRequiredComparator;
|
|
2006
|
+
function requireComparator() {
|
|
2007
|
+
if (hasRequiredComparator)
|
|
2008
|
+
return comparator;
|
|
2009
|
+
hasRequiredComparator = 1;
|
|
2010
|
+
const ANY = Symbol("SemVer ANY");
|
|
2011
|
+
|
|
2012
|
+
class Comparator {
|
|
2013
|
+
static get ANY() {
|
|
2014
|
+
return ANY;
|
|
2015
|
+
}
|
|
2016
|
+
constructor(comp, options) {
|
|
2017
|
+
options = parseOptions(options);
|
|
2018
|
+
if (comp instanceof Comparator) {
|
|
2019
|
+
if (comp.loose === !!options.loose) {
|
|
2020
|
+
return comp;
|
|
2021
|
+
} else {
|
|
2022
|
+
comp = comp.value;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
2026
|
+
debug("comparator", comp, options);
|
|
2027
|
+
this.options = options;
|
|
2028
|
+
this.loose = !!options.loose;
|
|
2029
|
+
this.parse(comp);
|
|
2030
|
+
if (this.semver === ANY) {
|
|
2031
|
+
this.value = "";
|
|
2032
|
+
} else {
|
|
2033
|
+
this.value = this.operator + this.semver.version;
|
|
2034
|
+
}
|
|
2035
|
+
debug("comp", this);
|
|
2036
|
+
}
|
|
2037
|
+
parse(comp) {
|
|
2038
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
2039
|
+
const m = comp.match(r);
|
|
2040
|
+
if (!m) {
|
|
2041
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
2042
|
+
}
|
|
2043
|
+
this.operator = m[1] !== undefined ? m[1] : "";
|
|
2044
|
+
if (this.operator === "=") {
|
|
2045
|
+
this.operator = "";
|
|
2046
|
+
}
|
|
2047
|
+
if (!m[2]) {
|
|
2048
|
+
this.semver = ANY;
|
|
2049
|
+
} else {
|
|
2050
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
toString() {
|
|
2054
|
+
return this.value;
|
|
2055
|
+
}
|
|
2056
|
+
test(version) {
|
|
2057
|
+
debug("Comparator.test", version, this.options.loose);
|
|
2058
|
+
if (this.semver === ANY || version === ANY) {
|
|
2059
|
+
return true;
|
|
2060
|
+
}
|
|
2061
|
+
if (typeof version === "string") {
|
|
2062
|
+
try {
|
|
2063
|
+
version = new SemVer(version, this.options);
|
|
2064
|
+
} catch (er) {
|
|
2065
|
+
return false;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
2069
|
+
}
|
|
2070
|
+
intersects(comp, options) {
|
|
2071
|
+
if (!(comp instanceof Comparator)) {
|
|
2072
|
+
throw new TypeError("a Comparator is required");
|
|
2073
|
+
}
|
|
2074
|
+
if (this.operator === "") {
|
|
2075
|
+
if (this.value === "") {
|
|
2076
|
+
return true;
|
|
2077
|
+
}
|
|
2078
|
+
return new Range(comp.value, options).test(this.value);
|
|
2079
|
+
} else if (comp.operator === "") {
|
|
2080
|
+
if (comp.value === "") {
|
|
2081
|
+
return true;
|
|
2082
|
+
}
|
|
2083
|
+
return new Range(this.value, options).test(comp.semver);
|
|
2084
|
+
}
|
|
2085
|
+
options = parseOptions(options);
|
|
2086
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
2087
|
+
return false;
|
|
2088
|
+
}
|
|
2089
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
2090
|
+
return false;
|
|
2091
|
+
}
|
|
2092
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
2093
|
+
return true;
|
|
2094
|
+
}
|
|
2095
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
2096
|
+
return true;
|
|
2097
|
+
}
|
|
2098
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
2099
|
+
return true;
|
|
2100
|
+
}
|
|
2101
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
2102
|
+
return true;
|
|
2103
|
+
}
|
|
2104
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
2105
|
+
return true;
|
|
2106
|
+
}
|
|
2107
|
+
return false;
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
comparator = Comparator;
|
|
2111
|
+
const parseOptions = requireParseOptions();
|
|
2112
|
+
const { safeRe: re, t } = requireRe();
|
|
2113
|
+
const cmp = requireCmp();
|
|
2114
|
+
const debug = requireDebug();
|
|
2115
|
+
const SemVer = requireSemver$1();
|
|
2116
|
+
const Range = requireRange();
|
|
2117
|
+
return comparator;
|
|
2118
|
+
}
|
|
2119
|
+
var satisfies_1;
|
|
2120
|
+
var hasRequiredSatisfies;
|
|
2121
|
+
function requireSatisfies() {
|
|
2122
|
+
if (hasRequiredSatisfies)
|
|
2123
|
+
return satisfies_1;
|
|
2124
|
+
hasRequiredSatisfies = 1;
|
|
2125
|
+
const Range = requireRange();
|
|
2126
|
+
const satisfies = (version, range, options) => {
|
|
2127
|
+
try {
|
|
2128
|
+
range = new Range(range, options);
|
|
2129
|
+
} catch (er) {
|
|
2130
|
+
return false;
|
|
2131
|
+
}
|
|
2132
|
+
return range.test(version);
|
|
2133
|
+
};
|
|
2134
|
+
satisfies_1 = satisfies;
|
|
2135
|
+
return satisfies_1;
|
|
2136
|
+
}
|
|
2137
|
+
var toComparators_1;
|
|
2138
|
+
var hasRequiredToComparators;
|
|
2139
|
+
function requireToComparators() {
|
|
2140
|
+
if (hasRequiredToComparators)
|
|
2141
|
+
return toComparators_1;
|
|
2142
|
+
hasRequiredToComparators = 1;
|
|
2143
|
+
const Range = requireRange();
|
|
2144
|
+
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
2145
|
+
toComparators_1 = toComparators;
|
|
2146
|
+
return toComparators_1;
|
|
2147
|
+
}
|
|
2148
|
+
var maxSatisfying_1;
|
|
2149
|
+
var hasRequiredMaxSatisfying;
|
|
2150
|
+
function requireMaxSatisfying() {
|
|
2151
|
+
if (hasRequiredMaxSatisfying)
|
|
2152
|
+
return maxSatisfying_1;
|
|
2153
|
+
hasRequiredMaxSatisfying = 1;
|
|
2154
|
+
const SemVer = requireSemver$1();
|
|
2155
|
+
const Range = requireRange();
|
|
2156
|
+
const maxSatisfying = (versions, range, options) => {
|
|
2157
|
+
let max = null;
|
|
2158
|
+
let maxSV = null;
|
|
2159
|
+
let rangeObj = null;
|
|
2160
|
+
try {
|
|
2161
|
+
rangeObj = new Range(range, options);
|
|
2162
|
+
} catch (er) {
|
|
2163
|
+
return null;
|
|
2164
|
+
}
|
|
2165
|
+
versions.forEach((v) => {
|
|
2166
|
+
if (rangeObj.test(v)) {
|
|
2167
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
2168
|
+
max = v;
|
|
2169
|
+
maxSV = new SemVer(max, options);
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
return max;
|
|
2174
|
+
};
|
|
2175
|
+
maxSatisfying_1 = maxSatisfying;
|
|
2176
|
+
return maxSatisfying_1;
|
|
2177
|
+
}
|
|
2178
|
+
var minSatisfying_1;
|
|
2179
|
+
var hasRequiredMinSatisfying;
|
|
2180
|
+
function requireMinSatisfying() {
|
|
2181
|
+
if (hasRequiredMinSatisfying)
|
|
2182
|
+
return minSatisfying_1;
|
|
2183
|
+
hasRequiredMinSatisfying = 1;
|
|
2184
|
+
const SemVer = requireSemver$1();
|
|
2185
|
+
const Range = requireRange();
|
|
2186
|
+
const minSatisfying = (versions, range, options) => {
|
|
2187
|
+
let min = null;
|
|
2188
|
+
let minSV = null;
|
|
2189
|
+
let rangeObj = null;
|
|
2190
|
+
try {
|
|
2191
|
+
rangeObj = new Range(range, options);
|
|
2192
|
+
} catch (er) {
|
|
2193
|
+
return null;
|
|
2194
|
+
}
|
|
2195
|
+
versions.forEach((v) => {
|
|
2196
|
+
if (rangeObj.test(v)) {
|
|
2197
|
+
if (!min || minSV.compare(v) === 1) {
|
|
2198
|
+
min = v;
|
|
2199
|
+
minSV = new SemVer(min, options);
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
});
|
|
2203
|
+
return min;
|
|
2204
|
+
};
|
|
2205
|
+
minSatisfying_1 = minSatisfying;
|
|
2206
|
+
return minSatisfying_1;
|
|
2207
|
+
}
|
|
2208
|
+
var minVersion_1;
|
|
2209
|
+
var hasRequiredMinVersion;
|
|
2210
|
+
function requireMinVersion() {
|
|
2211
|
+
if (hasRequiredMinVersion)
|
|
2212
|
+
return minVersion_1;
|
|
2213
|
+
hasRequiredMinVersion = 1;
|
|
2214
|
+
const SemVer = requireSemver$1();
|
|
2215
|
+
const Range = requireRange();
|
|
2216
|
+
const gt = requireGt();
|
|
2217
|
+
const minVersion = (range, loose) => {
|
|
2218
|
+
range = new Range(range, loose);
|
|
2219
|
+
let minver = new SemVer("0.0.0");
|
|
2220
|
+
if (range.test(minver)) {
|
|
2221
|
+
return minver;
|
|
2222
|
+
}
|
|
2223
|
+
minver = new SemVer("0.0.0-0");
|
|
2224
|
+
if (range.test(minver)) {
|
|
2225
|
+
return minver;
|
|
2226
|
+
}
|
|
2227
|
+
minver = null;
|
|
2228
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
2229
|
+
const comparators = range.set[i];
|
|
2230
|
+
let setMin = null;
|
|
2231
|
+
comparators.forEach((comparator) => {
|
|
2232
|
+
const compver = new SemVer(comparator.semver.version);
|
|
2233
|
+
switch (comparator.operator) {
|
|
2234
|
+
case ">":
|
|
2235
|
+
if (compver.prerelease.length === 0) {
|
|
2236
|
+
compver.patch++;
|
|
2237
|
+
} else {
|
|
2238
|
+
compver.prerelease.push(0);
|
|
2239
|
+
}
|
|
2240
|
+
compver.raw = compver.format();
|
|
2241
|
+
case "":
|
|
2242
|
+
case ">=":
|
|
2243
|
+
if (!setMin || gt(compver, setMin)) {
|
|
2244
|
+
setMin = compver;
|
|
2245
|
+
}
|
|
2246
|
+
break;
|
|
2247
|
+
case "<":
|
|
2248
|
+
case "<=":
|
|
2249
|
+
break;
|
|
2250
|
+
default:
|
|
2251
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
2252
|
+
}
|
|
2253
|
+
});
|
|
2254
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
2255
|
+
minver = setMin;
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
if (minver && range.test(minver)) {
|
|
2259
|
+
return minver;
|
|
2260
|
+
}
|
|
2261
|
+
return null;
|
|
2262
|
+
};
|
|
2263
|
+
minVersion_1 = minVersion;
|
|
2264
|
+
return minVersion_1;
|
|
2265
|
+
}
|
|
2266
|
+
var valid;
|
|
2267
|
+
var hasRequiredValid;
|
|
2268
|
+
function requireValid() {
|
|
2269
|
+
if (hasRequiredValid)
|
|
2270
|
+
return valid;
|
|
2271
|
+
hasRequiredValid = 1;
|
|
2272
|
+
const Range = requireRange();
|
|
2273
|
+
const validRange = (range, options) => {
|
|
2274
|
+
try {
|
|
2275
|
+
return new Range(range, options).range || "*";
|
|
2276
|
+
} catch (er) {
|
|
2277
|
+
return null;
|
|
2278
|
+
}
|
|
2279
|
+
};
|
|
2280
|
+
valid = validRange;
|
|
2281
|
+
return valid;
|
|
2282
|
+
}
|
|
2283
|
+
var outside_1;
|
|
2284
|
+
var hasRequiredOutside;
|
|
2285
|
+
function requireOutside() {
|
|
2286
|
+
if (hasRequiredOutside)
|
|
2287
|
+
return outside_1;
|
|
2288
|
+
hasRequiredOutside = 1;
|
|
2289
|
+
const SemVer = requireSemver$1();
|
|
2290
|
+
const Comparator = requireComparator();
|
|
2291
|
+
const { ANY } = Comparator;
|
|
2292
|
+
const Range = requireRange();
|
|
2293
|
+
const satisfies = requireSatisfies();
|
|
2294
|
+
const gt = requireGt();
|
|
2295
|
+
const lt = requireLt();
|
|
2296
|
+
const lte = requireLte();
|
|
2297
|
+
const gte = requireGte();
|
|
2298
|
+
const outside = (version, range, hilo, options) => {
|
|
2299
|
+
version = new SemVer(version, options);
|
|
2300
|
+
range = new Range(range, options);
|
|
2301
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
2302
|
+
switch (hilo) {
|
|
2303
|
+
case ">":
|
|
2304
|
+
gtfn = gt;
|
|
2305
|
+
ltefn = lte;
|
|
2306
|
+
ltfn = lt;
|
|
2307
|
+
comp = ">";
|
|
2308
|
+
ecomp = ">=";
|
|
2309
|
+
break;
|
|
2310
|
+
case "<":
|
|
2311
|
+
gtfn = lt;
|
|
2312
|
+
ltefn = gte;
|
|
2313
|
+
ltfn = gt;
|
|
2314
|
+
comp = "<";
|
|
2315
|
+
ecomp = "<=";
|
|
2316
|
+
break;
|
|
2317
|
+
default:
|
|
2318
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
2319
|
+
}
|
|
2320
|
+
if (satisfies(version, range, options)) {
|
|
2321
|
+
return false;
|
|
2322
|
+
}
|
|
2323
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
2324
|
+
const comparators = range.set[i];
|
|
2325
|
+
let high = null;
|
|
2326
|
+
let low = null;
|
|
2327
|
+
comparators.forEach((comparator) => {
|
|
2328
|
+
if (comparator.semver === ANY) {
|
|
2329
|
+
comparator = new Comparator(">=0.0.0");
|
|
2330
|
+
}
|
|
2331
|
+
high = high || comparator;
|
|
2332
|
+
low = low || comparator;
|
|
2333
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
2334
|
+
high = comparator;
|
|
2335
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
2336
|
+
low = comparator;
|
|
2337
|
+
}
|
|
2338
|
+
});
|
|
2339
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
2340
|
+
return false;
|
|
2341
|
+
}
|
|
2342
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
2343
|
+
return false;
|
|
2344
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
2345
|
+
return false;
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
return true;
|
|
2349
|
+
};
|
|
2350
|
+
outside_1 = outside;
|
|
2351
|
+
return outside_1;
|
|
2352
|
+
}
|
|
2353
|
+
var gtr_1;
|
|
2354
|
+
var hasRequiredGtr;
|
|
2355
|
+
function requireGtr() {
|
|
2356
|
+
if (hasRequiredGtr)
|
|
2357
|
+
return gtr_1;
|
|
2358
|
+
hasRequiredGtr = 1;
|
|
2359
|
+
const outside = requireOutside();
|
|
2360
|
+
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
2361
|
+
gtr_1 = gtr;
|
|
2362
|
+
return gtr_1;
|
|
2363
|
+
}
|
|
2364
|
+
var ltr_1;
|
|
2365
|
+
var hasRequiredLtr;
|
|
2366
|
+
function requireLtr() {
|
|
2367
|
+
if (hasRequiredLtr)
|
|
2368
|
+
return ltr_1;
|
|
2369
|
+
hasRequiredLtr = 1;
|
|
2370
|
+
const outside = requireOutside();
|
|
2371
|
+
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
2372
|
+
ltr_1 = ltr;
|
|
2373
|
+
return ltr_1;
|
|
2374
|
+
}
|
|
2375
|
+
var intersects_1;
|
|
2376
|
+
var hasRequiredIntersects;
|
|
2377
|
+
function requireIntersects() {
|
|
2378
|
+
if (hasRequiredIntersects)
|
|
2379
|
+
return intersects_1;
|
|
2380
|
+
hasRequiredIntersects = 1;
|
|
2381
|
+
const Range = requireRange();
|
|
2382
|
+
const intersects = (r1, r2, options) => {
|
|
2383
|
+
r1 = new Range(r1, options);
|
|
2384
|
+
r2 = new Range(r2, options);
|
|
2385
|
+
return r1.intersects(r2, options);
|
|
2386
|
+
};
|
|
2387
|
+
intersects_1 = intersects;
|
|
2388
|
+
return intersects_1;
|
|
2389
|
+
}
|
|
2390
|
+
var simplify;
|
|
2391
|
+
var hasRequiredSimplify;
|
|
2392
|
+
function requireSimplify() {
|
|
2393
|
+
if (hasRequiredSimplify)
|
|
2394
|
+
return simplify;
|
|
2395
|
+
hasRequiredSimplify = 1;
|
|
2396
|
+
const satisfies = requireSatisfies();
|
|
2397
|
+
const compare = requireCompare();
|
|
2398
|
+
simplify = (versions, range, options) => {
|
|
2399
|
+
const set = [];
|
|
2400
|
+
let first = null;
|
|
2401
|
+
let prev = null;
|
|
2402
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2403
|
+
for (const version of v) {
|
|
2404
|
+
const included = satisfies(version, range, options);
|
|
2405
|
+
if (included) {
|
|
2406
|
+
prev = version;
|
|
2407
|
+
if (!first) {
|
|
2408
|
+
first = version;
|
|
2409
|
+
}
|
|
2410
|
+
} else {
|
|
2411
|
+
if (prev) {
|
|
2412
|
+
set.push([first, prev]);
|
|
2413
|
+
}
|
|
2414
|
+
prev = null;
|
|
2415
|
+
first = null;
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
if (first) {
|
|
2419
|
+
set.push([first, null]);
|
|
2420
|
+
}
|
|
2421
|
+
const ranges = [];
|
|
2422
|
+
for (const [min, max] of set) {
|
|
2423
|
+
if (min === max) {
|
|
2424
|
+
ranges.push(min);
|
|
2425
|
+
} else if (!max && min === v[0]) {
|
|
2426
|
+
ranges.push("*");
|
|
2427
|
+
} else if (!max) {
|
|
2428
|
+
ranges.push(`>=${min}`);
|
|
2429
|
+
} else if (min === v[0]) {
|
|
2430
|
+
ranges.push(`<=${max}`);
|
|
2431
|
+
} else {
|
|
2432
|
+
ranges.push(`${min} - ${max}`);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
const simplified = ranges.join(" || ");
|
|
2436
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
2437
|
+
return simplified.length < original.length ? simplified : range;
|
|
2438
|
+
};
|
|
2439
|
+
return simplify;
|
|
2440
|
+
}
|
|
2441
|
+
var subset_1;
|
|
2442
|
+
var hasRequiredSubset;
|
|
2443
|
+
function requireSubset() {
|
|
2444
|
+
if (hasRequiredSubset)
|
|
2445
|
+
return subset_1;
|
|
2446
|
+
hasRequiredSubset = 1;
|
|
2447
|
+
const Range = requireRange();
|
|
2448
|
+
const Comparator = requireComparator();
|
|
2449
|
+
const { ANY } = Comparator;
|
|
2450
|
+
const satisfies = requireSatisfies();
|
|
2451
|
+
const compare = requireCompare();
|
|
2452
|
+
const subset = (sub, dom, options = {}) => {
|
|
2453
|
+
if (sub === dom) {
|
|
2454
|
+
return true;
|
|
2455
|
+
}
|
|
2456
|
+
sub = new Range(sub, options);
|
|
2457
|
+
dom = new Range(dom, options);
|
|
2458
|
+
let sawNonNull = false;
|
|
2459
|
+
OUTER:
|
|
2460
|
+
for (const simpleSub of sub.set) {
|
|
2461
|
+
for (const simpleDom of dom.set) {
|
|
2462
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
2463
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
2464
|
+
if (isSub) {
|
|
2465
|
+
continue OUTER;
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
if (sawNonNull) {
|
|
2469
|
+
return false;
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
return true;
|
|
2473
|
+
};
|
|
2474
|
+
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
2475
|
+
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
2476
|
+
const simpleSubset = (sub, dom, options) => {
|
|
2477
|
+
if (sub === dom) {
|
|
2478
|
+
return true;
|
|
2479
|
+
}
|
|
2480
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2481
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2482
|
+
return true;
|
|
2483
|
+
} else if (options.includePrerelease) {
|
|
2484
|
+
sub = minimumVersionWithPreRelease;
|
|
2485
|
+
} else {
|
|
2486
|
+
sub = minimumVersion;
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2490
|
+
if (options.includePrerelease) {
|
|
2491
|
+
return true;
|
|
2492
|
+
} else {
|
|
2493
|
+
dom = minimumVersion;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
const eqSet = new Set;
|
|
2497
|
+
let gt, lt;
|
|
2498
|
+
for (const c of sub) {
|
|
2499
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
2500
|
+
gt = higherGT(gt, c, options);
|
|
2501
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
2502
|
+
lt = lowerLT(lt, c, options);
|
|
2503
|
+
} else {
|
|
2504
|
+
eqSet.add(c.semver);
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
if (eqSet.size > 1) {
|
|
2508
|
+
return null;
|
|
2509
|
+
}
|
|
2510
|
+
let gtltComp;
|
|
2511
|
+
if (gt && lt) {
|
|
2512
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
2513
|
+
if (gtltComp > 0) {
|
|
2514
|
+
return null;
|
|
2515
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
2516
|
+
return null;
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
for (const eq of eqSet) {
|
|
2520
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
2521
|
+
return null;
|
|
2522
|
+
}
|
|
2523
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
2524
|
+
return null;
|
|
2525
|
+
}
|
|
2526
|
+
for (const c of dom) {
|
|
2527
|
+
if (!satisfies(eq, String(c), options)) {
|
|
2528
|
+
return false;
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
return true;
|
|
2532
|
+
}
|
|
2533
|
+
let higher, lower;
|
|
2534
|
+
let hasDomLT, hasDomGT;
|
|
2535
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
2536
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
2537
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
2538
|
+
needDomLTPre = false;
|
|
2539
|
+
}
|
|
2540
|
+
for (const c of dom) {
|
|
2541
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
2542
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
2543
|
+
if (gt) {
|
|
2544
|
+
if (needDomGTPre) {
|
|
2545
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
2546
|
+
needDomGTPre = false;
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
2550
|
+
higher = higherGT(gt, c, options);
|
|
2551
|
+
if (higher === c && higher !== gt) {
|
|
2552
|
+
return false;
|
|
2553
|
+
}
|
|
2554
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
|
|
2555
|
+
return false;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
if (lt) {
|
|
2559
|
+
if (needDomLTPre) {
|
|
2560
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
2561
|
+
needDomLTPre = false;
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
2565
|
+
lower = lowerLT(lt, c, options);
|
|
2566
|
+
if (lower === c && lower !== lt) {
|
|
2567
|
+
return false;
|
|
2568
|
+
}
|
|
2569
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
|
|
2570
|
+
return false;
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
2574
|
+
return false;
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
2578
|
+
return false;
|
|
2579
|
+
}
|
|
2580
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
2581
|
+
return false;
|
|
2582
|
+
}
|
|
2583
|
+
if (needDomGTPre || needDomLTPre) {
|
|
2584
|
+
return false;
|
|
2585
|
+
}
|
|
2586
|
+
return true;
|
|
2587
|
+
};
|
|
2588
|
+
const higherGT = (a, b, options) => {
|
|
2589
|
+
if (!a) {
|
|
2590
|
+
return b;
|
|
2591
|
+
}
|
|
2592
|
+
const comp = compare(a.semver, b.semver, options);
|
|
2593
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2594
|
+
};
|
|
2595
|
+
const lowerLT = (a, b, options) => {
|
|
2596
|
+
if (!a) {
|
|
2597
|
+
return b;
|
|
2598
|
+
}
|
|
2599
|
+
const comp = compare(a.semver, b.semver, options);
|
|
2600
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2601
|
+
};
|
|
2602
|
+
subset_1 = subset;
|
|
2603
|
+
return subset_1;
|
|
2604
|
+
}
|
|
2605
|
+
var semver;
|
|
2606
|
+
var hasRequiredSemver;
|
|
2607
|
+
function requireSemver() {
|
|
2608
|
+
if (hasRequiredSemver)
|
|
2609
|
+
return semver;
|
|
2610
|
+
hasRequiredSemver = 1;
|
|
2611
|
+
const internalRe = requireRe();
|
|
2612
|
+
const constants = requireConstants();
|
|
2613
|
+
const SemVer = requireSemver$1();
|
|
2614
|
+
const identifiers = requireIdentifiers();
|
|
2615
|
+
const parse = requireParse();
|
|
2616
|
+
const valid = requireValid$1();
|
|
2617
|
+
const clean = requireClean();
|
|
2618
|
+
const inc = requireInc();
|
|
2619
|
+
const diff = requireDiff();
|
|
2620
|
+
const major = requireMajor();
|
|
2621
|
+
const minor = requireMinor();
|
|
2622
|
+
const patch = requirePatch();
|
|
2623
|
+
const prerelease = requirePrerelease();
|
|
2624
|
+
const compare = requireCompare();
|
|
2625
|
+
const rcompare = requireRcompare();
|
|
2626
|
+
const compareLoose = requireCompareLoose();
|
|
2627
|
+
const compareBuild = requireCompareBuild();
|
|
2628
|
+
const sort = requireSort();
|
|
2629
|
+
const rsort = requireRsort();
|
|
2630
|
+
const gt = requireGt();
|
|
2631
|
+
const lt = requireLt();
|
|
2632
|
+
const eq = requireEq();
|
|
2633
|
+
const neq = requireNeq();
|
|
2634
|
+
const gte = requireGte();
|
|
2635
|
+
const lte = requireLte();
|
|
2636
|
+
const cmp = requireCmp();
|
|
2637
|
+
const coerce = requireCoerce();
|
|
2638
|
+
const Comparator = requireComparator();
|
|
2639
|
+
const Range = requireRange();
|
|
2640
|
+
const satisfies = requireSatisfies();
|
|
2641
|
+
const toComparators = requireToComparators();
|
|
2642
|
+
const maxSatisfying = requireMaxSatisfying();
|
|
2643
|
+
const minSatisfying = requireMinSatisfying();
|
|
2644
|
+
const minVersion = requireMinVersion();
|
|
2645
|
+
const validRange = requireValid();
|
|
2646
|
+
const outside = requireOutside();
|
|
2647
|
+
const gtr = requireGtr();
|
|
2648
|
+
const ltr = requireLtr();
|
|
2649
|
+
const intersects = requireIntersects();
|
|
2650
|
+
const simplifyRange = requireSimplify();
|
|
2651
|
+
const subset = requireSubset();
|
|
2652
|
+
semver = {
|
|
2653
|
+
parse,
|
|
2654
|
+
valid,
|
|
2655
|
+
clean,
|
|
2656
|
+
inc,
|
|
2657
|
+
diff,
|
|
2658
|
+
major,
|
|
2659
|
+
minor,
|
|
2660
|
+
patch,
|
|
2661
|
+
prerelease,
|
|
2662
|
+
compare,
|
|
2663
|
+
rcompare,
|
|
2664
|
+
compareLoose,
|
|
2665
|
+
compareBuild,
|
|
2666
|
+
sort,
|
|
2667
|
+
rsort,
|
|
2668
|
+
gt,
|
|
2669
|
+
lt,
|
|
2670
|
+
eq,
|
|
2671
|
+
neq,
|
|
2672
|
+
gte,
|
|
2673
|
+
lte,
|
|
2674
|
+
cmp,
|
|
2675
|
+
coerce,
|
|
2676
|
+
Comparator,
|
|
2677
|
+
Range,
|
|
2678
|
+
satisfies,
|
|
2679
|
+
toComparators,
|
|
2680
|
+
maxSatisfying,
|
|
2681
|
+
minSatisfying,
|
|
2682
|
+
minVersion,
|
|
2683
|
+
validRange,
|
|
2684
|
+
outside,
|
|
2685
|
+
gtr,
|
|
2686
|
+
ltr,
|
|
2687
|
+
intersects,
|
|
2688
|
+
simplifyRange,
|
|
2689
|
+
subset,
|
|
2690
|
+
SemVer,
|
|
2691
|
+
re: internalRe.re,
|
|
2692
|
+
src: internalRe.src,
|
|
2693
|
+
tokens: internalRe.t,
|
|
2694
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
2695
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
2696
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
2697
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
2698
|
+
};
|
|
2699
|
+
return semver;
|
|
2700
|
+
}
|
|
2701
|
+
var semverExports = requireSemver();
|
|
2702
|
+
function isCompatible(required, provided) {
|
|
2703
|
+
for (const [name, range] of Object.entries(required)) {
|
|
2704
|
+
const version = provided[name];
|
|
2705
|
+
if (!version) {
|
|
2706
|
+
continue;
|
|
2707
|
+
}
|
|
2708
|
+
if (isSatisfied(range, version) === false) {
|
|
2709
|
+
return false;
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
return true;
|
|
2713
|
+
}
|
|
2714
|
+
function isSatisfied(range, version) {
|
|
2715
|
+
if (!semverExports.validRange(range)) {
|
|
2716
|
+
return null;
|
|
2717
|
+
}
|
|
2718
|
+
const coerced = semverExports.coerce(version);
|
|
2719
|
+
if (!coerced) {
|
|
2720
|
+
return null;
|
|
2721
|
+
}
|
|
2722
|
+
return semverExports.satisfies(coerced, range);
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
// ../../node_modules/@bpmn-io/feel-lint/dist/index.js
|
|
2726
|
+
function lintSyntax(syntaxTree) {
|
|
2727
|
+
const lintMessages = [];
|
|
2728
|
+
syntaxTree.iterate({
|
|
2729
|
+
enter: (ref) => {
|
|
2730
|
+
const node = ref.node;
|
|
2731
|
+
if (!node.type.isError) {
|
|
2732
|
+
return;
|
|
2733
|
+
}
|
|
2734
|
+
const parent = node.parent;
|
|
2735
|
+
const next = getNextNode(node);
|
|
2736
|
+
const message = {
|
|
2737
|
+
from: node.from,
|
|
2738
|
+
to: node.to,
|
|
2739
|
+
severity: "error",
|
|
2740
|
+
type: "Syntax Error"
|
|
2741
|
+
};
|
|
2742
|
+
if (node.from !== node.to) {
|
|
2743
|
+
message.message = `Unrecognized token in <${parent.name}>`;
|
|
2744
|
+
} else if (next) {
|
|
2745
|
+
message.message = `Unrecognized token <${next.name}> in <${parent.name}>`;
|
|
2746
|
+
message.to = next.to;
|
|
2747
|
+
} else {
|
|
2748
|
+
const before = parent.enterUnfinishedNodesBefore(node.to);
|
|
2749
|
+
message.message = `Incomplete <${(before || parent).name}>`;
|
|
2750
|
+
}
|
|
2751
|
+
lintMessages.push(message);
|
|
2752
|
+
}
|
|
2753
|
+
});
|
|
2754
|
+
return lintMessages;
|
|
2755
|
+
}
|
|
2756
|
+
function getNextNode(node) {
|
|
2757
|
+
if (!node) {
|
|
2758
|
+
return null;
|
|
2759
|
+
}
|
|
2760
|
+
return node.nextSibling || getNextNode(node.parent);
|
|
2761
|
+
}
|
|
2762
|
+
var RULE_NAME$1 = "first-item";
|
|
2763
|
+
var firstItem = {
|
|
2764
|
+
create(context) {
|
|
2765
|
+
return {
|
|
2766
|
+
enter(node) {
|
|
2767
|
+
if (node.name !== "FilterExpression") {
|
|
2768
|
+
return;
|
|
2769
|
+
}
|
|
2770
|
+
const content = context.readContent(node.from, node.to);
|
|
2771
|
+
if (zeroIndexPattern().test(content)) {
|
|
2772
|
+
const {
|
|
2773
|
+
from,
|
|
2774
|
+
to
|
|
2775
|
+
} = node;
|
|
2776
|
+
context.report({
|
|
2777
|
+
from,
|
|
2778
|
+
to,
|
|
2779
|
+
message: "First item is accessed via [1]",
|
|
2780
|
+
severity: "warning",
|
|
2781
|
+
type: RULE_NAME$1,
|
|
2782
|
+
actions: [
|
|
2783
|
+
{
|
|
2784
|
+
name: "fix",
|
|
2785
|
+
apply(_, start = from, end = to) {
|
|
2786
|
+
context.updateContent(start, end, content.replace(zeroIndexPattern(), "[1]"));
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
]
|
|
2790
|
+
});
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
};
|
|
2794
|
+
}
|
|
2795
|
+
};
|
|
2796
|
+
function zeroIndexPattern() {
|
|
2797
|
+
return /\[\s*0\s*\]$/;
|
|
2798
|
+
}
|
|
2799
|
+
var RULES = [
|
|
2800
|
+
firstItem
|
|
2801
|
+
];
|
|
2802
|
+
function lintRules(context) {
|
|
2803
|
+
const {
|
|
2804
|
+
readContent,
|
|
2805
|
+
syntaxTree,
|
|
2806
|
+
updateContent
|
|
2807
|
+
} = context;
|
|
2808
|
+
const lintMessages = [];
|
|
2809
|
+
const ruleContext = {
|
|
2810
|
+
readContent,
|
|
2811
|
+
report: (message) => {
|
|
2812
|
+
lintMessages.push(message);
|
|
2813
|
+
},
|
|
2814
|
+
updateContent
|
|
2815
|
+
};
|
|
2816
|
+
const rules = RULES.map((rule) => rule.create(ruleContext));
|
|
2817
|
+
syntaxTree.iterate({
|
|
2818
|
+
enter: (ref) => {
|
|
2819
|
+
for (const rule of rules) {
|
|
2820
|
+
rule.enter && rule.enter(ref);
|
|
2821
|
+
}
|
|
2822
|
+
},
|
|
2823
|
+
leave: (ref) => {
|
|
2824
|
+
for (const rule of rules) {
|
|
2825
|
+
rule.leave && rule.leave(ref);
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
});
|
|
2829
|
+
return lintMessages;
|
|
2830
|
+
}
|
|
2831
|
+
var RULE_NAME = "compatibility";
|
|
2832
|
+
function lintCompatibility(context = {}) {
|
|
2833
|
+
const {
|
|
2834
|
+
syntaxTree,
|
|
2835
|
+
expression,
|
|
2836
|
+
engines,
|
|
2837
|
+
builtins = []
|
|
2838
|
+
} = context;
|
|
2839
|
+
if (!engines || !Object.keys(engines).length || !builtins.length) {
|
|
2840
|
+
return [];
|
|
2841
|
+
}
|
|
2842
|
+
const unavailable = getUnavailableBuiltins(builtins, engines);
|
|
2843
|
+
if (!unavailable.size) {
|
|
2844
|
+
return [];
|
|
2845
|
+
}
|
|
2846
|
+
const analyzer = new FeelAnalyzer({ builtins });
|
|
2847
|
+
const { valid, functions = [] } = analyzer.analyzeTree(syntaxTree, expression);
|
|
2848
|
+
if (!valid) {
|
|
2849
|
+
return [];
|
|
2850
|
+
}
|
|
2851
|
+
return functions.reduce((messages, fn) => {
|
|
2852
|
+
if (fn.type !== "builtin") {
|
|
2853
|
+
return messages;
|
|
2854
|
+
}
|
|
2855
|
+
const builtin = unavailable.get(fn.name);
|
|
2856
|
+
if (!builtin) {
|
|
2857
|
+
return messages;
|
|
2858
|
+
}
|
|
2859
|
+
messages.push({
|
|
2860
|
+
from: fn.from,
|
|
2861
|
+
to: fn.to,
|
|
2862
|
+
severity: "warning",
|
|
2863
|
+
type: RULE_NAME,
|
|
2864
|
+
message: `Function '${fn.name}' requires ${formatEngines(builtin.engines)}`
|
|
2865
|
+
});
|
|
2866
|
+
return messages;
|
|
2867
|
+
}, []);
|
|
2868
|
+
}
|
|
2869
|
+
function getUnavailableBuiltins(builtins, engines) {
|
|
2870
|
+
const unavailable = new Map;
|
|
2871
|
+
for (const builtin of builtins) {
|
|
2872
|
+
if (builtin.engines && !isCompatible(builtin.engines, engines)) {
|
|
2873
|
+
unavailable.set(builtin.name, builtin);
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
return unavailable;
|
|
2877
|
+
}
|
|
2878
|
+
function formatEngines(engines) {
|
|
2879
|
+
return Object.entries(engines).map(([name, range]) => `${capitalize(name)} ${range}`).join(", ");
|
|
2880
|
+
}
|
|
2881
|
+
function capitalize(string) {
|
|
2882
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
2883
|
+
}
|
|
2884
|
+
function lintAll(context) {
|
|
2885
|
+
const lintMessages = [
|
|
2886
|
+
...lintSyntax(context.syntaxTree),
|
|
2887
|
+
...lintRules(context),
|
|
2888
|
+
...lintCompatibility(context)
|
|
2889
|
+
];
|
|
2890
|
+
return lintMessages;
|
|
2891
|
+
}
|
|
2892
|
+
function createContext2(variables) {
|
|
2893
|
+
return variables.slice().reverse().reduce((context, variable) => {
|
|
2894
|
+
context[variable.name] = () => {};
|
|
2895
|
+
return context;
|
|
2896
|
+
}, {});
|
|
2897
|
+
}
|
|
2898
|
+
function lintExpression(expression, {
|
|
2899
|
+
dialect = "expression",
|
|
2900
|
+
parserDialect,
|
|
2901
|
+
builtins = [],
|
|
2902
|
+
variables = [],
|
|
2903
|
+
engines
|
|
2904
|
+
} = {}) {
|
|
2905
|
+
const context = createContext2([...builtins, ...variables]);
|
|
2906
|
+
const syntaxTree = parser.configure({
|
|
2907
|
+
top: dialect === "unaryTests" ? "UnaryTests" : "Expression",
|
|
2908
|
+
dialect: parserDialect,
|
|
2909
|
+
contextTracker: trackVariables(context)
|
|
2910
|
+
}).parse(expression);
|
|
2911
|
+
const lintMessages = lintAll({
|
|
2912
|
+
syntaxTree,
|
|
2913
|
+
expression,
|
|
2914
|
+
builtins,
|
|
2915
|
+
engines,
|
|
2916
|
+
readContent: (from, to) => expression.slice(from, to),
|
|
2917
|
+
updateContent: (from, to, content) => {}
|
|
2918
|
+
});
|
|
2919
|
+
return lintMessages;
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
// ../../node_modules/@uipath/dmn-editor-utils/dist/validation/index.js
|
|
2923
|
+
var U2 = (i, e, t) => ({ name: i, ...e ? { detail: e } : {}, ...t?.length ? { entries: t.map((s) => U2(s.name, s.typeRef)) } : {} });
|
|
2924
|
+
var b2 = (i, e = []) => {
|
|
2925
|
+
let t = i.map((a) => U2(a.variableName ?? a.name, a.typeRef)), s = new Set(i.map((a) => a.variableName ?? a.name));
|
|
2926
|
+
for (let a of e)
|
|
2927
|
+
s.has(a.name) || (s.add(a.name), t.push(U2(a.name, a.typeRef, a.members)));
|
|
2928
|
+
return t;
|
|
2929
|
+
};
|
|
2930
|
+
var Te = ["error", "warning", "info"];
|
|
2931
|
+
var Ee = (i) => Te.includes(i) ? i : "info";
|
|
2932
|
+
var Ne = (i) => ({ from: i.from, to: i.to, severity: Ee(i.severity), message: i.message });
|
|
2933
|
+
var le = (i, e, t = []) => lintExpression(i, { dialect: e, variables: t }).map(Ne);
|
|
2934
|
+
var K = parser.configure({ top: "UnaryTests" });
|
|
2935
|
+
var ce = (i, e) => {
|
|
2936
|
+
let t = i.trim();
|
|
2937
|
+
return t === "" || e === "unaryTests" && t === "-";
|
|
2938
|
+
};
|
|
2939
|
+
var D2 = (i, e, t) => ce(i, e) ? [] : le(i, e, t).map((s) => s.severity === "error" ? { code: "DMN_FEEL_SYNTAX", severity: "error", messageKey: "validation_feel_syntax", messageParams: { message: s.message }, range: { from: s.from, to: s.to } } : { code: "DMN_FEEL_LINT", severity: "warning", messageKey: "validation_feel_lint", messageParams: { message: s.message }, range: { from: s.from, to: s.to } });
|
|
2940
|
+
var ve = { StringLiteral: "string", NumericLiteral: "number", BooleanLiteral: "boolean" };
|
|
2941
|
+
var he = { string: ["number", "boolean"], number: ["string", "boolean"], boolean: ["string", "number"] };
|
|
2942
|
+
var E2 = (i, e) => {
|
|
2943
|
+
let t = i.trim();
|
|
2944
|
+
if (!t)
|
|
2945
|
+
return;
|
|
2946
|
+
let s = (e === "unaryTests" ? K : parser).parse(t), a;
|
|
2947
|
+
return s.iterate({ enter(m) {
|
|
2948
|
+
m.from === 0 && m.to === t.length && (a = ve[m.name] ?? a);
|
|
2949
|
+
} }), a;
|
|
2950
|
+
};
|
|
2951
|
+
var I2 = (i, e) => !i || !e || !he[i].includes(r(e)) ? [] : [{ code: "DMN_TYPE_MISMATCH", severity: "error", messageKey: "validation_type_mismatch", messageParams: { literalType: i, columnType: e } }];
|
|
2952
|
+
var ue = (i) => {
|
|
2953
|
+
let e = K.parse(i.trim()).topNode, t = e.getChild("PositiveUnaryTests");
|
|
2954
|
+
return t && !e.getChild("not") ? t.getChildren("PositiveUnaryTest").length : 1;
|
|
2955
|
+
};
|
|
2956
|
+
var pe = (i, e) => {
|
|
2957
|
+
let t = e ? r(e) : "Any";
|
|
2958
|
+
if (t === "Any")
|
|
2959
|
+
return be(i);
|
|
2960
|
+
if (!w({ text: i }, t))
|
|
2961
|
+
return;
|
|
2962
|
+
let s = N(i);
|
|
2963
|
+
return new Set(t === "number" ? s.map(Number) : t === "boolean" ? s.map((a) => a === "true") : s);
|
|
2964
|
+
};
|
|
2965
|
+
var be = (i) => {
|
|
2966
|
+
let e = i.trim(), t = K.parse(e).topNode, s = t.getChild("PositiveUnaryTests");
|
|
2967
|
+
if (!s || t.getChild("not"))
|
|
2968
|
+
return;
|
|
2969
|
+
let a = new Set;
|
|
2970
|
+
for (let m of s.getChildren("PositiveUnaryTest")) {
|
|
2971
|
+
let o = e.slice(m.from, m.to), p = E2(o, "expression");
|
|
2972
|
+
if (!p)
|
|
2973
|
+
return;
|
|
2974
|
+
a.add(de(p, o));
|
|
2975
|
+
}
|
|
2976
|
+
return a;
|
|
2977
|
+
};
|
|
2978
|
+
var de = (i, e) => {
|
|
2979
|
+
let t = e.trim();
|
|
2980
|
+
return i === "number" ? Number(t.replace(/\s+/g, "")) : i === "string" ? N(t)[0] : t === "true";
|
|
2981
|
+
};
|
|
2982
|
+
var ge = (i, e, t) => t.has(de(i, e));
|
|
2983
|
+
var y2 = (i, e, t) => ce(i, e) ? [] : g2(i, e).filter((s) => !t.has(s.name)).map((s) => ({ code: "DMN_UNKNOWN_NAME", severity: "error", messageKey: "validation_unknown_name", messageParams: { name: s.name }, range: { from: s.from, to: s.to } }));
|
|
2984
|
+
var Ie = (i, e, t) => !t || !h2(t) || [e, t].some((s) => r(s) === "Any") ? true : D(i, e) ? false : !h2(e) || r(e) === r(t);
|
|
2985
|
+
var _e = (i) => {
|
|
2986
|
+
let e = i.trim();
|
|
2987
|
+
return e === "" || e === "-";
|
|
2988
|
+
};
|
|
2989
|
+
var Me = (i) => JSON.stringify(i.inputEntries.map((e) => _e(e.text) ? null : e.text.trim()));
|
|
2990
|
+
var Se = (i) => ({ kind: "row", ruleId: i });
|
|
2991
|
+
var xe = "string";
|
|
2992
|
+
var Le = (i, e) => e ? i.inputData.find((t) => (t.variableName ?? t.name) === e) ?? i.scopeVariables?.find((t) => t.name === e) : undefined;
|
|
2993
|
+
var V = (i) => {
|
|
2994
|
+
let e = i.decision.decisionTable, t = [], s = b2(i.inputData, i.scopeVariables), a = new Set(s.map((n) => n.name));
|
|
2995
|
+
if (i.decision.name.trim() || t.push({ code: "DMN_DECISION_NAME_MISSING", severity: "error", messageKey: "validation_decision_name_missing", target: { kind: "decision" } }), e.rules.length === 0 && t.push({ code: "DMN_NO_RULES", severity: "warning", messageKey: "validation_no_rules", target: { kind: "decision" } }), e.hitPolicy === "COLLECT" && e.aggregation)
|
|
2996
|
+
if (e.outputs.length !== 1)
|
|
2997
|
+
t.push({ code: "DMN_COLLECT_AGGREGATION_MULTIPLE_OUTPUTS", severity: "error", messageKey: "validation_collect_aggregation_multiple_outputs", messageParams: { aggregation: e.aggregation, count: e.outputs.length }, target: { kind: "decision" } });
|
|
2998
|
+
else {
|
|
2999
|
+
let n = d(i, e.outputs[0]);
|
|
3000
|
+
n && !I(i, e.aggregation, e.outputs[0]) && t.push({ code: "DMN_COLLECT_AGGREGATION_TYPE", severity: "error", messageKey: "validation_collect_aggregation_type", messageParams: { aggregation: e.aggregation, typeRef: n }, target: { kind: "decision" } });
|
|
3001
|
+
let r = i.decision.variableTypeRef;
|
|
3002
|
+
r && !Ie(i, r, g3(i, U(e, e.aggregation))) && t.push({ code: "DMN_AGGREGATION_RESULT_TYPE", severity: "warning", messageKey: "validation_aggregation_result_type", messageParams: { aggregation: e.aggregation, typeRef: r }, target: { kind: "decision" } });
|
|
3003
|
+
}
|
|
3004
|
+
if (O.has(e.hitPolicy)) {
|
|
3005
|
+
let n = e.outputs.flatMap((r) => L2(i, r) ?? []);
|
|
3006
|
+
n.length === 0 ? t.push({ code: "DMN_RANKED_OUTPUT_VALUES_MISSING", severity: "error", messageKey: "validation_ranked_output_values_missing", messageParams: { hitPolicy: e.hitPolicy }, target: { kind: "decision" } }) : n.every((r) => ue(r.text) < 2) && t.push({ code: "DMN_RANKED_OUTPUT_VALUES_SINGLE", severity: "warning", messageKey: "validation_ranked_output_values_single", messageParams: { hitPolicy: e.hitPolicy }, target: { kind: "decision" } });
|
|
3007
|
+
}
|
|
3008
|
+
let m = i.decision.variableTypeRef;
|
|
3009
|
+
P(e) === "list" && m && C(i, m) && t.push({ code: "DMN_LIST_RESULT_TYPE", severity: "error", messageKey: "validation_list_result_type", messageParams: { hitPolicy: e.hitPolicy, typeRef: m }, target: { kind: "decision" } });
|
|
3010
|
+
let o = new Map;
|
|
3011
|
+
e.outputs.forEach((n, r) => {
|
|
3012
|
+
let l = v(n, r);
|
|
3013
|
+
o.set(l, (o.get(l) ?? 0) + 1);
|
|
3014
|
+
}), e.inputs.forEach((n) => {
|
|
3015
|
+
let r = { kind: "input", inputId: n.id }, l = { ...r, field: "expression" };
|
|
3016
|
+
n.expressionText.trim() || t.push({ code: "DMN_INPUT_EXPRESSION_MISSING", severity: "error", messageKey: "validation_input_expression_missing", target: l }), t.push(...[...D2(n.expressionText, "expression", s), ...y2(n.expressionText, "expression", a)].map((d) => ({ ...d, target: l })));
|
|
3017
|
+
let c = Le(i, n.expressionText.trim()), u = g3(i, c?.typeRef), g = g3(i, n.typeRef) ?? xe;
|
|
3018
|
+
u !== undefined && u !== "Any" && ot.includes(u) && u !== g && t.push({ code: "DMN_COLUMN_TYPE_MISMATCH", severity: "error", messageKey: "validation_column_type_mismatch", messageParams: { name: n.expressionText.trim(), declared: u, column: g }, target: l }), n.allowedValues && (t.push(...D2(n.allowedValues.text, "unaryTests", s).map((d) => ({ ...d, target: r }))), t.push(...y2(n.allowedValues.text, "unaryTests", a).map((d) => ({ ...d, target: r }))));
|
|
3019
|
+
}), e.outputs.forEach((n, r) => {
|
|
3020
|
+
let l = { kind: "output", outputId: n.id }, c = v(n, r);
|
|
3021
|
+
(o.get(c) ?? 0) > 1 && t.push({ code: "DMN_DUPLICATE_OUTPUT_NAME", severity: "error", messageKey: "validation_duplicate_output_name", messageParams: { name: c }, target: l }), n.name?.trim() ? L(n.name.trim()) || t.push({ code: "DMN_OUTPUT_NAME_INVALID", severity: "error", messageKey: "validation_output_name_invalid", messageParams: { name: n.name.trim() }, target: l }) : e.outputs.length > 1 && t.push({ code: "DMN_OUTPUT_NAME_MISSING", severity: "error", messageKey: "validation_output_name_missing", target: l }), n.allowedValues && (t.push(...D2(n.allowedValues.text, "unaryTests", s).map((u) => ({ ...u, target: l }))), t.push(...y2(n.allowedValues.text, "unaryTests", a).map((u) => ({ ...u, target: l }))));
|
|
3022
|
+
});
|
|
3023
|
+
let p = i.decision.variableName ?? i.decision.name, N = new Set((i.scopeVariables ?? []).map((n) => n.name)), T = new Map;
|
|
3024
|
+
i.inputData.forEach((n) => {
|
|
3025
|
+
let r = n.variableName ?? n.name;
|
|
3026
|
+
T.set(r, (T.get(r) ?? 0) + 1);
|
|
3027
|
+
}), i.inputData.forEach((n) => {
|
|
3028
|
+
let r = n.variableName ?? n.name, l = { kind: "inputData", inputDataId: n.id };
|
|
3029
|
+
(T.get(r) ?? 0) > 1 || r === p ? t.push({ code: "DMN_DUPLICATE_INPUT_DATA_NAME", severity: "error", messageKey: "validation_duplicate_input_data_name", messageParams: { name: r }, target: l }) : N.has(r) && t.push({ code: "DMN_INPUT_DATA_SHADOWS_DECISION", severity: "error", messageKey: "validation_input_data_shadows_decision", messageParams: { name: r }, target: l }), r.trim() && !b(r.trim()) && t.push({ code: "DMN_INPUT_DATA_NAME_INVALID", severity: "error", messageKey: "validation_input_data_name_invalid", messageParams: { name: r.trim() }, target: l });
|
|
3030
|
+
});
|
|
3031
|
+
let fe = e.outputs.map((n) => {
|
|
3032
|
+
let r = L2(i, n);
|
|
3033
|
+
return r && pe(r.text, r.typeRef);
|
|
3034
|
+
}), F = e.outputs.map(() => 0), k = new Set, G = false;
|
|
3035
|
+
return e.rules.forEach((n) => {
|
|
3036
|
+
let r = Se(n.id);
|
|
3037
|
+
if ((n.inputEntries.length !== e.inputs.length || n.outputEntries.length !== e.outputs.length) && t.push({ code: "DMN_RULE_ENTRY_COUNT", severity: "error", messageKey: "validation_rule_entry_count", target: r }), e.hitPolicy === "FIRST" && (G ? t.push({ code: "DMN_UNREACHABLE_RULE", severity: "warning", messageKey: "validation_unreachable_rule", target: r }) : n.inputEntries.every((c) => _e(c.text)) && (G = true)), !y.has(e.hitPolicy)) {
|
|
3038
|
+
let c = Me(n);
|
|
3039
|
+
k.has(c) ? t.push({ code: "DMN_DUPLICATE_RULE", severity: "warning", messageKey: "validation_duplicate_rule", target: r }) : k.add(c);
|
|
3040
|
+
}
|
|
3041
|
+
let l = [{ entries: n.inputEntries, columns: e.inputs, dialect: "unaryTests" }, { entries: n.outputEntries, columns: e.outputs, dialect: "expression" }];
|
|
3042
|
+
for (let { entries: c, columns: u, dialect: g } of l)
|
|
3043
|
+
c.forEach((_, d) => {
|
|
3044
|
+
let v = u[d];
|
|
3045
|
+
if (!v)
|
|
3046
|
+
return;
|
|
3047
|
+
let Y = { kind: "cell", ruleId: n.id, columnId: v.id }, B = D2(_.text, g, s), M = g === "expression" && !B.some((x) => x.severity === "error") ? fe[d] : undefined, S = v.typeRef || M ? E2(_.text, g) : undefined, H = I2(S, v.typeRef), De = [...B, ...y2(_.text, g, a), ...H];
|
|
3048
|
+
t.push(...De.map((x) => ({ ...x, target: Y }))), !(!M || !_.text.trim()) && (S ? H.length === 0 && !ge(S, _.text, M) && t.push({ code: "DMN_OUTPUT_VALUE_NOT_ALLOWED", severity: "error", messageKey: "validation_output_value_not_allowed", messageParams: { value: _.text.trim() }, target: Y }) : F[d] += 1);
|
|
3049
|
+
});
|
|
3050
|
+
}), e.outputs.forEach((n, r) => {
|
|
3051
|
+
let l = F[r];
|
|
3052
|
+
l > 0 && t.push({ code: "DMN_OUTPUT_VALUE_UNCHECKED", severity: "warning", messageKey: "validation_output_value_unchecked", messageParams: { count: l }, target: { kind: "output", outputId: n.id } });
|
|
3053
|
+
}), t;
|
|
3054
|
+
};
|
|
3055
|
+
var C2 = (i) => {
|
|
3056
|
+
let { literalExpression: e } = i.decision, t = [], s = { kind: "decision" }, a = b2(i.inputData, i.scopeVariables);
|
|
3057
|
+
if (i.decision.name.trim() || t.push({ code: "DMN_DECISION_NAME_MISSING", severity: "error", messageKey: "validation_decision_name_missing", target: s }), !e.text.trim())
|
|
3058
|
+
return t.push({ code: "DMN_LITERAL_EXPRESSION_EMPTY", severity: "error", messageKey: "validation_literal_expression_empty", target: s }), t;
|
|
3059
|
+
e.typeRef || t.push({ code: "DMN_LITERAL_EXPRESSION_TYPE_MISSING", severity: "warning", messageKey: "validation_literal_expression_type_missing", target: s });
|
|
3060
|
+
let m = new Set(a.map((o) => o.name));
|
|
3061
|
+
return t.push(...[...D2(e.text, "expression", a), ...y2(e.text, "expression", m), ...I2(E2(e.text, "expression"), e.typeRef)].map((o) => ({ ...o, target: s }))), t;
|
|
3062
|
+
};
|
|
3063
|
+
var Ae = new Set(["invalid-xml", "unsafe-xml", "migration-failed", "unsupported-version"]);
|
|
3064
|
+
var Pe = (i) => Ae.has(i) ? { code: "DMN_DOCUMENT_UNREADABLE", severity: "error", messageKey: "validation_document_unreadable", target: { kind: "document" } } : null;
|
|
3065
|
+
var Re = (i) => {
|
|
3066
|
+
let e = i.definitions.drgElement ?? [], t = new Set(e.filter((o) => o.__$$element === "inputData").map(g)), s = new Set(e.filter((o) => o.__$$element === "decision").map(g)), a = (o, p) => {
|
|
3067
|
+
if (!o)
|
|
3068
|
+
return false;
|
|
3069
|
+
let N = o["@_href"], T = h(N);
|
|
3070
|
+
return T !== undefined ? !p.has(T) : !N;
|
|
3071
|
+
};
|
|
3072
|
+
return e.filter((o) => o.__$$element === "decision").some((o) => (o.informationRequirement ?? []).some((p) => a(p.requiredInput, t) || a(p.requiredDecision, s))) ? [{ code: "DMN_DANGLING_REQUIREMENT", severity: "error", messageKey: "validation_dangling_requirement", target: { kind: "document" } }] : [];
|
|
3073
|
+
};
|
|
3074
|
+
var we = async (i) => {
|
|
3075
|
+
let e = await bs(i);
|
|
3076
|
+
if (e.status === "error") {
|
|
3077
|
+
let a = Pe(e.reason);
|
|
3078
|
+
return a ? [a] : [];
|
|
3079
|
+
}
|
|
3080
|
+
let t = Re(e.document);
|
|
3081
|
+
if (t.length > 0)
|
|
3082
|
+
return t;
|
|
3083
|
+
if (R(e.document.definitions).length === 1) {
|
|
3084
|
+
let a = await Xn(i);
|
|
3085
|
+
if (a.kind === "decision-table")
|
|
3086
|
+
return t.push(...V(a.model)), t;
|
|
3087
|
+
}
|
|
3088
|
+
let s = zt(e.document);
|
|
3089
|
+
return s && t.push(...C2(s)), t;
|
|
3090
|
+
};
|
|
3091
|
+
export {
|
|
3092
|
+
we as validateDmnDocument
|
|
3093
|
+
};
|
|
3094
|
+
|
|
3095
|
+
//# debugId=51DC7634CE1651E864756E2164756E21
|