@telorun/cel 0.107.0 → 0.108.0
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/backend-runtime.d.ts +46 -8
- package/dist/backend-runtime.d.ts.map +1 -1
- package/dist/backend-runtime.js +133 -30
- package/dist/catalog-runtime.d.ts.map +1 -1
- package/dist/catalog-runtime.js +110 -109
- package/dist/cel-map-value.d.ts +20 -7
- package/dist/cel-map-value.d.ts.map +1 -1
- package/dist/cel-map-value.js +29 -18
- package/dist/cel-value.d.ts +10 -3
- package/dist/cel-value.d.ts.map +1 -1
- package/dist/check-diagnostic.d.ts +3 -2
- package/dist/check-diagnostic.d.ts.map +1 -1
- package/dist/checker.d.ts +9 -0
- package/dist/checker.d.ts.map +1 -1
- package/dist/checker.js +98 -13
- package/dist/closure-backend.js +66 -15
- package/dist/duration-value.d.ts +11 -0
- package/dist/duration-value.d.ts.map +1 -1
- package/dist/duration-value.js +17 -3
- package/dist/emitted-module.d.ts +1 -1
- package/dist/emitted-module.js +1 -1
- package/dist/engine-version.d.ts +1 -1
- package/dist/engine-version.js +1 -1
- package/dist/environment.d.ts +8 -0
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +20 -5
- package/dist/function-registry.d.ts +40 -0
- package/dist/function-registry.d.ts.map +1 -1
- package/dist/function-registry.js +105 -2
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- package/dist/js-emitter.d.ts +3 -2
- package/dist/js-emitter.d.ts.map +1 -1
- package/dist/js-emitter.js +11 -5
- package/dist/macro-check.d.ts +8 -0
- package/dist/macro-check.d.ts.map +1 -1
- package/dist/macro-check.js +1 -1
- package/dist/member-read.d.ts +42 -5
- package/dist/member-read.d.ts.map +1 -1
- package/dist/member-read.js +47 -6
- package/dist/resolved-call.d.ts +13 -0
- package/dist/resolved-call.d.ts.map +1 -1
- package/dist/runtime-library.d.ts +13 -2
- package/dist/runtime-library.d.ts.map +1 -1
- package/dist/runtime-library.js +134 -125
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +20 -4
- package/dist/timestamp-value.d.ts +9 -0
- package/dist/timestamp-value.d.ts.map +1 -1
- package/dist/timestamp-value.js +15 -0
- package/dist/type-expression.d.ts +18 -2
- package/dist/type-expression.d.ts.map +1 -1
- package/dist/type-expression.js +23 -3
- package/dist/value-equality.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/backend-runtime.ts +180 -30
- package/src/catalog-runtime.ts +133 -133
- package/src/cel-map-value.ts +31 -20
- package/src/cel-value.ts +11 -3
- package/src/check-diagnostic.ts +4 -2
- package/src/checker.ts +123 -10
- package/src/closure-backend.ts +59 -14
- package/src/duration-value.ts +18 -3
- package/src/emitted-module.ts +1 -1
- package/src/engine-version.ts +1 -1
- package/src/environment.ts +26 -5
- package/src/function-registry.ts +114 -2
- package/src/index.ts +24 -3
- package/src/js-emitter.ts +13 -5
- package/src/macro-check.ts +7 -1
- package/src/member-read.ts +48 -7
- package/src/resolved-call.ts +13 -0
- package/src/runtime-library.ts +167 -143
- package/src/serializer.ts +19 -3
- package/src/timestamp-value.ts +16 -0
- package/src/type-expression.ts +25 -3
- package/src/value-equality.ts +3 -3
package/dist/catalog-runtime.js
CHANGED
|
@@ -50,9 +50,9 @@ class CatalogRefusal extends Error {
|
|
|
50
50
|
}
|
|
51
51
|
/** The one place a refusal becomes a value. Anything else thrown is a defect here. */
|
|
52
52
|
function refusing(run) {
|
|
53
|
-
return (
|
|
53
|
+
return (ctx, a, b, c, d) => {
|
|
54
54
|
try {
|
|
55
|
-
return run(
|
|
55
|
+
return run(ctx, a, b, c, d);
|
|
56
56
|
}
|
|
57
57
|
catch (cause) {
|
|
58
58
|
if (cause instanceof CatalogRefusal)
|
|
@@ -71,11 +71,13 @@ const own = (run) => () => refusing(run);
|
|
|
71
71
|
const hosted = (name, build) => (handlers) => {
|
|
72
72
|
const handler = handlers[name];
|
|
73
73
|
if (handler === undefined) {
|
|
74
|
-
return (
|
|
74
|
+
return (ctx) => celError("unbound_function", `${name}() is supplied by the host, and this environment was given no implementation for it`, ctx.range);
|
|
75
75
|
}
|
|
76
76
|
return refusing(build(handler));
|
|
77
77
|
};
|
|
78
78
|
// --- reading arguments ------------------------------------------------------
|
|
79
|
+
// `CelValue | undefined` because a parameter list is as wide as the widest overload; the
|
|
80
|
+
// dispatcher has already resolved on this argument's type.
|
|
79
81
|
const text = (value) => value;
|
|
80
82
|
const bytes = (value) => value;
|
|
81
83
|
/**
|
|
@@ -467,174 +469,173 @@ function compacted(value) {
|
|
|
467
469
|
// --- the table -------------------------------------------------------------
|
|
468
470
|
const IMPLEMENTATIONS = new Map([
|
|
469
471
|
// collections
|
|
470
|
-
["join(list<dyn>, string)", own((
|
|
471
|
-
["keys(map<dyn, dyn>)", own((
|
|
472
|
-
["values(map<dyn, dyn>)", own((
|
|
473
|
-
["distinct(list<dyn>)", own((
|
|
474
|
-
["reverse(list<dyn>)", own((
|
|
475
|
-
["flatten(list<dyn>)", own((
|
|
476
|
-
["sort(list<dyn>)", own((
|
|
472
|
+
["join(list<dyn>, string)", own((ctx, a, b) => list("join", a).map((held) => textOf("join", held)).join(text(b)))],
|
|
473
|
+
["keys(map<dyn, dyn>)", own((ctx, a) => mapEntries("keys", a).map(([key]) => key))],
|
|
474
|
+
["values(map<dyn, dyn>)", own((ctx, a) => mapEntries("values", a).map(([, value]) => value))],
|
|
475
|
+
["distinct(list<dyn>)", own((ctx, a) => distinct(list("distinct", a)))],
|
|
476
|
+
["reverse(list<dyn>)", own((ctx, a) => [...list("reverse", a)].reverse())],
|
|
477
|
+
["flatten(list<dyn>)", own((ctx, a) => list("flatten", a).flat())],
|
|
478
|
+
["sort(list<dyn>)", own((ctx, a) => sorted("sort", list("sort", a)))],
|
|
477
479
|
[
|
|
478
480
|
"range(int)",
|
|
479
|
-
own((
|
|
481
|
+
own((ctx, a) => Array.from({ length: Math.max(0, Math.trunc(numberOf(a))) }, (_unused, at) => BigInt(at))),
|
|
480
482
|
],
|
|
481
483
|
[
|
|
482
484
|
"enumerate(list<dyn>)",
|
|
483
|
-
own((
|
|
485
|
+
own((ctx, a) => list("enumerate", a).map((value, at) => {
|
|
484
486
|
const entry = Object.create(null);
|
|
485
487
|
entry.index = BigInt(at);
|
|
486
488
|
entry.value = value;
|
|
487
489
|
return entry;
|
|
488
490
|
})),
|
|
489
491
|
],
|
|
490
|
-
["compact(list<dyn>)", own((
|
|
491
|
-
["compact(map<dyn, dyn>)", own((
|
|
492
|
+
["compact(list<dyn>)", own((ctx, a) => compacted(a))],
|
|
493
|
+
["compact(map<dyn, dyn>)", own((ctx, a) => compacted(a))],
|
|
492
494
|
[
|
|
493
495
|
"merge(map<dyn, dyn>, map<dyn, dyn>)",
|
|
494
|
-
own((
|
|
496
|
+
own((ctx, a, b) => mapOfEntries(a, [...mapEntries("merge", a), ...mapEntries("merge", b)])),
|
|
495
497
|
],
|
|
496
498
|
// One body over the three: the overloads exist so that a statically wrong receiver is a
|
|
497
499
|
// type error, and at runtime a `dyn` receiver reaches whichever of them resolved first, so
|
|
498
500
|
// the VALUE decides what is sliced.
|
|
499
|
-
["slice(bytes, int, int)", own(sliced)],
|
|
500
|
-
["slice(string, int, int)", own(sliced)],
|
|
501
|
-
["slice(list<dyn>, int, int)", own(sliced)],
|
|
501
|
+
["slice(bytes, int, int)", own((ctx, a, b, c) => sliced(a, b, c))],
|
|
502
|
+
["slice(string, int, int)", own((ctx, a, b, c) => sliced(a, b, c))],
|
|
503
|
+
["slice(list<dyn>, int, int)", own((ctx, a, b, c) => sliced(a, b, c))],
|
|
502
504
|
// strings
|
|
503
|
-
["lower(string)", own((
|
|
504
|
-
["upper(string)", own((
|
|
505
|
-
["trim(string)", own((
|
|
506
|
-
["replace(string, string, string)", own((
|
|
507
|
-
["split(string, string)", own((
|
|
505
|
+
["lower(string)", own((ctx, a) => text(a).toLowerCase())],
|
|
506
|
+
["upper(string)", own((ctx, a) => text(a).toUpperCase())],
|
|
507
|
+
["trim(string)", own((ctx, a) => text(a).trim())],
|
|
508
|
+
["replace(string, string, string)", own((ctx, a, b, c) => text(a).split(text(b)).join(text(c)))],
|
|
509
|
+
["split(string, string)", own((ctx, a, b) => text(a).split(text(b)))],
|
|
508
510
|
[
|
|
509
511
|
"trimPrefix(string, string)",
|
|
510
|
-
own((
|
|
511
|
-
const prefix = text(
|
|
512
|
-
return text(
|
|
512
|
+
own((ctx, a, b) => {
|
|
513
|
+
const prefix = text(b);
|
|
514
|
+
return text(a).startsWith(prefix) ? text(a).slice(prefix.length) : text(a);
|
|
513
515
|
}),
|
|
514
516
|
],
|
|
515
517
|
[
|
|
516
518
|
"trimSuffix(string, string)",
|
|
517
|
-
own((
|
|
518
|
-
const suffix = text(
|
|
519
|
-
const value = text(
|
|
519
|
+
own((ctx, a, b) => {
|
|
520
|
+
const suffix = text(b);
|
|
521
|
+
const value = text(a);
|
|
520
522
|
return suffix !== "" && value.endsWith(suffix) ? value.slice(0, value.length - suffix.length) : value;
|
|
521
523
|
}),
|
|
522
524
|
],
|
|
523
525
|
[
|
|
524
526
|
"regexReplace(string, string, string)",
|
|
525
|
-
own((
|
|
527
|
+
own((ctx, a, b, c) => pattern("regexReplace", b, undefined).matcher(text(a)).replaceAll(text(c))),
|
|
526
528
|
],
|
|
527
529
|
[
|
|
528
530
|
"regexReplace(string, string, string, string)",
|
|
529
|
-
own((
|
|
531
|
+
own((ctx, a, b, c, d) => pattern("regexReplace", b, d).matcher(text(a)).replaceAll(text(c))),
|
|
530
532
|
],
|
|
531
|
-
["regexExtract(string, string)", own((
|
|
532
|
-
["regexExtract(string, string, string)", own((
|
|
533
|
-
["regexExtractAll(string, string)", own((
|
|
534
|
-
["regexExtractAll(string, string, string)", own((
|
|
535
|
-
["regexGroups(string, string)", own((
|
|
536
|
-
["regexGroups(string, string, string)", own((
|
|
533
|
+
["regexExtract(string, string)", own((ctx, a, b) => firstMatch("regexExtract", a, b, undefined))],
|
|
534
|
+
["regexExtract(string, string, string)", own((ctx, a, b, c) => firstMatch("regexExtract", a, b, c))],
|
|
535
|
+
["regexExtractAll(string, string)", own((ctx, a, b) => everyMatch("regexExtractAll", a, b, undefined))],
|
|
536
|
+
["regexExtractAll(string, string, string)", own((ctx, a, b, c) => everyMatch("regexExtractAll", a, b, c))],
|
|
537
|
+
["regexGroups(string, string)", own((ctx, a, b) => matchGroups("regexGroups", a, b, undefined))],
|
|
538
|
+
["regexGroups(string, string, string)", own((ctx, a, b, c) => matchGroups("regexGroups", a, b, c))],
|
|
537
539
|
// math
|
|
538
|
-
["abs(dyn)", own((
|
|
539
|
-
["floor(dyn)", own((
|
|
540
|
-
["ceil(dyn)", own((
|
|
540
|
+
["abs(dyn)", own((ctx, a) => Math.abs(numberOf(a)))],
|
|
541
|
+
["floor(dyn)", own((ctx, a) => Math.floor(numberOf(a)))],
|
|
542
|
+
["ceil(dyn)", own((ctx, a) => Math.ceil(numberOf(a)))],
|
|
541
543
|
// Both arities go through `formattable`, so the 2^53 refusal does not depend on which
|
|
542
544
|
// one the author wrote: guarding only the two-argument form left `round(x)` silently
|
|
543
545
|
// answering with a neighbouring integer, reachable by writing one fewer argument.
|
|
544
|
-
["round(double)", own((
|
|
545
|
-
["round(int)", own((
|
|
546
|
-
["round(double, int)", own((
|
|
547
|
-
["round(int, int)", own((
|
|
548
|
-
["min(list<dyn>)", own((
|
|
549
|
-
["max(list<dyn>)", own((
|
|
546
|
+
["round(double)", own((ctx, a) => Math.round(formattable("round", a)))],
|
|
547
|
+
["round(int)", own((ctx, a) => Math.round(formattable("round", a)))],
|
|
548
|
+
["round(double, int)", own((ctx, a, b) => roundedTo(a, b))],
|
|
549
|
+
["round(int, int)", own((ctx, a, b) => roundedTo(a, b))],
|
|
550
|
+
["min(list<dyn>)", own((ctx, a) => smallest(list("min", a), true))],
|
|
551
|
+
["max(list<dyn>)", own((ctx, a) => smallest(list("max", a), false))],
|
|
550
552
|
[
|
|
551
553
|
"sum(list<dyn>)",
|
|
552
|
-
own((
|
|
554
|
+
own((ctx, a) => list("sum", a).reduce((total, held) => total + numberOf(held), 0)),
|
|
553
555
|
],
|
|
554
556
|
[
|
|
555
557
|
"avg(list<dyn>)",
|
|
556
|
-
own((
|
|
557
|
-
const values = list("avg",
|
|
558
|
+
own((ctx, a) => {
|
|
559
|
+
const values = list("avg", a);
|
|
558
560
|
if (values.length === 0)
|
|
559
561
|
return null;
|
|
560
562
|
return values.reduce((total, held) => total + numberOf(held), 0) / values.length;
|
|
561
563
|
}),
|
|
562
564
|
],
|
|
563
565
|
// JSON
|
|
564
|
-
["json(dyn)", hosted("json", (handler) => (
|
|
565
|
-
["parseJson(string)", own((
|
|
566
|
+
["json(dyn)", hosted("json", (handler) => (ctx, a) => handler(a))],
|
|
567
|
+
["parseJson(string)", own((ctx, a) => parseJsonText(text(a)))],
|
|
566
568
|
// paths
|
|
567
569
|
[
|
|
568
570
|
"string.joinPath(string)",
|
|
569
|
-
hosted("joinPath", (handler) => (
|
|
571
|
+
hosted("joinPath", (handler) => (ctx, a, b) => handler(text(a), text(b))),
|
|
570
572
|
],
|
|
571
573
|
// encoding
|
|
572
|
-
["base64Encode(string)", hosted("base64Encode", (handler) => (
|
|
573
|
-
["base64Decode(string)", hosted("base64Decode", (handler) => (
|
|
574
|
-
["bytesFromBase64(string)", own((
|
|
575
|
-
["bytesToBase64(bytes)", own((
|
|
576
|
-
["urlEncode(string)", own((
|
|
577
|
-
["urlDecode(string)", own((
|
|
574
|
+
["base64Encode(string)", hosted("base64Encode", (handler) => (ctx, a) => handler(text(a)))],
|
|
575
|
+
["base64Decode(string)", hosted("base64Decode", (handler) => (ctx, a) => handler(text(a)))],
|
|
576
|
+
["bytesFromBase64(string)", own((ctx, a) => bytesFromBase64(text(a)))],
|
|
577
|
+
["bytesToBase64(bytes)", own((ctx, a) => base64Text(bytes(a)))],
|
|
578
|
+
["urlEncode(string)", own((ctx, a) => encodeURIComponent(text(a)))],
|
|
579
|
+
["urlDecode(string)", own((ctx, a) => decodeURIComponent(text(a)))],
|
|
578
580
|
// hashing
|
|
579
|
-
["sha256(string)", hosted("sha256", (handler) => (
|
|
580
|
-
["md5(string)", hosted("md5", (handler) => (
|
|
581
|
-
["sha1(string)", hosted("sha1", (handler) => (
|
|
582
|
-
["sha512(string)", hosted("sha512", (handler) => (
|
|
581
|
+
["sha256(string)", hosted("sha256", (handler) => (ctx, a) => handler(text(a)))],
|
|
582
|
+
["md5(string)", hosted("md5", (handler) => (ctx, a) => handler(text(a)))],
|
|
583
|
+
["sha1(string)", hosted("sha1", (handler) => (ctx, a) => handler(text(a)))],
|
|
584
|
+
["sha512(string)", hosted("sha512", (handler) => (ctx, a) => handler(text(a)))],
|
|
583
585
|
[
|
|
584
586
|
"hmac(string, string, string)",
|
|
585
|
-
hosted("hmac", (handler) => (
|
|
587
|
+
hosted("hmac", (handler) => (ctx, a, b, c) => handler(text(a), text(b), text(c))),
|
|
586
588
|
],
|
|
587
589
|
// null handling
|
|
588
|
-
["default(dyn, dyn)", own((
|
|
590
|
+
["default(dyn, dyn)", own((ctx, a, b) => (a === null ? b : a))],
|
|
589
591
|
[
|
|
590
592
|
"coalesce(list<dyn>)",
|
|
591
|
-
own((
|
|
592
|
-
const found = list("coalesce",
|
|
593
|
+
own((ctx, a) => {
|
|
594
|
+
const found = list("coalesce", a).find((held) => held !== null);
|
|
593
595
|
return found === undefined ? null : found;
|
|
594
596
|
}),
|
|
595
597
|
],
|
|
596
598
|
// time
|
|
597
599
|
["now()", own(() => instantOfMillis("now", Date.now()))],
|
|
598
600
|
["nowIso()", own(() => isoTextIn(Date.now(), "UTC"))],
|
|
599
|
-
["nowIso(string)", own((
|
|
601
|
+
["nowIso(string)", own((ctx, a) => isoTextIn(Date.now(), zoneArg("nowIso", a)))],
|
|
600
602
|
["today()", own(() => dateTextIn(Date.now(), "UTC"))],
|
|
601
|
-
["today(string)", own((
|
|
603
|
+
["today(string)", own((ctx, a) => dateTextIn(Date.now(), zoneArg("today", a)))],
|
|
602
604
|
["nowMillis()", own(() => BigInt(Date.now()))],
|
|
603
605
|
["nowSeconds()", own(() => BigInt(Math.floor(Date.now() / 1000)))],
|
|
604
|
-
["dateIn(google.protobuf.Timestamp)", own((
|
|
605
|
-
["dateIn(google.protobuf.Timestamp, string)", own((
|
|
606
|
-
["isoIn(google.protobuf.Timestamp)", own((
|
|
607
|
-
["isoIn(google.protobuf.Timestamp, string)", own((
|
|
608
|
-
["startOfMonth(google.protobuf.Timestamp)", own((
|
|
609
|
-
["startOfMonth(google.protobuf.Timestamp, string)", own((
|
|
610
|
-
["addMonths(google.protobuf.Timestamp, int)", own((
|
|
611
|
-
["addMonths(google.protobuf.Timestamp, int, string)", own((
|
|
606
|
+
["dateIn(google.protobuf.Timestamp)", own((ctx, a) => dateIn(a, undefined))],
|
|
607
|
+
["dateIn(google.protobuf.Timestamp, string)", own((ctx, a, b) => dateIn(a, b))],
|
|
608
|
+
["isoIn(google.protobuf.Timestamp)", own((ctx, a) => isoIn(a, undefined))],
|
|
609
|
+
["isoIn(google.protobuf.Timestamp, string)", own((ctx, a, b) => isoIn(a, b))],
|
|
610
|
+
["startOfMonth(google.protobuf.Timestamp)", own((ctx, a) => startOfMonth(a, undefined))],
|
|
611
|
+
["startOfMonth(google.protobuf.Timestamp, string)", own((ctx, a, b) => startOfMonth(a, b))],
|
|
612
|
+
["addMonths(google.protobuf.Timestamp, int)", own((ctx, a, b) => addMonths(a, b, undefined))],
|
|
613
|
+
["addMonths(google.protobuf.Timestamp, int, string)", own((ctx, a, b, c) => addMonths(a, b, c))],
|
|
612
614
|
// formatting
|
|
613
|
-
["format(double, string)", own((
|
|
614
|
-
["format(int, string)", own((
|
|
615
|
-
["fixed(double, int)", own((
|
|
616
|
-
["fixed(int, int)", own((
|
|
617
|
-
["formatDuration(double, int)", own((
|
|
618
|
-
["formatDuration(int, int)", own((
|
|
615
|
+
["format(double, string)", own((ctx, a, b) => formatter("format", b)(formattable("format", a)))],
|
|
616
|
+
["format(int, string)", own((ctx, a, b) => formatter("format", b)(formattable("format", a)))],
|
|
617
|
+
["fixed(double, int)", own((ctx, a, b) => fixedText(a, b))],
|
|
618
|
+
["fixed(int, int)", own((ctx, a, b) => fixedText(a, b))],
|
|
619
|
+
["formatDuration(double, int)", own((ctx, a, b) => durationText(a, b))],
|
|
620
|
+
["formatDuration(int, int)", own((ctx, a, b) => durationText(a, b))],
|
|
619
621
|
// uuid
|
|
620
622
|
["uuidv1()", own(() => v1())],
|
|
621
623
|
["uuidv4()", own(() => v4())],
|
|
622
624
|
["uuidv6()", own(() => v6())],
|
|
623
625
|
["uuidv7()", own(() => v7())],
|
|
624
|
-
["uuidv3(string, string)", own((
|
|
625
|
-
["uuidv5(string, string)", own((
|
|
626
|
-
["uuidValidate(string)", own((
|
|
627
|
-
["uuidVersion(string)", own((
|
|
626
|
+
["uuidv3(string, string)", own((ctx, a, b) => v3(text(a), text(b)))],
|
|
627
|
+
["uuidv5(string, string)", own((ctx, a, b) => v5(text(a), text(b)))],
|
|
628
|
+
["uuidValidate(string)", own((ctx, a) => uuidValidate(text(a)))],
|
|
629
|
+
["uuidVersion(string)", own((ctx, a) => BigInt(uuidVersion(text(a))))],
|
|
628
630
|
]);
|
|
629
631
|
/**
|
|
630
632
|
* The half-open range of a string, bytes or a list. Indices arrive as CEL ints (`bigint`),
|
|
631
633
|
* which neither `String.slice` nor `TypedArray.subarray` accepts. `subarray` rather than
|
|
632
634
|
* `slice` for bytes: a view costs no copy, and every consumer treats the result as read-only.
|
|
633
635
|
*/
|
|
634
|
-
function sliced(
|
|
635
|
-
const from = Number(
|
|
636
|
-
const to = Number(
|
|
637
|
-
const value = args[0];
|
|
636
|
+
function sliced(value, start, end) {
|
|
637
|
+
const from = Number(start);
|
|
638
|
+
const to = Number(end);
|
|
638
639
|
if (typeof value === "string")
|
|
639
640
|
return value.slice(from, to);
|
|
640
641
|
if (isCelBytes(value))
|
|
@@ -643,44 +644,44 @@ function sliced(args) {
|
|
|
643
644
|
return value.slice(from, to);
|
|
644
645
|
throw new CatalogRefusal(`slice: expected a string, bytes or a list, got ${celTypeNameOf(value) ?? "no CEL value"}`);
|
|
645
646
|
}
|
|
646
|
-
function roundedTo(
|
|
647
|
-
return Number(formattable("round",
|
|
647
|
+
function roundedTo(value, digits) {
|
|
648
|
+
return Number(formattable("round", value).toFixed(digitCount("round", digits)));
|
|
648
649
|
}
|
|
649
|
-
function fixedText(
|
|
650
|
-
return formatter("fixed", `.${digitCount("fixed",
|
|
650
|
+
function fixedText(value, digits) {
|
|
651
|
+
return formatter("fixed", `.${digitCount("fixed", digits)}f`)(formattable("fixed", value));
|
|
651
652
|
}
|
|
652
|
-
function firstMatch(what,
|
|
653
|
-
const matcher = pattern(what,
|
|
653
|
+
function firstMatch(what, subject, source, flags) {
|
|
654
|
+
const matcher = pattern(what, source, flags).matcher(text(subject));
|
|
654
655
|
return matcher.find() ? (matcher.group() ?? "") : "";
|
|
655
656
|
}
|
|
656
|
-
function everyMatch(what,
|
|
657
|
-
const matcher = pattern(what,
|
|
657
|
+
function everyMatch(what, subject, source, flags) {
|
|
658
|
+
const matcher = pattern(what, source, flags).matcher(text(subject));
|
|
658
659
|
const out = [];
|
|
659
660
|
while (matcher.find())
|
|
660
661
|
out.push(matcher.group() ?? "");
|
|
661
662
|
return out;
|
|
662
663
|
}
|
|
663
|
-
function matchGroups(what,
|
|
664
|
-
const matcher = pattern(what,
|
|
664
|
+
function matchGroups(what, subject, source, flags) {
|
|
665
|
+
const matcher = pattern(what, source, flags).matcher(text(subject));
|
|
665
666
|
if (!matcher.find())
|
|
666
667
|
return [];
|
|
667
668
|
return Array.from({ length: matcher.groupCount() }, (_unused, at) => matcher.group(at + 1) ?? "");
|
|
668
669
|
}
|
|
669
|
-
function dateIn(
|
|
670
|
-
return dateTextIn(millisOf(instantArg("dateIn",
|
|
670
|
+
function dateIn(instant, zone) {
|
|
671
|
+
return dateTextIn(millisOf(instantArg("dateIn", instant)), zoneArg("dateIn", zone));
|
|
671
672
|
}
|
|
672
|
-
function isoIn(
|
|
673
|
-
return isoTextIn(millisOf(instantArg("isoIn",
|
|
673
|
+
function isoIn(instant, zone) {
|
|
674
|
+
return isoTextIn(millisOf(instantArg("isoIn", instant)), zoneArg("isoIn", zone));
|
|
674
675
|
}
|
|
675
|
-
function startOfMonth(
|
|
676
|
+
function startOfMonth(instant, zone) {
|
|
676
677
|
const named = zoneArg("startOfMonth", zone);
|
|
677
|
-
const fields = civilTimeIn(millisOf(instantArg("startOfMonth",
|
|
678
|
+
const fields = civilTimeIn(millisOf(instantArg("startOfMonth", instant)), named);
|
|
678
679
|
return instantOfMillis("startOfMonth", instantOfCivilTime({ ...fields, day: 1, hour: 0, minute: 0, second: 0 }, named));
|
|
679
680
|
}
|
|
680
|
-
function addMonths(
|
|
681
|
+
function addMonths(instant, months, zone) {
|
|
681
682
|
const named = zoneArg("addMonths", zone);
|
|
682
|
-
const fields = civilTimeIn(millisOf(instantArg("addMonths",
|
|
683
|
-
const shifted = fields.year * 12 + (fields.month - 1) + Number(
|
|
683
|
+
const fields = civilTimeIn(millisOf(instantArg("addMonths", instant)), named);
|
|
684
|
+
const shifted = fields.year * 12 + (fields.month - 1) + Number(months);
|
|
684
685
|
// `%` takes the dividend's sign in JS, so a negative total would yield month 0.
|
|
685
686
|
const year = Math.floor(shifted / 12);
|
|
686
687
|
const month = (((shifted % 12) + 12) % 12) + 1;
|
package/dist/cel-map-value.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Building a CEL map, and the one identity a key has.
|
|
3
3
|
*
|
|
4
|
-
* A map's entries live in a `Map` keyed by
|
|
5
|
-
*
|
|
4
|
+
* A map's entries live in a `Map` keyed by each key's **own typed value**, never by a
|
|
5
|
+
* property name. Three consequences, all load-bearing:
|
|
6
6
|
*
|
|
7
7
|
* - A map holds CEL's four key types (int, uint, bool, string) in one container, and an
|
|
8
8
|
* int key and a uint key of the same number are **one** key, because CEL equality
|
|
@@ -10,25 +10,38 @@
|
|
|
10
10
|
* - Nothing a key spells can reach a prototype, a method or an inherited member. A map
|
|
11
11
|
* built from `{'__proto__': 1}` holds `__proto__` as data and reads it back as data;
|
|
12
12
|
* dropping such a key would be swallowing what the author wrote.
|
|
13
|
+
* - The types separate themselves. A `Map` compares its keys by type as well as value, so
|
|
14
|
+
* a string `"1"` and an int `1` are distinct keys with nothing prefixed to say so — and a
|
|
15
|
+
* second engine keys an entry by its own discriminant rather than reproducing this one's
|
|
16
|
+
* text byte for byte.
|
|
13
17
|
*/
|
|
14
|
-
import type { CelMap, CelMapValueEntry, CelValue } from "./cel-value.js";
|
|
18
|
+
import type { CelMap, CelMapKey, CelMapValueEntry, CelValue } from "./cel-value.js";
|
|
15
19
|
import { type CelError } from "./cel-value.js";
|
|
16
20
|
import type { SourceRange } from "./syntax-tree.js";
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* What identifies a key. The `bigint` covers the numeric types together: CEL equality
|
|
19
23
|
* makes `1`, `1u` and `1.0` one key, so a map carrying two of them is not a map and a
|
|
20
24
|
* lookup by any of the three finds the entry — which is what
|
|
21
25
|
* `{1u: 1.0, 2: 2.0, 3u: 3.0}[?3.0]` reads. A double that is not whole identifies
|
|
22
26
|
* nothing, since no entry can hold it.
|
|
27
|
+
*
|
|
28
|
+
* A string and a bool identify themselves, and nothing is prefixed to keep the types
|
|
29
|
+
* apart: a `Map` key of one type never equals a key of another, so `"1"` and `1` are
|
|
30
|
+
* distinct keys and `"true"` is not `true`.
|
|
23
31
|
*/
|
|
24
|
-
export declare function mapKeyIdentity(key: CelValue):
|
|
32
|
+
export declare function mapKeyIdentity(key: CelValue): CelMapKey | undefined;
|
|
25
33
|
/** An empty map, for a literal with no entries. */
|
|
26
|
-
export declare function celMapOf(entries: ReadonlyMap<
|
|
34
|
+
export declare function celMapOf(entries: ReadonlyMap<CelMapKey, CelMapValueEntry>): CelMap;
|
|
27
35
|
/**
|
|
28
36
|
* A map from its entries in written order, or the error that stops it: a key of a type
|
|
29
37
|
* no map is keyed by, or two keys CEL equality makes one.
|
|
38
|
+
*
|
|
39
|
+
* The entries arrive **flat** — key, value, key, value — because a literal of n entries
|
|
40
|
+
* then costs one allocation rather than one per entry, and both backends write the same
|
|
41
|
+
* call. A duplicate is caught by the size not moving, which is the one hash lookup the
|
|
42
|
+
* insert already performs.
|
|
30
43
|
*/
|
|
31
|
-
export declare function celMapFromEntries(
|
|
44
|
+
export declare function celMapFromEntries(flat: readonly CelValue[], range?: SourceRange): CelMap | CelError;
|
|
32
45
|
/** Every key of a map, in insertion order — what a comprehension ranges over. */
|
|
33
46
|
export declare function celMapKeys(map: CelMap): CelValue[];
|
|
34
47
|
//# sourceMappingURL=cel-map-value.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cel-map-value.d.ts","sourceRoot":"","sources":["../src/cel-map-value.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cel-map-value.d.ts","sourceRoot":"","sources":["../src/cel-map-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAKnE;AAED,mDAAmD;AACnD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,gBAAgB,CAAC,GAAG,MAAM,CAElF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ,CAyBnG;AAQD,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,CAElD"}
|
package/dist/cel-map-value.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Building a CEL map, and the one identity a key has.
|
|
3
3
|
*
|
|
4
|
-
* A map's entries live in a `Map` keyed by
|
|
5
|
-
*
|
|
4
|
+
* A map's entries live in a `Map` keyed by each key's **own typed value**, never by a
|
|
5
|
+
* property name. Three consequences, all load-bearing:
|
|
6
6
|
*
|
|
7
7
|
* - A map holds CEL's four key types (int, uint, bool, string) in one container, and an
|
|
8
8
|
* int key and a uint key of the same number are **one** key, because CEL equality
|
|
@@ -10,27 +10,30 @@
|
|
|
10
10
|
* - Nothing a key spells can reach a prototype, a method or an inherited member. A map
|
|
11
11
|
* built from `{'__proto__': 1}` holds `__proto__` as data and reads it back as data;
|
|
12
12
|
* dropping such a key would be swallowing what the author wrote.
|
|
13
|
+
* - The types separate themselves. A `Map` compares its keys by type as well as value, so
|
|
14
|
+
* a string `"1"` and an int `1` are distinct keys with nothing prefixed to say so — and a
|
|
15
|
+
* second engine keys an entry by its own discriminant rather than reproducing this one's
|
|
16
|
+
* text byte for byte.
|
|
13
17
|
*/
|
|
14
18
|
import { CEL_VALUE_TYPE, celError, isCelError, isCelUint, } from "./cel-value.js";
|
|
15
19
|
/**
|
|
16
|
-
*
|
|
20
|
+
* What identifies a key. The `bigint` covers the numeric types together: CEL equality
|
|
17
21
|
* makes `1`, `1u` and `1.0` one key, so a map carrying two of them is not a map and a
|
|
18
22
|
* lookup by any of the three finds the entry — which is what
|
|
19
23
|
* `{1u: 1.0, 2: 2.0, 3u: 3.0}[?3.0]` reads. A double that is not whole identifies
|
|
20
24
|
* nothing, since no entry can hold it.
|
|
25
|
+
*
|
|
26
|
+
* A string and a bool identify themselves, and nothing is prefixed to keep the types
|
|
27
|
+
* apart: a `Map` key of one type never equals a key of another, so `"1"` and `1` are
|
|
28
|
+
* distinct keys and `"true"` is not `true`.
|
|
21
29
|
*/
|
|
22
30
|
export function mapKeyIdentity(key) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (isCelUint(key))
|
|
30
|
-
return `n${key.value}`;
|
|
31
|
-
if (typeof key === "number" && Number.isInteger(key))
|
|
32
|
-
return `n${BigInt(key)}`;
|
|
33
|
-
return undefined;
|
|
31
|
+
const held = typeof key;
|
|
32
|
+
if (held === "string" || held === "boolean" || held === "bigint")
|
|
33
|
+
return key;
|
|
34
|
+
if (held === "number")
|
|
35
|
+
return Number.isInteger(key) ? BigInt(key) : undefined;
|
|
36
|
+
return isCelUint(key) ? key.value : undefined;
|
|
34
37
|
}
|
|
35
38
|
/** An empty map, for a literal with no entries. */
|
|
36
39
|
export function celMapOf(entries) {
|
|
@@ -39,10 +42,17 @@ export function celMapOf(entries) {
|
|
|
39
42
|
/**
|
|
40
43
|
* A map from its entries in written order, or the error that stops it: a key of a type
|
|
41
44
|
* no map is keyed by, or two keys CEL equality makes one.
|
|
45
|
+
*
|
|
46
|
+
* The entries arrive **flat** — key, value, key, value — because a literal of n entries
|
|
47
|
+
* then costs one allocation rather than one per entry, and both backends write the same
|
|
48
|
+
* call. A duplicate is caught by the size not moving, which is the one hash lookup the
|
|
49
|
+
* insert already performs.
|
|
42
50
|
*/
|
|
43
|
-
export function celMapFromEntries(
|
|
51
|
+
export function celMapFromEntries(flat, range) {
|
|
44
52
|
const entries = new Map();
|
|
45
|
-
for (
|
|
53
|
+
for (let at = 0; at < flat.length; at += 2) {
|
|
54
|
+
const key = flat[at];
|
|
55
|
+
const value = flat[at + 1];
|
|
46
56
|
if (isCelError(key))
|
|
47
57
|
return key;
|
|
48
58
|
if (isCelError(value))
|
|
@@ -54,10 +64,11 @@ export function celMapFromEntries(pairs, range) {
|
|
|
54
64
|
if (identity === undefined) {
|
|
55
65
|
return celError("unsupported_key_type", "a map is keyed by an int, a uint, a bool or a string", range);
|
|
56
66
|
}
|
|
57
|
-
|
|
67
|
+
const before = entries.size;
|
|
68
|
+
entries.set(identity, { key, value });
|
|
69
|
+
if (entries.size === before) {
|
|
58
70
|
return celError("duplicate_map_key", `the key ${describeKey(key)} is written twice`, range);
|
|
59
71
|
}
|
|
60
|
-
entries.set(identity, { key, value });
|
|
61
72
|
}
|
|
62
73
|
return celMapOf(entries);
|
|
63
74
|
}
|
package/dist/cel-value.d.ts
CHANGED
|
@@ -62,12 +62,19 @@ export interface CelMapValueEntry {
|
|
|
62
62
|
readonly value: CelValue;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
65
|
+
* What identifies a key inside a map's entries. A `Map` distinguishes its own keys **by
|
|
66
|
+
* type**, so the four CEL key types collapse onto three JS ones with no namespace to
|
|
67
|
+
* separate by hand: a string key is itself, a bool is itself, and an int, a uint and a
|
|
68
|
+
* whole double are all the `bigint` CEL equality makes them.
|
|
69
|
+
*/
|
|
70
|
+
export type CelMapKey = string | bigint | boolean;
|
|
71
|
+
/**
|
|
72
|
+
* A map. Entries live in a `Map` keyed by each key's own `CelMapKey`, so the map holds
|
|
73
|
+
* int, uint, bool and string keys alike and **no key is ever a property name**:
|
|
67
74
|
* `__proto__`, `constructor` and `prototype` are data here, as they are in any map.
|
|
68
75
|
*/
|
|
69
76
|
export interface CelMap extends Branded<"map"> {
|
|
70
|
-
readonly entries: ReadonlyMap<
|
|
77
|
+
readonly entries: ReadonlyMap<CelMapKey, CelMapValueEntry>;
|
|
71
78
|
}
|
|
72
79
|
/** Every evaluation failure this engine names. A code is never derived from a message. */
|
|
73
80
|
export declare const CEL_EVALUATION_CODES: readonly ["no_such_key", "no_such_variable", "index_out_of_range", "no_matching_overload", "unsupported_container", "unsupported_key_type", "duplicate_map_key", "numeric_overflow", "division_by_zero", "modulo_by_zero", "invalid_conversion", "invalid_argument", "invalid_regular_expression", "optional_value_missing", "unbound_function", "async_value_unsupported"];
|
package/dist/cel-value.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cel-value.d.ts","sourceRoot":"","sources":["../src/cel-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhE,eAAO,MAAM,cAAc,EAAE,OAAO,MAAqC,CAAC;AAE1E,gFAAgF;AAChF,eAAO,MAAM,cAAc,gHAQjB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,UAAU,OAAO,CAAC,GAAG,SAAS,MAAM;IAClC,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,GAAG,CAAC;CAChC;AAED,2EAA2E;AAC3E,MAAM,WAAW,OAAQ,SAAQ,OAAO,CAAC,MAAM,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,2BAA2B,CAAC;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,6EAA6E;AAC7E,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,0BAA0B,CAAC;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,yEAAyE;AACzE,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,MAAM,CAAC;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,8CAA8C;AAC9C,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,UAAU,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,Q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AK,IAAI,SAAS,CAK9D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAwBhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,SAAS,CAO3F;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,UAAU,GAAG,QAAQ,CAiB1D"}
|
|
@@ -36,9 +36,10 @@ export interface CelCheckDiagnostic {
|
|
|
36
36
|
* refusal to compile a tree the front end already reported a syntax diagnostic for,
|
|
37
37
|
* which is a question the caller should have asked before compiling, and
|
|
38
38
|
* `emitted_module_rejected` is the refusal to run a loaded module whose integrity header
|
|
39
|
-
* is not the one the emission asked for
|
|
39
|
+
* is not the one the emission asked for, and `signature_too_wide` is a registration
|
|
40
|
+
* declaring more values than an implementation receives.
|
|
40
41
|
*/
|
|
41
|
-
export type CelEngineErrorCode = "namespaces_mismatch" | "unreadable_expression" | "emitted_module_rejected";
|
|
42
|
+
export type CelEngineErrorCode = "namespaces_mismatch" | "unreadable_expression" | "emitted_module_rejected" | "signature_too_wide";
|
|
42
43
|
export declare class CelEngineError extends Error {
|
|
43
44
|
readonly code: CelEngineErrorCode;
|
|
44
45
|
constructor(code: CelEngineErrorCode, message: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-diagnostic.d.ts","sourceRoot":"","sources":["../src/check-diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,eAAe,4SAyBlB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CA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F;AACnF,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA4B;IAEjD,GAAG,CAAC,UAAU,EAAE,kBAAkB,GAAG,IAAI;IAIzC,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,SAAS,kBAAkB,EAAE;CAGtC"}
|
package/dist/checker.d.ts
CHANGED
|
@@ -38,6 +38,15 @@ export interface NamespaceFunction {
|
|
|
38
38
|
readonly parameters?: readonly CelType[];
|
|
39
39
|
/** How the declaration is written, for a listing; absent with the parameters. */
|
|
40
40
|
readonly signature?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Types the declaration named that nothing is registered under, in the order written.
|
|
43
|
+
*
|
|
44
|
+
* The declaration is accepted and reads `dyn` where one stands: a host's declaration is
|
|
45
|
+
* data out of someone's manifest, so a name its own registry does not carry is the host
|
|
46
|
+
* disagreeing with itself — reported at the call, where there is a range, rather than
|
|
47
|
+
* thrown at registration, where there is none. Same rule as an unjudged schema node.
|
|
48
|
+
*/
|
|
49
|
+
readonly unregisteredTypes?: readonly string[];
|
|
41
50
|
readonly deterministic?: boolean;
|
|
42
51
|
readonly hostBacked?: boolean;
|
|
43
52
|
readonly throws?: readonly string[];
|
package/dist/checker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../src/checker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,eAAe,CAAC;AAyBzD,OAAO,KAAK,EAAgB,kBAAkB,EAAoB,MAAM,uBAAuB,CAAC;AAGhG,OAAO,KAAK,EAAE,gBAAgB,EAAyC,MAAM,wBAAwB,CAAC;AAKtG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAYvD;;;;;;;;;;GAUG;AACH,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