@elaraai/east 1.0.104 → 1.0.105

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 (62) hide show
  1. package/dist/src/compile/builtins/primitives.d.ts +1 -1
  2. package/dist/src/compile/control.d.ts.map +1 -1
  3. package/dist/src/compile/control.js +10 -5
  4. package/dist/src/compile/control.js.map +1 -1
  5. package/dist/src/compile.open_beast.spec.js +7 -3
  6. package/dist/src/compile.open_beast.spec.js.map +1 -1
  7. package/dist/src/query/jq/narrow.d.ts +68 -0
  8. package/dist/src/query/jq/narrow.d.ts.map +1 -0
  9. package/dist/src/query/jq/narrow.js +691 -0
  10. package/dist/src/query/jq/narrow.js.map +1 -0
  11. package/dist/src/query/jq/split.d.ts +35 -11
  12. package/dist/src/query/jq/split.d.ts.map +1 -1
  13. package/dist/src/query/jq/split.js +205 -35
  14. package/dist/src/query/jq/split.js.map +1 -1
  15. package/dist/src/query/jq/translate-builtins.d.ts.map +1 -1
  16. package/dist/src/query/jq/translate-builtins.js +43 -8
  17. package/dist/src/query/jq/translate-builtins.js.map +1 -1
  18. package/dist/src/query/jq/translate.d.ts +55 -4
  19. package/dist/src/query/jq/translate.d.ts.map +1 -1
  20. package/dist/src/query/jq/translate.js +174 -21
  21. package/dist/src/query/jq/translate.js.map +1 -1
  22. package/dist/src/runner_exec.d.ts +10 -0
  23. package/dist/src/runner_exec.d.ts.map +1 -1
  24. package/dist/src/runner_exec.js +11 -3
  25. package/dist/src/runner_exec.js.map +1 -1
  26. package/dist/src/runner_exec.spec.js +40 -2
  27. package/dist/src/runner_exec.spec.js.map +1 -1
  28. package/dist/src/serialization/beast2/index.d.ts +2 -1
  29. package/dist/src/serialization/beast2/index.d.ts.map +1 -1
  30. package/dist/src/serialization/beast2/index.js +2 -1
  31. package/dist/src/serialization/beast2/index.js.map +1 -1
  32. package/dist/src/serialization/beast2/v5/codec.d.ts +30 -1
  33. package/dist/src/serialization/beast2/v5/codec.d.ts.map +1 -1
  34. package/dist/src/serialization/beast2/v5/codec.js +24 -3
  35. package/dist/src/serialization/beast2/v5/codec.js.map +1 -1
  36. package/dist/src/serialization/beast2/v5/lazy.d.ts +23 -4
  37. package/dist/src/serialization/beast2/v5/lazy.d.ts.map +1 -1
  38. package/dist/src/serialization/beast2/v5/lazy.js +84 -19
  39. package/dist/src/serialization/beast2/v5/lazy.js.map +1 -1
  40. package/dist/src/serialization/beast2/v5/project.d.ts +156 -0
  41. package/dist/src/serialization/beast2/v5/project.d.ts.map +1 -0
  42. package/dist/src/serialization/beast2/v5/project.js +830 -0
  43. package/dist/src/serialization/beast2/v5/project.js.map +1 -0
  44. package/dist/src/serialization/beast2/v5/project.spec.d.ts +6 -0
  45. package/dist/src/serialization/beast2/v5/project.spec.d.ts.map +1 -0
  46. package/dist/src/serialization/beast2/v5/project.spec.js +273 -0
  47. package/dist/src/serialization/beast2/v5/project.spec.js.map +1 -0
  48. package/dist/src/serialization/beast2/v5/runs.d.ts +78 -7
  49. package/dist/src/serialization/beast2/v5/runs.d.ts.map +1 -1
  50. package/dist/src/serialization/beast2/v5/runs.js +218 -7
  51. package/dist/src/serialization/beast2/v5/runs.js.map +1 -1
  52. package/dist/src/serialization/beast2/v5/runs.spec.js +223 -6
  53. package/dist/src/serialization/beast2/v5/runs.spec.js.map +1 -1
  54. package/dist/src/serialization/beast2/v5/stream.d.ts +30 -2
  55. package/dist/src/serialization/beast2/v5/stream.d.ts.map +1 -1
  56. package/dist/src/serialization/beast2/v5/stream.js +30 -5
  57. package/dist/src/serialization/beast2/v5/stream.js.map +1 -1
  58. package/dist/src/serialization/index.d.ts +1 -1
  59. package/dist/src/serialization/index.d.ts.map +1 -1
  60. package/dist/src/serialization/index.js +1 -1
  61. package/dist/src/serialization/index.js.map +1 -1
  62. package/package.json +1 -1
@@ -13,7 +13,7 @@ import { walkSteps } from "./check.js";
13
13
  import { jqTypeNames, nullablePayload, unify, unwrap } from "./shapes.js";
14
14
  import { childPath, jqChildren } from "./spans.js";
15
15
  import { formatTokens } from "./strftime.js";
16
- import { isRoot, parts } from "./translate.js";
16
+ import { isRoot, isRows, parts } from "./translate.js";
17
17
  /** Builds a rule table entry for each of some names. */
18
18
  const rules = {};
19
19
  function rule(names, r) {
@@ -102,7 +102,8 @@ rule("first", (t, c) => {
102
102
  t.once(c.$, ($, label) => arg(t, c, 0, $, c.x, ($2, v) => { c.emit($2, v); t.brk($2, label); }), c.path);
103
103
  return;
104
104
  }
105
- t.indexOf(c.$, input(t, c), t.int(0), false, c.path, c.emit);
105
+ // A stage's rows (#1140): the first, kept as it is made.
106
+ t.indexOf(c.$, isRows(c.x) ? t.firstRows(c.$, c.x, 1n, c.path) : input(t, c), t.int(0), false, c.path, c.emit);
106
107
  });
