@uipath/rules-tool 1.205.0-preview.281 → 1.206.0-preview.282
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/dist/DmnFactory-L7MABUC6-q2sr3grz.js +10 -0
- package/dist/DmnModelTypes-ATR7FVKZ-h8srwcxk.js +8 -0
- package/dist/KieDmnMarshaller-LGE63WDG-nfkpv8f4.js +8 -0
- package/dist/THIRD-PARTY-NOTICES.md +4 -4
- package/dist/business-rules-z2zw35qd.js +25 -0
- package/dist/{constants-cnn0jfw6.js → constants-1sdwfz26.js} +7 -15
- package/dist/{embedded-file-reader-z4becc02.js → embedded-file-reader-0228j82a.js} +1 -4
- package/dist/first-party-service-hegqxm82.js +8 -0
- package/dist/hitPolicyResult-CGCR73CW-jz89f1aa.js +12 -0
- package/dist/index-4a4x1ygg.js +24 -0
- package/dist/{index-52h8rpew.js → index-egzwtc07.js} +2 -4
- package/dist/{index-sby22td6.js → index-nzr4mx5p.js} +2 -22
- package/dist/index-xaxgkfez.js +23 -0
- package/dist/{tool-tjcg2xje.js → index-y5yffb2s.js} +3525 -236
- package/dist/index-z4kt2kt6.js +8 -0
- package/dist/{index-bhjt1h5c.js → index-zeszs1ra.js} +23 -66
- package/dist/index.js +8 -9
- package/dist/{jmespath-231m3hyn.js → jmespath-ab6tdc42.js} +1 -1
- package/dist/{js-yaml-88tdqrtd.js → js-yaml-a2bk27p6.js} +1 -3
- package/dist/rule-catalog-5qnmp0xp.js +71 -0
- package/dist/rules-command-error-30c8a3n9.js +13 -0
- package/dist/{rules-debug-service-02zf7t4e.js → rules-debug-service-jf46j5g6.js} +37 -38
- package/dist/{rules-init-service-f990fgeb.js → rules-init-service-skes439c.js} +12 -16
- package/dist/{rules-refresh-service-jn6my893.js → rules-refresh-service-18hrs394.js} +13 -14
- package/dist/{rules-validate-service-hfw8m3dm.js → rules-validate-service-s787ehrr.js} +10 -13
- package/dist/{tool-f04pwp3c.js → tool-5exp6zh7.js} +659 -14
- package/dist/{tool-fk8rznma.js → tool-89e90qrm.js} +173 -223
- package/dist/{tool-fbxe48wd.js → tool-8cnhz30a.js} +13991 -15184
- package/dist/{tool-h7gn1rar.js → tool-93hqhaj3.js} +402 -417
- package/dist/{tool-wf2qkrye.js → tool-cs8nyk0r.js} +990 -514
- package/dist/{tool-txp5th7j.js → tool-e23cj2jx.js} +127 -42
- package/dist/{tool-1de529jm.js → tool-epsr41wx.js} +12 -3
- package/dist/{tool-gkbr01gc.js → tool-fkppxa9f.js} +14 -17
- package/dist/{tool-5hek0atf.js → tool-k55fs9aj.js} +32 -34
- package/dist/{tool-86f1xpxn.js → tool-m59a481n.js} +18 -20
- package/dist/tool-mst6a4dr.js +73 -0
- package/dist/{tool-t4k013ex.js → tool-njnhj05q.js} +8 -8
- package/dist/tool-p7hqn93n.js +455 -0
- package/dist/{tool-z1ay3csx.js → tool-sbtf80ft.js} +66 -24
- package/dist/{tool-yq5jph4h.js → tool-vqm4apm6.js} +207 -216
- package/dist/tool.js +7 -8
- package/package.json +2 -2
- package/dist/DmnFactory-L7MABUC6-98k17dkr.js +0 -46
- package/dist/DmnModelTypes-ATR7FVKZ-jp35cecy.js +0 -18
- package/dist/KieDmnMarshaller-LGE63WDG-3vemswef.js +0 -20
- package/dist/business-rules-pm96sefm.js +0 -26
- package/dist/first-party-service-sd8yaf73.js +0 -27
- package/dist/hitPolicyResult-CGCR73CW-9bmc4nsr.js +0 -36
- package/dist/index-cpm94vee.js +0 -132
- package/dist/index-dqa169gp.js +0 -25
- package/dist/index-x9msn1dj.js +0 -85
- package/dist/index-ybrgtfsg.js +0 -3326
- package/dist/rule-catalog-10fhgevc.js +0 -74
- package/dist/rules-command-error-k6kxwfn7.js +0 -14
- package/dist/tool-1pccj6q3.js +0 -1116
- package/dist/tool-53w8skv5.js +0 -262
- package/dist/tool-7haj67tr.js +0 -19
- package/dist/tool-fbmxx07c.js +0 -73
- package/dist/tool-gdtpsdn7.js +0 -342
- package/dist/tool-jd313s2x.js +0 -10
- package/dist/tool-qgqscsjc.js +0 -46
- /package/dist/{tool-cfrcyxgm.js → tool-2nmqvfmt.js} +0 -0
|
@@ -1,12 +1,59 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
trackVariables,
|
|
3
|
+
parser,
|
|
3
4
|
c,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
oe,
|
|
6
|
+
ae,
|
|
7
|
+
b,
|
|
8
|
+
me,
|
|
9
|
+
h,
|
|
10
|
+
xe,
|
|
11
|
+
J,
|
|
12
|
+
ee,
|
|
13
|
+
_e,
|
|
14
|
+
te,
|
|
15
|
+
ne
|
|
16
|
+
} from "./tool-vqm4apm6.js";
|
|
17
|
+
import {
|
|
18
|
+
bs
|
|
19
|
+
} from "./tool-93hqhaj3.js";
|
|
20
|
+
import {
|
|
21
|
+
l
|
|
22
|
+
} from "./tool-2nmqvfmt.js";
|
|
7
23
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
24
|
+
fe,
|
|
25
|
+
w,
|
|
26
|
+
g,
|
|
27
|
+
$,
|
|
28
|
+
At,
|
|
29
|
+
Ui
|
|
30
|
+
} from "./tool-89e90qrm.js";
|
|
31
|
+
import {
|
|
32
|
+
f,
|
|
33
|
+
m3,
|
|
34
|
+
O,
|
|
35
|
+
C,
|
|
36
|
+
p,
|
|
37
|
+
T,
|
|
38
|
+
g2,
|
|
39
|
+
x,
|
|
40
|
+
u,
|
|
41
|
+
E2,
|
|
42
|
+
A,
|
|
43
|
+
S
|
|
44
|
+
} from "./tool-m59a481n.js";
|
|
45
|
+
import {
|
|
46
|
+
e,
|
|
47
|
+
r,
|
|
48
|
+
R2,
|
|
49
|
+
z,
|
|
50
|
+
B,
|
|
51
|
+
U,
|
|
52
|
+
K,
|
|
53
|
+
Q,
|
|
54
|
+
G,
|
|
55
|
+
J2
|
|
56
|
+
} from "./tool-sbtf80ft.js";
|
|
10
57
|
|
|
11
58
|
// ../../node_modules/luxon/build/es6/luxon.mjs
|
|
12
59
|
class LuxonError extends Error {
|
|
@@ -49,7 +96,7 @@ class ZoneIsAbstractError extends LuxonError {
|
|
|
49
96
|
}
|
|
50
97
|
var n = "numeric";
|
|
51
98
|
var s = "short";
|
|
52
|
-
var
|
|
99
|
+
var l2 = "long";
|
|
53
100
|
var DATE_SHORT = {
|
|
54
101
|
year: n,
|
|
55
102
|
month: n,
|
|
@@ -68,14 +115,14 @@ var DATE_MED_WITH_WEEKDAY = {
|
|
|
68
115
|
};
|
|
69
116
|
var DATE_FULL = {
|
|
70
117
|
year: n,
|
|
71
|
-
month:
|
|
118
|
+
month: l2,
|
|
72
119
|
day: n
|
|
73
120
|
};
|
|
74
121
|
var DATE_HUGE = {
|
|
75
122
|
year: n,
|
|
76
|
-
month:
|
|
123
|
+
month: l2,
|
|
77
124
|
day: n,
|
|
78
|
-
weekday:
|
|
125
|
+
weekday: l2
|
|
79
126
|
};
|
|
80
127
|
var TIME_SIMPLE = {
|
|
81
128
|
hour: n,
|
|
@@ -96,7 +143,7 @@ var TIME_WITH_LONG_OFFSET = {
|
|
|
96
143
|
hour: n,
|
|
97
144
|
minute: n,
|
|
98
145
|
second: n,
|
|
99
|
-
timeZoneName:
|
|
146
|
+
timeZoneName: l2
|
|
100
147
|
};
|
|
101
148
|
var TIME_24_SIMPLE = {
|
|
102
149
|
hour: n,
|
|
@@ -121,7 +168,7 @@ var TIME_24_WITH_LONG_OFFSET = {
|
|
|
121
168
|
minute: n,
|
|
122
169
|
second: n,
|
|
123
170
|
hourCycle: "h23",
|
|
124
|
-
timeZoneName:
|
|
171
|
+
timeZoneName: l2
|
|
125
172
|
};
|
|
126
173
|
var DATETIME_SHORT = {
|
|
127
174
|
year: n,
|
|
@@ -163,7 +210,7 @@ var DATETIME_MED_WITH_WEEKDAY = {
|
|
|
163
210
|
};
|
|
164
211
|
var DATETIME_FULL = {
|
|
165
212
|
year: n,
|
|
166
|
-
month:
|
|
213
|
+
month: l2,
|
|
167
214
|
day: n,
|
|
168
215
|
hour: n,
|
|
169
216
|
minute: n,
|
|
@@ -171,7 +218,7 @@ var DATETIME_FULL = {
|
|
|
171
218
|
};
|
|
172
219
|
var DATETIME_FULL_WITH_SECONDS = {
|
|
173
220
|
year: n,
|
|
174
|
-
month:
|
|
221
|
+
month: l2,
|
|
175
222
|
day: n,
|
|
176
223
|
hour: n,
|
|
177
224
|
minute: n,
|
|
@@ -180,22 +227,22 @@ var DATETIME_FULL_WITH_SECONDS = {
|
|
|
180
227
|
};
|
|
181
228
|
var DATETIME_HUGE = {
|
|
182
229
|
year: n,
|
|
183
|
-
month:
|
|
230
|
+
month: l2,
|
|
184
231
|
day: n,
|
|
185
|
-
weekday:
|
|
232
|
+
weekday: l2,
|
|
186
233
|
hour: n,
|
|
187
234
|
minute: n,
|
|
188
|
-
timeZoneName:
|
|
235
|
+
timeZoneName: l2
|
|
189
236
|
};
|
|
190
237
|
var DATETIME_HUGE_WITH_SECONDS = {
|
|
191
238
|
year: n,
|
|
192
|
-
month:
|
|
239
|
+
month: l2,
|
|
193
240
|
day: n,
|
|
194
|
-
weekday:
|
|
241
|
+
weekday: l2,
|
|
195
242
|
hour: n,
|
|
196
243
|
minute: n,
|
|
197
244
|
second: n,
|
|
198
|
-
timeZoneName:
|
|
245
|
+
timeZoneName: l2
|
|
199
246
|
};
|
|
200
247
|
|
|
201
248
|
class Zone {
|
|
@@ -321,8 +368,8 @@ class IANAZone extends Zone {
|
|
|
321
368
|
ianaZoneCache.clear();
|
|
322
369
|
dtfCache.clear();
|
|
323
370
|
}
|
|
324
|
-
static isValidSpecifier(
|
|
325
|
-
return this.isValidZone(
|
|
371
|
+
static isValidSpecifier(s) {
|
|
372
|
+
return this.isValidZone(s);
|
|
326
373
|
}
|
|
327
374
|
static isValidZone(zone) {
|
|
328
375
|
if (!zone) {
|
|
@@ -803,9 +850,9 @@ class FixedOffsetZone extends Zone {
|
|
|
803
850
|
static instance(offset) {
|
|
804
851
|
return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);
|
|
805
852
|
}
|
|
806
|
-
static parseSpecifier(
|
|
807
|
-
if (
|
|
808
|
-
const r =
|
|
853
|
+
static parseSpecifier(s) {
|
|
854
|
+
if (s) {
|
|
855
|
+
const r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
|
|
809
856
|
if (r) {
|
|
810
857
|
return new FixedOffsetZone(signedOffset(r[1], r[2]));
|
|
811
858
|
}
|
|
@@ -1000,8 +1047,8 @@ class Settings {
|
|
|
1000
1047
|
static get now() {
|
|
1001
1048
|
return now;
|
|
1002
1049
|
}
|
|
1003
|
-
static set now(
|
|
1004
|
-
now =
|
|
1050
|
+
static set now(n) {
|
|
1051
|
+
now = n;
|
|
1005
1052
|
}
|
|
1006
1053
|
static set defaultZone(zone) {
|
|
1007
1054
|
defaultZone = zone;
|
|
@@ -1272,16 +1319,16 @@ function validateWeekSettings(settings) {
|
|
|
1272
1319
|
function integerBetween(thing, bottom, top) {
|
|
1273
1320
|
return isInteger(thing) && thing >= bottom && thing <= top;
|
|
1274
1321
|
}
|
|
1275
|
-
function floorMod(x,
|
|
1276
|
-
return x -
|
|
1322
|
+
function floorMod(x, n) {
|
|
1323
|
+
return x - n * Math.floor(x / n);
|
|
1277
1324
|
}
|
|
1278
|
-
function padStart(input,
|
|
1325
|
+
function padStart(input, n = 2) {
|
|
1279
1326
|
const isNeg = input < 0;
|
|
1280
1327
|
let padded;
|
|
1281
1328
|
if (isNeg) {
|
|
1282
|
-
padded = "-" + ("" + -input).padStart(
|
|
1329
|
+
padded = "-" + ("" + -input).padStart(n, "0");
|
|
1283
1330
|
} else {
|
|
1284
|
-
padded = ("" + input).padStart(
|
|
1331
|
+
padded = ("" + input).padStart(n, "0");
|
|
1285
1332
|
}
|
|
1286
1333
|
return padded;
|
|
1287
1334
|
}
|
|
@@ -1544,15 +1591,15 @@ function formatRelativeTime(unit, count, numeric = "always", narrow = false) {
|
|
|
1544
1591
|
return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;
|
|
1545
1592
|
}
|
|
1546
1593
|
function stringifyTokens(splits, tokenToString) {
|
|
1547
|
-
let
|
|
1594
|
+
let s = "";
|
|
1548
1595
|
for (const token of splits) {
|
|
1549
1596
|
if (token.literal) {
|
|
1550
|
-
|
|
1597
|
+
s += token.val;
|
|
1551
1598
|
} else {
|
|
1552
|
-
|
|
1599
|
+
s += tokenToString(token.val);
|
|
1553
1600
|
}
|
|
1554
1601
|
}
|
|
1555
|
-
return
|
|
1602
|
+
return s;
|
|
1556
1603
|
}
|
|
1557
1604
|
var macroTokenToFormatOpts = {
|
|
1558
1605
|
D: DATE_SHORT,
|
|
@@ -1585,8 +1632,8 @@ class Formatter {
|
|
|
1585
1632
|
let current = null, currentFull = "", bracketed = false;
|
|
1586
1633
|
const splits = [];
|
|
1587
1634
|
for (let i = 0;i < fmt.length; i++) {
|
|
1588
|
-
const
|
|
1589
|
-
if (
|
|
1635
|
+
const c = fmt.charAt(i);
|
|
1636
|
+
if (c === "'") {
|
|
1590
1637
|
if (currentFull.length > 0 || bracketed) {
|
|
1591
1638
|
splits.push({
|
|
1592
1639
|
literal: bracketed || /^\s+$/.test(currentFull),
|
|
@@ -1597,15 +1644,15 @@ class Formatter {
|
|
|
1597
1644
|
currentFull = "";
|
|
1598
1645
|
bracketed = !bracketed;
|
|
1599
1646
|
} else if (bracketed) {
|
|
1600
|
-
currentFull +=
|
|
1601
|
-
} else if (
|
|
1602
|
-
currentFull +=
|
|
1647
|
+
currentFull += c;
|
|
1648
|
+
} else if (c === current) {
|
|
1649
|
+
currentFull += c;
|
|
1603
1650
|
} else {
|
|
1604
1651
|
if (currentFull.length > 0) {
|
|
1605
1652
|
splits.push({ literal: /^\s+$/.test(currentFull), val: currentFull });
|
|
1606
1653
|
}
|
|
1607
|
-
currentFull =
|
|
1608
|
-
current =
|
|
1654
|
+
currentFull = c;
|
|
1655
|
+
current = c;
|
|
1609
1656
|
}
|
|
1610
1657
|
}
|
|
1611
1658
|
if (currentFull.length > 0) {
|
|
@@ -1644,9 +1691,9 @@ class Formatter {
|
|
|
1644
1691
|
resolvedOptions(dt, opts) {
|
|
1645
1692
|
return this.dtFormatter(dt, opts).resolvedOptions();
|
|
1646
1693
|
}
|
|
1647
|
-
num(
|
|
1694
|
+
num(n, p = 0, signDisplay = undefined) {
|
|
1648
1695
|
if (this.opts.forceSimple) {
|
|
1649
|
-
return padStart(
|
|
1696
|
+
return padStart(n, p);
|
|
1650
1697
|
}
|
|
1651
1698
|
const opts = { ...this.opts };
|
|
1652
1699
|
if (p > 0) {
|
|
@@ -1655,10 +1702,10 @@ class Formatter {
|
|
|
1655
1702
|
if (signDisplay) {
|
|
1656
1703
|
opts.signDisplay = signDisplay;
|
|
1657
1704
|
}
|
|
1658
|
-
return this.loc.numberFormatter(opts).format(
|
|
1705
|
+
return this.loc.numberFormatter(opts).format(n);
|
|
1659
1706
|
}
|
|
1660
1707
|
formatDateTimeFromString(dt, fmt) {
|
|
1661
|
-
const knownEnglish = this.loc.listingMode() === "en", useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", string = (opts, extract) => this.loc.extract(dt, opts, extract),
|
|
1708
|
+
const knownEnglish = this.loc.listingMode() === "en", useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", string = (opts, extract) => this.loc.extract(dt, opts, extract), formatOffset = (opts) => {
|
|
1662
1709
|
if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {
|
|
1663
1710
|
return "Z";
|
|
1664
1711
|
}
|
|
@@ -1698,11 +1745,11 @@ class Formatter {
|
|
|
1698
1745
|
case "HH":
|
|
1699
1746
|
return this.num(dt.hour, 2);
|
|
1700
1747
|
case "Z":
|
|
1701
|
-
return
|
|
1748
|
+
return formatOffset({ format: "narrow", allowZ: this.opts.allowZ });
|
|
1702
1749
|
case "ZZ":
|
|
1703
|
-
return
|
|
1750
|
+
return formatOffset({ format: "short", allowZ: this.opts.allowZ });
|
|
1704
1751
|
case "ZZZ":
|
|
1705
|
-
return
|
|
1752
|
+
return formatOffset({ format: "techie", allowZ: this.opts.allowZ });
|
|
1706
1753
|
case "ZZZZ":
|
|
1707
1754
|
return dt.zone.offsetName(dt.ts, { format: "short", locale: this.loc.locale });
|
|
1708
1755
|
case "ZZZZZ":
|
|
@@ -1856,12 +1903,12 @@ function combineExtractors(...extractors) {
|
|
|
1856
1903
|
return [{ ...mergedVals, ...val }, zone || mergedZone, next];
|
|
1857
1904
|
}, [{}, null, 1]).slice(0, 2);
|
|
1858
1905
|
}
|
|
1859
|
-
function parse(
|
|
1860
|
-
if (
|
|
1906
|
+
function parse(s, ...patterns) {
|
|
1907
|
+
if (s == null) {
|
|
1861
1908
|
return [null, null];
|
|
1862
1909
|
}
|
|
1863
1910
|
for (const [regex, extractor] of patterns) {
|
|
1864
|
-
const m = regex.exec(
|
|
1911
|
+
const m = regex.exec(s);
|
|
1865
1912
|
if (m) {
|
|
1866
1913
|
return extractor(m);
|
|
1867
1914
|
}
|
|
@@ -1923,8 +1970,8 @@ function extractIANAZone(match, cursor) {
|
|
|
1923
1970
|
var isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);
|
|
1924
1971
|
var isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
|
|
1925
1972
|
function extractISODuration(match) {
|
|
1926
|
-
const [
|
|
1927
|
-
const hasNegativePrefix =
|
|
1973
|
+
const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match;
|
|
1974
|
+
const hasNegativePrefix = s[0] === "-";
|
|
1928
1975
|
const negativeSeconds = secondStr && secondStr[0] === "-";
|
|
1929
1976
|
const maybeNegate = (num, force = false) => num !== undefined && (force || num && hasNegativePrefix) ? -num : num;
|
|
1930
1977
|
return [
|
|
@@ -1992,8 +2039,8 @@ function extractRFC2822(match) {
|
|
|
1992
2039
|
}
|
|
1993
2040
|
return [result, new FixedOffsetZone(offset)];
|
|
1994
2041
|
}
|
|
1995
|
-
function preprocessRFC2822(
|
|
1996
|
-
return
|
|
2042
|
+
function preprocessRFC2822(s) {
|
|
2043
|
+
return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
|
|
1997
2044
|
}
|
|
1998
2045
|
var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/;
|
|
1999
2046
|
var rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/;
|
|
@@ -2014,27 +2061,27 @@ var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime
|
|
|
2014
2061
|
var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone);
|
|
2015
2062
|
var extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone);
|
|
2016
2063
|
var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
|
|
2017
|
-
function parseISODate(
|
|
2018
|
-
return parse(
|
|
2064
|
+
function parseISODate(s) {
|
|
2065
|
+
return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]);
|
|
2019
2066
|
}
|
|
2020
|
-
function parseRFC2822Date(
|
|
2021
|
-
return parse(preprocessRFC2822(
|
|
2067
|
+
function parseRFC2822Date(s) {
|
|
2068
|
+
return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);
|
|
2022
2069
|
}
|
|
2023
|
-
function parseHTTPDate(
|
|
2024
|
-
return parse(
|
|
2070
|
+
function parseHTTPDate(s) {
|
|
2071
|
+
return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]);
|
|
2025
2072
|
}
|
|
2026
|
-
function parseISODuration(
|
|
2027
|
-
return parse(
|
|
2073
|
+
function parseISODuration(s) {
|
|
2074
|
+
return parse(s, [isoDuration, extractISODuration]);
|
|
2028
2075
|
}
|
|
2029
2076
|
var extractISOTimeOnly = combineExtractors(extractISOTime);
|
|
2030
|
-
function parseISOTimeOnly(
|
|
2031
|
-
return parse(
|
|
2077
|
+
function parseISOTimeOnly(s) {
|
|
2078
|
+
return parse(s, [isoTimeOnly, extractISOTimeOnly]);
|
|
2032
2079
|
}
|
|
2033
2080
|
var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
|
|
2034
2081
|
var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
|
|
2035
2082
|
var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
|
|
2036
|
-
function parseSQL(
|
|
2037
|
-
return parse(
|
|
2083
|
+
function parseSQL(s) {
|
|
2084
|
+
return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]);
|
|
2038
2085
|
}
|
|
2039
2086
|
var INVALID$2 = "Invalid Duration";
|
|
2040
2087
|
var lowOrderMatrix = {
|
|
@@ -2297,14 +2344,14 @@ class Duration {
|
|
|
2297
2344
|
if (!this.isValid)
|
|
2298
2345
|
return INVALID$2;
|
|
2299
2346
|
const showZeros = opts.showZeros !== false;
|
|
2300
|
-
const
|
|
2347
|
+
const l = orderedUnits$1.map((unit) => {
|
|
2301
2348
|
const val = this.values[unit];
|
|
2302
2349
|
if (isUndefined(val) || val === 0 && !showZeros) {
|
|
2303
2350
|
return null;
|
|
2304
2351
|
}
|
|
2305
2352
|
return this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...opts, unit: unit.slice(0, -1) }).format(val);
|
|
2306
|
-
}).filter((
|
|
2307
|
-
return this.loc.listFormatter({ type: "conjunction", style: opts.listStyle || "narrow", ...opts }).format(
|
|
2353
|
+
}).filter((n) => n);
|
|
2354
|
+
return this.loc.listFormatter({ type: "conjunction", style: opts.listStyle || "narrow", ...opts }).format(l);
|
|
2308
2355
|
}
|
|
2309
2356
|
toObject() {
|
|
2310
2357
|
if (!this.isValid)
|
|
@@ -2314,26 +2361,26 @@ class Duration {
|
|
|
2314
2361
|
toISO() {
|
|
2315
2362
|
if (!this.isValid)
|
|
2316
2363
|
return null;
|
|
2317
|
-
let
|
|
2364
|
+
let s = "P";
|
|
2318
2365
|
if (this.years !== 0)
|
|
2319
|
-
|
|
2366
|
+
s += this.years + "Y";
|
|
2320
2367
|
if (this.months !== 0 || this.quarters !== 0)
|
|
2321
|
-
|
|
2368
|
+
s += this.months + this.quarters * 3 + "M";
|
|
2322
2369
|
if (this.weeks !== 0)
|
|
2323
|
-
|
|
2370
|
+
s += this.weeks + "W";
|
|
2324
2371
|
if (this.days !== 0)
|
|
2325
|
-
|
|
2372
|
+
s += this.days + "D";
|
|
2326
2373
|
if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)
|
|
2327
|
-
|
|
2374
|
+
s += "T";
|
|
2328
2375
|
if (this.hours !== 0)
|
|
2329
|
-
|
|
2376
|
+
s += this.hours + "H";
|
|
2330
2377
|
if (this.minutes !== 0)
|
|
2331
|
-
|
|
2378
|
+
s += this.minutes + "M";
|
|
2332
2379
|
if (this.seconds !== 0 || this.milliseconds !== 0)
|
|
2333
|
-
|
|
2334
|
-
if (
|
|
2335
|
-
|
|
2336
|
-
return
|
|
2380
|
+
s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S";
|
|
2381
|
+
if (s === "P")
|
|
2382
|
+
s += "T0S";
|
|
2383
|
+
return s;
|
|
2337
2384
|
}
|
|
2338
2385
|
toISOTime(opts = {}) {
|
|
2339
2386
|
if (!this.isValid)
|
|
@@ -2592,20 +2639,20 @@ class Interval {
|
|
|
2592
2639
|
return Interval.fromDateTimes(dt.minus(dur), dt);
|
|
2593
2640
|
}
|
|
2594
2641
|
static fromISO(text, opts) {
|
|
2595
|
-
const [
|
|
2596
|
-
if (
|
|
2642
|
+
const [s, e] = (text || "").split("/", 2);
|
|
2643
|
+
if (s && e) {
|
|
2597
2644
|
let start, startIsValid;
|
|
2598
2645
|
try {
|
|
2599
|
-
start = DateTime.fromISO(
|
|
2646
|
+
start = DateTime.fromISO(s, opts);
|
|
2600
2647
|
startIsValid = start.isValid;
|
|
2601
|
-
} catch (
|
|
2648
|
+
} catch (e) {
|
|
2602
2649
|
startIsValid = false;
|
|
2603
2650
|
}
|
|
2604
2651
|
let end, endIsValid;
|
|
2605
2652
|
try {
|
|
2606
2653
|
end = DateTime.fromISO(e, opts);
|
|
2607
2654
|
endIsValid = end.isValid;
|
|
2608
|
-
} catch (
|
|
2655
|
+
} catch (e) {
|
|
2609
2656
|
endIsValid = false;
|
|
2610
2657
|
}
|
|
2611
2658
|
if (startIsValid && endIsValid) {
|
|
@@ -2617,7 +2664,7 @@ class Interval {
|
|
|
2617
2664
|
return Interval.after(start, dur);
|
|
2618
2665
|
}
|
|
2619
2666
|
} else if (endIsValid) {
|
|
2620
|
-
const dur = Duration.fromISO(
|
|
2667
|
+
const dur = Duration.fromISO(s, opts);
|
|
2621
2668
|
if (dur.isValid) {
|
|
2622
2669
|
return Interval.before(end, dur);
|
|
2623
2670
|
}
|
|
@@ -2692,11 +2739,11 @@ class Interval {
|
|
|
2692
2739
|
if (!this.isValid)
|
|
2693
2740
|
return [];
|
|
2694
2741
|
const sorted = dateTimes.map(friendlyDateTime).filter((d) => this.contains(d)).sort((a, b) => a.toMillis() - b.toMillis()), results = [];
|
|
2695
|
-
let { s
|
|
2696
|
-
while (
|
|
2742
|
+
let { s } = this, i = 0;
|
|
2743
|
+
while (s < this.e) {
|
|
2697
2744
|
const added = sorted[i] || this.e, next = +added > +this.e ? this.e : added;
|
|
2698
|
-
results.push(Interval.fromDateTimes(
|
|
2699
|
-
|
|
2745
|
+
results.push(Interval.fromDateTimes(s, next));
|
|
2746
|
+
s = next;
|
|
2700
2747
|
i += 1;
|
|
2701
2748
|
}
|
|
2702
2749
|
return results;
|
|
@@ -2706,13 +2753,13 @@ class Interval {
|
|
|
2706
2753
|
if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) {
|
|
2707
2754
|
return [];
|
|
2708
2755
|
}
|
|
2709
|
-
let { s
|
|
2756
|
+
let { s } = this, idx = 1, next;
|
|
2710
2757
|
const results = [];
|
|
2711
|
-
while (
|
|
2758
|
+
while (s < this.e) {
|
|
2712
2759
|
const added = this.start.plus(dur.mapUnits((x) => x * idx));
|
|
2713
2760
|
next = +added > +this.e ? this.e : added;
|
|
2714
|
-
results.push(Interval.fromDateTimes(
|
|
2715
|
-
|
|
2761
|
+
results.push(Interval.fromDateTimes(s, next));
|
|
2762
|
+
s = next;
|
|
2716
2763
|
idx += 1;
|
|
2717
2764
|
}
|
|
2718
2765
|
return results;
|
|
@@ -2749,18 +2796,18 @@ class Interval {
|
|
|
2749
2796
|
intersection(other) {
|
|
2750
2797
|
if (!this.isValid)
|
|
2751
2798
|
return this;
|
|
2752
|
-
const
|
|
2753
|
-
if (
|
|
2799
|
+
const s = this.s > other.s ? this.s : other.s, e = this.e < other.e ? this.e : other.e;
|
|
2800
|
+
if (s >= e) {
|
|
2754
2801
|
return null;
|
|
2755
2802
|
} else {
|
|
2756
|
-
return Interval.fromDateTimes(
|
|
2803
|
+
return Interval.fromDateTimes(s, e);
|
|
2757
2804
|
}
|
|
2758
2805
|
}
|
|
2759
2806
|
union(other) {
|
|
2760
2807
|
if (!this.isValid)
|
|
2761
2808
|
return this;
|
|
2762
|
-
const
|
|
2763
|
-
return Interval.fromDateTimes(
|
|
2809
|
+
const s = this.s < other.s ? this.s : other.s, e = this.e > other.e ? this.e : other.e;
|
|
2810
|
+
return Interval.fromDateTimes(s, e);
|
|
2764
2811
|
}
|
|
2765
2812
|
static merge(intervals) {
|
|
2766
2813
|
const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(([sofar, current], item) => {
|
|
@@ -2844,7 +2891,6 @@ class Interval {
|
|
|
2844
2891
|
return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));
|
|
2845
2892
|
}
|
|
2846
2893
|
}
|
|
2847
|
-
|
|
2848
2894
|
class Info {
|
|
2849
2895
|
static hasDST(zone = Settings.defaultZone) {
|
|
2850
2896
|
const proto = DateTime.now().setZone(zone).set({ month: 12 });
|
|
@@ -2949,16 +2995,16 @@ function diff(earlier, later, units, opts) {
|
|
|
2949
2995
|
}
|
|
2950
2996
|
var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support";
|
|
2951
2997
|
function intUnit(regex, post = (i) => i) {
|
|
2952
|
-
return { regex, deser: ([
|
|
2998
|
+
return { regex, deser: ([s]) => post(parseDigits(s)) };
|
|
2953
2999
|
}
|
|
2954
3000
|
var NBSP = String.fromCharCode(160);
|
|
2955
3001
|
var spaceOrNBSP = `[ ${NBSP}]`;
|
|
2956
3002
|
var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g");
|
|
2957
|
-
function fixListRegex(
|
|
2958
|
-
return
|
|
3003
|
+
function fixListRegex(s) {
|
|
3004
|
+
return s.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP);
|
|
2959
3005
|
}
|
|
2960
|
-
function stripInsensitivities(
|
|
2961
|
-
return
|
|
3006
|
+
function stripInsensitivities(s) {
|
|
3007
|
+
return s.replace(/\./g, "").replace(spaceOrNBSPRegExp, " ").toLowerCase();
|
|
2962
3008
|
}
|
|
2963
3009
|
function oneOf(strings, startIndex) {
|
|
2964
3010
|
if (strings === null) {
|
|
@@ -2966,7 +3012,7 @@ function oneOf(strings, startIndex) {
|
|
|
2966
3012
|
} else {
|
|
2967
3013
|
return {
|
|
2968
3014
|
regex: RegExp(strings.map(fixListRegex).join("|")),
|
|
2969
|
-
deser: ([
|
|
3015
|
+
deser: ([s]) => strings.findIndex((i) => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex
|
|
2970
3016
|
};
|
|
2971
3017
|
}
|
|
2972
3018
|
}
|
|
@@ -2974,13 +3020,13 @@ function offset(regex, groups) {
|
|
|
2974
3020
|
return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };
|
|
2975
3021
|
}
|
|
2976
3022
|
function simple(regex) {
|
|
2977
|
-
return { regex, deser: ([
|
|
3023
|
+
return { regex, deser: ([s]) => s };
|
|
2978
3024
|
}
|
|
2979
3025
|
function escapeToken(value) {
|
|
2980
3026
|
return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
2981
3027
|
}
|
|
2982
3028
|
function unitForToken(token, loc) {
|
|
2983
|
-
const one = digitRegex(loc), two = digitRegex(loc, "{2}"), three = digitRegex(loc, "{3}"), four = digitRegex(loc, "{4}"), six = digitRegex(loc, "{6}"), oneOrTwo = digitRegex(loc, "{1,2}"), oneToThree = digitRegex(loc, "{1,3}"), oneToSix = digitRegex(loc, "{1,6}"), oneToNine = digitRegex(loc, "{1,9}"), twoToFour = digitRegex(loc, "{2,4}"), fourToSix = digitRegex(loc, "{4,6}"), literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([
|
|
3029
|
+
const one = digitRegex(loc), two = digitRegex(loc, "{2}"), three = digitRegex(loc, "{3}"), four = digitRegex(loc, "{4}"), six = digitRegex(loc, "{6}"), oneOrTwo = digitRegex(loc, "{1,2}"), oneToThree = digitRegex(loc, "{1,3}"), oneToSix = digitRegex(loc, "{1,6}"), oneToNine = digitRegex(loc, "{1,9}"), twoToFour = digitRegex(loc, "{2,4}"), fourToSix = digitRegex(loc, "{4,6}"), literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }), unitate = (t) => {
|
|
2984
3030
|
if (token.literal) {
|
|
2985
3031
|
return literal(t);
|
|
2986
3032
|
}
|
|
@@ -3385,8 +3431,8 @@ function fixOffset(localTS, o, tz) {
|
|
|
3385
3431
|
}
|
|
3386
3432
|
return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];
|
|
3387
3433
|
}
|
|
3388
|
-
function tsToObj(ts,
|
|
3389
|
-
ts +=
|
|
3434
|
+
function tsToObj(ts, offset) {
|
|
3435
|
+
ts += offset * 60 * 1000;
|
|
3390
3436
|
const d = new Date(ts);
|
|
3391
3437
|
return {
|
|
3392
3438
|
year: d.getUTCFullYear(),
|
|
@@ -3398,11 +3444,11 @@ function tsToObj(ts, offset2) {
|
|
|
3398
3444
|
millisecond: d.getUTCMilliseconds()
|
|
3399
3445
|
};
|
|
3400
3446
|
}
|
|
3401
|
-
function objToTS(obj,
|
|
3402
|
-
return fixOffset(objToLocalTS(obj),
|
|
3447
|
+
function objToTS(obj, offset, zone) {
|
|
3448
|
+
return fixOffset(objToLocalTS(obj), offset, zone);
|
|
3403
3449
|
}
|
|
3404
3450
|
function adjustTime(inst, dur) {
|
|
3405
|
-
const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3,
|
|
3451
|
+
const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, c = {
|
|
3406
3452
|
...inst.c,
|
|
3407
3453
|
year,
|
|
3408
3454
|
month,
|
|
@@ -3417,7 +3463,7 @@ function adjustTime(inst, dur) {
|
|
|
3417
3463
|
minutes: dur.minutes,
|
|
3418
3464
|
seconds: dur.seconds,
|
|
3419
3465
|
milliseconds: dur.milliseconds
|
|
3420
|
-
}).as("milliseconds"), localTS = objToLocalTS(
|
|
3466
|
+
}).as("milliseconds"), localTS = objToLocalTS(c);
|
|
3421
3467
|
let [ts, o] = fixOffset(localTS, oPre, inst.zone);
|
|
3422
3468
|
if (millisToAdd !== 0) {
|
|
3423
3469
|
ts += millisToAdd;
|
|
@@ -3446,80 +3492,80 @@ function toTechFormat(dt, format, allowZ = true) {
|
|
|
3446
3492
|
}
|
|
3447
3493
|
function toISODate(o, extended, precision) {
|
|
3448
3494
|
const longFormat = o.c.year > 9999 || o.c.year < 0;
|
|
3449
|
-
let
|
|
3495
|
+
let c = "";
|
|
3450
3496
|
if (longFormat && o.c.year >= 0)
|
|
3451
|
-
|
|
3452
|
-
|
|
3497
|
+
c += "+";
|
|
3498
|
+
c += padStart(o.c.year, longFormat ? 6 : 4);
|
|
3453
3499
|
if (precision === "year")
|
|
3454
|
-
return
|
|
3500
|
+
return c;
|
|
3455
3501
|
if (extended) {
|
|
3456
|
-
|
|
3457
|
-
|
|
3502
|
+
c += "-";
|
|
3503
|
+
c += padStart(o.c.month);
|
|
3458
3504
|
if (precision === "month")
|
|
3459
|
-
return
|
|
3460
|
-
|
|
3505
|
+
return c;
|
|
3506
|
+
c += "-";
|
|
3461
3507
|
} else {
|
|
3462
|
-
|
|
3508
|
+
c += padStart(o.c.month);
|
|
3463
3509
|
if (precision === "month")
|
|
3464
|
-
return
|
|
3510
|
+
return c;
|
|
3465
3511
|
}
|
|
3466
|
-
|
|
3467
|
-
return
|
|
3512
|
+
c += padStart(o.c.day);
|
|
3513
|
+
return c;
|
|
3468
3514
|
}
|
|
3469
3515
|
function toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision) {
|
|
3470
|
-
let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0,
|
|
3516
|
+
let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0, c = "";
|
|
3471
3517
|
switch (precision) {
|
|
3472
3518
|
case "day":
|
|
3473
3519
|
case "month":
|
|
3474
3520
|
case "year":
|
|
3475
3521
|
break;
|
|
3476
3522
|
default:
|
|
3477
|
-
|
|
3523
|
+
c += padStart(o.c.hour);
|
|
3478
3524
|
if (precision === "hour")
|
|
3479
3525
|
break;
|
|
3480
3526
|
if (extended) {
|
|
3481
|
-
|
|
3482
|
-
|
|
3527
|
+
c += ":";
|
|
3528
|
+
c += padStart(o.c.minute);
|
|
3483
3529
|
if (precision === "minute")
|
|
3484
3530
|
break;
|
|
3485
3531
|
if (showSeconds) {
|
|
3486
|
-
|
|
3487
|
-
|
|
3532
|
+
c += ":";
|
|
3533
|
+
c += padStart(o.c.second);
|
|
3488
3534
|
}
|
|
3489
3535
|
} else {
|
|
3490
|
-
|
|
3536
|
+
c += padStart(o.c.minute);
|
|
3491
3537
|
if (precision === "minute")
|
|
3492
3538
|
break;
|
|
3493
3539
|
if (showSeconds) {
|
|
3494
|
-
|
|
3540
|
+
c += padStart(o.c.second);
|
|
3495
3541
|
}
|
|
3496
3542
|
}
|
|
3497
3543
|
if (precision === "second")
|
|
3498
3544
|
break;
|
|
3499
3545
|
if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {
|
|
3500
|
-
|
|
3501
|
-
|
|
3546
|
+
c += ".";
|
|
3547
|
+
c += padStart(o.c.millisecond, 3);
|
|
3502
3548
|
}
|
|
3503
3549
|
}
|
|
3504
3550
|
if (includeOffset) {
|
|
3505
3551
|
if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {
|
|
3506
|
-
|
|
3552
|
+
c += "Z";
|
|
3507
3553
|
} else if (o.o < 0) {
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3554
|
+
c += "-";
|
|
3555
|
+
c += padStart(Math.trunc(-o.o / 60));
|
|
3556
|
+
c += ":";
|
|
3557
|
+
c += padStart(Math.trunc(-o.o % 60));
|
|
3512
3558
|
} else {
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3559
|
+
c += "+";
|
|
3560
|
+
c += padStart(Math.trunc(o.o / 60));
|
|
3561
|
+
c += ":";
|
|
3562
|
+
c += padStart(Math.trunc(o.o % 60));
|
|
3517
3563
|
}
|
|
3518
3564
|
}
|
|
3519
3565
|
if (extendedZone) {
|
|
3520
|
-
|
|
3566
|
+
c += "[" + o.zone.ianaName + "]";
|
|
3521
3567
|
}
|
|
3522
|
-
return
|
|
3568
|
+
return c;
|
|
3523
3569
|
}
|
|
3524
3570
|
var defaultUnitValues = {
|
|
3525
3571
|
month: 1,
|
|
@@ -3641,10 +3687,10 @@ function quickDT(obj, opts) {
|
|
|
3641
3687
|
return new DateTime({ ts, zone, loc, o });
|
|
3642
3688
|
}
|
|
3643
3689
|
function diffRelative(start, end, opts) {
|
|
3644
|
-
const round = isUndefined(opts.round) ? true : opts.round, rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, format = (
|
|
3645
|
-
|
|
3690
|
+
const round = isUndefined(opts.round) ? true : opts.round, rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, format = (c, unit) => {
|
|
3691
|
+
c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding);
|
|
3646
3692
|
const formatter = end.loc.clone(opts).relFormatter(opts);
|
|
3647
|
-
return formatter.format(
|
|
3693
|
+
return formatter.format(c, unit);
|
|
3648
3694
|
}, differ = (unit) => {
|
|
3649
3695
|
if (opts.calendary) {
|
|
3650
3696
|
if (!end.hasSame(start, unit)) {
|
|
@@ -3684,16 +3730,16 @@ class DateTime {
|
|
|
3684
3730
|
const zone = config.zone || Settings.defaultZone;
|
|
3685
3731
|
let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null);
|
|
3686
3732
|
this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;
|
|
3687
|
-
let
|
|
3733
|
+
let c = null, o = null;
|
|
3688
3734
|
if (!invalid) {
|
|
3689
3735
|
const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
|
|
3690
3736
|
if (unchanged) {
|
|
3691
|
-
[
|
|
3737
|
+
[c, o] = [config.old.c, config.old.o];
|
|
3692
3738
|
} else {
|
|
3693
3739
|
const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts);
|
|
3694
|
-
|
|
3695
|
-
invalid = Number.isNaN(
|
|
3696
|
-
|
|
3740
|
+
c = tsToObj(this.ts, ot);
|
|
3741
|
+
invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null;
|
|
3742
|
+
c = invalid ? null : c;
|
|
3697
3743
|
o = invalid ? null : ot;
|
|
3698
3744
|
}
|
|
3699
3745
|
}
|
|
@@ -3702,7 +3748,7 @@ class DateTime {
|
|
|
3702
3748
|
this.invalid = invalid;
|
|
3703
3749
|
this.weekData = null;
|
|
3704
3750
|
this.localWeekData = null;
|
|
3705
|
-
this.c =
|
|
3751
|
+
this.c = c;
|
|
3706
3752
|
this.o = o;
|
|
3707
3753
|
this.isLuxonDateTime = true;
|
|
3708
3754
|
}
|
|
@@ -4038,8 +4084,8 @@ class DateTime {
|
|
|
4038
4084
|
const { locale, numberingSystem, calendar } = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this);
|
|
4039
4085
|
return { locale, numberingSystem, outputCalendar: calendar };
|
|
4040
4086
|
}
|
|
4041
|
-
toUTC(
|
|
4042
|
-
return this.setZone(FixedOffsetZone.instance(
|
|
4087
|
+
toUTC(offset = 0, opts = {}) {
|
|
4088
|
+
return this.setZone(FixedOffsetZone.instance(offset), opts);
|
|
4043
4089
|
}
|
|
4044
4090
|
toLocal() {
|
|
4045
4091
|
return this.setZone(Settings.defaultZone);
|
|
@@ -4169,11 +4215,11 @@ class DateTime {
|
|
|
4169
4215
|
}
|
|
4170
4216
|
precision = normalizeUnit(precision);
|
|
4171
4217
|
const ext = format === "extended";
|
|
4172
|
-
let
|
|
4218
|
+
let c = toISODate(this, ext, precision);
|
|
4173
4219
|
if (orderedUnits.indexOf(precision) >= 3)
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
return
|
|
4220
|
+
c += "T";
|
|
4221
|
+
c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision);
|
|
4222
|
+
return c;
|
|
4177
4223
|
}
|
|
4178
4224
|
toISODate({ format = "extended", precision = "day" } = {}) {
|
|
4179
4225
|
if (!this.isValid) {
|
|
@@ -4197,8 +4243,8 @@ class DateTime {
|
|
|
4197
4243
|
return null;
|
|
4198
4244
|
}
|
|
4199
4245
|
precision = normalizeUnit(precision);
|
|
4200
|
-
let
|
|
4201
|
-
return
|
|
4246
|
+
let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : "";
|
|
4247
|
+
return c + toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision);
|
|
4202
4248
|
}
|
|
4203
4249
|
toRFC2822() {
|
|
4204
4250
|
return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
|
|
@@ -4456,80 +4502,80 @@ function friendlyDateTime(dateTimeish) {
|
|
|
4456
4502
|
|
|
4457
4503
|
// ../../node_modules/@uipath/dmn-editor-utils/dist/chunks/chunk-TZVIZNQA.js
|
|
4458
4504
|
var ne2 = (e, t) => {
|
|
4459
|
-
let
|
|
4460
|
-
return
|
|
4505
|
+
let n = t.trim();
|
|
4506
|
+
return n ? e.find((r) => ne(r) === n) : undefined;
|
|
4461
4507
|
};
|
|
4462
4508
|
var y = String.raw`-?\d{4,}-\d{2}-\d{2}`;
|
|
4463
|
-
var
|
|
4464
|
-
var
|
|
4465
|
-
var
|
|
4509
|
+
var x2 = String.raw`\d{2}:\d{2}(:\d{2}(\.\d+)?)?([Zz]|[+-]\d{2}:\d{2})?`;
|
|
4510
|
+
var R = String.raw`-?P(?!$)(\d+Y)?(\d+M)?(\d+D)?(T(?!$)(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?`;
|
|
4511
|
+
var w2 = String.raw`-?(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?`;
|
|
4466
4512
|
var E = new RegExp(`^${y}$`);
|
|
4467
|
-
var D = new RegExp(`^${
|
|
4468
|
-
var
|
|
4469
|
-
var
|
|
4470
|
-
var
|
|
4513
|
+
var D = new RegExp(`^${x2}$`);
|
|
4514
|
+
var h2 = new RegExp(`^${y}T${x2}$`);
|
|
4515
|
+
var b2 = new RegExp(`^${R}$`);
|
|
4516
|
+
var A2 = new RegExp(`^${w2}$`);
|
|
4471
4517
|
var N = /^(?!.*\.\.)[^[\]()<>=!,]*$/;
|
|
4472
|
-
var
|
|
4518
|
+
var O2 = (e) => {
|
|
4473
4519
|
let t = e.indexOf("@");
|
|
4474
4520
|
return t === -1 ? { text: e } : { text: e.slice(0, t), zone: e.slice(t + 1) };
|
|
4475
4521
|
};
|
|
4476
|
-
var $ = (e) => E.test(e) && DateTime.fromISO(e).isValid;
|
|
4522
|
+
var $2 = (e) => E.test(e) && DateTime.fromISO(e).isValid;
|
|
4477
4523
|
var P = (e) => {
|
|
4478
|
-
let { text: t, zone:
|
|
4479
|
-
return D.test(t) ? DateTime.fromISO(`2000-01-01T${t}`,
|
|
4524
|
+
let { text: t, zone: n } = O2(e);
|
|
4525
|
+
return D.test(t) ? DateTime.fromISO(`2000-01-01T${t}`, n ? { zone: n } : { setZone: true }).isValid : false;
|
|
4480
4526
|
};
|
|
4481
4527
|
var k = (e) => {
|
|
4482
|
-
let { text: t, zone:
|
|
4483
|
-
return
|
|
4528
|
+
let { text: t, zone: n } = O2(e);
|
|
4529
|
+
return h2.test(t) && DateTime.fromISO(t, n ? { zone: n } : { setZone: true }).isValid;
|
|
4484
4530
|
};
|
|
4485
4531
|
var F = (e) => {
|
|
4486
|
-
if (!
|
|
4532
|
+
if (!b2.test(e))
|
|
4487
4533
|
return;
|
|
4488
4534
|
let t = Duration.fromISO(e);
|
|
4489
4535
|
if (!t.isValid)
|
|
4490
4536
|
return;
|
|
4491
|
-
let
|
|
4537
|
+
let n = t.toObject(), r = (...i) => i.some((s) => n[s] !== undefined);
|
|
4492
4538
|
return { years: r("years", "months"), days: r("weeks", "days", "hours", "minutes", "seconds", "milliseconds") };
|
|
4493
4539
|
};
|
|
4494
4540
|
var M = (e, t) => {
|
|
4495
|
-
let
|
|
4496
|
-
return
|
|
4541
|
+
let n = F(e);
|
|
4542
|
+
return n ? t === "yearMonth" ? n.years && !n.days : n.days && !n.years : false;
|
|
4497
4543
|
};
|
|
4498
|
-
var
|
|
4544
|
+
var C2 = (e) => A2.test(e);
|
|
4499
4545
|
var de = (e, t) => {
|
|
4500
|
-
let
|
|
4501
|
-
if (!
|
|
4546
|
+
let n = e.trim();
|
|
4547
|
+
if (!n)
|
|
4502
4548
|
return false;
|
|
4503
|
-
switch (
|
|
4549
|
+
switch (R2(t ?? "string")) {
|
|
4504
4550
|
case "date":
|
|
4505
|
-
return $(
|
|
4551
|
+
return $2(n);
|
|
4506
4552
|
case "time":
|
|
4507
|
-
return P(
|
|
4553
|
+
return P(n);
|
|
4508
4554
|
case "date and time":
|
|
4509
|
-
return k(
|
|
4555
|
+
return k(n);
|
|
4510
4556
|
case "dayTimeDuration":
|
|
4511
|
-
return M(
|
|
4557
|
+
return M(n, "dayTime");
|
|
4512
4558
|
case "yearMonthDuration":
|
|
4513
|
-
return M(
|
|
4559
|
+
return M(n, "yearMonth");
|
|
4514
4560
|
case "boolean":
|
|
4515
|
-
return
|
|
4561
|
+
return n === "true" || n === "false";
|
|
4516
4562
|
case "number":
|
|
4517
|
-
return
|
|
4563
|
+
return C2(n);
|
|
4518
4564
|
default:
|
|
4519
4565
|
return true;
|
|
4520
4566
|
}
|
|
4521
4567
|
};
|
|
4522
|
-
var W = (e) => ["date", "time", "date and time", "dayTimeDuration", "yearMonthDuration", "boolean", "number"].includes(
|
|
4523
|
-
var _ = (e) => W(e) ||
|
|
4524
|
-
var
|
|
4568
|
+
var W = (e) => ["date", "time", "date and time", "dayTimeDuration", "yearMonthDuration", "boolean", "number"].includes(R2(e ?? "string"));
|
|
4569
|
+
var _ = (e) => W(e) || R2(e ?? "string") === "string";
|
|
4570
|
+
var J3 = String.raw`\"`;
|
|
4525
4571
|
var c2 = "matches(?, ";
|
|
4526
|
-
var
|
|
4572
|
+
var S2 = "^(";
|
|
4527
4573
|
var I = ")$";
|
|
4528
4574
|
var v = ["date", "time", "date and time", "duration"];
|
|
4529
4575
|
var Y = (e) => {
|
|
4530
4576
|
let t = e.trim();
|
|
4531
|
-
for (let
|
|
4532
|
-
let r = `${
|
|
4577
|
+
for (let n of v) {
|
|
4578
|
+
let r = `${n}(`;
|
|
4533
4579
|
if (t.startsWith(r) && t.endsWith(")"))
|
|
4534
4580
|
try {
|
|
4535
4581
|
let i = JSON.parse(t.slice(r.length, -1).trim());
|
|
@@ -4539,23 +4585,23 @@ var Y = (e) => {
|
|
|
4539
4585
|
}
|
|
4540
4586
|
}
|
|
4541
4587
|
};
|
|
4542
|
-
var
|
|
4543
|
-
let t = e.trim(),
|
|
4544
|
-
return
|
|
4588
|
+
var z2 = (e) => {
|
|
4589
|
+
let t = e.trim(), n = Y(t);
|
|
4590
|
+
return n !== undefined ? n : U2(t) ? X(t)[0] : N.test(t) ? t : undefined;
|
|
4545
4591
|
};
|
|
4546
|
-
var
|
|
4547
|
-
var
|
|
4548
|
-
if (!
|
|
4592
|
+
var U2 = (e) => e.length >= 2 && e.startsWith('"') && e.endsWith('"');
|
|
4593
|
+
var B2 = (e) => {
|
|
4594
|
+
if (!U2(e))
|
|
4549
4595
|
return e;
|
|
4550
4596
|
try {
|
|
4551
4597
|
let t = JSON.parse(e);
|
|
4552
4598
|
return typeof t == "string" ? t : e;
|
|
4553
4599
|
} catch {
|
|
4554
|
-
return e.slice(1, -1).replaceAll(
|
|
4600
|
+
return e.slice(1, -1).replaceAll(J3, '"');
|
|
4555
4601
|
}
|
|
4556
4602
|
};
|
|
4557
4603
|
var L = (e) => {
|
|
4558
|
-
let t = [],
|
|
4604
|
+
let t = [], n = 0, r = false, i = 0, s = (o) => {
|
|
4559
4605
|
let a = e.slice(i, o), u = a.trim();
|
|
4560
4606
|
if (u) {
|
|
4561
4607
|
let f = i + a.indexOf(u);
|
|
@@ -4564,53 +4610,3296 @@ var L = (e) => {
|
|
|
4564
4610
|
};
|
|
4565
4611
|
for (let o = 0;o < e.length; o += 1) {
|
|
4566
4612
|
let a = e[o];
|
|
4567
|
-
r && a === "\\" ? o += 1 : a === '"' ? r = !r : !r && "([{".includes(a) ?
|
|
4613
|
+
r && a === "\\" ? o += 1 : a === '"' ? r = !r : !r && "([{".includes(a) ? n += 1 : !r && ")]}".includes(a) ? n = Math.max(0, n - 1) : a === "," && !r && n === 0 && (s(o), i = o + 1);
|
|
4568
4614
|
}
|
|
4569
|
-
return
|
|
4615
|
+
return s(e.length), t;
|
|
4570
4616
|
};
|
|
4571
4617
|
var H = (e) => L(e).map(({ token: t }) => t);
|
|
4572
|
-
var X = (e) => H(e).map(
|
|
4618
|
+
var X = (e) => H(e).map(B2);
|
|
4573
4619
|
var Z = (e) => {
|
|
4574
4620
|
let t = e?.text;
|
|
4575
4621
|
if (!t?.startsWith(c2) || !t.endsWith(")"))
|
|
4576
4622
|
return null;
|
|
4577
|
-
let
|
|
4623
|
+
let n = t.slice(c2.length, -1);
|
|
4578
4624
|
try {
|
|
4579
|
-
let r = JSON.parse(
|
|
4580
|
-
return typeof r != "string" || `${c2}${JSON.stringify(r)})` !== t || !r.startsWith(
|
|
4625
|
+
let r = JSON.parse(n);
|
|
4626
|
+
return typeof r != "string" || `${c2}${JSON.stringify(r)})` !== t || !r.startsWith(S2) || !r.endsWith(I) ? null : r.slice(S2.length, -I.length);
|
|
4581
4627
|
} catch {
|
|
4582
4628
|
return null;
|
|
4583
4629
|
}
|
|
4584
4630
|
};
|
|
4585
4631
|
var pe = (e, t) => {
|
|
4586
|
-
let
|
|
4587
|
-
return !e || !
|
|
4632
|
+
let n = e?.text.trim();
|
|
4633
|
+
return !e || !n ? "none" : Z(e) !== null ? "regex" : ae(n, "unaryTests") ? "expression" : G2(e, t) ? "list" : "expression";
|
|
4588
4634
|
};
|
|
4589
|
-
var
|
|
4590
|
-
let
|
|
4591
|
-
if (
|
|
4635
|
+
var G2 = (e, t) => {
|
|
4636
|
+
let n = Q2(e.text);
|
|
4637
|
+
if (n.length === 0)
|
|
4592
4638
|
return false;
|
|
4593
4639
|
if (!_(t))
|
|
4594
|
-
return
|
|
4595
|
-
let r =
|
|
4596
|
-
return
|
|
4640
|
+
return n.every(({ token: i }) => oe(i));
|
|
4641
|
+
let r = ee2(t);
|
|
4642
|
+
return n.every(({ token: i, value: s }) => s !== undefined || r && K2(i) !== undefined);
|
|
4597
4643
|
};
|
|
4598
|
-
var
|
|
4599
|
-
var
|
|
4600
|
-
let t = e.trim(),
|
|
4601
|
-
if (c(t, "unaryTests").iterate({ enter(
|
|
4602
|
-
|
|
4644
|
+
var Q2 = (e) => L(e).map((t) => ({ ...t, value: z2(t.token) }));
|
|
4645
|
+
var K2 = (e) => {
|
|
4646
|
+
let t = e.trim(), n = e.indexOf(t), r;
|
|
4647
|
+
if (c(t, "unaryTests").iterate({ enter(s) {
|
|
4648
|
+
s.name === "Interval" && s.from === 0 && s.to === t.length && (r = s.node);
|
|
4603
4649
|
} }), !r)
|
|
4604
4650
|
return;
|
|
4605
4651
|
let i = [];
|
|
4606
|
-
for (let
|
|
4607
|
-
j.has(
|
|
4652
|
+
for (let s = r.firstChild;s; s = s.nextSibling)
|
|
4653
|
+
j.has(s.name) && i.push({ text: t.slice(s.from, s.to), from: n + s.from, to: n + s.to });
|
|
4608
4654
|
return i.length === 2 ? i : undefined;
|
|
4609
4655
|
};
|
|
4610
4656
|
var j = new Set(["StringLiteral", "NumericLiteral", "DateTimeLiteral"]);
|
|
4611
4657
|
var q = new Set(["number"]);
|
|
4612
|
-
var
|
|
4658
|
+
var ee2 = (e) => q.has(R2(e ?? "string"));
|
|
4659
|
+
|
|
4660
|
+
// ../../node_modules/@bpmn-io/feel-analyzer/dist/index.js
|
|
4661
|
+
function stripBackticks(text) {
|
|
4662
|
+
return text.replace(/^`|`$/g, "");
|
|
4663
|
+
}
|
|
4664
|
+
function nodeText(node, source) {
|
|
4665
|
+
return stripBackticks(source.substring(node.from, node.to));
|
|
4666
|
+
}
|
|
4667
|
+
function isInScope(varName, scopes) {
|
|
4668
|
+
return scopes.some((scope) => scope.has(varName));
|
|
4669
|
+
}
|
|
4670
|
+
function withScope(scopes, initialNames, fn) {
|
|
4671
|
+
const scope = new Set(initialNames);
|
|
4672
|
+
scopes.push(scope);
|
|
4673
|
+
const result = fn(scope);
|
|
4674
|
+
scopes.pop();
|
|
4675
|
+
return result;
|
|
4676
|
+
}
|
|
4677
|
+
function forEachChild(node, callback) {
|
|
4678
|
+
let child = node.firstChild;
|
|
4679
|
+
while (child) {
|
|
4680
|
+
callback(child);
|
|
4681
|
+
child = child.nextSibling;
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
function collectPathParts(node, source) {
|
|
4685
|
+
const parts = [];
|
|
4686
|
+
forEachChild(node, (child) => {
|
|
4687
|
+
if (child.name === "PathExpression") {
|
|
4688
|
+
parts.push(...collectPathParts(child, source));
|
|
4689
|
+
} else if (child.name === "VariableName" || child.name === "PathName") {
|
|
4690
|
+
parts.push(nodeText(child, source));
|
|
4691
|
+
}
|
|
4692
|
+
});
|
|
4693
|
+
return parts;
|
|
4694
|
+
}
|
|
4695
|
+
function getFilterBase(node) {
|
|
4696
|
+
const firstChild = node.firstChild;
|
|
4697
|
+
if (!firstChild)
|
|
4698
|
+
return null;
|
|
4699
|
+
if (firstChild.name === "FilterExpression")
|
|
4700
|
+
return firstChild;
|
|
4701
|
+
if (firstChild.name === "PathExpression")
|
|
4702
|
+
return getFilterBase(firstChild);
|
|
4703
|
+
return null;
|
|
4704
|
+
}
|
|
4705
|
+
function hasContextBase(node) {
|
|
4706
|
+
const firstChild = node.firstChild;
|
|
4707
|
+
if (!firstChild)
|
|
4708
|
+
return false;
|
|
4709
|
+
if (firstChild.name === "Context")
|
|
4710
|
+
return true;
|
|
4711
|
+
if (firstChild.name === "PathExpression")
|
|
4712
|
+
return hasContextBase(firstChild);
|
|
4713
|
+
return false;
|
|
4714
|
+
}
|
|
4715
|
+
function extractContextKeys(contextNode, source) {
|
|
4716
|
+
const keys = [];
|
|
4717
|
+
forEachChild(contextNode, (child) => {
|
|
4718
|
+
if (child.name === "ContextEntry") {
|
|
4719
|
+
const keyName = child.getChild("Key")?.getChild("Name");
|
|
4720
|
+
if (keyName) {
|
|
4721
|
+
keys.push(nodeText(keyName, source));
|
|
4722
|
+
}
|
|
4723
|
+
}
|
|
4724
|
+
});
|
|
4725
|
+
return keys;
|
|
4726
|
+
}
|
|
4727
|
+
function collectIterationVariables(node, source) {
|
|
4728
|
+
const vars = [];
|
|
4729
|
+
const inExpressions = node.getChild("InExpressions");
|
|
4730
|
+
if (inExpressions) {
|
|
4731
|
+
forEachChild(inExpressions, (child) => {
|
|
4732
|
+
if (child.name === "InExpression") {
|
|
4733
|
+
const id = child.getChild("Name")?.getChild("Identifier");
|
|
4734
|
+
if (id)
|
|
4735
|
+
vars.push(source.substring(id.from, id.to));
|
|
4736
|
+
}
|
|
4737
|
+
});
|
|
4738
|
+
}
|
|
4739
|
+
return vars;
|
|
4740
|
+
}
|
|
4741
|
+
function collectFunctionParameters(node, source) {
|
|
4742
|
+
const params = [];
|
|
4743
|
+
const formalParams = node.getChild("FormalParameters");
|
|
4744
|
+
if (formalParams) {
|
|
4745
|
+
forEachChild(formalParams, (child) => {
|
|
4746
|
+
if (child.name === "FormalParameter") {
|
|
4747
|
+
const id = child.getChild("ParameterName")?.getChild("Name")?.getChild("Identifier");
|
|
4748
|
+
if (id)
|
|
4749
|
+
params.push(source.substring(id.from, id.to));
|
|
4750
|
+
}
|
|
4751
|
+
});
|
|
4752
|
+
}
|
|
4753
|
+
return params;
|
|
4754
|
+
}
|
|
4755
|
+
function findVariable(variables, name) {
|
|
4756
|
+
return variables.find((v) => v.name === name);
|
|
4757
|
+
}
|
|
4758
|
+
function findOrCreateVariable(variables, name) {
|
|
4759
|
+
let variable = findVariable(variables, name);
|
|
4760
|
+
if (!variable) {
|
|
4761
|
+
variable = { name };
|
|
4762
|
+
variables.push(variable);
|
|
4763
|
+
}
|
|
4764
|
+
return variable;
|
|
4765
|
+
}
|
|
4766
|
+
function buildNestedEntries(variables, pathParts) {
|
|
4767
|
+
const rootVar = findOrCreateVariable(variables, pathParts[0]);
|
|
4768
|
+
if (pathParts.length <= 1)
|
|
4769
|
+
return;
|
|
4770
|
+
if (!rootVar.type) {
|
|
4771
|
+
rootVar.type = "Context";
|
|
4772
|
+
rootVar.entries = rootVar.entries || [];
|
|
4773
|
+
}
|
|
4774
|
+
if (rootVar.type !== "Context")
|
|
4775
|
+
return;
|
|
4776
|
+
let currentLevel = rootVar.entries;
|
|
4777
|
+
for (let i = 1;i < pathParts.length; i++) {
|
|
4778
|
+
const part = pathParts[i];
|
|
4779
|
+
const isLast = i === pathParts.length - 1;
|
|
4780
|
+
let entry = findVariable(currentLevel, part);
|
|
4781
|
+
if (!entry) {
|
|
4782
|
+
entry = isLast ? { name: part } : { name: part, type: "Context", entries: [] };
|
|
4783
|
+
currentLevel.push(entry);
|
|
4784
|
+
} else if (!isLast && !entry.type) {
|
|
4785
|
+
entry.type = "Context";
|
|
4786
|
+
entry.entries = entry.entries || [];
|
|
4787
|
+
}
|
|
4788
|
+
if (!isLast) {
|
|
4789
|
+
entry.entries = entry.entries || [];
|
|
4790
|
+
currentLevel = entry.entries;
|
|
4791
|
+
}
|
|
4792
|
+
}
|
|
4793
|
+
}
|
|
4794
|
+
function sortEntries(variable) {
|
|
4795
|
+
if (variable.entries) {
|
|
4796
|
+
variable.entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
4797
|
+
for (const entry of variable.entries) {
|
|
4798
|
+
sortEntries(entry);
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
}
|
|
4802
|
+
var ITERATION_KEYWORDS$1 = new Set(["for", "return", "some", "every", "InExpressions", "satisfies"]);
|
|
4803
|
+
function extractInputNames(node, source, builtinNames) {
|
|
4804
|
+
const inputs = new Set;
|
|
4805
|
+
const localScopes = [new Set];
|
|
4806
|
+
function isExternal(name, filterCtx) {
|
|
4807
|
+
return !isInScope(name, localScopes) && !builtinNames.has(name) && !(filterCtx !== "none" && name === "item");
|
|
4808
|
+
}
|
|
4809
|
+
const collectInputs = (node, filterCtx = "none") => {
|
|
4810
|
+
const { name: nodeName } = node;
|
|
4811
|
+
if (node.type.isError) {
|
|
4812
|
+
return;
|
|
4813
|
+
}
|
|
4814
|
+
if (nodeName === "FunctionInvocation") {
|
|
4815
|
+
const funcNameNode = node.getChild("VariableName");
|
|
4816
|
+
if (funcNameNode) {
|
|
4817
|
+
const funcName = nodeText(funcNameNode, source);
|
|
4818
|
+
if (isExternal(funcName, filterCtx)) {
|
|
4819
|
+
inputs.add(funcName);
|
|
4820
|
+
}
|
|
4821
|
+
}
|
|
4822
|
+
forEachChild(node, (child) => {
|
|
4823
|
+
if (child.name !== "VariableName" && child.name !== "(" && child.name !== ")") {
|
|
4824
|
+
collectInputs(child, filterCtx);
|
|
4825
|
+
}
|
|
4826
|
+
});
|
|
4827
|
+
return;
|
|
4828
|
+
}
|
|
4829
|
+
if (nodeName === "PathExpression") {
|
|
4830
|
+
const filterBase = getFilterBase(node);
|
|
4831
|
+
if (hasContextBase(node)) {
|
|
4832
|
+
forEachChild(node, (child) => collectInputs(child, filterCtx));
|
|
4833
|
+
} else if (filterBase) {
|
|
4834
|
+
collectInputs(filterBase, filterCtx);
|
|
4835
|
+
} else {
|
|
4836
|
+
const pathParts = collectPathParts(node, source);
|
|
4837
|
+
if (pathParts.length > 0 && isExternal(pathParts[0], filterCtx)) {
|
|
4838
|
+
inputs.add(pathParts.join("."));
|
|
4839
|
+
}
|
|
4840
|
+
}
|
|
4841
|
+
return;
|
|
4842
|
+
}
|
|
4843
|
+
if (nodeName === "VariableName" && node.parent?.name !== "PathExpression" && node.parent?.name !== "FunctionInvocation") {
|
|
4844
|
+
const varName = nodeText(node, source);
|
|
4845
|
+
const isImplicitFilterProp = filterCtx === "variable-list" && varName !== "item";
|
|
4846
|
+
if (isExternal(varName, filterCtx) && !isImplicitFilterProp) {
|
|
4847
|
+
inputs.add(varName);
|
|
4848
|
+
}
|
|
4849
|
+
return;
|
|
4850
|
+
}
|
|
4851
|
+
if (nodeName === "Context" && node.parent?.name !== "List") {
|
|
4852
|
+
withScope(localScopes, [], (scope) => {
|
|
4853
|
+
forEachChild(node, (child) => {
|
|
4854
|
+
if (child.name === "ContextEntry") {
|
|
4855
|
+
forEachChild(child, (entryChild) => {
|
|
4856
|
+
if (entryChild.name !== "Key")
|
|
4857
|
+
collectInputs(entryChild, filterCtx);
|
|
4858
|
+
});
|
|
4859
|
+
const keyName = child.getChild("Key")?.getChild("Name");
|
|
4860
|
+
if (keyName)
|
|
4861
|
+
scope.add(nodeText(keyName, source));
|
|
4862
|
+
}
|
|
4863
|
+
});
|
|
4864
|
+
});
|
|
4865
|
+
return;
|
|
4866
|
+
}
|
|
4867
|
+
if (nodeName === "FilterExpression") {
|
|
4868
|
+
let newFilterCtx = "none";
|
|
4869
|
+
const scopeNames = ["item"];
|
|
4870
|
+
const listNode = node.getChild("List");
|
|
4871
|
+
if (listNode) {
|
|
4872
|
+
forEachChild(listNode, (child) => {
|
|
4873
|
+
if (child.name === "Context") {
|
|
4874
|
+
scopeNames.push(...extractContextKeys(child, source));
|
|
4875
|
+
}
|
|
4876
|
+
});
|
|
4877
|
+
newFilterCtx = "list-literal";
|
|
4878
|
+
} else {
|
|
4879
|
+
forEachChild(node, (child) => {
|
|
4880
|
+
if (child.name === "VariableName") {
|
|
4881
|
+
collectInputs(child, "none");
|
|
4882
|
+
newFilterCtx = "variable-list";
|
|
4883
|
+
}
|
|
4884
|
+
});
|
|
4885
|
+
}
|
|
4886
|
+
withScope(localScopes, scopeNames, () => {
|
|
4887
|
+
forEachChild(node, (child) => {
|
|
4888
|
+
if (child.name === "Comparison" || child.name === "Expression") {
|
|
4889
|
+
collectInputs(child, newFilterCtx);
|
|
4890
|
+
}
|
|
4891
|
+
});
|
|
4892
|
+
});
|
|
4893
|
+
return;
|
|
4894
|
+
}
|
|
4895
|
+
if (nodeName === "ForExpression" || nodeName === "QuantifiedExpression") {
|
|
4896
|
+
const iterVars = collectIterationVariables(node, source);
|
|
4897
|
+
const inExp = node.getChild("InExpressions");
|
|
4898
|
+
if (inExp) {
|
|
4899
|
+
forEachChild(inExp, (child) => {
|
|
4900
|
+
if (child.name === "InExpression") {
|
|
4901
|
+
forEachChild(child, (innerChild) => {
|
|
4902
|
+
if (innerChild.name !== "Name" && innerChild.name !== "in" && innerChild.name !== "Identifier") {
|
|
4903
|
+
collectInputs(innerChild, filterCtx);
|
|
4904
|
+
}
|
|
4905
|
+
});
|
|
4906
|
+
}
|
|
4907
|
+
});
|
|
4908
|
+
}
|
|
4909
|
+
withScope(localScopes, iterVars, () => {
|
|
4910
|
+
forEachChild(node, (child) => {
|
|
4911
|
+
if (!ITERATION_KEYWORDS$1.has(child.name)) {
|
|
4912
|
+
collectInputs(child, "none");
|
|
4913
|
+
}
|
|
4914
|
+
});
|
|
4915
|
+
});
|
|
4916
|
+
return;
|
|
4917
|
+
}
|
|
4918
|
+
if (nodeName === "FunctionDefinition") {
|
|
4919
|
+
const params = collectFunctionParameters(node, source);
|
|
4920
|
+
withScope(localScopes, params, () => {
|
|
4921
|
+
const body = node.getChild("FunctionBody");
|
|
4922
|
+
if (body)
|
|
4923
|
+
collectInputs(body, "none");
|
|
4924
|
+
});
|
|
4925
|
+
return;
|
|
4926
|
+
}
|
|
4927
|
+
forEachChild(node, (child) => collectInputs(child, filterCtx));
|
|
4928
|
+
};
|
|
4929
|
+
collectInputs(node);
|
|
4930
|
+
return Array.from(inputs).sort();
|
|
4931
|
+
}
|
|
4932
|
+
function initializeInputVariables(collectedInputs) {
|
|
4933
|
+
const variables = [];
|
|
4934
|
+
for (const input of collectedInputs) {
|
|
4935
|
+
buildNestedEntries(variables, input.split("."));
|
|
4936
|
+
}
|
|
4937
|
+
return variables;
|
|
4938
|
+
}
|
|
4939
|
+
function checkLiteralsInNode(node) {
|
|
4940
|
+
let hasString = false;
|
|
4941
|
+
let hasNumber = false;
|
|
4942
|
+
forEachChild(node, (child) => {
|
|
4943
|
+
if (child.name === "StringLiteral")
|
|
4944
|
+
hasString = true;
|
|
4945
|
+
else if (child.name === "NumericLiteral")
|
|
4946
|
+
hasNumber = true;
|
|
4947
|
+
else if (child.name === "ArithmeticExpression") {
|
|
4948
|
+
const nested = checkLiteralsInNode(child);
|
|
4949
|
+
hasString = hasString || nested.hasString;
|
|
4950
|
+
hasNumber = hasNumber || nested.hasNumber;
|
|
4951
|
+
}
|
|
4952
|
+
});
|
|
4953
|
+
return { hasString, hasNumber };
|
|
4954
|
+
}
|
|
4955
|
+
function inferTypeForVariablesInNode(node, source, inputs, localScopes, inferredType) {
|
|
4956
|
+
if (node.name === "VariableName" && node.parent?.name !== "PathExpression") {
|
|
4957
|
+
const varName = nodeText(node, source);
|
|
4958
|
+
const variable = findVariable(inputs, varName);
|
|
4959
|
+
if (!isInScope(varName, localScopes) && variable && !variable.type) {
|
|
4960
|
+
variable.type = inferredType;
|
|
4961
|
+
}
|
|
4962
|
+
} else if (node.name === "PathExpression") {
|
|
4963
|
+
const pathParts = collectPathParts(node, source);
|
|
4964
|
+
if (pathParts.length > 0) {
|
|
4965
|
+
const rootVar = pathParts[0];
|
|
4966
|
+
const variable = findVariable(inputs, rootVar);
|
|
4967
|
+
if (!isInScope(rootVar, localScopes) && variable && !variable.type) {
|
|
4968
|
+
variable.type = inferredType;
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
} else {
|
|
4972
|
+
forEachChild(node, (child) => {
|
|
4973
|
+
inferTypeForVariablesInNode(child, source, inputs, localScopes, inferredType);
|
|
4974
|
+
});
|
|
4975
|
+
}
|
|
4976
|
+
}
|
|
4977
|
+
function trackFilterItemProperties(node, source, listVarName, inputs, localScopes) {
|
|
4978
|
+
const listVar = listVarName ? findVariable(inputs, listVarName) : null;
|
|
4979
|
+
if (!listVar)
|
|
4980
|
+
return;
|
|
4981
|
+
const visit = (node) => {
|
|
4982
|
+
if (listVar.type !== "List")
|
|
4983
|
+
return;
|
|
4984
|
+
if (node.name === "PathExpression") {
|
|
4985
|
+
const pathParts = collectPathParts(node, source);
|
|
4986
|
+
if (pathParts.length > 1 && pathParts[0] === "item") {
|
|
4987
|
+
const entries = listVar.entries || [];
|
|
4988
|
+
for (let i = 1;i < pathParts.length; i++) {
|
|
4989
|
+
if (!findVariable(entries, pathParts[i])) {
|
|
4990
|
+
entries.push({ name: pathParts[i] });
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4993
|
+
listVar.entries = entries;
|
|
4994
|
+
}
|
|
4995
|
+
} else if (node.name === "VariableName") {
|
|
4996
|
+
const varName = nodeText(node, source);
|
|
4997
|
+
if (!isInScope(varName, localScopes) && varName !== "item" && node.parent?.name !== "PathExpression") {
|
|
4998
|
+
const entries = listVar.entries || [];
|
|
4999
|
+
if (!findVariable(entries, varName)) {
|
|
5000
|
+
entries.push({ name: varName });
|
|
5001
|
+
}
|
|
5002
|
+
listVar.entries = entries;
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
forEachChild(node, visit);
|
|
5006
|
+
};
|
|
5007
|
+
visit(node);
|
|
5008
|
+
}
|
|
5009
|
+
function inferTypeFromComparison(varNode, literalNode, source, inputs, localScopes) {
|
|
5010
|
+
if (varNode.name !== "VariableName")
|
|
5011
|
+
return;
|
|
5012
|
+
const varName = nodeText(varNode, source);
|
|
5013
|
+
const variable = findVariable(inputs, varName);
|
|
5014
|
+
if (isInScope(varName, localScopes) || !variable)
|
|
5015
|
+
return;
|
|
5016
|
+
if (variable.type)
|
|
5017
|
+
return;
|
|
5018
|
+
const literalTypeMap = {
|
|
5019
|
+
NumericLiteral: "Number",
|
|
5020
|
+
StringLiteral: "String",
|
|
5021
|
+
BooleanLiteral: "Boolean"
|
|
5022
|
+
};
|
|
5023
|
+
const inferred = literalTypeMap[literalNode.name];
|
|
5024
|
+
if (inferred)
|
|
5025
|
+
variable.type = inferred;
|
|
5026
|
+
}
|
|
5027
|
+
function inferTypes(node, source, inputs, localScopes, filterCtx = "none") {
|
|
5028
|
+
const { name: nodeName } = node;
|
|
5029
|
+
if (nodeName === "PathExpression") {
|
|
5030
|
+
const first = node.firstChild;
|
|
5031
|
+
if (first?.name === "Context" || first?.name === "PathExpression" || first?.name === "FilterExpression") {
|
|
5032
|
+
inferTypes(first, source, inputs, localScopes, filterCtx);
|
|
5033
|
+
return;
|
|
5034
|
+
}
|
|
5035
|
+
const pathParts = collectPathParts(node, source);
|
|
5036
|
+
if (pathParts.length > 0) {
|
|
5037
|
+
const rootVar = pathParts[0];
|
|
5038
|
+
if (!isInScope(rootVar, localScopes) && !(filterCtx !== "none" && rootVar === "item") && findVariable(inputs, rootVar)) {
|
|
5039
|
+
buildNestedEntries(inputs, pathParts);
|
|
5040
|
+
}
|
|
5041
|
+
}
|
|
5042
|
+
return;
|
|
5043
|
+
}
|
|
5044
|
+
if (nodeName === "Context" && node.parent?.name !== "List") {
|
|
5045
|
+
withScope(localScopes, [], (scope) => {
|
|
5046
|
+
forEachChild(node, (child) => {
|
|
5047
|
+
if (child.name === "ContextEntry") {
|
|
5048
|
+
forEachChild(child, (innerChild) => {
|
|
5049
|
+
if (innerChild.name !== "Key") {
|
|
5050
|
+
inferTypes(innerChild, source, inputs, localScopes, filterCtx);
|
|
5051
|
+
}
|
|
5052
|
+
});
|
|
5053
|
+
const keyName = child.getChild("Key")?.getChild("Name");
|
|
5054
|
+
if (keyName)
|
|
5055
|
+
scope.add(nodeText(keyName, source));
|
|
5056
|
+
}
|
|
5057
|
+
});
|
|
5058
|
+
});
|
|
5059
|
+
return;
|
|
5060
|
+
}
|
|
5061
|
+
if (nodeName === "FilterExpression") {
|
|
5062
|
+
let newFilterCtx = "none";
|
|
5063
|
+
let listVarName = null;
|
|
5064
|
+
const scopeNames = ["item"];
|
|
5065
|
+
const listNode = node.getChild("List");
|
|
5066
|
+
if (listNode) {
|
|
5067
|
+
forEachChild(listNode, (child) => {
|
|
5068
|
+
if (child.name === "Context") {
|
|
5069
|
+
scopeNames.push(...extractContextKeys(child, source));
|
|
5070
|
+
}
|
|
5071
|
+
});
|
|
5072
|
+
newFilterCtx = "list-literal";
|
|
5073
|
+
} else {
|
|
5074
|
+
forEachChild(node, (child) => {
|
|
5075
|
+
if (child.name === "VariableName") {
|
|
5076
|
+
listVarName = nodeText(child, source);
|
|
5077
|
+
const variable = findVariable(inputs, listVarName);
|
|
5078
|
+
if (!isInScope(listVarName, localScopes) && variable) {
|
|
5079
|
+
if (!variable.type) {
|
|
5080
|
+
variable.type = "List";
|
|
5081
|
+
}
|
|
5082
|
+
}
|
|
5083
|
+
newFilterCtx = "variable-list";
|
|
5084
|
+
}
|
|
5085
|
+
});
|
|
5086
|
+
}
|
|
5087
|
+
withScope(localScopes, scopeNames, () => {
|
|
5088
|
+
forEachChild(node, (child) => {
|
|
5089
|
+
if (child.name === "Comparison" || child.name === "Expression") {
|
|
5090
|
+
trackFilterItemProperties(child, source, listVarName, inputs, localScopes);
|
|
5091
|
+
inferTypes(child, source, inputs, localScopes, newFilterCtx);
|
|
5092
|
+
}
|
|
5093
|
+
});
|
|
5094
|
+
});
|
|
5095
|
+
return;
|
|
5096
|
+
}
|
|
5097
|
+
if (nodeName === "Comparison") {
|
|
5098
|
+
const operands = [];
|
|
5099
|
+
forEachChild(node, (child) => {
|
|
5100
|
+
if (child.name !== "CompareOp")
|
|
5101
|
+
operands.push(child);
|
|
5102
|
+
});
|
|
5103
|
+
if (operands.length === 2) {
|
|
5104
|
+
inferTypeFromComparison(operands[0], operands[1], source, inputs, localScopes);
|
|
5105
|
+
inferTypeFromComparison(operands[1], operands[0], source, inputs, localScopes);
|
|
5106
|
+
}
|
|
5107
|
+
}
|
|
5108
|
+
if (nodeName === "ArithmeticExpression") {
|
|
5109
|
+
const { hasString, hasNumber } = checkLiteralsInNode(node);
|
|
5110
|
+
const inferredType = hasString && !hasNumber ? "String" : !hasString && hasNumber ? "Number" : null;
|
|
5111
|
+
if (inferredType) {
|
|
5112
|
+
inferTypeForVariablesInNode(node, source, inputs, localScopes, inferredType);
|
|
5113
|
+
}
|
|
5114
|
+
forEachChild(node, (child) => {
|
|
5115
|
+
if (!["ArithmeticExpression", "ArithOp", "NumericLiteral", "StringLiteral"].includes(child.name)) {
|
|
5116
|
+
inferTypes(child, source, inputs, localScopes, filterCtx);
|
|
5117
|
+
}
|
|
5118
|
+
});
|
|
5119
|
+
return;
|
|
5120
|
+
}
|
|
5121
|
+
if (nodeName === "ForExpression" || nodeName === "QuantifiedExpression") {
|
|
5122
|
+
const iterVars = collectIterationVariables(node, source);
|
|
5123
|
+
const inExp = node.getChild("InExpressions");
|
|
5124
|
+
if (inExp) {
|
|
5125
|
+
forEachChild(inExp, (child) => {
|
|
5126
|
+
if (child.name === "InExpression") {
|
|
5127
|
+
forEachChild(child, (innerChild) => {
|
|
5128
|
+
if (!["Name", "in", "Identifier"].includes(innerChild.name)) {
|
|
5129
|
+
inferTypes(innerChild, source, inputs, localScopes, filterCtx);
|
|
5130
|
+
}
|
|
5131
|
+
});
|
|
5132
|
+
}
|
|
5133
|
+
});
|
|
5134
|
+
}
|
|
5135
|
+
withScope(localScopes, iterVars, () => {
|
|
5136
|
+
forEachChild(node, (child) => {
|
|
5137
|
+
if (!ITERATION_KEYWORDS$1.has(child.name)) {
|
|
5138
|
+
inferTypes(child, source, inputs, localScopes, "none");
|
|
5139
|
+
}
|
|
5140
|
+
});
|
|
5141
|
+
});
|
|
5142
|
+
return;
|
|
5143
|
+
}
|
|
5144
|
+
if (nodeName === "FunctionDefinition") {
|
|
5145
|
+
const params = collectFunctionParameters(node, source);
|
|
5146
|
+
withScope(localScopes, params, () => {
|
|
5147
|
+
const body = node.getChild("FunctionBody");
|
|
5148
|
+
if (body)
|
|
5149
|
+
inferTypes(body, source, inputs, localScopes, "none");
|
|
5150
|
+
});
|
|
5151
|
+
return;
|
|
5152
|
+
}
|
|
5153
|
+
forEachChild(node, (child) => {
|
|
5154
|
+
inferTypes(child, source, inputs, localScopes, filterCtx);
|
|
5155
|
+
});
|
|
5156
|
+
}
|
|
5157
|
+
function analyzeForInputs(node, source, builtinNames) {
|
|
5158
|
+
const collectedInputs = extractInputNames(node, source, builtinNames);
|
|
5159
|
+
const inputs = initializeInputVariables(collectedInputs);
|
|
5160
|
+
const localScopes = [new Set];
|
|
5161
|
+
inferTypes(node, source, inputs, localScopes);
|
|
5162
|
+
for (const variable of inputs) {
|
|
5163
|
+
sortEntries(variable);
|
|
5164
|
+
}
|
|
5165
|
+
inputs.sort((a, b) => a.name.localeCompare(b.name));
|
|
5166
|
+
return inputs;
|
|
5167
|
+
}
|
|
5168
|
+
var ITERATION_KEYWORDS = new Set(["for", "return", "some", "every", "InExpressions", "satisfies"]);
|
|
5169
|
+
function analyzeForFunctions(node, source, builtinNames) {
|
|
5170
|
+
const functions = [];
|
|
5171
|
+
const scopes = [];
|
|
5172
|
+
const recordInvocation = (funcNameNode) => {
|
|
5173
|
+
const name = nodeText(funcNameNode, source);
|
|
5174
|
+
const type = !isInScope(name, scopes) && builtinNames.has(name) ? "builtin" : "user";
|
|
5175
|
+
const { from, to } = funcNameNode;
|
|
5176
|
+
functions.push({ name, type, from, to });
|
|
5177
|
+
};
|
|
5178
|
+
const walk = (n) => {
|
|
5179
|
+
const { name: nodeName } = n;
|
|
5180
|
+
if (nodeName === "Context") {
|
|
5181
|
+
withScope(scopes, [], (scope) => {
|
|
5182
|
+
forEachChild(n, (child) => {
|
|
5183
|
+
if (child.name !== "ContextEntry")
|
|
5184
|
+
return;
|
|
5185
|
+
forEachChild(child, (entryChild) => {
|
|
5186
|
+
if (entryChild.name !== "Key")
|
|
5187
|
+
walk(entryChild);
|
|
5188
|
+
});
|
|
5189
|
+
const keyName = child.getChild("Key")?.getChild("Name");
|
|
5190
|
+
if (keyName)
|
|
5191
|
+
scope.add(nodeText(keyName, source));
|
|
5192
|
+
});
|
|
5193
|
+
});
|
|
5194
|
+
return;
|
|
5195
|
+
}
|
|
5196
|
+
if (nodeName === "FunctionDefinition") {
|
|
5197
|
+
const params = collectFunctionParameters(n, source);
|
|
5198
|
+
withScope(scopes, params, () => {
|
|
5199
|
+
const body = n.getChild("FunctionBody");
|
|
5200
|
+
if (body)
|
|
5201
|
+
walk(body);
|
|
5202
|
+
});
|
|
5203
|
+
return;
|
|
5204
|
+
}
|
|
5205
|
+
if (nodeName === "ForExpression" || nodeName === "QuantifiedExpression") {
|
|
5206
|
+
const inExp = n.getChild("InExpressions");
|
|
5207
|
+
if (inExp) {
|
|
5208
|
+
forEachChild(inExp, (child) => {
|
|
5209
|
+
if (child.name === "InExpression") {
|
|
5210
|
+
forEachChild(child, (innerChild) => {
|
|
5211
|
+
if (innerChild.name !== "Name" && innerChild.name !== "in" && innerChild.name !== "Identifier") {
|
|
5212
|
+
walk(innerChild);
|
|
5213
|
+
}
|
|
5214
|
+
});
|
|
5215
|
+
}
|
|
5216
|
+
});
|
|
5217
|
+
}
|
|
5218
|
+
withScope(scopes, collectIterationVariables(n, source), () => {
|
|
5219
|
+
forEachChild(n, (child) => {
|
|
5220
|
+
if (!ITERATION_KEYWORDS.has(child.name))
|
|
5221
|
+
walk(child);
|
|
5222
|
+
});
|
|
5223
|
+
});
|
|
5224
|
+
return;
|
|
5225
|
+
}
|
|
5226
|
+
if (nodeName === "FunctionInvocation") {
|
|
5227
|
+
const funcNameNode = n.getChild("VariableName");
|
|
5228
|
+
if (funcNameNode)
|
|
5229
|
+
recordInvocation(funcNameNode);
|
|
5230
|
+
}
|
|
5231
|
+
forEachChild(n, walk);
|
|
5232
|
+
};
|
|
5233
|
+
walk(node);
|
|
5234
|
+
return functions.sort((a, b) => a.from - b.from);
|
|
5235
|
+
}
|
|
5236
|
+
function analyzeForValidity(node) {
|
|
5237
|
+
return !containsErrorNodes(node);
|
|
5238
|
+
}
|
|
5239
|
+
function containsErrorNodes(node) {
|
|
5240
|
+
if (node.type.isError) {
|
|
5241
|
+
return true;
|
|
5242
|
+
}
|
|
5243
|
+
let child = node.firstChild;
|
|
5244
|
+
while (child) {
|
|
5245
|
+
if (containsErrorNodes(child)) {
|
|
5246
|
+
return true;
|
|
5247
|
+
}
|
|
5248
|
+
child = child.nextSibling;
|
|
5249
|
+
}
|
|
5250
|
+
return false;
|
|
5251
|
+
}
|
|
5252
|
+
function createContext(variables) {
|
|
5253
|
+
return variables.reduce((context, variable) => {
|
|
5254
|
+
context[variable.name] = () => {};
|
|
5255
|
+
return context;
|
|
5256
|
+
}, {});
|
|
5257
|
+
}
|
|
5258
|
+
|
|
5259
|
+
class FeelAnalyzer {
|
|
5260
|
+
constructor(options = {}) {
|
|
5261
|
+
this.builtinNames = new Set(options.builtins?.map((b) => b.name) ?? []);
|
|
5262
|
+
const config = {
|
|
5263
|
+
top: options.dialect === "unaryTests" ? "UnaryTests" : "Expression",
|
|
5264
|
+
dialect: options.parserDialect
|
|
5265
|
+
};
|
|
5266
|
+
if (options.reservedNameBuiltins && options.reservedNameBuiltins.length > 0) {
|
|
5267
|
+
config.contextTracker = trackVariables(createContext(options.reservedNameBuiltins));
|
|
5268
|
+
}
|
|
5269
|
+
this.parser = parser.configure(config);
|
|
5270
|
+
}
|
|
5271
|
+
analyzeExpression(expression) {
|
|
5272
|
+
const tree = this.parser.parse(expression);
|
|
5273
|
+
return this.analyzeTree(tree, expression);
|
|
5274
|
+
}
|
|
5275
|
+
analyzeTree(tree, source) {
|
|
5276
|
+
const node = tree.topNode;
|
|
5277
|
+
return {
|
|
5278
|
+
valid: analyzeForValidity(node),
|
|
5279
|
+
inputs: analyzeForInputs(node, source, this.builtinNames),
|
|
5280
|
+
functions: analyzeForFunctions(node, source, this.builtinNames)
|
|
5281
|
+
};
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
|
|
5285
|
+
// ../../node_modules/@bpmn-io/semver-compat/dist/index.js
|
|
5286
|
+
var re = { exports: {} };
|
|
5287
|
+
var constants;
|
|
5288
|
+
var hasRequiredConstants;
|
|
5289
|
+
function requireConstants() {
|
|
5290
|
+
if (hasRequiredConstants)
|
|
5291
|
+
return constants;
|
|
5292
|
+
hasRequiredConstants = 1;
|
|
5293
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
5294
|
+
const MAX_LENGTH = 256;
|
|
5295
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
5296
|
+
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
5297
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
5298
|
+
const RELEASE_TYPES = [
|
|
5299
|
+
"major",
|
|
5300
|
+
"premajor",
|
|
5301
|
+
"minor",
|
|
5302
|
+
"preminor",
|
|
5303
|
+
"patch",
|
|
5304
|
+
"prepatch",
|
|
5305
|
+
"prerelease"
|
|
5306
|
+
];
|
|
5307
|
+
constants = {
|
|
5308
|
+
MAX_LENGTH,
|
|
5309
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
5310
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
5311
|
+
MAX_SAFE_INTEGER,
|
|
5312
|
+
RELEASE_TYPES,
|
|
5313
|
+
SEMVER_SPEC_VERSION,
|
|
5314
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
5315
|
+
FLAG_LOOSE: 2
|
|
5316
|
+
};
|
|
5317
|
+
return constants;
|
|
5318
|
+
}
|
|
5319
|
+
var debug_1;
|
|
5320
|
+
var hasRequiredDebug;
|
|
5321
|
+
function requireDebug() {
|
|
5322
|
+
if (hasRequiredDebug)
|
|
5323
|
+
return debug_1;
|
|
5324
|
+
hasRequiredDebug = 1;
|
|
5325
|
+
const debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
5326
|
+
debug_1 = debug;
|
|
5327
|
+
return debug_1;
|
|
5328
|
+
}
|
|
5329
|
+
var hasRequiredRe;
|
|
5330
|
+
function requireRe() {
|
|
5331
|
+
if (hasRequiredRe)
|
|
5332
|
+
return re.exports;
|
|
5333
|
+
hasRequiredRe = 1;
|
|
5334
|
+
(function(module, exports$1) {
|
|
5335
|
+
const {
|
|
5336
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
5337
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
5338
|
+
MAX_LENGTH
|
|
5339
|
+
} = requireConstants();
|
|
5340
|
+
const debug = requireDebug();
|
|
5341
|
+
exports$1 = module.exports = {};
|
|
5342
|
+
const re = exports$1.re = [];
|
|
5343
|
+
const safeRe = exports$1.safeRe = [];
|
|
5344
|
+
const src = exports$1.src = [];
|
|
5345
|
+
const safeSrc = exports$1.safeSrc = [];
|
|
5346
|
+
const t = exports$1.t = {};
|
|
5347
|
+
let R = 0;
|
|
5348
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
5349
|
+
const safeRegexReplacements = [
|
|
5350
|
+
["\\s", 1],
|
|
5351
|
+
["\\d", MAX_LENGTH],
|
|
5352
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
5353
|
+
];
|
|
5354
|
+
const makeSafeRegex = (value) => {
|
|
5355
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
5356
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
5357
|
+
}
|
|
5358
|
+
return value;
|
|
5359
|
+
};
|
|
5360
|
+
const createToken = (name, value, isGlobal) => {
|
|
5361
|
+
const safe = makeSafeRegex(value);
|
|
5362
|
+
const index = R++;
|
|
5363
|
+
debug(name, index, value);
|
|
5364
|
+
t[name] = index;
|
|
5365
|
+
src[index] = value;
|
|
5366
|
+
safeSrc[index] = safe;
|
|
5367
|
+
re[index] = new RegExp(value, isGlobal ? "g" : undefined);
|
|
5368
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined);
|
|
5369
|
+
};
|
|
5370
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
5371
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
5372
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
5373
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
|
|
5374
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
5375
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
5376
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
5377
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
5378
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
5379
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
5380
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
5381
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
5382
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
5383
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
5384
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
5385
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
5386
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
5387
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
5388
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
5389
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
5390
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
5391
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
5392
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])" + "(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
5393
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
5394
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
|
|
5395
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
5396
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
5397
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
5398
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
5399
|
+
exports$1.tildeTrimReplace = "$1~";
|
|
5400
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
5401
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
5402
|
+
createToken("LONECARET", "(?:\\^)");
|
|
5403
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
5404
|
+
exports$1.caretTrimReplace = "$1^";
|
|
5405
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
5406
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
5407
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
5408
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
5409
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
5410
|
+
exports$1.comparatorTrimReplace = "$1$2$3";
|
|
5411
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
|
|
5412
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`);
|
|
5413
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
5414
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
5415
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
5416
|
+
})(re, re.exports);
|
|
5417
|
+
return re.exports;
|
|
5418
|
+
}
|
|
5419
|
+
var parseOptions_1;
|
|
5420
|
+
var hasRequiredParseOptions;
|
|
5421
|
+
function requireParseOptions() {
|
|
5422
|
+
if (hasRequiredParseOptions)
|
|
5423
|
+
return parseOptions_1;
|
|
5424
|
+
hasRequiredParseOptions = 1;
|
|
5425
|
+
const looseOption = Object.freeze({ loose: true });
|
|
5426
|
+
const emptyOpts = Object.freeze({});
|
|
5427
|
+
const parseOptions = (options) => {
|
|
5428
|
+
if (!options) {
|
|
5429
|
+
return emptyOpts;
|
|
5430
|
+
}
|
|
5431
|
+
if (typeof options !== "object") {
|
|
5432
|
+
return looseOption;
|
|
5433
|
+
}
|
|
5434
|
+
return options;
|
|
5435
|
+
};
|
|
5436
|
+
parseOptions_1 = parseOptions;
|
|
5437
|
+
return parseOptions_1;
|
|
5438
|
+
}
|
|
5439
|
+
var identifiers;
|
|
5440
|
+
var hasRequiredIdentifiers;
|
|
5441
|
+
function requireIdentifiers() {
|
|
5442
|
+
if (hasRequiredIdentifiers)
|
|
5443
|
+
return identifiers;
|
|
5444
|
+
hasRequiredIdentifiers = 1;
|
|
5445
|
+
const numeric = /^[0-9]+$/;
|
|
5446
|
+
const compareIdentifiers = (a, b) => {
|
|
5447
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
5448
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
5449
|
+
}
|
|
5450
|
+
const anum = numeric.test(a);
|
|
5451
|
+
const bnum = numeric.test(b);
|
|
5452
|
+
if (anum && bnum) {
|
|
5453
|
+
a = +a;
|
|
5454
|
+
b = +b;
|
|
5455
|
+
}
|
|
5456
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
5457
|
+
};
|
|
5458
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
5459
|
+
identifiers = {
|
|
5460
|
+
compareIdentifiers,
|
|
5461
|
+
rcompareIdentifiers
|
|
5462
|
+
};
|
|
5463
|
+
return identifiers;
|
|
5464
|
+
}
|
|
5465
|
+
var semver$1;
|
|
5466
|
+
var hasRequiredSemver$1;
|
|
5467
|
+
function requireSemver$1() {
|
|
5468
|
+
if (hasRequiredSemver$1)
|
|
5469
|
+
return semver$1;
|
|
5470
|
+
hasRequiredSemver$1 = 1;
|
|
5471
|
+
const debug = requireDebug();
|
|
5472
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
|
|
5473
|
+
const { safeRe: re, t } = requireRe();
|
|
5474
|
+
const parseOptions = requireParseOptions();
|
|
5475
|
+
const { compareIdentifiers } = requireIdentifiers();
|
|
4613
5476
|
|
|
4614
|
-
|
|
5477
|
+
class SemVer {
|
|
5478
|
+
constructor(version, options) {
|
|
5479
|
+
options = parseOptions(options);
|
|
5480
|
+
if (version instanceof SemVer) {
|
|
5481
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
5482
|
+
return version;
|
|
5483
|
+
} else {
|
|
5484
|
+
version = version.version;
|
|
5485
|
+
}
|
|
5486
|
+
} else if (typeof version !== "string") {
|
|
5487
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
5488
|
+
}
|
|
5489
|
+
if (version.length > MAX_LENGTH) {
|
|
5490
|
+
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
5491
|
+
}
|
|
5492
|
+
debug("SemVer", version, options);
|
|
5493
|
+
this.options = options;
|
|
5494
|
+
this.loose = !!options.loose;
|
|
5495
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
5496
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
5497
|
+
if (!m) {
|
|
5498
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
5499
|
+
}
|
|
5500
|
+
this.raw = version;
|
|
5501
|
+
this.major = +m[1];
|
|
5502
|
+
this.minor = +m[2];
|
|
5503
|
+
this.patch = +m[3];
|
|
5504
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
5505
|
+
throw new TypeError("Invalid major version");
|
|
5506
|
+
}
|
|
5507
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
5508
|
+
throw new TypeError("Invalid minor version");
|
|
5509
|
+
}
|
|
5510
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
5511
|
+
throw new TypeError("Invalid patch version");
|
|
5512
|
+
}
|
|
5513
|
+
if (!m[4]) {
|
|
5514
|
+
this.prerelease = [];
|
|
5515
|
+
} else {
|
|
5516
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
5517
|
+
if (/^[0-9]+$/.test(id)) {
|
|
5518
|
+
const num = +id;
|
|
5519
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
5520
|
+
return num;
|
|
5521
|
+
}
|
|
5522
|
+
}
|
|
5523
|
+
return id;
|
|
5524
|
+
});
|
|
5525
|
+
}
|
|
5526
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
5527
|
+
this.format();
|
|
5528
|
+
}
|
|
5529
|
+
format() {
|
|
5530
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
5531
|
+
if (this.prerelease.length) {
|
|
5532
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
5533
|
+
}
|
|
5534
|
+
return this.version;
|
|
5535
|
+
}
|
|
5536
|
+
toString() {
|
|
5537
|
+
return this.version;
|
|
5538
|
+
}
|
|
5539
|
+
compare(other) {
|
|
5540
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
5541
|
+
if (!(other instanceof SemVer)) {
|
|
5542
|
+
if (typeof other === "string" && other === this.version) {
|
|
5543
|
+
return 0;
|
|
5544
|
+
}
|
|
5545
|
+
other = new SemVer(other, this.options);
|
|
5546
|
+
}
|
|
5547
|
+
if (other.version === this.version) {
|
|
5548
|
+
return 0;
|
|
5549
|
+
}
|
|
5550
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
5551
|
+
}
|
|
5552
|
+
compareMain(other) {
|
|
5553
|
+
if (!(other instanceof SemVer)) {
|
|
5554
|
+
other = new SemVer(other, this.options);
|
|
5555
|
+
}
|
|
5556
|
+
if (this.major < other.major) {
|
|
5557
|
+
return -1;
|
|
5558
|
+
}
|
|
5559
|
+
if (this.major > other.major) {
|
|
5560
|
+
return 1;
|
|
5561
|
+
}
|
|
5562
|
+
if (this.minor < other.minor) {
|
|
5563
|
+
return -1;
|
|
5564
|
+
}
|
|
5565
|
+
if (this.minor > other.minor) {
|
|
5566
|
+
return 1;
|
|
5567
|
+
}
|
|
5568
|
+
if (this.patch < other.patch) {
|
|
5569
|
+
return -1;
|
|
5570
|
+
}
|
|
5571
|
+
if (this.patch > other.patch) {
|
|
5572
|
+
return 1;
|
|
5573
|
+
}
|
|
5574
|
+
return 0;
|
|
5575
|
+
}
|
|
5576
|
+
comparePre(other) {
|
|
5577
|
+
if (!(other instanceof SemVer)) {
|
|
5578
|
+
other = new SemVer(other, this.options);
|
|
5579
|
+
}
|
|
5580
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
5581
|
+
return -1;
|
|
5582
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
5583
|
+
return 1;
|
|
5584
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
5585
|
+
return 0;
|
|
5586
|
+
}
|
|
5587
|
+
let i = 0;
|
|
5588
|
+
do {
|
|
5589
|
+
const a = this.prerelease[i];
|
|
5590
|
+
const b = other.prerelease[i];
|
|
5591
|
+
debug("prerelease compare", i, a, b);
|
|
5592
|
+
if (a === undefined && b === undefined) {
|
|
5593
|
+
return 0;
|
|
5594
|
+
} else if (b === undefined) {
|
|
5595
|
+
return 1;
|
|
5596
|
+
} else if (a === undefined) {
|
|
5597
|
+
return -1;
|
|
5598
|
+
} else if (a === b) {
|
|
5599
|
+
continue;
|
|
5600
|
+
} else {
|
|
5601
|
+
return compareIdentifiers(a, b);
|
|
5602
|
+
}
|
|
5603
|
+
} while (++i);
|
|
5604
|
+
}
|
|
5605
|
+
compareBuild(other) {
|
|
5606
|
+
if (!(other instanceof SemVer)) {
|
|
5607
|
+
other = new SemVer(other, this.options);
|
|
5608
|
+
}
|
|
5609
|
+
let i = 0;
|
|
5610
|
+
do {
|
|
5611
|
+
const a = this.build[i];
|
|
5612
|
+
const b = other.build[i];
|
|
5613
|
+
debug("build compare", i, a, b);
|
|
5614
|
+
if (a === undefined && b === undefined) {
|
|
5615
|
+
return 0;
|
|
5616
|
+
} else if (b === undefined) {
|
|
5617
|
+
return 1;
|
|
5618
|
+
} else if (a === undefined) {
|
|
5619
|
+
return -1;
|
|
5620
|
+
} else if (a === b) {
|
|
5621
|
+
continue;
|
|
5622
|
+
} else {
|
|
5623
|
+
return compareIdentifiers(a, b);
|
|
5624
|
+
}
|
|
5625
|
+
} while (++i);
|
|
5626
|
+
}
|
|
5627
|
+
inc(release, identifier, identifierBase) {
|
|
5628
|
+
if (release.startsWith("pre")) {
|
|
5629
|
+
if (!identifier && identifierBase === false) {
|
|
5630
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
5631
|
+
}
|
|
5632
|
+
if (identifier) {
|
|
5633
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
5634
|
+
if (!match || match[1] !== identifier) {
|
|
5635
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
5636
|
+
}
|
|
5637
|
+
}
|
|
5638
|
+
}
|
|
5639
|
+
switch (release) {
|
|
5640
|
+
case "premajor":
|
|
5641
|
+
this.prerelease.length = 0;
|
|
5642
|
+
this.patch = 0;
|
|
5643
|
+
this.minor = 0;
|
|
5644
|
+
this.major++;
|
|
5645
|
+
this.inc("pre", identifier, identifierBase);
|
|
5646
|
+
break;
|
|
5647
|
+
case "preminor":
|
|
5648
|
+
this.prerelease.length = 0;
|
|
5649
|
+
this.patch = 0;
|
|
5650
|
+
this.minor++;
|
|
5651
|
+
this.inc("pre", identifier, identifierBase);
|
|
5652
|
+
break;
|
|
5653
|
+
case "prepatch":
|
|
5654
|
+
this.prerelease.length = 0;
|
|
5655
|
+
this.inc("patch", identifier, identifierBase);
|
|
5656
|
+
this.inc("pre", identifier, identifierBase);
|
|
5657
|
+
break;
|
|
5658
|
+
case "prerelease":
|
|
5659
|
+
if (this.prerelease.length === 0) {
|
|
5660
|
+
this.inc("patch", identifier, identifierBase);
|
|
5661
|
+
}
|
|
5662
|
+
this.inc("pre", identifier, identifierBase);
|
|
5663
|
+
break;
|
|
5664
|
+
case "release":
|
|
5665
|
+
if (this.prerelease.length === 0) {
|
|
5666
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
5667
|
+
}
|
|
5668
|
+
this.prerelease.length = 0;
|
|
5669
|
+
break;
|
|
5670
|
+
case "major":
|
|
5671
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
5672
|
+
this.major++;
|
|
5673
|
+
}
|
|
5674
|
+
this.minor = 0;
|
|
5675
|
+
this.patch = 0;
|
|
5676
|
+
this.prerelease = [];
|
|
5677
|
+
break;
|
|
5678
|
+
case "minor":
|
|
5679
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
5680
|
+
this.minor++;
|
|
5681
|
+
}
|
|
5682
|
+
this.patch = 0;
|
|
5683
|
+
this.prerelease = [];
|
|
5684
|
+
break;
|
|
5685
|
+
case "patch":
|
|
5686
|
+
if (this.prerelease.length === 0) {
|
|
5687
|
+
this.patch++;
|
|
5688
|
+
}
|
|
5689
|
+
this.prerelease = [];
|
|
5690
|
+
break;
|
|
5691
|
+
case "pre": {
|
|
5692
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
5693
|
+
if (this.prerelease.length === 0) {
|
|
5694
|
+
this.prerelease = [base];
|
|
5695
|
+
} else {
|
|
5696
|
+
let i = this.prerelease.length;
|
|
5697
|
+
while (--i >= 0) {
|
|
5698
|
+
if (typeof this.prerelease[i] === "number") {
|
|
5699
|
+
this.prerelease[i]++;
|
|
5700
|
+
i = -2;
|
|
5701
|
+
}
|
|
5702
|
+
}
|
|
5703
|
+
if (i === -1) {
|
|
5704
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
5705
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
5706
|
+
}
|
|
5707
|
+
this.prerelease.push(base);
|
|
5708
|
+
}
|
|
5709
|
+
}
|
|
5710
|
+
if (identifier) {
|
|
5711
|
+
let prerelease = [identifier, base];
|
|
5712
|
+
if (identifierBase === false) {
|
|
5713
|
+
prerelease = [identifier];
|
|
5714
|
+
}
|
|
5715
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
5716
|
+
if (isNaN(this.prerelease[1])) {
|
|
5717
|
+
this.prerelease = prerelease;
|
|
5718
|
+
}
|
|
5719
|
+
} else {
|
|
5720
|
+
this.prerelease = prerelease;
|
|
5721
|
+
}
|
|
5722
|
+
}
|
|
5723
|
+
break;
|
|
5724
|
+
}
|
|
5725
|
+
default:
|
|
5726
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
5727
|
+
}
|
|
5728
|
+
this.raw = this.format();
|
|
5729
|
+
if (this.build.length) {
|
|
5730
|
+
this.raw += `+${this.build.join(".")}`;
|
|
5731
|
+
}
|
|
5732
|
+
return this;
|
|
5733
|
+
}
|
|
5734
|
+
}
|
|
5735
|
+
semver$1 = SemVer;
|
|
5736
|
+
return semver$1;
|
|
5737
|
+
}
|
|
5738
|
+
var parse_1;
|
|
5739
|
+
var hasRequiredParse;
|
|
5740
|
+
function requireParse() {
|
|
5741
|
+
if (hasRequiredParse)
|
|
5742
|
+
return parse_1;
|
|
5743
|
+
hasRequiredParse = 1;
|
|
5744
|
+
const SemVer = requireSemver$1();
|
|
5745
|
+
const parse = (version, options, throwErrors = false) => {
|
|
5746
|
+
if (version instanceof SemVer) {
|
|
5747
|
+
return version;
|
|
5748
|
+
}
|
|
5749
|
+
try {
|
|
5750
|
+
return new SemVer(version, options);
|
|
5751
|
+
} catch (er) {
|
|
5752
|
+
if (!throwErrors) {
|
|
5753
|
+
return null;
|
|
5754
|
+
}
|
|
5755
|
+
throw er;
|
|
5756
|
+
}
|
|
5757
|
+
};
|
|
5758
|
+
parse_1 = parse;
|
|
5759
|
+
return parse_1;
|
|
5760
|
+
}
|
|
5761
|
+
var valid_1;
|
|
5762
|
+
var hasRequiredValid$1;
|
|
5763
|
+
function requireValid$1() {
|
|
5764
|
+
if (hasRequiredValid$1)
|
|
5765
|
+
return valid_1;
|
|
5766
|
+
hasRequiredValid$1 = 1;
|
|
5767
|
+
const parse = requireParse();
|
|
5768
|
+
const valid = (version, options) => {
|
|
5769
|
+
const v = parse(version, options);
|
|
5770
|
+
return v ? v.version : null;
|
|
5771
|
+
};
|
|
5772
|
+
valid_1 = valid;
|
|
5773
|
+
return valid_1;
|
|
5774
|
+
}
|
|
5775
|
+
var clean_1;
|
|
5776
|
+
var hasRequiredClean;
|
|
5777
|
+
function requireClean() {
|
|
5778
|
+
if (hasRequiredClean)
|
|
5779
|
+
return clean_1;
|
|
5780
|
+
hasRequiredClean = 1;
|
|
5781
|
+
const parse = requireParse();
|
|
5782
|
+
const clean = (version, options) => {
|
|
5783
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
5784
|
+
return s ? s.version : null;
|
|
5785
|
+
};
|
|
5786
|
+
clean_1 = clean;
|
|
5787
|
+
return clean_1;
|
|
5788
|
+
}
|
|
5789
|
+
var inc_1;
|
|
5790
|
+
var hasRequiredInc;
|
|
5791
|
+
function requireInc() {
|
|
5792
|
+
if (hasRequiredInc)
|
|
5793
|
+
return inc_1;
|
|
5794
|
+
hasRequiredInc = 1;
|
|
5795
|
+
const SemVer = requireSemver$1();
|
|
5796
|
+
const inc = (version, release, options, identifier, identifierBase) => {
|
|
5797
|
+
if (typeof options === "string") {
|
|
5798
|
+
identifierBase = identifier;
|
|
5799
|
+
identifier = options;
|
|
5800
|
+
options = undefined;
|
|
5801
|
+
}
|
|
5802
|
+
try {
|
|
5803
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
5804
|
+
} catch (er) {
|
|
5805
|
+
return null;
|
|
5806
|
+
}
|
|
5807
|
+
};
|
|
5808
|
+
inc_1 = inc;
|
|
5809
|
+
return inc_1;
|
|
5810
|
+
}
|
|
5811
|
+
var diff_1;
|
|
5812
|
+
var hasRequiredDiff;
|
|
5813
|
+
function requireDiff() {
|
|
5814
|
+
if (hasRequiredDiff)
|
|
5815
|
+
return diff_1;
|
|
5816
|
+
hasRequiredDiff = 1;
|
|
5817
|
+
const parse = requireParse();
|
|
5818
|
+
const diff = (version1, version2) => {
|
|
5819
|
+
const v1 = parse(version1, null, true);
|
|
5820
|
+
const v2 = parse(version2, null, true);
|
|
5821
|
+
const comparison = v1.compare(v2);
|
|
5822
|
+
if (comparison === 0) {
|
|
5823
|
+
return null;
|
|
5824
|
+
}
|
|
5825
|
+
const v1Higher = comparison > 0;
|
|
5826
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
5827
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
5828
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
5829
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
5830
|
+
if (lowHasPre && !highHasPre) {
|
|
5831
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
5832
|
+
return "major";
|
|
5833
|
+
}
|
|
5834
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
5835
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
5836
|
+
return "minor";
|
|
5837
|
+
}
|
|
5838
|
+
return "patch";
|
|
5839
|
+
}
|
|
5840
|
+
}
|
|
5841
|
+
const prefix = highHasPre ? "pre" : "";
|
|
5842
|
+
if (v1.major !== v2.major) {
|
|
5843
|
+
return prefix + "major";
|
|
5844
|
+
}
|
|
5845
|
+
if (v1.minor !== v2.minor) {
|
|
5846
|
+
return prefix + "minor";
|
|
5847
|
+
}
|
|
5848
|
+
if (v1.patch !== v2.patch) {
|
|
5849
|
+
return prefix + "patch";
|
|
5850
|
+
}
|
|
5851
|
+
return "prerelease";
|
|
5852
|
+
};
|
|
5853
|
+
diff_1 = diff;
|
|
5854
|
+
return diff_1;
|
|
5855
|
+
}
|
|
5856
|
+
var major_1;
|
|
5857
|
+
var hasRequiredMajor;
|
|
5858
|
+
function requireMajor() {
|
|
5859
|
+
if (hasRequiredMajor)
|
|
5860
|
+
return major_1;
|
|
5861
|
+
hasRequiredMajor = 1;
|
|
5862
|
+
const SemVer = requireSemver$1();
|
|
5863
|
+
const major = (a, loose) => new SemVer(a, loose).major;
|
|
5864
|
+
major_1 = major;
|
|
5865
|
+
return major_1;
|
|
5866
|
+
}
|
|
5867
|
+
var minor_1;
|
|
5868
|
+
var hasRequiredMinor;
|
|
5869
|
+
function requireMinor() {
|
|
5870
|
+
if (hasRequiredMinor)
|
|
5871
|
+
return minor_1;
|
|
5872
|
+
hasRequiredMinor = 1;
|
|
5873
|
+
const SemVer = requireSemver$1();
|
|
5874
|
+
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
5875
|
+
minor_1 = minor;
|
|
5876
|
+
return minor_1;
|
|
5877
|
+
}
|
|
5878
|
+
var patch_1;
|
|
5879
|
+
var hasRequiredPatch;
|
|
5880
|
+
function requirePatch() {
|
|
5881
|
+
if (hasRequiredPatch)
|
|
5882
|
+
return patch_1;
|
|
5883
|
+
hasRequiredPatch = 1;
|
|
5884
|
+
const SemVer = requireSemver$1();
|
|
5885
|
+
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
5886
|
+
patch_1 = patch;
|
|
5887
|
+
return patch_1;
|
|
5888
|
+
}
|
|
5889
|
+
var prerelease_1;
|
|
5890
|
+
var hasRequiredPrerelease;
|
|
5891
|
+
function requirePrerelease() {
|
|
5892
|
+
if (hasRequiredPrerelease)
|
|
5893
|
+
return prerelease_1;
|
|
5894
|
+
hasRequiredPrerelease = 1;
|
|
5895
|
+
const parse = requireParse();
|
|
5896
|
+
const prerelease = (version, options) => {
|
|
5897
|
+
const parsed = parse(version, options);
|
|
5898
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
5899
|
+
};
|
|
5900
|
+
prerelease_1 = prerelease;
|
|
5901
|
+
return prerelease_1;
|
|
5902
|
+
}
|
|
5903
|
+
var compare_1;
|
|
5904
|
+
var hasRequiredCompare;
|
|
5905
|
+
function requireCompare() {
|
|
5906
|
+
if (hasRequiredCompare)
|
|
5907
|
+
return compare_1;
|
|
5908
|
+
hasRequiredCompare = 1;
|
|
5909
|
+
const SemVer = requireSemver$1();
|
|
5910
|
+
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
5911
|
+
compare_1 = compare;
|
|
5912
|
+
return compare_1;
|
|
5913
|
+
}
|
|
5914
|
+
var rcompare_1;
|
|
5915
|
+
var hasRequiredRcompare;
|
|
5916
|
+
function requireRcompare() {
|
|
5917
|
+
if (hasRequiredRcompare)
|
|
5918
|
+
return rcompare_1;
|
|
5919
|
+
hasRequiredRcompare = 1;
|
|
5920
|
+
const compare = requireCompare();
|
|
5921
|
+
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
5922
|
+
rcompare_1 = rcompare;
|
|
5923
|
+
return rcompare_1;
|
|
5924
|
+
}
|
|
5925
|
+
var compareLoose_1;
|
|
5926
|
+
var hasRequiredCompareLoose;
|
|
5927
|
+
function requireCompareLoose() {
|
|
5928
|
+
if (hasRequiredCompareLoose)
|
|
5929
|
+
return compareLoose_1;
|
|
5930
|
+
hasRequiredCompareLoose = 1;
|
|
5931
|
+
const compare = requireCompare();
|
|
5932
|
+
const compareLoose = (a, b) => compare(a, b, true);
|
|
5933
|
+
compareLoose_1 = compareLoose;
|
|
5934
|
+
return compareLoose_1;
|
|
5935
|
+
}
|
|
5936
|
+
var compareBuild_1;
|
|
5937
|
+
var hasRequiredCompareBuild;
|
|
5938
|
+
function requireCompareBuild() {
|
|
5939
|
+
if (hasRequiredCompareBuild)
|
|
5940
|
+
return compareBuild_1;
|
|
5941
|
+
hasRequiredCompareBuild = 1;
|
|
5942
|
+
const SemVer = requireSemver$1();
|
|
5943
|
+
const compareBuild = (a, b, loose) => {
|
|
5944
|
+
const versionA = new SemVer(a, loose);
|
|
5945
|
+
const versionB = new SemVer(b, loose);
|
|
5946
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
5947
|
+
};
|
|
5948
|
+
compareBuild_1 = compareBuild;
|
|
5949
|
+
return compareBuild_1;
|
|
5950
|
+
}
|
|
5951
|
+
var sort_1;
|
|
5952
|
+
var hasRequiredSort;
|
|
5953
|
+
function requireSort() {
|
|
5954
|
+
if (hasRequiredSort)
|
|
5955
|
+
return sort_1;
|
|
5956
|
+
hasRequiredSort = 1;
|
|
5957
|
+
const compareBuild = requireCompareBuild();
|
|
5958
|
+
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
5959
|
+
sort_1 = sort;
|
|
5960
|
+
return sort_1;
|
|
5961
|
+
}
|
|
5962
|
+
var rsort_1;
|
|
5963
|
+
var hasRequiredRsort;
|
|
5964
|
+
function requireRsort() {
|
|
5965
|
+
if (hasRequiredRsort)
|
|
5966
|
+
return rsort_1;
|
|
5967
|
+
hasRequiredRsort = 1;
|
|
5968
|
+
const compareBuild = requireCompareBuild();
|
|
5969
|
+
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
5970
|
+
rsort_1 = rsort;
|
|
5971
|
+
return rsort_1;
|
|
5972
|
+
}
|
|
5973
|
+
var gt_1;
|
|
5974
|
+
var hasRequiredGt;
|
|
5975
|
+
function requireGt() {
|
|
5976
|
+
if (hasRequiredGt)
|
|
5977
|
+
return gt_1;
|
|
5978
|
+
hasRequiredGt = 1;
|
|
5979
|
+
const compare = requireCompare();
|
|
5980
|
+
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
5981
|
+
gt_1 = gt;
|
|
5982
|
+
return gt_1;
|
|
5983
|
+
}
|
|
5984
|
+
var lt_1;
|
|
5985
|
+
var hasRequiredLt;
|
|
5986
|
+
function requireLt() {
|
|
5987
|
+
if (hasRequiredLt)
|
|
5988
|
+
return lt_1;
|
|
5989
|
+
hasRequiredLt = 1;
|
|
5990
|
+
const compare = requireCompare();
|
|
5991
|
+
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
5992
|
+
lt_1 = lt;
|
|
5993
|
+
return lt_1;
|
|
5994
|
+
}
|
|
5995
|
+
var eq_1;
|
|
5996
|
+
var hasRequiredEq;
|
|
5997
|
+
function requireEq() {
|
|
5998
|
+
if (hasRequiredEq)
|
|
5999
|
+
return eq_1;
|
|
6000
|
+
hasRequiredEq = 1;
|
|
6001
|
+
const compare = requireCompare();
|
|
6002
|
+
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
6003
|
+
eq_1 = eq;
|
|
6004
|
+
return eq_1;
|
|
6005
|
+
}
|
|
6006
|
+
var neq_1;
|
|
6007
|
+
var hasRequiredNeq;
|
|
6008
|
+
function requireNeq() {
|
|
6009
|
+
if (hasRequiredNeq)
|
|
6010
|
+
return neq_1;
|
|
6011
|
+
hasRequiredNeq = 1;
|
|
6012
|
+
const compare = requireCompare();
|
|
6013
|
+
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
6014
|
+
neq_1 = neq;
|
|
6015
|
+
return neq_1;
|
|
6016
|
+
}
|
|
6017
|
+
var gte_1;
|
|
6018
|
+
var hasRequiredGte;
|
|
6019
|
+
function requireGte() {
|
|
6020
|
+
if (hasRequiredGte)
|
|
6021
|
+
return gte_1;
|
|
6022
|
+
hasRequiredGte = 1;
|
|
6023
|
+
const compare = requireCompare();
|
|
6024
|
+
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
6025
|
+
gte_1 = gte;
|
|
6026
|
+
return gte_1;
|
|
6027
|
+
}
|
|
6028
|
+
var lte_1;
|
|
6029
|
+
var hasRequiredLte;
|
|
6030
|
+
function requireLte() {
|
|
6031
|
+
if (hasRequiredLte)
|
|
6032
|
+
return lte_1;
|
|
6033
|
+
hasRequiredLte = 1;
|
|
6034
|
+
const compare = requireCompare();
|
|
6035
|
+
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
6036
|
+
lte_1 = lte;
|
|
6037
|
+
return lte_1;
|
|
6038
|
+
}
|
|
6039
|
+
var cmp_1;
|
|
6040
|
+
var hasRequiredCmp;
|
|
6041
|
+
function requireCmp() {
|
|
6042
|
+
if (hasRequiredCmp)
|
|
6043
|
+
return cmp_1;
|
|
6044
|
+
hasRequiredCmp = 1;
|
|
6045
|
+
const eq = requireEq();
|
|
6046
|
+
const neq = requireNeq();
|
|
6047
|
+
const gt = requireGt();
|
|
6048
|
+
const gte = requireGte();
|
|
6049
|
+
const lt = requireLt();
|
|
6050
|
+
const lte = requireLte();
|
|
6051
|
+
const cmp = (a, op, b, loose) => {
|
|
6052
|
+
switch (op) {
|
|
6053
|
+
case "===":
|
|
6054
|
+
if (typeof a === "object") {
|
|
6055
|
+
a = a.version;
|
|
6056
|
+
}
|
|
6057
|
+
if (typeof b === "object") {
|
|
6058
|
+
b = b.version;
|
|
6059
|
+
}
|
|
6060
|
+
return a === b;
|
|
6061
|
+
case "!==":
|
|
6062
|
+
if (typeof a === "object") {
|
|
6063
|
+
a = a.version;
|
|
6064
|
+
}
|
|
6065
|
+
if (typeof b === "object") {
|
|
6066
|
+
b = b.version;
|
|
6067
|
+
}
|
|
6068
|
+
return a !== b;
|
|
6069
|
+
case "":
|
|
6070
|
+
case "=":
|
|
6071
|
+
case "==":
|
|
6072
|
+
return eq(a, b, loose);
|
|
6073
|
+
case "!=":
|
|
6074
|
+
return neq(a, b, loose);
|
|
6075
|
+
case ">":
|
|
6076
|
+
return gt(a, b, loose);
|
|
6077
|
+
case ">=":
|
|
6078
|
+
return gte(a, b, loose);
|
|
6079
|
+
case "<":
|
|
6080
|
+
return lt(a, b, loose);
|
|
6081
|
+
case "<=":
|
|
6082
|
+
return lte(a, b, loose);
|
|
6083
|
+
default:
|
|
6084
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
6085
|
+
}
|
|
6086
|
+
};
|
|
6087
|
+
cmp_1 = cmp;
|
|
6088
|
+
return cmp_1;
|
|
6089
|
+
}
|
|
6090
|
+
var coerce_1;
|
|
6091
|
+
var hasRequiredCoerce;
|
|
6092
|
+
function requireCoerce() {
|
|
6093
|
+
if (hasRequiredCoerce)
|
|
6094
|
+
return coerce_1;
|
|
6095
|
+
hasRequiredCoerce = 1;
|
|
6096
|
+
const SemVer = requireSemver$1();
|
|
6097
|
+
const parse = requireParse();
|
|
6098
|
+
const { safeRe: re, t } = requireRe();
|
|
6099
|
+
const coerce = (version, options) => {
|
|
6100
|
+
if (version instanceof SemVer) {
|
|
6101
|
+
return version;
|
|
6102
|
+
}
|
|
6103
|
+
if (typeof version === "number") {
|
|
6104
|
+
version = String(version);
|
|
6105
|
+
}
|
|
6106
|
+
if (typeof version !== "string") {
|
|
6107
|
+
return null;
|
|
6108
|
+
}
|
|
6109
|
+
options = options || {};
|
|
6110
|
+
let match = null;
|
|
6111
|
+
if (!options.rtl) {
|
|
6112
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
6113
|
+
} else {
|
|
6114
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
6115
|
+
let next;
|
|
6116
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
6117
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
6118
|
+
match = next;
|
|
6119
|
+
}
|
|
6120
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
6121
|
+
}
|
|
6122
|
+
coerceRtlRegex.lastIndex = -1;
|
|
6123
|
+
}
|
|
6124
|
+
if (match === null) {
|
|
6125
|
+
return null;
|
|
6126
|
+
}
|
|
6127
|
+
const major = match[2];
|
|
6128
|
+
const minor = match[3] || "0";
|
|
6129
|
+
const patch = match[4] || "0";
|
|
6130
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
6131
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
6132
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
6133
|
+
};
|
|
6134
|
+
coerce_1 = coerce;
|
|
6135
|
+
return coerce_1;
|
|
6136
|
+
}
|
|
6137
|
+
var lrucache;
|
|
6138
|
+
var hasRequiredLrucache;
|
|
6139
|
+
function requireLrucache() {
|
|
6140
|
+
if (hasRequiredLrucache)
|
|
6141
|
+
return lrucache;
|
|
6142
|
+
hasRequiredLrucache = 1;
|
|
6143
|
+
|
|
6144
|
+
class LRUCache {
|
|
6145
|
+
constructor() {
|
|
6146
|
+
this.max = 1000;
|
|
6147
|
+
this.map = new Map;
|
|
6148
|
+
}
|
|
6149
|
+
get(key) {
|
|
6150
|
+
const value = this.map.get(key);
|
|
6151
|
+
if (value === undefined) {
|
|
6152
|
+
return;
|
|
6153
|
+
} else {
|
|
6154
|
+
this.map.delete(key);
|
|
6155
|
+
this.map.set(key, value);
|
|
6156
|
+
return value;
|
|
6157
|
+
}
|
|
6158
|
+
}
|
|
6159
|
+
delete(key) {
|
|
6160
|
+
return this.map.delete(key);
|
|
6161
|
+
}
|
|
6162
|
+
set(key, value) {
|
|
6163
|
+
const deleted = this.delete(key);
|
|
6164
|
+
if (!deleted && value !== undefined) {
|
|
6165
|
+
if (this.map.size >= this.max) {
|
|
6166
|
+
const firstKey = this.map.keys().next().value;
|
|
6167
|
+
this.delete(firstKey);
|
|
6168
|
+
}
|
|
6169
|
+
this.map.set(key, value);
|
|
6170
|
+
}
|
|
6171
|
+
return this;
|
|
6172
|
+
}
|
|
6173
|
+
}
|
|
6174
|
+
lrucache = LRUCache;
|
|
6175
|
+
return lrucache;
|
|
6176
|
+
}
|
|
6177
|
+
var range;
|
|
6178
|
+
var hasRequiredRange;
|
|
6179
|
+
function requireRange() {
|
|
6180
|
+
if (hasRequiredRange)
|
|
6181
|
+
return range;
|
|
6182
|
+
hasRequiredRange = 1;
|
|
6183
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
6184
|
+
|
|
6185
|
+
class Range {
|
|
6186
|
+
constructor(range, options) {
|
|
6187
|
+
options = parseOptions(options);
|
|
6188
|
+
if (range instanceof Range) {
|
|
6189
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
6190
|
+
return range;
|
|
6191
|
+
} else {
|
|
6192
|
+
return new Range(range.raw, options);
|
|
6193
|
+
}
|
|
6194
|
+
}
|
|
6195
|
+
if (range instanceof Comparator) {
|
|
6196
|
+
this.raw = range.value;
|
|
6197
|
+
this.set = [[range]];
|
|
6198
|
+
this.formatted = undefined;
|
|
6199
|
+
return this;
|
|
6200
|
+
}
|
|
6201
|
+
this.options = options;
|
|
6202
|
+
this.loose = !!options.loose;
|
|
6203
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
6204
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
6205
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
6206
|
+
if (!this.set.length) {
|
|
6207
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
6208
|
+
}
|
|
6209
|
+
if (this.set.length > 1) {
|
|
6210
|
+
const first = this.set[0];
|
|
6211
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
6212
|
+
if (this.set.length === 0) {
|
|
6213
|
+
this.set = [first];
|
|
6214
|
+
} else if (this.set.length > 1) {
|
|
6215
|
+
for (const c of this.set) {
|
|
6216
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
6217
|
+
this.set = [c];
|
|
6218
|
+
break;
|
|
6219
|
+
}
|
|
6220
|
+
}
|
|
6221
|
+
}
|
|
6222
|
+
}
|
|
6223
|
+
this.formatted = undefined;
|
|
6224
|
+
}
|
|
6225
|
+
get range() {
|
|
6226
|
+
if (this.formatted === undefined) {
|
|
6227
|
+
this.formatted = "";
|
|
6228
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
6229
|
+
if (i > 0) {
|
|
6230
|
+
this.formatted += "||";
|
|
6231
|
+
}
|
|
6232
|
+
const comps = this.set[i];
|
|
6233
|
+
for (let k = 0;k < comps.length; k++) {
|
|
6234
|
+
if (k > 0) {
|
|
6235
|
+
this.formatted += " ";
|
|
6236
|
+
}
|
|
6237
|
+
this.formatted += comps[k].toString().trim();
|
|
6238
|
+
}
|
|
6239
|
+
}
|
|
6240
|
+
}
|
|
6241
|
+
return this.formatted;
|
|
6242
|
+
}
|
|
6243
|
+
format() {
|
|
6244
|
+
return this.range;
|
|
6245
|
+
}
|
|
6246
|
+
toString() {
|
|
6247
|
+
return this.range;
|
|
6248
|
+
}
|
|
6249
|
+
parseRange(range) {
|
|
6250
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
6251
|
+
const memoKey = memoOpts + ":" + range;
|
|
6252
|
+
const cached = cache.get(memoKey);
|
|
6253
|
+
if (cached) {
|
|
6254
|
+
return cached;
|
|
6255
|
+
}
|
|
6256
|
+
const loose = this.options.loose;
|
|
6257
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
6258
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
6259
|
+
debug("hyphen replace", range);
|
|
6260
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
6261
|
+
debug("comparator trim", range);
|
|
6262
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
6263
|
+
debug("tilde trim", range);
|
|
6264
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
6265
|
+
debug("caret trim", range);
|
|
6266
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
6267
|
+
if (loose) {
|
|
6268
|
+
rangeList = rangeList.filter((comp) => {
|
|
6269
|
+
debug("loose invalid filter", comp, this.options);
|
|
6270
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
6271
|
+
});
|
|
6272
|
+
}
|
|
6273
|
+
debug("range list", rangeList);
|
|
6274
|
+
const rangeMap = new Map;
|
|
6275
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
6276
|
+
for (const comp of comparators) {
|
|
6277
|
+
if (isNullSet(comp)) {
|
|
6278
|
+
return [comp];
|
|
6279
|
+
}
|
|
6280
|
+
rangeMap.set(comp.value, comp);
|
|
6281
|
+
}
|
|
6282
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
6283
|
+
rangeMap.delete("");
|
|
6284
|
+
}
|
|
6285
|
+
const result = [...rangeMap.values()];
|
|
6286
|
+
cache.set(memoKey, result);
|
|
6287
|
+
return result;
|
|
6288
|
+
}
|
|
6289
|
+
intersects(range, options) {
|
|
6290
|
+
if (!(range instanceof Range)) {
|
|
6291
|
+
throw new TypeError("a Range is required");
|
|
6292
|
+
}
|
|
6293
|
+
return this.set.some((thisComparators) => {
|
|
6294
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
6295
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
6296
|
+
return rangeComparators.every((rangeComparator) => {
|
|
6297
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
6298
|
+
});
|
|
6299
|
+
});
|
|
6300
|
+
});
|
|
6301
|
+
});
|
|
6302
|
+
}
|
|
6303
|
+
test(version) {
|
|
6304
|
+
if (!version) {
|
|
6305
|
+
return false;
|
|
6306
|
+
}
|
|
6307
|
+
if (typeof version === "string") {
|
|
6308
|
+
try {
|
|
6309
|
+
version = new SemVer(version, this.options);
|
|
6310
|
+
} catch (er) {
|
|
6311
|
+
return false;
|
|
6312
|
+
}
|
|
6313
|
+
}
|
|
6314
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
6315
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
6316
|
+
return true;
|
|
6317
|
+
}
|
|
6318
|
+
}
|
|
6319
|
+
return false;
|
|
6320
|
+
}
|
|
6321
|
+
}
|
|
6322
|
+
range = Range;
|
|
6323
|
+
const LRU = requireLrucache();
|
|
6324
|
+
const cache = new LRU;
|
|
6325
|
+
const parseOptions = requireParseOptions();
|
|
6326
|
+
const Comparator = requireComparator();
|
|
6327
|
+
const debug = requireDebug();
|
|
6328
|
+
const SemVer = requireSemver$1();
|
|
6329
|
+
const {
|
|
6330
|
+
safeRe: re,
|
|
6331
|
+
t,
|
|
6332
|
+
comparatorTrimReplace,
|
|
6333
|
+
tildeTrimReplace,
|
|
6334
|
+
caretTrimReplace
|
|
6335
|
+
} = requireRe();
|
|
6336
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
|
|
6337
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
6338
|
+
const isAny = (c) => c.value === "";
|
|
6339
|
+
const isSatisfiable = (comparators, options) => {
|
|
6340
|
+
let result = true;
|
|
6341
|
+
const remainingComparators = comparators.slice();
|
|
6342
|
+
let testComparator = remainingComparators.pop();
|
|
6343
|
+
while (result && remainingComparators.length) {
|
|
6344
|
+
result = remainingComparators.every((otherComparator) => {
|
|
6345
|
+
return testComparator.intersects(otherComparator, options);
|
|
6346
|
+
});
|
|
6347
|
+
testComparator = remainingComparators.pop();
|
|
6348
|
+
}
|
|
6349
|
+
return result;
|
|
6350
|
+
};
|
|
6351
|
+
const parseComparator = (comp, options) => {
|
|
6352
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
6353
|
+
debug("comp", comp, options);
|
|
6354
|
+
comp = replaceCarets(comp, options);
|
|
6355
|
+
debug("caret", comp);
|
|
6356
|
+
comp = replaceTildes(comp, options);
|
|
6357
|
+
debug("tildes", comp);
|
|
6358
|
+
comp = replaceXRanges(comp, options);
|
|
6359
|
+
debug("xrange", comp);
|
|
6360
|
+
comp = replaceStars(comp, options);
|
|
6361
|
+
debug("stars", comp);
|
|
6362
|
+
return comp;
|
|
6363
|
+
};
|
|
6364
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
6365
|
+
const replaceTildes = (comp, options) => {
|
|
6366
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
6367
|
+
};
|
|
6368
|
+
const replaceTilde = (comp, options) => {
|
|
6369
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
6370
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
6371
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
6372
|
+
let ret;
|
|
6373
|
+
if (isX(M)) {
|
|
6374
|
+
ret = "";
|
|
6375
|
+
} else if (isX(m)) {
|
|
6376
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
6377
|
+
} else if (isX(p)) {
|
|
6378
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
6379
|
+
} else if (pr) {
|
|
6380
|
+
debug("replaceTilde pr", pr);
|
|
6381
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
6382
|
+
} else {
|
|
6383
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
6384
|
+
}
|
|
6385
|
+
debug("tilde return", ret);
|
|
6386
|
+
return ret;
|
|
6387
|
+
});
|
|
6388
|
+
};
|
|
6389
|
+
const replaceCarets = (comp, options) => {
|
|
6390
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
6391
|
+
};
|
|
6392
|
+
const replaceCaret = (comp, options) => {
|
|
6393
|
+
debug("caret", comp, options);
|
|
6394
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
6395
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
6396
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
6397
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
6398
|
+
let ret;
|
|
6399
|
+
if (isX(M)) {
|
|
6400
|
+
ret = "";
|
|
6401
|
+
} else if (isX(m)) {
|
|
6402
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
6403
|
+
} else if (isX(p)) {
|
|
6404
|
+
if (M === "0") {
|
|
6405
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
6406
|
+
} else {
|
|
6407
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
6408
|
+
}
|
|
6409
|
+
} else if (pr) {
|
|
6410
|
+
debug("replaceCaret pr", pr);
|
|
6411
|
+
if (M === "0") {
|
|
6412
|
+
if (m === "0") {
|
|
6413
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
6414
|
+
} else {
|
|
6415
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
6416
|
+
}
|
|
6417
|
+
} else {
|
|
6418
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
6419
|
+
}
|
|
6420
|
+
} else {
|
|
6421
|
+
debug("no pr");
|
|
6422
|
+
if (M === "0") {
|
|
6423
|
+
if (m === "0") {
|
|
6424
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
6425
|
+
} else {
|
|
6426
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
6427
|
+
}
|
|
6428
|
+
} else {
|
|
6429
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
6430
|
+
}
|
|
6431
|
+
}
|
|
6432
|
+
debug("caret return", ret);
|
|
6433
|
+
return ret;
|
|
6434
|
+
});
|
|
6435
|
+
};
|
|
6436
|
+
const replaceXRanges = (comp, options) => {
|
|
6437
|
+
debug("replaceXRanges", comp, options);
|
|
6438
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
6439
|
+
};
|
|
6440
|
+
const replaceXRange = (comp, options) => {
|
|
6441
|
+
comp = comp.trim();
|
|
6442
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
6443
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
6444
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
6445
|
+
const xM = isX(M);
|
|
6446
|
+
const xm = xM || isX(m);
|
|
6447
|
+
const xp = xm || isX(p);
|
|
6448
|
+
const anyX = xp;
|
|
6449
|
+
if (gtlt === "=" && anyX) {
|
|
6450
|
+
gtlt = "";
|
|
6451
|
+
}
|
|
6452
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
6453
|
+
if (xM) {
|
|
6454
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
6455
|
+
ret = "<0.0.0-0";
|
|
6456
|
+
} else {
|
|
6457
|
+
ret = "*";
|
|
6458
|
+
}
|
|
6459
|
+
} else if (gtlt && anyX) {
|
|
6460
|
+
if (xm) {
|
|
6461
|
+
m = 0;
|
|
6462
|
+
}
|
|
6463
|
+
p = 0;
|
|
6464
|
+
if (gtlt === ">") {
|
|
6465
|
+
gtlt = ">=";
|
|
6466
|
+
if (xm) {
|
|
6467
|
+
M = +M + 1;
|
|
6468
|
+
m = 0;
|
|
6469
|
+
p = 0;
|
|
6470
|
+
} else {
|
|
6471
|
+
m = +m + 1;
|
|
6472
|
+
p = 0;
|
|
6473
|
+
}
|
|
6474
|
+
} else if (gtlt === "<=") {
|
|
6475
|
+
gtlt = "<";
|
|
6476
|
+
if (xm) {
|
|
6477
|
+
M = +M + 1;
|
|
6478
|
+
} else {
|
|
6479
|
+
m = +m + 1;
|
|
6480
|
+
}
|
|
6481
|
+
}
|
|
6482
|
+
if (gtlt === "<") {
|
|
6483
|
+
pr = "-0";
|
|
6484
|
+
}
|
|
6485
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
6486
|
+
} else if (xm) {
|
|
6487
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
6488
|
+
} else if (xp) {
|
|
6489
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
6490
|
+
}
|
|
6491
|
+
debug("xRange return", ret);
|
|
6492
|
+
return ret;
|
|
6493
|
+
});
|
|
6494
|
+
};
|
|
6495
|
+
const replaceStars = (comp, options) => {
|
|
6496
|
+
debug("replaceStars", comp, options);
|
|
6497
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
6498
|
+
};
|
|
6499
|
+
const replaceGTE0 = (comp, options) => {
|
|
6500
|
+
debug("replaceGTE0", comp, options);
|
|
6501
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
6502
|
+
};
|
|
6503
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
6504
|
+
if (isX(fM)) {
|
|
6505
|
+
from = "";
|
|
6506
|
+
} else if (isX(fm)) {
|
|
6507
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
6508
|
+
} else if (isX(fp)) {
|
|
6509
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
6510
|
+
} else if (fpr) {
|
|
6511
|
+
from = `>=${from}`;
|
|
6512
|
+
} else {
|
|
6513
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
6514
|
+
}
|
|
6515
|
+
if (isX(tM)) {
|
|
6516
|
+
to = "";
|
|
6517
|
+
} else if (isX(tm)) {
|
|
6518
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
6519
|
+
} else if (isX(tp)) {
|
|
6520
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
6521
|
+
} else if (tpr) {
|
|
6522
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
6523
|
+
} else if (incPr) {
|
|
6524
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
6525
|
+
} else {
|
|
6526
|
+
to = `<=${to}`;
|
|
6527
|
+
}
|
|
6528
|
+
return `${from} ${to}`.trim();
|
|
6529
|
+
};
|
|
6530
|
+
const testSet = (set, version, options) => {
|
|
6531
|
+
for (let i = 0;i < set.length; i++) {
|
|
6532
|
+
if (!set[i].test(version)) {
|
|
6533
|
+
return false;
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
6537
|
+
for (let i = 0;i < set.length; i++) {
|
|
6538
|
+
debug(set[i].semver);
|
|
6539
|
+
if (set[i].semver === Comparator.ANY) {
|
|
6540
|
+
continue;
|
|
6541
|
+
}
|
|
6542
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
6543
|
+
const allowed = set[i].semver;
|
|
6544
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
6545
|
+
return true;
|
|
6546
|
+
}
|
|
6547
|
+
}
|
|
6548
|
+
}
|
|
6549
|
+
return false;
|
|
6550
|
+
}
|
|
6551
|
+
return true;
|
|
6552
|
+
};
|
|
6553
|
+
return range;
|
|
6554
|
+
}
|
|
6555
|
+
var comparator;
|
|
6556
|
+
var hasRequiredComparator;
|
|
6557
|
+
function requireComparator() {
|
|
6558
|
+
if (hasRequiredComparator)
|
|
6559
|
+
return comparator;
|
|
6560
|
+
hasRequiredComparator = 1;
|
|
6561
|
+
const ANY = Symbol("SemVer ANY");
|
|
6562
|
+
|
|
6563
|
+
class Comparator {
|
|
6564
|
+
static get ANY() {
|
|
6565
|
+
return ANY;
|
|
6566
|
+
}
|
|
6567
|
+
constructor(comp, options) {
|
|
6568
|
+
options = parseOptions(options);
|
|
6569
|
+
if (comp instanceof Comparator) {
|
|
6570
|
+
if (comp.loose === !!options.loose) {
|
|
6571
|
+
return comp;
|
|
6572
|
+
} else {
|
|
6573
|
+
comp = comp.value;
|
|
6574
|
+
}
|
|
6575
|
+
}
|
|
6576
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
6577
|
+
debug("comparator", comp, options);
|
|
6578
|
+
this.options = options;
|
|
6579
|
+
this.loose = !!options.loose;
|
|
6580
|
+
this.parse(comp);
|
|
6581
|
+
if (this.semver === ANY) {
|
|
6582
|
+
this.value = "";
|
|
6583
|
+
} else {
|
|
6584
|
+
this.value = this.operator + this.semver.version;
|
|
6585
|
+
}
|
|
6586
|
+
debug("comp", this);
|
|
6587
|
+
}
|
|
6588
|
+
parse(comp) {
|
|
6589
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
6590
|
+
const m = comp.match(r);
|
|
6591
|
+
if (!m) {
|
|
6592
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
6593
|
+
}
|
|
6594
|
+
this.operator = m[1] !== undefined ? m[1] : "";
|
|
6595
|
+
if (this.operator === "=") {
|
|
6596
|
+
this.operator = "";
|
|
6597
|
+
}
|
|
6598
|
+
if (!m[2]) {
|
|
6599
|
+
this.semver = ANY;
|
|
6600
|
+
} else {
|
|
6601
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
6602
|
+
}
|
|
6603
|
+
}
|
|
6604
|
+
toString() {
|
|
6605
|
+
return this.value;
|
|
6606
|
+
}
|
|
6607
|
+
test(version) {
|
|
6608
|
+
debug("Comparator.test", version, this.options.loose);
|
|
6609
|
+
if (this.semver === ANY || version === ANY) {
|
|
6610
|
+
return true;
|
|
6611
|
+
}
|
|
6612
|
+
if (typeof version === "string") {
|
|
6613
|
+
try {
|
|
6614
|
+
version = new SemVer(version, this.options);
|
|
6615
|
+
} catch (er) {
|
|
6616
|
+
return false;
|
|
6617
|
+
}
|
|
6618
|
+
}
|
|
6619
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
6620
|
+
}
|
|
6621
|
+
intersects(comp, options) {
|
|
6622
|
+
if (!(comp instanceof Comparator)) {
|
|
6623
|
+
throw new TypeError("a Comparator is required");
|
|
6624
|
+
}
|
|
6625
|
+
if (this.operator === "") {
|
|
6626
|
+
if (this.value === "") {
|
|
6627
|
+
return true;
|
|
6628
|
+
}
|
|
6629
|
+
return new Range(comp.value, options).test(this.value);
|
|
6630
|
+
} else if (comp.operator === "") {
|
|
6631
|
+
if (comp.value === "") {
|
|
6632
|
+
return true;
|
|
6633
|
+
}
|
|
6634
|
+
return new Range(this.value, options).test(comp.semver);
|
|
6635
|
+
}
|
|
6636
|
+
options = parseOptions(options);
|
|
6637
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
6638
|
+
return false;
|
|
6639
|
+
}
|
|
6640
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
6641
|
+
return false;
|
|
6642
|
+
}
|
|
6643
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
6644
|
+
return true;
|
|
6645
|
+
}
|
|
6646
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
6647
|
+
return true;
|
|
6648
|
+
}
|
|
6649
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
6650
|
+
return true;
|
|
6651
|
+
}
|
|
6652
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
6653
|
+
return true;
|
|
6654
|
+
}
|
|
6655
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
6656
|
+
return true;
|
|
6657
|
+
}
|
|
6658
|
+
return false;
|
|
6659
|
+
}
|
|
6660
|
+
}
|
|
6661
|
+
comparator = Comparator;
|
|
6662
|
+
const parseOptions = requireParseOptions();
|
|
6663
|
+
const { safeRe: re, t } = requireRe();
|
|
6664
|
+
const cmp = requireCmp();
|
|
6665
|
+
const debug = requireDebug();
|
|
6666
|
+
const SemVer = requireSemver$1();
|
|
6667
|
+
const Range = requireRange();
|
|
6668
|
+
return comparator;
|
|
6669
|
+
}
|
|
6670
|
+
var satisfies_1;
|
|
6671
|
+
var hasRequiredSatisfies;
|
|
6672
|
+
function requireSatisfies() {
|
|
6673
|
+
if (hasRequiredSatisfies)
|
|
6674
|
+
return satisfies_1;
|
|
6675
|
+
hasRequiredSatisfies = 1;
|
|
6676
|
+
const Range = requireRange();
|
|
6677
|
+
const satisfies = (version, range, options) => {
|
|
6678
|
+
try {
|
|
6679
|
+
range = new Range(range, options);
|
|
6680
|
+
} catch (er) {
|
|
6681
|
+
return false;
|
|
6682
|
+
}
|
|
6683
|
+
return range.test(version);
|
|
6684
|
+
};
|
|
6685
|
+
satisfies_1 = satisfies;
|
|
6686
|
+
return satisfies_1;
|
|
6687
|
+
}
|
|
6688
|
+
var toComparators_1;
|
|
6689
|
+
var hasRequiredToComparators;
|
|
6690
|
+
function requireToComparators() {
|
|
6691
|
+
if (hasRequiredToComparators)
|
|
6692
|
+
return toComparators_1;
|
|
6693
|
+
hasRequiredToComparators = 1;
|
|
6694
|
+
const Range = requireRange();
|
|
6695
|
+
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
6696
|
+
toComparators_1 = toComparators;
|
|
6697
|
+
return toComparators_1;
|
|
6698
|
+
}
|
|
6699
|
+
var maxSatisfying_1;
|
|
6700
|
+
var hasRequiredMaxSatisfying;
|
|
6701
|
+
function requireMaxSatisfying() {
|
|
6702
|
+
if (hasRequiredMaxSatisfying)
|
|
6703
|
+
return maxSatisfying_1;
|
|
6704
|
+
hasRequiredMaxSatisfying = 1;
|
|
6705
|
+
const SemVer = requireSemver$1();
|
|
6706
|
+
const Range = requireRange();
|
|
6707
|
+
const maxSatisfying = (versions, range, options) => {
|
|
6708
|
+
let max = null;
|
|
6709
|
+
let maxSV = null;
|
|
6710
|
+
let rangeObj = null;
|
|
6711
|
+
try {
|
|
6712
|
+
rangeObj = new Range(range, options);
|
|
6713
|
+
} catch (er) {
|
|
6714
|
+
return null;
|
|
6715
|
+
}
|
|
6716
|
+
versions.forEach((v) => {
|
|
6717
|
+
if (rangeObj.test(v)) {
|
|
6718
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
6719
|
+
max = v;
|
|
6720
|
+
maxSV = new SemVer(max, options);
|
|
6721
|
+
}
|
|
6722
|
+
}
|
|
6723
|
+
});
|
|
6724
|
+
return max;
|
|
6725
|
+
};
|
|
6726
|
+
maxSatisfying_1 = maxSatisfying;
|
|
6727
|
+
return maxSatisfying_1;
|
|
6728
|
+
}
|
|
6729
|
+
var minSatisfying_1;
|
|
6730
|
+
var hasRequiredMinSatisfying;
|
|
6731
|
+
function requireMinSatisfying() {
|
|
6732
|
+
if (hasRequiredMinSatisfying)
|
|
6733
|
+
return minSatisfying_1;
|
|
6734
|
+
hasRequiredMinSatisfying = 1;
|
|
6735
|
+
const SemVer = requireSemver$1();
|
|
6736
|
+
const Range = requireRange();
|
|
6737
|
+
const minSatisfying = (versions, range, options) => {
|
|
6738
|
+
let min = null;
|
|
6739
|
+
let minSV = null;
|
|
6740
|
+
let rangeObj = null;
|
|
6741
|
+
try {
|
|
6742
|
+
rangeObj = new Range(range, options);
|
|
6743
|
+
} catch (er) {
|
|
6744
|
+
return null;
|
|
6745
|
+
}
|
|
6746
|
+
versions.forEach((v) => {
|
|
6747
|
+
if (rangeObj.test(v)) {
|
|
6748
|
+
if (!min || minSV.compare(v) === 1) {
|
|
6749
|
+
min = v;
|
|
6750
|
+
minSV = new SemVer(min, options);
|
|
6751
|
+
}
|
|
6752
|
+
}
|
|
6753
|
+
});
|
|
6754
|
+
return min;
|
|
6755
|
+
};
|
|
6756
|
+
minSatisfying_1 = minSatisfying;
|
|
6757
|
+
return minSatisfying_1;
|
|
6758
|
+
}
|
|
6759
|
+
var minVersion_1;
|
|
6760
|
+
var hasRequiredMinVersion;
|
|
6761
|
+
function requireMinVersion() {
|
|
6762
|
+
if (hasRequiredMinVersion)
|
|
6763
|
+
return minVersion_1;
|
|
6764
|
+
hasRequiredMinVersion = 1;
|
|
6765
|
+
const SemVer = requireSemver$1();
|
|
6766
|
+
const Range = requireRange();
|
|
6767
|
+
const gt = requireGt();
|
|
6768
|
+
const minVersion = (range, loose) => {
|
|
6769
|
+
range = new Range(range, loose);
|
|
6770
|
+
let minver = new SemVer("0.0.0");
|
|
6771
|
+
if (range.test(minver)) {
|
|
6772
|
+
return minver;
|
|
6773
|
+
}
|
|
6774
|
+
minver = new SemVer("0.0.0-0");
|
|
6775
|
+
if (range.test(minver)) {
|
|
6776
|
+
return minver;
|
|
6777
|
+
}
|
|
6778
|
+
minver = null;
|
|
6779
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
6780
|
+
const comparators = range.set[i];
|
|
6781
|
+
let setMin = null;
|
|
6782
|
+
comparators.forEach((comparator) => {
|
|
6783
|
+
const compver = new SemVer(comparator.semver.version);
|
|
6784
|
+
switch (comparator.operator) {
|
|
6785
|
+
case ">":
|
|
6786
|
+
if (compver.prerelease.length === 0) {
|
|
6787
|
+
compver.patch++;
|
|
6788
|
+
} else {
|
|
6789
|
+
compver.prerelease.push(0);
|
|
6790
|
+
}
|
|
6791
|
+
compver.raw = compver.format();
|
|
6792
|
+
case "":
|
|
6793
|
+
case ">=":
|
|
6794
|
+
if (!setMin || gt(compver, setMin)) {
|
|
6795
|
+
setMin = compver;
|
|
6796
|
+
}
|
|
6797
|
+
break;
|
|
6798
|
+
case "<":
|
|
6799
|
+
case "<=":
|
|
6800
|
+
break;
|
|
6801
|
+
default:
|
|
6802
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
6803
|
+
}
|
|
6804
|
+
});
|
|
6805
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
6806
|
+
minver = setMin;
|
|
6807
|
+
}
|
|
6808
|
+
}
|
|
6809
|
+
if (minver && range.test(minver)) {
|
|
6810
|
+
return minver;
|
|
6811
|
+
}
|
|
6812
|
+
return null;
|
|
6813
|
+
};
|
|
6814
|
+
minVersion_1 = minVersion;
|
|
6815
|
+
return minVersion_1;
|
|
6816
|
+
}
|
|
6817
|
+
var valid;
|
|
6818
|
+
var hasRequiredValid;
|
|
6819
|
+
function requireValid() {
|
|
6820
|
+
if (hasRequiredValid)
|
|
6821
|
+
return valid;
|
|
6822
|
+
hasRequiredValid = 1;
|
|
6823
|
+
const Range = requireRange();
|
|
6824
|
+
const validRange = (range, options) => {
|
|
6825
|
+
try {
|
|
6826
|
+
return new Range(range, options).range || "*";
|
|
6827
|
+
} catch (er) {
|
|
6828
|
+
return null;
|
|
6829
|
+
}
|
|
6830
|
+
};
|
|
6831
|
+
valid = validRange;
|
|
6832
|
+
return valid;
|
|
6833
|
+
}
|
|
6834
|
+
var outside_1;
|
|
6835
|
+
var hasRequiredOutside;
|
|
6836
|
+
function requireOutside() {
|
|
6837
|
+
if (hasRequiredOutside)
|
|
6838
|
+
return outside_1;
|
|
6839
|
+
hasRequiredOutside = 1;
|
|
6840
|
+
const SemVer = requireSemver$1();
|
|
6841
|
+
const Comparator = requireComparator();
|
|
6842
|
+
const { ANY } = Comparator;
|
|
6843
|
+
const Range = requireRange();
|
|
6844
|
+
const satisfies = requireSatisfies();
|
|
6845
|
+
const gt = requireGt();
|
|
6846
|
+
const lt = requireLt();
|
|
6847
|
+
const lte = requireLte();
|
|
6848
|
+
const gte = requireGte();
|
|
6849
|
+
const outside = (version, range, hilo, options) => {
|
|
6850
|
+
version = new SemVer(version, options);
|
|
6851
|
+
range = new Range(range, options);
|
|
6852
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
6853
|
+
switch (hilo) {
|
|
6854
|
+
case ">":
|
|
6855
|
+
gtfn = gt;
|
|
6856
|
+
ltefn = lte;
|
|
6857
|
+
ltfn = lt;
|
|
6858
|
+
comp = ">";
|
|
6859
|
+
ecomp = ">=";
|
|
6860
|
+
break;
|
|
6861
|
+
case "<":
|
|
6862
|
+
gtfn = lt;
|
|
6863
|
+
ltefn = gte;
|
|
6864
|
+
ltfn = gt;
|
|
6865
|
+
comp = "<";
|
|
6866
|
+
ecomp = "<=";
|
|
6867
|
+
break;
|
|
6868
|
+
default:
|
|
6869
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
6870
|
+
}
|
|
6871
|
+
if (satisfies(version, range, options)) {
|
|
6872
|
+
return false;
|
|
6873
|
+
}
|
|
6874
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
6875
|
+
const comparators = range.set[i];
|
|
6876
|
+
let high = null;
|
|
6877
|
+
let low = null;
|
|
6878
|
+
comparators.forEach((comparator) => {
|
|
6879
|
+
if (comparator.semver === ANY) {
|
|
6880
|
+
comparator = new Comparator(">=0.0.0");
|
|
6881
|
+
}
|
|
6882
|
+
high = high || comparator;
|
|
6883
|
+
low = low || comparator;
|
|
6884
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
6885
|
+
high = comparator;
|
|
6886
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
6887
|
+
low = comparator;
|
|
6888
|
+
}
|
|
6889
|
+
});
|
|
6890
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
6891
|
+
return false;
|
|
6892
|
+
}
|
|
6893
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
6894
|
+
return false;
|
|
6895
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
6896
|
+
return false;
|
|
6897
|
+
}
|
|
6898
|
+
}
|
|
6899
|
+
return true;
|
|
6900
|
+
};
|
|
6901
|
+
outside_1 = outside;
|
|
6902
|
+
return outside_1;
|
|
6903
|
+
}
|
|
6904
|
+
var gtr_1;
|
|
6905
|
+
var hasRequiredGtr;
|
|
6906
|
+
function requireGtr() {
|
|
6907
|
+
if (hasRequiredGtr)
|
|
6908
|
+
return gtr_1;
|
|
6909
|
+
hasRequiredGtr = 1;
|
|
6910
|
+
const outside = requireOutside();
|
|
6911
|
+
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
6912
|
+
gtr_1 = gtr;
|
|
6913
|
+
return gtr_1;
|
|
6914
|
+
}
|
|
6915
|
+
var ltr_1;
|
|
6916
|
+
var hasRequiredLtr;
|
|
6917
|
+
function requireLtr() {
|
|
6918
|
+
if (hasRequiredLtr)
|
|
6919
|
+
return ltr_1;
|
|
6920
|
+
hasRequiredLtr = 1;
|
|
6921
|
+
const outside = requireOutside();
|
|
6922
|
+
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
6923
|
+
ltr_1 = ltr;
|
|
6924
|
+
return ltr_1;
|
|
6925
|
+
}
|
|
6926
|
+
var intersects_1;
|
|
6927
|
+
var hasRequiredIntersects;
|
|
6928
|
+
function requireIntersects() {
|
|
6929
|
+
if (hasRequiredIntersects)
|
|
6930
|
+
return intersects_1;
|
|
6931
|
+
hasRequiredIntersects = 1;
|
|
6932
|
+
const Range = requireRange();
|
|
6933
|
+
const intersects = (r1, r2, options) => {
|
|
6934
|
+
r1 = new Range(r1, options);
|
|
6935
|
+
r2 = new Range(r2, options);
|
|
6936
|
+
return r1.intersects(r2, options);
|
|
6937
|
+
};
|
|
6938
|
+
intersects_1 = intersects;
|
|
6939
|
+
return intersects_1;
|
|
6940
|
+
}
|
|
6941
|
+
var simplify;
|
|
6942
|
+
var hasRequiredSimplify;
|
|
6943
|
+
function requireSimplify() {
|
|
6944
|
+
if (hasRequiredSimplify)
|
|
6945
|
+
return simplify;
|
|
6946
|
+
hasRequiredSimplify = 1;
|
|
6947
|
+
const satisfies = requireSatisfies();
|
|
6948
|
+
const compare = requireCompare();
|
|
6949
|
+
simplify = (versions, range, options) => {
|
|
6950
|
+
const set = [];
|
|
6951
|
+
let first = null;
|
|
6952
|
+
let prev = null;
|
|
6953
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
6954
|
+
for (const version of v) {
|
|
6955
|
+
const included = satisfies(version, range, options);
|
|
6956
|
+
if (included) {
|
|
6957
|
+
prev = version;
|
|
6958
|
+
if (!first) {
|
|
6959
|
+
first = version;
|
|
6960
|
+
}
|
|
6961
|
+
} else {
|
|
6962
|
+
if (prev) {
|
|
6963
|
+
set.push([first, prev]);
|
|
6964
|
+
}
|
|
6965
|
+
prev = null;
|
|
6966
|
+
first = null;
|
|
6967
|
+
}
|
|
6968
|
+
}
|
|
6969
|
+
if (first) {
|
|
6970
|
+
set.push([first, null]);
|
|
6971
|
+
}
|
|
6972
|
+
const ranges = [];
|
|
6973
|
+
for (const [min, max] of set) {
|
|
6974
|
+
if (min === max) {
|
|
6975
|
+
ranges.push(min);
|
|
6976
|
+
} else if (!max && min === v[0]) {
|
|
6977
|
+
ranges.push("*");
|
|
6978
|
+
} else if (!max) {
|
|
6979
|
+
ranges.push(`>=${min}`);
|
|
6980
|
+
} else if (min === v[0]) {
|
|
6981
|
+
ranges.push(`<=${max}`);
|
|
6982
|
+
} else {
|
|
6983
|
+
ranges.push(`${min} - ${max}`);
|
|
6984
|
+
}
|
|
6985
|
+
}
|
|
6986
|
+
const simplified = ranges.join(" || ");
|
|
6987
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
6988
|
+
return simplified.length < original.length ? simplified : range;
|
|
6989
|
+
};
|
|
6990
|
+
return simplify;
|
|
6991
|
+
}
|
|
6992
|
+
var subset_1;
|
|
6993
|
+
var hasRequiredSubset;
|
|
6994
|
+
function requireSubset() {
|
|
6995
|
+
if (hasRequiredSubset)
|
|
6996
|
+
return subset_1;
|
|
6997
|
+
hasRequiredSubset = 1;
|
|
6998
|
+
const Range = requireRange();
|
|
6999
|
+
const Comparator = requireComparator();
|
|
7000
|
+
const { ANY } = Comparator;
|
|
7001
|
+
const satisfies = requireSatisfies();
|
|
7002
|
+
const compare = requireCompare();
|
|
7003
|
+
const subset = (sub, dom, options = {}) => {
|
|
7004
|
+
if (sub === dom) {
|
|
7005
|
+
return true;
|
|
7006
|
+
}
|
|
7007
|
+
sub = new Range(sub, options);
|
|
7008
|
+
dom = new Range(dom, options);
|
|
7009
|
+
let sawNonNull = false;
|
|
7010
|
+
OUTER:
|
|
7011
|
+
for (const simpleSub of sub.set) {
|
|
7012
|
+
for (const simpleDom of dom.set) {
|
|
7013
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
7014
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
7015
|
+
if (isSub) {
|
|
7016
|
+
continue OUTER;
|
|
7017
|
+
}
|
|
7018
|
+
}
|
|
7019
|
+
if (sawNonNull) {
|
|
7020
|
+
return false;
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
return true;
|
|
7024
|
+
};
|
|
7025
|
+
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
7026
|
+
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
7027
|
+
const simpleSubset = (sub, dom, options) => {
|
|
7028
|
+
if (sub === dom) {
|
|
7029
|
+
return true;
|
|
7030
|
+
}
|
|
7031
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
7032
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
7033
|
+
return true;
|
|
7034
|
+
} else if (options.includePrerelease) {
|
|
7035
|
+
sub = minimumVersionWithPreRelease;
|
|
7036
|
+
} else {
|
|
7037
|
+
sub = minimumVersion;
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
7040
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
7041
|
+
if (options.includePrerelease) {
|
|
7042
|
+
return true;
|
|
7043
|
+
} else {
|
|
7044
|
+
dom = minimumVersion;
|
|
7045
|
+
}
|
|
7046
|
+
}
|
|
7047
|
+
const eqSet = new Set;
|
|
7048
|
+
let gt, lt;
|
|
7049
|
+
for (const c of sub) {
|
|
7050
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
7051
|
+
gt = higherGT(gt, c, options);
|
|
7052
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
7053
|
+
lt = lowerLT(lt, c, options);
|
|
7054
|
+
} else {
|
|
7055
|
+
eqSet.add(c.semver);
|
|
7056
|
+
}
|
|
7057
|
+
}
|
|
7058
|
+
if (eqSet.size > 1) {
|
|
7059
|
+
return null;
|
|
7060
|
+
}
|
|
7061
|
+
let gtltComp;
|
|
7062
|
+
if (gt && lt) {
|
|
7063
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
7064
|
+
if (gtltComp > 0) {
|
|
7065
|
+
return null;
|
|
7066
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
7067
|
+
return null;
|
|
7068
|
+
}
|
|
7069
|
+
}
|
|
7070
|
+
for (const eq of eqSet) {
|
|
7071
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
7072
|
+
return null;
|
|
7073
|
+
}
|
|
7074
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
7075
|
+
return null;
|
|
7076
|
+
}
|
|
7077
|
+
for (const c of dom) {
|
|
7078
|
+
if (!satisfies(eq, String(c), options)) {
|
|
7079
|
+
return false;
|
|
7080
|
+
}
|
|
7081
|
+
}
|
|
7082
|
+
return true;
|
|
7083
|
+
}
|
|
7084
|
+
let higher, lower;
|
|
7085
|
+
let hasDomLT, hasDomGT;
|
|
7086
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
7087
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
7088
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
7089
|
+
needDomLTPre = false;
|
|
7090
|
+
}
|
|
7091
|
+
for (const c of dom) {
|
|
7092
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
7093
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
7094
|
+
if (gt) {
|
|
7095
|
+
if (needDomGTPre) {
|
|
7096
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
7097
|
+
needDomGTPre = false;
|
|
7098
|
+
}
|
|
7099
|
+
}
|
|
7100
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
7101
|
+
higher = higherGT(gt, c, options);
|
|
7102
|
+
if (higher === c && higher !== gt) {
|
|
7103
|
+
return false;
|
|
7104
|
+
}
|
|
7105
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
|
|
7106
|
+
return false;
|
|
7107
|
+
}
|
|
7108
|
+
}
|
|
7109
|
+
if (lt) {
|
|
7110
|
+
if (needDomLTPre) {
|
|
7111
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
7112
|
+
needDomLTPre = false;
|
|
7113
|
+
}
|
|
7114
|
+
}
|
|
7115
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
7116
|
+
lower = lowerLT(lt, c, options);
|
|
7117
|
+
if (lower === c && lower !== lt) {
|
|
7118
|
+
return false;
|
|
7119
|
+
}
|
|
7120
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
|
|
7121
|
+
return false;
|
|
7122
|
+
}
|
|
7123
|
+
}
|
|
7124
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
7125
|
+
return false;
|
|
7126
|
+
}
|
|
7127
|
+
}
|
|
7128
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
7129
|
+
return false;
|
|
7130
|
+
}
|
|
7131
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
7132
|
+
return false;
|
|
7133
|
+
}
|
|
7134
|
+
if (needDomGTPre || needDomLTPre) {
|
|
7135
|
+
return false;
|
|
7136
|
+
}
|
|
7137
|
+
return true;
|
|
7138
|
+
};
|
|
7139
|
+
const higherGT = (a, b, options) => {
|
|
7140
|
+
if (!a) {
|
|
7141
|
+
return b;
|
|
7142
|
+
}
|
|
7143
|
+
const comp = compare(a.semver, b.semver, options);
|
|
7144
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
7145
|
+
};
|
|
7146
|
+
const lowerLT = (a, b, options) => {
|
|
7147
|
+
if (!a) {
|
|
7148
|
+
return b;
|
|
7149
|
+
}
|
|
7150
|
+
const comp = compare(a.semver, b.semver, options);
|
|
7151
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
7152
|
+
};
|
|
7153
|
+
subset_1 = subset;
|
|
7154
|
+
return subset_1;
|
|
7155
|
+
}
|
|
7156
|
+
var semver;
|
|
7157
|
+
var hasRequiredSemver;
|
|
7158
|
+
function requireSemver() {
|
|
7159
|
+
if (hasRequiredSemver)
|
|
7160
|
+
return semver;
|
|
7161
|
+
hasRequiredSemver = 1;
|
|
7162
|
+
const internalRe = requireRe();
|
|
7163
|
+
const constants = requireConstants();
|
|
7164
|
+
const SemVer = requireSemver$1();
|
|
7165
|
+
const identifiers = requireIdentifiers();
|
|
7166
|
+
const parse = requireParse();
|
|
7167
|
+
const valid = requireValid$1();
|
|
7168
|
+
const clean = requireClean();
|
|
7169
|
+
const inc = requireInc();
|
|
7170
|
+
const diff = requireDiff();
|
|
7171
|
+
const major = requireMajor();
|
|
7172
|
+
const minor = requireMinor();
|
|
7173
|
+
const patch = requirePatch();
|
|
7174
|
+
const prerelease = requirePrerelease();
|
|
7175
|
+
const compare = requireCompare();
|
|
7176
|
+
const rcompare = requireRcompare();
|
|
7177
|
+
const compareLoose = requireCompareLoose();
|
|
7178
|
+
const compareBuild = requireCompareBuild();
|
|
7179
|
+
const sort = requireSort();
|
|
7180
|
+
const rsort = requireRsort();
|
|
7181
|
+
const gt = requireGt();
|
|
7182
|
+
const lt = requireLt();
|
|
7183
|
+
const eq = requireEq();
|
|
7184
|
+
const neq = requireNeq();
|
|
7185
|
+
const gte = requireGte();
|
|
7186
|
+
const lte = requireLte();
|
|
7187
|
+
const cmp = requireCmp();
|
|
7188
|
+
const coerce = requireCoerce();
|
|
7189
|
+
const Comparator = requireComparator();
|
|
7190
|
+
const Range = requireRange();
|
|
7191
|
+
const satisfies = requireSatisfies();
|
|
7192
|
+
const toComparators = requireToComparators();
|
|
7193
|
+
const maxSatisfying = requireMaxSatisfying();
|
|
7194
|
+
const minSatisfying = requireMinSatisfying();
|
|
7195
|
+
const minVersion = requireMinVersion();
|
|
7196
|
+
const validRange = requireValid();
|
|
7197
|
+
const outside = requireOutside();
|
|
7198
|
+
const gtr = requireGtr();
|
|
7199
|
+
const ltr = requireLtr();
|
|
7200
|
+
const intersects = requireIntersects();
|
|
7201
|
+
const simplifyRange = requireSimplify();
|
|
7202
|
+
const subset = requireSubset();
|
|
7203
|
+
semver = {
|
|
7204
|
+
parse,
|
|
7205
|
+
valid,
|
|
7206
|
+
clean,
|
|
7207
|
+
inc,
|
|
7208
|
+
diff,
|
|
7209
|
+
major,
|
|
7210
|
+
minor,
|
|
7211
|
+
patch,
|
|
7212
|
+
prerelease,
|
|
7213
|
+
compare,
|
|
7214
|
+
rcompare,
|
|
7215
|
+
compareLoose,
|
|
7216
|
+
compareBuild,
|
|
7217
|
+
sort,
|
|
7218
|
+
rsort,
|
|
7219
|
+
gt,
|
|
7220
|
+
lt,
|
|
7221
|
+
eq,
|
|
7222
|
+
neq,
|
|
7223
|
+
gte,
|
|
7224
|
+
lte,
|
|
7225
|
+
cmp,
|
|
7226
|
+
coerce,
|
|
7227
|
+
Comparator,
|
|
7228
|
+
Range,
|
|
7229
|
+
satisfies,
|
|
7230
|
+
toComparators,
|
|
7231
|
+
maxSatisfying,
|
|
7232
|
+
minSatisfying,
|
|
7233
|
+
minVersion,
|
|
7234
|
+
validRange,
|
|
7235
|
+
outside,
|
|
7236
|
+
gtr,
|
|
7237
|
+
ltr,
|
|
7238
|
+
intersects,
|
|
7239
|
+
simplifyRange,
|
|
7240
|
+
subset,
|
|
7241
|
+
SemVer,
|
|
7242
|
+
re: internalRe.re,
|
|
7243
|
+
src: internalRe.src,
|
|
7244
|
+
tokens: internalRe.t,
|
|
7245
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
7246
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
7247
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
7248
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
7249
|
+
};
|
|
7250
|
+
return semver;
|
|
7251
|
+
}
|
|
7252
|
+
var semverExports = requireSemver();
|
|
7253
|
+
function isCompatible(required, provided) {
|
|
7254
|
+
for (const [name, range] of Object.entries(required)) {
|
|
7255
|
+
const version = provided[name];
|
|
7256
|
+
if (!version) {
|
|
7257
|
+
continue;
|
|
7258
|
+
}
|
|
7259
|
+
if (isSatisfied(range, version) === false) {
|
|
7260
|
+
return false;
|
|
7261
|
+
}
|
|
7262
|
+
}
|
|
7263
|
+
return true;
|
|
7264
|
+
}
|
|
7265
|
+
function isSatisfied(range, version) {
|
|
7266
|
+
if (!semverExports.validRange(range)) {
|
|
7267
|
+
return null;
|
|
7268
|
+
}
|
|
7269
|
+
const coerced = semverExports.coerce(version);
|
|
7270
|
+
if (!coerced) {
|
|
7271
|
+
return null;
|
|
7272
|
+
}
|
|
7273
|
+
return semverExports.satisfies(coerced, range);
|
|
7274
|
+
}
|
|
7275
|
+
|
|
7276
|
+
// ../../node_modules/@bpmn-io/feel-lint/dist/index.js
|
|
7277
|
+
function lintSyntax(syntaxTree) {
|
|
7278
|
+
const lintMessages = [];
|
|
7279
|
+
syntaxTree.iterate({
|
|
7280
|
+
enter: (ref) => {
|
|
7281
|
+
const node = ref.node;
|
|
7282
|
+
if (!node.type.isError) {
|
|
7283
|
+
return;
|
|
7284
|
+
}
|
|
7285
|
+
const parent = node.parent;
|
|
7286
|
+
const next = getNextNode(node);
|
|
7287
|
+
const message = {
|
|
7288
|
+
from: node.from,
|
|
7289
|
+
to: node.to,
|
|
7290
|
+
severity: "error",
|
|
7291
|
+
type: "Syntax Error"
|
|
7292
|
+
};
|
|
7293
|
+
if (node.from !== node.to) {
|
|
7294
|
+
message.message = `Unrecognized token in <${parent.name}>`;
|
|
7295
|
+
} else if (next) {
|
|
7296
|
+
message.message = `Unrecognized token <${next.name}> in <${parent.name}>`;
|
|
7297
|
+
message.to = next.to;
|
|
7298
|
+
} else {
|
|
7299
|
+
const before = parent.enterUnfinishedNodesBefore(node.to);
|
|
7300
|
+
message.message = `Incomplete <${(before || parent).name}>`;
|
|
7301
|
+
}
|
|
7302
|
+
lintMessages.push(message);
|
|
7303
|
+
}
|
|
7304
|
+
});
|
|
7305
|
+
return lintMessages;
|
|
7306
|
+
}
|
|
7307
|
+
function getNextNode(node) {
|
|
7308
|
+
if (!node) {
|
|
7309
|
+
return null;
|
|
7310
|
+
}
|
|
7311
|
+
return node.nextSibling || getNextNode(node.parent);
|
|
7312
|
+
}
|
|
7313
|
+
var RULE_NAME$1 = "first-item";
|
|
7314
|
+
var firstItem = {
|
|
7315
|
+
create(context) {
|
|
7316
|
+
return {
|
|
7317
|
+
enter(node) {
|
|
7318
|
+
if (node.name !== "FilterExpression") {
|
|
7319
|
+
return;
|
|
7320
|
+
}
|
|
7321
|
+
const content = context.readContent(node.from, node.to);
|
|
7322
|
+
if (zeroIndexPattern().test(content)) {
|
|
7323
|
+
const {
|
|
7324
|
+
from,
|
|
7325
|
+
to
|
|
7326
|
+
} = node;
|
|
7327
|
+
context.report({
|
|
7328
|
+
from,
|
|
7329
|
+
to,
|
|
7330
|
+
message: "First item is accessed via [1]",
|
|
7331
|
+
severity: "warning",
|
|
7332
|
+
type: RULE_NAME$1,
|
|
7333
|
+
actions: [
|
|
7334
|
+
{
|
|
7335
|
+
name: "fix",
|
|
7336
|
+
apply(_, start = from, end = to) {
|
|
7337
|
+
context.updateContent(start, end, content.replace(zeroIndexPattern(), "[1]"));
|
|
7338
|
+
}
|
|
7339
|
+
}
|
|
7340
|
+
]
|
|
7341
|
+
});
|
|
7342
|
+
}
|
|
7343
|
+
}
|
|
7344
|
+
};
|
|
7345
|
+
}
|
|
7346
|
+
};
|
|
7347
|
+
function zeroIndexPattern() {
|
|
7348
|
+
return /\[\s*0\s*\]$/;
|
|
7349
|
+
}
|
|
7350
|
+
var RULES = [
|
|
7351
|
+
firstItem
|
|
7352
|
+
];
|
|
7353
|
+
function lintRules(context) {
|
|
7354
|
+
const {
|
|
7355
|
+
readContent,
|
|
7356
|
+
syntaxTree,
|
|
7357
|
+
updateContent
|
|
7358
|
+
} = context;
|
|
7359
|
+
const lintMessages = [];
|
|
7360
|
+
const ruleContext = {
|
|
7361
|
+
readContent,
|
|
7362
|
+
report: (message) => {
|
|
7363
|
+
lintMessages.push(message);
|
|
7364
|
+
},
|
|
7365
|
+
updateContent
|
|
7366
|
+
};
|
|
7367
|
+
const rules = RULES.map((rule) => rule.create(ruleContext));
|
|
7368
|
+
syntaxTree.iterate({
|
|
7369
|
+
enter: (ref) => {
|
|
7370
|
+
for (const rule of rules) {
|
|
7371
|
+
rule.enter && rule.enter(ref);
|
|
7372
|
+
}
|
|
7373
|
+
},
|
|
7374
|
+
leave: (ref) => {
|
|
7375
|
+
for (const rule of rules) {
|
|
7376
|
+
rule.leave && rule.leave(ref);
|
|
7377
|
+
}
|
|
7378
|
+
}
|
|
7379
|
+
});
|
|
7380
|
+
return lintMessages;
|
|
7381
|
+
}
|
|
7382
|
+
var RULE_NAME = "compatibility";
|
|
7383
|
+
function lintCompatibility(context = {}) {
|
|
7384
|
+
const {
|
|
7385
|
+
syntaxTree,
|
|
7386
|
+
expression,
|
|
7387
|
+
engines,
|
|
7388
|
+
builtins = []
|
|
7389
|
+
} = context;
|
|
7390
|
+
if (!engines || !Object.keys(engines).length || !builtins.length) {
|
|
7391
|
+
return [];
|
|
7392
|
+
}
|
|
7393
|
+
const unavailable = getUnavailableBuiltins(builtins, engines);
|
|
7394
|
+
if (!unavailable.size) {
|
|
7395
|
+
return [];
|
|
7396
|
+
}
|
|
7397
|
+
const analyzer = new FeelAnalyzer({ builtins });
|
|
7398
|
+
const { valid, functions = [] } = analyzer.analyzeTree(syntaxTree, expression);
|
|
7399
|
+
if (!valid) {
|
|
7400
|
+
return [];
|
|
7401
|
+
}
|
|
7402
|
+
return functions.reduce((messages, fn) => {
|
|
7403
|
+
if (fn.type !== "builtin") {
|
|
7404
|
+
return messages;
|
|
7405
|
+
}
|
|
7406
|
+
const builtin = unavailable.get(fn.name);
|
|
7407
|
+
if (!builtin) {
|
|
7408
|
+
return messages;
|
|
7409
|
+
}
|
|
7410
|
+
messages.push({
|
|
7411
|
+
from: fn.from,
|
|
7412
|
+
to: fn.to,
|
|
7413
|
+
severity: "warning",
|
|
7414
|
+
type: RULE_NAME,
|
|
7415
|
+
message: `Function '${fn.name}' requires ${formatEngines(builtin.engines)}`
|
|
7416
|
+
});
|
|
7417
|
+
return messages;
|
|
7418
|
+
}, []);
|
|
7419
|
+
}
|
|
7420
|
+
function getUnavailableBuiltins(builtins, engines) {
|
|
7421
|
+
const unavailable = new Map;
|
|
7422
|
+
for (const builtin of builtins) {
|
|
7423
|
+
if (builtin.engines && !isCompatible(builtin.engines, engines)) {
|
|
7424
|
+
unavailable.set(builtin.name, builtin);
|
|
7425
|
+
}
|
|
7426
|
+
}
|
|
7427
|
+
return unavailable;
|
|
7428
|
+
}
|
|
7429
|
+
function formatEngines(engines) {
|
|
7430
|
+
return Object.entries(engines).map(([name, range]) => `${capitalize(name)} ${range}`).join(", ");
|
|
7431
|
+
}
|
|
7432
|
+
function capitalize(string) {
|
|
7433
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
7434
|
+
}
|
|
7435
|
+
function lintAll(context) {
|
|
7436
|
+
const lintMessages = [
|
|
7437
|
+
...lintSyntax(context.syntaxTree),
|
|
7438
|
+
...lintRules(context),
|
|
7439
|
+
...lintCompatibility(context)
|
|
7440
|
+
];
|
|
7441
|
+
return lintMessages;
|
|
7442
|
+
}
|
|
7443
|
+
function createContext2(variables) {
|
|
7444
|
+
return variables.slice().reverse().reduce((context, variable) => {
|
|
7445
|
+
context[variable.name] = () => {};
|
|
7446
|
+
return context;
|
|
7447
|
+
}, {});
|
|
7448
|
+
}
|
|
7449
|
+
function lintExpression(expression, {
|
|
7450
|
+
dialect = "expression",
|
|
7451
|
+
parserDialect,
|
|
7452
|
+
builtins = [],
|
|
7453
|
+
variables = [],
|
|
7454
|
+
engines
|
|
7455
|
+
} = {}) {
|
|
7456
|
+
const context = createContext2([...builtins, ...variables]);
|
|
7457
|
+
const syntaxTree = parser.configure({
|
|
7458
|
+
top: dialect === "unaryTests" ? "UnaryTests" : "Expression",
|
|
7459
|
+
dialect: parserDialect,
|
|
7460
|
+
contextTracker: trackVariables(context)
|
|
7461
|
+
}).parse(expression);
|
|
7462
|
+
const lintMessages = lintAll({
|
|
7463
|
+
syntaxTree,
|
|
7464
|
+
expression,
|
|
7465
|
+
builtins,
|
|
7466
|
+
engines,
|
|
7467
|
+
readContent: (from, to) => expression.slice(from, to),
|
|
7468
|
+
updateContent: (from, to, content) => {}
|
|
7469
|
+
});
|
|
7470
|
+
return lintMessages;
|
|
7471
|
+
}
|
|
7472
|
+
|
|
7473
|
+
// ../../node_modules/@uipath/dmn-editor-utils/dist/validation/index.js
|
|
7474
|
+
var Tt = (e2) => e2.isCollection ? `list<${e2.components ? "context" : e2.baseTypeRef ?? "Any"}>` : e2.baseTypeRef;
|
|
7475
|
+
var qe = (e2) => {
|
|
7476
|
+
let t = B(e2);
|
|
7477
|
+
if (t)
|
|
7478
|
+
return { fieldlessType: t };
|
|
7479
|
+
let n = U(e2);
|
|
7480
|
+
return n ? { fieldlessType: n, fieldlessItems: true } : {};
|
|
7481
|
+
};
|
|
7482
|
+
var He = (e2) => z(e2) ? [] : e2.components && !e2.recursive ? e2.components.map((t) => {
|
|
7483
|
+
let n = He(t.type), i = Tt(t.type);
|
|
7484
|
+
return { name: t.name, ...i ? { detail: i } : {}, ...n ? { entries: n } : {}, ...qe(t.type) };
|
|
7485
|
+
}) : undefined;
|
|
7486
|
+
var Z2 = (e2, t, n, i) => {
|
|
7487
|
+
let a = { name: e2, ...t ? { detail: t } : {} };
|
|
7488
|
+
if (i?.length)
|
|
7489
|
+
return { ...a, entries: i.map((m) => Z2(m.name, m.typeRef, n, m.members)) };
|
|
7490
|
+
let s = J2(n ?? {}, t), r2 = n && He(s);
|
|
7491
|
+
return { ...a, ...r2 ? { entries: r2 } : {}, ...qe(s) };
|
|
7492
|
+
};
|
|
7493
|
+
var B3 = (e2, t = [], n) => {
|
|
7494
|
+
let i = e2.filter((r2) => ne(r2)), a = i.map((r2) => Z2(ne(r2), r2.typeRef, n)), s = new Set(i.map(ne));
|
|
7495
|
+
for (let r2 of t)
|
|
7496
|
+
s.has(r2.name) || (s.add(r2.name), a.push(Z2(r2.name, r2.typeRef, n, r2.members)));
|
|
7497
|
+
return a;
|
|
7498
|
+
};
|
|
7499
|
+
var We = "DMN_INPUT_EXPRESSION_MISSING";
|
|
7500
|
+
var Et = ["error", "warning", "info"];
|
|
7501
|
+
var vt = (e2) => Et.includes(e2) ? e2 : "info";
|
|
7502
|
+
var It = (e2) => ({ from: e2.from, to: e2.to, severity: vt(e2.severity), message: e2.message });
|
|
7503
|
+
var ee3 = (e2, t, n = []) => lintExpression(e2, { dialect: t, variables: n }).map(It);
|
|
7504
|
+
var te2 = (e2, t) => {
|
|
7505
|
+
let n = e2.trim();
|
|
7506
|
+
return n === "" || t === "unaryTests" && n === "-";
|
|
7507
|
+
};
|
|
7508
|
+
var ht = /"(?:\\[\s\S]|[^"\\])*"?|\/\*[\s\S]*?(?:\*\/|$)|\/\/[^\n]*|'/g;
|
|
7509
|
+
var Mt = (e2) => Array.from(e2.matchAll(ht), (t) => t[0] === "'" ? t.index : -1).filter((t) => t >= 0);
|
|
7510
|
+
var Xe = (e2, t) => {
|
|
7511
|
+
let n = new Set(t.filter((i) => i.severity === "error").map((i) => i.from));
|
|
7512
|
+
return Mt(e2).find((i) => n.has(i));
|
|
7513
|
+
};
|
|
7514
|
+
var I2 = (e2, t, n) => {
|
|
7515
|
+
if (te2(e2, t))
|
|
7516
|
+
return [];
|
|
7517
|
+
let i = ee3(e2, t, n), a = Xe(e2, i);
|
|
7518
|
+
return a !== undefined ? [{ code: "DMN_FEEL_SYNTAX", severity: "error", messageKey: "validation_feel_single_quote", range: { from: a, to: a + 1 } }] : i.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 } });
|
|
7519
|
+
};
|
|
7520
|
+
var ne3 = { StringLiteral: "string", NumericLiteral: "number", BooleanLiteral: "boolean" };
|
|
7521
|
+
var je = { string: ["number", "boolean"], number: ["string", "boolean"], boolean: ["string", "number"] };
|
|
7522
|
+
var ie = (e2, t) => {
|
|
7523
|
+
let n = e2.trim();
|
|
7524
|
+
if (!n)
|
|
7525
|
+
return;
|
|
7526
|
+
let i = c(n, t), a;
|
|
7527
|
+
return i.iterate({ enter(s) {
|
|
7528
|
+
s.from === 0 && s.to === n.length && (a = ne3[s.name] ?? a);
|
|
7529
|
+
} }), a;
|
|
7530
|
+
};
|
|
7531
|
+
var ze = (e2, t) => !e2 || !t || !je[e2].includes(R2(t)) ? [] : [{ code: "DMN_TYPE_MISMATCH", severity: "error", messageKey: "validation_type_mismatch", messageParams: { literalType: e2, columnType: t } }];
|
|
7532
|
+
var bt = new Set([...Object.keys(ne3), "DateTimeLiteral", "null"]);
|
|
7533
|
+
var St = new Set(["UnaryTests", "PositiveUnaryTests", "PositiveUnaryTest", "SimplePositiveUnaryTest", "Interval", "Expression"]);
|
|
7534
|
+
var Ot = (e2) => {
|
|
7535
|
+
for (let t = e2;t; t = t.parent)
|
|
7536
|
+
if (t.name === "Interval")
|
|
7537
|
+
return true;
|
|
7538
|
+
return false;
|
|
7539
|
+
};
|
|
7540
|
+
var Pt = (e2) => {
|
|
7541
|
+
for (let t = e2;t; t = t.parent)
|
|
7542
|
+
if (!St.has(t.name))
|
|
7543
|
+
return false;
|
|
7544
|
+
return true;
|
|
7545
|
+
};
|
|
7546
|
+
var Rt = (e2, t) => {
|
|
7547
|
+
let n = e2.trim(), i = { operands: [], intervals: [] };
|
|
7548
|
+
if (!n)
|
|
7549
|
+
return i;
|
|
7550
|
+
let a = e2.length - e2.trimStart().length;
|
|
7551
|
+
return c(n, t).iterate({ enter(s) {
|
|
7552
|
+
if (!bt.has(s.name) && s.name !== "Interval" || !Pt(s.node.parent))
|
|
7553
|
+
return;
|
|
7554
|
+
let r2 = { from: a + s.from, to: a + s.to };
|
|
7555
|
+
if (s.name === "Interval") {
|
|
7556
|
+
Ot(s.node.parent) || i.intervals.push(r2);
|
|
7557
|
+
return;
|
|
7558
|
+
}
|
|
7559
|
+
i.operands.push({ nodeName: s.name, kind: ne3[s.name], ...r2 });
|
|
7560
|
+
} }), i;
|
|
7561
|
+
};
|
|
7562
|
+
var At2 = (e2) => {
|
|
7563
|
+
let t = R2(e2);
|
|
7564
|
+
return t === "string" || t === "number" || t === "boolean" ? t : undefined;
|
|
7565
|
+
};
|
|
7566
|
+
var wt = new Set(["number", "string", "date", "time", "date and time", "dayTimeDuration", "yearMonthDuration"]);
|
|
7567
|
+
var xt = new Set(["boolean"]);
|
|
7568
|
+
var Lt = (e2) => {
|
|
7569
|
+
let t = R2(e2);
|
|
7570
|
+
return wt.has(t) ? "ordered" : xt.has(t) ? "unordered" : "unknown";
|
|
7571
|
+
};
|
|
7572
|
+
var $e = (e2, t) => t.from >= e2.from && t.to <= e2.to;
|
|
7573
|
+
var se = (e2, t, n) => {
|
|
7574
|
+
if (!n || te2(e2, t))
|
|
7575
|
+
return [];
|
|
7576
|
+
let { operands: i, intervals: a } = Rt(e2, t), s = [], r2 = At2(n), m = Lt(n), u = m === "unordered" ? a : [];
|
|
7577
|
+
if (m === "unordered")
|
|
7578
|
+
for (let l of a)
|
|
7579
|
+
s.push({ code: "DMN_RANGE_NOT_ORDERED", severity: "error", messageKey: "validation_range_not_ordered", messageParams: { columnType: n }, range: l });
|
|
7580
|
+
else if (!r2)
|
|
7581
|
+
for (let l of a)
|
|
7582
|
+
new Set(i.filter((D) => $e(l, D) && D.kind).map((D) => D.kind)).size > 1 && s.push({ code: "DMN_RANGE_ENDPOINT_TYPES", severity: "error", messageKey: "validation_range_endpoint_types", range: l });
|
|
7583
|
+
if (et.has(R2(n))) {
|
|
7584
|
+
for (let l of i) {
|
|
7585
|
+
let _ = e2.slice(l.from, l.to), D = l.nodeName === "null" ? "" : Y(_);
|
|
7586
|
+
l.nodeName !== "null" && (D === undefined || !de(D, n)) && s.push({ code: "DMN_VALUE_NOT_VALID_FOR_TYPE", severity: "error", messageKey: "validation_value_not_valid_for_type", messageParams: { value: _, columnType: n }, range: { from: l.from, to: l.to } });
|
|
7587
|
+
}
|
|
7588
|
+
return s;
|
|
7589
|
+
}
|
|
7590
|
+
if (!r2)
|
|
7591
|
+
return s;
|
|
7592
|
+
for (let l of i)
|
|
7593
|
+
if (!(l.nodeName === "null" || u.some((_) => $e(_, l)))) {
|
|
7594
|
+
if (r2 === "boolean") {
|
|
7595
|
+
l.kind !== "boolean" && s.push({ code: "DMN_BOOLEAN_COLUMN_VALUE", severity: "error", messageKey: "validation_boolean_column_value", messageParams: { value: e2.slice(l.from, l.to) }, range: { from: l.from, to: l.to } });
|
|
7596
|
+
continue;
|
|
7597
|
+
}
|
|
7598
|
+
l.kind && je[l.kind].includes(r2) && s.push({ code: "DMN_TYPE_MISMATCH", severity: "error", messageKey: "validation_value_not_valid_for_type", messageParams: { value: e2.slice(l.from, l.to), columnType: n }, range: { from: l.from, to: l.to } });
|
|
7599
|
+
}
|
|
7600
|
+
return s;
|
|
7601
|
+
};
|
|
7602
|
+
var Je = (e2) => {
|
|
7603
|
+
let t = c(e2.trim(), "unaryTests").topNode, n = t.getChild("PositiveUnaryTests");
|
|
7604
|
+
return n && !t.getChild("not") ? n.getChildren("PositiveUnaryTest").length : 1;
|
|
7605
|
+
};
|
|
7606
|
+
var re2 = (e2) => {
|
|
7607
|
+
let t = ie(e2, "expression");
|
|
7608
|
+
return t ? Ct(t, e2) : Y(e2);
|
|
7609
|
+
};
|
|
7610
|
+
var Ze = (e2) => {
|
|
7611
|
+
let t = e2.trim(), n = c(t, "unaryTests").topNode, i = n.getChild("PositiveUnaryTests");
|
|
7612
|
+
if (!i || n.getChild("not"))
|
|
7613
|
+
return;
|
|
7614
|
+
let a = new Set;
|
|
7615
|
+
for (let s of i.getChildren("PositiveUnaryTest")) {
|
|
7616
|
+
let r2 = re2(t.slice(s.from, s.to));
|
|
7617
|
+
if (r2 === undefined)
|
|
7618
|
+
return;
|
|
7619
|
+
a.add(r2);
|
|
7620
|
+
}
|
|
7621
|
+
return a;
|
|
7622
|
+
};
|
|
7623
|
+
var Ct = (e2, t) => {
|
|
7624
|
+
let n = t.trim();
|
|
7625
|
+
return e2 === "number" ? Number(n.replace(/\s+/g, "")) : e2 === "string" ? X(n)[0] : n === "true";
|
|
7626
|
+
};
|
|
7627
|
+
var Ft = (e2, t) => t.results.has(e2) ? ["DMN_RESULT_NAME_REFERENCED", "validation_result_name_referenced"] : t.allowedValues?.has(e2) ? ["DMN_ALLOWED_VALUE_UNQUOTED", "validation_allowed_value_unquoted"] : ["DMN_UNKNOWN_NAME", "validation_unknown_name"];
|
|
7628
|
+
var et = new Set(["date", "time", "date and time", "dayTimeDuration", "yearMonthDuration"]);
|
|
7629
|
+
var tt = (e2, t, n = new Set) => {
|
|
7630
|
+
let i = R2(t ?? "string");
|
|
7631
|
+
if (!(W(i) || i === "string"))
|
|
7632
|
+
return [];
|
|
7633
|
+
let a = (m, u) => {
|
|
7634
|
+
if (m === "null")
|
|
7635
|
+
return true;
|
|
7636
|
+
if (i === "string")
|
|
7637
|
+
return U2(m);
|
|
7638
|
+
if (et.has(i)) {
|
|
7639
|
+
let l = Y(m);
|
|
7640
|
+
return l !== undefined && de(l, t);
|
|
7641
|
+
}
|
|
7642
|
+
return !U2(m) && de(u, t);
|
|
7643
|
+
}, s = (m, u, l) => ({ code: "DMN_VALUE_NOT_VALID_FOR_TYPE", severity: "error", messageKey: "validation_value_not_valid_for_type", messageParams: { value: m, columnType: t ?? i }, range: { from: u, to: l } }), r2 = ee2(t);
|
|
7644
|
+
return Q2(e2).flatMap((m) => {
|
|
7645
|
+
if (n.has(m.token))
|
|
7646
|
+
return [];
|
|
7647
|
+
let u = r2 ? K2(m.token) : undefined;
|
|
7648
|
+
return u ? u.filter((l) => !a(l.text, l.text)).map((l) => s(l.text, m.from + l.from, m.from + l.to)) : m.value !== undefined && !a(m.token, m.value) ? [s(m.token, m.from, m.to)] : [];
|
|
7649
|
+
});
|
|
7650
|
+
};
|
|
7651
|
+
var Ut = (e2, t, n) => {
|
|
7652
|
+
let i;
|
|
7653
|
+
return (a, s) => !a.includes("'") && e2[s - 1] !== "'" ? false : (i ??= Xe(e2, ee3(e2, t, Array.from(n, (r2) => ({ name: r2 })))) !== undefined, i);
|
|
7654
|
+
};
|
|
7655
|
+
var Vt = (e2, t, n) => e2.filter((i) => !t.known.has(i.name) && !n(i.name, i.from)).map((i) => {
|
|
7656
|
+
let [a, s] = Ft(i.name, t);
|
|
7657
|
+
return { code: a, messageKey: s, severity: "error", messageParams: { name: i.name }, range: { from: i.from, to: i.to } };
|
|
7658
|
+
});
|
|
7659
|
+
var Qe = new WeakMap;
|
|
7660
|
+
var kt = (e2) => {
|
|
7661
|
+
let t = Qe.get(e2);
|
|
7662
|
+
return t || (t = new Map(e2.map((n) => [n.name, n])), Qe.set(e2, t)), t;
|
|
7663
|
+
};
|
|
7664
|
+
var Kt = (e2, t, n) => {
|
|
7665
|
+
let i = kt(t), a = (s, r2) => {
|
|
7666
|
+
if (n(s.name, s.from))
|
|
7667
|
+
return;
|
|
7668
|
+
let m = { from: s.from, to: s.to };
|
|
7669
|
+
if (r2.fieldlessType) {
|
|
7670
|
+
let l = { name: s.name, parent: r2.name, type: r2.fieldlessType };
|
|
7671
|
+
return { code: "DMN_FIELD_OF_SINGLE_VALUE", severity: "error", messageKey: r2.fieldlessItems ? "validation_field_of_list_item" : "validation_field_of_single_value", messageParams: l, range: m };
|
|
7672
|
+
}
|
|
7673
|
+
return { code: "DMN_UNKNOWN_MEMBER", severity: "error", messageKey: "validation_unknown_member", messageParams: { name: s.name, parent: r2.name }, range: m };
|
|
7674
|
+
};
|
|
7675
|
+
return e2.flatMap(({ segments: s }) => {
|
|
7676
|
+
let r2 = i.get(s[0].name);
|
|
7677
|
+
for (let m of s.slice(1)) {
|
|
7678
|
+
if (!r2 || !r2.entries && !r2.fieldlessType)
|
|
7679
|
+
return [];
|
|
7680
|
+
let u = r2.entries?.find((l) => l.name === m.name);
|
|
7681
|
+
if (!u) {
|
|
7682
|
+
let l = a(m, r2);
|
|
7683
|
+
return l ? [l] : [];
|
|
7684
|
+
}
|
|
7685
|
+
r2 = u;
|
|
7686
|
+
}
|
|
7687
|
+
return [];
|
|
7688
|
+
});
|
|
7689
|
+
};
|
|
7690
|
+
var h3 = (e2, t, n, i) => {
|
|
7691
|
+
if (te2(e2, t))
|
|
7692
|
+
return [];
|
|
7693
|
+
let a = b(e2, t).filter((r2) => !r2.inFilterPredicate), s = Ut(e2, t, n.known);
|
|
7694
|
+
return [...Vt(a, n, s), ...Kt(a, i, s)];
|
|
7695
|
+
};
|
|
7696
|
+
var w3 = (e2) => e2.filter((t) => !ne(t)).map((t) => ({ code: "DMN_INPUT_DATA_NAME_MISSING", severity: "error", messageKey: "validation_input_data_name_missing", target: { kind: "inputData", inputDataId: t.id } }));
|
|
7697
|
+
var nt = (e2) => (e2.definitions.drgElement ?? []).flatMap((t) => {
|
|
7698
|
+
if (t.__$$element !== "inputData")
|
|
7699
|
+
return [];
|
|
7700
|
+
let n = { id: g(t), name: t["@_name"], variableName: t.variable?.["@_name"] };
|
|
7701
|
+
return w3([n]).map((i) => ({ ...i, elementName: fe(t).trim() }));
|
|
7702
|
+
});
|
|
7703
|
+
var G3 = { kind: "document" };
|
|
7704
|
+
var Yt = (e2, t) => {
|
|
7705
|
+
let n = new Set;
|
|
7706
|
+
for (let i = G(e2, t);i && !i.components?.length; i = G(e2, i)) {
|
|
7707
|
+
if (i === t)
|
|
7708
|
+
return true;
|
|
7709
|
+
if (n.has(i))
|
|
7710
|
+
return false;
|
|
7711
|
+
n.add(i);
|
|
7712
|
+
}
|
|
7713
|
+
return false;
|
|
7714
|
+
};
|
|
7715
|
+
var st = (e2) => e2.typeRef === undefined && !e2.components?.length;
|
|
7716
|
+
var rt = (e2, t) => {
|
|
7717
|
+
let n = t.components ?? [], i = new Set;
|
|
7718
|
+
return n.flatMap((a) => {
|
|
7719
|
+
let s = i.has(a.name);
|
|
7720
|
+
return i.add(a.name), [...s ? [{ code: "DMN_ITEM_COMPONENT_DUPLICATE_NAME", severity: "error", messageKey: "validation_item_component_duplicate_name", messageParams: { type: e2, field: a.name }, target: G3 }] : [], ...h(a.name) ? [] : [{ code: "DMN_ITEM_COMPONENT_NAME_INVALID", severity: "error", messageKey: "validation_item_component_name_invalid", messageParams: { type: e2, field: a.name }, target: G3 }], ...st(a) ? [{ code: "DMN_ITEM_COMPONENT_EMPTY", severity: "warning", messageKey: "validation_item_component_empty", messageParams: { type: e2, field: a.name }, target: G3 }] : [], ...rt(e2, a)];
|
|
7721
|
+
});
|
|
7722
|
+
};
|
|
7723
|
+
var at = (e2) => e2.typeRef !== undefined && !!e2.components?.length || !!e2.components?.some(at);
|
|
7724
|
+
var it = new WeakMap;
|
|
7725
|
+
var M2 = (e2) => {
|
|
7726
|
+
let t = e2.itemDefinitions;
|
|
7727
|
+
if (!t)
|
|
7728
|
+
return [];
|
|
7729
|
+
let n = it.get(t);
|
|
7730
|
+
if (n && n.namespace === e2.namespace && n.namespaces === e2.namespaces)
|
|
7731
|
+
return [...n.diagnostics];
|
|
7732
|
+
let i = Bt(e2, t);
|
|
7733
|
+
return it.set(t, { namespace: e2.namespace, namespaces: e2.namespaces, diagnostics: i }), [...i];
|
|
7734
|
+
};
|
|
7735
|
+
var Bt = (e2, t) => {
|
|
7736
|
+
let n = new Set;
|
|
7737
|
+
return t.flatMap((i) => {
|
|
7738
|
+
let a = i.name, s = n.has(a);
|
|
7739
|
+
n.add(a);
|
|
7740
|
+
let r2 = (m, u) => ({ code: m, severity: "error", messageKey: u, messageParams: { type: a }, target: G3 });
|
|
7741
|
+
return [...s ? [r2("DMN_ITEM_DEFINITION_DUPLICATE_NAME", "validation_item_definition_duplicate_name")] : [], ...at(i) ? [r2("DMN_ITEM_DEFINITION_SIMPLE_AND_STRUCTURED", "validation_item_definition_simple_and_structured")] : [], ...Yt(e2, i) ? [r2("DMN_ITEM_DEFINITION_CYCLE", "validation_item_definition_cycle")] : [], ...st(i) ? [{ ...r2("DMN_ITEM_DEFINITION_EMPTY", "validation_item_definition_empty"), severity: "warning" }] : [], ...rt(a, i)];
|
|
7742
|
+
});
|
|
7743
|
+
};
|
|
7744
|
+
var ot = (e2, t, n, i, a) => {
|
|
7745
|
+
let s = { ...n, field: "allowedValues" }, r2 = (m) => m.map((u) => ({ ...u, target: s }));
|
|
7746
|
+
switch (pe(e2, t)) {
|
|
7747
|
+
case "none":
|
|
7748
|
+
return [];
|
|
7749
|
+
case "list":
|
|
7750
|
+
return r2(tt(e2.text, t, a.known));
|
|
7751
|
+
default: {
|
|
7752
|
+
let m = I2(e2.text, "unaryTests", i), l = m.some((_) => _.severity === "error") ? [] : se(e2.text, "unaryTests", t);
|
|
7753
|
+
return r2([...m, ...h3(e2.text, "unaryTests", a, i), ...l]);
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7756
|
+
};
|
|
7757
|
+
var Gt = (e2, t, n) => !n || !g2(n) || [t, n].some((i) => R2(i) === "Any") ? true : T(e2, t) ? false : !g2(t) || R2(t) === R2(n);
|
|
7758
|
+
var dt = (e2) => {
|
|
7759
|
+
let t = e2.trim();
|
|
7760
|
+
return t === "" || t === "-";
|
|
7761
|
+
};
|
|
7762
|
+
var qt = (e2) => JSON.stringify(e2.inputEntries.map((t) => dt(t.text) ? null : t.text.trim()));
|
|
7763
|
+
var Ht = (e2) => ({ kind: "row", ruleId: e2 });
|
|
7764
|
+
var lt = "string";
|
|
7765
|
+
var Wt = new Set(["dayTimeDuration", "yearMonthDuration"]);
|
|
7766
|
+
var mt = (e2, t) => t ? ne2(e2.inputData, t) ?? e2.scopeVariables?.find((n) => n.name === t) : undefined;
|
|
7767
|
+
var ct = (e2, t) => {
|
|
7768
|
+
if (t.foreign)
|
|
7769
|
+
return { name: "Any", list: t.isCollection, structure: false };
|
|
7770
|
+
if (!t.recursive) {
|
|
7771
|
+
if (t.components) {
|
|
7772
|
+
let n = [...t.chain].reverse().find((a) => a.components?.length);
|
|
7773
|
+
return { name: n && e2.itemDefinitions?.includes(n) ? n.name : "context", list: t.isCollection, structure: true };
|
|
7774
|
+
}
|
|
7775
|
+
return t.baseTypeRef === undefined ? undefined : { name: t.baseTypeRef, list: t.isCollection, structure: false };
|
|
7776
|
+
}
|
|
7777
|
+
};
|
|
7778
|
+
var ut = (e2, t) => {
|
|
7779
|
+
let n = e2.structure && !!t?.structure && t.name !== e2.name;
|
|
7780
|
+
return l(e2.structure && !n ? "Any" : e2.name, e2.list);
|
|
7781
|
+
};
|
|
7782
|
+
var $t = (e2, t) => e2.structure && !t.structure && t.name === "Any" && e2.list === t.list || e2.structure === t.structure && e2.name === t.name && e2.list === t.list;
|
|
7783
|
+
var Qt = (e2, t) => {
|
|
7784
|
+
let n = t.trim(), i = mt(e2, n);
|
|
7785
|
+
if (i)
|
|
7786
|
+
return J2(e2, i.typeRef);
|
|
7787
|
+
let a = me(n, "expression"), s = _e(n);
|
|
7788
|
+
if (a.length !== 1 || a[0] !== s)
|
|
7789
|
+
return;
|
|
7790
|
+
let [r2, ...m] = s.split("."), u = m.length ? mt(e2, r2) : undefined;
|
|
7791
|
+
if (u)
|
|
7792
|
+
return K(J2(e2, u.typeRef), m).type;
|
|
7793
|
+
};
|
|
7794
|
+
var ae2 = (e2) => {
|
|
7795
|
+
let t = e2.decision.decisionTable, n = [], i = B3(e2.inputData, e2.scopeVariables, e2), a = new Set(i.map((o) => o.name)), s = te(e2.decision.variableName, e2.decision.name), r2 = new Set([s, ...t.outputs.map((o, c) => ee(o, c))]), m = (o) => new Set(o ? X(o.text) : []), u2 = t.inputs.map((o) => m(o.allowedValues)), l = t.outputs.map((o) => m(A(e2, o)));
|
|
7796
|
+
if (e2.decision.name.trim() || n.push({ code: "DMN_DECISION_NAME_MISSING", severity: "error", messageKey: "validation_decision_name_missing", target: { kind: "decision" } }), t.rules.length === 0 && n.push({ code: "DMN_NO_RULES", severity: "warning", messageKey: "validation_no_rules", target: { kind: "decision" } }), t.hitPolicy === e.Collect && t.aggregation) {
|
|
7797
|
+
let { aggregation: o } = t;
|
|
7798
|
+
t.outputs.forEach((f2) => {
|
|
7799
|
+
let g = p(e2, f2);
|
|
7800
|
+
g && !S(e2, o, f2) && n.push({ code: "DMN_COLLECT_AGGREGATION_TYPE", severity: "error", messageKey: "validation_collect_aggregation_type", messageParams: { aggregation: o, typeRef: g }, target: { kind: "output", outputId: f2.id } });
|
|
7801
|
+
});
|
|
7802
|
+
let c = e2.decision.variableTypeRef, d = t.outputs.length === 1, p2 = u(e2, c);
|
|
7803
|
+
!!c && (d ? !Gt(e2, c, u(e2, C(o, t.outputs[0]))) : T(e2, c) || !!p2 && g2(p2) && p2 !== "Any") && n.push({ code: "DMN_AGGREGATION_RESULT_TYPE", severity: d ? "warning" : "error", messageKey: "validation_aggregation_result_type", messageParams: { aggregation: o, typeRef: c }, target: { kind: "decision" } });
|
|
7804
|
+
}
|
|
7805
|
+
if (m3.has(t.hitPolicy)) {
|
|
7806
|
+
let o = t.outputs.flatMap((c) => A(e2, c) ?? []);
|
|
7807
|
+
o.length === 0 ? n.push({ code: "DMN_RANKED_OUTPUT_VALUES_MISSING", severity: "error", messageKey: "validation_ranked_output_values_missing", messageParams: { hitPolicy: t.hitPolicy }, target: { kind: "decision" } }) : o.every((c) => Je(c.text) < 2) && n.push({ code: "DMN_RANKED_OUTPUT_VALUES_SINGLE", severity: "warning", messageKey: "validation_ranked_output_values_single", messageParams: { hitPolicy: t.hitPolicy }, target: { kind: "decision" } });
|
|
7808
|
+
}
|
|
7809
|
+
let _ = e2.decision.variableTypeRef;
|
|
7810
|
+
O(t) === "list" && _ && x(e2, _) && n.push({ code: "DMN_LIST_RESULT_TYPE", severity: "error", messageKey: "validation_list_result_type", messageParams: { hitPolicy: t.hitPolicy, typeRef: _ }, target: { kind: "decision" } });
|
|
7811
|
+
let D = new Map;
|
|
7812
|
+
t.outputs.forEach((o, c) => {
|
|
7813
|
+
let d = ee(o, c);
|
|
7814
|
+
D.set(d, (D.get(d) ?? 0) + 1);
|
|
7815
|
+
}), t.inputs.forEach((o, c) => {
|
|
7816
|
+
let p = { ...{ kind: "input", inputId: o.id }, field: "expression" };
|
|
7817
|
+
o.expressionText.trim() || n.push({ code: We, severity: "error", messageKey: "validation_input_expression_missing", target: p }), n.push(...[...I2(o.expressionText, "expression", i), ...h3(o.expressionText, "expression", { known: a, results: r2 }, i)].map((y) => ({ ...y, target: p })));
|
|
7818
|
+
let b = Qt(e2, o.expressionText), f2 = b && ct(e2, b), g = o.typeRef ? ct(e2, J2(e2, o.typeRef)) : { name: lt, list: false, structure: false };
|
|
7819
|
+
if (!!f2 && (f2.structure || f2.name !== "Any" && r.includes(f2.name)) && (g ? !$t(f2, g) : !f2.structure)) {
|
|
7820
|
+
let y = !f2.structure && !f2.list && f2.name === "string" && !!g && !g.list && Wt.has(g.name);
|
|
7821
|
+
n.push({ code: "DMN_COLUMN_TYPE_MISMATCH", severity: "error", messageKey: y ? "validation_column_type_mismatch_duration" : "validation_column_type_mismatch", messageParams: { name: o.expressionText.trim(), declared: ut(f2, g), column: g ? ut(g, f2) : u(e2, o.typeRef) ?? lt }, target: p });
|
|
7822
|
+
}
|
|
7823
|
+
if (o.allowedValues) {
|
|
7824
|
+
let y = E2(e2, o.typeRef), S = { known: a, results: r2, allowedValues: u2[c] };
|
|
7825
|
+
n.push(...ot(o.allowedValues, y, { kind: "input", inputId: o.id }, i, S));
|
|
7826
|
+
}
|
|
7827
|
+
}), t.outputs.forEach((o, c) => {
|
|
7828
|
+
let d = { kind: "output", outputId: o.id }, p2 = ee(o, c);
|
|
7829
|
+
(D.get(p2) ?? 0) > 1 && n.push({ code: "DMN_DUPLICATE_OUTPUT_NAME", severity: "error", messageKey: "validation_duplicate_output_name", messageParams: { name: p2 }, target: d }), o.name?.trim() ? J(o.name.trim()) || n.push({ code: "DMN_OUTPUT_NAME_INVALID", severity: "error", messageKey: "validation_output_name_invalid", messageParams: { name: o.name.trim() }, target: d }) : t.outputs.length > 1 && n.push({ code: "DMN_OUTPUT_NAME_MISSING", severity: "error", messageKey: "validation_output_name_missing", target: d }), o.allowedValues && n.push(...ot(o.allowedValues, E2(e2, p(e2, o)), { kind: "output", outputId: o.id }, i, { known: a, results: r2, allowedValues: l[c] }));
|
|
7830
|
+
});
|
|
7831
|
+
let pt = new Set((e2.scopeVariables ?? []).map((o) => o.name)), ft = xe(t);
|
|
7832
|
+
n.push(...w3(e2.inputData));
|
|
7833
|
+
let le = e2.inputData.filter((o) => ne(o)), q = new Map;
|
|
7834
|
+
le.forEach((o) => {
|
|
7835
|
+
let c = ne(o);
|
|
7836
|
+
q.set(c, (q.get(c) ?? 0) + 1);
|
|
7837
|
+
}), le.forEach((o) => {
|
|
7838
|
+
let c = ne(o), d = { kind: "inputData", inputDataId: o.id };
|
|
7839
|
+
(q.get(c) ?? 0) > 1 || c === s ? n.push({ code: "DMN_DUPLICATE_INPUT_DATA_NAME", severity: "error", messageKey: "validation_duplicate_input_data_name", messageParams: { name: c }, target: d }) : pt.has(c) && n.push({ code: "DMN_INPUT_DATA_SHADOWS_DECISION", severity: "error", messageKey: "validation_input_data_shadows_decision", messageParams: { name: c }, target: d }), h(c) || n.push({ code: "DMN_INPUT_DATA_NAME_INVALID", severity: "error", messageKey: "validation_input_data_name_invalid", messageParams: { name: c }, target: d }), !o.requirementId && ft.has(c) && n.push({ code: "DMN_MISSING_REQUIREMENT", severity: "error", messageKey: "validation_missing_requirement", messageParams: { name: c }, target: d });
|
|
7840
|
+
});
|
|
7841
|
+
let gt = t.outputs.map((o) => {
|
|
7842
|
+
let c = A(e2, o);
|
|
7843
|
+
return c && Ze(c.text);
|
|
7844
|
+
}), me = t.outputs.map(() => 0), ce = new Set, ue = false;
|
|
7845
|
+
return t.rules.forEach((o) => {
|
|
7846
|
+
let c = Ht(o.id);
|
|
7847
|
+
if ((o.inputEntries.length !== t.inputs.length || o.outputEntries.length !== t.outputs.length) && n.push({ code: "DMN_RULE_ENTRY_COUNT", severity: "error", messageKey: "validation_rule_entry_count", target: c }), t.hitPolicy === e.First && (ue ? n.push({ code: "DMN_UNREACHABLE_RULE", severity: "warning", messageKey: "validation_unreachable_rule", target: c }) : o.inputEntries.every((p) => dt(p.text)) && (ue = true)), !f.has(t.hitPolicy)) {
|
|
7848
|
+
let p = qt(o);
|
|
7849
|
+
ce.has(p) ? n.push({ code: "DMN_DUPLICATE_RULE", severity: "warning", messageKey: "validation_duplicate_rule", target: c }) : ce.add(p);
|
|
7850
|
+
}
|
|
7851
|
+
let d = [{ entries: o.inputEntries, columns: t.inputs, literals: u2, dialect: "unaryTests" }, { entries: o.outputEntries, columns: t.outputs, literals: l, dialect: "expression" }];
|
|
7852
|
+
for (let { entries: p, columns: b, literals: f2, dialect: g } of d)
|
|
7853
|
+
p.forEach((E, y) => {
|
|
7854
|
+
let S = b[y];
|
|
7855
|
+
if (!S)
|
|
7856
|
+
return;
|
|
7857
|
+
let de = { kind: "cell", ruleId: o.id, columnId: S.id }, H = I2(E.text, g, i), W = g === "expression" && !H.some((O) => O.severity === "error") ? gt[y] : undefined, pe = W ? re2(E.text) : undefined, fe = H.some((O) => O.severity === "error") ? [] : se(E.text, g, E2(e2, S.typeRef)), _t = [...H, ...h3(E.text, g, { known: a, results: r2, allowedValues: f2[y] }, i), ...fe];
|
|
7858
|
+
n.push(..._t.map((O) => ({ ...O, target: de }))), !(!W || !E.text.trim()) && (pe === undefined ? me[y] += 1 : fe.length === 0 && !W.has(pe) && n.push({ code: "DMN_OUTPUT_VALUE_NOT_ALLOWED", severity: "error", messageKey: "validation_output_value_not_allowed", messageParams: { value: E.text.trim() }, target: de }));
|
|
7859
|
+
});
|
|
7860
|
+
}), t.outputs.forEach((o, c) => {
|
|
7861
|
+
let d = me[c];
|
|
7862
|
+
d > 0 && n.push({ code: "DMN_OUTPUT_VALUE_UNCHECKED", severity: "warning", messageKey: "validation_output_value_unchecked", messageParams: { count: d }, target: { kind: "output", outputId: o.id, field: "allowedValues" } });
|
|
7863
|
+
}), n.push(...M2(e2)), n;
|
|
7864
|
+
};
|
|
7865
|
+
var oe2 = (e2) => {
|
|
7866
|
+
let { literalExpression: t } = e2.decision, n = M2(e2), i = { kind: "decision" }, a = B3(e2.inputData, e2.scopeVariables, e2);
|
|
7867
|
+
if (e2.decision.name.trim() || n.push({ code: "DMN_DECISION_NAME_MISSING", severity: "error", messageKey: "validation_decision_name_missing", target: i }), n.push(...w3(e2.inputData)), !t.text.trim())
|
|
7868
|
+
return n.push({ code: "DMN_LITERAL_EXPRESSION_EMPTY", severity: "error", messageKey: "validation_literal_expression_empty", target: i }), n;
|
|
7869
|
+
t.typeRef || n.push({ code: "DMN_LITERAL_EXPRESSION_TYPE_MISSING", severity: "warning", messageKey: "validation_literal_expression_type_missing", target: i });
|
|
7870
|
+
let s = new Set(a.map((r2) => r2.name));
|
|
7871
|
+
return n.push(...[...I2(t.text, "expression", a), ...h3(t.text, "expression", { known: s, results: new Set([te(e2.decision.variableName, e2.decision.name)]) }, a), ...ze(ie(t.text, "expression"), t.typeRef)].map((r2) => ({ ...r2, target: i }))), n;
|
|
7872
|
+
};
|
|
7873
|
+
var Xt = new Set(["invalid-xml", "unsafe-xml", "migration-failed", "unsupported-version"]);
|
|
7874
|
+
var jt = (e2) => Xt.has(e2) ? { code: "DMN_DOCUMENT_UNREADABLE", severity: "error", messageKey: "validation_document_unreadable", target: { kind: "document" } } : null;
|
|
7875
|
+
var zt = (e2) => {
|
|
7876
|
+
let t = e2.definitions.drgElement ?? [], n = new Set(t.filter((r2) => r2.__$$element === "inputData").map(g)), i = new Set(t.filter((r2) => r2.__$$element === "decision").map(g)), a = (r2, m) => {
|
|
7877
|
+
if (!r2)
|
|
7878
|
+
return false;
|
|
7879
|
+
let u = r2["@_href"], l = $(u);
|
|
7880
|
+
return l !== undefined ? !m.has(l) : !u;
|
|
7881
|
+
};
|
|
7882
|
+
return t.filter((r2) => r2.__$$element === "decision").some((r2) => (r2.informationRequirement ?? []).some((m) => a(m.requiredInput, n) || a(m.requiredDecision, i))) ? [{ code: "DMN_DANGLING_REQUIREMENT", severity: "error", messageKey: "validation_dangling_requirement", target: { kind: "document" } }] : [];
|
|
7883
|
+
};
|
|
7884
|
+
var Jt = async (e2, t) => {
|
|
7885
|
+
let n = await bs(e2);
|
|
7886
|
+
if (n.status === "error") {
|
|
7887
|
+
let s = jt(n.reason);
|
|
7888
|
+
return s ? [s] : [];
|
|
7889
|
+
}
|
|
7890
|
+
let i = zt(n.document);
|
|
7891
|
+
if (i.length > 0)
|
|
7892
|
+
return i;
|
|
7893
|
+
if (w(n.document.definitions).length === 1) {
|
|
7894
|
+
let s = t?.kind === "decision-table" ? t : await At(e2);
|
|
7895
|
+
if (s.kind === "decision-table")
|
|
7896
|
+
return i.push(...ae2(s.model)), i;
|
|
7897
|
+
}
|
|
7898
|
+
let a = Ui(n.document);
|
|
7899
|
+
return a ? i.push(...oe2(a)) : i.push(...nt(n.document), ...M2(Q(n.document.definitions))), i;
|
|
7900
|
+
};
|
|
7901
|
+
export {
|
|
7902
|
+
Jt as validateDmnDocument
|
|
7903
|
+
};
|
|
4615
7904
|
|
|
4616
|
-
//# debugId=
|
|
7905
|
+
//# debugId=C52D52571BE6132564756E2164756E21
|