@digipair/skill-codex 0.103.2 → 0.105.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs.js +113 -57
  2. package/index.esm.js +113 -57
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -23924,14 +23924,14 @@ function indent(str, spaces) {
23924
23924
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23925
23925
  // match is required
23926
23926
  if (!match) {
23927
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23927
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23928
23928
  v: nextMatch1
23929
23929
  };
23930
23930
  }
23931
23931
  var token = match.token, offset = match.offset;
23932
23932
  i1 += offset;
23933
23933
  if (token === " ") {
23934
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23934
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23935
23935
  }
23936
23936
  tokens1 = _to_consumable_array$1(tokens1).concat([
23937
23937
  token
@@ -23950,7 +23950,7 @@ function indent(str, spaces) {
23950
23950
  if (contextKeys.some(function(el) {
23951
23951
  return el.startsWith(name);
23952
23952
  })) {
23953
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23953
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23954
23954
  }
23955
23955
  if (dateTimeIdentifiers.some(function(el) {
23956
23956
  return el === name;
@@ -23969,9 +23969,9 @@ function indent(str, spaces) {
23969
23969
  if (dateTimeIdentifiers.some(function(el) {
23970
23970
  return el.startsWith(name);
23971
23971
  })) {
23972
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23972
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23973
23973
  }
23974
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23974
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1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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~",
24839
24839
  tokenizers: [
24840
24840
  propertyIdentifiers,
24841
24841
  identifiers,
@@ -25351,6 +25351,9 @@ function parseParameterNames(fn) {
25351
25351
  function notImplemented(thing) {
25352
25352
  return new Error("not implemented: ".concat(thing));
25353
25353
  }
25354
+ function isNotImplemented(err) {
25355
+ return /^not implemented/.test(err.message);
25356
+ }
25354
25357
  /**
25355
25358
  * Returns a name from context or undefined if it does not exist.
25356
25359
  *
@@ -25471,6 +25474,9 @@ var builtins = {
25471
25474
  d = from;
25472
25475
  }
25473
25476
  if (year) {
25477
+ if (!isNumber(month) || !isNumber(day)) {
25478
+ return null;
25479
+ }
25474
25480
  d = date().setZone("utc").set({
25475
25481
  year: year,
25476
25482
  month: month,
@@ -25525,7 +25531,7 @@ var builtins = {
25525
25531
  from = hour;
25526
25532
  hour = null;
25527
25533
  }
25528
- if (isString(from)) {
25534
+ if (isString(from) && from) {
25529
25535
  t = date(null, from);
25530
25536
  }
25531
25537
  if (isDateTime(from)) {
@@ -25536,6 +25542,9 @@ var builtins = {
25536
25542
  });
25537
25543
  }
25538
25544
  if (isNumber(hour)) {
25545
+ if (!isNumber(minute) || !isNumber(second)) {
25546
+ return null;
25547
+ }
25539
25548
  // TODO: support offset = days and time duration
25540
25549
  t = date().set({
25541
25550
  hour: hour,
@@ -25645,7 +25654,8 @@ var builtins = {
25645
25654
  "string"
25646
25655
  ]),
25647
25656
  "replace": fn(function(input, pattern, replacement, flags) {
25648
- return input.replace(new RegExp(pattern, "ug" + (flags || "").replace(/[x]/g, "")), replacement.replace(/\$0/g, "$$&"));
25657
+ var regexp = createRegexp(pattern, flags || "", "g");
25658
+ return regexp && input.replace(regexp, replacement.replace(/\$0/g, "$$&"));
25649
25659
  }, [
25650
25660
  "string",
25651
25661
  "string",
@@ -25658,9 +25668,9 @@ var builtins = {
25658
25668
  "string",
25659
25669
  "string"
25660
25670
  ]),
25661
- // eslint-disable-next-line
25662
25671
  "matches": fn(function(input, pattern, flags) {
25663
- throw notImplemented("matches");
25672
+ var regexp = createRegexp(pattern, flags || "", "");
25673
+ return regexp && regexp.test(input);
25664
25674
  }, [
25665
25675
  "string",
25666
25676
  "string",
@@ -25679,7 +25689,8 @@ var builtins = {
25679
25689
  "string"
25680
25690
  ]),
25681
25691
  "split": fn(function(string, delimiter) {
25682
- return string.split(new RegExp(delimiter, "u"));
25692
+ var regexp = createRegexp(delimiter, "", "");
25693
+ return regexp && string.split(regexp);
25683
25694
  }, [
25684
25695
  "string",
25685
25696
  "string"
@@ -26595,6 +26606,35 @@ function mode(array) {
26595
26606
  function ifValid(o) {
26596
26607
  return o.isValid ? o : null;
26597
26608
  }
26609
+ /**
26610
+ * Concatenates flags for a regular expression.
26611
+ *
26612
+ * Ensures that default flags are included without duplication, even if
26613
+ * user-specified flags overlap with the defaults.
26614
+ */ function buildFlags(flags, defaultFlags) {
26615
+ var unsupportedFlags = flags.replace(/[smix]/g, "");
26616
+ if (unsupportedFlags) {
26617
+ throw new Error("illegal flags: " + unsupportedFlags);
26618
+ }
26619
+ // we don't implement the <x> flag
26620
+ if (/x/.test(flags)) {
26621
+ throw notImplemented("matches <x> flag");
26622
+ }
26623
+ return flags + defaultFlags;
26624
+ }
26625
+ /**
26626
+ * Creates a regular expression from a given pattern
26627
+ */ function createRegexp(pattern, flags) {
26628
+ var defaultFlags = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
26629
+ try {
26630
+ return new RegExp(pattern, "u" + buildFlags(flags, defaultFlags));
26631
+ } catch (_err) {
26632
+ if (isNotImplemented(_err)) {
26633
+ throw _err;
26634
+ }
26635
+ }
26636
+ return null;
26637
+ }
26598
26638
  function parseExpression(expression) {
26599
26639
  var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, dialect = arguments.length > 2 ? arguments[2] : void 0;
26600
26640
  return parser.configure({
@@ -27049,27 +27089,59 @@ function evalNode(node, input, args) {
27049
27089
  };
27050
27090
  case "Type":
27051
27091
  return args[0];
27092
+ // (x in [ [1,2], [3,4] ]), (y in x)
27052
27093
  case "InExpressions":
27053
27094
  return function(context) {
27054
- var iterationContexts = args.map(function(ctx) {
27055
- return ctx(context);
27056
- });
27057
- if (iterationContexts.some(function(ctx) {
27058
- return getType(ctx) !== "list";
27059
- })) {
27060
- return null;
27061
- }
27062
- return cartesianProduct(iterationContexts).map(function(ctx) {
27063
- var _Object;
27064
- if (!isArray(ctx)) {
27065
- ctx = [
27066
- ctx
27067
- ];
27095
+ // we build up evaluation contexts from left to right,
27096
+ // ending up with the cartesian product over all available contexts
27097
+ //
27098
+ // previous context is provided to later context providers
27099
+ // producing <null> as a context during evaluation causes the
27100
+ // whole result to turn <null>
27101
+ var isValidContexts = function(contexts) {
27102
+ if (contexts === null || contexts.some(function(arr) {
27103
+ return getType(arr) === "nil";
27104
+ })) {
27105
+ return false;
27106
+ }
27107
+ return true;
27108
+ };
27109
+ var join = function(aContexts, bContextProducer) {
27110
+ var _instance;
27111
+ return (_instance = []).concat.apply(_instance, _to_consumable_array(aContexts.map(function(aContext) {
27112
+ var bContexts = bContextProducer(Object.assign(Object.assign({}, context), aContext));
27113
+ if (!isValidContexts(bContexts)) {
27114
+ return null;
27115
+ }
27116
+ return bContexts.map(function(bContext) {
27117
+ return Object.assign(Object.assign({}, aContext), bContext);
27118
+ });
27119
+ })));
27120
+ };
27121
+ var cartesian = function(aContexts, bContextProducer) {
27122
+ for(var _len = arguments.length, otherContextProducers = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
27123
+ otherContextProducers[_key - 2] = arguments[_key];
27124
+ }
27125
+ if (!isValidContexts(aContexts)) {
27126
+ return null;
27127
+ }
27128
+ if (!bContextProducer) {
27129
+ return aContexts;
27068
27130
  }
27069
- return (_Object = Object).assign.apply(_Object, [
27070
- {},
27071
- context
27072
- ].concat(_to_consumable_array(ctx)));
27131
+ return cartesian.apply(void 0, [
27132
+ join(aContexts, bContextProducer)
27133
+ ].concat(_to_consumable_array(otherContextProducers)));
27134
+ };
27135
+ var cartesianProduct = function(contextProducers) {
27136
+ var _contextProducers = _to_array(contextProducers), aContextProducer = _contextProducers[0], otherContextProducers = _contextProducers.slice(1);
27137
+ var aContexts = aContextProducer(context);
27138
+ return cartesian.apply(void 0, [
27139
+ aContexts
27140
+ ].concat(_to_consumable_array(otherContextProducers)));
27141
+ };
27142
+ var product = cartesianProduct(args);
27143
+ return product && product.map(function(p) {
27144
+ return Object.assign(Object.assign({}, context), p);
27073
27145
  });
27074
27146
  };
27075
27147
  // Name kw<"in"> Expr
@@ -27699,31 +27771,6 @@ function createDateTimeRange(start, end, startIncluded, endIncluded) {
27699
27771
  includes: includes
27700
27772
  });
27701
27773
  }
27702
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27703
- function cartesianProduct(arrays) {
27704
- var _instance;
27705
- if (arrays.some(function(arr) {
27706
- return getType(arr) === "nil";
27707
- })) {
27708
- return null;
27709
- }
27710
- var f = function(a, b) {
27711
- return (_instance = []).concat.apply(_instance, _to_consumable_array(a.map(function(d) {
27712
- return b.map(function(e) {
27713
- return [].concat(d, e);
27714
- });
27715
- })));
27716
- };
27717
- var cartesian = function(a, b) {
27718
- for(var _len = arguments.length, c = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
27719
- c[_key - 2] = arguments[_key];
27720
- }
27721
- return b ? cartesian.apply(void 0, [
27722
- f(a, b)
27723
- ].concat(_to_consumable_array(c))) : a || [];
27724
- };
27725
- return cartesian.apply(void 0, _to_consumable_array(arrays));
27726
- }
27727
27774
  function coalecenseTypes(a, b) {
27728
27775
  if (!b) {
27729
27776
  return a.type;
@@ -27785,15 +27832,24 @@ function parseString(str) {
27785
27832
  if (str.endsWith('"')) {
27786
27833
  str = str.slice(0, -1);
27787
27834
  }
27788
- return str.replace(/(\\")|(\\\\)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
27835
+ return str.replace(/(\\")|(\\\\)|(\\n)|(\\r)|(\\t)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
27789
27836
  for(var _len = arguments.length, groups = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
27790
27837
  groups[_key - 1] = arguments[_key];
27791
27838
  }
27792
- var _groups = _sliced_to_array(groups, 4), quotes = _groups[0], escape = _groups[1], codePoint = _groups[2], charCodes = _groups[3];
27839
+ var _groups = _sliced_to_array(groups, 7), quotes = _groups[0], backslash = _groups[1], newline = _groups[2], carriageReturn = _groups[3], tab = _groups[4], codePoint = _groups[5], charCodes = _groups[6];
27793
27840
  if (quotes) {
27794
27841
  return '"';
27795
27842
  }
27796
- if (escape) {
27843
+ if (newline) {
27844
+ return "\n";
27845
+ }
27846
+ if (carriageReturn) {
27847
+ return "\r";
27848
+ }
27849
+ if (tab) {
27850
+ return " ";
27851
+ }
27852
+ if (backslash) {
27797
27853
  return "\\";
27798
27854
  }
27799
27855
  var escapePattern = /\\u([a-fA-F0-9]+)/ig;
package/index.esm.js CHANGED
@@ -23902,14 +23902,14 @@ function indent(str, spaces) {
23902
23902
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23903
23903
  // match is required
23904
23904
  if (!match) {
23905
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23905
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23906
23906
  v: nextMatch1
23907
23907
  };
23908
23908
  }
23909
23909
  var token = match.token, offset = match.offset;
23910
23910
  i1 += offset;
23911
23911
  if (token === " ") {
23912
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23912
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23913
23913
  }
23914
23914
  tokens1 = _to_consumable_array$1(tokens1).concat([
23915
23915
  token
@@ -23928,7 +23928,7 @@ function indent(str, spaces) {
23928
23928
  if (contextKeys.some(function(el) {
23929
23929
  return el.startsWith(name);
23930
23930
  })) {
23931
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23931
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23932
23932
  }
23933
23933
  if (dateTimeIdentifiers.some(function(el) {
23934
23934
  return el === name;
@@ -23947,9 +23947,9 @@ function indent(str, spaces) {
23947
23947
  if (dateTimeIdentifiers.some(function(el) {
23948
23948
  return el.startsWith(name);
23949
23949
  })) {
23950
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23950
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23951
23951
  }
23952
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23952
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23953
23953
  v: nextMatch1
23954
23954
  };
23955
23955
  };
@@ -24813,7 +24813,7 @@ var parser = LRParser.deserialize({
24813
24813
  2
24814
24814
  ],
24815
24815
  repeatNodeCount: 14,
24816
- tokenData: ".Z~RvXY#iYZ$^Z[#i]^$^pq#iqr$crs$nwx&fxy&kyz&pz{&u{|'S|}'X}!O'^!O!P'k!P!Q(u!Q![*p![!]+X!]!^+^!^!_+c!_!`$i!`!a+r!b!c+|!}#O,R#P#Q,W#Q#R&}#S#T,]#o#p.P#q#r.U$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$J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$^$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~",
24817
24817
  tokenizers: [
24818
24818
  propertyIdentifiers,
24819
24819
  identifiers,
@@ -25329,6 +25329,9 @@ function parseParameterNames(fn) {
25329
25329
  function notImplemented(thing) {
25330
25330
  return new Error("not implemented: ".concat(thing));
25331
25331
  }
25332
+ function isNotImplemented(err) {
25333
+ return /^not implemented/.test(err.message);
25334
+ }
25332
25335
  /**
25333
25336
  * Returns a name from context or undefined if it does not exist.
25334
25337
  *
@@ -25449,6 +25452,9 @@ var builtins = {
25449
25452
  d = from;
25450
25453
  }
25451
25454
  if (year) {
25455
+ if (!isNumber(month) || !isNumber(day)) {
25456
+ return null;
25457
+ }
25452
25458
  d = date().setZone("utc").set({
25453
25459
  year: year,
25454
25460
  month: month,
@@ -25503,7 +25509,7 @@ var builtins = {
25503
25509
  from = hour;
25504
25510
  hour = null;
25505
25511
  }
25506
- if (isString(from)) {
25512
+ if (isString(from) && from) {
25507
25513
  t = date(null, from);
25508
25514
  }
25509
25515
  if (isDateTime(from)) {
@@ -25514,6 +25520,9 @@ var builtins = {
25514
25520
  });
25515
25521
  }
25516
25522
  if (isNumber(hour)) {
25523
+ if (!isNumber(minute) || !isNumber(second)) {
25524
+ return null;
25525
+ }
25517
25526
  // TODO: support offset = days and time duration
25518
25527
  t = date().set({
25519
25528
  hour: hour,
@@ -25623,7 +25632,8 @@ var builtins = {
25623
25632
  "string"
25624
25633
  ]),
25625
25634
  "replace": fn(function(input, pattern, replacement, flags) {
25626
- return input.replace(new RegExp(pattern, "ug" + (flags || "").replace(/[x]/g, "")), replacement.replace(/\$0/g, "$$&"));
25635
+ var regexp = createRegexp(pattern, flags || "", "g");
25636
+ return regexp && input.replace(regexp, replacement.replace(/\$0/g, "$$&"));
25627
25637
  }, [
25628
25638
  "string",
25629
25639
  "string",
@@ -25636,9 +25646,9 @@ var builtins = {
25636
25646
  "string",
25637
25647
  "string"
25638
25648
  ]),
25639
- // eslint-disable-next-line
25640
25649
  "matches": fn(function(input, pattern, flags) {
25641
- throw notImplemented("matches");
25650
+ var regexp = createRegexp(pattern, flags || "", "");
25651
+ return regexp && regexp.test(input);
25642
25652
  }, [
25643
25653
  "string",
25644
25654
  "string",
@@ -25657,7 +25667,8 @@ var builtins = {
25657
25667
  "string"
25658
25668
  ]),
25659
25669
  "split": fn(function(string, delimiter) {
25660
- return string.split(new RegExp(delimiter, "u"));
25670
+ var regexp = createRegexp(delimiter, "", "");
25671
+ return regexp && string.split(regexp);
25661
25672
  }, [
25662
25673
  "string",
25663
25674
  "string"
@@ -26573,6 +26584,35 @@ function mode(array) {
26573
26584
  function ifValid(o) {
26574
26585
  return o.isValid ? o : null;
26575
26586
  }
26587
+ /**
26588
+ * Concatenates flags for a regular expression.
26589
+ *
26590
+ * Ensures that default flags are included without duplication, even if
26591
+ * user-specified flags overlap with the defaults.
26592
+ */ function buildFlags(flags, defaultFlags) {
26593
+ var unsupportedFlags = flags.replace(/[smix]/g, "");
26594
+ if (unsupportedFlags) {
26595
+ throw new Error("illegal flags: " + unsupportedFlags);
26596
+ }
26597
+ // we don't implement the <x> flag
26598
+ if (/x/.test(flags)) {
26599
+ throw notImplemented("matches <x> flag");
26600
+ }
26601
+ return flags + defaultFlags;
26602
+ }
26603
+ /**
26604
+ * Creates a regular expression from a given pattern
26605
+ */ function createRegexp(pattern, flags) {
26606
+ var defaultFlags = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
26607
+ try {
26608
+ return new RegExp(pattern, "u" + buildFlags(flags, defaultFlags));
26609
+ } catch (_err) {
26610
+ if (isNotImplemented(_err)) {
26611
+ throw _err;
26612
+ }
26613
+ }
26614
+ return null;
26615
+ }
26576
26616
  function parseExpression(expression) {
26577
26617
  var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, dialect = arguments.length > 2 ? arguments[2] : void 0;
26578
26618
  return parser.configure({
@@ -27027,27 +27067,59 @@ function evalNode(node, input, args) {
27027
27067
  };
27028
27068
  case "Type":
27029
27069
  return args[0];
27070
+ // (x in [ [1,2], [3,4] ]), (y in x)
27030
27071
  case "InExpressions":
27031
27072
  return function(context) {
27032
- var iterationContexts = args.map(function(ctx) {
27033
- return ctx(context);
27034
- });
27035
- if (iterationContexts.some(function(ctx) {
27036
- return getType(ctx) !== "list";
27037
- })) {
27038
- return null;
27039
- }
27040
- return cartesianProduct(iterationContexts).map(function(ctx) {
27041
- var _Object;
27042
- if (!isArray(ctx)) {
27043
- ctx = [
27044
- ctx
27045
- ];
27073
+ // we build up evaluation contexts from left to right,
27074
+ // ending up with the cartesian product over all available contexts
27075
+ //
27076
+ // previous context is provided to later context providers
27077
+ // producing <null> as a context during evaluation causes the
27078
+ // whole result to turn <null>
27079
+ var isValidContexts = function(contexts) {
27080
+ if (contexts === null || contexts.some(function(arr) {
27081
+ return getType(arr) === "nil";
27082
+ })) {
27083
+ return false;
27084
+ }
27085
+ return true;
27086
+ };
27087
+ var join = function(aContexts, bContextProducer) {
27088
+ var _instance;
27089
+ return (_instance = []).concat.apply(_instance, _to_consumable_array(aContexts.map(function(aContext) {
27090
+ var bContexts = bContextProducer(Object.assign(Object.assign({}, context), aContext));
27091
+ if (!isValidContexts(bContexts)) {
27092
+ return null;
27093
+ }
27094
+ return bContexts.map(function(bContext) {
27095
+ return Object.assign(Object.assign({}, aContext), bContext);
27096
+ });
27097
+ })));
27098
+ };
27099
+ var cartesian = function(aContexts, bContextProducer) {
27100
+ for(var _len = arguments.length, otherContextProducers = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
27101
+ otherContextProducers[_key - 2] = arguments[_key];
27102
+ }
27103
+ if (!isValidContexts(aContexts)) {
27104
+ return null;
27105
+ }
27106
+ if (!bContextProducer) {
27107
+ return aContexts;
27046
27108
  }
27047
- return (_Object = Object).assign.apply(_Object, [
27048
- {},
27049
- context
27050
- ].concat(_to_consumable_array(ctx)));
27109
+ return cartesian.apply(void 0, [
27110
+ join(aContexts, bContextProducer)
27111
+ ].concat(_to_consumable_array(otherContextProducers)));
27112
+ };
27113
+ var cartesianProduct = function(contextProducers) {
27114
+ var _contextProducers = _to_array(contextProducers), aContextProducer = _contextProducers[0], otherContextProducers = _contextProducers.slice(1);
27115
+ var aContexts = aContextProducer(context);
27116
+ return cartesian.apply(void 0, [
27117
+ aContexts
27118
+ ].concat(_to_consumable_array(otherContextProducers)));
27119
+ };
27120
+ var product = cartesianProduct(args);
27121
+ return product && product.map(function(p) {
27122
+ return Object.assign(Object.assign({}, context), p);
27051
27123
  });
27052
27124
  };
27053
27125
  // Name kw<"in"> Expr
@@ -27677,31 +27749,6 @@ function createDateTimeRange(start, end, startIncluded, endIncluded) {
27677
27749
  includes: includes
27678
27750
  });
27679
27751
  }
27680
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27681
- function cartesianProduct(arrays) {
27682
- var _instance;
27683
- if (arrays.some(function(arr) {
27684
- return getType(arr) === "nil";
27685
- })) {
27686
- return null;
27687
- }
27688
- var f = function(a, b) {
27689
- return (_instance = []).concat.apply(_instance, _to_consumable_array(a.map(function(d) {
27690
- return b.map(function(e) {
27691
- return [].concat(d, e);
27692
- });
27693
- })));
27694
- };
27695
- var cartesian = function(a, b) {
27696
- for(var _len = arguments.length, c = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
27697
- c[_key - 2] = arguments[_key];
27698
- }
27699
- return b ? cartesian.apply(void 0, [
27700
- f(a, b)
27701
- ].concat(_to_consumable_array(c))) : a || [];
27702
- };
27703
- return cartesian.apply(void 0, _to_consumable_array(arrays));
27704
- }
27705
27752
  function coalecenseTypes(a, b) {
27706
27753
  if (!b) {
27707
27754
  return a.type;
@@ -27763,15 +27810,24 @@ function parseString(str) {
27763
27810
  if (str.endsWith('"')) {
27764
27811
  str = str.slice(0, -1);
27765
27812
  }
27766
- return str.replace(/(\\")|(\\\\)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
27813
+ return str.replace(/(\\")|(\\\\)|(\\n)|(\\r)|(\\t)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function(substring) {
27767
27814
  for(var _len = arguments.length, groups = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
27768
27815
  groups[_key - 1] = arguments[_key];
27769
27816
  }
27770
- var _groups = _sliced_to_array(groups, 4), quotes = _groups[0], escape = _groups[1], codePoint = _groups[2], charCodes = _groups[3];
27817
+ var _groups = _sliced_to_array(groups, 7), quotes = _groups[0], backslash = _groups[1], newline = _groups[2], carriageReturn = _groups[3], tab = _groups[4], codePoint = _groups[5], charCodes = _groups[6];
27771
27818
  if (quotes) {
27772
27819
  return '"';
27773
27820
  }
27774
- if (escape) {
27821
+ if (newline) {
27822
+ return "\n";
27823
+ }
27824
+ if (carriageReturn) {
27825
+ return "\r";
27826
+ }
27827
+ if (tab) {
27828
+ return " ";
27829
+ }
27830
+ if (backslash) {
27775
27831
  return "\\";
27776
27832
  }
27777
27833
  var escapePattern = /\\u([a-fA-F0-9]+)/ig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-codex",
3
- "version": "0.103.2",
3
+ "version": "0.105.2",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",