@bonsae/nrg 0.18.3 → 0.18.5
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/README.md +38 -45
- package/package.json +1 -1
- package/server/index.cjs +10 -1
- package/server/resources/nrg-client.js +502 -499
- package/test/client/e2e/index.js +30 -3
- package/vite/index.js +34 -7
|
@@ -29,8 +29,8 @@ function Cs() {
|
|
|
29
29
|
if (b = n(g[v++]), u = E > v, typeof m[b] > "u" && (Array.isArray(m) && b === "-" && (b = m.length), u && (g[v] !== "" && g[v] < 1 / 0 || g[v] === "-" ? m[b] = [] : m[b] = {})), !u) break;
|
|
30
30
|
m = m[b];
|
|
31
31
|
}
|
|
32
|
-
var
|
|
33
|
-
return N === void 0 ? delete m[b] : m[b] = N,
|
|
32
|
+
var l = m[b];
|
|
33
|
+
return N === void 0 ? delete m[b] : m[b] = N, l;
|
|
34
34
|
}
|
|
35
35
|
function a(m) {
|
|
36
36
|
if (typeof m == "string") {
|
|
@@ -191,10 +191,10 @@ function Je() {
|
|
|
191
191
|
throw new Error(`CodeGen: invalid export name: ${y}, use explicit $id name mapping`);
|
|
192
192
|
}
|
|
193
193
|
e.getEsmExportName = E;
|
|
194
|
-
function
|
|
194
|
+
function l(y) {
|
|
195
195
|
return new n(y.toString());
|
|
196
196
|
}
|
|
197
|
-
e.regexpCode =
|
|
197
|
+
e.regexpCode = l;
|
|
198
198
|
})(Zt)), Zt;
|
|
199
199
|
}
|
|
200
200
|
var Qt = {}, Er;
|
|
@@ -270,8 +270,8 @@ function Sr() {
|
|
|
270
270
|
} else
|
|
271
271
|
E = this._values[u] = /* @__PURE__ */ new Map();
|
|
272
272
|
E.set(v, b);
|
|
273
|
-
const
|
|
274
|
-
return
|
|
273
|
+
const l = this._scope[u] || (this._scope[u] = []), y = l.length;
|
|
274
|
+
return l[y] = g.ref, b.setValue(g, { property: u, itemIndex: y }), b;
|
|
275
275
|
}
|
|
276
276
|
getValue(m, g) {
|
|
277
277
|
const N = this._values[m];
|
|
@@ -298,11 +298,11 @@ function Sr() {
|
|
|
298
298
|
const E = m[v];
|
|
299
299
|
if (!E)
|
|
300
300
|
continue;
|
|
301
|
-
const
|
|
301
|
+
const l = N[v] = N[v] || /* @__PURE__ */ new Map();
|
|
302
302
|
E.forEach((y) => {
|
|
303
|
-
if (
|
|
303
|
+
if (l.has(y))
|
|
304
304
|
return;
|
|
305
|
-
|
|
305
|
+
l.set(y, n.Started);
|
|
306
306
|
let s = g(y);
|
|
307
307
|
if (s) {
|
|
308
308
|
const p = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
@@ -311,7 +311,7 @@ function Sr() {
|
|
|
311
311
|
u = (0, t._)`${u}${s}${this.opts._n}`;
|
|
312
312
|
else
|
|
313
313
|
throw new r(y);
|
|
314
|
-
|
|
314
|
+
l.set(y, n.Completed);
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
return u;
|
|
@@ -368,164 +368,164 @@ function Y() {
|
|
|
368
368
|
optimizeNodes() {
|
|
369
369
|
return this;
|
|
370
370
|
}
|
|
371
|
-
optimizeNames(
|
|
371
|
+
optimizeNames(f, S) {
|
|
372
372
|
return this;
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
class o extends a {
|
|
376
|
-
constructor(
|
|
377
|
-
super(), this.varKind =
|
|
376
|
+
constructor(f, S, q) {
|
|
377
|
+
super(), this.varKind = f, this.name = S, this.rhs = q;
|
|
378
378
|
}
|
|
379
|
-
render({ es5:
|
|
380
|
-
const q =
|
|
379
|
+
render({ es5: f, _n: S }) {
|
|
380
|
+
const q = f ? r.varKinds.var : this.varKind, F = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
381
381
|
return `${q} ${this.name}${F};` + S;
|
|
382
382
|
}
|
|
383
|
-
optimizeNames(
|
|
384
|
-
if (
|
|
385
|
-
return this.rhs && (this.rhs = B(this.rhs,
|
|
383
|
+
optimizeNames(f, S) {
|
|
384
|
+
if (f[this.name.str])
|
|
385
|
+
return this.rhs && (this.rhs = B(this.rhs, f, S)), this;
|
|
386
386
|
}
|
|
387
387
|
get names() {
|
|
388
388
|
return this.rhs instanceof t._CodeOrName ? this.rhs.names : {};
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
class i extends a {
|
|
392
|
-
constructor(
|
|
393
|
-
super(), this.lhs =
|
|
392
|
+
constructor(f, S, q) {
|
|
393
|
+
super(), this.lhs = f, this.rhs = S, this.sideEffects = q;
|
|
394
394
|
}
|
|
395
|
-
render({ _n:
|
|
396
|
-
return `${this.lhs} = ${this.rhs};` +
|
|
395
|
+
render({ _n: f }) {
|
|
396
|
+
return `${this.lhs} = ${this.rhs};` + f;
|
|
397
397
|
}
|
|
398
|
-
optimizeNames(
|
|
399
|
-
if (!(this.lhs instanceof t.Name && !
|
|
400
|
-
return this.rhs = B(this.rhs,
|
|
398
|
+
optimizeNames(f, S) {
|
|
399
|
+
if (!(this.lhs instanceof t.Name && !f[this.lhs.str] && !this.sideEffects))
|
|
400
|
+
return this.rhs = B(this.rhs, f, S), this;
|
|
401
401
|
}
|
|
402
402
|
get names() {
|
|
403
|
-
const
|
|
404
|
-
return K(
|
|
403
|
+
const f = this.lhs instanceof t.Name ? {} : { ...this.lhs.names };
|
|
404
|
+
return K(f, this.rhs);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
class h extends i {
|
|
408
|
-
constructor(
|
|
409
|
-
super(
|
|
408
|
+
constructor(f, S, q, F) {
|
|
409
|
+
super(f, q, F), this.op = S;
|
|
410
410
|
}
|
|
411
|
-
render({ _n:
|
|
412
|
-
return `${this.lhs} ${this.op}= ${this.rhs};` +
|
|
411
|
+
render({ _n: f }) {
|
|
412
|
+
return `${this.lhs} ${this.op}= ${this.rhs};` + f;
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
class m extends a {
|
|
416
|
-
constructor(
|
|
417
|
-
super(), this.label =
|
|
416
|
+
constructor(f) {
|
|
417
|
+
super(), this.label = f, this.names = {};
|
|
418
418
|
}
|
|
419
|
-
render({ _n:
|
|
420
|
-
return `${this.label}:` +
|
|
419
|
+
render({ _n: f }) {
|
|
420
|
+
return `${this.label}:` + f;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
class g extends a {
|
|
424
|
-
constructor(
|
|
425
|
-
super(), this.label =
|
|
424
|
+
constructor(f) {
|
|
425
|
+
super(), this.label = f, this.names = {};
|
|
426
426
|
}
|
|
427
|
-
render({ _n:
|
|
428
|
-
return `break${this.label ? ` ${this.label}` : ""};` +
|
|
427
|
+
render({ _n: f }) {
|
|
428
|
+
return `break${this.label ? ` ${this.label}` : ""};` + f;
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
class N extends a {
|
|
432
|
-
constructor(
|
|
433
|
-
super(), this.error =
|
|
432
|
+
constructor(f) {
|
|
433
|
+
super(), this.error = f;
|
|
434
434
|
}
|
|
435
|
-
render({ _n:
|
|
436
|
-
return `throw ${this.error};` +
|
|
435
|
+
render({ _n: f }) {
|
|
436
|
+
return `throw ${this.error};` + f;
|
|
437
437
|
}
|
|
438
438
|
get names() {
|
|
439
439
|
return this.error.names;
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
class b extends a {
|
|
443
|
-
constructor(
|
|
444
|
-
super(), this.code =
|
|
443
|
+
constructor(f) {
|
|
444
|
+
super(), this.code = f;
|
|
445
445
|
}
|
|
446
|
-
render({ _n:
|
|
447
|
-
return `${this.code};` +
|
|
446
|
+
render({ _n: f }) {
|
|
447
|
+
return `${this.code};` + f;
|
|
448
448
|
}
|
|
449
449
|
optimizeNodes() {
|
|
450
450
|
return `${this.code}` ? this : void 0;
|
|
451
451
|
}
|
|
452
|
-
optimizeNames(
|
|
453
|
-
return this.code = B(this.code,
|
|
452
|
+
optimizeNames(f, S) {
|
|
453
|
+
return this.code = B(this.code, f, S), this;
|
|
454
454
|
}
|
|
455
455
|
get names() {
|
|
456
456
|
return this.code instanceof t._CodeOrName ? this.code.names : {};
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
class u extends a {
|
|
460
|
-
constructor(
|
|
461
|
-
super(), this.nodes =
|
|
460
|
+
constructor(f = []) {
|
|
461
|
+
super(), this.nodes = f;
|
|
462
462
|
}
|
|
463
|
-
render(
|
|
464
|
-
return this.nodes.reduce((S, q) => S + q.render(
|
|
463
|
+
render(f) {
|
|
464
|
+
return this.nodes.reduce((S, q) => S + q.render(f), "");
|
|
465
465
|
}
|
|
466
466
|
optimizeNodes() {
|
|
467
|
-
const { nodes:
|
|
468
|
-
let S =
|
|
467
|
+
const { nodes: f } = this;
|
|
468
|
+
let S = f.length;
|
|
469
469
|
for (; S--; ) {
|
|
470
|
-
const q =
|
|
471
|
-
Array.isArray(q) ?
|
|
470
|
+
const q = f[S].optimizeNodes();
|
|
471
|
+
Array.isArray(q) ? f.splice(S, 1, ...q) : q ? f[S] = q : f.splice(S, 1);
|
|
472
472
|
}
|
|
473
|
-
return
|
|
473
|
+
return f.length > 0 ? this : void 0;
|
|
474
474
|
}
|
|
475
|
-
optimizeNames(
|
|
475
|
+
optimizeNames(f, S) {
|
|
476
476
|
const { nodes: q } = this;
|
|
477
477
|
let F = q.length;
|
|
478
478
|
for (; F--; ) {
|
|
479
479
|
const z = q[F];
|
|
480
|
-
z.optimizeNames(
|
|
480
|
+
z.optimizeNames(f, S) || (x(f, z.names), q.splice(F, 1));
|
|
481
481
|
}
|
|
482
482
|
return q.length > 0 ? this : void 0;
|
|
483
483
|
}
|
|
484
484
|
get names() {
|
|
485
|
-
return this.nodes.reduce((
|
|
485
|
+
return this.nodes.reduce((f, S) => L(f, S.names), {});
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
class v extends u {
|
|
489
|
-
render(
|
|
490
|
-
return "{" +
|
|
489
|
+
render(f) {
|
|
490
|
+
return "{" + f._n + super.render(f) + "}" + f._n;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
class E extends u {
|
|
494
494
|
}
|
|
495
|
-
class
|
|
495
|
+
class l extends v {
|
|
496
496
|
}
|
|
497
|
-
|
|
497
|
+
l.kind = "else";
|
|
498
498
|
class y extends v {
|
|
499
|
-
constructor(
|
|
500
|
-
super(S), this.condition =
|
|
499
|
+
constructor(f, S) {
|
|
500
|
+
super(S), this.condition = f;
|
|
501
501
|
}
|
|
502
|
-
render(
|
|
503
|
-
let S = `if(${this.condition})` + super.render(
|
|
504
|
-
return this.else && (S += "else " + this.else.render(
|
|
502
|
+
render(f) {
|
|
503
|
+
let S = `if(${this.condition})` + super.render(f);
|
|
504
|
+
return this.else && (S += "else " + this.else.render(f)), S;
|
|
505
505
|
}
|
|
506
506
|
optimizeNodes() {
|
|
507
507
|
super.optimizeNodes();
|
|
508
|
-
const
|
|
509
|
-
if (
|
|
508
|
+
const f = this.condition;
|
|
509
|
+
if (f === !0)
|
|
510
510
|
return this.nodes;
|
|
511
511
|
let S = this.else;
|
|
512
512
|
if (S) {
|
|
513
513
|
const q = S.optimizeNodes();
|
|
514
|
-
S = this.else = Array.isArray(q) ? new
|
|
514
|
+
S = this.else = Array.isArray(q) ? new l(q) : q;
|
|
515
515
|
}
|
|
516
516
|
if (S)
|
|
517
|
-
return
|
|
518
|
-
if (!(
|
|
517
|
+
return f === !1 ? S instanceof y ? S : S.nodes : this.nodes.length ? this : new y(se(f), S instanceof y ? [S] : S.nodes);
|
|
518
|
+
if (!(f === !1 || !this.nodes.length))
|
|
519
519
|
return this;
|
|
520
520
|
}
|
|
521
|
-
optimizeNames(
|
|
521
|
+
optimizeNames(f, S) {
|
|
522
522
|
var q;
|
|
523
|
-
if (this.else = (q = this.else) === null || q === void 0 ? void 0 : q.optimizeNames(
|
|
524
|
-
return this.condition = B(this.condition,
|
|
523
|
+
if (this.else = (q = this.else) === null || q === void 0 ? void 0 : q.optimizeNames(f, S), !!(super.optimizeNames(f, S) || this.else))
|
|
524
|
+
return this.condition = B(this.condition, f, S), this;
|
|
525
525
|
}
|
|
526
526
|
get names() {
|
|
527
|
-
const
|
|
528
|
-
return K(
|
|
527
|
+
const f = super.names;
|
|
528
|
+
return K(f, this.condition), this.else && L(f, this.else.names), f;
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
y.kind = "if";
|
|
@@ -533,166 +533,166 @@ function Y() {
|
|
|
533
533
|
}
|
|
534
534
|
s.kind = "for";
|
|
535
535
|
class p extends s {
|
|
536
|
-
constructor(
|
|
537
|
-
super(), this.iteration =
|
|
536
|
+
constructor(f) {
|
|
537
|
+
super(), this.iteration = f;
|
|
538
538
|
}
|
|
539
|
-
render(
|
|
540
|
-
return `for(${this.iteration})` + super.render(
|
|
539
|
+
render(f) {
|
|
540
|
+
return `for(${this.iteration})` + super.render(f);
|
|
541
541
|
}
|
|
542
|
-
optimizeNames(
|
|
543
|
-
if (super.optimizeNames(
|
|
544
|
-
return this.iteration = B(this.iteration,
|
|
542
|
+
optimizeNames(f, S) {
|
|
543
|
+
if (super.optimizeNames(f, S))
|
|
544
|
+
return this.iteration = B(this.iteration, f, S), this;
|
|
545
545
|
}
|
|
546
546
|
get names() {
|
|
547
547
|
return L(super.names, this.iteration.names);
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
550
|
class w extends s {
|
|
551
|
-
constructor(
|
|
552
|
-
super(), this.varKind =
|
|
551
|
+
constructor(f, S, q, F) {
|
|
552
|
+
super(), this.varKind = f, this.name = S, this.from = q, this.to = F;
|
|
553
553
|
}
|
|
554
|
-
render(
|
|
555
|
-
const S =
|
|
556
|
-
return `for(${S} ${q}=${F}; ${q}<${z}; ${q}++)` + super.render(
|
|
554
|
+
render(f) {
|
|
555
|
+
const S = f.es5 ? r.varKinds.var : this.varKind, { name: q, from: F, to: z } = this;
|
|
556
|
+
return `for(${S} ${q}=${F}; ${q}<${z}; ${q}++)` + super.render(f);
|
|
557
557
|
}
|
|
558
558
|
get names() {
|
|
559
|
-
const
|
|
560
|
-
return K(
|
|
559
|
+
const f = K(super.names, this.from);
|
|
560
|
+
return K(f, this.to);
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
563
|
class d extends s {
|
|
564
|
-
constructor(
|
|
565
|
-
super(), this.loop =
|
|
564
|
+
constructor(f, S, q, F) {
|
|
565
|
+
super(), this.loop = f, this.varKind = S, this.name = q, this.iterable = F;
|
|
566
566
|
}
|
|
567
|
-
render(
|
|
568
|
-
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(
|
|
567
|
+
render(f) {
|
|
568
|
+
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(f);
|
|
569
569
|
}
|
|
570
|
-
optimizeNames(
|
|
571
|
-
if (super.optimizeNames(
|
|
572
|
-
return this.iterable = B(this.iterable,
|
|
570
|
+
optimizeNames(f, S) {
|
|
571
|
+
if (super.optimizeNames(f, S))
|
|
572
|
+
return this.iterable = B(this.iterable, f, S), this;
|
|
573
573
|
}
|
|
574
574
|
get names() {
|
|
575
575
|
return L(super.names, this.iterable.names);
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
578
|
class _ extends v {
|
|
579
|
-
constructor(
|
|
580
|
-
super(), this.name =
|
|
579
|
+
constructor(f, S, q) {
|
|
580
|
+
super(), this.name = f, this.args = S, this.async = q;
|
|
581
581
|
}
|
|
582
|
-
render(
|
|
583
|
-
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(
|
|
582
|
+
render(f) {
|
|
583
|
+
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(f);
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
_.kind = "func";
|
|
587
587
|
class P extends u {
|
|
588
|
-
render(
|
|
589
|
-
return "return " + super.render(
|
|
588
|
+
render(f) {
|
|
589
|
+
return "return " + super.render(f);
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
P.kind = "return";
|
|
593
593
|
class T extends v {
|
|
594
|
-
render(
|
|
595
|
-
let S = "try" + super.render(
|
|
596
|
-
return this.catch && (S += this.catch.render(
|
|
594
|
+
render(f) {
|
|
595
|
+
let S = "try" + super.render(f);
|
|
596
|
+
return this.catch && (S += this.catch.render(f)), this.finally && (S += this.finally.render(f)), S;
|
|
597
597
|
}
|
|
598
598
|
optimizeNodes() {
|
|
599
|
-
var
|
|
600
|
-
return super.optimizeNodes(), (
|
|
599
|
+
var f, S;
|
|
600
|
+
return super.optimizeNodes(), (f = this.catch) === null || f === void 0 || f.optimizeNodes(), (S = this.finally) === null || S === void 0 || S.optimizeNodes(), this;
|
|
601
601
|
}
|
|
602
|
-
optimizeNames(
|
|
602
|
+
optimizeNames(f, S) {
|
|
603
603
|
var q, F;
|
|
604
|
-
return super.optimizeNames(
|
|
604
|
+
return super.optimizeNames(f, S), (q = this.catch) === null || q === void 0 || q.optimizeNames(f, S), (F = this.finally) === null || F === void 0 || F.optimizeNames(f, S), this;
|
|
605
605
|
}
|
|
606
606
|
get names() {
|
|
607
|
-
const
|
|
608
|
-
return this.catch && L(
|
|
607
|
+
const f = super.names;
|
|
608
|
+
return this.catch && L(f, this.catch.names), this.finally && L(f, this.finally.names), f;
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
611
|
class D extends v {
|
|
612
|
-
constructor(
|
|
613
|
-
super(), this.error =
|
|
612
|
+
constructor(f) {
|
|
613
|
+
super(), this.error = f;
|
|
614
614
|
}
|
|
615
|
-
render(
|
|
616
|
-
return `catch(${this.error})` + super.render(
|
|
615
|
+
render(f) {
|
|
616
|
+
return `catch(${this.error})` + super.render(f);
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
D.kind = "catch";
|
|
620
620
|
class U extends v {
|
|
621
|
-
render(
|
|
622
|
-
return "finally" + super.render(
|
|
621
|
+
render(f) {
|
|
622
|
+
return "finally" + super.render(f);
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
U.kind = "finally";
|
|
626
626
|
class A {
|
|
627
|
-
constructor(
|
|
627
|
+
constructor(f, S = {}) {
|
|
628
628
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...S, _n: S.lines ? `
|
|
629
|
-
` : "" }, this._extScope =
|
|
629
|
+
` : "" }, this._extScope = f, this._scope = new r.Scope({ parent: f }), this._nodes = [new E()];
|
|
630
630
|
}
|
|
631
631
|
toString() {
|
|
632
632
|
return this._root.render(this.opts);
|
|
633
633
|
}
|
|
634
634
|
// returns unique name in the internal scope
|
|
635
|
-
name(
|
|
636
|
-
return this._scope.name(
|
|
635
|
+
name(f) {
|
|
636
|
+
return this._scope.name(f);
|
|
637
637
|
}
|
|
638
638
|
// reserves unique name in the external scope
|
|
639
|
-
scopeName(
|
|
640
|
-
return this._extScope.name(
|
|
639
|
+
scopeName(f) {
|
|
640
|
+
return this._extScope.name(f);
|
|
641
641
|
}
|
|
642
642
|
// reserves unique name in the external scope and assigns value to it
|
|
643
|
-
scopeValue(
|
|
644
|
-
const q = this._extScope.value(
|
|
643
|
+
scopeValue(f, S) {
|
|
644
|
+
const q = this._extScope.value(f, S);
|
|
645
645
|
return (this._values[q.prefix] || (this._values[q.prefix] = /* @__PURE__ */ new Set())).add(q), q;
|
|
646
646
|
}
|
|
647
|
-
getScopeValue(
|
|
648
|
-
return this._extScope.getValue(
|
|
647
|
+
getScopeValue(f, S) {
|
|
648
|
+
return this._extScope.getValue(f, S);
|
|
649
649
|
}
|
|
650
650
|
// return code that assigns values in the external scope to the names that are used internally
|
|
651
651
|
// (same names that were returned by gen.scopeName or gen.scopeValue)
|
|
652
|
-
scopeRefs(
|
|
653
|
-
return this._extScope.scopeRefs(
|
|
652
|
+
scopeRefs(f) {
|
|
653
|
+
return this._extScope.scopeRefs(f, this._values);
|
|
654
654
|
}
|
|
655
655
|
scopeCode() {
|
|
656
656
|
return this._extScope.scopeCode(this._values);
|
|
657
657
|
}
|
|
658
|
-
_def(
|
|
658
|
+
_def(f, S, q, F) {
|
|
659
659
|
const z = this._scope.toName(S);
|
|
660
|
-
return q !== void 0 && F && (this._constants[z.str] = q), this._leafNode(new o(
|
|
660
|
+
return q !== void 0 && F && (this._constants[z.str] = q), this._leafNode(new o(f, z, q)), z;
|
|
661
661
|
}
|
|
662
662
|
// `const` declaration (`var` in es5 mode)
|
|
663
|
-
const(
|
|
664
|
-
return this._def(r.varKinds.const,
|
|
663
|
+
const(f, S, q) {
|
|
664
|
+
return this._def(r.varKinds.const, f, S, q);
|
|
665
665
|
}
|
|
666
666
|
// `let` declaration with optional assignment (`var` in es5 mode)
|
|
667
|
-
let(
|
|
668
|
-
return this._def(r.varKinds.let,
|
|
667
|
+
let(f, S, q) {
|
|
668
|
+
return this._def(r.varKinds.let, f, S, q);
|
|
669
669
|
}
|
|
670
670
|
// `var` declaration with optional assignment
|
|
671
|
-
var(
|
|
672
|
-
return this._def(r.varKinds.var,
|
|
671
|
+
var(f, S, q) {
|
|
672
|
+
return this._def(r.varKinds.var, f, S, q);
|
|
673
673
|
}
|
|
674
674
|
// assignment code
|
|
675
|
-
assign(
|
|
676
|
-
return this._leafNode(new i(
|
|
675
|
+
assign(f, S, q) {
|
|
676
|
+
return this._leafNode(new i(f, S, q));
|
|
677
677
|
}
|
|
678
678
|
// `+=` code
|
|
679
|
-
add(
|
|
680
|
-
return this._leafNode(new h(
|
|
679
|
+
add(f, S) {
|
|
680
|
+
return this._leafNode(new h(f, e.operators.ADD, S));
|
|
681
681
|
}
|
|
682
682
|
// appends passed SafeExpr to code or executes Block
|
|
683
|
-
code(
|
|
684
|
-
return typeof
|
|
683
|
+
code(f) {
|
|
684
|
+
return typeof f == "function" ? f() : f !== t.nil && this._leafNode(new b(f)), this;
|
|
685
685
|
}
|
|
686
686
|
// returns code for object literal for the passed argument list of key-value pairs
|
|
687
|
-
object(...
|
|
687
|
+
object(...f) {
|
|
688
688
|
const S = ["{"];
|
|
689
|
-
for (const [q, F] of
|
|
689
|
+
for (const [q, F] of f)
|
|
690
690
|
S.length > 1 && S.push(","), S.push(q), (q !== F || this.opts.es5) && (S.push(":"), (0, t.addCodeArg)(S, F));
|
|
691
691
|
return S.push("}"), new t._Code(S);
|
|
692
692
|
}
|
|
693
693
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
694
|
-
if(
|
|
695
|
-
if (this._blockNode(new y(
|
|
694
|
+
if(f, S, q) {
|
|
695
|
+
if (this._blockNode(new y(f)), S && q)
|
|
696
696
|
this.code(S).else().code(q).endIf();
|
|
697
697
|
else if (S)
|
|
698
698
|
this.code(S).endIf();
|
|
@@ -701,32 +701,32 @@ function Y() {
|
|
|
701
701
|
return this;
|
|
702
702
|
}
|
|
703
703
|
// `else if` clause - invalid without `if` or after `else` clauses
|
|
704
|
-
elseIf(
|
|
705
|
-
return this._elseNode(new y(
|
|
704
|
+
elseIf(f) {
|
|
705
|
+
return this._elseNode(new y(f));
|
|
706
706
|
}
|
|
707
707
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
708
708
|
else() {
|
|
709
|
-
return this._elseNode(new
|
|
709
|
+
return this._elseNode(new l());
|
|
710
710
|
}
|
|
711
711
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
712
712
|
endIf() {
|
|
713
|
-
return this._endBlockNode(y,
|
|
713
|
+
return this._endBlockNode(y, l);
|
|
714
714
|
}
|
|
715
|
-
_for(
|
|
716
|
-
return this._blockNode(
|
|
715
|
+
_for(f, S) {
|
|
716
|
+
return this._blockNode(f), S && this.code(S).endFor(), this;
|
|
717
717
|
}
|
|
718
718
|
// a generic `for` clause (or statement if `forBody` is passed)
|
|
719
|
-
for(
|
|
720
|
-
return this._for(new p(
|
|
719
|
+
for(f, S) {
|
|
720
|
+
return this._for(new p(f), S);
|
|
721
721
|
}
|
|
722
722
|
// `for` statement for a range of values
|
|
723
|
-
forRange(
|
|
724
|
-
const H = this._scope.toName(
|
|
723
|
+
forRange(f, S, q, F, z = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
724
|
+
const H = this._scope.toName(f);
|
|
725
725
|
return this._for(new w(z, H, S, q), () => F(H));
|
|
726
726
|
}
|
|
727
727
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
728
|
-
forOf(
|
|
729
|
-
const z = this._scope.toName(
|
|
728
|
+
forOf(f, S, q, F = r.varKinds.const) {
|
|
729
|
+
const z = this._scope.toName(f);
|
|
730
730
|
if (this.opts.es5) {
|
|
731
731
|
const H = S instanceof t.Name ? S : this.var("_arr", S);
|
|
732
732
|
return this.forRange("_i", 0, (0, t._)`${H}.length`, (G) => {
|
|
@@ -737,10 +737,10 @@ function Y() {
|
|
|
737
737
|
}
|
|
738
738
|
// `for-in` statement.
|
|
739
739
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
740
|
-
forIn(
|
|
740
|
+
forIn(f, S, q, F = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
741
741
|
if (this.opts.ownProperties)
|
|
742
|
-
return this.forOf(
|
|
743
|
-
const z = this._scope.toName(
|
|
742
|
+
return this.forOf(f, (0, t._)`Object.keys(${S})`, q);
|
|
743
|
+
const z = this._scope.toName(f);
|
|
744
744
|
return this._for(new d("in", F, z, S), () => q(z));
|
|
745
745
|
}
|
|
746
746
|
// end `for` loop
|
|
@@ -748,101 +748,101 @@ function Y() {
|
|
|
748
748
|
return this._endBlockNode(s);
|
|
749
749
|
}
|
|
750
750
|
// `label` statement
|
|
751
|
-
label(
|
|
752
|
-
return this._leafNode(new m(
|
|
751
|
+
label(f) {
|
|
752
|
+
return this._leafNode(new m(f));
|
|
753
753
|
}
|
|
754
754
|
// `break` statement
|
|
755
|
-
break(
|
|
756
|
-
return this._leafNode(new g(
|
|
755
|
+
break(f) {
|
|
756
|
+
return this._leafNode(new g(f));
|
|
757
757
|
}
|
|
758
758
|
// `return` statement
|
|
759
|
-
return(
|
|
759
|
+
return(f) {
|
|
760
760
|
const S = new P();
|
|
761
|
-
if (this._blockNode(S), this.code(
|
|
761
|
+
if (this._blockNode(S), this.code(f), S.nodes.length !== 1)
|
|
762
762
|
throw new Error('CodeGen: "return" should have one node');
|
|
763
763
|
return this._endBlockNode(P);
|
|
764
764
|
}
|
|
765
765
|
// `try` statement
|
|
766
|
-
try(
|
|
766
|
+
try(f, S, q) {
|
|
767
767
|
if (!S && !q)
|
|
768
768
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
769
769
|
const F = new T();
|
|
770
|
-
if (this._blockNode(F), this.code(
|
|
770
|
+
if (this._blockNode(F), this.code(f), S) {
|
|
771
771
|
const z = this.name("e");
|
|
772
772
|
this._currNode = F.catch = new D(z), S(z);
|
|
773
773
|
}
|
|
774
774
|
return q && (this._currNode = F.finally = new U(), this.code(q)), this._endBlockNode(D, U);
|
|
775
775
|
}
|
|
776
776
|
// `throw` statement
|
|
777
|
-
throw(
|
|
778
|
-
return this._leafNode(new N(
|
|
777
|
+
throw(f) {
|
|
778
|
+
return this._leafNode(new N(f));
|
|
779
779
|
}
|
|
780
780
|
// start self-balancing block
|
|
781
|
-
block(
|
|
782
|
-
return this._blockStarts.push(this._nodes.length),
|
|
781
|
+
block(f, S) {
|
|
782
|
+
return this._blockStarts.push(this._nodes.length), f && this.code(f).endBlock(S), this;
|
|
783
783
|
}
|
|
784
784
|
// end the current self-balancing block
|
|
785
|
-
endBlock(
|
|
785
|
+
endBlock(f) {
|
|
786
786
|
const S = this._blockStarts.pop();
|
|
787
787
|
if (S === void 0)
|
|
788
788
|
throw new Error("CodeGen: not in self-balancing block");
|
|
789
789
|
const q = this._nodes.length - S;
|
|
790
|
-
if (q < 0 ||
|
|
791
|
-
throw new Error(`CodeGen: wrong number of nodes: ${q} vs ${
|
|
790
|
+
if (q < 0 || f !== void 0 && q !== f)
|
|
791
|
+
throw new Error(`CodeGen: wrong number of nodes: ${q} vs ${f} expected`);
|
|
792
792
|
return this._nodes.length = S, this;
|
|
793
793
|
}
|
|
794
794
|
// `function` heading (or definition if funcBody is passed)
|
|
795
|
-
func(
|
|
796
|
-
return this._blockNode(new _(
|
|
795
|
+
func(f, S = t.nil, q, F) {
|
|
796
|
+
return this._blockNode(new _(f, S, q)), F && this.code(F).endFunc(), this;
|
|
797
797
|
}
|
|
798
798
|
// end function definition
|
|
799
799
|
endFunc() {
|
|
800
800
|
return this._endBlockNode(_);
|
|
801
801
|
}
|
|
802
|
-
optimize(
|
|
803
|
-
for (;
|
|
802
|
+
optimize(f = 1) {
|
|
803
|
+
for (; f-- > 0; )
|
|
804
804
|
this._root.optimizeNodes(), this._root.optimizeNames(this._root.names, this._constants);
|
|
805
805
|
}
|
|
806
|
-
_leafNode(
|
|
807
|
-
return this._currNode.nodes.push(
|
|
806
|
+
_leafNode(f) {
|
|
807
|
+
return this._currNode.nodes.push(f), this;
|
|
808
808
|
}
|
|
809
|
-
_blockNode(
|
|
810
|
-
this._currNode.nodes.push(
|
|
809
|
+
_blockNode(f) {
|
|
810
|
+
this._currNode.nodes.push(f), this._nodes.push(f);
|
|
811
811
|
}
|
|
812
|
-
_endBlockNode(
|
|
812
|
+
_endBlockNode(f, S) {
|
|
813
813
|
const q = this._currNode;
|
|
814
|
-
if (q instanceof
|
|
814
|
+
if (q instanceof f || S && q instanceof S)
|
|
815
815
|
return this._nodes.pop(), this;
|
|
816
|
-
throw new Error(`CodeGen: not in block "${S ? `${
|
|
816
|
+
throw new Error(`CodeGen: not in block "${S ? `${f.kind}/${S.kind}` : f.kind}"`);
|
|
817
817
|
}
|
|
818
|
-
_elseNode(
|
|
818
|
+
_elseNode(f) {
|
|
819
819
|
const S = this._currNode;
|
|
820
820
|
if (!(S instanceof y))
|
|
821
821
|
throw new Error('CodeGen: "else" without "if"');
|
|
822
|
-
return this._currNode = S.else =
|
|
822
|
+
return this._currNode = S.else = f, this;
|
|
823
823
|
}
|
|
824
824
|
get _root() {
|
|
825
825
|
return this._nodes[0];
|
|
826
826
|
}
|
|
827
827
|
get _currNode() {
|
|
828
|
-
const
|
|
829
|
-
return
|
|
828
|
+
const f = this._nodes;
|
|
829
|
+
return f[f.length - 1];
|
|
830
830
|
}
|
|
831
|
-
set _currNode(
|
|
831
|
+
set _currNode(f) {
|
|
832
832
|
const S = this._nodes;
|
|
833
|
-
S[S.length - 1] =
|
|
833
|
+
S[S.length - 1] = f;
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
836
|
e.CodeGen = A;
|
|
837
|
-
function L(O,
|
|
838
|
-
for (const S in
|
|
839
|
-
O[S] = (O[S] || 0) + (
|
|
837
|
+
function L(O, f) {
|
|
838
|
+
for (const S in f)
|
|
839
|
+
O[S] = (O[S] || 0) + (f[S] || 0);
|
|
840
840
|
return O;
|
|
841
841
|
}
|
|
842
|
-
function K(O,
|
|
843
|
-
return
|
|
842
|
+
function K(O, f) {
|
|
843
|
+
return f instanceof t._CodeOrName ? L(O, f.names) : O;
|
|
844
844
|
}
|
|
845
|
-
function B(O,
|
|
845
|
+
function B(O, f, S) {
|
|
846
846
|
if (O instanceof t.Name)
|
|
847
847
|
return q(O);
|
|
848
848
|
if (!F(O))
|
|
@@ -850,15 +850,15 @@ function Y() {
|
|
|
850
850
|
return new t._Code(O._items.reduce((z, H) => (H instanceof t.Name && (H = q(H)), H instanceof t._Code ? z.push(...H._items) : z.push(H), z), []));
|
|
851
851
|
function q(z) {
|
|
852
852
|
const H = S[z.str];
|
|
853
|
-
return H === void 0 ||
|
|
853
|
+
return H === void 0 || f[z.str] !== 1 ? z : (delete f[z.str], H);
|
|
854
854
|
}
|
|
855
855
|
function F(z) {
|
|
856
|
-
return z instanceof t._Code && z._items.some((H) => H instanceof t.Name &&
|
|
856
|
+
return z instanceof t._Code && z._items.some((H) => H instanceof t.Name && f[H.str] === 1 && S[H.str] !== void 0);
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
|
-
function x(O,
|
|
860
|
-
for (const S in
|
|
861
|
-
O[S] = (O[S] || 0) - (
|
|
859
|
+
function x(O, f) {
|
|
860
|
+
for (const S in f)
|
|
861
|
+
O[S] = (O[S] || 0) - (f[S] || 0);
|
|
862
862
|
}
|
|
863
863
|
function se(O) {
|
|
864
864
|
return typeof O == "boolean" || typeof O == "number" || O === null ? !O : (0, t._)`!${k(O)}`;
|
|
@@ -875,7 +875,7 @@ function Y() {
|
|
|
875
875
|
}
|
|
876
876
|
e.or = M;
|
|
877
877
|
function j(O) {
|
|
878
|
-
return (
|
|
878
|
+
return (f, S) => f === t.nil ? S : S === t.nil ? f : (0, t._)`${k(f)} ${O} ${k(S)}`;
|
|
879
879
|
}
|
|
880
880
|
function k(O) {
|
|
881
881
|
return O instanceof t.Name ? O : (0, t._)`(${O})`;
|
|
@@ -994,11 +994,11 @@ function X() {
|
|
|
994
994
|
Object.keys(P).forEach((T) => d.assign((0, e._)`${_}${(0, e.getProperty)(T)}`, !0));
|
|
995
995
|
}
|
|
996
996
|
Z.setEvaluated = E;
|
|
997
|
-
const
|
|
997
|
+
const l = {};
|
|
998
998
|
function y(d, _) {
|
|
999
999
|
return d.scopeValue("func", {
|
|
1000
1000
|
ref: _,
|
|
1001
|
-
code:
|
|
1001
|
+
code: l[_.code] || (l[_.code] = new t._Code(_.code))
|
|
1002
1002
|
});
|
|
1003
1003
|
}
|
|
1004
1004
|
Z.useFunc = y;
|
|
@@ -1064,40 +1064,40 @@ function Ye() {
|
|
|
1064
1064
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
1065
1065
|
const t = /* @__PURE__ */ Y(), r = /* @__PURE__ */ X(), n = /* @__PURE__ */ Ne();
|
|
1066
1066
|
e.keywordError = {
|
|
1067
|
-
message: ({ keyword:
|
|
1067
|
+
message: ({ keyword: l }) => (0, t.str)`must pass "${l}" keyword validation`
|
|
1068
1068
|
}, e.keyword$DataError = {
|
|
1069
|
-
message: ({ keyword:
|
|
1069
|
+
message: ({ keyword: l, schemaType: y }) => y ? (0, t.str)`"${l}" keyword must be ${y} ($data)` : (0, t.str)`"${l}" keyword is invalid ($data)`
|
|
1070
1070
|
};
|
|
1071
|
-
function c(
|
|
1072
|
-
const { it: w } =
|
|
1071
|
+
function c(l, y = e.keywordError, s, p) {
|
|
1072
|
+
const { it: w } = l, { gen: d, compositeRule: _, allErrors: P } = w, T = N(l, y, s);
|
|
1073
1073
|
p ?? (_ || P) ? h(d, T) : m(w, (0, t._)`[${T}]`);
|
|
1074
1074
|
}
|
|
1075
1075
|
e.reportError = c;
|
|
1076
|
-
function a(
|
|
1077
|
-
const { it: p } =
|
|
1076
|
+
function a(l, y = e.keywordError, s) {
|
|
1077
|
+
const { it: p } = l, { gen: w, compositeRule: d, allErrors: _ } = p, P = N(l, y, s);
|
|
1078
1078
|
h(w, P), d || _ || m(p, n.default.vErrors);
|
|
1079
1079
|
}
|
|
1080
1080
|
e.reportExtraError = a;
|
|
1081
|
-
function o(
|
|
1082
|
-
|
|
1081
|
+
function o(l, y) {
|
|
1082
|
+
l.assign(n.default.errors, y), l.if((0, t._)`${n.default.vErrors} !== null`, () => l.if(y, () => l.assign((0, t._)`${n.default.vErrors}.length`, y), () => l.assign(n.default.vErrors, null)));
|
|
1083
1083
|
}
|
|
1084
1084
|
e.resetErrorsCount = o;
|
|
1085
|
-
function i({ gen:
|
|
1085
|
+
function i({ gen: l, keyword: y, schemaValue: s, data: p, errsCount: w, it: d }) {
|
|
1086
1086
|
if (w === void 0)
|
|
1087
1087
|
throw new Error("ajv implementation error");
|
|
1088
|
-
const _ =
|
|
1089
|
-
|
|
1090
|
-
|
|
1088
|
+
const _ = l.name("err");
|
|
1089
|
+
l.forRange("i", w, n.default.errors, (P) => {
|
|
1090
|
+
l.const(_, (0, t._)`${n.default.vErrors}[${P}]`), l.if((0, t._)`${_}.instancePath === undefined`, () => l.assign((0, t._)`${_}.instancePath`, (0, t.strConcat)(n.default.instancePath, d.errorPath))), l.assign((0, t._)`${_}.schemaPath`, (0, t.str)`${d.errSchemaPath}/${y}`), d.opts.verbose && (l.assign((0, t._)`${_}.schema`, s), l.assign((0, t._)`${_}.data`, p));
|
|
1091
1091
|
});
|
|
1092
1092
|
}
|
|
1093
1093
|
e.extendErrors = i;
|
|
1094
|
-
function h(
|
|
1095
|
-
const s =
|
|
1096
|
-
|
|
1094
|
+
function h(l, y) {
|
|
1095
|
+
const s = l.const("err", y);
|
|
1096
|
+
l.if((0, t._)`${n.default.vErrors} === null`, () => l.assign(n.default.vErrors, (0, t._)`[${s}]`), (0, t._)`${n.default.vErrors}.push(${s})`), l.code((0, t._)`${n.default.errors}++`);
|
|
1097
1097
|
}
|
|
1098
|
-
function m(
|
|
1099
|
-
const { gen: s, validateName: p, schemaEnv: w } =
|
|
1100
|
-
w.$async ? s.throw((0, t._)`new ${
|
|
1098
|
+
function m(l, y) {
|
|
1099
|
+
const { gen: s, validateName: p, schemaEnv: w } = l;
|
|
1100
|
+
w.$async ? s.throw((0, t._)`new ${l.ValidationError}(${y})`) : (s.assign((0, t._)`${p}.errors`, y), s.return(!1));
|
|
1101
1101
|
}
|
|
1102
1102
|
const g = {
|
|
1103
1103
|
keyword: new t.Name("keyword"),
|
|
@@ -1109,28 +1109,28 @@ function Ye() {
|
|
|
1109
1109
|
schema: new t.Name("schema"),
|
|
1110
1110
|
parentSchema: new t.Name("parentSchema")
|
|
1111
1111
|
};
|
|
1112
|
-
function N(
|
|
1113
|
-
const { createErrors: p } =
|
|
1114
|
-
return p === !1 ? (0, t._)`{}` : b(
|
|
1112
|
+
function N(l, y, s) {
|
|
1113
|
+
const { createErrors: p } = l.it;
|
|
1114
|
+
return p === !1 ? (0, t._)`{}` : b(l, y, s);
|
|
1115
1115
|
}
|
|
1116
|
-
function b(
|
|
1117
|
-
const { gen: p, it: w } =
|
|
1116
|
+
function b(l, y, s = {}) {
|
|
1117
|
+
const { gen: p, it: w } = l, d = [
|
|
1118
1118
|
u(w, s),
|
|
1119
|
-
v(
|
|
1119
|
+
v(l, s)
|
|
1120
1120
|
];
|
|
1121
|
-
return E(
|
|
1121
|
+
return E(l, y, d), p.object(...d);
|
|
1122
1122
|
}
|
|
1123
|
-
function u({ errorPath:
|
|
1124
|
-
const s = y ? (0, t.str)`${
|
|
1123
|
+
function u({ errorPath: l }, { instancePath: y }) {
|
|
1124
|
+
const s = y ? (0, t.str)`${l}${(0, r.getErrorPath)(y, r.Type.Str)}` : l;
|
|
1125
1125
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, s)];
|
|
1126
1126
|
}
|
|
1127
|
-
function v({ keyword:
|
|
1128
|
-
let w = p ? y : (0, t.str)`${y}/${
|
|
1127
|
+
function v({ keyword: l, it: { errSchemaPath: y } }, { schemaPath: s, parentSchema: p }) {
|
|
1128
|
+
let w = p ? y : (0, t.str)`${y}/${l}`;
|
|
1129
1129
|
return s && (w = (0, t.str)`${w}${(0, r.getErrorPath)(s, r.Type.Str)}`), [g.schemaPath, w];
|
|
1130
1130
|
}
|
|
1131
|
-
function E(
|
|
1132
|
-
const { keyword: w, data: d, schemaValue: _, it: P } =
|
|
1133
|
-
p.push([g.keyword, w], [g.params, typeof y == "function" ? y(
|
|
1131
|
+
function E(l, { params: y, message: s }, p) {
|
|
1132
|
+
const { keyword: w, data: d, schemaValue: _, it: P } = l, { opts: T, propertyName: D, topSchemaRef: U, schemaPath: A } = P;
|
|
1133
|
+
p.push([g.keyword, w], [g.params, typeof y == "function" ? y(l) : y || (0, t._)`{}`]), T.messages && p.push([g.message, typeof s == "function" ? s(l) : s]), T.verbose && p.push([g.schema, _], [g.parentSchema, (0, t._)`${U}${A}`], [n.default.data, d]), D && p.push([g.propertyName, D]);
|
|
1134
1134
|
}
|
|
1135
1135
|
})(Jt)), Jt;
|
|
1136
1136
|
}
|
|
@@ -1245,7 +1245,7 @@ function zt() {
|
|
|
1245
1245
|
if (T) {
|
|
1246
1246
|
const D = v(p, d, _.strictNumbers, a.Wrong);
|
|
1247
1247
|
w.if(D, () => {
|
|
1248
|
-
P.length ? N(s, p, P) :
|
|
1248
|
+
P.length ? N(s, p, P) : l(s);
|
|
1249
1249
|
});
|
|
1250
1250
|
}
|
|
1251
1251
|
return T;
|
|
@@ -1260,7 +1260,7 @@ function zt() {
|
|
|
1260
1260
|
P.coerceTypes === "array" && d.if((0, n._)`${T} == 'object' && Array.isArray(${_}) && ${_}.length == 1`, () => d.assign(_, (0, n._)`${_}[0]`).assign(T, (0, n._)`typeof ${_}`).if(v(p, _, P.strictNumbers), () => d.assign(D, _))), d.if((0, n._)`${D} !== undefined`);
|
|
1261
1261
|
for (const A of w)
|
|
1262
1262
|
(m.has(A) || A === "array" && P.coerceTypes === "array") && U(A);
|
|
1263
|
-
d.else(),
|
|
1263
|
+
d.else(), l(s), d.endIf(), d.if((0, n._)`${D} !== undefined`, () => {
|
|
1264
1264
|
d.assign(_, D), b(s, D);
|
|
1265
1265
|
});
|
|
1266
1266
|
function U(A) {
|
|
@@ -1338,11 +1338,11 @@ function zt() {
|
|
|
1338
1338
|
message: ({ schema: s }) => `must be ${s}`,
|
|
1339
1339
|
params: ({ schema: s, schemaValue: p }) => typeof s == "string" ? (0, n._)`{type: ${s}}` : (0, n._)`{type: ${p}}`
|
|
1340
1340
|
};
|
|
1341
|
-
function
|
|
1341
|
+
function l(s) {
|
|
1342
1342
|
const p = y(s);
|
|
1343
1343
|
(0, r.reportError)(p, E);
|
|
1344
1344
|
}
|
|
1345
|
-
ue.reportTypeError =
|
|
1345
|
+
ue.reportTypeError = l;
|
|
1346
1346
|
function y(s) {
|
|
1347
1347
|
const { gen: p, data: w, schema: d } = s, _ = (0, c.schemaRefOrVal)(s, d, "type");
|
|
1348
1348
|
return {
|
|
@@ -1458,7 +1458,7 @@ function $e() {
|
|
|
1458
1458
|
});
|
|
1459
1459
|
}
|
|
1460
1460
|
re.usePattern = E;
|
|
1461
|
-
function
|
|
1461
|
+
function l(s) {
|
|
1462
1462
|
const { gen: p, data: w, keyword: d, it: _ } = s, P = p.name("valid");
|
|
1463
1463
|
if (_.allErrors) {
|
|
1464
1464
|
const D = p.let("valid", !0);
|
|
@@ -1476,7 +1476,7 @@ function $e() {
|
|
|
1476
1476
|
});
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
1479
|
-
re.validateArray =
|
|
1479
|
+
re.validateArray = l;
|
|
1480
1480
|
function y(s) {
|
|
1481
1481
|
const { gen: p, schema: w, keyword: d, it: _ } = s;
|
|
1482
1482
|
if (!Array.isArray(w))
|
|
@@ -1501,7 +1501,7 @@ function Ks() {
|
|
|
1501
1501
|
Vr = 1, Object.defineProperty(ve, "__esModule", { value: !0 }), ve.validateKeywordUsage = ve.validSchemaType = ve.funcKeywordCode = ve.macroKeywordCode = void 0;
|
|
1502
1502
|
const e = /* @__PURE__ */ Y(), t = /* @__PURE__ */ Ne(), r = /* @__PURE__ */ $e(), n = /* @__PURE__ */ Ye();
|
|
1503
1503
|
function c(b, u) {
|
|
1504
|
-
const { gen: v, keyword: E, schema:
|
|
1504
|
+
const { gen: v, keyword: E, schema: l, parentSchema: y, it: s } = b, p = u.macro.call(s.self, l, y, s), w = m(v, E, p);
|
|
1505
1505
|
s.opts.validateSchema !== !1 && s.self.validateSchema(p, !0);
|
|
1506
1506
|
const d = v.name("valid");
|
|
1507
1507
|
b.subschema({
|
|
@@ -1515,9 +1515,9 @@ function Ks() {
|
|
|
1515
1515
|
ve.macroKeywordCode = c;
|
|
1516
1516
|
function a(b, u) {
|
|
1517
1517
|
var v;
|
|
1518
|
-
const { gen: E, keyword:
|
|
1518
|
+
const { gen: E, keyword: l, schema: y, parentSchema: s, $data: p, it: w } = b;
|
|
1519
1519
|
h(w, u);
|
|
1520
|
-
const d = !p && u.compile ? u.compile.call(w.self, y, s, w) : u.validate, _ = m(E,
|
|
1520
|
+
const d = !p && u.compile ? u.compile.call(w.self, y, s, w) : u.validate, _ = m(E, l, d), P = E.let("valid");
|
|
1521
1521
|
b.block$data(P, T), b.ok((v = u.valid) !== null && v !== void 0 ? v : P);
|
|
1522
1522
|
function T() {
|
|
1523
1523
|
if (u.errors === !1)
|
|
@@ -1568,14 +1568,14 @@ function Ks() {
|
|
|
1568
1568
|
return !u.length || u.some((E) => E === "array" ? Array.isArray(b) : E === "object" ? b && typeof b == "object" && !Array.isArray(b) : typeof b == E || v && typeof b > "u");
|
|
1569
1569
|
}
|
|
1570
1570
|
ve.validSchemaType = g;
|
|
1571
|
-
function N({ schema: b, opts: u, self: v, errSchemaPath: E },
|
|
1572
|
-
if (Array.isArray(
|
|
1571
|
+
function N({ schema: b, opts: u, self: v, errSchemaPath: E }, l, y) {
|
|
1572
|
+
if (Array.isArray(l.keyword) ? !l.keyword.includes(y) : l.keyword !== y)
|
|
1573
1573
|
throw new Error("ajv implementation error");
|
|
1574
|
-
const s =
|
|
1574
|
+
const s = l.dependencies;
|
|
1575
1575
|
if (s != null && s.some((p) => !Object.prototype.hasOwnProperty.call(b, p)))
|
|
1576
1576
|
throw new Error(`parent schema must have dependencies of ${y}: ${s.join(",")}`);
|
|
1577
|
-
if (
|
|
1578
|
-
const w = `keyword "${y}" value is invalid at path "${E}": ` + v.errorsText(
|
|
1577
|
+
if (l.validateSchema && !l.validateSchema(b[y])) {
|
|
1578
|
+
const w = `keyword "${y}" value is invalid at path "${E}": ` + v.errorsText(l.validateSchema.errors);
|
|
1579
1579
|
if (u.validateSchema === "log")
|
|
1580
1580
|
v.logger.error(w);
|
|
1581
1581
|
else
|
|
@@ -1622,8 +1622,8 @@ function Bs() {
|
|
|
1622
1622
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
1623
1623
|
const { gen: b } = o;
|
|
1624
1624
|
if (i !== void 0) {
|
|
1625
|
-
const { errorPath: v, dataPathArr: E, opts:
|
|
1626
|
-
u(y), a.errorPath = (0, e.str)`${v}${(0, t.getErrorPath)(i, h,
|
|
1625
|
+
const { errorPath: v, dataPathArr: E, opts: l } = o, y = b.let("data", (0, e._)`${o.data}${(0, e.getProperty)(i)}`, !0);
|
|
1626
|
+
u(y), a.errorPath = (0, e.str)`${v}${(0, t.getErrorPath)(i, h, l.jsPropertySyntax)}`, a.parentDataProperty = (0, e._)`${i}`, a.dataPathArr = [...E, a.parentDataProperty];
|
|
1627
1627
|
}
|
|
1628
1628
|
if (m !== void 0) {
|
|
1629
1629
|
const v = m instanceof e.Name ? m : b.let("data", m, !0);
|
|
@@ -1731,8 +1731,8 @@ function Hs() {
|
|
|
1731
1731
|
t(n, c, a, v[E], i + "/" + u + "/" + E, h, i, u, o, E);
|
|
1732
1732
|
} else if (u in e.propsKeywords) {
|
|
1733
1733
|
if (v && typeof v == "object")
|
|
1734
|
-
for (var
|
|
1735
|
-
t(n, c, a, v[
|
|
1734
|
+
for (var l in v)
|
|
1735
|
+
t(n, c, a, v[l], i + "/" + u + "/" + r(l), h, i, u, o, l);
|
|
1736
1736
|
} else (u in e.keywords || n.allKeys && !(u in e.skipKeywords)) && t(n, c, a, v, i + "/" + u, h, i, u, o);
|
|
1737
1737
|
}
|
|
1738
1738
|
a(o, i, h, m, g, N, b);
|
|
@@ -1765,8 +1765,8 @@ function Ft() {
|
|
|
1765
1765
|
"enum",
|
|
1766
1766
|
"const"
|
|
1767
1767
|
]);
|
|
1768
|
-
function c(E,
|
|
1769
|
-
return typeof E == "boolean" ? !0 :
|
|
1768
|
+
function c(E, l = !0) {
|
|
1769
|
+
return typeof E == "boolean" ? !0 : l === !0 ? !o(E) : l ? i(E) <= l : !1;
|
|
1770
1770
|
}
|
|
1771
1771
|
le.inlineRef = c;
|
|
1772
1772
|
const a = /* @__PURE__ */ new Set([
|
|
@@ -1777,33 +1777,33 @@ function Ft() {
|
|
|
1777
1777
|
"$dynamicAnchor"
|
|
1778
1778
|
]);
|
|
1779
1779
|
function o(E) {
|
|
1780
|
-
for (const
|
|
1781
|
-
if (a.has(
|
|
1780
|
+
for (const l in E) {
|
|
1781
|
+
if (a.has(l))
|
|
1782
1782
|
return !0;
|
|
1783
|
-
const y = E[
|
|
1783
|
+
const y = E[l];
|
|
1784
1784
|
if (Array.isArray(y) && y.some(o) || typeof y == "object" && o(y))
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
}
|
|
1787
1787
|
return !1;
|
|
1788
1788
|
}
|
|
1789
1789
|
function i(E) {
|
|
1790
|
-
let
|
|
1790
|
+
let l = 0;
|
|
1791
1791
|
for (const y in E) {
|
|
1792
1792
|
if (y === "$ref")
|
|
1793
1793
|
return 1 / 0;
|
|
1794
|
-
if (
|
|
1794
|
+
if (l++, !n.has(y) && (typeof E[y] == "object" && (0, e.eachItem)(E[y], (s) => l += i(s)), l === 1 / 0))
|
|
1795
1795
|
return 1 / 0;
|
|
1796
1796
|
}
|
|
1797
|
-
return
|
|
1797
|
+
return l;
|
|
1798
1798
|
}
|
|
1799
|
-
function h(E,
|
|
1800
|
-
y !== !1 && (
|
|
1801
|
-
const s = E.parse(
|
|
1799
|
+
function h(E, l = "", y) {
|
|
1800
|
+
y !== !1 && (l = N(l));
|
|
1801
|
+
const s = E.parse(l);
|
|
1802
1802
|
return m(E, s);
|
|
1803
1803
|
}
|
|
1804
1804
|
le.getFullPath = h;
|
|
1805
|
-
function m(E,
|
|
1806
|
-
return E.serialize(
|
|
1805
|
+
function m(E, l) {
|
|
1806
|
+
return E.serialize(l).split("#")[0] + "#";
|
|
1807
1807
|
}
|
|
1808
1808
|
le._getFullPath = m;
|
|
1809
1809
|
const g = /#\/?$/;
|
|
@@ -1811,15 +1811,15 @@ function Ft() {
|
|
|
1811
1811
|
return E ? E.replace(g, "") : "";
|
|
1812
1812
|
}
|
|
1813
1813
|
le.normalizeId = N;
|
|
1814
|
-
function b(E,
|
|
1815
|
-
return y = N(y), E.resolve(
|
|
1814
|
+
function b(E, l, y) {
|
|
1815
|
+
return y = N(y), E.resolve(l, y);
|
|
1816
1816
|
}
|
|
1817
1817
|
le.resolveUrl = b;
|
|
1818
1818
|
const u = /^[a-z_][-a-z0-9._]*$/i;
|
|
1819
|
-
function v(E,
|
|
1819
|
+
function v(E, l) {
|
|
1820
1820
|
if (typeof E == "boolean")
|
|
1821
1821
|
return {};
|
|
1822
|
-
const { schemaId: y, uriResolver: s } = this.opts, p = N(E[y] ||
|
|
1822
|
+
const { schemaId: y, uriResolver: s } = this.opts, p = N(E[y] || l), w = { "": p }, d = h(s, p, !1), _ = {}, P = /* @__PURE__ */ new Set();
|
|
1823
1823
|
return r(E, { allKeys: !0 }, (U, A, L, K) => {
|
|
1824
1824
|
if (K === void 0)
|
|
1825
1825
|
return;
|
|
@@ -1859,7 +1859,7 @@ function Ze() {
|
|
|
1859
1859
|
const e = /* @__PURE__ */ Ls(), t = /* @__PURE__ */ zt(), r = /* @__PURE__ */ Jn(), n = /* @__PURE__ */ zt(), c = /* @__PURE__ */ Us(), a = /* @__PURE__ */ Ks(), o = /* @__PURE__ */ Bs(), i = /* @__PURE__ */ Y(), h = /* @__PURE__ */ Ne(), m = /* @__PURE__ */ Ft(), g = /* @__PURE__ */ X(), N = /* @__PURE__ */ Ye();
|
|
1860
1860
|
function b(R) {
|
|
1861
1861
|
if (d(R) && (P(R), w(R))) {
|
|
1862
|
-
|
|
1862
|
+
l(R);
|
|
1863
1863
|
return;
|
|
1864
1864
|
}
|
|
1865
1865
|
u(R, () => (0, e.topBoolOrEmptySchema)(R));
|
|
@@ -1880,7 +1880,7 @@ function Ze() {
|
|
|
1880
1880
|
R.var(h.default.instancePath, (0, i._)`""`), R.var(h.default.parentData, (0, i._)`undefined`), R.var(h.default.parentDataProperty, (0, i._)`undefined`), R.var(h.default.rootData, h.default.data), I.dynamicRef && R.var(h.default.dynamicAnchors, (0, i._)`{}`);
|
|
1881
1881
|
});
|
|
1882
1882
|
}
|
|
1883
|
-
function
|
|
1883
|
+
function l(R) {
|
|
1884
1884
|
const { schema: I, opts: V, gen: C } = R;
|
|
1885
1885
|
u(R, () => {
|
|
1886
1886
|
V.$comment && I.$comment && K(R), U(R), C.let(h.default.vErrors, null), C.let(h.default.errors, 0), V.unevaluated && y(R), T(R), B(R);
|
|
@@ -1992,7 +1992,7 @@ function Ze() {
|
|
|
1992
1992
|
}
|
|
1993
1993
|
I.forEach((V) => {
|
|
1994
1994
|
O(R.dataTypes, V) || S(R, `type "${V}" not allowed by context "${R.dataTypes.join(",")}"`);
|
|
1995
|
-
}),
|
|
1995
|
+
}), f(R, I);
|
|
1996
1996
|
}
|
|
1997
1997
|
}
|
|
1998
1998
|
function M(R, I) {
|
|
@@ -2014,7 +2014,7 @@ function Ze() {
|
|
|
2014
2014
|
function O(R, I) {
|
|
2015
2015
|
return R.includes(I) || I === "integer" && R.includes("number");
|
|
2016
2016
|
}
|
|
2017
|
-
function
|
|
2017
|
+
function f(R, I) {
|
|
2018
2018
|
const V = [];
|
|
2019
2019
|
for (const C of R.dataTypes)
|
|
2020
2020
|
O(I, C) ? V.push(C) : I.includes("integer") && C === "number" && V.push("integer");
|
|
@@ -2202,18 +2202,18 @@ function pr() {
|
|
|
2202
2202
|
}
|
|
2203
2203
|
}
|
|
2204
2204
|
me.SchemaEnv = o;
|
|
2205
|
-
function i(
|
|
2206
|
-
const y = g.call(this,
|
|
2205
|
+
function i(l) {
|
|
2206
|
+
const y = g.call(this, l);
|
|
2207
2207
|
if (y)
|
|
2208
2208
|
return y;
|
|
2209
|
-
const s = (0, n.getFullPath)(this.opts.uriResolver,
|
|
2209
|
+
const s = (0, n.getFullPath)(this.opts.uriResolver, l.root.baseId), { es5: p, lines: w } = this.opts.code, { ownProperties: d } = this.opts, _ = new e.CodeGen(this.scope, { es5: p, lines: w, ownProperties: d });
|
|
2210
2210
|
let P;
|
|
2211
|
-
|
|
2211
|
+
l.$async && (P = _.scopeValue("Error", {
|
|
2212
2212
|
ref: t.default,
|
|
2213
2213
|
code: (0, e._)`require("ajv/dist/runtime/validation_error").default`
|
|
2214
2214
|
}));
|
|
2215
2215
|
const T = _.scopeName("validate");
|
|
2216
|
-
|
|
2216
|
+
l.validateName = T;
|
|
2217
2217
|
const D = {
|
|
2218
2218
|
gen: _,
|
|
2219
2219
|
allErrors: this.opts.allErrors,
|
|
@@ -2226,26 +2226,26 @@ function pr() {
|
|
|
2226
2226
|
dataLevel: 0,
|
|
2227
2227
|
dataTypes: [],
|
|
2228
2228
|
definedProperties: /* @__PURE__ */ new Set(),
|
|
2229
|
-
topSchemaRef: _.scopeValue("schema", this.opts.code.source === !0 ? { ref:
|
|
2229
|
+
topSchemaRef: _.scopeValue("schema", this.opts.code.source === !0 ? { ref: l.schema, code: (0, e.stringify)(l.schema) } : { ref: l.schema }),
|
|
2230
2230
|
validateName: T,
|
|
2231
2231
|
ValidationError: P,
|
|
2232
|
-
schema:
|
|
2233
|
-
schemaEnv:
|
|
2232
|
+
schema: l.schema,
|
|
2233
|
+
schemaEnv: l,
|
|
2234
2234
|
rootId: s,
|
|
2235
|
-
baseId:
|
|
2235
|
+
baseId: l.baseId || s,
|
|
2236
2236
|
schemaPath: e.nil,
|
|
2237
|
-
errSchemaPath:
|
|
2237
|
+
errSchemaPath: l.schemaPath || (this.opts.jtd ? "" : "#"),
|
|
2238
2238
|
errorPath: (0, e._)`""`,
|
|
2239
2239
|
opts: this.opts,
|
|
2240
2240
|
self: this
|
|
2241
2241
|
};
|
|
2242
2242
|
let U;
|
|
2243
2243
|
try {
|
|
2244
|
-
this._compilations.add(
|
|
2244
|
+
this._compilations.add(l), (0, a.validateFunctionCode)(D), _.optimize(this.opts.code.optimize);
|
|
2245
2245
|
const A = _.toString();
|
|
2246
|
-
U = `${_.scopeRefs(r.default.scope)}return ${A}`, this.opts.code.process && (U = this.opts.code.process(U,
|
|
2246
|
+
U = `${_.scopeRefs(r.default.scope)}return ${A}`, this.opts.code.process && (U = this.opts.code.process(U, l));
|
|
2247
2247
|
const K = new Function(`${r.default.self}`, `${r.default.scope}`, U)(this, this.scope.get());
|
|
2248
|
-
if (this.scope.value(T, { ref: K }), K.errors = null, K.schema =
|
|
2248
|
+
if (this.scope.value(T, { ref: K }), K.errors = null, K.schema = l.schema, K.schemaEnv = l, l.$async && (K.$async = !0), this.opts.code.source === !0 && (K.source = { validateName: T, validateCode: A, scopeValues: _._values }), this.opts.unevaluated) {
|
|
2249
2249
|
const { props: B, items: x } = D;
|
|
2250
2250
|
K.evaluated = {
|
|
2251
2251
|
props: B instanceof e.Name ? void 0 : B,
|
|
@@ -2254,61 +2254,61 @@ function pr() {
|
|
|
2254
2254
|
dynamicItems: x instanceof e.Name
|
|
2255
2255
|
}, K.source && (K.source.evaluated = (0, e.stringify)(K.evaluated));
|
|
2256
2256
|
}
|
|
2257
|
-
return
|
|
2257
|
+
return l.validate = K, l;
|
|
2258
2258
|
} catch (A) {
|
|
2259
|
-
throw delete
|
|
2259
|
+
throw delete l.validate, delete l.validateName, U && this.logger.error("Error compiling schema, function code:", U), A;
|
|
2260
2260
|
} finally {
|
|
2261
|
-
this._compilations.delete(
|
|
2261
|
+
this._compilations.delete(l);
|
|
2262
2262
|
}
|
|
2263
2263
|
}
|
|
2264
2264
|
me.compileSchema = i;
|
|
2265
|
-
function h(
|
|
2265
|
+
function h(l, y, s) {
|
|
2266
2266
|
var p;
|
|
2267
2267
|
s = (0, n.resolveUrl)(this.opts.uriResolver, y, s);
|
|
2268
|
-
const w =
|
|
2268
|
+
const w = l.refs[s];
|
|
2269
2269
|
if (w)
|
|
2270
2270
|
return w;
|
|
2271
|
-
let d = b.call(this,
|
|
2271
|
+
let d = b.call(this, l, s);
|
|
2272
2272
|
if (d === void 0) {
|
|
2273
|
-
const _ = (p =
|
|
2274
|
-
_ && (d = new o({ schema: _, schemaId: P, root:
|
|
2273
|
+
const _ = (p = l.localRefs) === null || p === void 0 ? void 0 : p[s], { schemaId: P } = this.opts;
|
|
2274
|
+
_ && (d = new o({ schema: _, schemaId: P, root: l, baseId: y }));
|
|
2275
2275
|
}
|
|
2276
2276
|
if (d !== void 0)
|
|
2277
|
-
return
|
|
2277
|
+
return l.refs[s] = m.call(this, d);
|
|
2278
2278
|
}
|
|
2279
2279
|
me.resolveRef = h;
|
|
2280
|
-
function m(
|
|
2281
|
-
return (0, n.inlineRef)(
|
|
2280
|
+
function m(l) {
|
|
2281
|
+
return (0, n.inlineRef)(l.schema, this.opts.inlineRefs) ? l.schema : l.validate ? l : i.call(this, l);
|
|
2282
2282
|
}
|
|
2283
|
-
function g(
|
|
2283
|
+
function g(l) {
|
|
2284
2284
|
for (const y of this._compilations)
|
|
2285
|
-
if (N(y,
|
|
2285
|
+
if (N(y, l))
|
|
2286
2286
|
return y;
|
|
2287
2287
|
}
|
|
2288
2288
|
me.getCompilingSchema = g;
|
|
2289
|
-
function N(
|
|
2290
|
-
return
|
|
2289
|
+
function N(l, y) {
|
|
2290
|
+
return l.schema === y.schema && l.root === y.root && l.baseId === y.baseId;
|
|
2291
2291
|
}
|
|
2292
|
-
function b(
|
|
2292
|
+
function b(l, y) {
|
|
2293
2293
|
let s;
|
|
2294
2294
|
for (; typeof (s = this.refs[y]) == "string"; )
|
|
2295
2295
|
y = s;
|
|
2296
|
-
return s || this.schemas[y] || u.call(this,
|
|
2296
|
+
return s || this.schemas[y] || u.call(this, l, y);
|
|
2297
2297
|
}
|
|
2298
|
-
function u(
|
|
2298
|
+
function u(l, y) {
|
|
2299
2299
|
const s = this.opts.uriResolver.parse(y), p = (0, n._getFullPath)(this.opts.uriResolver, s);
|
|
2300
|
-
let w = (0, n.getFullPath)(this.opts.uriResolver,
|
|
2301
|
-
if (Object.keys(
|
|
2302
|
-
return E.call(this, s,
|
|
2300
|
+
let w = (0, n.getFullPath)(this.opts.uriResolver, l.baseId, void 0);
|
|
2301
|
+
if (Object.keys(l.schema).length > 0 && p === w)
|
|
2302
|
+
return E.call(this, s, l);
|
|
2303
2303
|
const d = (0, n.normalizeId)(p), _ = this.refs[d] || this.schemas[d];
|
|
2304
2304
|
if (typeof _ == "string") {
|
|
2305
|
-
const P = u.call(this,
|
|
2305
|
+
const P = u.call(this, l, _);
|
|
2306
2306
|
return typeof (P == null ? void 0 : P.schema) != "object" ? void 0 : E.call(this, s, P);
|
|
2307
2307
|
}
|
|
2308
2308
|
if (typeof (_ == null ? void 0 : _.schema) == "object") {
|
|
2309
2309
|
if (_.validate || i.call(this, _), d === (0, n.normalizeId)(y)) {
|
|
2310
2310
|
const { schema: P } = _, { schemaId: T } = this.opts, D = P[T];
|
|
2311
|
-
return D && (w = (0, n.resolveUrl)(this.opts.uriResolver, w, D)), new o({ schema: P, schemaId: T, root:
|
|
2311
|
+
return D && (w = (0, n.resolveUrl)(this.opts.uriResolver, w, D)), new o({ schema: P, schemaId: T, root: l, baseId: w });
|
|
2312
2312
|
}
|
|
2313
2313
|
return E.call(this, s, _);
|
|
2314
2314
|
}
|
|
@@ -2321,11 +2321,11 @@ function pr() {
|
|
|
2321
2321
|
"dependencies",
|
|
2322
2322
|
"definitions"
|
|
2323
2323
|
]);
|
|
2324
|
-
function E(
|
|
2324
|
+
function E(l, { baseId: y, schema: s, root: p }) {
|
|
2325
2325
|
var w;
|
|
2326
|
-
if (((w =
|
|
2326
|
+
if (((w = l.fragment) === null || w === void 0 ? void 0 : w[0]) !== "/")
|
|
2327
2327
|
return;
|
|
2328
|
-
for (const P of
|
|
2328
|
+
for (const P of l.fragment.slice(1).split("/")) {
|
|
2329
2329
|
if (typeof s == "boolean")
|
|
2330
2330
|
return;
|
|
2331
2331
|
const T = s[(0, c.unescapeFragment)(P)];
|
|
@@ -2392,13 +2392,13 @@ function Zn() {
|
|
|
2392
2392
|
}
|
|
2393
2393
|
function o(b) {
|
|
2394
2394
|
let u = 0;
|
|
2395
|
-
const v = { error: !1, address: "", zone: "" }, E = [],
|
|
2395
|
+
const v = { error: !1, address: "", zone: "" }, E = [], l = [];
|
|
2396
2396
|
let y = !1, s = !1, p = a;
|
|
2397
2397
|
for (let w = 0; w < b.length; w++) {
|
|
2398
2398
|
const d = b[w];
|
|
2399
2399
|
if (!(d === "[" || d === "]"))
|
|
2400
2400
|
if (d === ":") {
|
|
2401
|
-
if (y === !0 && (s = !0), !p(
|
|
2401
|
+
if (y === !0 && (s = !0), !p(l, E, v))
|
|
2402
2402
|
break;
|
|
2403
2403
|
if (++u > 7) {
|
|
2404
2404
|
v.error = !0;
|
|
@@ -2407,15 +2407,15 @@ function Zn() {
|
|
|
2407
2407
|
w > 0 && b[w - 1] === ":" && (y = !0), E.push(":");
|
|
2408
2408
|
continue;
|
|
2409
2409
|
} else if (d === "%") {
|
|
2410
|
-
if (!p(
|
|
2410
|
+
if (!p(l, E, v))
|
|
2411
2411
|
break;
|
|
2412
2412
|
p = c;
|
|
2413
2413
|
} else {
|
|
2414
|
-
|
|
2414
|
+
l.push(d);
|
|
2415
2415
|
continue;
|
|
2416
2416
|
}
|
|
2417
2417
|
}
|
|
2418
|
-
return
|
|
2418
|
+
return l.length && (p === c ? v.zone = l.join("") : s ? E.push(l.join("")) : E.push(r(l))), v.address = E.join(""), v;
|
|
2419
2419
|
}
|
|
2420
2420
|
function i(b) {
|
|
2421
2421
|
if (h(b, ":") < 2)
|
|
@@ -2437,9 +2437,9 @@ function Zn() {
|
|
|
2437
2437
|
function m(b) {
|
|
2438
2438
|
let u = b;
|
|
2439
2439
|
const v = [];
|
|
2440
|
-
let E = -1,
|
|
2441
|
-
for (;
|
|
2442
|
-
if (
|
|
2440
|
+
let E = -1, l = 0;
|
|
2441
|
+
for (; l = u.length; ) {
|
|
2442
|
+
if (l === 1) {
|
|
2443
2443
|
if (u === ".")
|
|
2444
2444
|
break;
|
|
2445
2445
|
if (u === "/") {
|
|
@@ -2449,7 +2449,7 @@ function Zn() {
|
|
|
2449
2449
|
v.push(u);
|
|
2450
2450
|
break;
|
|
2451
2451
|
}
|
|
2452
|
-
} else if (
|
|
2452
|
+
} else if (l === 2) {
|
|
2453
2453
|
if (u[0] === ".") {
|
|
2454
2454
|
if (u[1] === ".")
|
|
2455
2455
|
break;
|
|
@@ -2461,7 +2461,7 @@ function Zn() {
|
|
|
2461
2461
|
v.push("/");
|
|
2462
2462
|
break;
|
|
2463
2463
|
}
|
|
2464
|
-
} else if (
|
|
2464
|
+
} else if (l === 3 && u === "/..") {
|
|
2465
2465
|
v.length !== 0 && v.pop(), v.push("/");
|
|
2466
2466
|
break;
|
|
2467
2467
|
}
|
|
@@ -2613,7 +2613,7 @@ function xs() {
|
|
|
2613
2613
|
parse: i,
|
|
2614
2614
|
serialize: h
|
|
2615
2615
|
}
|
|
2616
|
-
),
|
|
2616
|
+
), l = (
|
|
2617
2617
|
/** @type {SchemeHandler} */
|
|
2618
2618
|
{
|
|
2619
2619
|
scheme: "wss",
|
|
@@ -2627,7 +2627,7 @@ function xs() {
|
|
|
2627
2627
|
http: u,
|
|
2628
2628
|
https: v,
|
|
2629
2629
|
ws: E,
|
|
2630
|
-
wss:
|
|
2630
|
+
wss: l,
|
|
2631
2631
|
urn: (
|
|
2632
2632
|
/** @type {SchemeHandler} */
|
|
2633
2633
|
{
|
|
@@ -2670,37 +2670,37 @@ function eo() {
|
|
|
2670
2670
|
if (Wr) return Be.exports;
|
|
2671
2671
|
Wr = 1;
|
|
2672
2672
|
const { normalizeIPv6: e, removeDotSegments: t, recomposeAuthority: r, normalizeComponentEncoding: n, isIPv4: c, nonSimpleDomain: a } = Zn(), { SCHEMES: o, getSchemeHandler: i } = xs();
|
|
2673
|
-
function h(
|
|
2674
|
-
return typeof
|
|
2675
|
-
b(v(
|
|
2676
|
-
v(b(
|
|
2673
|
+
function h(l, y) {
|
|
2674
|
+
return typeof l == "string" ? l = /** @type {T} */
|
|
2675
|
+
b(v(l, y), y) : typeof l == "object" && (l = /** @type {T} */
|
|
2676
|
+
v(b(l, y), y)), l;
|
|
2677
2677
|
}
|
|
2678
|
-
function m(
|
|
2679
|
-
const p = s ? Object.assign({ scheme: "null" }, s) : { scheme: "null" }, w = g(v(
|
|
2678
|
+
function m(l, y, s) {
|
|
2679
|
+
const p = s ? Object.assign({ scheme: "null" }, s) : { scheme: "null" }, w = g(v(l, p), v(y, p), p, !0);
|
|
2680
2680
|
return p.skipEscape = !0, b(w, p);
|
|
2681
2681
|
}
|
|
2682
|
-
function g(
|
|
2682
|
+
function g(l, y, s, p) {
|
|
2683
2683
|
const w = {};
|
|
2684
|
-
return p || (
|
|
2684
|
+
return p || (l = v(b(l, s), s), y = v(b(y, s), s)), s = s || {}, !s.tolerant && y.scheme ? (w.scheme = y.scheme, w.userinfo = y.userinfo, w.host = y.host, w.port = y.port, w.path = t(y.path || ""), w.query = y.query) : (y.userinfo !== void 0 || y.host !== void 0 || y.port !== void 0 ? (w.userinfo = y.userinfo, w.host = y.host, w.port = y.port, w.path = t(y.path || ""), w.query = y.query) : (y.path ? (y.path[0] === "/" ? w.path = t(y.path) : ((l.userinfo !== void 0 || l.host !== void 0 || l.port !== void 0) && !l.path ? w.path = "/" + y.path : l.path ? w.path = l.path.slice(0, l.path.lastIndexOf("/") + 1) + y.path : w.path = y.path, w.path = t(w.path)), w.query = y.query) : (w.path = l.path, y.query !== void 0 ? w.query = y.query : w.query = l.query), w.userinfo = l.userinfo, w.host = l.host, w.port = l.port), w.scheme = l.scheme), w.fragment = y.fragment, w;
|
|
2685
2685
|
}
|
|
2686
|
-
function N(
|
|
2687
|
-
return typeof
|
|
2686
|
+
function N(l, y, s) {
|
|
2687
|
+
return typeof l == "string" ? (l = unescape(l), l = b(n(v(l, s), !0), { ...s, skipEscape: !0 })) : typeof l == "object" && (l = b(n(l, !0), { ...s, skipEscape: !0 })), typeof y == "string" ? (y = unescape(y), y = b(n(v(y, s), !0), { ...s, skipEscape: !0 })) : typeof y == "object" && (y = b(n(y, !0), { ...s, skipEscape: !0 })), l.toLowerCase() === y.toLowerCase();
|
|
2688
2688
|
}
|
|
2689
|
-
function b(
|
|
2689
|
+
function b(l, y) {
|
|
2690
2690
|
const s = {
|
|
2691
|
-
host:
|
|
2692
|
-
scheme:
|
|
2693
|
-
userinfo:
|
|
2694
|
-
port:
|
|
2695
|
-
path:
|
|
2696
|
-
query:
|
|
2697
|
-
nid:
|
|
2698
|
-
nss:
|
|
2699
|
-
uuid:
|
|
2700
|
-
fragment:
|
|
2701
|
-
reference:
|
|
2702
|
-
resourceName:
|
|
2703
|
-
secure:
|
|
2691
|
+
host: l.host,
|
|
2692
|
+
scheme: l.scheme,
|
|
2693
|
+
userinfo: l.userinfo,
|
|
2694
|
+
port: l.port,
|
|
2695
|
+
path: l.path,
|
|
2696
|
+
query: l.query,
|
|
2697
|
+
nid: l.nid,
|
|
2698
|
+
nss: l.nss,
|
|
2699
|
+
uuid: l.uuid,
|
|
2700
|
+
fragment: l.fragment,
|
|
2701
|
+
reference: l.reference,
|
|
2702
|
+
resourceName: l.resourceName,
|
|
2703
|
+
secure: l.secure,
|
|
2704
2704
|
error: ""
|
|
2705
2705
|
}, p = Object.assign({}, y), w = [], d = i(p.scheme || s.scheme);
|
|
2706
2706
|
d && d.serialize && d.serialize(s, p), s.path !== void 0 && (p.skipEscape ? s.path = unescape(s.path) : (s.path = escape(s.path), s.scheme !== void 0 && (s.path = s.path.split("%3A").join(":")))), p.reference !== "suffix" && s.scheme && w.push(s.scheme, ":");
|
|
@@ -2712,7 +2712,7 @@ function eo() {
|
|
|
2712
2712
|
return s.query !== void 0 && w.push("?", s.query), s.fragment !== void 0 && w.push("#", s.fragment), w.join("");
|
|
2713
2713
|
}
|
|
2714
2714
|
const u = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
2715
|
-
function v(
|
|
2715
|
+
function v(l, y) {
|
|
2716
2716
|
const s = Object.assign({}, y), p = {
|
|
2717
2717
|
scheme: void 0,
|
|
2718
2718
|
userinfo: void 0,
|
|
@@ -2723,8 +2723,8 @@ function eo() {
|
|
|
2723
2723
|
fragment: void 0
|
|
2724
2724
|
};
|
|
2725
2725
|
let w = !1;
|
|
2726
|
-
s.reference === "suffix" && (s.scheme ?
|
|
2727
|
-
const d =
|
|
2726
|
+
s.reference === "suffix" && (s.scheme ? l = s.scheme + ":" + l : l = "//" + l);
|
|
2727
|
+
const d = l.match(u);
|
|
2728
2728
|
if (d) {
|
|
2729
2729
|
if (p.scheme = d[1], p.userinfo = d[3], p.host = d[4], p.port = parseInt(d[5], 10), p.path = d[6] || "", p.query = d[7], p.fragment = d[8], isNaN(p.port) && (p.port = d[5]), p.host)
|
|
2730
2730
|
if (c(p.host) === !1) {
|
|
@@ -2740,7 +2740,7 @@ function eo() {
|
|
|
2740
2740
|
} catch (P) {
|
|
2741
2741
|
p.error = p.error || "Host's domain name can not be converted to ASCII: " + P;
|
|
2742
2742
|
}
|
|
2743
|
-
(!_ || _ && !_.skipNormalize) && (
|
|
2743
|
+
(!_ || _ && !_.skipNormalize) && (l.indexOf("%") !== -1 && (p.scheme !== void 0 && (p.scheme = unescape(p.scheme)), p.host !== void 0 && (p.host = unescape(p.host))), p.path && (p.path = escape(unescape(p.path))), p.fragment && (p.fragment = encodeURI(decodeURIComponent(p.fragment)))), _ && _.parse && _.parse(p, s);
|
|
2744
2744
|
} else
|
|
2745
2745
|
p.error = p.error || "URI can not be parsed.";
|
|
2746
2746
|
return p;
|
|
@@ -2801,7 +2801,7 @@ function ro() {
|
|
|
2801
2801
|
"func",
|
|
2802
2802
|
"obj",
|
|
2803
2803
|
"Error"
|
|
2804
|
-
]),
|
|
2804
|
+
]), l = {
|
|
2805
2805
|
errorDataPath: "",
|
|
2806
2806
|
format: "`validateFormats: false` can be used instead.",
|
|
2807
2807
|
nullable: '"nullable" keyword is supported by default.',
|
|
@@ -2823,8 +2823,8 @@ function ro() {
|
|
|
2823
2823
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
2824
2824
|
}, s = 200;
|
|
2825
2825
|
function p(M) {
|
|
2826
|
-
var j, k, O,
|
|
2827
|
-
const Le = M.strict, Ht = (j = M.code) === null || j === void 0 ? void 0 : j.optimize, gr = Ht === !0 || Ht === void 0 ? 1 : Ht || 0, vr = (O = (k = M.code) === null || k === void 0 ? void 0 : k.regExp) !== null && O !== void 0 ? O : u, qs = (
|
|
2826
|
+
var j, k, O, f, S, q, F, z, H, G, R, I, V, C, W, Q, ae, ge, fe, pe, ie, Me, ye, Kt, Bt;
|
|
2827
|
+
const Le = M.strict, Ht = (j = M.code) === null || j === void 0 ? void 0 : j.optimize, gr = Ht === !0 || Ht === void 0 ? 1 : Ht || 0, vr = (O = (k = M.code) === null || k === void 0 ? void 0 : k.regExp) !== null && O !== void 0 ? O : u, qs = (f = M.uriResolver) !== null && f !== void 0 ? f : b.default;
|
|
2828
2828
|
return {
|
|
2829
2829
|
strictSchema: (q = (S = M.strictSchema) !== null && S !== void 0 ? S : Le) !== null && q !== void 0 ? q : !0,
|
|
2830
2830
|
strictNumbers: (z = (F = M.strictNumbers) !== null && F !== void 0 ? F : Le) !== null && z !== void 0 ? z : !0,
|
|
@@ -2851,16 +2851,16 @@ function ro() {
|
|
|
2851
2851
|
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), j = this.opts = { ...j, ...p(j) };
|
|
2852
2852
|
const { es5: k, lines: O } = this.opts.code;
|
|
2853
2853
|
this.scope = new i.ValueScope({ scope: {}, prefixes: E, es5: k, lines: O }), this.logger = L(j.logger);
|
|
2854
|
-
const
|
|
2855
|
-
j.validateFormats = !1, this.RULES = (0, a.getRules)(), d.call(this,
|
|
2854
|
+
const f = j.validateFormats;
|
|
2855
|
+
j.validateFormats = !1, this.RULES = (0, a.getRules)(), d.call(this, l, j, "NOT SUPPORTED"), d.call(this, y, j, "DEPRECATED", "warn"), this._metaOpts = U.call(this), j.formats && T.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), j.keywords && D.call(this, j.keywords), typeof j.meta == "object" && this.addMetaSchema(j.meta), P.call(this), j.validateFormats = f;
|
|
2856
2856
|
}
|
|
2857
2857
|
_addVocabularies() {
|
|
2858
2858
|
this.addKeyword("$async");
|
|
2859
2859
|
}
|
|
2860
2860
|
_addDefaultMetaSchema() {
|
|
2861
2861
|
const { $data: j, meta: k, schemaId: O } = this.opts;
|
|
2862
|
-
let
|
|
2863
|
-
O === "id" && (
|
|
2862
|
+
let f = N;
|
|
2863
|
+
O === "id" && (f = { ...N }, f.id = f.$id, delete f.$id), k && j && this.addMetaSchema(f, f[O], !1);
|
|
2864
2864
|
}
|
|
2865
2865
|
defaultMeta() {
|
|
2866
2866
|
const { meta: j, schemaId: k } = this.opts;
|
|
@@ -2873,8 +2873,8 @@ function ro() {
|
|
|
2873
2873
|
throw new Error(`no schema with key or ref "${j}"`);
|
|
2874
2874
|
} else
|
|
2875
2875
|
O = this.compile(j);
|
|
2876
|
-
const
|
|
2877
|
-
return "$async" in O || (this.errors = O.errors),
|
|
2876
|
+
const f = O(k);
|
|
2877
|
+
return "$async" in O || (this.errors = O.errors), f;
|
|
2878
2878
|
}
|
|
2879
2879
|
compile(j, k) {
|
|
2880
2880
|
const O = this._addSchema(j, k);
|
|
@@ -2884,14 +2884,14 @@ function ro() {
|
|
|
2884
2884
|
if (typeof this.opts.loadSchema != "function")
|
|
2885
2885
|
throw new Error("options.loadSchema should be a function");
|
|
2886
2886
|
const { loadSchema: O } = this.opts;
|
|
2887
|
-
return
|
|
2888
|
-
async function
|
|
2887
|
+
return f.call(this, j, k);
|
|
2888
|
+
async function f(G, R) {
|
|
2889
2889
|
await S.call(this, G.$schema);
|
|
2890
2890
|
const I = this._addSchema(G, R);
|
|
2891
2891
|
return I.validate || q.call(this, I);
|
|
2892
2892
|
}
|
|
2893
2893
|
async function S(G) {
|
|
2894
|
-
G && !this.getSchema(G) && await
|
|
2894
|
+
G && !this.getSchema(G) && await f.call(this, { $ref: G }, !0);
|
|
2895
2895
|
}
|
|
2896
2896
|
async function q(G) {
|
|
2897
2897
|
try {
|
|
@@ -2922,10 +2922,10 @@ function ro() {
|
|
|
2922
2922
|
}
|
|
2923
2923
|
}
|
|
2924
2924
|
// Adds schema to the instance
|
|
2925
|
-
addSchema(j, k, O,
|
|
2925
|
+
addSchema(j, k, O, f = this.opts.validateSchema) {
|
|
2926
2926
|
if (Array.isArray(j)) {
|
|
2927
2927
|
for (const q of j)
|
|
2928
|
-
this.addSchema(q, void 0, O,
|
|
2928
|
+
this.addSchema(q, void 0, O, f);
|
|
2929
2929
|
return this;
|
|
2930
2930
|
}
|
|
2931
2931
|
let S;
|
|
@@ -2934,7 +2934,7 @@ function ro() {
|
|
|
2934
2934
|
if (S = j[q], S !== void 0 && typeof S != "string")
|
|
2935
2935
|
throw new Error(`schema ${q} must be string`);
|
|
2936
2936
|
}
|
|
2937
|
-
return k = (0, h.normalizeId)(k || S), this._checkUnique(k), this.schemas[k] = this._addSchema(j, O, k,
|
|
2937
|
+
return k = (0, h.normalizeId)(k || S), this._checkUnique(k), this.schemas[k] = this._addSchema(j, O, k, f, !0), this;
|
|
2938
2938
|
}
|
|
2939
2939
|
// Add schema that will be used to validate other schemas
|
|
2940
2940
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
@@ -2950,15 +2950,15 @@ function ro() {
|
|
|
2950
2950
|
throw new Error("$schema must be a string");
|
|
2951
2951
|
if (O = O || this.opts.defaultMeta || this.defaultMeta(), !O)
|
|
2952
2952
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
2953
|
-
const
|
|
2954
|
-
if (!
|
|
2953
|
+
const f = this.validate(O, j);
|
|
2954
|
+
if (!f && k) {
|
|
2955
2955
|
const S = "schema is invalid: " + this.errorsText();
|
|
2956
2956
|
if (this.opts.validateSchema === "log")
|
|
2957
2957
|
this.logger.error(S);
|
|
2958
2958
|
else
|
|
2959
2959
|
throw new Error(S);
|
|
2960
2960
|
}
|
|
2961
|
-
return
|
|
2961
|
+
return f;
|
|
2962
2962
|
}
|
|
2963
2963
|
// Get compiled schema by `key` or `ref`.
|
|
2964
2964
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
@@ -2967,8 +2967,8 @@ function ro() {
|
|
|
2967
2967
|
for (; typeof (k = _.call(this, j)) == "string"; )
|
|
2968
2968
|
j = k;
|
|
2969
2969
|
if (k === void 0) {
|
|
2970
|
-
const { schemaId: O } = this.opts,
|
|
2971
|
-
if (k = o.resolveSchema.call(this,
|
|
2970
|
+
const { schemaId: O } = this.opts, f = new o.SchemaEnv({ schema: {}, schemaId: O });
|
|
2971
|
+
if (k = o.resolveSchema.call(this, f, j), !k)
|
|
2972
2972
|
return;
|
|
2973
2973
|
this.refs[j] = k;
|
|
2974
2974
|
}
|
|
@@ -3016,12 +3016,12 @@ function ro() {
|
|
|
3016
3016
|
if (B.call(this, O, k), !k)
|
|
3017
3017
|
return (0, g.eachItem)(O, (S) => x.call(this, S)), this;
|
|
3018
3018
|
oe.call(this, k);
|
|
3019
|
-
const
|
|
3019
|
+
const f = {
|
|
3020
3020
|
...k,
|
|
3021
3021
|
type: (0, m.getJSONTypes)(k.type),
|
|
3022
3022
|
schemaType: (0, m.getJSONTypes)(k.schemaType)
|
|
3023
3023
|
};
|
|
3024
|
-
return (0, g.eachItem)(O,
|
|
3024
|
+
return (0, g.eachItem)(O, f.type.length === 0 ? (S) => x.call(this, S, f) : (S) => f.type.forEach((q) => x.call(this, S, f, q))), this;
|
|
3025
3025
|
}
|
|
3026
3026
|
getKeyword(j) {
|
|
3027
3027
|
const k = this.RULES.all[j];
|
|
@@ -3032,8 +3032,8 @@ function ro() {
|
|
|
3032
3032
|
const { RULES: k } = this;
|
|
3033
3033
|
delete k.keywords[j], delete k.all[j];
|
|
3034
3034
|
for (const O of k.rules) {
|
|
3035
|
-
const
|
|
3036
|
-
|
|
3035
|
+
const f = O.rules.findIndex((S) => S.keyword === j);
|
|
3036
|
+
f >= 0 && O.rules.splice(f, 1);
|
|
3037
3037
|
}
|
|
3038
3038
|
return this;
|
|
3039
3039
|
}
|
|
@@ -3042,13 +3042,13 @@ function ro() {
|
|
|
3042
3042
|
return typeof k == "string" && (k = new RegExp(k)), this.formats[j] = k, this;
|
|
3043
3043
|
}
|
|
3044
3044
|
errorsText(j = this.errors, { separator: k = ", ", dataVar: O = "data" } = {}) {
|
|
3045
|
-
return !j || j.length === 0 ? "No errors" : j.map((
|
|
3045
|
+
return !j || j.length === 0 ? "No errors" : j.map((f) => `${O}${f.instancePath} ${f.message}`).reduce((f, S) => f + k + S);
|
|
3046
3046
|
}
|
|
3047
3047
|
$dataMetaSchema(j, k) {
|
|
3048
3048
|
const O = this.RULES.all;
|
|
3049
3049
|
j = JSON.parse(JSON.stringify(j));
|
|
3050
|
-
for (const
|
|
3051
|
-
const S =
|
|
3050
|
+
for (const f of k) {
|
|
3051
|
+
const S = f.split("/").slice(1);
|
|
3052
3052
|
let q = j;
|
|
3053
3053
|
for (const F of S)
|
|
3054
3054
|
q = q[F];
|
|
@@ -3064,11 +3064,11 @@ function ro() {
|
|
|
3064
3064
|
}
|
|
3065
3065
|
_removeAllSchemas(j, k) {
|
|
3066
3066
|
for (const O in j) {
|
|
3067
|
-
const
|
|
3068
|
-
(!k || k.test(O)) && (typeof
|
|
3067
|
+
const f = j[O];
|
|
3068
|
+
(!k || k.test(O)) && (typeof f == "string" ? delete j[O] : f && !f.meta && (this._cache.delete(f.schema), delete j[O]));
|
|
3069
3069
|
}
|
|
3070
3070
|
}
|
|
3071
|
-
_addSchema(j, k, O,
|
|
3071
|
+
_addSchema(j, k, O, f = this.opts.validateSchema, S = this.opts.addUsedSchema) {
|
|
3072
3072
|
let q;
|
|
3073
3073
|
const { schemaId: F } = this.opts;
|
|
3074
3074
|
if (typeof j == "object")
|
|
@@ -3084,7 +3084,7 @@ function ro() {
|
|
|
3084
3084
|
return z;
|
|
3085
3085
|
O = (0, h.normalizeId)(q || O);
|
|
3086
3086
|
const H = h.getSchemaRefs.call(this, j, O);
|
|
3087
|
-
return z = new o.SchemaEnv({ schema: j, schemaId: F, meta: k, baseId: O, localRefs: H }), this._cache.set(z.schema, z), S && !O.startsWith("#") && (O && this._checkUnique(O), this.refs[O] = z),
|
|
3087
|
+
return z = new o.SchemaEnv({ schema: j, schemaId: F, meta: k, baseId: O, localRefs: H }), this._cache.set(z.schema, z), S && !O.startsWith("#") && (O && this._checkUnique(O), this.refs[O] = z), f && this.validateSchema(j, !0), z;
|
|
3088
3088
|
}
|
|
3089
3089
|
_checkUnique(j) {
|
|
3090
3090
|
if (this.schemas[j] || this.refs[j])
|
|
@@ -3107,9 +3107,9 @@ function ro() {
|
|
|
3107
3107
|
}
|
|
3108
3108
|
w.ValidationError = n.default, w.MissingRefError = c.default, e.default = w;
|
|
3109
3109
|
function d(M, j, k, O = "error") {
|
|
3110
|
-
for (const
|
|
3111
|
-
const S =
|
|
3112
|
-
S in j && this.logger[O](`${k}: option ${
|
|
3110
|
+
for (const f in M) {
|
|
3111
|
+
const S = f;
|
|
3112
|
+
S in j && this.logger[O](`${k}: option ${f}. ${M[S]}`);
|
|
3113
3113
|
}
|
|
3114
3114
|
}
|
|
3115
3115
|
function _(M) {
|
|
@@ -3173,11 +3173,11 @@ function ro() {
|
|
|
3173
3173
|
}
|
|
3174
3174
|
function x(M, j, k) {
|
|
3175
3175
|
var O;
|
|
3176
|
-
const
|
|
3177
|
-
if (k &&
|
|
3176
|
+
const f = j == null ? void 0 : j.post;
|
|
3177
|
+
if (k && f)
|
|
3178
3178
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
3179
3179
|
const { RULES: S } = this;
|
|
3180
|
-
let q =
|
|
3180
|
+
let q = f ? S.post : S.rules.find(({ type: z }) => z === k);
|
|
3181
3181
|
if (q || (q = { type: k, rules: [] }, S.rules.push(q)), S.keywords[M] = !0, !j)
|
|
3182
3182
|
return;
|
|
3183
3183
|
const F = {
|
|
@@ -3191,7 +3191,7 @@ function ro() {
|
|
|
3191
3191
|
j.before ? se.call(this, q, F, j.before) : q.rules.push(F), S.all[M] = F, (O = j.implements) === null || O === void 0 || O.forEach((z) => this.addKeyword(z));
|
|
3192
3192
|
}
|
|
3193
3193
|
function se(M, j, k) {
|
|
3194
|
-
const O = M.rules.findIndex((
|
|
3194
|
+
const O = M.rules.findIndex((f) => f.keyword === k);
|
|
3195
3195
|
O >= 0 ? M.rules.splice(O, 0, j) : (M.rules.push(j), this.logger.warn(`rule ${k} is not defined`));
|
|
3196
3196
|
}
|
|
3197
3197
|
function oe(M) {
|
|
@@ -3226,7 +3226,7 @@ function so() {
|
|
|
3226
3226
|
keyword: "$ref",
|
|
3227
3227
|
schemaType: "string",
|
|
3228
3228
|
code(m) {
|
|
3229
|
-
const { gen: g, schema: N, it: b } = m, { baseId: u, schemaEnv: v, validateName: E, opts:
|
|
3229
|
+
const { gen: g, schema: N, it: b } = m, { baseId: u, schemaEnv: v, validateName: E, opts: l, self: y } = b, { root: s } = v;
|
|
3230
3230
|
if ((N === "#" || N === "#/") && u === s.baseId)
|
|
3231
3231
|
return w();
|
|
3232
3232
|
const p = c.resolveRef.call(y, s, u, N);
|
|
@@ -3246,7 +3246,7 @@ function so() {
|
|
|
3246
3246
|
h(m, T, P, P.$async);
|
|
3247
3247
|
}
|
|
3248
3248
|
function _(P) {
|
|
3249
|
-
const T = g.scopeValue("schema",
|
|
3249
|
+
const T = g.scopeValue("schema", l.code.source === !0 ? { ref: P, code: (0, r.stringify)(P) } : { ref: P }), D = g.name("valid"), U = m.subschema({
|
|
3250
3250
|
schema: P,
|
|
3251
3251
|
dataTypes: [],
|
|
3252
3252
|
schemaPath: r.nil,
|
|
@@ -3263,10 +3263,10 @@ function so() {
|
|
|
3263
3263
|
}
|
|
3264
3264
|
Re.getValidate = i;
|
|
3265
3265
|
function h(m, g, N, b) {
|
|
3266
|
-
const { gen: u, it: v } = m, { allErrors: E, schemaEnv:
|
|
3266
|
+
const { gen: u, it: v } = m, { allErrors: E, schemaEnv: l, opts: y } = v, s = y.passContext ? n.default.this : r.nil;
|
|
3267
3267
|
b ? p() : w();
|
|
3268
3268
|
function p() {
|
|
3269
|
-
if (!
|
|
3269
|
+
if (!l.$async)
|
|
3270
3270
|
throw new Error("async schema referenced by sync schema");
|
|
3271
3271
|
const P = u.let("valid");
|
|
3272
3272
|
u.try(() => {
|
|
@@ -3479,7 +3479,7 @@ function po() {
|
|
|
3479
3479
|
}
|
|
3480
3480
|
function v() {
|
|
3481
3481
|
if (u || g)
|
|
3482
|
-
a.block$data(t.nil,
|
|
3482
|
+
a.block$data(t.nil, l);
|
|
3483
3483
|
else
|
|
3484
3484
|
for (const s of i)
|
|
3485
3485
|
(0, e.checkReportMissingProp)(a, s);
|
|
@@ -3492,7 +3492,7 @@ function po() {
|
|
|
3492
3492
|
} else
|
|
3493
3493
|
o.if((0, e.checkMissingProp)(a, i, s)), (0, e.reportMissingProp)(a, s), o.else();
|
|
3494
3494
|
}
|
|
3495
|
-
function
|
|
3495
|
+
function l() {
|
|
3496
3496
|
o.forOf("prop", h, (s) => {
|
|
3497
3497
|
a.setParams({ missingProperty: s }), o.if((0, e.noPropertyInData)(o, m, s, b.ownProperties), () => a.error());
|
|
3498
3498
|
});
|
|
@@ -3556,8 +3556,8 @@ function mo() {
|
|
|
3556
3556
|
if (!m && !g)
|
|
3557
3557
|
return;
|
|
3558
3558
|
const v = i.let("valid"), E = N.items ? (0, e.getSchemaTypes)(N.items) : [];
|
|
3559
|
-
o.block$data(v,
|
|
3560
|
-
function
|
|
3559
|
+
o.block$data(v, l, (0, t._)`${b} === false`), o.ok(v);
|
|
3560
|
+
function l() {
|
|
3561
3561
|
const w = i.let("i", (0, t._)`${h}.length`), d = i.let("j");
|
|
3562
3562
|
o.setParams({ i: w, j: d }), i.assign(v, !0), i.if((0, t._)`${w} > 1`, () => (y() ? s : p)(w, d));
|
|
3563
3563
|
}
|
|
@@ -3621,7 +3621,7 @@ function go() {
|
|
|
3621
3621
|
const v = () => u ?? (u = (0, t.useFunc)(o, r.default));
|
|
3622
3622
|
let E;
|
|
3623
3623
|
if (b || h)
|
|
3624
|
-
E = o.let("valid"), a.block$data(E,
|
|
3624
|
+
E = o.let("valid"), a.block$data(E, l);
|
|
3625
3625
|
else {
|
|
3626
3626
|
if (!Array.isArray(m))
|
|
3627
3627
|
throw new Error("ajv implementation error");
|
|
@@ -3629,7 +3629,7 @@ function go() {
|
|
|
3629
3629
|
E = (0, e.or)(...m.map((p, w) => y(s, w)));
|
|
3630
3630
|
}
|
|
3631
3631
|
a.pass(E);
|
|
3632
|
-
function
|
|
3632
|
+
function l() {
|
|
3633
3633
|
o.assign(E, !1), o.forOf("v", g, (s) => o.if((0, e._)`${v()}(${i}, ${s})`, () => o.assign(E, !0).break()));
|
|
3634
3634
|
}
|
|
3635
3635
|
function y(s, p) {
|
|
@@ -3725,15 +3725,15 @@ function Xn() {
|
|
|
3725
3725
|
const { gen: h, parentSchema: m, data: g, keyword: N, it: b } = a;
|
|
3726
3726
|
E(m), b.opts.unevaluated && i.length && b.items !== !0 && (b.items = t.mergeEvaluated.items(h, i.length, b.items));
|
|
3727
3727
|
const u = h.name("valid"), v = h.const("len", (0, e._)`${g}.length`);
|
|
3728
|
-
i.forEach((
|
|
3729
|
-
(0, t.alwaysValidSchema)(b,
|
|
3728
|
+
i.forEach((l, y) => {
|
|
3729
|
+
(0, t.alwaysValidSchema)(b, l) || (h.if((0, e._)`${v} > ${y}`, () => a.subschema({
|
|
3730
3730
|
keyword: N,
|
|
3731
3731
|
schemaProp: y,
|
|
3732
3732
|
dataProp: y
|
|
3733
3733
|
}, u)), a.ok(u));
|
|
3734
3734
|
});
|
|
3735
|
-
function E(
|
|
3736
|
-
const { opts: y, errSchemaPath: s } = b, p = i.length, w = p ===
|
|
3735
|
+
function E(l) {
|
|
3736
|
+
const { opts: y, errSchemaPath: s } = b, p = i.length, w = p === l.minItems && (p === l.maxItems || l[o] === !1);
|
|
3737
3737
|
if (y.strictTuples && !w) {
|
|
3738
3738
|
const d = `"${N}" is ${p}-tuple, but minItems or maxItems/${o} are not specified or different at path "${s}"`;
|
|
3739
3739
|
(0, t.checkStrictMode)(b, d, y.strictTuples);
|
|
@@ -3810,8 +3810,8 @@ function bo() {
|
|
|
3810
3810
|
}
|
|
3811
3811
|
m.items = !0;
|
|
3812
3812
|
const E = a.name("valid");
|
|
3813
|
-
N === void 0 && g === 1 ? y(E, () => a.if(E, () => a.break())) : g === 0 ? (a.let(E, !0), N !== void 0 && a.if((0, e._)`${h}.length > 0`,
|
|
3814
|
-
function
|
|
3813
|
+
N === void 0 && g === 1 ? y(E, () => a.if(E, () => a.break())) : g === 0 ? (a.let(E, !0), N !== void 0 && a.if((0, e._)`${h}.length > 0`, l)) : (a.let(E, !1), l()), c.result(E, () => c.reset());
|
|
3814
|
+
function l() {
|
|
3815
3815
|
const p = a.name("_valid"), w = a.let("count", 0);
|
|
3816
3816
|
y(p, () => a.if(p, () => s(w)));
|
|
3817
3817
|
}
|
|
@@ -3877,15 +3877,15 @@ function wo() {
|
|
|
3877
3877
|
const E = m[v];
|
|
3878
3878
|
if (E.length === 0)
|
|
3879
3879
|
continue;
|
|
3880
|
-
const
|
|
3880
|
+
const l = (0, n.propertyInData)(g, N, v, b.opts.ownProperties);
|
|
3881
3881
|
h.setParams({
|
|
3882
3882
|
property: v,
|
|
3883
3883
|
depsCount: E.length,
|
|
3884
3884
|
deps: E.join(", ")
|
|
3885
|
-
}), b.allErrors ? g.if(
|
|
3885
|
+
}), b.allErrors ? g.if(l, () => {
|
|
3886
3886
|
for (const y of E)
|
|
3887
3887
|
(0, n.checkReportMissingProp)(h, y);
|
|
3888
|
-
}) : (g.if((0, t._)`${
|
|
3888
|
+
}) : (g.if((0, t._)`${l} && (${(0, n.checkMissingProp)(h, E, u)})`), (0, n.reportMissingProp)(h, u), g.else());
|
|
3889
3889
|
}
|
|
3890
3890
|
}
|
|
3891
3891
|
e.validatePropertyDeps = o;
|
|
@@ -3895,8 +3895,8 @@ function wo() {
|
|
|
3895
3895
|
(0, r.alwaysValidSchema)(u, m[E]) || (g.if(
|
|
3896
3896
|
(0, n.propertyInData)(g, N, E, u.opts.ownProperties),
|
|
3897
3897
|
() => {
|
|
3898
|
-
const
|
|
3899
|
-
h.mergeValidEvaluated(
|
|
3898
|
+
const l = h.subschema({ keyword: b, schemaProp: E }, v);
|
|
3899
|
+
h.mergeValidEvaluated(l, v);
|
|
3900
3900
|
},
|
|
3901
3901
|
() => g.var(v, !0)
|
|
3902
3902
|
// TODO var
|
|
@@ -3958,11 +3958,11 @@ function xn() {
|
|
|
3958
3958
|
const { allErrors: u, opts: v } = b;
|
|
3959
3959
|
if (b.props = !0, v.removeAdditional !== "all" && (0, n.alwaysValidSchema)(b, h))
|
|
3960
3960
|
return;
|
|
3961
|
-
const E = (0, e.allSchemaProperties)(m.properties),
|
|
3961
|
+
const E = (0, e.allSchemaProperties)(m.properties), l = (0, e.allSchemaProperties)(m.patternProperties);
|
|
3962
3962
|
y(), o.ok((0, t._)`${N} === ${r.default.errors}`);
|
|
3963
3963
|
function y() {
|
|
3964
3964
|
i.forIn("key", g, (_) => {
|
|
3965
|
-
!E.length && !
|
|
3965
|
+
!E.length && !l.length ? w(_) : i.if(s(_), () => w(_));
|
|
3966
3966
|
});
|
|
3967
3967
|
}
|
|
3968
3968
|
function s(_) {
|
|
@@ -3971,7 +3971,7 @@ function xn() {
|
|
|
3971
3971
|
const T = (0, n.schemaRefOrVal)(b, m.properties, "properties");
|
|
3972
3972
|
P = (0, e.isOwnProperty)(i, T, _);
|
|
3973
3973
|
} else E.length ? P = (0, t.or)(...E.map((T) => (0, t._)`${_} === ${T}`)) : P = t.nil;
|
|
3974
|
-
return
|
|
3974
|
+
return l.length && (P = (0, t.or)(P, ...l.map((T) => (0, t._)`${(0, e.usePattern)(o, T)}.test(${_})`))), (0, t.not)(P);
|
|
3975
3975
|
}
|
|
3976
3976
|
function p(_) {
|
|
3977
3977
|
i.code((0, t._)`delete ${g}[${_}]`);
|
|
@@ -4020,23 +4020,23 @@ function So() {
|
|
|
4020
4020
|
const { gen: o, schema: i, parentSchema: h, data: m, it: g } = a;
|
|
4021
4021
|
g.opts.removeAdditional === "all" && h.additionalProperties === void 0 && n.default.code(new e.KeywordCxt(g, n.default, "additionalProperties"));
|
|
4022
4022
|
const N = (0, t.allSchemaProperties)(i);
|
|
4023
|
-
for (const
|
|
4024
|
-
g.definedProperties.add(
|
|
4023
|
+
for (const l of N)
|
|
4024
|
+
g.definedProperties.add(l);
|
|
4025
4025
|
g.opts.unevaluated && N.length && g.props !== !0 && (g.props = r.mergeEvaluated.props(o, (0, r.toHash)(N), g.props));
|
|
4026
|
-
const b = N.filter((
|
|
4026
|
+
const b = N.filter((l) => !(0, r.alwaysValidSchema)(g, i[l]));
|
|
4027
4027
|
if (b.length === 0)
|
|
4028
4028
|
return;
|
|
4029
4029
|
const u = o.name("valid");
|
|
4030
|
-
for (const
|
|
4031
|
-
v(
|
|
4032
|
-
function v(
|
|
4033
|
-
return g.opts.useDefaults && !g.compositeRule && i[
|
|
4030
|
+
for (const l of b)
|
|
4031
|
+
v(l) ? E(l) : (o.if((0, t.propertyInData)(o, m, l, g.opts.ownProperties)), E(l), g.allErrors || o.else().var(u, !0), o.endIf()), a.it.definedProperties.add(l), a.ok(u);
|
|
4032
|
+
function v(l) {
|
|
4033
|
+
return g.opts.useDefaults && !g.compositeRule && i[l].default !== void 0;
|
|
4034
4034
|
}
|
|
4035
|
-
function E(
|
|
4035
|
+
function E(l) {
|
|
4036
4036
|
a.subschema({
|
|
4037
4037
|
keyword: "properties",
|
|
4038
|
-
schemaProp:
|
|
4039
|
-
dataProp:
|
|
4038
|
+
schemaProp: l,
|
|
4039
|
+
dataProp: l
|
|
4040
4040
|
}, u);
|
|
4041
4041
|
}
|
|
4042
4042
|
}
|
|
@@ -4057,7 +4057,7 @@ function Po() {
|
|
|
4057
4057
|
return;
|
|
4058
4058
|
const v = N.strictSchema && !N.allowMatchingProperties && m.properties, E = o.name("valid");
|
|
4059
4059
|
g.props !== !0 && !(g.props instanceof t.Name) && (g.props = (0, n.evaluatedPropsToName)(o, g.props));
|
|
4060
|
-
const { props:
|
|
4060
|
+
const { props: l } = g;
|
|
4061
4061
|
y();
|
|
4062
4062
|
function y() {
|
|
4063
4063
|
for (const w of b)
|
|
@@ -4076,7 +4076,7 @@ function Po() {
|
|
|
4076
4076
|
schemaProp: w,
|
|
4077
4077
|
dataProp: d,
|
|
4078
4078
|
dataPropType: n.Type.Str
|
|
4079
|
-
}, E), g.opts.unevaluated &&
|
|
4079
|
+
}, E), g.opts.unevaluated && l !== !0 ? o.assign((0, t._)`${l}[${d}]`, !0) : !_ && !g.allErrors && o.if((0, t.not)(E), () => o.break());
|
|
4080
4080
|
});
|
|
4081
4081
|
});
|
|
4082
4082
|
}
|
|
@@ -4145,13 +4145,13 @@ function Ro() {
|
|
|
4145
4145
|
c.setParams({ passing: N }), a.block(u), c.result(g, () => c.reset(), () => c.error(!0));
|
|
4146
4146
|
function u() {
|
|
4147
4147
|
m.forEach((v, E) => {
|
|
4148
|
-
let
|
|
4149
|
-
(0, t.alwaysValidSchema)(h, v) ? a.var(b, !0) :
|
|
4148
|
+
let l;
|
|
4149
|
+
(0, t.alwaysValidSchema)(h, v) ? a.var(b, !0) : l = c.subschema({
|
|
4150
4150
|
keyword: "oneOf",
|
|
4151
4151
|
schemaProp: E,
|
|
4152
4152
|
compositeRule: !0
|
|
4153
4153
|
}, b), E > 0 && a.if((0, e._)`${b} && ${g}`).assign(g, !1).assign(N, (0, e._)`[${N}, ${E}]`).else(), a.if(b, () => {
|
|
4154
|
-
a.assign(g, !0), a.assign(N, E),
|
|
4154
|
+
a.assign(g, !0), a.assign(N, E), l && c.mergeEvaluated(l, e.Name);
|
|
4155
4155
|
});
|
|
4156
4156
|
});
|
|
4157
4157
|
}
|
|
@@ -4214,10 +4214,10 @@ function jo() {
|
|
|
4214
4214
|
}, b);
|
|
4215
4215
|
a.mergeEvaluated(E);
|
|
4216
4216
|
}
|
|
4217
|
-
function v(E,
|
|
4217
|
+
function v(E, l) {
|
|
4218
4218
|
return () => {
|
|
4219
4219
|
const y = a.subschema({ keyword: E }, b);
|
|
4220
|
-
o.assign(N, b), a.mergeValidEvaluated(y, N),
|
|
4220
|
+
o.assign(N, b), a.mergeValidEvaluated(y, N), l ? o.assign(l, (0, e._)`${E}`) : a.setParams({ ifClause: E });
|
|
4221
4221
|
};
|
|
4222
4222
|
}
|
|
4223
4223
|
}
|
|
@@ -4246,7 +4246,7 @@ function qo() {
|
|
|
4246
4246
|
if (Rn) return vt;
|
|
4247
4247
|
Rn = 1, Object.defineProperty(vt, "__esModule", { value: !0 });
|
|
4248
4248
|
const e = /* @__PURE__ */ Qn(), t = /* @__PURE__ */ _o(), r = /* @__PURE__ */ Xn(), n = /* @__PURE__ */ $o(), c = /* @__PURE__ */ bo(), a = /* @__PURE__ */ wo(), o = /* @__PURE__ */ Eo(), i = /* @__PURE__ */ xn(), h = /* @__PURE__ */ So(), m = /* @__PURE__ */ Po(), g = /* @__PURE__ */ No(), N = /* @__PURE__ */ Oo(), b = /* @__PURE__ */ Ro(), u = /* @__PURE__ */ Io(), v = /* @__PURE__ */ jo(), E = /* @__PURE__ */ ko();
|
|
4249
|
-
function
|
|
4249
|
+
function l(y = !1) {
|
|
4250
4250
|
const s = [
|
|
4251
4251
|
// any
|
|
4252
4252
|
g.default,
|
|
@@ -4264,7 +4264,7 @@ function qo() {
|
|
|
4264
4264
|
];
|
|
4265
4265
|
return y ? s.push(t.default, n.default) : s.push(e.default, r.default), s.push(c.default), s;
|
|
4266
4266
|
}
|
|
4267
|
-
return vt.default =
|
|
4267
|
+
return vt.default = l, vt;
|
|
4268
4268
|
}
|
|
4269
4269
|
var qt = {}, Tt = {}, In;
|
|
4270
4270
|
function To() {
|
|
@@ -4283,7 +4283,7 @@ function To() {
|
|
|
4283
4283
|
const { gen: a, data: o, $data: i, schema: h, schemaCode: m, it: g } = n, { opts: N, errSchemaPath: b, schemaEnv: u, self: v } = g;
|
|
4284
4284
|
if (!N.validateFormats)
|
|
4285
4285
|
return;
|
|
4286
|
-
i ? E() :
|
|
4286
|
+
i ? E() : l();
|
|
4287
4287
|
function E() {
|
|
4288
4288
|
const y = a.scopeValue("formats", {
|
|
4289
4289
|
ref: v.formats,
|
|
@@ -4298,7 +4298,7 @@ function To() {
|
|
|
4298
4298
|
return (0, e._)`${w} && ${w} !== true && ${p} === ${c} && !${T}`;
|
|
4299
4299
|
}
|
|
4300
4300
|
}
|
|
4301
|
-
function
|
|
4301
|
+
function l() {
|
|
4302
4302
|
const y = v.formats[h];
|
|
4303
4303
|
if (!y) {
|
|
4304
4304
|
d();
|
|
@@ -4404,14 +4404,14 @@ function zo() {
|
|
|
4404
4404
|
throw new Error("discriminator: mapping is not supported");
|
|
4405
4405
|
if (!u)
|
|
4406
4406
|
throw new Error("discriminator: requires oneOf keyword");
|
|
4407
|
-
const E = h.let("valid", !1),
|
|
4408
|
-
h.if((0, e._)`typeof ${
|
|
4407
|
+
const E = h.let("valid", !1), l = h.const("tag", (0, e._)`${m}${(0, e.getProperty)(v)}`);
|
|
4408
|
+
h.if((0, e._)`typeof ${l} == "string"`, () => y(), () => i.error(!1, { discrError: t.DiscrError.Tag, tag: l, tagName: v })), i.ok(E);
|
|
4409
4409
|
function y() {
|
|
4410
4410
|
const w = p();
|
|
4411
4411
|
h.if(!1);
|
|
4412
4412
|
for (const d in w)
|
|
4413
|
-
h.elseIf((0, e._)`${
|
|
4414
|
-
h.else(), i.error(!1, { discrError: t.DiscrError.Mapping, tag:
|
|
4413
|
+
h.elseIf((0, e._)`${l} === ${d}`), h.assign(E, s(w[d]));
|
|
4414
|
+
h.else(), i.error(!1, { discrError: t.DiscrError.Mapping, tag: l, tagName: v }), h.endIf();
|
|
4415
4415
|
}
|
|
4416
4416
|
function s(w) {
|
|
4417
4417
|
const d = h.name("valid"), _ = i.subschema({ keyword: "oneOf", schemaProp: w }, d);
|
|
@@ -4651,9 +4651,9 @@ function Jo() {
|
|
|
4651
4651
|
if (oe !== void 0)
|
|
4652
4652
|
return oe || m(B, se);
|
|
4653
4653
|
}
|
|
4654
|
-
const E = /\/|:/,
|
|
4654
|
+
const E = /\/|:/, l = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
4655
4655
|
function y(A) {
|
|
4656
|
-
return E.test(A) &&
|
|
4656
|
+
return E.test(A) && l.test(A);
|
|
4657
4657
|
}
|
|
4658
4658
|
const s = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
4659
4659
|
function p(A) {
|
|
@@ -4705,8 +4705,8 @@ function Yo() {
|
|
|
4705
4705
|
if (!u.validateFormats)
|
|
4706
4706
|
return;
|
|
4707
4707
|
const E = new t.KeywordCxt(b, v.RULES.all.format.definition, "format");
|
|
4708
|
-
E.$data ?
|
|
4709
|
-
function
|
|
4708
|
+
E.$data ? l() : y();
|
|
4709
|
+
function l() {
|
|
4710
4710
|
const p = h.scopeValue("formats", {
|
|
4711
4711
|
ref: v.formats,
|
|
4712
4712
|
code: u.code.formats
|
|
@@ -4772,7 +4772,7 @@ function xo() {
|
|
|
4772
4772
|
dependencies: "property",
|
|
4773
4773
|
dependentRequired: "property"
|
|
4774
4774
|
}, N = /\$\{[^}]+\}/, b = /\$\{([^}]+)\}/g, u = /^""\s*\+\s*|\s*\+\s*""$/g;
|
|
4775
|
-
function v(
|
|
4775
|
+
function v(l) {
|
|
4776
4776
|
return {
|
|
4777
4777
|
keyword: h,
|
|
4778
4778
|
schemaType: ["string", "object"],
|
|
@@ -4784,28 +4784,28 @@ function xo() {
|
|
|
4784
4784
|
const P = w, T = n.strConcat(i.default.instancePath, _.errorPath);
|
|
4785
4785
|
s.if(r._`${i.default.errors} > 0`, () => {
|
|
4786
4786
|
if (typeof P == "object") {
|
|
4787
|
-
const [O,
|
|
4788
|
-
|
|
4787
|
+
const [O, f] = U(P);
|
|
4788
|
+
f && A(f), O && L(O), K(D(P));
|
|
4789
4789
|
}
|
|
4790
4790
|
const k = typeof P == "string" ? P : P._;
|
|
4791
|
-
k && B(k),
|
|
4791
|
+
k && B(k), l.keepErrors || x();
|
|
4792
4792
|
});
|
|
4793
4793
|
function D({ properties: k, items: O }) {
|
|
4794
|
-
const
|
|
4794
|
+
const f = {};
|
|
4795
4795
|
if (k) {
|
|
4796
|
-
|
|
4796
|
+
f.props = {};
|
|
4797
4797
|
for (const S in k)
|
|
4798
|
-
|
|
4798
|
+
f.props[S] = [];
|
|
4799
4799
|
}
|
|
4800
4800
|
if (O) {
|
|
4801
|
-
|
|
4801
|
+
f.items = {};
|
|
4802
4802
|
for (let S = 0; S < O.length; S++)
|
|
4803
|
-
|
|
4803
|
+
f.items[S] = [];
|
|
4804
4804
|
}
|
|
4805
|
-
return
|
|
4805
|
+
return f;
|
|
4806
4806
|
}
|
|
4807
4807
|
function U(k) {
|
|
4808
|
-
let O,
|
|
4808
|
+
let O, f;
|
|
4809
4809
|
for (const S in k) {
|
|
4810
4810
|
if (S === "properties" || S === "items")
|
|
4811
4811
|
continue;
|
|
@@ -4816,14 +4816,14 @@ function xo() {
|
|
|
4816
4816
|
for (const z in q)
|
|
4817
4817
|
F[z] = [];
|
|
4818
4818
|
} else
|
|
4819
|
-
|
|
4819
|
+
f || (f = {}), f[S] = [];
|
|
4820
4820
|
}
|
|
4821
|
-
return [O,
|
|
4821
|
+
return [O, f];
|
|
4822
4822
|
}
|
|
4823
4823
|
function A(k) {
|
|
4824
|
-
const O = s.const("emErrors", r.stringify(k)),
|
|
4824
|
+
const O = s.const("emErrors", r.stringify(k)), f = s.const("templates", de(k, w));
|
|
4825
4825
|
s.forOf("err", i.default.vErrors, (z) => s.if(se(z, O), () => s.code(r._`${O}[${z}.keyword].push(${z})`).assign(r._`${z}.${m}`, !0)));
|
|
4826
|
-
const { singleError: S } =
|
|
4826
|
+
const { singleError: S } = l;
|
|
4827
4827
|
if (S) {
|
|
4828
4828
|
const z = s.let("message", r._`""`), H = s.let("paramsErrors", r._`[]`);
|
|
4829
4829
|
q((G) => {
|
|
@@ -4838,17 +4838,17 @@ function xo() {
|
|
|
4838
4838
|
s.forIn("key", O, (H) => s.if(r._`${O}[${H}].length`, () => z(H)));
|
|
4839
4839
|
}
|
|
4840
4840
|
function F(z) {
|
|
4841
|
-
return r._`${z} in ${
|
|
4841
|
+
return r._`${z} in ${f} ? ${f}[${z}]() : ${d}[${z}]`;
|
|
4842
4842
|
}
|
|
4843
4843
|
}
|
|
4844
4844
|
function L(k) {
|
|
4845
|
-
const O = s.const("emErrors", r.stringify(k)),
|
|
4845
|
+
const O = s.const("emErrors", r.stringify(k)), f = [];
|
|
4846
4846
|
for (const H in k)
|
|
4847
|
-
|
|
4847
|
+
f.push([
|
|
4848
4848
|
H,
|
|
4849
4849
|
de(k[H], w[H])
|
|
4850
4850
|
]);
|
|
4851
|
-
const S = s.const("templates", s.object(...
|
|
4851
|
+
const S = s.const("templates", s.object(...f)), q = s.scopeValue("obj", {
|
|
4852
4852
|
ref: g,
|
|
4853
4853
|
code: r.stringify(g)
|
|
4854
4854
|
}), F = s.let("emPropParams"), z = s.let("emParamsErrors");
|
|
@@ -4865,17 +4865,17 @@ function xo() {
|
|
|
4865
4865
|
}));
|
|
4866
4866
|
}
|
|
4867
4867
|
function K(k) {
|
|
4868
|
-
const { props: O, items:
|
|
4869
|
-
if (!O && !
|
|
4868
|
+
const { props: O, items: f } = k;
|
|
4869
|
+
if (!O && !f)
|
|
4870
4870
|
return;
|
|
4871
4871
|
const S = r._`typeof ${p} == "object"`, q = r._`Array.isArray(${p})`, F = s.let("emErrors");
|
|
4872
4872
|
let z, H;
|
|
4873
4873
|
const G = s.let("templates");
|
|
4874
|
-
O &&
|
|
4875
|
-
R(
|
|
4874
|
+
O && f ? (z = s.let("emChildKwd"), s.if(S), s.if(q, () => {
|
|
4875
|
+
R(f, w.items), s.assign(z, r.str`items`);
|
|
4876
4876
|
}, () => {
|
|
4877
4877
|
R(O, w.properties), s.assign(z, r.str`properties`);
|
|
4878
|
-
}), H = r._`[${z}]`) :
|
|
4878
|
+
}), H = r._`[${z}]`) : f ? (s.if(q), R(f, w.items), H = r._`.items`) : O && (s.if(n.and(S, n.not(q))), R(O, w.properties), H = r._`.properties`), s.forOf("err", i.default.vErrors, (I) => oe(I, F, (V) => s.code(r._`${F}[${V}].push(${I})`).assign(r._`${I}.${m}`, !0))), s.forIn("key", F, (I) => s.if(r._`${F}[${I}].length`, () => {
|
|
4879
4879
|
o.reportError(y, {
|
|
4880
4880
|
message: r._`${I} in ${G} ? ${G}[${I}]() : ${d}${H}[${I}]`,
|
|
4881
4881
|
params: r._`{errors: ${F}[${I}]}`
|
|
@@ -4887,7 +4887,7 @@ function xo() {
|
|
|
4887
4887
|
}
|
|
4888
4888
|
function B(k) {
|
|
4889
4889
|
const O = s.const("emErrs", r._`[]`);
|
|
4890
|
-
s.forOf("err", i.default.vErrors, (
|
|
4890
|
+
s.forOf("err", i.default.vErrors, (f) => s.if(te(f), () => s.code(r._`${O}.push(${f})`).assign(r._`${f}.${m}`, !0))), s.if(r._`${O}.length`, () => o.reportError(y, {
|
|
4891
4891
|
message: M(k),
|
|
4892
4892
|
params: r._`{errors: ${O}}`
|
|
4893
4893
|
}));
|
|
@@ -4907,28 +4907,28 @@ function xo() {
|
|
|
4907
4907
|
r._`/^\\/[^\\/]*$/.test(${k}.schemaPath.slice(${_.errSchemaPath.length}))`
|
|
4908
4908
|
);
|
|
4909
4909
|
}
|
|
4910
|
-
function oe(k, O,
|
|
4910
|
+
function oe(k, O, f) {
|
|
4911
4911
|
s.if(n.and(r._`${k}.keyword !== ${h}`, r._`!${k}.${m}`, r._`${k}.instancePath.indexOf(${T}) === 0`), () => {
|
|
4912
4912
|
const S = s.scopeValue("pattern", {
|
|
4913
4913
|
ref: /^\/([^/]*)(?:\/|$)/,
|
|
4914
4914
|
code: r._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`
|
|
4915
4915
|
}), q = s.const("emMatches", r._`${S}.exec(${k}.instancePath.slice(${T}.length))`), F = s.const("emChild", r._`${q} && ${q}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);
|
|
4916
|
-
s.if(r._`${F} !== undefined && ${F} in ${O}`, () =>
|
|
4916
|
+
s.if(r._`${F} !== undefined && ${F} in ${O}`, () => f(F));
|
|
4917
4917
|
});
|
|
4918
4918
|
}
|
|
4919
4919
|
function te(k) {
|
|
4920
4920
|
return n.and(r._`${k}.keyword !== ${h}`, r._`!${k}.${m}`, n.or(r._`${k}.instancePath === ${T}`, n.and(r._`${k}.instancePath.indexOf(${T}) === 0`, r._`${k}.instancePath[${T}.length] === "/"`)), r._`${k}.schemaPath.indexOf(${_.errSchemaPath}) === 0`, r._`${k}.schemaPath[${_.errSchemaPath}.length] === "/"`);
|
|
4921
4921
|
}
|
|
4922
4922
|
function de(k, O) {
|
|
4923
|
-
const
|
|
4923
|
+
const f = [];
|
|
4924
4924
|
for (const S in k) {
|
|
4925
4925
|
const q = O[S];
|
|
4926
|
-
N.test(q) &&
|
|
4926
|
+
N.test(q) && f.push([S, j(q)]);
|
|
4927
4927
|
}
|
|
4928
|
-
return s.object(...
|
|
4928
|
+
return s.object(...f);
|
|
4929
4929
|
}
|
|
4930
4930
|
function M(k) {
|
|
4931
|
-
return N.test(k) ? new c._Code(c.safeStringify(k).replace(b, (O,
|
|
4931
|
+
return N.test(k) ? new c._Code(c.safeStringify(k).replace(b, (O, f) => `" + JSON.stringify(${a.getData(f, _)}) + "`).replace(u, "")) : r.stringify(k);
|
|
4932
4932
|
}
|
|
4933
4933
|
function j(k) {
|
|
4934
4934
|
return r._`function(){return ${M(k)}}`;
|
|
@@ -4961,12 +4961,12 @@ function xo() {
|
|
|
4961
4961
|
}
|
|
4962
4962
|
};
|
|
4963
4963
|
}
|
|
4964
|
-
const E = (
|
|
4965
|
-
if (!
|
|
4964
|
+
const E = (l, y = {}) => {
|
|
4965
|
+
if (!l.opts.allErrors)
|
|
4966
4966
|
throw new Error("ajv-errors: Ajv option allErrors must be true");
|
|
4967
|
-
if (
|
|
4967
|
+
if (l.opts.jsPropertySyntax)
|
|
4968
4968
|
throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported");
|
|
4969
|
-
return
|
|
4969
|
+
return l.addKeyword(v(y));
|
|
4970
4970
|
};
|
|
4971
4971
|
t.default = E, e.exports = E, e.exports.default = E;
|
|
4972
4972
|
})(Dt, Dt.exports)), Dt.exports;
|
|
@@ -5159,10 +5159,10 @@ function aa(e, t, { signal: r, edges: n } = {}) {
|
|
|
5159
5159
|
b(), c = void 0, a = null;
|
|
5160
5160
|
}, v = () => {
|
|
5161
5161
|
h();
|
|
5162
|
-
}, E = function(...
|
|
5162
|
+
}, E = function(...l) {
|
|
5163
5163
|
if (r != null && r.aborted)
|
|
5164
5164
|
return;
|
|
5165
|
-
c = this, a =
|
|
5165
|
+
c = this, a = l;
|
|
5166
5166
|
const y = g == null;
|
|
5167
5167
|
N(), o && y && h();
|
|
5168
5168
|
};
|
|
@@ -7063,7 +7063,7 @@ async function qi(e) {
|
|
|
7063
7063
|
var s;
|
|
7064
7064
|
const u = this;
|
|
7065
7065
|
or(u);
|
|
7066
|
-
const v = Bn(u._newState), E = Bn(u),
|
|
7066
|
+
const v = Bn(u._newState), E = Bn(u), l = Is(E, v), y = !!((s = Object.keys(l)) != null && s.length);
|
|
7067
7067
|
if (!y) return !1;
|
|
7068
7068
|
if (Ri(u), js(u, v), e.category === "config") {
|
|
7069
7069
|
Ii(u, v, m);
|
|
@@ -7075,7 +7075,7 @@ async function qi(e) {
|
|
|
7075
7075
|
{
|
|
7076
7076
|
t: "edit",
|
|
7077
7077
|
node: u,
|
|
7078
|
-
changes:
|
|
7078
|
+
changes: l,
|
|
7079
7079
|
links: [],
|
|
7080
7080
|
dirty: RED.nodes.dirty(),
|
|
7081
7081
|
changed: y
|
|
@@ -7103,12 +7103,15 @@ async function qi(e) {
|
|
|
7103
7103
|
b
|
|
7104
7104
|
)), g && i) {
|
|
7105
7105
|
const u = Object.keys(i)[0];
|
|
7106
|
-
|
|
7107
|
-
...i[u]
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7106
|
+
if (u) {
|
|
7107
|
+
const { required: v, ...E } = i[u];
|
|
7108
|
+
i[u] = {
|
|
7109
|
+
...E,
|
|
7110
|
+
validate: function(l, y) {
|
|
7111
|
+
return sa(this, g);
|
|
7112
|
+
}
|
|
7113
|
+
};
|
|
7114
|
+
}
|
|
7112
7115
|
}
|
|
7113
7116
|
RED.nodes.registerType(t, {
|
|
7114
7117
|
type: t,
|