107
108
  rule("last", (t, c) => {
108
109
  if (c.args.length === 1) {
@@ -710,6 +711,13 @@ rule("transpose", (t, c) => {
710
711
  });
711
712
  // ─── Collections ─────────────────────────────────────────────────────────
712
713
  rule("length", (t, c) => {
714
+ if (isRows(c.x)) {
715
+ // A stage's rows, counted as they are made (#1140).
716
+ const count = t.declare(c.$, t.int(0), "count");
717
+ c.x.each(c.$, $ => t.assign($, count, t.add(count, t.int(1), c.path)));
718
+ c.emit(c.$, count);
719
+ return;
720
+ }
713
721
  const x = t.open(input(t, c));
714
722
  const length = ($, v, emit) => {
715
723
  const o = t.open(v);
@@ -933,10 +941,15 @@ export function addInto(t, c, $, acc, v, type) {
933
941
  }
934
942
  rule("add", (t, c) => {
935
943
  const type = outputType(t, c);
944
+ // A stage's rows, added as they are made (#1140).
945
+ const rows = c.args.length === 0 && isRows(c.x) ? c.x : undefined;
936
946
  if (type.type === "Null") {
937
947
  // The values' type has no identity to add: jq's null.
938
948
  if (c.args.length === 1)
939
949
  arg(t, c, 0, c.$, c.x, () => { });
950
+ // The rows are made all the same, as the array's were, when making one may raise.
951
+ else if (rows !== undefined && !rows.stops)
952
+ rows.each(c.$, () => { });
940
953
  c.emit(c.$, t.null(c.path));
941
954
  return;
942
955
  }
@@ -946,6 +959,8 @@ rule("add", (t, c) => {
946
959
  const each = ($, v) => addInto(t, c, $, acc, v, type);
947
960
  if (c.args.length === 1)
948
961
  arg(t, c, 0, c.$, c.x, each);
962
+ else if (rows !== undefined)
963
+ rows.each(c.$, each);
949
964
  else
950
965
  t.iterate(c.$, input(t, c), false, c.path, each);
951
966
  c.emit(c.$, acc);
@@ -956,8 +971,22 @@ rule(["any", "all"], (t, c) => {
956
971
  const result = t.declare(c.$, t.bool(!any), "result");
957
972
  const test = ($, v, label) => {
958
973
  const truth = t.truthy(v, c.path);
959
- t.branch($, any ? truth : negate(t, truth, c.path), $2 => { t.assign($2, result, t.bool(any)); t.brk($2, label); }, () => { }, c.path);
974
+ t.branch($, any ? truth : negate(t, truth, c.path), $2 => {
975
+ t.assign($2, result, t.bool(any));
976
+ if (label !== undefined)
977
+ t.brk($2, label);
978
+ }, () => { }, c.path);
960
979
  };
980
+ if (c.args.length === 0 && isRows(c.x)) {
981
+ // A stage's rows, tested as they are made (#1140): the stage stops at the answer, unless making a row may raise.
982
+ const rows = c.x;
983
+ if (rows.stops)
984
+ t.once(c.$, ($, label) => rows.each($, ($2, row) => test($2, row, label)), c.path);
985
+ else
986
+ rows.each(c.$, ($, row) => test($, row, undefined));
987
+ c.emit(c.$, result);
988
+ return;
989
+ }
961
990
  t.once(c.$, ($, label) => {
962
991
  if (c.args.length === 2) {
963
992
  arg(t, c, 0, $, c.x, ($2, g) => arg(t, c, 1, $2, g, ($3, v) => test($3, v, label)));
@@ -1123,21 +1152,27 @@ rule("unique", (t, c) => {
1123
1152
  c.emit(c.$, out);
1124
1153
  });
1125
1154
  rule(["min", "max"], (t, c) => {
1126
- const array = elementsOf(t, c, c.$);
1127
- if (array === undefined) {
1155
+ // A stage's rows, compared as they are made (#1140), or an array's elements.
1156
+ const rows = isRows(c.x) ? c.x : undefined;
1157
+ const array = rows === undefined ? elementsOf(t, c, c.$) : undefined;
1158
+ if (rows === undefined && array === undefined) {
1128
1159
  cannot(t, c, c.$, input(t, c), "an array");
1129
1160
  return;
1130
1161
  }
1131
- const element = t.type(array).value;
1162
+ const element = (rows === undefined ? t.type(array) : parts(rows.type)).value;
1132
1163
  const option = OptionType(element);
1133
1164
  const best = t.declare(c.$, t.none(option), "best");
1134
- t.forEach(c.$, array, ($, item) => {
1165
+ const each = ($, item) => {
1135
1166
  const better = t.matchValue(best, {
1136
1167
  none: () => t.bool(true),
1137
1168
  some: (_$2, b) => c.name === "min" ? t.lt(item, b, c.path) : t.b("GreaterEqual", [element], [item, b], BooleanType, c.path),
1138
1169
  }, BooleanType, c.path);
1139
1170
  t.ifElse($, better, $2 => t.assign($2, best, t.some(item, option)), undefined, c.path);
1140
- }, c.path);
1171
+ };
1172
+ if (rows !== undefined)
1173
+ rows.each(c.$, each);
1174
+ else
1175
+ t.forEach(c.$, array, ($, item) => each($, item), c.path);
1141
1176
  const out = outputType(t, c);
1142
1177
  if (nullablePayload(option) !== undefined) {
1143
1178
  c.emit(c.$, t.widenTo(c.$, best, out, c.path));