@digipair/skill-mcp 0.104.0 → 0.105.1
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/index.cjs.js +113 -57
- package/index.esm.js +108 -52
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -23938,14 +23938,14 @@ function indent(str, spaces) {
|
|
|
23938
23938
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
23939
23939
|
// match is required
|
|
23940
23940
|
if (!match) {
|
|
23941
|
-
return nextMatch = nextMatch1,
|
|
23941
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23942
23942
|
v: nextMatch1
|
|
23943
23943
|
};
|
|
23944
23944
|
}
|
|
23945
23945
|
var token = match.token, offset = match.offset;
|
|
23946
23946
|
i1 += offset;
|
|
23947
23947
|
if (token === " ") {
|
|
23948
|
-
return nextMatch = nextMatch1,
|
|
23948
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23949
23949
|
}
|
|
23950
23950
|
tokens1 = _to_consumable_array$j(tokens1).concat([
|
|
23951
23951
|
token
|
|
@@ -23964,7 +23964,7 @@ function indent(str, spaces) {
|
|
|
23964
23964
|
if (contextKeys.some(function(el) {
|
|
23965
23965
|
return el.startsWith(name);
|
|
23966
23966
|
})) {
|
|
23967
|
-
return nextMatch = nextMatch1,
|
|
23967
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23968
23968
|
}
|
|
23969
23969
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23970
23970
|
return el === name;
|
|
@@ -23983,9 +23983,9 @@ function indent(str, spaces) {
|
|
|
23983
23983
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23984
23984
|
return el.startsWith(name);
|
|
23985
23985
|
})) {
|
|
23986
|
-
return nextMatch = nextMatch1,
|
|
23986
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23987
23987
|
}
|
|
23988
|
-
return nextMatch = nextMatch1,
|
|
23988
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23989
23989
|
v: nextMatch1
|
|
23990
23990
|
};
|
|
23991
23991
|
};
|
|
@@ -24849,7 +24849,7 @@ var parser = LRParser.deserialize({
|
|
|
24849
24849
|
2
|
|
24850
24850
|
],
|
|
24851
24851
|
repeatNodeCount: 14,
|
|
24852
|
-
tokenData: ".
|
|
24852
|
+
tokenData: ".V~RvXY#iYZ$^Z[#i]^$^pq#iqr$crs$nwx&bxy&gyz&lz{&q{|'O|}'T}!O'Y!O!P'g!P!Q(q!Q![*l![!]+T!]!^+Y!^!_+_!_!`$i!`!a+n!b!c+x!}#O+}#P#Q,S#Q#R&y#S#T,X#o#p-{#q#r.Q$f$g#i#BY#BZ#i$IS$I_#i$I|$I}$^$I}$JO$^$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~#nY#r~XY#iZ[#ipq#i$f$g#i#BY#BZ#i$IS$I_#i$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~$cO#s~~$fP!_!`$i~$nOr~~$qWOY$nZr$nrs%Zs#O$n#O#P%`#P;'S$n;'S;=`&[<%lO$n~%`O$j~~%cRO;'S$n;'S;=`%l;=`O$n~%oXOY$nZr$nrs%Zs#O$n#O#P%`#P;'S$n;'S;=`&[;=`<%l$n<%lO$n~&_P;=`<%l$n~&gO#{~~&lOv~~&qOx~~&vP^~z{&y~'OO_~~'TO[~~'YO$O~R'_PZP!`!a'bQ'gO$_Q~'lQ#z~!O!P'r!Q!['w~'wO#}~~'|R$i~!Q!['w!g!h(V#X#Y(V~(YR{|(c}!O(c!Q![(i~(fP!Q![(i~(nP$i~!Q![(i~(vQ]~z{(|!P!Q*T~)PTOz(|z{)`{;'S(|;'S;=`)}<%lO(|~)cVOz(|z{)`{!P(|!P!Q)x!Q;'S(|;'S;=`)}<%lO(|~)}OQ~~*QP;=`<%l(|~*YSP~OY*TZ;'S*T;'S;=`*f<%lO*T~*iP;=`<%l*T~*qS$i~!O!P*}!Q![*l!g!h(V#X#Y(V~+QP!Q!['w~+YO$]~~+_O$s~R+fP!]QsP!_!`+iP+nOsPR+uP!YQsP!_!`+i~+}O$l~~,SO!i~~,XO!g~~,[WOY,XZ#O,X#O#P,t#P#S,X#S#T-p#T;'S,X;'S;=`-u<%lO,X~,wRO;'S,X;'S;=`-Q;=`O,X~-TXOY,XZ#O,X#O#P,t#P#S,X#S#T-p#T;'S,X;'S;=`-u;=`<%l,X<%lO,X~-uO$Z~~-xP;=`<%l,X~.QO#S~~.VO#R~",
|
|
24853
24853
|
tokenizers: [
|
|
24854
24854
|
propertyIdentifiers,
|
|
24855
24855
|
identifiers,
|
|
@@ -25365,6 +25365,9 @@ function parseParameterNames(fn) {
|
|
|
25365
25365
|
function notImplemented(thing) {
|
|
25366
25366
|
return new Error("not implemented: ".concat(thing));
|
|
25367
25367
|
}
|
|
25368
|
+
function isNotImplemented(err) {
|
|
25369
|
+
return /^not implemented/.test(err.message);
|
|
25370
|
+
}
|
|
25368
25371
|
/**
|
|
25369
25372
|
* Returns a name from context or undefined if it does not exist.
|
|
25370
25373
|
*
|
|
@@ -25485,6 +25488,9 @@ var builtins = {
|
|
|
25485
25488
|
d = from;
|
|
25486
25489
|
}
|
|
25487
25490
|
if (year) {
|
|
25491
|
+
if (!isNumber(month) || !isNumber(day)) {
|
|
25492
|
+
return null;
|
|
25493
|
+
}
|
|
25488
25494
|
d = date$1().setZone("utc").set({
|
|
25489
25495
|
year: year,
|
|
25490
25496
|
month: month,
|
|
@@ -25539,7 +25545,7 @@ var builtins = {
|
|
|
25539
25545
|
from = hour;
|
|
25540
25546
|
hour = null;
|
|
25541
25547
|
}
|
|
25542
|
-
if (isString(from)) {
|
|
25548
|
+
if (isString(from) && from) {
|
|
25543
25549
|
t = date$1(null, from);
|
|
25544
25550
|
}
|
|
25545
25551
|
if (isDateTime(from)) {
|
|
@@ -25550,6 +25556,9 @@ var builtins = {
|
|
|
25550
25556
|
});
|
|
25551
25557
|
}
|
|
25552
25558
|
if (isNumber(hour)) {
|
|
25559
|
+
if (!isNumber(minute) || !isNumber(second)) {
|
|
25560
|
+
return null;
|
|
25561
|
+
}
|
|
25553
25562
|
// TODO: support offset = days and time duration
|
|
25554
25563
|
t = date$1().set({
|
|
25555
25564
|
hour: hour,
|
|
@@ -25659,7 +25668,8 @@ var builtins = {
|
|
|
25659
25668
|
"string"
|
|
25660
25669
|
]),
|
|
25661
25670
|
"replace": fn(function(input, pattern, replacement, flags) {
|
|
25662
|
-
|
|
25671
|
+
var regexp = createRegexp(pattern, flags || "", "g");
|
|
25672
|
+
return regexp && input.replace(regexp, replacement.replace(/\$0/g, "$$&"));
|
|
25663
25673
|
}, [
|
|
25664
25674
|
"string",
|
|
25665
25675
|
"string",
|
|
@@ -25672,9 +25682,9 @@ var builtins = {
|
|
|
25672
25682
|
"string",
|
|
25673
25683
|
"string"
|
|
25674
25684
|
]),
|
|
25675
|
-
// eslint-disable-next-line
|
|
25676
25685
|
"matches": fn(function(input, pattern, flags) {
|
|
25677
|
-
|
|
25686
|
+
var regexp = createRegexp(pattern, flags || "", "");
|
|
25687
|
+
return regexp && regexp.test(input);
|
|
25678
25688
|
}, [
|
|
25679
25689
|
"string",
|
|
25680
25690
|
"string",
|
|
@@ -25693,7 +25703,8 @@ var builtins = {
|
|
|
25693
25703
|
"string"
|
|
25694
25704
|
]),
|
|
25695
25705
|
"split": fn(function(string, delimiter) {
|
|
25696
|
-
|
|
25706
|
+
var regexp = createRegexp(delimiter, "", "");
|
|
25707
|
+
return regexp && string.split(regexp);
|
|
25697
25708
|
}, [
|
|
25698
25709
|
"string",
|
|
25699
25710
|
"string"
|
|
@@ -26609,6 +26620,35 @@ function mode(array) {
|
|
|
26609
26620
|
function ifValid(o) {
|
|
26610
26621
|
return o.isValid ? o : null;
|
|
26611
26622
|
}
|
|
26623
|
+
/**
|
|
26624
|
+
* Concatenates flags for a regular expression.
|
|
26625
|
+
*
|
|
26626
|
+
* Ensures that default flags are included without duplication, even if
|
|
26627
|
+
* user-specified flags overlap with the defaults.
|
|
26628
|
+
*/ function buildFlags(flags, defaultFlags) {
|
|
26629
|
+
var unsupportedFlags = flags.replace(/[smix]/g, "");
|
|
26630
|
+
if (unsupportedFlags) {
|
|
26631
|
+
throw new Error("illegal flags: " + unsupportedFlags);
|
|
26632
|
+
}
|
|
26633
|
+
// we don't implement the <x> flag
|
|
26634
|
+
if (/x/.test(flags)) {
|
|
26635
|
+
throw notImplemented("matches <x> flag");
|
|
26636
|
+
}
|
|
26637
|
+
return flags + defaultFlags;
|
|
26638
|
+
}
|
|
26639
|
+
/**
|
|
26640
|
+
* Creates a regular expression from a given pattern
|
|
26641
|
+
*/ function createRegexp(pattern, flags) {
|
|
26642
|
+
var defaultFlags = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
26643
|
+
try {
|
|
26644
|
+
return new RegExp(pattern, "u" + buildFlags(flags, defaultFlags));
|
|
26645
|
+
} catch (_err) {
|
|
26646
|
+
if (isNotImplemented(_err)) {
|
|
26647
|
+
throw _err;
|
|
26648
|
+
}
|
|
26649
|
+
}
|
|
26650
|
+
return null;
|
|
26651
|
+
}
|
|
26612
26652
|
function parseExpression(expression) {
|
|
26613
26653
|
var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, dialect = arguments.length > 2 ? arguments[2] : void 0;
|
|
26614
26654
|
return parser.configure({
|
|
@@ -27063,27 +27103,59 @@ function evalNode(node, input, args) {
|
|
|
27063
27103
|
};
|
|
27064
27104
|
case "Type":
|
|
27065
27105
|
return args[0];
|
|
27106
|
+
// (x in [ [1,2], [3,4] ]), (y in x)
|
|
27066
27107
|
case "InExpressions":
|
|
27067
27108
|
return function(context) {
|
|
27068
|
-
|
|
27069
|
-
|
|
27070
|
-
|
|
27071
|
-
|
|
27072
|
-
|
|
27073
|
-
|
|
27074
|
-
|
|
27075
|
-
|
|
27076
|
-
|
|
27077
|
-
|
|
27078
|
-
|
|
27079
|
-
ctx = [
|
|
27080
|
-
ctx
|
|
27081
|
-
];
|
|
27109
|
+
// we build up evaluation contexts from left to right,
|
|
27110
|
+
// ending up with the cartesian product over all available contexts
|
|
27111
|
+
//
|
|
27112
|
+
// previous context is provided to later context providers
|
|
27113
|
+
// producing <null> as a context during evaluation causes the
|
|
27114
|
+
// whole result to turn <null>
|
|
27115
|
+
var isValidContexts = function(contexts) {
|
|
27116
|
+
if (contexts === null || contexts.some(function(arr) {
|
|
27117
|
+
return getType(arr) === "nil";
|
|
27118
|
+
})) {
|
|
27119
|
+
return false;
|
|
27082
27120
|
}
|
|
27083
|
-
return
|
|
27084
|
-
|
|
27085
|
-
|
|
27086
|
-
|
|
27121
|
+
return true;
|
|
27122
|
+
};
|
|
27123
|
+
var join = function(aContexts, bContextProducer) {
|
|
27124
|
+
var _instance;
|
|
27125
|
+
return (_instance = []).concat.apply(_instance, _to_consumable_array$i(aContexts.map(function(aContext) {
|
|
27126
|
+
var bContexts = bContextProducer(Object.assign(Object.assign({}, context), aContext));
|
|
27127
|
+
if (!isValidContexts(bContexts)) {
|
|
27128
|
+
return null;
|
|
27129
|
+
}
|
|
27130
|
+
return bContexts.map(function(bContext) {
|
|
27131
|
+
return Object.assign(Object.assign({}, aContext), bContext);
|
|
27132
|
+
});
|
|
27133
|
+
})));
|
|
27134
|
+
};
|
|
27135
|
+
var cartesian = function(aContexts, bContextProducer) {
|
|
27136
|
+
for(var _len = arguments.length, otherContextProducers = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
27137
|
+
otherContextProducers[_key - 2] = arguments[_key];
|
|
27138
|
+
}
|
|
27139
|
+
if (!isValidContexts(aContexts)) {
|
|
27140
|
+
return null;
|
|
27141
|
+
}
|
|
27142
|
+
if (!bContextProducer) {
|
|
27143
|
+
return aContexts;
|
|
27144
|
+
}
|
|
27145
|
+
return cartesian.apply(void 0, [
|
|
27146
|
+
join(aContexts, bContextProducer)
|
|
27147
|
+
].concat(_to_consumable_array$i(otherContextProducers)));
|
|
27148
|
+
};
|
|
27149
|
+
var cartesianProduct = function(contextProducers) {
|
|
27150
|
+
var _contextProducers = _to_array(contextProducers), aContextProducer = _contextProducers[0], otherContextProducers = _contextProducers.slice(1);
|
|
27151
|
+
var aContexts = aContextProducer(context);
|
|
27152
|
+
return cartesian.apply(void 0, [
|
|
27153
|
+
aContexts
|
|
27154
|
+
].concat(_to_consumable_array$i(otherContextProducers)));
|
|
27155
|
+
};
|
|
27156
|
+
var product = cartesianProduct(args);
|
|
27157
|
+
return product && product.map(function(p) {
|
|
27158
|
+
return Object.assign(Object.assign({}, context), p);
|
|
27087
27159
|
});
|
|
27088
27160
|
};
|
|
27089
27161
|
// Name kw<"in"> Expr
|
|
@@ -27713,31 +27785,6 @@ function createDateTimeRange(start, end, startIncluded, endIncluded) {
|
|
|
27713
27785
|
includes: includes
|
|
27714
27786
|
});
|
|
27715
27787
|
}
|
|
27716
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27717
|
-
function cartesianProduct(arrays) {
|
|
27718
|
-
var _instance;
|
|
27719
|
-
if (arrays.some(function(arr) {
|
|
27720
|
-
return getType(arr) === "nil";
|
|
27721
|
-
})) {
|
|
27722
|
-
return null;
|
|
27723
|
-
}
|
|
27724
|
-
var f = function(a, b) {
|
|
27725
|
-
return (_instance = []).concat.apply(_instance, _to_consumable_array$i(a.map(function(d) {
|
|
27726
|
-
return b.map(function(e) {
|
|
27727
|
-
return [].concat(d, e);
|
|
27728
|
-
});
|
|
27729
|
-
})));
|
|
27730
|
-
};
|
|
27731
|
-
var cartesian = function(a, b) {
|
|
27732
|
-
for(var _len = arguments.length, c = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
27733
|
-
c[_key - 2] = arguments[_key];
|
|
27734
|
-
}
|
|
27735
|
-
return b ? cartesian.apply(void 0, [
|
|
27736
|
-
f(a, b)
|
|
27737
|
-
].concat(_to_consumable_array$i(c))) : a || [];
|
|
27738
|
-
};
|
|
27739
|
-
return cartesian.apply(void 0, _to_consumable_array$i(arrays));
|
|
27740
|
-
}
|
|
27741
27788
|
function coalecenseTypes(a, b) {
|
|
27742
27789
|
if (!b) {
|
|
27743
27790
|
return a.type;
|
|
@@ -27799,15 +27846,24 @@ function parseString(str) {
|
|
|
27799
27846
|
if (str.endsWith('"')) {
|
|
27800
27847
|
str = str.slice(0, -1);
|
|
27801
27848
|
}
|
|
27802
|
-
return str.replace(/(\\")|(\\\\)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
|
|
27849
|
+
return str.replace(/(\\")|(\\\\)|(\\n)|(\\r)|(\\t)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
|
|
27803
27850
|
for(var _len = arguments.length, groups = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
27804
27851
|
groups[_key - 1] = arguments[_key];
|
|
27805
27852
|
}
|
|
27806
|
-
var _groups = _sliced_to_array$6(groups,
|
|
27853
|
+
var _groups = _sliced_to_array$6(groups, 7), quotes = _groups[0], backslash = _groups[1], newline = _groups[2], carriageReturn = _groups[3], tab = _groups[4], codePoint = _groups[5], charCodes = _groups[6];
|
|
27807
27854
|
if (quotes) {
|
|
27808
27855
|
return '"';
|
|
27809
27856
|
}
|
|
27810
|
-
if (
|
|
27857
|
+
if (newline) {
|
|
27858
|
+
return "\n";
|
|
27859
|
+
}
|
|
27860
|
+
if (carriageReturn) {
|
|
27861
|
+
return "\r";
|
|
27862
|
+
}
|
|
27863
|
+
if (tab) {
|
|
27864
|
+
return " ";
|
|
27865
|
+
}
|
|
27866
|
+
if (backslash) {
|
|
27811
27867
|
return "\\";
|
|
27812
27868
|
}
|
|
27813
27869
|
var escapePattern = /\\u([a-fA-F0-9]+)/ig;
|
package/index.esm.js
CHANGED
|
@@ -24818,7 +24818,7 @@ var parser = LRParser.deserialize({
|
|
|
24818
24818
|
2
|
|
24819
24819
|
],
|
|
24820
24820
|
repeatNodeCount: 14,
|
|
24821
|
-
tokenData: ".
|
|
24821
|
+
tokenData: ".V~RvXY#iYZ$^Z[#i]^$^pq#iqr$crs$nwx&bxy&gyz&lz{&q{|'O|}'T}!O'Y!O!P'g!P!Q(q!Q![*l![!]+T!]!^+Y!^!_+_!_!`$i!`!a+n!b!c+x!}#O+}#P#Q,S#Q#R&y#S#T,X#o#p-{#q#r.Q$f$g#i#BY#BZ#i$IS$I_#i$I|$I}$^$I}$JO$^$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~#nY#r~XY#iZ[#ipq#i$f$g#i#BY#BZ#i$IS$I_#i$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~$cO#s~~$fP!_!`$i~$nOr~~$qWOY$nZr$nrs%Zs#O$n#O#P%`#P;'S$n;'S;=`&[<%lO$n~%`O$j~~%cRO;'S$n;'S;=`%l;=`O$n~%oXOY$nZr$nrs%Zs#O$n#O#P%`#P;'S$n;'S;=`&[;=`<%l$n<%lO$n~&_P;=`<%l$n~&gO#{~~&lOv~~&qOx~~&vP^~z{&y~'OO_~~'TO[~~'YO$O~R'_PZP!`!a'bQ'gO$_Q~'lQ#z~!O!P'r!Q!['w~'wO#}~~'|R$i~!Q!['w!g!h(V#X#Y(V~(YR{|(c}!O(c!Q![(i~(fP!Q![(i~(nP$i~!Q![(i~(vQ]~z{(|!P!Q*T~)PTOz(|z{)`{;'S(|;'S;=`)}<%lO(|~)cVOz(|z{)`{!P(|!P!Q)x!Q;'S(|;'S;=`)}<%lO(|~)}OQ~~*QP;=`<%l(|~*YSP~OY*TZ;'S*T;'S;=`*f<%lO*T~*iP;=`<%l*T~*qS$i~!O!P*}!Q![*l!g!h(V#X#Y(V~+QP!Q!['w~+YO$]~~+_O$s~R+fP!]QsP!_!`+iP+nOsPR+uP!YQsP!_!`+i~+}O$l~~,SO!i~~,XO!g~~,[WOY,XZ#O,X#O#P,t#P#S,X#S#T-p#T;'S,X;'S;=`-u<%lO,X~,wRO;'S,X;'S;=`-Q;=`O,X~-TXOY,XZ#O,X#O#P,t#P#S,X#S#T-p#T;'S,X;'S;=`-u;=`<%l,X<%lO,X~-uO$Z~~-xP;=`<%l,X~.QO#S~~.VO#R~",
|
|
24822
24822
|
tokenizers: [
|
|
24823
24823
|
propertyIdentifiers,
|
|
24824
24824
|
identifiers,
|
|
@@ -25334,6 +25334,9 @@ function parseParameterNames(fn) {
|
|
|
25334
25334
|
function notImplemented(thing) {
|
|
25335
25335
|
return new Error("not implemented: ".concat(thing));
|
|
25336
25336
|
}
|
|
25337
|
+
function isNotImplemented(err) {
|
|
25338
|
+
return /^not implemented/.test(err.message);
|
|
25339
|
+
}
|
|
25337
25340
|
/**
|
|
25338
25341
|
* Returns a name from context or undefined if it does not exist.
|
|
25339
25342
|
*
|
|
@@ -25454,6 +25457,9 @@ var builtins = {
|
|
|
25454
25457
|
d = from;
|
|
25455
25458
|
}
|
|
25456
25459
|
if (year) {
|
|
25460
|
+
if (!isNumber(month) || !isNumber(day)) {
|
|
25461
|
+
return null;
|
|
25462
|
+
}
|
|
25457
25463
|
d = date$1().setZone("utc").set({
|
|
25458
25464
|
year: year,
|
|
25459
25465
|
month: month,
|
|
@@ -25508,7 +25514,7 @@ var builtins = {
|
|
|
25508
25514
|
from = hour;
|
|
25509
25515
|
hour = null;
|
|
25510
25516
|
}
|
|
25511
|
-
if (isString(from)) {
|
|
25517
|
+
if (isString(from) && from) {
|
|
25512
25518
|
t = date$1(null, from);
|
|
25513
25519
|
}
|
|
25514
25520
|
if (isDateTime(from)) {
|
|
@@ -25519,6 +25525,9 @@ var builtins = {
|
|
|
25519
25525
|
});
|
|
25520
25526
|
}
|
|
25521
25527
|
if (isNumber(hour)) {
|
|
25528
|
+
if (!isNumber(minute) || !isNumber(second)) {
|
|
25529
|
+
return null;
|
|
25530
|
+
}
|
|
25522
25531
|
// TODO: support offset = days and time duration
|
|
25523
25532
|
t = date$1().set({
|
|
25524
25533
|
hour: hour,
|
|
@@ -25628,7 +25637,8 @@ var builtins = {
|
|
|
25628
25637
|
"string"
|
|
25629
25638
|
]),
|
|
25630
25639
|
"replace": fn(function(input, pattern, replacement, flags) {
|
|
25631
|
-
|
|
25640
|
+
var regexp = createRegexp(pattern, flags || "", "g");
|
|
25641
|
+
return regexp && input.replace(regexp, replacement.replace(/\$0/g, "$$&"));
|
|
25632
25642
|
}, [
|
|
25633
25643
|
"string",
|
|
25634
25644
|
"string",
|
|
@@ -25641,9 +25651,9 @@ var builtins = {
|
|
|
25641
25651
|
"string",
|
|
25642
25652
|
"string"
|
|
25643
25653
|
]),
|
|
25644
|
-
// eslint-disable-next-line
|
|
25645
25654
|
"matches": fn(function(input, pattern, flags) {
|
|
25646
|
-
|
|
25655
|
+
var regexp = createRegexp(pattern, flags || "", "");
|
|
25656
|
+
return regexp && regexp.test(input);
|
|
25647
25657
|
}, [
|
|
25648
25658
|
"string",
|
|
25649
25659
|
"string",
|
|
@@ -25662,7 +25672,8 @@ var builtins = {
|
|
|
25662
25672
|
"string"
|
|
25663
25673
|
]),
|
|
25664
25674
|
"split": fn(function(string, delimiter) {
|
|
25665
|
-
|
|
25675
|
+
var regexp = createRegexp(delimiter, "", "");
|
|
25676
|
+
return regexp && string.split(regexp);
|
|
25666
25677
|
}, [
|
|
25667
25678
|
"string",
|
|
25668
25679
|
"string"
|
|
@@ -26578,6 +26589,35 @@ function mode(array) {
|
|
|
26578
26589
|
function ifValid(o) {
|
|
26579
26590
|
return o.isValid ? o : null;
|
|
26580
26591
|
}
|
|
26592
|
+
/**
|
|
26593
|
+
* Concatenates flags for a regular expression.
|
|
26594
|
+
*
|
|
26595
|
+
* Ensures that default flags are included without duplication, even if
|
|
26596
|
+
* user-specified flags overlap with the defaults.
|
|
26597
|
+
*/ function buildFlags(flags, defaultFlags) {
|
|
26598
|
+
var unsupportedFlags = flags.replace(/[smix]/g, "");
|
|
26599
|
+
if (unsupportedFlags) {
|
|
26600
|
+
throw new Error("illegal flags: " + unsupportedFlags);
|
|
26601
|
+
}
|
|
26602
|
+
// we don't implement the <x> flag
|
|
26603
|
+
if (/x/.test(flags)) {
|
|
26604
|
+
throw notImplemented("matches <x> flag");
|
|
26605
|
+
}
|
|
26606
|
+
return flags + defaultFlags;
|
|
26607
|
+
}
|
|
26608
|
+
/**
|
|
26609
|
+
* Creates a regular expression from a given pattern
|
|
26610
|
+
*/ function createRegexp(pattern, flags) {
|
|
26611
|
+
var defaultFlags = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
26612
|
+
try {
|
|
26613
|
+
return new RegExp(pattern, "u" + buildFlags(flags, defaultFlags));
|
|
26614
|
+
} catch (_err) {
|
|
26615
|
+
if (isNotImplemented(_err)) {
|
|
26616
|
+
throw _err;
|
|
26617
|
+
}
|
|
26618
|
+
}
|
|
26619
|
+
return null;
|
|
26620
|
+
}
|
|
26581
26621
|
function parseExpression(expression) {
|
|
26582
26622
|
var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, dialect = arguments.length > 2 ? arguments[2] : void 0;
|
|
26583
26623
|
return parser.configure({
|
|
@@ -27032,27 +27072,59 @@ function evalNode(node, input, args) {
|
|
|
27032
27072
|
};
|
|
27033
27073
|
case "Type":
|
|
27034
27074
|
return args[0];
|
|
27075
|
+
// (x in [ [1,2], [3,4] ]), (y in x)
|
|
27035
27076
|
case "InExpressions":
|
|
27036
27077
|
return function(context) {
|
|
27037
|
-
|
|
27038
|
-
|
|
27039
|
-
|
|
27040
|
-
|
|
27041
|
-
|
|
27042
|
-
|
|
27043
|
-
|
|
27044
|
-
|
|
27045
|
-
|
|
27046
|
-
|
|
27047
|
-
|
|
27048
|
-
ctx = [
|
|
27049
|
-
ctx
|
|
27050
|
-
];
|
|
27078
|
+
// we build up evaluation contexts from left to right,
|
|
27079
|
+
// ending up with the cartesian product over all available contexts
|
|
27080
|
+
//
|
|
27081
|
+
// previous context is provided to later context providers
|
|
27082
|
+
// producing <null> as a context during evaluation causes the
|
|
27083
|
+
// whole result to turn <null>
|
|
27084
|
+
var isValidContexts = function(contexts) {
|
|
27085
|
+
if (contexts === null || contexts.some(function(arr) {
|
|
27086
|
+
return getType(arr) === "nil";
|
|
27087
|
+
})) {
|
|
27088
|
+
return false;
|
|
27051
27089
|
}
|
|
27052
|
-
return
|
|
27053
|
-
|
|
27054
|
-
|
|
27055
|
-
|
|
27090
|
+
return true;
|
|
27091
|
+
};
|
|
27092
|
+
var join = function(aContexts, bContextProducer) {
|
|
27093
|
+
var _instance;
|
|
27094
|
+
return (_instance = []).concat.apply(_instance, _to_consumable_array$i(aContexts.map(function(aContext) {
|
|
27095
|
+
var bContexts = bContextProducer(Object.assign(Object.assign({}, context), aContext));
|
|
27096
|
+
if (!isValidContexts(bContexts)) {
|
|
27097
|
+
return null;
|
|
27098
|
+
}
|
|
27099
|
+
return bContexts.map(function(bContext) {
|
|
27100
|
+
return Object.assign(Object.assign({}, aContext), bContext);
|
|
27101
|
+
});
|
|
27102
|
+
})));
|
|
27103
|
+
};
|
|
27104
|
+
var cartesian = function(aContexts, bContextProducer) {
|
|
27105
|
+
for(var _len = arguments.length, otherContextProducers = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
27106
|
+
otherContextProducers[_key - 2] = arguments[_key];
|
|
27107
|
+
}
|
|
27108
|
+
if (!isValidContexts(aContexts)) {
|
|
27109
|
+
return null;
|
|
27110
|
+
}
|
|
27111
|
+
if (!bContextProducer) {
|
|
27112
|
+
return aContexts;
|
|
27113
|
+
}
|
|
27114
|
+
return cartesian.apply(void 0, [
|
|
27115
|
+
join(aContexts, bContextProducer)
|
|
27116
|
+
].concat(_to_consumable_array$i(otherContextProducers)));
|
|
27117
|
+
};
|
|
27118
|
+
var cartesianProduct = function(contextProducers) {
|
|
27119
|
+
var _contextProducers = _to_array(contextProducers), aContextProducer = _contextProducers[0], otherContextProducers = _contextProducers.slice(1);
|
|
27120
|
+
var aContexts = aContextProducer(context);
|
|
27121
|
+
return cartesian.apply(void 0, [
|
|
27122
|
+
aContexts
|
|
27123
|
+
].concat(_to_consumable_array$i(otherContextProducers)));
|
|
27124
|
+
};
|
|
27125
|
+
var product = cartesianProduct(args);
|
|
27126
|
+
return product && product.map(function(p) {
|
|
27127
|
+
return Object.assign(Object.assign({}, context), p);
|
|
27056
27128
|
});
|
|
27057
27129
|
};
|
|
27058
27130
|
// Name kw<"in"> Expr
|
|
@@ -27682,31 +27754,6 @@ function createDateTimeRange(start, end, startIncluded, endIncluded) {
|
|
|
27682
27754
|
includes: includes
|
|
27683
27755
|
});
|
|
27684
27756
|
}
|
|
27685
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27686
|
-
function cartesianProduct(arrays) {
|
|
27687
|
-
var _instance;
|
|
27688
|
-
if (arrays.some(function(arr) {
|
|
27689
|
-
return getType(arr) === "nil";
|
|
27690
|
-
})) {
|
|
27691
|
-
return null;
|
|
27692
|
-
}
|
|
27693
|
-
var f = function(a, b) {
|
|
27694
|
-
return (_instance = []).concat.apply(_instance, _to_consumable_array$i(a.map(function(d) {
|
|
27695
|
-
return b.map(function(e) {
|
|
27696
|
-
return [].concat(d, e);
|
|
27697
|
-
});
|
|
27698
|
-
})));
|
|
27699
|
-
};
|
|
27700
|
-
var cartesian = function(a, b) {
|
|
27701
|
-
for(var _len = arguments.length, c = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
27702
|
-
c[_key - 2] = arguments[_key];
|
|
27703
|
-
}
|
|
27704
|
-
return b ? cartesian.apply(void 0, [
|
|
27705
|
-
f(a, b)
|
|
27706
|
-
].concat(_to_consumable_array$i(c))) : a || [];
|
|
27707
|
-
};
|
|
27708
|
-
return cartesian.apply(void 0, _to_consumable_array$i(arrays));
|
|
27709
|
-
}
|
|
27710
27757
|
function coalecenseTypes(a, b) {
|
|
27711
27758
|
if (!b) {
|
|
27712
27759
|
return a.type;
|
|
@@ -27768,15 +27815,24 @@ function parseString(str) {
|
|
|
27768
27815
|
if (str.endsWith('"')) {
|
|
27769
27816
|
str = str.slice(0, -1);
|
|
27770
27817
|
}
|
|
27771
|
-
return str.replace(/(\\")|(\\\\)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
|
|
27818
|
+
return str.replace(/(\\")|(\\\\)|(\\n)|(\\r)|(\\t)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
|
|
27772
27819
|
for(var _len = arguments.length, groups = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
27773
27820
|
groups[_key - 1] = arguments[_key];
|
|
27774
27821
|
}
|
|
27775
|
-
var _groups = _sliced_to_array$6(groups,
|
|
27822
|
+
var _groups = _sliced_to_array$6(groups, 7), quotes = _groups[0], backslash = _groups[1], newline = _groups[2], carriageReturn = _groups[3], tab = _groups[4], codePoint = _groups[5], charCodes = _groups[6];
|
|
27776
27823
|
if (quotes) {
|
|
27777
27824
|
return '"';
|
|
27778
27825
|
}
|
|
27779
|
-
if (
|
|
27826
|
+
if (newline) {
|
|
27827
|
+
return "\n";
|
|
27828
|
+
}
|
|
27829
|
+
if (carriageReturn) {
|
|
27830
|
+
return "\r";
|
|
27831
|
+
}
|
|
27832
|
+
if (tab) {
|
|
27833
|
+
return " ";
|
|
27834
|
+
}
|
|
27835
|
+
if (backslash) {
|
|
27780
27836
|
return "\\";
|
|
27781
27837
|
}
|
|
27782
27838
|
var escapePattern = /\\u([a-fA-F0-9]+)/ig;
|