@jplorg/jpl 2.1.0 → 2.1.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/dist/esm/main.js +146 -146
- package/dist/types/builtins/funcContains.d.ts +1 -1
- package/dist/types/builtins/funcEndsWith.d.ts +1 -1
- package/dist/types/builtins/funcError.d.ts +1 -1
- package/dist/types/builtins/funcFromJSON.d.ts +1 -1
- package/dist/types/builtins/funcHas.d.ts +1 -1
- package/dist/types/builtins/funcIn.d.ts +1 -1
- package/dist/types/builtins/funcKeys.d.ts +1 -1
- package/dist/types/builtins/funcLength.d.ts +1 -1
- package/dist/types/builtins/funcNow.d.ts +1 -1
- package/dist/types/builtins/funcStartsWith.d.ts +1 -1
- package/dist/types/builtins/funcToJSON.d.ts +1 -1
- package/dist/types/builtins/funcToLowerCase.d.ts +1 -1
- package/dist/types/builtins/funcToNumber.d.ts +1 -1
- package/dist/types/builtins/funcToString.d.ts +1 -1
- package/dist/types/builtins/funcToUpperCase.d.ts +1 -1
- package/dist/types/builtins/funcTrim.d.ts +1 -1
- package/dist/types/builtins/funcTrimEnd.d.ts +1 -1
- package/dist/types/builtins/funcTrimStart.d.ts +1 -1
- package/dist/types/builtins/funcType.d.ts +1 -1
- package/dist/types/builtins/funcVoid.d.ts +1 -1
- package/dist/types/interpreter/index.d.ts +1 -1
- package/dist/types/interpreter/parse.d.ts +1 -1
- package/dist/types/library/index.d.ts +1 -0
- package/dist/types/program/handler.d.ts +1 -2
- package/dist/types/program/index.d.ts +1 -1
- package/dist/types/program/ops/opAccess/index.d.ts +1 -2
- package/dist/types/program/ops/opAccess/opaField.d.ts +1 -2
- package/dist/types/program/ops/opAccess/opaFunction.d.ts +1 -2
- package/dist/types/program/ops/opAccess/opaIter.d.ts +1 -2
- package/dist/types/program/ops/opAccess/opaSlice.d.ts +1 -2
- package/dist/types/program/ops/opAnd.d.ts +2 -3
- package/dist/types/program/ops/opArrayConstructor.d.ts +2 -3
- package/dist/types/program/ops/opAssignment/index.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opaAssignField.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opaAssignIter.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opaAssignSlice.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opuAddition.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opuDivision.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opuMultiplication.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opuNullCoalescence.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opuRemainder.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opuSet.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opuSubtraction.d.ts +1 -2
- package/dist/types/program/ops/opAssignment/opuUpdate.d.ts +1 -2
- package/dist/types/program/ops/opCalculation/index.d.ts +1 -2
- package/dist/types/program/ops/opCalculation/opmAddition.d.ts +1 -2
- package/dist/types/program/ops/opCalculation/opmDivision.d.ts +1 -2
- package/dist/types/program/ops/opCalculation/opmMultiplication.d.ts +1 -2
- package/dist/types/program/ops/opCalculation/opmRemainder.d.ts +1 -2
- package/dist/types/program/ops/opCalculation/opmSubtraction.d.ts +1 -2
- package/dist/types/program/ops/opComparison/index.d.ts +1 -2
- package/dist/types/program/ops/opComparison/opcEqual.d.ts +1 -2
- package/dist/types/program/ops/opComparison/opcGreater.d.ts +1 -2
- package/dist/types/program/ops/opComparison/opcGreaterEqual.d.ts +1 -2
- package/dist/types/program/ops/opComparison/opcLess.d.ts +1 -2
- package/dist/types/program/ops/opComparison/opcLessEqual.d.ts +1 -2
- package/dist/types/program/ops/opComparison/opcUnequal.d.ts +1 -2
- package/dist/types/program/ops/opConstant.d.ts +1 -2
- package/dist/types/program/ops/opConstantFalse.d.ts +1 -2
- package/dist/types/program/ops/opConstantNull.d.ts +1 -2
- package/dist/types/program/ops/opConstantTrue.d.ts +1 -2
- package/dist/types/program/ops/opFunctionDefinition.d.ts +2 -3
- package/dist/types/program/ops/opIf.d.ts +2 -3
- package/dist/types/program/ops/opInterpolatedString.d.ts +2 -3
- package/dist/types/program/ops/opNegation.d.ts +2 -3
- package/dist/types/program/ops/opNot.d.ts +2 -3
- package/dist/types/program/ops/opNullCoalescence.d.ts +2 -3
- package/dist/types/program/ops/opNumber.d.ts +2 -3
- package/dist/types/program/ops/opObjectConstructor.d.ts +2 -3
- package/dist/types/program/ops/opOr.d.ts +2 -3
- package/dist/types/program/ops/opOutputConcat.d.ts +2 -3
- package/dist/types/program/ops/opString.d.ts +1 -2
- package/dist/types/program/ops/opTry.d.ts +1 -2
- package/dist/types/program/ops/opVariable.d.ts +2 -3
- package/dist/types/program/ops/opVariableDefinition.d.ts +2 -3
- package/dist/types/program/ops/opVoid.d.ts +2 -3
- package/dist/types/program/ops/utils.d.ts +1 -1
- package/dist/types/program/params.d.ts +1 -2
- package/dist/types/runtime/index.d.ts +1 -2
- package/package.json +3 -10
package/dist/esm/main.js
CHANGED
|
@@ -178,7 +178,7 @@ function Ge(e) {
|
|
|
178
178
|
return b.is(e) ? e.value : x(e);
|
|
179
179
|
}
|
|
180
180
|
function x(e) {
|
|
181
|
-
return
|
|
181
|
+
return D(e, void 0, Ye);
|
|
182
182
|
}
|
|
183
183
|
function S(e) {
|
|
184
184
|
return b.is(e) ? Ue(() => e.value) : e;
|
|
@@ -192,7 +192,7 @@ var Ke = [
|
|
|
192
192
|
"array",
|
|
193
193
|
"object"
|
|
194
194
|
];
|
|
195
|
-
function
|
|
195
|
+
function C(e) {
|
|
196
196
|
let t = S(e);
|
|
197
197
|
if (t === null) return "null";
|
|
198
198
|
if (Array.isArray(t)) return "array";
|
|
@@ -206,19 +206,19 @@ function qe(e) {
|
|
|
206
206
|
default: throw new y(`invalid type ${n} (${e})`);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
if (b.is(e)) throw new y(
|
|
211
|
-
let n =
|
|
212
|
-
if (n !== t) throw new y(
|
|
209
|
+
function qe(e, t) {
|
|
210
|
+
if (b.is(e)) throw new y(T("unexpected type: JPLTypes (%*<100v) are not allowed here", e));
|
|
211
|
+
let n = C(e);
|
|
212
|
+
if (n !== t) throw new y(T("unexpected type: %s (%*<100v) cannot be used as %s", n, e, t));
|
|
213
213
|
return e;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
let r = n ?
|
|
215
|
+
function w(e, t, n) {
|
|
216
|
+
let r = n ? D(e, (e, t) => typeof S(t) == "function" ? "<function>" : t) : D(e);
|
|
217
217
|
return t && typeof r == "string" ? r : JSON.stringify(r);
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function T(e, ...t) {
|
|
220
220
|
let n = 0;
|
|
221
|
-
return
|
|
221
|
+
return E(e).replace(/%([*\-<]+)?([1-9][0-9]*)?(.)/g, (e, r, i, a) => {
|
|
222
222
|
switch (a) {
|
|
223
223
|
case "%": return "%";
|
|
224
224
|
default:
|
|
@@ -228,10 +228,10 @@ function w(e, ...t) {
|
|
|
228
228
|
let s;
|
|
229
229
|
switch (a) {
|
|
230
230
|
case "s":
|
|
231
|
-
s =
|
|
231
|
+
s = E(o);
|
|
232
232
|
break;
|
|
233
233
|
case "v":
|
|
234
|
-
s =
|
|
234
|
+
s = Je(o);
|
|
235
235
|
break;
|
|
236
236
|
default: throw new y(`format ${e} has unknown verb ${a}`);
|
|
237
237
|
}
|
|
@@ -261,35 +261,35 @@ function w(e, ...t) {
|
|
|
261
261
|
return s;
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
return
|
|
264
|
+
function E(e) {
|
|
265
|
+
return w(e, !0, !0);
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
return
|
|
267
|
+
function Je(e) {
|
|
268
|
+
return w(e, !1, !0);
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function D(e, t, n = Ze) {
|
|
271
271
|
let r = (e, i) => {
|
|
272
272
|
let a = i;
|
|
273
273
|
return t && (a = t(e ?? "", a)), n(e, a, r);
|
|
274
274
|
};
|
|
275
275
|
return r(null, e);
|
|
276
276
|
}
|
|
277
|
+
function Ye(e, t, n) {
|
|
278
|
+
return b.is(t) || typeof t == "function" ? t : O(e, t, n);
|
|
279
|
+
}
|
|
277
280
|
function Xe(e, t, n) {
|
|
278
|
-
|
|
281
|
+
let r = t;
|
|
282
|
+
return b.is(r) && (r = r.toJSON()), typeof r == "function" ? r : O(e, r, n);
|
|
279
283
|
}
|
|
280
284
|
function Ze(e, t, n) {
|
|
281
285
|
let r = t;
|
|
282
|
-
return b.is(r) && (r = r.toJSON()),
|
|
286
|
+
return b.is(r) && (r = r.toJSON()), O(e, r, n);
|
|
283
287
|
}
|
|
284
288
|
function Qe(e, t, n) {
|
|
285
289
|
let r = t;
|
|
286
|
-
return
|
|
290
|
+
return typeof r?.toJSON == "function" && (r = r.toJSON()), O(e, r, n);
|
|
287
291
|
}
|
|
288
|
-
function
|
|
289
|
-
let r = t;
|
|
290
|
-
return typeof r?.toJSON == "function" && (r = r.toJSON()), D(e, r, n);
|
|
291
|
-
}
|
|
292
|
-
function D(e, t, n) {
|
|
292
|
+
function O(e, t, n) {
|
|
293
293
|
let r = e == null;
|
|
294
294
|
switch (typeof t) {
|
|
295
295
|
case "string":
|
|
@@ -306,29 +306,29 @@ function D(e, t, n) {
|
|
|
306
306
|
}
|
|
307
307
|
//#endregion
|
|
308
308
|
//#region lib/library/errors/runtime.ts
|
|
309
|
-
function
|
|
310
|
-
return t.length > 0 ?
|
|
309
|
+
function k(e, t) {
|
|
310
|
+
return t.length > 0 ? T(e, ...t) : E(e);
|
|
311
311
|
}
|
|
312
|
-
var
|
|
312
|
+
var A = class extends g {
|
|
313
313
|
constructor(e, ...t) {
|
|
314
|
-
let n =
|
|
314
|
+
let n = k(e, t);
|
|
315
315
|
super(n, "JPLRuntimeError"), this.value = t.length > 0 ? n : x(e);
|
|
316
316
|
}
|
|
317
|
-
},
|
|
317
|
+
}, j = class extends A {
|
|
318
318
|
constructor(e, ...t) {
|
|
319
|
-
super(`TypeError - ${
|
|
319
|
+
super(`TypeError - ${k(e, t)}`);
|
|
320
320
|
}
|
|
321
|
-
},
|
|
321
|
+
}, $e = class extends A {
|
|
322
322
|
constructor(e, ...t) {
|
|
323
|
-
super(`ReferenceError - ${
|
|
323
|
+
super(`ReferenceError - ${k(e, t)}`);
|
|
324
324
|
}
|
|
325
|
-
},
|
|
325
|
+
}, et = class extends A {
|
|
326
326
|
constructor(e, ...t) {
|
|
327
|
-
super(`ZeroDivisionError - ${
|
|
327
|
+
super(`ZeroDivisionError - ${k(e, t)}`);
|
|
328
328
|
}
|
|
329
|
-
}, tt = class extends
|
|
329
|
+
}, tt = class extends A {
|
|
330
330
|
constructor(e, ...t) {
|
|
331
|
-
super(`TypeConversionError - ${
|
|
331
|
+
super(`TypeConversionError - ${k(e, t)}`);
|
|
332
332
|
}
|
|
333
333
|
}, nt = class extends h {
|
|
334
334
|
src;
|
|
@@ -462,26 +462,26 @@ function M(e, t) {
|
|
|
462
462
|
}
|
|
463
463
|
return a;
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function ut(e, t) {
|
|
466
466
|
return Promise.all(M(e, t));
|
|
467
467
|
}
|
|
468
|
-
async function
|
|
469
|
-
return
|
|
468
|
+
async function dt(e, t) {
|
|
469
|
+
return ft(await ut(e, t));
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function ft(e) {
|
|
472
472
|
return e.length === 0 ? e : e.length === 1 ? e[0] : e.flat(1);
|
|
473
473
|
}
|
|
474
474
|
//#endregion
|
|
475
475
|
//#region lib/runtime/index.ts
|
|
476
|
-
var
|
|
477
|
-
function
|
|
476
|
+
var pt = { vars: {} };
|
|
477
|
+
function N(e = {}, t = {}) {
|
|
478
478
|
return r(e, t, "vars");
|
|
479
479
|
}
|
|
480
|
-
var
|
|
480
|
+
var mt = class {
|
|
481
481
|
#e;
|
|
482
482
|
#t;
|
|
483
483
|
constructor(e, t) {
|
|
484
|
-
this.#e =
|
|
484
|
+
this.#e = N(t?.runtime, pt), this.#t = e;
|
|
485
485
|
}
|
|
486
486
|
get options() {
|
|
487
487
|
return this.#e;
|
|
@@ -523,32 +523,32 @@ var pt = class {
|
|
|
523
523
|
if (!Array.isArray(e)) throw new y(`expected ${t} to be an array`);
|
|
524
524
|
return this.muxOne([e], (e) => this.unwrapValue(e));
|
|
525
525
|
};
|
|
526
|
-
stripValue = (e) =>
|
|
526
|
+
stripValue = (e) => D(e, (e, t) => this.unwrapValue(t));
|
|
527
527
|
stripValues = (e = [], t = "values") => {
|
|
528
528
|
if (!Array.isArray(e)) throw new y(`expected ${t} to be an array`);
|
|
529
529
|
return this.muxOne([e], (e) => this.stripValue(e));
|
|
530
530
|
};
|
|
531
531
|
alterValue = async (e, t) => b.is(e) ? We(() => e.alter(t)) : this.normalizeValue(await t(e));
|
|
532
|
-
type =
|
|
533
|
-
assertType =
|
|
532
|
+
type = C;
|
|
533
|
+
assertType = qe;
|
|
534
534
|
truthy = (e) => {
|
|
535
535
|
let t = this.unwrapValue(e);
|
|
536
536
|
return t !== null && t !== !1;
|
|
537
537
|
};
|
|
538
|
-
compare =
|
|
538
|
+
compare = P.bind(this);
|
|
539
539
|
compareStrings = (e, t) => {
|
|
540
540
|
let n = this.type(e);
|
|
541
541
|
if (n !== "string") throw new y(`unexpected type ${n}`);
|
|
542
542
|
let r = this.type(t);
|
|
543
543
|
if (r !== "string") throw new y(`unexpected type ${r}`);
|
|
544
|
-
return
|
|
544
|
+
return F(this.unwrapValue(e), this.unwrapValue(t));
|
|
545
545
|
};
|
|
546
546
|
compareArrays = (e, t) => {
|
|
547
547
|
let n = this.type(e);
|
|
548
548
|
if (n !== "array") throw new y(`unexpected type ${n}`);
|
|
549
549
|
let r = this.type(t);
|
|
550
550
|
if (r !== "array") throw new y(`unexpected type ${r}`);
|
|
551
|
-
return
|
|
551
|
+
return I.call(this, this.unwrapValue(e), this.unwrapValue(t));
|
|
552
552
|
};
|
|
553
553
|
compareObjects = (e, t) => {
|
|
554
554
|
let n = this.type(e);
|
|
@@ -559,14 +559,14 @@ var pt = class {
|
|
|
559
559
|
};
|
|
560
560
|
equals = (e, t) => this.compare(e, t) === 0;
|
|
561
561
|
merge = async (e, t) => (await void 0, this.type(e) !== "object" || this.type(t) !== "object" ? t : this.alterValue(e, async (e) => i(e, await Promise.all(Object.entries(this.unwrapValue(t)).map(async ([t, n]) => [t, await this.merge(e[t] ?? null, n)])))));
|
|
562
|
-
stringifyJSON = (e, t) =>
|
|
563
|
-
stripJSON = (e) =>
|
|
562
|
+
stringifyJSON = (e, t) => w(e, t);
|
|
563
|
+
stripJSON = (e) => D(e);
|
|
564
564
|
mux = lt;
|
|
565
565
|
muxOne = M;
|
|
566
|
-
muxAsync =
|
|
567
|
-
muxAll =
|
|
566
|
+
muxAsync = ut;
|
|
567
|
+
muxAll = dt;
|
|
568
568
|
};
|
|
569
|
-
function
|
|
569
|
+
function P(e, t) {
|
|
570
570
|
let n = this.type(e), r = this.type(t);
|
|
571
571
|
if (n !== r) return Ke.indexOf(n) - Ke.indexOf(r);
|
|
572
572
|
let i = this.unwrapValue(e), a = this.unwrapValue(t);
|
|
@@ -575,13 +575,13 @@ function F(e, t) {
|
|
|
575
575
|
case "function": return 0;
|
|
576
576
|
case "boolean":
|
|
577
577
|
case "number": return i - +a;
|
|
578
|
-
case "string": return
|
|
579
|
-
case "array": return
|
|
578
|
+
case "string": return F(i, a);
|
|
579
|
+
case "array": return I.call(this, i, a);
|
|
580
580
|
case "object": return ht.call(this, i, a);
|
|
581
581
|
default: throw new y(`unexpected type ${n}`);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
function
|
|
584
|
+
function F(e, t) {
|
|
585
585
|
let n = Math.min(e.length, t.length), r = 0;
|
|
586
586
|
for (let i of e) {
|
|
587
587
|
if (r >= n) break;
|
|
@@ -591,18 +591,18 @@ function I(e, t) {
|
|
|
591
591
|
}
|
|
592
592
|
return e.length - t.length;
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function I(e, t) {
|
|
595
595
|
let n = Math.min(e.length, t.length);
|
|
596
596
|
for (let r = 0; r < n; r += 1) {
|
|
597
|
-
let n =
|
|
597
|
+
let n = P.call(this, e[r], t[r]);
|
|
598
598
|
if (n !== 0) return n;
|
|
599
599
|
}
|
|
600
600
|
return e.length - t.length;
|
|
601
601
|
}
|
|
602
602
|
function ht(e, t) {
|
|
603
|
-
let n = Object.keys(e).sort(
|
|
603
|
+
let n = Object.keys(e).sort(F), r = Object.keys(t).sort(F), i = I.call(this, n, r);
|
|
604
604
|
if (i !== 0) return i;
|
|
605
|
-
for (let r of n) if (i =
|
|
605
|
+
for (let r of n) if (i = P.call(this, e[r], t[r]), i !== 0) return i;
|
|
606
606
|
return 0;
|
|
607
607
|
}
|
|
608
608
|
//#endregion
|
|
@@ -617,7 +617,7 @@ function R(e) {
|
|
|
617
617
|
return [{
|
|
618
618
|
op: "$.",
|
|
619
619
|
params: {
|
|
620
|
-
pipe: L(
|
|
620
|
+
pipe: L(qe(e, "function")),
|
|
621
621
|
selectors: [{
|
|
622
622
|
op: "$()",
|
|
623
623
|
params: {
|
|
@@ -658,7 +658,7 @@ var gt = {
|
|
|
658
658
|
default:
|
|
659
659
|
}
|
|
660
660
|
if (r.optional) return [];
|
|
661
|
-
throw new
|
|
661
|
+
throw new j("cannot access field of %s (%*<100v) with %s (%*<100v)", s, o, i, n);
|
|
662
662
|
});
|
|
663
663
|
},
|
|
664
664
|
map(e, t) {
|
|
@@ -691,7 +691,7 @@ var gt = {
|
|
|
691
691
|
default:
|
|
692
692
|
}
|
|
693
693
|
if (r.optional) return [];
|
|
694
|
-
throw new
|
|
694
|
+
throw new j("cannot execute %s (%*<100v)", s, o);
|
|
695
695
|
},
|
|
696
696
|
map(e, t) {
|
|
697
697
|
return {
|
|
@@ -711,7 +711,7 @@ var gt = {
|
|
|
711
711
|
default:
|
|
712
712
|
}
|
|
713
713
|
if (r.optional) return [];
|
|
714
|
-
throw new
|
|
714
|
+
throw new j("cannot iterate over %s (%*<100v)", s, o);
|
|
715
715
|
},
|
|
716
716
|
map(e, t) {
|
|
717
717
|
return { optional: e.assertType(t.optional, "boolean") };
|
|
@@ -735,7 +735,7 @@ var gt = {
|
|
|
735
735
|
default:
|
|
736
736
|
}
|
|
737
737
|
if (r.optional) return [];
|
|
738
|
-
throw new
|
|
738
|
+
throw new j("cannot slice %s (%*<100v) with %s (%*<100v) and %s (%*<100v)", s, o, i, t, c, n);
|
|
739
739
|
});
|
|
740
740
|
},
|
|
741
741
|
map(e, t) {
|
|
@@ -806,7 +806,7 @@ var gt = {
|
|
|
806
806
|
break;
|
|
807
807
|
default:
|
|
808
808
|
if (r.optional) return [void 0];
|
|
809
|
-
throw new
|
|
809
|
+
throw new j("cannot access fields of %s (%*<100v) (assignment)", u, l);
|
|
810
810
|
}
|
|
811
811
|
let d = await e.executeInstructions(r.pipe ?? [], [t], o, (e) => [e]), f = async (t, n) => {
|
|
812
812
|
if (await void 0, o.signal.checkHealth(), t >= d.length) return [n];
|
|
@@ -845,14 +845,14 @@ var gt = {
|
|
|
845
845
|
case "string": return f(t + 1, a(n, [[r, i ?? " "]], " "));
|
|
846
846
|
default:
|
|
847
847
|
}
|
|
848
|
-
throw new
|
|
848
|
+
throw new j("cannot assign %s (%*<100v) to string (%*<100v)", s, o, n.join(""));
|
|
849
849
|
});
|
|
850
850
|
}
|
|
851
851
|
break;
|
|
852
852
|
default:
|
|
853
853
|
}
|
|
854
854
|
if (r.optional) return f(t + 1, n);
|
|
855
|
-
throw new
|
|
855
|
+
throw new j("cannot access field of %s (%*<100v) with %s (%*<100v) (assignment)", c, c === "string" ? n.join("") : n, p, l);
|
|
856
856
|
};
|
|
857
857
|
return e.muxAsync([await f(0, c)], (t) => {
|
|
858
858
|
if (c === t) return n;
|
|
@@ -893,14 +893,14 @@ var gt = {
|
|
|
893
893
|
case "string": return r ?? " ";
|
|
894
894
|
default:
|
|
895
895
|
}
|
|
896
|
-
throw new
|
|
896
|
+
throw new j("cannot assign %s (%*<100v) to string (%*<100v)", i, r, s);
|
|
897
897
|
}));
|
|
898
898
|
return e.muxAsync([o(t, r)], (r) => t === r ? n : e.alterValue(n, () => r.join("")));
|
|
899
899
|
}
|
|
900
900
|
default:
|
|
901
901
|
}
|
|
902
902
|
if (r.optional) return [void 0];
|
|
903
|
-
throw new
|
|
903
|
+
throw new j("cannot iterate over %s (%*<100v) (assignment)", c, s);
|
|
904
904
|
},
|
|
905
905
|
map(e, t) {
|
|
906
906
|
return { optional: e.assertType(t.optional, "boolean") };
|
|
@@ -931,7 +931,7 @@ var Dt = {
|
|
|
931
931
|
}
|
|
932
932
|
default:
|
|
933
933
|
}
|
|
934
|
-
throw new
|
|
934
|
+
throw new j("cannot assign %s (%*<100v) to slice of %s (%*<100v)", i, n, s, t);
|
|
935
935
|
})));
|
|
936
936
|
break;
|
|
937
937
|
case "string":
|
|
@@ -947,14 +947,14 @@ var Dt = {
|
|
|
947
947
|
}
|
|
948
948
|
default:
|
|
949
949
|
}
|
|
950
|
-
throw new
|
|
950
|
+
throw new j("cannot assign %s (%*<100v) to slice of %s (%*<100v)", i, n, s, t);
|
|
951
951
|
})));
|
|
952
952
|
}
|
|
953
953
|
break;
|
|
954
954
|
default:
|
|
955
955
|
}
|
|
956
956
|
if (r.optional) return l(t + 1, n);
|
|
957
|
-
throw new
|
|
957
|
+
throw new j("cannot slice %s (%*<100v) with %s (%*<100v) and %s (%*<100v) (assignment)", s, o, f, u, p, d);
|
|
958
958
|
};
|
|
959
959
|
return e.muxOne([await l(0, n)], (t) => e.type(t) === "null" ? void 0 : t);
|
|
960
960
|
},
|
|
@@ -1137,7 +1137,7 @@ var Dt = {
|
|
|
1137
1137
|
break;
|
|
1138
1138
|
default:
|
|
1139
1139
|
}
|
|
1140
|
-
throw new
|
|
1140
|
+
throw new j("%s (%*<100v) and %s (%*<100v) cannot be added together", a, n, o, r);
|
|
1141
1141
|
})));
|
|
1142
1142
|
},
|
|
1143
1143
|
map(e, t) {
|
|
@@ -1150,7 +1150,7 @@ var Dt = {
|
|
|
1150
1150
|
switch (i) {
|
|
1151
1151
|
case "number":
|
|
1152
1152
|
if (a === "number") {
|
|
1153
|
-
if (r === 0) throw new
|
|
1153
|
+
if (r === 0) throw new et("%s (%*<100v) cannot be divided by zero", i, n);
|
|
1154
1154
|
return n / r;
|
|
1155
1155
|
}
|
|
1156
1156
|
break;
|
|
@@ -1159,7 +1159,7 @@ var Dt = {
|
|
|
1159
1159
|
break;
|
|
1160
1160
|
default:
|
|
1161
1161
|
}
|
|
1162
|
-
throw new
|
|
1162
|
+
throw new j("%s (%*<100v) cannot be divided by %s (%*<100v)", i, n, a, r);
|
|
1163
1163
|
})));
|
|
1164
1164
|
},
|
|
1165
1165
|
map(e, t) {
|
|
@@ -1181,7 +1181,7 @@ var Dt = {
|
|
|
1181
1181
|
break;
|
|
1182
1182
|
default:
|
|
1183
1183
|
}
|
|
1184
|
-
throw new
|
|
1184
|
+
throw new j("%s (%*<100v) and %s (%*<100v) cannot be multiplied together", i, n, a, r);
|
|
1185
1185
|
})));
|
|
1186
1186
|
},
|
|
1187
1187
|
map(e, t) {
|
|
@@ -1194,13 +1194,13 @@ var Dt = {
|
|
|
1194
1194
|
switch (i) {
|
|
1195
1195
|
case "number":
|
|
1196
1196
|
if (a === "number") {
|
|
1197
|
-
if (r === 0) throw new
|
|
1197
|
+
if (r === 0) throw new et("%s (%*<100v) cannot be divided by zero (remainder)", i, n);
|
|
1198
1198
|
return n % r;
|
|
1199
1199
|
}
|
|
1200
1200
|
break;
|
|
1201
1201
|
default:
|
|
1202
1202
|
}
|
|
1203
|
-
throw new
|
|
1203
|
+
throw new j("%s (%*<100v) cannot be divided by %s (%*<100v) (remainder)", i, n, a, r);
|
|
1204
1204
|
})));
|
|
1205
1205
|
},
|
|
1206
1206
|
map(e, t) {
|
|
@@ -1233,7 +1233,7 @@ var Dt = {
|
|
|
1233
1233
|
break;
|
|
1234
1234
|
default:
|
|
1235
1235
|
}
|
|
1236
|
-
throw new
|
|
1236
|
+
throw new j("%s (%*<100v) and %s (%*<100v) cannot be subtracted", a, n, o, r);
|
|
1237
1237
|
})));
|
|
1238
1238
|
},
|
|
1239
1239
|
map(e, t) {
|
|
@@ -1432,7 +1432,7 @@ var Dt = {
|
|
|
1432
1432
|
case "number": return -t;
|
|
1433
1433
|
default:
|
|
1434
1434
|
}
|
|
1435
|
-
throw new
|
|
1435
|
+
throw new j("%s (%*<100v) cannot be negated", n, t);
|
|
1436
1436
|
}), r);
|
|
1437
1437
|
},
|
|
1438
1438
|
map(e, t) {
|
|
@@ -1484,7 +1484,7 @@ var Dt = {
|
|
|
1484
1484
|
default:
|
|
1485
1485
|
}
|
|
1486
1486
|
if (n.optional) return [];
|
|
1487
|
-
throw new
|
|
1487
|
+
throw new j("cannot use %s (%*<100v) as object key", i, t);
|
|
1488
1488
|
});
|
|
1489
1489
|
});
|
|
1490
1490
|
return e.muxAll(a, (...e) => i(Object.fromEntries(e), r));
|
|
@@ -1552,7 +1552,7 @@ var Dt = {
|
|
|
1552
1552
|
},
|
|
1553
1553
|
var: {
|
|
1554
1554
|
op(e, t, n, r, i) {
|
|
1555
|
-
if (!Object.hasOwn(r.vars, n.name ?? "")) throw new
|
|
1555
|
+
if (!Object.hasOwn(r.vars, n.name ?? "")) throw new $e("%s is not defined", n.name ?? "");
|
|
1556
1556
|
return i(r.vars[n.name ?? ""], r);
|
|
1557
1557
|
},
|
|
1558
1558
|
map(e, t) {
|
|
@@ -1579,10 +1579,10 @@ var Dt = {
|
|
|
1579
1579
|
}
|
|
1580
1580
|
}
|
|
1581
1581
|
}, tn = {};
|
|
1582
|
-
function
|
|
1582
|
+
function z(e = {}, t = {}) {
|
|
1583
1583
|
return r(e, t);
|
|
1584
1584
|
}
|
|
1585
|
-
function
|
|
1585
|
+
function nn(e) {
|
|
1586
1586
|
let t = e?.version, [, n, r] = typeof t == "string" ? /^(\d+)\.(\d+)?$/g.exec(t) ?? [] : [];
|
|
1587
1587
|
if (!n || !r || !Array.isArray(e.instructions)) throw new y("invalid program definition");
|
|
1588
1588
|
if (+n != 1 || +r > 0) throw new y(`unsupported program definition v${n}.${r} - this version of JPL only supports v1 (up to v${m})`);
|
|
@@ -1593,7 +1593,7 @@ var rn = class e {
|
|
|
1593
1593
|
#n;
|
|
1594
1594
|
#r;
|
|
1595
1595
|
constructor(e, t) {
|
|
1596
|
-
|
|
1596
|
+
nn(e), this.#e = z(t?.program, tn), this.#t = t?.runtime, this.#n = e, this.#r = en;
|
|
1597
1597
|
}
|
|
1598
1598
|
get options() {
|
|
1599
1599
|
return this.#e;
|
|
@@ -1605,17 +1605,17 @@ var rn = class e {
|
|
|
1605
1605
|
return this.#r;
|
|
1606
1606
|
}
|
|
1607
1607
|
run = async (e, t) => {
|
|
1608
|
-
let n = new
|
|
1608
|
+
let n = new mt(this, { runtime: N(t?.runtime, this.#t) }), r = n.normalizeValues(e, "program inputs"), i = await n.execute(r);
|
|
1609
1609
|
return n.stripJSON(i);
|
|
1610
1610
|
};
|
|
1611
|
-
prepend = (t) => (
|
|
1611
|
+
prepend = (t) => (nn(t), new e({
|
|
1612
1612
|
version: m,
|
|
1613
1613
|
instructions: [...t.instructions, ...this.definition.instructions]
|
|
1614
1614
|
}, {
|
|
1615
1615
|
program: this.#e,
|
|
1616
1616
|
runtime: this.#t
|
|
1617
1617
|
}));
|
|
1618
|
-
append = (t) => (
|
|
1618
|
+
append = (t) => (nn(t), new e({
|
|
1619
1619
|
version: m,
|
|
1620
1620
|
instructions: [...this.definition.instructions, ...t.instructions]
|
|
1621
1621
|
}, {
|
|
@@ -2335,7 +2335,7 @@ async function J(e, t, n) {
|
|
|
2335
2335
|
let r = t, i = [];
|
|
2336
2336
|
for (;;) {
|
|
2337
2337
|
let t;
|
|
2338
|
-
({i: r, ops: t} = await
|
|
2338
|
+
({i: r, ops: t} = await Tn(e, r, n)), i.push(...t);
|
|
2339
2339
|
let a = H(e, r, n, {
|
|
2340
2340
|
phrase: "|",
|
|
2341
2341
|
notBeforeSet: "="
|
|
@@ -2349,13 +2349,13 @@ async function J(e, t, n) {
|
|
|
2349
2349
|
};
|
|
2350
2350
|
}
|
|
2351
2351
|
async function Y(e, t, n) {
|
|
2352
|
-
return await void 0,
|
|
2352
|
+
return await void 0, Tn(e, t, n);
|
|
2353
2353
|
}
|
|
2354
2354
|
async function wn(e, t, n) {
|
|
2355
2355
|
let r = t, i = [];
|
|
2356
2356
|
for (;;) {
|
|
2357
2357
|
let t;
|
|
2358
|
-
({i: r, ops: t} = await
|
|
2358
|
+
({i: r, ops: t} = await Tn(e, r, n)), i.push(t);
|
|
2359
2359
|
let a = H(e, r, n, { phrase: "," });
|
|
2360
2360
|
if (!a.is) break;
|
|
2361
2361
|
({i: r} = a);
|
|
@@ -2371,21 +2371,21 @@ async function wn(e, t, n) {
|
|
|
2371
2371
|
}]
|
|
2372
2372
|
};
|
|
2373
2373
|
}
|
|
2374
|
-
async function
|
|
2374
|
+
async function Tn(e, t, n) {
|
|
2375
2375
|
let r = t, i = H(e, r, n, {
|
|
2376
2376
|
phrase: "try",
|
|
2377
2377
|
spaceAfter: !0
|
|
2378
2378
|
});
|
|
2379
|
-
if (!i.is) return
|
|
2379
|
+
if (!i.is) return En(e, r, n);
|
|
2380
2380
|
({i: r} = i);
|
|
2381
2381
|
let a;
|
|
2382
|
-
({i: r, ops: a} = await
|
|
2382
|
+
({i: r, ops: a} = await En(e, r, n));
|
|
2383
2383
|
let o;
|
|
2384
2384
|
return i = H(e, r, n, {
|
|
2385
2385
|
spaceBefore: !0,
|
|
2386
2386
|
phrase: "catch",
|
|
2387
2387
|
spaceAfter: !0
|
|
2388
|
-
}), i.is ? ({i: r} = i, {i: r, ops: o} = await
|
|
2388
|
+
}), i.is ? ({i: r} = i, {i: r, ops: o} = await En(e, r, n)) : o = [{
|
|
2389
2389
|
op: "vod",
|
|
2390
2390
|
params: {}
|
|
2391
2391
|
}], {
|
|
@@ -2399,11 +2399,11 @@ async function X(e, t, n) {
|
|
|
2399
2399
|
}]
|
|
2400
2400
|
};
|
|
2401
2401
|
}
|
|
2402
|
-
async function
|
|
2402
|
+
async function En(e, t, n) {
|
|
2403
2403
|
let r = t, i = [];
|
|
2404
2404
|
for (;;) {
|
|
2405
2405
|
let t;
|
|
2406
|
-
({i: r, ops: t} = await
|
|
2406
|
+
({i: r, ops: t} = await Dn(e, r, n)), i.push(t);
|
|
2407
2407
|
let a = H(e, r, n, {
|
|
2408
2408
|
spaceBefore: !0,
|
|
2409
2409
|
phrase: "or",
|
|
@@ -2423,11 +2423,11 @@ async function Tn(e, t, n) {
|
|
|
2423
2423
|
}]
|
|
2424
2424
|
};
|
|
2425
2425
|
}
|
|
2426
|
-
async function
|
|
2426
|
+
async function Dn(e, t, n) {
|
|
2427
2427
|
let r = t, i = [];
|
|
2428
2428
|
for (;;) {
|
|
2429
2429
|
let t;
|
|
2430
|
-
({i: r, ops: t} = await
|
|
2430
|
+
({i: r, ops: t} = await On(e, r, n)), i.push(t);
|
|
2431
2431
|
let a = H(e, r, n, {
|
|
2432
2432
|
spaceBefore: !0,
|
|
2433
2433
|
phrase: "and",
|
|
@@ -2447,16 +2447,16 @@ async function En(e, t, n) {
|
|
|
2447
2447
|
}]
|
|
2448
2448
|
};
|
|
2449
2449
|
}
|
|
2450
|
-
async function
|
|
2450
|
+
async function On(e, t, n) {
|
|
2451
2451
|
let r = t, i;
|
|
2452
|
-
({i: r, ops: i} = await
|
|
2452
|
+
({i: r, ops: i} = await kn(e, r, n));
|
|
2453
2453
|
let a = [];
|
|
2454
2454
|
for (;;) {
|
|
2455
2455
|
let t = H(e, r, n, { phrase: "==" });
|
|
2456
2456
|
if (t.is) {
|
|
2457
2457
|
({i: r} = t);
|
|
2458
2458
|
let i;
|
|
2459
|
-
({i: r, ops: i} = await
|
|
2459
|
+
({i: r, ops: i} = await kn(e, r, n)), a.push({
|
|
2460
2460
|
op: "==",
|
|
2461
2461
|
params: { by: i }
|
|
2462
2462
|
});
|
|
@@ -2465,7 +2465,7 @@ async function Dn(e, t, n) {
|
|
|
2465
2465
|
if (t = H(e, r, n, { phrase: "!=" }), t.is) {
|
|
2466
2466
|
({i: r} = t);
|
|
2467
2467
|
let i;
|
|
2468
|
-
({i: r, ops: i} = await
|
|
2468
|
+
({i: r, ops: i} = await kn(e, r, n)), a.push({
|
|
2469
2469
|
op: "!=",
|
|
2470
2470
|
params: { by: i }
|
|
2471
2471
|
});
|
|
@@ -2487,16 +2487,16 @@ async function Dn(e, t, n) {
|
|
|
2487
2487
|
}]
|
|
2488
2488
|
};
|
|
2489
2489
|
}
|
|
2490
|
-
async function
|
|
2490
|
+
async function kn(e, t, n) {
|
|
2491
2491
|
let r = t, i;
|
|
2492
|
-
({i: r, ops: i} = await
|
|
2492
|
+
({i: r, ops: i} = await X(e, r, n));
|
|
2493
2493
|
let a = [];
|
|
2494
2494
|
for (;;) {
|
|
2495
2495
|
let t = H(e, r, n, { phrase: "<=" });
|
|
2496
2496
|
if (t.is) {
|
|
2497
2497
|
({i: r} = t);
|
|
2498
2498
|
let i;
|
|
2499
|
-
({i: r, ops: i} = await
|
|
2499
|
+
({i: r, ops: i} = await X(e, r, n)), a.push({
|
|
2500
2500
|
op: "<=",
|
|
2501
2501
|
params: { by: i }
|
|
2502
2502
|
});
|
|
@@ -2505,7 +2505,7 @@ async function On(e, t, n) {
|
|
|
2505
2505
|
if (t = H(e, r, n, { phrase: "<" }), t.is) {
|
|
2506
2506
|
({i: r} = t);
|
|
2507
2507
|
let i;
|
|
2508
|
-
({i: r, ops: i} = await
|
|
2508
|
+
({i: r, ops: i} = await X(e, r, n)), a.push({
|
|
2509
2509
|
op: "<",
|
|
2510
2510
|
params: { by: i }
|
|
2511
2511
|
});
|
|
@@ -2514,7 +2514,7 @@ async function On(e, t, n) {
|
|
|
2514
2514
|
if (t = H(e, r, n, { phrase: ">=" }), t.is) {
|
|
2515
2515
|
({i: r} = t);
|
|
2516
2516
|
let i;
|
|
2517
|
-
({i: r, ops: i} = await
|
|
2517
|
+
({i: r, ops: i} = await X(e, r, n)), a.push({
|
|
2518
2518
|
op: ">=",
|
|
2519
2519
|
params: { by: i }
|
|
2520
2520
|
});
|
|
@@ -2523,7 +2523,7 @@ async function On(e, t, n) {
|
|
|
2523
2523
|
if (t = H(e, r, n, { phrase: ">" }), t.is) {
|
|
2524
2524
|
({i: r} = t);
|
|
2525
2525
|
let i;
|
|
2526
|
-
({i: r, ops: i} = await
|
|
2526
|
+
({i: r, ops: i} = await X(e, r, n)), a.push({
|
|
2527
2527
|
op: ">",
|
|
2528
2528
|
params: { by: i }
|
|
2529
2529
|
});
|
|
@@ -2545,15 +2545,15 @@ async function On(e, t, n) {
|
|
|
2545
2545
|
}]
|
|
2546
2546
|
};
|
|
2547
2547
|
}
|
|
2548
|
-
async function
|
|
2548
|
+
async function X(e, t, n) {
|
|
2549
2549
|
let r = t, i = H(e, r, n, {
|
|
2550
2550
|
phrase: "not",
|
|
2551
2551
|
spaceAfter: !0
|
|
2552
2552
|
});
|
|
2553
|
-
if (!i.is) return
|
|
2553
|
+
if (!i.is) return An(e, r, n);
|
|
2554
2554
|
({i: r} = i);
|
|
2555
2555
|
let a;
|
|
2556
|
-
return {i: r, ops: a} = await
|
|
2556
|
+
return {i: r, ops: a} = await An(e, r, n), {
|
|
2557
2557
|
i: r,
|
|
2558
2558
|
ops: [...a, {
|
|
2559
2559
|
op: "not",
|
|
@@ -2561,8 +2561,8 @@ async function Z(e, t, n) {
|
|
|
2561
2561
|
}]
|
|
2562
2562
|
};
|
|
2563
2563
|
}
|
|
2564
|
-
async function
|
|
2565
|
-
let r = t, i = await
|
|
2564
|
+
async function An(e, t, n) {
|
|
2565
|
+
let r = t, i = await jn(e, r, n);
|
|
2566
2566
|
({i: r} = i);
|
|
2567
2567
|
let a = H(e, r, n, {
|
|
2568
2568
|
phrase: "?",
|
|
@@ -2582,9 +2582,9 @@ async function kn(e, t, n) {
|
|
|
2582
2582
|
}]
|
|
2583
2583
|
}) : i;
|
|
2584
2584
|
}
|
|
2585
|
-
async function
|
|
2585
|
+
async function jn(e, t, n) {
|
|
2586
2586
|
let r = t, i;
|
|
2587
|
-
({i: r, ops: i} = await
|
|
2587
|
+
({i: r, ops: i} = await Z(e, r, n));
|
|
2588
2588
|
let a = [];
|
|
2589
2589
|
for (;;) {
|
|
2590
2590
|
let t = H(e, r, n, {
|
|
@@ -2594,7 +2594,7 @@ async function An(e, t, n) {
|
|
|
2594
2594
|
if (t.is) {
|
|
2595
2595
|
({i: r} = t);
|
|
2596
2596
|
let i;
|
|
2597
|
-
({i: r, ops: i} = await
|
|
2597
|
+
({i: r, ops: i} = await Z(e, r, n)), a.push({
|
|
2598
2598
|
op: "+",
|
|
2599
2599
|
params: { by: i }
|
|
2600
2600
|
});
|
|
@@ -2606,7 +2606,7 @@ async function An(e, t, n) {
|
|
|
2606
2606
|
}), t.is) {
|
|
2607
2607
|
({i: r} = t);
|
|
2608
2608
|
let i;
|
|
2609
|
-
({i: r, ops: i} = await
|
|
2609
|
+
({i: r, ops: i} = await Z(e, r, n)), a.push({
|
|
2610
2610
|
op: "-",
|
|
2611
2611
|
params: { by: i }
|
|
2612
2612
|
});
|
|
@@ -2628,7 +2628,7 @@ async function An(e, t, n) {
|
|
|
2628
2628
|
}]
|
|
2629
2629
|
};
|
|
2630
2630
|
}
|
|
2631
|
-
async function
|
|
2631
|
+
async function Z(e, t, n) {
|
|
2632
2632
|
let r = t, i;
|
|
2633
2633
|
({i: r, ops: i} = await Q(e, r, n));
|
|
2634
2634
|
let a = [];
|
|
@@ -3173,8 +3173,8 @@ var Kn = class {
|
|
|
3173
3173
|
version: m,
|
|
3174
3174
|
instructions: await this.parseInstructions(e)
|
|
3175
3175
|
}, {
|
|
3176
|
-
program:
|
|
3177
|
-
runtime:
|
|
3176
|
+
program: z(t?.program, this.#t),
|
|
3177
|
+
runtime: N(t?.runtime, this.#n)
|
|
3178
3178
|
});
|
|
3179
3179
|
parseInstructions = async (e) => {
|
|
3180
3180
|
let { ops: t } = await _n(e, 0, { interpreter: this });
|
|
@@ -3193,7 +3193,7 @@ function Xn(e, t, n, r, i) {
|
|
|
3193
3193
|
case "object": return n(Object.values(a).some((t) => e.equals(t, s)));
|
|
3194
3194
|
default:
|
|
3195
3195
|
}
|
|
3196
|
-
throw new
|
|
3196
|
+
throw new j("%s (%*<100v) cannot contain %s (%*<100v)", o, a, c, s);
|
|
3197
3197
|
}
|
|
3198
3198
|
//#endregion
|
|
3199
3199
|
//#region lib/builtins/funcEndsWith.ts
|
|
@@ -3205,12 +3205,12 @@ function Zn(e, t, n, r, i) {
|
|
|
3205
3205
|
break;
|
|
3206
3206
|
default:
|
|
3207
3207
|
}
|
|
3208
|
-
throw new
|
|
3208
|
+
throw new j("%s (%*<100v) cannot end with %s (%*<100v)", o, a, c, s);
|
|
3209
3209
|
}
|
|
3210
3210
|
//#endregion
|
|
3211
3211
|
//#region lib/builtins/funcError.ts
|
|
3212
3212
|
function Qn(e, t, n, r) {
|
|
3213
|
-
throw new
|
|
3213
|
+
throw new A(r);
|
|
3214
3214
|
}
|
|
3215
3215
|
//#endregion
|
|
3216
3216
|
//#region lib/builtins/funcFromJSON.ts
|
|
@@ -3222,13 +3222,13 @@ function $n(e, t, n, r) {
|
|
|
3222
3222
|
try {
|
|
3223
3223
|
e = JSON.parse(i);
|
|
3224
3224
|
} catch (e) {
|
|
3225
|
-
throw new
|
|
3225
|
+
throw new A(e.message);
|
|
3226
3226
|
}
|
|
3227
3227
|
return n(e);
|
|
3228
3228
|
}
|
|
3229
3229
|
default:
|
|
3230
3230
|
}
|
|
3231
|
-
throw new
|
|
3231
|
+
throw new j("%s (%*<100v) cannot be parsed as JSON", a, i);
|
|
3232
3232
|
}
|
|
3233
3233
|
//#endregion
|
|
3234
3234
|
//#region lib/builtins/funcHas.ts
|
|
@@ -3243,7 +3243,7 @@ function er(e, t, n, r, i) {
|
|
|
3243
3243
|
break;
|
|
3244
3244
|
default:
|
|
3245
3245
|
}
|
|
3246
|
-
throw new
|
|
3246
|
+
throw new j("%s (%*<100v) cannot have %s (%*<100v) as key", o, a, c, s);
|
|
3247
3247
|
}
|
|
3248
3248
|
//#endregion
|
|
3249
3249
|
//#region lib/builtins/funcIn.ts
|
|
@@ -3258,7 +3258,7 @@ function tr(e, t, n, r, i) {
|
|
|
3258
3258
|
break;
|
|
3259
3259
|
default:
|
|
3260
3260
|
}
|
|
3261
|
-
throw new
|
|
3261
|
+
throw new j("%s (%*<100v) cannot have %s (%*<100v) as key", c, s, o, a);
|
|
3262
3262
|
}
|
|
3263
3263
|
//#endregion
|
|
3264
3264
|
//#region lib/builtins/funcKeys.ts
|
|
@@ -3269,7 +3269,7 @@ function nr(e, t, n, r) {
|
|
|
3269
3269
|
case "object": return n(Object.keys(i));
|
|
3270
3270
|
default:
|
|
3271
3271
|
}
|
|
3272
|
-
throw new
|
|
3272
|
+
throw new j("%s (%*<100v) has no keys", a, i);
|
|
3273
3273
|
}
|
|
3274
3274
|
//#endregion
|
|
3275
3275
|
//#region lib/builtins/funcLength.ts
|
|
@@ -3282,7 +3282,7 @@ function rr(e, t, n, r) {
|
|
|
3282
3282
|
case "object": return n(Object.keys(i).length);
|
|
3283
3283
|
default:
|
|
3284
3284
|
}
|
|
3285
|
-
throw new
|
|
3285
|
+
throw new j("%s (%*<100v) has no length", a, i);
|
|
3286
3286
|
}
|
|
3287
3287
|
//#endregion
|
|
3288
3288
|
//#region lib/builtins/funcNow.ts
|
|
@@ -3299,7 +3299,7 @@ function ar(e, t, n, r, i) {
|
|
|
3299
3299
|
break;
|
|
3300
3300
|
default:
|
|
3301
3301
|
}
|
|
3302
|
-
throw new
|
|
3302
|
+
throw new j("%s (%*<100v) cannot start with %s (%*<100v)", o, a, c, s);
|
|
3303
3303
|
}
|
|
3304
3304
|
//#endregion
|
|
3305
3305
|
//#region lib/builtins/funcToJSON.ts
|
|
@@ -3314,7 +3314,7 @@ async function sr(e, t, n, r) {
|
|
|
3314
3314
|
case "string": return n(await e.alterValue(r, (e) => e.toLowerCase()));
|
|
3315
3315
|
default:
|
|
3316
3316
|
}
|
|
3317
|
-
throw new
|
|
3317
|
+
throw new j("%s (%*<100v) cannot be converted to lower case", i, e.unwrapValue(r));
|
|
3318
3318
|
}
|
|
3319
3319
|
//#endregion
|
|
3320
3320
|
//#region lib/builtins/funcToNumber.ts
|
|
@@ -3329,7 +3329,7 @@ function cr(e, t, n, r) {
|
|
|
3329
3329
|
}
|
|
3330
3330
|
default:
|
|
3331
3331
|
}
|
|
3332
|
-
throw new
|
|
3332
|
+
throw new j("%s (%*<100v) cannot be parsed as a number", a, i);
|
|
3333
3333
|
}
|
|
3334
3334
|
//#endregion
|
|
3335
3335
|
//#region lib/builtins/funcToString.ts
|
|
@@ -3344,7 +3344,7 @@ async function ur(e, t, n, r) {
|
|
|
3344
3344
|
case "string": return n(await e.alterValue(r, (e) => e.toUpperCase()));
|
|
3345
3345
|
default:
|
|
3346
3346
|
}
|
|
3347
|
-
throw new
|
|
3347
|
+
throw new j("%s (%*<100v) cannot be converted to upper case", i, e.unwrapValue(r));
|
|
3348
3348
|
}
|
|
3349
3349
|
//#endregion
|
|
3350
3350
|
//#region lib/builtins/funcTrim.ts
|
|
@@ -3354,7 +3354,7 @@ async function dr(e, t, n, r) {
|
|
|
3354
3354
|
case "string": return n(await e.alterValue(r, (e) => e.trim()));
|
|
3355
3355
|
default:
|
|
3356
3356
|
}
|
|
3357
|
-
throw new
|
|
3357
|
+
throw new j("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
|
|
3358
3358
|
}
|
|
3359
3359
|
//#endregion
|
|
3360
3360
|
//#region lib/builtins/funcTrimEnd.ts
|
|
@@ -3364,7 +3364,7 @@ async function fr(e, t, n, r) {
|
|
|
3364
3364
|
case "string": return n(await e.alterValue(r, (e) => e.trimEnd()));
|
|
3365
3365
|
default:
|
|
3366
3366
|
}
|
|
3367
|
-
throw new
|
|
3367
|
+
throw new j("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
|
|
3368
3368
|
}
|
|
3369
3369
|
//#endregion
|
|
3370
3370
|
//#region lib/builtins/funcTrimStart.ts
|
|
@@ -3374,7 +3374,7 @@ async function pr(e, t, n, r) {
|
|
|
3374
3374
|
case "string": return n(await e.alterValue(r, (e) => e.trimStart()));
|
|
3375
3375
|
default:
|
|
3376
3376
|
}
|
|
3377
|
-
throw new
|
|
3377
|
+
throw new j("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
|
|
3378
3378
|
}
|
|
3379
3379
|
//#endregion
|
|
3380
3380
|
//#region lib/builtins/funcType.ts
|
|
@@ -3390,13 +3390,13 @@ function hr(e, t, n, r) {
|
|
|
3390
3390
|
//#region lib/builtins/math.ts
|
|
3391
3391
|
function gr(e, t) {
|
|
3392
3392
|
let n = e.type(t), r = e.unwrapValue(t);
|
|
3393
|
-
if (n !== "number") throw new
|
|
3393
|
+
if (n !== "number") throw new j("%s (%*<100v) cannot be used for mathematical operations", n, r);
|
|
3394
3394
|
return r;
|
|
3395
3395
|
}
|
|
3396
3396
|
function $(e) {
|
|
3397
3397
|
return async function(t, n, r, i, ...a) {
|
|
3398
3398
|
let o = t.type(i);
|
|
3399
|
-
if (o !== "number") throw new
|
|
3399
|
+
if (o !== "number") throw new j("%s (%*<100v) cannot be used for mathematical operations", o, t.unwrapValue(i));
|
|
3400
3400
|
return r(await t.alterValue(i, (n) => e(t, n, ...a)));
|
|
3401
3401
|
};
|
|
3402
3402
|
}
|
|
@@ -3466,9 +3466,9 @@ var Lr = n(async () => ({
|
|
|
3466
3466
|
let n = await Lr();
|
|
3467
3467
|
return new Kn({
|
|
3468
3468
|
interpreter: Gn(t?.interpreter, n.interpreter),
|
|
3469
|
-
program:
|
|
3470
|
-
runtime:
|
|
3469
|
+
program: z(t?.program, n.program),
|
|
3470
|
+
runtime: N(t?.runtime, n.runtime)
|
|
3471
3471
|
}).parse(e);
|
|
3472
3472
|
}, zr = async (e, t, n) => (await Rr(e, n)).run(t);
|
|
3473
3473
|
//#endregion
|
|
3474
|
-
export { m as DEFINITION_VERSION, Ve as DEFINITION_VERSION_MAJOR, He as DEFINITION_VERSION_MINOR, h as JPLError, v as JPLErrorEnclosure, g as JPLExecutionError, y as JPLFatalError,
|
|
3474
|
+
export { m as DEFINITION_VERSION, Ve as DEFINITION_VERSION_MAJOR, He as DEFINITION_VERSION_MINOR, h as JPLError, v as JPLErrorEnclosure, g as JPLExecutionError, y as JPLFatalError, $e as JPLReferenceError, A as JPLRuntimeError, it as JPLRuntimeScope, rt as JPLRuntimeSignal, nt as JPLSyntaxError, b as JPLType, tt as JPLTypeConversionError, j as JPLTypeError, et as JPLZeroDivisionError, ve as OPA_FIELD, ye as OPA_FUNCTION, be as OPA_ITER, xe as OPA_SLICE, Se as OPC_EQUAL, Ce as OPC_GREATER, we as OPC_GREATEREQUAL, Te as OPC_LESS, Ee as OPC_LESSEQUAL, De as OPC_UNEQUAL, Oe as OPM_ADDITION, ke as OPM_DIVISION, Ae as OPM_MULTIPLICATION, je as OPM_REMAINDER, Me as OPM_SUBTRACTION, Ne as OPU_ADDITION, Pe as OPU_DIVISION, Fe as OPU_MULTIPLICATION, Ie as OPU_NULL_COALESCENCE, Le as OPU_REMAINDER, Re as OPU_SET, ze as OPU_SUBTRACTION, Be as OPU_UPDATE, s as OP_ACCESS, c as OP_AND, l as OP_ARRAY_CONSTRUCTOR, u as OP_ASSIGNMENT, d as OP_CALCULATION, f as OP_COMPARISON, p as OP_CONSTANT, ee as OP_CONSTANT_FALSE, te as OP_CONSTANT_NULL, ne as OP_CONSTANT_TRUE, re as OP_FUNCTION_DEFINITION, ie as OP_IF, ae as OP_INTERPOLATED_STRING, oe as OP_NEGATION, se as OP_NOT, ce as OP_NULL_COALESCENCE, le as OP_NUMBER, ue as OP_OBJECT_CONSTRUCTOR, de as OP_OR, fe as OP_OUTPUT_CONCAT, pe as OP_STRING, me as OP_TRY, he as OP_VARIABLE, ge as OP_VARIABLE_DEFINITION, _e as OP_VOID, _ as adaptError, Ue as adaptErrors, We as adaptErrorsAsync, a as applyArray, o as applyCombinations, i as applyObject, qe as assertType, E as displayValue, Fr as getBuiltins, Lr as getOptions, Ze as jplJSONStripper, Xe as jplStripper, Ye as jplTypedStripper, Qe as jsonStripper, ft as mergeSegments, lt as mux, dt as muxAll, ut as muxAsync, M as muxOne, ct as nativeFunction, x as normalize, st as orphanFunction, Rr as parse, Ir as parseFunction, O as rawStripper, zr as run, ot as scopedFunction, Je as strictDisplayValue, w as stringify, D as strip, T as template, C as typeOf, Ke as typeOrder, S as unwrap };
|