@opra/common 0.18.4 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.js +1225 -910
- package/cjs/document/api-document.js +55 -38
- package/cjs/document/data-type/api-field.js +5 -5
- package/cjs/document/data-type/builtin/any.type.js +3 -5
- package/cjs/document/data-type/builtin/base64.type.js +5 -28
- package/cjs/document/data-type/builtin/bigint.type.js +7 -25
- package/cjs/document/data-type/builtin/boolean.type.js +5 -18
- package/cjs/document/data-type/builtin/date.type.js +13 -9
- package/cjs/document/data-type/builtin/index.js +3 -1
- package/cjs/document/data-type/builtin/integer.type.js +5 -18
- package/cjs/document/data-type/builtin/number.type.js +5 -23
- package/cjs/document/data-type/builtin/object.type.js +4 -9
- package/cjs/document/data-type/builtin/string.type.js +5 -14
- package/cjs/document/data-type/builtin/time.type.js +11 -23
- package/cjs/document/data-type/builtin/timestamp.type.js +8 -20
- package/cjs/document/data-type/builtin/uuid.type.js +15 -0
- package/cjs/document/data-type/complex-type.js +151 -92
- package/cjs/document/data-type/data-type.js +32 -31
- package/cjs/document/data-type/enum-type.js +49 -43
- package/cjs/document/data-type/mapped-type.js +115 -70
- package/cjs/document/data-type/simple-type.js +46 -45
- package/cjs/document/data-type/union-type.js +69 -36
- package/cjs/document/factory/create-document.js +5 -3
- package/cjs/document/factory/factory.js +23 -20
- package/cjs/document/factory/import-type-class.js +13 -4
- package/cjs/document/resource/collection.js +55 -59
- package/cjs/document/resource/resource.js +10 -21
- package/cjs/document/resource/singleton.js +36 -39
- package/cjs/exception/common-errors/validation.error.js +11 -0
- package/cjs/exception/index.js +2 -1
- package/cjs/exception/{enums/issue-severity.enum.js → issue-severity.enum.js} +1 -1
- package/cjs/exception/opra-exception.js +2 -2
- package/cjs/filter/antlr/OpraFilterLexer.js +1 -1
- package/cjs/filter/antlr/OpraFilterParser.js +1 -1
- package/cjs/filter/errors.js +5 -0
- package/cjs/http/enums/http-headers-codes.enum.js +1 -1
- package/cjs/http/enums/http-status-codes.enum.js +1 -1
- package/cjs/http/http-request-message.js +1 -1
- package/cjs/http/http-response-message.js +1 -1
- package/cjs/schema/data-type/complex-type.interface.js +1 -1
- package/cjs/schema/data-type/enum-type.interface.js +1 -1
- package/cjs/schema/data-type/mapped-type.interface.js +1 -1
- package/cjs/schema/data-type/simple-type.interface.js +1 -1
- package/cjs/schema/data-type/union-type.interface.js +1 -1
- package/cjs/schema/index.js +3 -41
- package/cjs/schema/opra-schema.ns.js +18 -0
- package/cjs/schema/resource/collection.interface.js +1 -1
- package/cjs/schema/resource/container.interface.js +1 -1
- package/cjs/schema/resource/singleton.interface.js +1 -1
- package/esm/document/api-document.js +55 -38
- package/esm/document/data-type/api-field.js +5 -5
- package/esm/document/data-type/builtin/any.type.js +2 -4
- package/esm/document/data-type/builtin/base64.type.js +4 -27
- package/esm/document/data-type/builtin/bigint.type.js +6 -24
- package/esm/document/data-type/builtin/boolean.type.js +4 -17
- package/esm/document/data-type/builtin/date.type.js +12 -8
- package/esm/document/data-type/builtin/index.js +3 -1
- package/esm/document/data-type/builtin/integer.type.js +4 -17
- package/esm/document/data-type/builtin/number.type.js +4 -22
- package/esm/document/data-type/builtin/object.type.js +3 -8
- package/esm/document/data-type/builtin/string.type.js +4 -13
- package/esm/document/data-type/builtin/time.type.js +10 -22
- package/esm/document/data-type/builtin/timestamp.type.js +7 -19
- package/esm/document/data-type/builtin/uuid.type.js +12 -0
- package/esm/document/data-type/complex-type.js +151 -92
- package/esm/document/data-type/data-type.js +31 -31
- package/esm/document/data-type/enum-type.js +49 -43
- package/esm/document/data-type/mapped-type.js +114 -70
- package/esm/document/data-type/simple-type.js +45 -44
- package/esm/document/data-type/union-type.js +68 -36
- package/esm/document/factory/create-document.js +6 -4
- package/esm/document/factory/factory.js +23 -20
- package/esm/document/factory/import-type-class.js +13 -4
- package/esm/document/resource/collection.js +55 -59
- package/esm/document/resource/resource.js +9 -21
- package/esm/document/resource/singleton.js +36 -39
- package/esm/exception/common-errors/validation.error.js +7 -0
- package/esm/exception/index.js +2 -1
- package/esm/exception/opra-exception.js +2 -2
- package/esm/filter/antlr/OpraFilterLexer.js +2 -1
- package/esm/filter/antlr/OpraFilterParser.js +2 -1
- package/esm/filter/errors.js +5 -0
- package/esm/schema/index.js +2 -41
- package/esm/schema/opra-schema.ns.js +15 -0
- package/package.json +5 -3
- package/types/document/api-document.d.ts +3 -2
- package/types/document/data-type/builtin/base64.type.d.ts +0 -4
- package/types/document/data-type/builtin/bigint.type.d.ts +1 -5
- package/types/document/data-type/builtin/boolean.type.d.ts +0 -3
- package/types/document/data-type/builtin/date.type.d.ts +1 -3
- package/types/document/data-type/builtin/index.d.ts +3 -1
- package/types/document/data-type/builtin/integer.type.d.ts +1 -5
- package/types/document/data-type/builtin/number.type.d.ts +0 -4
- package/types/document/data-type/builtin/object.type.d.ts +0 -1
- package/types/document/data-type/builtin/string.type.d.ts +0 -3
- package/types/document/data-type/builtin/time.type.d.ts +1 -6
- package/types/document/data-type/builtin/timestamp.type.d.ts +0 -3
- package/types/document/data-type/builtin/uuid.type.d.ts +2 -0
- package/types/document/data-type/complex-type.d.ts +29 -16
- package/types/document/data-type/data-type.d.ts +19 -15
- package/types/document/data-type/enum-type.d.ts +15 -5
- package/types/document/data-type/mapped-type.d.ts +27 -5
- package/types/document/data-type/simple-type.d.ts +26 -12
- package/types/document/data-type/union-type.d.ts +20 -5
- package/types/document/factory/factory.d.ts +3 -2
- package/types/document/resource/collection.d.ts +11 -9
- package/types/document/resource/resource.d.ts +3 -9
- package/types/document/resource/singleton.d.ts +7 -5
- package/types/exception/common-errors/validation.error.d.ts +4 -0
- package/types/exception/error-issue.d.ts +1 -1
- package/types/exception/index.d.ts +2 -1
- package/types/exception/opra-exception.d.ts +4 -2
- package/types/filter/errors.d.ts +3 -0
- package/types/schema/data-type/enum-type.interface.d.ts +5 -5
- package/types/schema/data-type/simple-type.interface.d.ts +5 -11
- package/types/schema/index.d.ts +2 -51
- package/types/schema/opra-schema.ns.d.ts +15 -0
- package/cjs/document/data-type/builtin/guid.type.js +0 -35
- package/esm/document/data-type/builtin/guid.type.js +0 -32
- package/types/document/data-type/builtin/guid.type.d.ts +0 -7
- /package/esm/exception/{enums/issue-severity.enum.js → issue-severity.enum.js} +0 -0
- /package/types/exception/{enums/issue-severity.enum.d.ts → issue-severity.enum.d.ts} +0 -0
package/browser.js
CHANGED
|
@@ -193,6 +193,9 @@ var kKeyOrder = Symbol("kKeyOrder");
|
|
|
193
193
|
var kWellKnownKeys = Symbol("kWellKnownKeys");
|
|
194
194
|
var kOptions = Symbol("kOptions");
|
|
195
195
|
var ResponsiveMap = class extends Map {
|
|
196
|
+
static {
|
|
197
|
+
__name(this, "ResponsiveMap");
|
|
198
|
+
}
|
|
196
199
|
constructor(init, options) {
|
|
197
200
|
super();
|
|
198
201
|
this[_a] = /* @__PURE__ */ new Map();
|
|
@@ -343,7 +346,6 @@ var ResponsiveMap = class extends Map {
|
|
|
343
346
|
return key.toLowerCase();
|
|
344
347
|
}
|
|
345
348
|
};
|
|
346
|
-
__name(ResponsiveMap, "ResponsiveMap");
|
|
347
349
|
|
|
348
350
|
// ../../build/common/esm/i18n/string-utils.js
|
|
349
351
|
var unescapeRegEx = /\\(.)/g;
|
|
@@ -360,7 +362,10 @@ __name(unescapeString, "unescapeString");
|
|
|
360
362
|
// ../../build/common/esm/i18n/i18n.js
|
|
361
363
|
var BaseI18n = Object.getPrototypeOf(i18next).constructor;
|
|
362
364
|
var globalLocaleDirs = [];
|
|
363
|
-
var I18n = class extends BaseI18n {
|
|
365
|
+
var I18n = class _I18n extends BaseI18n {
|
|
366
|
+
static {
|
|
367
|
+
__name(this, "I18n");
|
|
368
|
+
}
|
|
364
369
|
async init(arg0, arg1) {
|
|
365
370
|
const options = typeof arg0 === "object" ? arg0 : {};
|
|
366
371
|
const callback = typeof arg0 === "function" ? arg0 : arg1;
|
|
@@ -433,10 +438,10 @@ var I18n = class extends BaseI18n {
|
|
|
433
438
|
}
|
|
434
439
|
}
|
|
435
440
|
createInstance(options = {}, callback) {
|
|
436
|
-
return new
|
|
441
|
+
return new _I18n(options, callback);
|
|
437
442
|
}
|
|
438
443
|
static createInstance(options, callback) {
|
|
439
|
-
return new
|
|
444
|
+
return new _I18n(options, callback);
|
|
440
445
|
}
|
|
441
446
|
_deepTranslate(input, objectStack, options) {
|
|
442
447
|
if (input == null)
|
|
@@ -506,7 +511,6 @@ var I18n = class extends BaseI18n {
|
|
|
506
511
|
return defaultInstance;
|
|
507
512
|
}
|
|
508
513
|
};
|
|
509
|
-
__name(I18n, "I18n");
|
|
510
514
|
var defaultInstance = I18n.createInstance();
|
|
511
515
|
|
|
512
516
|
// ../../build/common/esm/i18n/translate.js
|
|
@@ -524,18 +528,21 @@ i18n.init().catch(() => void 0);
|
|
|
524
528
|
|
|
525
529
|
// ../../build/common/esm/exception/opra-exception.js
|
|
526
530
|
var OpraException = class extends Error {
|
|
531
|
+
static {
|
|
532
|
+
__name(this, "OpraException");
|
|
533
|
+
}
|
|
527
534
|
constructor(issue, cause) {
|
|
528
535
|
super("");
|
|
529
536
|
this.status = 500;
|
|
530
537
|
this._initName();
|
|
538
|
+
if (issue instanceof Error)
|
|
539
|
+
cause = issue;
|
|
531
540
|
if (cause) {
|
|
532
541
|
this.cause = cause;
|
|
533
542
|
if (cause.stack)
|
|
534
543
|
this.stack = cause.stack;
|
|
535
544
|
}
|
|
536
545
|
this._init(issue || cause || "Unknown error");
|
|
537
|
-
if (issue instanceof Error)
|
|
538
|
-
this.stack = issue.stack;
|
|
539
546
|
this.message = i18n.deep(this.issue.message);
|
|
540
547
|
}
|
|
541
548
|
get issue() {
|
|
@@ -569,10 +576,12 @@ var OpraException = class extends Error {
|
|
|
569
576
|
}
|
|
570
577
|
}
|
|
571
578
|
};
|
|
572
|
-
__name(OpraException, "OpraException");
|
|
573
579
|
|
|
574
580
|
// ../../build/common/esm/exception/http-errors/bad-request.error.js
|
|
575
581
|
var BadRequestError = class extends OpraException {
|
|
582
|
+
static {
|
|
583
|
+
__name(this, "BadRequestError");
|
|
584
|
+
}
|
|
576
585
|
constructor() {
|
|
577
586
|
super(...arguments);
|
|
578
587
|
this.status = 400;
|
|
@@ -586,10 +595,12 @@ var BadRequestError = class extends OpraException {
|
|
|
586
595
|
});
|
|
587
596
|
}
|
|
588
597
|
};
|
|
589
|
-
__name(BadRequestError, "BadRequestError");
|
|
590
598
|
|
|
591
599
|
// ../../build/common/esm/exception/http-errors/failed-dependency.error.js
|
|
592
600
|
var FailedDependencyError = class extends OpraException {
|
|
601
|
+
static {
|
|
602
|
+
__name(this, "FailedDependencyError");
|
|
603
|
+
}
|
|
593
604
|
constructor() {
|
|
594
605
|
super(...arguments);
|
|
595
606
|
this.status = 424;
|
|
@@ -603,10 +614,12 @@ var FailedDependencyError = class extends OpraException {
|
|
|
603
614
|
});
|
|
604
615
|
}
|
|
605
616
|
};
|
|
606
|
-
__name(FailedDependencyError, "FailedDependencyError");
|
|
607
617
|
|
|
608
618
|
// ../../build/common/esm/exception/http-errors/forbidden.error.js
|
|
609
619
|
var ForbiddenError = class extends OpraException {
|
|
620
|
+
static {
|
|
621
|
+
__name(this, "ForbiddenError");
|
|
622
|
+
}
|
|
610
623
|
constructor() {
|
|
611
624
|
super(...arguments);
|
|
612
625
|
this.status = 403;
|
|
@@ -620,10 +633,12 @@ var ForbiddenError = class extends OpraException {
|
|
|
620
633
|
});
|
|
621
634
|
}
|
|
622
635
|
};
|
|
623
|
-
__name(ForbiddenError, "ForbiddenError");
|
|
624
636
|
|
|
625
637
|
// ../../build/common/esm/exception/http-errors/method-not-allowed.error.js
|
|
626
638
|
var MethodNotAllowedError = class extends OpraException {
|
|
639
|
+
static {
|
|
640
|
+
__name(this, "MethodNotAllowedError");
|
|
641
|
+
}
|
|
627
642
|
constructor() {
|
|
628
643
|
super(...arguments);
|
|
629
644
|
this.status = 405;
|
|
@@ -637,10 +652,12 @@ var MethodNotAllowedError = class extends OpraException {
|
|
|
637
652
|
});
|
|
638
653
|
}
|
|
639
654
|
};
|
|
640
|
-
__name(MethodNotAllowedError, "MethodNotAllowedError");
|
|
641
655
|
|
|
642
656
|
// ../../build/common/esm/exception/http-errors/not-acceptable.error.js
|
|
643
657
|
var NotAcceptableError = class extends OpraException {
|
|
658
|
+
static {
|
|
659
|
+
__name(this, "NotAcceptableError");
|
|
660
|
+
}
|
|
644
661
|
constructor() {
|
|
645
662
|
super(...arguments);
|
|
646
663
|
this.status = 406;
|
|
@@ -654,10 +671,12 @@ var NotAcceptableError = class extends OpraException {
|
|
|
654
671
|
});
|
|
655
672
|
}
|
|
656
673
|
};
|
|
657
|
-
__name(NotAcceptableError, "NotAcceptableError");
|
|
658
674
|
|
|
659
675
|
// ../../build/common/esm/exception/http-errors/not-found.error.js
|
|
660
676
|
var NotFoundError = class extends OpraException {
|
|
677
|
+
static {
|
|
678
|
+
__name(this, "NotFoundError");
|
|
679
|
+
}
|
|
661
680
|
constructor() {
|
|
662
681
|
super(...arguments);
|
|
663
682
|
this.status = 404;
|
|
@@ -671,10 +690,12 @@ var NotFoundError = class extends OpraException {
|
|
|
671
690
|
});
|
|
672
691
|
}
|
|
673
692
|
};
|
|
674
|
-
__name(NotFoundError, "NotFoundError");
|
|
675
693
|
|
|
676
694
|
// ../../build/common/esm/exception/http-errors/unauthorized.error.js
|
|
677
695
|
var UnauthorizedError = class extends OpraException {
|
|
696
|
+
static {
|
|
697
|
+
__name(this, "UnauthorizedError");
|
|
698
|
+
}
|
|
678
699
|
constructor() {
|
|
679
700
|
super(...arguments);
|
|
680
701
|
this.status = 401;
|
|
@@ -688,10 +709,12 @@ var UnauthorizedError = class extends OpraException {
|
|
|
688
709
|
});
|
|
689
710
|
}
|
|
690
711
|
};
|
|
691
|
-
__name(UnauthorizedError, "UnauthorizedError");
|
|
692
712
|
|
|
693
713
|
// ../../build/common/esm/exception/http-errors/unprocessable-entity.error.js
|
|
694
714
|
var UnprocessableEntityError = class extends OpraException {
|
|
715
|
+
static {
|
|
716
|
+
__name(this, "UnprocessableEntityError");
|
|
717
|
+
}
|
|
695
718
|
constructor() {
|
|
696
719
|
super(...arguments);
|
|
697
720
|
this.status = 422;
|
|
@@ -705,7 +728,6 @@ var UnprocessableEntityError = class extends OpraException {
|
|
|
705
728
|
});
|
|
706
729
|
}
|
|
707
730
|
};
|
|
708
|
-
__name(UnprocessableEntityError, "UnprocessableEntityError");
|
|
709
731
|
|
|
710
732
|
// ../../build/common/esm/exception/wrap-exception.js
|
|
711
733
|
function wrapException(e) {
|
|
@@ -739,7 +761,7 @@ function wrapException(e) {
|
|
|
739
761
|
}
|
|
740
762
|
__name(wrapException, "wrapException");
|
|
741
763
|
|
|
742
|
-
// ../../build/common/esm/exception/
|
|
764
|
+
// ../../build/common/esm/exception/issue-severity.enum.js
|
|
743
765
|
var IssueSeverity;
|
|
744
766
|
(function(IssueSeverity2) {
|
|
745
767
|
let Enum;
|
|
@@ -762,6 +784,9 @@ var IssueSeverity;
|
|
|
762
784
|
|
|
763
785
|
// ../../build/common/esm/exception/http-errors/internal-server.error.js
|
|
764
786
|
var InternalServerError = class extends OpraException {
|
|
787
|
+
static {
|
|
788
|
+
__name(this, "InternalServerError");
|
|
789
|
+
}
|
|
765
790
|
constructor() {
|
|
766
791
|
super(...arguments);
|
|
767
792
|
this.status = 500;
|
|
@@ -775,10 +800,12 @@ var InternalServerError = class extends OpraException {
|
|
|
775
800
|
});
|
|
776
801
|
}
|
|
777
802
|
};
|
|
778
|
-
__name(InternalServerError, "InternalServerError");
|
|
779
803
|
|
|
780
804
|
// ../../build/common/esm/exception/resource-errors/resource-conflict.error.js
|
|
781
805
|
var ResourceConflictError = class extends OpraException {
|
|
806
|
+
static {
|
|
807
|
+
__name(this, "ResourceConflictError");
|
|
808
|
+
}
|
|
782
809
|
constructor(resource, fields, cause) {
|
|
783
810
|
super({
|
|
784
811
|
message: translate(`error:RESOURCE_CONFLICT`, { resource, fields }, `There is already an other {{resource}} resource with same field values ({{fields}})`),
|
|
@@ -792,10 +819,12 @@ var ResourceConflictError = class extends OpraException {
|
|
|
792
819
|
this.status = 409;
|
|
793
820
|
}
|
|
794
821
|
};
|
|
795
|
-
__name(ResourceConflictError, "ResourceConflictError");
|
|
796
822
|
|
|
797
823
|
// ../../build/common/esm/exception/resource-errors/resource-not-found.error.js
|
|
798
824
|
var ResourceNotFoundError = class extends OpraException {
|
|
825
|
+
static {
|
|
826
|
+
__name(this, "ResourceNotFoundError");
|
|
827
|
+
}
|
|
799
828
|
constructor(resource, keyValue, cause) {
|
|
800
829
|
super({
|
|
801
830
|
message: translate(`error:RESOURCE_NOT_FOUND`, { resource: resource + (keyValue ? "@" + keyValue : "") }, `The resource '{{resource}}' could not be found`),
|
|
@@ -809,10 +838,41 @@ var ResourceNotFoundError = class extends OpraException {
|
|
|
809
838
|
this.status = 404;
|
|
810
839
|
}
|
|
811
840
|
};
|
|
812
|
-
__name(ResourceNotFoundError, "ResourceNotFoundError");
|
|
813
841
|
|
|
814
|
-
// ../../build/common/esm/
|
|
815
|
-
var
|
|
842
|
+
// ../../build/common/esm/exception/common-errors/validation.error.js
|
|
843
|
+
var ValidationError = class extends OpraException {
|
|
844
|
+
static {
|
|
845
|
+
__name(this, "ValidationError");
|
|
846
|
+
}
|
|
847
|
+
constructor() {
|
|
848
|
+
super(...arguments);
|
|
849
|
+
this.status = 400;
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
// ../../build/common/esm/schema/opra-schema.ns.js
|
|
854
|
+
var opra_schema_ns_exports = {};
|
|
855
|
+
__export(opra_schema_ns_exports, {
|
|
856
|
+
Collection: () => Collection,
|
|
857
|
+
ComplexType: () => ComplexType,
|
|
858
|
+
Container: () => Container,
|
|
859
|
+
EnumType: () => EnumType,
|
|
860
|
+
MappedType: () => MappedType,
|
|
861
|
+
SimpleType: () => SimpleType,
|
|
862
|
+
Singleton: () => Singleton,
|
|
863
|
+
SpecVersion: () => SpecVersion,
|
|
864
|
+
UnionType: () => UnionType,
|
|
865
|
+
isCollection: () => isCollection,
|
|
866
|
+
isComplexType: () => isComplexType,
|
|
867
|
+
isContainer: () => isContainer,
|
|
868
|
+
isDataType: () => isDataType,
|
|
869
|
+
isEnumType: () => isEnumType,
|
|
870
|
+
isMappedType: () => isMappedType,
|
|
871
|
+
isResource: () => isResource,
|
|
872
|
+
isSimpleType: () => isSimpleType,
|
|
873
|
+
isSingleton: () => isSingleton,
|
|
874
|
+
isUnionType: () => isUnionType
|
|
875
|
+
});
|
|
816
876
|
|
|
817
877
|
// ../../build/common/esm/schema/data-type/complex-type.interface.js
|
|
818
878
|
var ComplexType;
|
|
@@ -826,18 +886,18 @@ var EnumType;
|
|
|
826
886
|
EnumType3.Kind = "EnumType";
|
|
827
887
|
})(EnumType || (EnumType = {}));
|
|
828
888
|
|
|
829
|
-
// ../../build/common/esm/schema/data-type/mapped-type.interface.js
|
|
830
|
-
var MappedType;
|
|
831
|
-
(function(MappedType3) {
|
|
832
|
-
MappedType3.Kind = "MappedType";
|
|
833
|
-
})(MappedType || (MappedType = {}));
|
|
834
|
-
|
|
835
889
|
// ../../build/common/esm/schema/data-type/simple-type.interface.js
|
|
836
890
|
var SimpleType;
|
|
837
891
|
(function(SimpleType3) {
|
|
838
892
|
SimpleType3.Kind = "SimpleType";
|
|
839
893
|
})(SimpleType || (SimpleType = {}));
|
|
840
894
|
|
|
895
|
+
// ../../build/common/esm/schema/data-type/mapped-type.interface.js
|
|
896
|
+
var MappedType;
|
|
897
|
+
(function(MappedType3) {
|
|
898
|
+
MappedType3.Kind = "MappedType";
|
|
899
|
+
})(MappedType || (MappedType = {}));
|
|
900
|
+
|
|
841
901
|
// ../../build/common/esm/schema/data-type/union-type.interface.js
|
|
842
902
|
var UnionType;
|
|
843
903
|
(function(UnionType3) {
|
|
@@ -862,6 +922,9 @@ var Singleton;
|
|
|
862
922
|
Singleton3.Kind = "Singleton";
|
|
863
923
|
})(Singleton || (Singleton = {}));
|
|
864
924
|
|
|
925
|
+
// ../../build/common/esm/schema/constants.js
|
|
926
|
+
var SpecVersion = "1.0";
|
|
927
|
+
|
|
865
928
|
// ../../build/common/esm/schema/type-guards.js
|
|
866
929
|
function isDataType(obj) {
|
|
867
930
|
return obj && typeof obj === "object" && (obj.kind === ComplexType.Kind || obj.kind === EnumType.Kind || obj.kind === MappedType.Kind || obj.kind === SimpleType.Kind || obj.kind === UnionType.Kind);
|
|
@@ -904,35 +967,15 @@ function isContainer(obj) {
|
|
|
904
967
|
}
|
|
905
968
|
__name(isContainer, "isContainer");
|
|
906
969
|
|
|
907
|
-
// ../../build/common/esm/schema/index.js
|
|
908
|
-
var OpraSchema;
|
|
909
|
-
(function(OpraSchema2) {
|
|
910
|
-
OpraSchema2.SpecVersion = SpecVersion;
|
|
911
|
-
OpraSchema2.ComplexType = ComplexType;
|
|
912
|
-
OpraSchema2.EnumType = EnumType;
|
|
913
|
-
OpraSchema2.MappedType = MappedType;
|
|
914
|
-
OpraSchema2.SimpleType = SimpleType;
|
|
915
|
-
OpraSchema2.UnionType = UnionType;
|
|
916
|
-
OpraSchema2.Collection = Collection;
|
|
917
|
-
OpraSchema2.Container = Container;
|
|
918
|
-
OpraSchema2.Singleton = Singleton;
|
|
919
|
-
OpraSchema2.isDataType = isDataType;
|
|
920
|
-
OpraSchema2.isComplexType = isComplexType;
|
|
921
|
-
OpraSchema2.isEnumType = isEnumType;
|
|
922
|
-
OpraSchema2.isMappedType = isMappedType;
|
|
923
|
-
OpraSchema2.isSimpleType = isSimpleType;
|
|
924
|
-
OpraSchema2.isUnionType = isUnionType;
|
|
925
|
-
OpraSchema2.isResource = isResource;
|
|
926
|
-
OpraSchema2.isCollection = isCollection;
|
|
927
|
-
OpraSchema2.isContainer = isContainer;
|
|
928
|
-
OpraSchema2.isSingleton = isSingleton;
|
|
929
|
-
})(OpraSchema || (OpraSchema = {}));
|
|
930
|
-
|
|
931
970
|
// ../../build/common/esm/document/data-type/complex-type.js
|
|
932
971
|
import omit2 from "lodash.omit";
|
|
972
|
+
import merge3 from "putil-merge";
|
|
973
|
+
import * as vg2 from "valgen";
|
|
933
974
|
|
|
934
975
|
// ../../build/common/esm/document/data-type/enum-type.js
|
|
935
976
|
import omit from "lodash.omit";
|
|
977
|
+
import merge2 from "putil-merge";
|
|
978
|
+
import * as vg from "valgen";
|
|
936
979
|
|
|
937
980
|
// ../../build/common/esm/document/utils/inspect.util.js
|
|
938
981
|
var nodeInspectCustom = Symbol.for("nodejs.util.inspect.custom");
|
|
@@ -941,91 +984,103 @@ var colorFgYellow = "\x1B[33m";
|
|
|
941
984
|
var colorFgMagenta = "\x1B[35m";
|
|
942
985
|
|
|
943
986
|
// ../../build/common/esm/document/data-type/data-type.js
|
|
944
|
-
var DataType =
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
987
|
+
var DataType = class _DataType {
|
|
988
|
+
static {
|
|
989
|
+
__name(this, "DataType");
|
|
990
|
+
}
|
|
991
|
+
constructor(document, init) {
|
|
992
|
+
this.document = document;
|
|
993
|
+
this.name = init?.name;
|
|
994
|
+
this.own = {};
|
|
995
|
+
this.description = init?.description;
|
|
996
|
+
this.isAnonymous = !this.name;
|
|
997
|
+
}
|
|
998
|
+
decode(v) {
|
|
999
|
+
return this._getDecoder()(v, { coerce: true });
|
|
1000
|
+
}
|
|
1001
|
+
encode(v) {
|
|
1002
|
+
return this._getEncoder()(v, { coerce: true });
|
|
1003
|
+
}
|
|
1004
|
+
validate(v) {
|
|
1005
|
+
return this._getEncoder()(v);
|
|
948
1006
|
}
|
|
949
|
-
const _this = this;
|
|
950
|
-
_this.document = document;
|
|
951
|
-
_this.name = init?.name;
|
|
952
|
-
_this.own = {
|
|
953
|
-
description: init?.description
|
|
954
|
-
};
|
|
955
|
-
_this.description = init?.description;
|
|
956
|
-
return this;
|
|
957
|
-
}, "DataType");
|
|
958
|
-
var proto = {
|
|
959
|
-
get isAnonymous() {
|
|
960
|
-
return !this.name;
|
|
961
|
-
},
|
|
962
|
-
coerce(value) {
|
|
963
|
-
return value;
|
|
964
|
-
},
|
|
965
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
966
|
-
extendsFrom(t) {
|
|
967
|
-
return false;
|
|
968
|
-
},
|
|
969
1007
|
exportSchema() {
|
|
970
1008
|
return omitUndefined({
|
|
971
1009
|
kind: this.kind,
|
|
972
|
-
description: this.
|
|
1010
|
+
description: this.description
|
|
973
1011
|
});
|
|
974
|
-
}
|
|
1012
|
+
}
|
|
1013
|
+
extendsFrom(type) {
|
|
1014
|
+
const dataType = type instanceof _DataType ? type : this.document.getDataType(type);
|
|
1015
|
+
let t = this.base;
|
|
1016
|
+
while (t) {
|
|
1017
|
+
if (t === dataType)
|
|
1018
|
+
return true;
|
|
1019
|
+
t = t.base;
|
|
1020
|
+
}
|
|
1021
|
+
return false;
|
|
1022
|
+
}
|
|
975
1023
|
toString() {
|
|
976
1024
|
return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || "#anonymous"}]`;
|
|
977
|
-
}
|
|
1025
|
+
}
|
|
978
1026
|
[nodeInspectCustom]() {
|
|
979
1027
|
return `[${colorFgYellow + Object.getPrototypeOf(this).constructor.name + colorReset} ${colorFgMagenta + this.name + colorReset}]`;
|
|
980
1028
|
}
|
|
981
1029
|
};
|
|
982
|
-
Object.assign(DataType.prototype, proto);
|
|
983
1030
|
|
|
984
1031
|
// ../../build/common/esm/document/data-type/enum-type.js
|
|
985
|
-
var
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
};
|
|
996
|
-
|
|
997
|
-
Object.assign(metadata, omit(options, ["kind", "values"]));
|
|
998
|
-
Reflect.defineMetadata(METADATA_KEY, metadata, source);
|
|
999
|
-
return values;
|
|
1032
|
+
var EnumTypeClass = class extends DataType {
|
|
1033
|
+
static {
|
|
1034
|
+
__name(this, "EnumTypeClass");
|
|
1035
|
+
}
|
|
1036
|
+
constructor(document, init) {
|
|
1037
|
+
super(document, init);
|
|
1038
|
+
this.kind = opra_schema_ns_exports.EnumType.Kind;
|
|
1039
|
+
this.base = init.base;
|
|
1040
|
+
this.ownValues = init.values;
|
|
1041
|
+
this.ownMeanings = init.meanings || {};
|
|
1042
|
+
this.values = { ...this.base?.values, ...this.ownValues };
|
|
1043
|
+
this.meanings = { ...this.base?.meanings, ...this.ownMeanings };
|
|
1000
1044
|
}
|
|
1001
|
-
const [, init] = args;
|
|
1002
|
-
DataType.apply(this, args);
|
|
1003
|
-
const _this = this;
|
|
1004
|
-
_this.kind = OpraSchema.EnumType.Kind;
|
|
1005
|
-
_this.base = init.base;
|
|
1006
|
-
const own = _this.own;
|
|
1007
|
-
own.values = init.values;
|
|
1008
|
-
own.meanings = init.meanings || {};
|
|
1009
|
-
_this.values = { ..._this.base?.values, ...own.values };
|
|
1010
|
-
_this.meanings = { ..._this.base?.meanings, ...own.meanings };
|
|
1011
|
-
}, "EnumType");
|
|
1012
|
-
var proto2 = {
|
|
1013
1045
|
exportSchema() {
|
|
1014
1046
|
const out = DataType.prototype.exportSchema.call(this);
|
|
1015
1047
|
Object.assign(out, omitUndefined({
|
|
1016
1048
|
base: this.base ? this.base.name ? this.base.name : this.base.exportSchema() : void 0,
|
|
1017
|
-
values: this.
|
|
1018
|
-
meanings: this.
|
|
1049
|
+
values: this.ownValues,
|
|
1050
|
+
meanings: this.ownMeanings
|
|
1019
1051
|
}));
|
|
1020
1052
|
return out;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
if (!this.
|
|
1024
|
-
|
|
1053
|
+
}
|
|
1054
|
+
_getDecoder() {
|
|
1055
|
+
if (!this._decoder)
|
|
1056
|
+
this._decoder = vg.isEnum(Object.values(this.values), { enumName: this.name });
|
|
1057
|
+
return this._decoder;
|
|
1058
|
+
}
|
|
1059
|
+
_getEncoder() {
|
|
1060
|
+
return this._getDecoder();
|
|
1025
1061
|
}
|
|
1026
1062
|
};
|
|
1027
|
-
|
|
1028
|
-
|
|
1063
|
+
var EnumType2 = /* @__PURE__ */ __name(function(...args) {
|
|
1064
|
+
if (this) {
|
|
1065
|
+
const [document, init] = args;
|
|
1066
|
+
merge2(this, new EnumTypeClass(document, init), { descriptor: true });
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
const [source, options] = args;
|
|
1070
|
+
const values = Array.isArray(source) ? source.reduce((obj, v) => {
|
|
1071
|
+
obj[v] = v;
|
|
1072
|
+
return obj;
|
|
1073
|
+
}, {}) : source;
|
|
1074
|
+
const metadata = {
|
|
1075
|
+
kind: opra_schema_ns_exports.EnumType.Kind,
|
|
1076
|
+
values
|
|
1077
|
+
};
|
|
1078
|
+
if (options)
|
|
1079
|
+
Object.assign(metadata, omit(options, ["kind", "values"]));
|
|
1080
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, source);
|
|
1081
|
+
return values;
|
|
1082
|
+
}, "EnumType");
|
|
1083
|
+
EnumType2.prototype = EnumTypeClass.prototype;
|
|
1029
1084
|
|
|
1030
1085
|
// ../../build/common/esm/document/data-type/api-field.js
|
|
1031
1086
|
var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
@@ -1035,17 +1090,18 @@ var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
|
1035
1090
|
if (typeof propertyKey !== "string")
|
|
1036
1091
|
throw new TypeError(`Symbol properties can't be used as a field`);
|
|
1037
1092
|
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target.constructor) || {};
|
|
1038
|
-
metadata.kind =
|
|
1093
|
+
metadata.kind = opra_schema_ns_exports.ComplexType.Kind;
|
|
1039
1094
|
metadata.fields = metadata.fields || {};
|
|
1040
1095
|
const designType = Reflect.getMetadata("design:type", target, propertyKey);
|
|
1041
|
-
const isArray = designType === Array;
|
|
1042
1096
|
const elemMeta = metadata.fields[propertyKey] = {
|
|
1043
1097
|
...options,
|
|
1044
1098
|
enum: void 0,
|
|
1045
|
-
designType
|
|
1099
|
+
designType
|
|
1046
1100
|
};
|
|
1047
|
-
if (designType === Array)
|
|
1101
|
+
if (designType === Array) {
|
|
1048
1102
|
elemMeta.isArray = true;
|
|
1103
|
+
delete elemMeta.designType;
|
|
1104
|
+
}
|
|
1049
1105
|
if (options?.enum) {
|
|
1050
1106
|
elemMeta.type = void 0;
|
|
1051
1107
|
if (Array.isArray(options.enum)) {
|
|
@@ -1057,7 +1113,7 @@ var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
|
1057
1113
|
elemMeta.enum = enumObj;
|
|
1058
1114
|
} else {
|
|
1059
1115
|
const m = Reflect.getOwnMetadata(METADATA_KEY, options?.enum);
|
|
1060
|
-
if (!
|
|
1116
|
+
if (!opra_schema_ns_exports.isEnumType(m))
|
|
1061
1117
|
throw new TypeError(`Invalid "enum" value. Did you forget to set metadata using EnumType() method?`);
|
|
1062
1118
|
elemMeta.enum = options.enum;
|
|
1063
1119
|
}
|
|
@@ -1084,9 +1140,9 @@ var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
|
1084
1140
|
if (init?.required != null)
|
|
1085
1141
|
this.required = init?.required;
|
|
1086
1142
|
}, "ApiField");
|
|
1087
|
-
var
|
|
1143
|
+
var proto = {
|
|
1088
1144
|
exportSchema() {
|
|
1089
|
-
|
|
1145
|
+
return {
|
|
1090
1146
|
type: this.type.name ? this.type.name : this.type.exportSchema(),
|
|
1091
1147
|
description: this.description,
|
|
1092
1148
|
isArray: this.isArray,
|
|
@@ -1094,106 +1150,71 @@ var proto3 = {
|
|
|
1094
1150
|
fixed: this.fixed,
|
|
1095
1151
|
required: this.required
|
|
1096
1152
|
};
|
|
1097
|
-
return out;
|
|
1098
1153
|
}
|
|
1099
1154
|
};
|
|
1100
|
-
Object.assign(ApiField.prototype,
|
|
1155
|
+
Object.assign(ApiField.prototype, proto);
|
|
1101
1156
|
|
|
1102
1157
|
// ../../build/common/esm/document/data-type/complex-type.js
|
|
1103
|
-
var
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
const _this = this;
|
|
1122
|
-
const own = _this.own;
|
|
1123
|
-
own.ctor = init?.ctor;
|
|
1124
|
-
own.fields = new ResponsiveMap();
|
|
1125
|
-
own.abstract = init?.abstract;
|
|
1126
|
-
own.additionalFields = init?.additionalFields;
|
|
1127
|
-
_this.kind = OpraSchema.ComplexType.Kind;
|
|
1128
|
-
_this.base = init?.base;
|
|
1129
|
-
_this.ctor = own.ctor || Object;
|
|
1130
|
-
_this.abstract = own.abstract;
|
|
1131
|
-
_this.additionalFields = own.additionalFields;
|
|
1132
|
-
_this.fields = new ResponsiveMap();
|
|
1133
|
-
if (_this.base) {
|
|
1134
|
-
if (_this.additionalFields == null)
|
|
1135
|
-
_this.additionalFields = _this.base.additionalFields;
|
|
1136
|
-
if (own.ctor == null && _this.base instanceof ComplexType2)
|
|
1137
|
-
_this.ctor = _this.base.ctor;
|
|
1138
|
-
if (_this.base.fields)
|
|
1139
|
-
for (const [k, el] of _this.base.fields.entries()) {
|
|
1140
|
-
const newEl = new ApiField(_this, el);
|
|
1141
|
-
_this.fields.set(k, newEl);
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
}, "ComplexType");
|
|
1145
|
-
Object.setPrototypeOf(ComplexType2.prototype, DataType.prototype);
|
|
1146
|
-
var proto4 = {
|
|
1147
|
-
extendsFrom(t) {
|
|
1148
|
-
const base = t instanceof DataType ? t : this.document.getDataType(t);
|
|
1158
|
+
var ComplexTypeClass = class extends DataType {
|
|
1159
|
+
static {
|
|
1160
|
+
__name(this, "ComplexTypeClass");
|
|
1161
|
+
}
|
|
1162
|
+
constructor(document, init) {
|
|
1163
|
+
super(document, init);
|
|
1164
|
+
this.kind = opra_schema_ns_exports.ComplexType.Kind;
|
|
1165
|
+
const own = this.own = {};
|
|
1166
|
+
own.ctor = init?.ctor;
|
|
1167
|
+
own.abstract = init?.abstract;
|
|
1168
|
+
own.additionalFields = init?.additionalFields;
|
|
1169
|
+
own.fields = new ResponsiveMap();
|
|
1170
|
+
this.kind = opra_schema_ns_exports.ComplexType.Kind;
|
|
1171
|
+
this.base = init?.base;
|
|
1172
|
+
this.ctor = own.ctor || Object;
|
|
1173
|
+
this.abstract = own.abstract;
|
|
1174
|
+
this.additionalFields = own.additionalFields;
|
|
1175
|
+
this.fields = new ResponsiveMap();
|
|
1149
1176
|
if (this.base) {
|
|
1150
|
-
if (this.
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
base: this.base ? this.base.name ? this.base.name : this.base.exportSchema() : void 0,
|
|
1160
|
-
abstract: this.own.abstract,
|
|
1161
|
-
additionalFields: this.own.additionalFields
|
|
1162
|
-
}));
|
|
1163
|
-
if (this.own.fields.size) {
|
|
1164
|
-
const fields = out.fields = {};
|
|
1165
|
-
for (const field of this.own.fields.values()) {
|
|
1166
|
-
fields[field.name] = field.exportSchema();
|
|
1167
|
-
}
|
|
1177
|
+
if (this.additionalFields == null)
|
|
1178
|
+
this.additionalFields = this.base.additionalFields;
|
|
1179
|
+
if (own.ctor == null && this.base instanceof ComplexType2)
|
|
1180
|
+
this.ctor = this.base.ctor;
|
|
1181
|
+
if (this.base.fields)
|
|
1182
|
+
for (const [k, el] of this.base.fields.entries()) {
|
|
1183
|
+
const newEl = new ApiField(this, el);
|
|
1184
|
+
this.fields.set(k, newEl);
|
|
1185
|
+
}
|
|
1168
1186
|
}
|
|
1169
|
-
|
|
1170
|
-
},
|
|
1187
|
+
}
|
|
1171
1188
|
addField(init) {
|
|
1172
1189
|
const field = new ApiField(this, init);
|
|
1173
1190
|
this.own.fields.set(field.name, field);
|
|
1174
1191
|
this.fields.set(field.name, field);
|
|
1175
1192
|
return field;
|
|
1176
|
-
}
|
|
1193
|
+
}
|
|
1177
1194
|
findField(nameOrPath) {
|
|
1178
1195
|
let field;
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1196
|
+
if (nameOrPath.includes(".")) {
|
|
1197
|
+
for (const [, f] of this.iteratePath(nameOrPath, true)) {
|
|
1198
|
+
if (!f)
|
|
1199
|
+
return;
|
|
1200
|
+
field = f;
|
|
1201
|
+
}
|
|
1202
|
+
return field;
|
|
1183
1203
|
}
|
|
1184
|
-
return
|
|
1185
|
-
}
|
|
1204
|
+
return this.fields.get(nameOrPath);
|
|
1205
|
+
}
|
|
1186
1206
|
getField(nameOrPath) {
|
|
1187
1207
|
let field;
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
}
|
|
1208
|
+
if (nameOrPath.includes(".")) {
|
|
1209
|
+
for (const [, f] of this.iteratePath(nameOrPath)) {
|
|
1210
|
+
field = f;
|
|
1211
|
+
}
|
|
1212
|
+
} else
|
|
1213
|
+
field = this.fields.get(nameOrPath);
|
|
1193
1214
|
if (!field)
|
|
1194
|
-
throw new Error(`
|
|
1215
|
+
throw new Error(`Unknown field "${nameOrPath}"`);
|
|
1195
1216
|
return field;
|
|
1196
|
-
}
|
|
1217
|
+
}
|
|
1197
1218
|
iteratePath(path3, silent) {
|
|
1198
1219
|
const arr = path3.split(".");
|
|
1199
1220
|
const len = arr.length;
|
|
@@ -1234,70 +1255,119 @@ var proto4 = {
|
|
|
1234
1255
|
};
|
|
1235
1256
|
}
|
|
1236
1257
|
};
|
|
1237
|
-
}
|
|
1238
|
-
normalizeFieldPath(
|
|
1239
|
-
if (Array.isArray(
|
|
1240
|
-
return
|
|
1258
|
+
}
|
|
1259
|
+
normalizeFieldPath(fieldPaths) {
|
|
1260
|
+
if (Array.isArray(fieldPaths))
|
|
1261
|
+
return fieldPaths.map((s) => this.normalizeFieldPath(s));
|
|
1241
1262
|
let curPath = "";
|
|
1242
|
-
for (const [, , p] of this.iteratePath(
|
|
1263
|
+
for (const [, , p] of this.iteratePath(fieldPaths)) {
|
|
1243
1264
|
curPath = p;
|
|
1244
1265
|
}
|
|
1245
1266
|
return curPath;
|
|
1246
1267
|
}
|
|
1247
|
-
};
|
|
1248
|
-
Object.assign(ComplexType2.prototype, proto4);
|
|
1249
|
-
Object.setPrototypeOf(ComplexType2.prototype, DataType.prototype);
|
|
1250
|
-
|
|
1251
|
-
// ../../build/common/esm/document/data-type/simple-type.js
|
|
1252
|
-
import omit3 from "lodash.omit";
|
|
1253
|
-
var SimpleType2 = /* @__PURE__ */ __name(function(...args) {
|
|
1254
|
-
if (!this) {
|
|
1255
|
-
const [options2] = args;
|
|
1256
|
-
return function(target) {
|
|
1257
|
-
let name = options2?.name || target.name.match(TYPENAME_PATTERN)?.[1] || target.name;
|
|
1258
|
-
name = name.charAt(0).toLowerCase() + name.substring(1);
|
|
1259
|
-
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target) || {};
|
|
1260
|
-
metadata.kind = OpraSchema.SimpleType.Kind;
|
|
1261
|
-
metadata.name = name;
|
|
1262
|
-
if (options2)
|
|
1263
|
-
Object.assign(metadata, omit3(options2, ["kind", "name", "base"]));
|
|
1264
|
-
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
1265
|
-
};
|
|
1266
|
-
}
|
|
1267
|
-
const [, options] = args;
|
|
1268
|
-
DataType.apply(this, args);
|
|
1269
|
-
const _this = this;
|
|
1270
|
-
_this.kind = OpraSchema.SimpleType.Kind;
|
|
1271
|
-
_this.base = options?.base;
|
|
1272
|
-
const own = _this.own;
|
|
1273
|
-
own.codec = options?.codec;
|
|
1274
|
-
own.ctor = options?.ctor;
|
|
1275
|
-
if (options?.pattern)
|
|
1276
|
-
own.pattern = options?.pattern instanceof RegExp ? options.pattern : new RegExp(options.pattern);
|
|
1277
|
-
const ctor = own.ctor || _this.base?.ctor;
|
|
1278
|
-
_this.ctor = ctor || Object;
|
|
1279
|
-
_this.decode = own.codec?.decode || _this.base?.decode || ((v) => v);
|
|
1280
|
-
_this.encode = own.codec?.encode || _this.base?.encode || ((v) => v);
|
|
1281
|
-
_this.coerce = own.codec?.coerce || _this.base?.coerce || ((v) => v);
|
|
1282
|
-
_this.validate = own.codec?.validate || _this.base?.validate || (() => true);
|
|
1283
|
-
_this.pattern = own.pattern || _this.base?.pattern;
|
|
1284
|
-
}, "SimpleType");
|
|
1285
|
-
var proto5 = {
|
|
1286
1268
|
exportSchema() {
|
|
1287
|
-
const out =
|
|
1269
|
+
const out = super.exportSchema();
|
|
1288
1270
|
Object.assign(out, omitUndefined({
|
|
1289
1271
|
base: this.base ? this.base.name ? this.base.name : this.base.exportSchema() : void 0,
|
|
1290
|
-
|
|
1272
|
+
abstract: this.own.abstract,
|
|
1273
|
+
additionalFields: this.own.additionalFields
|
|
1291
1274
|
}));
|
|
1292
|
-
|
|
1275
|
+
if (this.own.fields.size) {
|
|
1276
|
+
const fields = out.fields = {};
|
|
1277
|
+
for (const field of this.own.fields.values()) {
|
|
1278
|
+
fields[field.name] = field.exportSchema();
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
return omitUndefined(out);
|
|
1282
|
+
}
|
|
1283
|
+
isTypeOf(t) {
|
|
1284
|
+
return t === this.own.ctor;
|
|
1285
|
+
}
|
|
1286
|
+
extendsFrom(t) {
|
|
1287
|
+
const base = t instanceof DataType ? t : this.document.getDataType(t);
|
|
1288
|
+
if (this.base) {
|
|
1289
|
+
if (this.base === base)
|
|
1290
|
+
return true;
|
|
1291
|
+
return this.base.extendsFrom(base);
|
|
1292
|
+
}
|
|
1293
|
+
return false;
|
|
1294
|
+
}
|
|
1295
|
+
decode(v) {
|
|
1296
|
+
return this._getDecoder()(v, { coerce: true });
|
|
1297
|
+
}
|
|
1298
|
+
encode(v) {
|
|
1299
|
+
return this._getEncoder()(v, { coerce: true });
|
|
1300
|
+
}
|
|
1301
|
+
validate(v) {
|
|
1302
|
+
return this._getEncoder()(v);
|
|
1303
|
+
}
|
|
1304
|
+
_getDecoder() {
|
|
1305
|
+
if (this._decoder)
|
|
1306
|
+
return this._decoder;
|
|
1307
|
+
const schema = {};
|
|
1308
|
+
for (const f of this.fields.values()) {
|
|
1309
|
+
let t = f.type._getDecoder();
|
|
1310
|
+
if (f.isArray)
|
|
1311
|
+
t = vg2.isArray(t);
|
|
1312
|
+
schema[f.name] = f.required ? vg2.required(t) : vg2.optional(t);
|
|
1313
|
+
}
|
|
1314
|
+
this._decoder = vg2.isObject(schema, {
|
|
1315
|
+
ctor: this.ctor,
|
|
1316
|
+
additionalFields: this.additionalFields ?? "ignore",
|
|
1317
|
+
name: this.name,
|
|
1318
|
+
caseInSensitive: true
|
|
1319
|
+
});
|
|
1320
|
+
return this._decoder;
|
|
1321
|
+
}
|
|
1322
|
+
_getEncoder() {
|
|
1323
|
+
if (this._encoder)
|
|
1324
|
+
return this._encoder;
|
|
1325
|
+
const schema = {};
|
|
1326
|
+
for (const f of this.fields.values()) {
|
|
1327
|
+
let t = f.type._getEncoder();
|
|
1328
|
+
if (f.isArray)
|
|
1329
|
+
t = vg2.isArray(t);
|
|
1330
|
+
schema[f.name] = t;
|
|
1331
|
+
}
|
|
1332
|
+
this._encoder = vg2.isObject(schema, {
|
|
1333
|
+
ctor: this.ctor,
|
|
1334
|
+
additionalFields: this.additionalFields,
|
|
1335
|
+
name: this.name,
|
|
1336
|
+
caseInSensitive: true,
|
|
1337
|
+
detectCircular: true
|
|
1338
|
+
});
|
|
1339
|
+
return this._encoder;
|
|
1293
1340
|
}
|
|
1294
1341
|
};
|
|
1295
|
-
|
|
1296
|
-
|
|
1342
|
+
var ComplexType2 = /* @__PURE__ */ __name(function(...args) {
|
|
1343
|
+
if (this) {
|
|
1344
|
+
const [document, init] = args;
|
|
1345
|
+
merge3(this, new ComplexTypeClass(document, init), { descriptor: true });
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
const [options] = args;
|
|
1349
|
+
return function(target) {
|
|
1350
|
+
const name = options?.name || target.name.match(TYPENAME_PATTERN)?.[1] || target.name;
|
|
1351
|
+
let metadata = Reflect.getOwnMetadata(METADATA_KEY, target);
|
|
1352
|
+
if (!metadata) {
|
|
1353
|
+
metadata = {};
|
|
1354
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
1355
|
+
}
|
|
1356
|
+
metadata.kind = opra_schema_ns_exports.ComplexType.Kind;
|
|
1357
|
+
metadata.name = name;
|
|
1358
|
+
if (options)
|
|
1359
|
+
Object.assign(metadata, omit2(options, ["kind", "name", "base", "fields"]));
|
|
1360
|
+
};
|
|
1361
|
+
}, "ComplexType");
|
|
1362
|
+
ComplexType2.prototype = ComplexTypeClass.prototype;
|
|
1297
1363
|
|
|
1298
1364
|
// ../../build/common/esm/document/api-document.js
|
|
1299
1365
|
var ApiDocument = class {
|
|
1366
|
+
static {
|
|
1367
|
+
__name(this, "ApiDocument");
|
|
1368
|
+
}
|
|
1300
1369
|
constructor() {
|
|
1370
|
+
this._designCtorMap = /* @__PURE__ */ new Map();
|
|
1301
1371
|
this._typeCache = new ResponsiveMap();
|
|
1302
1372
|
this._typesCacheByCtor = /* @__PURE__ */ new Map();
|
|
1303
1373
|
this.references = new ResponsiveMap();
|
|
@@ -1307,51 +1377,72 @@ var ApiDocument = class {
|
|
|
1307
1377
|
version: "",
|
|
1308
1378
|
title: ""
|
|
1309
1379
|
};
|
|
1380
|
+
const BigIntConstructor = Object.getPrototypeOf(BigInt(0)).constructor;
|
|
1381
|
+
const BufferConstructor = Object.getPrototypeOf(Buffer.from([]));
|
|
1382
|
+
this._designCtorMap.set(String, "string");
|
|
1383
|
+
this._designCtorMap.set(Number, "number");
|
|
1384
|
+
this._designCtorMap.set(Boolean, "boolean");
|
|
1385
|
+
this._designCtorMap.set(Object, "any");
|
|
1386
|
+
this._designCtorMap.set(Date, "timestamp");
|
|
1387
|
+
this._designCtorMap.set(BigIntConstructor, "bigint");
|
|
1388
|
+
this._designCtorMap.set(ArrayBuffer, "base64");
|
|
1389
|
+
this._designCtorMap.set(SharedArrayBuffer, "base64");
|
|
1390
|
+
this._designCtorMap.set(BufferConstructor, "base64");
|
|
1310
1391
|
}
|
|
1311
|
-
|
|
1392
|
+
/**
|
|
1393
|
+
*
|
|
1394
|
+
*/
|
|
1395
|
+
getDataType(arg0, silent) {
|
|
1312
1396
|
let dataType;
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
const nameOrCtorName = typeof nameOrCtor === "function" ? nameOrCtor.name : nameOrCtor;
|
|
1316
|
-
const t = typeof nameOrCtor === "string" ? this._typeCache.get(nameOrCtor) : this._typesCacheByCtor.get(nameOrCtor);
|
|
1397
|
+
const name = typeof arg0 === "function" ? arg0.name : arg0;
|
|
1398
|
+
const t = typeof arg0 === "string" ? this._typeCache.get(arg0) : this._typesCacheByCtor.get(arg0);
|
|
1317
1399
|
if (t)
|
|
1318
1400
|
return t;
|
|
1319
1401
|
if (t === null) {
|
|
1320
1402
|
if (silent)
|
|
1321
1403
|
return;
|
|
1322
|
-
throw new
|
|
1404
|
+
throw new Error(`Data type "${name}" does not exists`);
|
|
1323
1405
|
}
|
|
1324
|
-
if (typeof
|
|
1325
|
-
const
|
|
1406
|
+
if (typeof arg0 === "function") {
|
|
1407
|
+
const x = this._designCtorMap.get(arg0);
|
|
1408
|
+
if (x)
|
|
1409
|
+
arg0 = x;
|
|
1410
|
+
}
|
|
1411
|
+
if (typeof arg0 === "string") {
|
|
1412
|
+
const m = NAMESPACE_PATTERN.exec(arg0);
|
|
1326
1413
|
if (!m)
|
|
1327
|
-
throw new
|
|
1414
|
+
throw new TypeError(`Invalid data type name "${name}"`);
|
|
1328
1415
|
if (m[2]) {
|
|
1329
1416
|
const ref = this.references.get(m[1]);
|
|
1330
1417
|
if (!ref) {
|
|
1331
1418
|
if (silent)
|
|
1332
1419
|
return;
|
|
1333
|
-
throw new
|
|
1420
|
+
throw new Error(`No referenced document found for given namespace "${m[1]}"`);
|
|
1334
1421
|
}
|
|
1335
|
-
dataType = ref.getDataType(m[2]);
|
|
1336
|
-
this._typeCache.set(nameOrCtor, dataType);
|
|
1422
|
+
dataType = ref.getDataType(m[2], silent);
|
|
1337
1423
|
} else {
|
|
1338
|
-
|
|
1339
|
-
dataType = this.types.get(name);
|
|
1424
|
+
dataType = this.types.get(arg0);
|
|
1340
1425
|
if (!dataType) {
|
|
1341
1426
|
const references = Array.from(this.references.values()).reverse();
|
|
1342
1427
|
for (const ref of references) {
|
|
1343
|
-
dataType = ref.getDataType(name);
|
|
1428
|
+
dataType = ref.getDataType(name, true);
|
|
1344
1429
|
if (dataType)
|
|
1345
1430
|
break;
|
|
1346
1431
|
}
|
|
1347
1432
|
}
|
|
1348
|
-
if (dataType)
|
|
1349
|
-
this._typeCache.set(dataType.name || name, dataType);
|
|
1350
1433
|
}
|
|
1351
|
-
|
|
1434
|
+
if (dataType) {
|
|
1435
|
+
this._typeCache.set(arg0, dataType);
|
|
1436
|
+
return dataType;
|
|
1437
|
+
}
|
|
1438
|
+
if (!silent)
|
|
1439
|
+
throw new NotFoundError(`Data type "${arg0}" does not exists`);
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
if (typeof arg0 === "function") {
|
|
1352
1443
|
const types = Array.from(this.types.values()).reverse();
|
|
1353
1444
|
for (const dt of types) {
|
|
1354
|
-
if (
|
|
1445
|
+
if (dt instanceof ComplexType2 && dt.isTypeOf(arg0)) {
|
|
1355
1446
|
dataType = dt;
|
|
1356
1447
|
break;
|
|
1357
1448
|
}
|
|
@@ -1359,25 +1450,21 @@ var ApiDocument = class {
|
|
|
1359
1450
|
if (!dataType) {
|
|
1360
1451
|
const references = Array.from(this.references.values()).reverse();
|
|
1361
1452
|
for (const ref of references) {
|
|
1362
|
-
dataType = ref.getDataType(
|
|
1453
|
+
dataType = ref.getDataType(arg0, true);
|
|
1363
1454
|
if (dataType)
|
|
1364
1455
|
break;
|
|
1365
1456
|
}
|
|
1366
1457
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
if (
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
if (typeof nameOrCtor === "string")
|
|
1374
|
-
this._typeCache.set(nameOrCtor, null);
|
|
1375
|
-
else
|
|
1376
|
-
this._typesCacheByCtor.set(nameOrCtor, null);
|
|
1377
|
-
}
|
|
1378
|
-
if (silent)
|
|
1458
|
+
if (dataType)
|
|
1459
|
+
this._typesCacheByCtor.set(arg0, dataType);
|
|
1460
|
+
if (dataType)
|
|
1461
|
+
return dataType;
|
|
1462
|
+
if (!silent)
|
|
1463
|
+
throw new NotFoundError(`No data type mapping found for class "${name}"`);
|
|
1379
1464
|
return;
|
|
1380
|
-
|
|
1465
|
+
}
|
|
1466
|
+
if (!silent)
|
|
1467
|
+
throw new TypeError("Invalid argument");
|
|
1381
1468
|
}
|
|
1382
1469
|
getComplexType(nameOrCtor, silent) {
|
|
1383
1470
|
if (nameOrCtor === Object)
|
|
@@ -1385,7 +1472,7 @@ var ApiDocument = class {
|
|
|
1385
1472
|
const t = this.getDataType(nameOrCtor);
|
|
1386
1473
|
if (!t && silent)
|
|
1387
1474
|
return;
|
|
1388
|
-
if (t && t.kind ===
|
|
1475
|
+
if (t && t.kind === opra_schema_ns_exports.ComplexType.Kind)
|
|
1389
1476
|
return t;
|
|
1390
1477
|
throw new NotAcceptableError(`Data type "${t.name}" is not a ComplexType`);
|
|
1391
1478
|
}
|
|
@@ -1393,7 +1480,7 @@ var ApiDocument = class {
|
|
|
1393
1480
|
const t = this.getDataType(nameOrCtor);
|
|
1394
1481
|
if (!t && silent)
|
|
1395
1482
|
return;
|
|
1396
|
-
if (t && t.kind ===
|
|
1483
|
+
if (t && t.kind === opra_schema_ns_exports.SimpleType.Kind)
|
|
1397
1484
|
return t;
|
|
1398
1485
|
throw new NotAcceptableError(`Data type "${t.name || t}" is not a SimpleType`);
|
|
1399
1486
|
}
|
|
@@ -1430,7 +1517,7 @@ var ApiDocument = class {
|
|
|
1430
1517
|
const t = this.getResource(path3);
|
|
1431
1518
|
if (!t && silent)
|
|
1432
1519
|
return;
|
|
1433
|
-
if (t && t.kind ===
|
|
1520
|
+
if (t && t.kind === opra_schema_ns_exports.Collection.Kind)
|
|
1434
1521
|
return t;
|
|
1435
1522
|
throw new NotAcceptableError(`Resource type "${t.name}" is not a Collection`);
|
|
1436
1523
|
}
|
|
@@ -1438,7 +1525,7 @@ var ApiDocument = class {
|
|
|
1438
1525
|
const t = this.getResource(path3);
|
|
1439
1526
|
if (!t && silent)
|
|
1440
1527
|
return;
|
|
1441
|
-
if (t && t.kind ===
|
|
1528
|
+
if (t && t.kind === opra_schema_ns_exports.Singleton.Kind)
|
|
1442
1529
|
return t;
|
|
1443
1530
|
throw new NotAcceptableError(`Resource type "${t.name}" is not a Singleton`);
|
|
1444
1531
|
}
|
|
@@ -1447,7 +1534,7 @@ var ApiDocument = class {
|
|
|
1447
1534
|
*/
|
|
1448
1535
|
exportSchema() {
|
|
1449
1536
|
const schema = {
|
|
1450
|
-
version:
|
|
1537
|
+
version: opra_schema_ns_exports.SpecVersion,
|
|
1451
1538
|
url: this.url,
|
|
1452
1539
|
info: cloneObject(this.info)
|
|
1453
1540
|
};
|
|
@@ -1482,7 +1569,6 @@ var ApiDocument = class {
|
|
|
1482
1569
|
this._typesCacheByCtor.clear();
|
|
1483
1570
|
}
|
|
1484
1571
|
};
|
|
1485
|
-
__name(ApiDocument, "ApiDocument");
|
|
1486
1572
|
|
|
1487
1573
|
// ../../build/common/esm/document/factory/add-references.js
|
|
1488
1574
|
async function addReferences(references) {
|
|
@@ -1500,7 +1586,7 @@ async function addReferences(references) {
|
|
|
1500
1586
|
}
|
|
1501
1587
|
__name(addReferences, "addReferences");
|
|
1502
1588
|
|
|
1503
|
-
// ../../node_modules/tslib/tslib.es6.
|
|
1589
|
+
// ../../node_modules/tslib/tslib.es6.mjs
|
|
1504
1590
|
function __decorate(decorators, target, key, desc) {
|
|
1505
1591
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1506
1592
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1513,261 +1599,245 @@ function __decorate(decorators, target, key, desc) {
|
|
|
1513
1599
|
}
|
|
1514
1600
|
__name(__decorate, "__decorate");
|
|
1515
1601
|
|
|
1602
|
+
// ../../build/common/esm/document/data-type/simple-type.js
|
|
1603
|
+
import omit3 from "lodash.omit";
|
|
1604
|
+
import merge4 from "putil-merge";
|
|
1605
|
+
import * as vg3 from "valgen";
|
|
1606
|
+
var SimpleTypeClass = class extends DataType {
|
|
1607
|
+
static {
|
|
1608
|
+
__name(this, "SimpleTypeClass");
|
|
1609
|
+
}
|
|
1610
|
+
constructor(document, init) {
|
|
1611
|
+
super(document, init);
|
|
1612
|
+
this.kind = opra_schema_ns_exports.SimpleType.Kind;
|
|
1613
|
+
this.base = init.base;
|
|
1614
|
+
this._decoder = init.decoder || init.base?._decoder || vg3.isAny();
|
|
1615
|
+
this._encoder = init.encoder || init.base?._encoder || vg3.isAny();
|
|
1616
|
+
}
|
|
1617
|
+
_getDecoder() {
|
|
1618
|
+
return this._decoder;
|
|
1619
|
+
}
|
|
1620
|
+
_getEncoder() {
|
|
1621
|
+
return this._encoder;
|
|
1622
|
+
}
|
|
1623
|
+
exportSchema() {
|
|
1624
|
+
const out = super.exportSchema();
|
|
1625
|
+
return out;
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
var SimpleType2 = /* @__PURE__ */ __name(function(...args) {
|
|
1629
|
+
if (this) {
|
|
1630
|
+
const [document, init] = args;
|
|
1631
|
+
merge4(this, new SimpleTypeClass(document, init), { descriptor: true });
|
|
1632
|
+
return;
|
|
1633
|
+
}
|
|
1634
|
+
const [options] = args;
|
|
1635
|
+
return function(target) {
|
|
1636
|
+
let name = options?.name || target.name.match(TYPENAME_PATTERN)?.[1] || target.name;
|
|
1637
|
+
name = name.charAt(0).toLowerCase() + name.substring(1);
|
|
1638
|
+
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target) || {};
|
|
1639
|
+
metadata.kind = opra_schema_ns_exports.SimpleType.Kind;
|
|
1640
|
+
metadata.name = name;
|
|
1641
|
+
if (options)
|
|
1642
|
+
Object.assign(metadata, omit3(options, ["kind", "name"]));
|
|
1643
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
1644
|
+
};
|
|
1645
|
+
}, "SimpleType");
|
|
1646
|
+
SimpleType2.prototype = SimpleTypeClass.prototype;
|
|
1647
|
+
|
|
1516
1648
|
// ../../build/common/esm/document/data-type/builtin/any.type.js
|
|
1517
|
-
var AnyType =
|
|
1518
|
-
|
|
1649
|
+
var AnyType = class AnyType2 {
|
|
1650
|
+
static {
|
|
1651
|
+
__name(this, "AnyType");
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1519
1654
|
AnyType = __decorate([
|
|
1520
1655
|
SimpleType2({
|
|
1521
|
-
description: "
|
|
1522
|
-
ctor: Object
|
|
1656
|
+
description: "Represents any value"
|
|
1523
1657
|
})
|
|
1524
1658
|
], AnyType);
|
|
1525
1659
|
|
|
1526
1660
|
// ../../build/common/esm/document/data-type/builtin/base64.type.js
|
|
1527
|
-
|
|
1528
|
-
var Base64Type =
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
return v;
|
|
1532
|
-
if (typeof v === "string")
|
|
1533
|
-
this.validate(v);
|
|
1534
|
-
return Buffer.from(v, "base64").buffer.slice(0);
|
|
1535
|
-
}
|
|
1536
|
-
encode(v) {
|
|
1537
|
-
if (v == null)
|
|
1538
|
-
return v;
|
|
1539
|
-
if (Buffer.isBuffer(v))
|
|
1540
|
-
return v.toString("base64");
|
|
1541
|
-
return Buffer.from(v).toString("base64");
|
|
1661
|
+
import { isBase64 } from "valgen";
|
|
1662
|
+
var Base64Type = class Base64Type2 {
|
|
1663
|
+
static {
|
|
1664
|
+
__name(this, "Base64Type");
|
|
1542
1665
|
}
|
|
1543
|
-
|
|
1544
|
-
if (v instanceof ArrayBuffer)
|
|
1545
|
-
return v;
|
|
1546
|
-
return this.decode(v);
|
|
1547
|
-
}
|
|
1548
|
-
validate(v) {
|
|
1549
|
-
if (!(typeof v === "string" && BASE64_PATTERN.test(v)))
|
|
1550
|
-
throw new TypeError(`Invalid base64 value "${String(v).substring(0, 10)}..."`);
|
|
1551
|
-
}
|
|
1552
|
-
}, "Base64Type");
|
|
1666
|
+
};
|
|
1553
1667
|
Base64Type = __decorate([
|
|
1554
1668
|
SimpleType2({
|
|
1555
1669
|
description: "A stream of bytes, base64 encoded",
|
|
1556
|
-
|
|
1670
|
+
decoder: isBase64(),
|
|
1671
|
+
encoder: isBase64()
|
|
1557
1672
|
})
|
|
1558
1673
|
], Base64Type);
|
|
1559
1674
|
|
|
1560
1675
|
// ../../build/common/esm/document/data-type/builtin/bigint.type.js
|
|
1561
|
-
|
|
1562
|
-
var
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
return v;
|
|
1566
|
-
return typeof v === "bigint" ? v : BigInt(v);
|
|
1567
|
-
}
|
|
1568
|
-
encode(v) {
|
|
1569
|
-
if (v == null)
|
|
1570
|
-
return v;
|
|
1571
|
-
return typeof v === "bigint" ? String(v) : void 0;
|
|
1572
|
-
}
|
|
1573
|
-
coerce(v) {
|
|
1574
|
-
return this.decode(v);
|
|
1575
|
-
}
|
|
1576
|
-
validate(v) {
|
|
1577
|
-
if (!(typeof v === "number" && !isNaN(v) || typeof v === "bigint"))
|
|
1578
|
-
throw new TypeError(`Invalid number value "${v}"`);
|
|
1676
|
+
import { isBigint, isString, pipe } from "valgen";
|
|
1677
|
+
var BigintType = class BigintType2 {
|
|
1678
|
+
static {
|
|
1679
|
+
__name(this, "BigintType");
|
|
1579
1680
|
}
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1681
|
+
};
|
|
1682
|
+
BigintType = __decorate([
|
|
1582
1683
|
SimpleType2({
|
|
1583
|
-
name: "bigint",
|
|
1584
1684
|
description: "BigInt number",
|
|
1585
|
-
|
|
1685
|
+
decoder: isBigint(),
|
|
1686
|
+
encoder: pipe(isBigint(), isString())
|
|
1586
1687
|
})
|
|
1587
|
-
],
|
|
1688
|
+
], BigintType);
|
|
1588
1689
|
|
|
1589
1690
|
// ../../build/common/esm/document/data-type/builtin/boolean.type.js
|
|
1590
|
-
import {
|
|
1591
|
-
var BooleanType =
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
return v;
|
|
1595
|
-
return toBoolean(v);
|
|
1596
|
-
}
|
|
1597
|
-
encode(v) {
|
|
1598
|
-
if (v == null)
|
|
1599
|
-
return v;
|
|
1600
|
-
return toBoolean(v);
|
|
1691
|
+
import { isBoolean } from "valgen";
|
|
1692
|
+
var BooleanType = class BooleanType2 {
|
|
1693
|
+
static {
|
|
1694
|
+
__name(this, "BooleanType");
|
|
1601
1695
|
}
|
|
1602
|
-
|
|
1603
|
-
return this.decode(v);
|
|
1604
|
-
}
|
|
1605
|
-
}, "BooleanType");
|
|
1696
|
+
};
|
|
1606
1697
|
BooleanType = __decorate([
|
|
1607
1698
|
SimpleType2({
|
|
1608
1699
|
description: "Simple true/false value",
|
|
1609
|
-
|
|
1700
|
+
decoder: isBoolean(),
|
|
1701
|
+
encoder: isBoolean()
|
|
1610
1702
|
})
|
|
1611
1703
|
], BooleanType);
|
|
1612
1704
|
|
|
1613
|
-
// ../../build/common/esm/document/data-type/builtin/timestamp.type.js
|
|
1614
|
-
import dayjs from "dayjs";
|
|
1615
|
-
var TimestampType = /* @__PURE__ */ __name(class TimestampType2 {
|
|
1616
|
-
constructor() {
|
|
1617
|
-
this.format = "YYYY-MM-DDTHH:mm:ss";
|
|
1618
|
-
}
|
|
1619
|
-
decode(v) {
|
|
1620
|
-
return dayjs(v).toDate();
|
|
1621
|
-
}
|
|
1622
|
-
encode(v) {
|
|
1623
|
-
if (!v)
|
|
1624
|
-
return void 0;
|
|
1625
|
-
const d = dayjs(v);
|
|
1626
|
-
if (!d.isValid())
|
|
1627
|
-
throw new TypeError(`Invalid date value ${v}`);
|
|
1628
|
-
return dayjs(v).format(this.format);
|
|
1629
|
-
}
|
|
1630
|
-
}, "TimestampType");
|
|
1631
|
-
TimestampType = __decorate([
|
|
1632
|
-
SimpleType2({
|
|
1633
|
-
description: "date-time notation as defined by RFC 3339, section 5.6, for example, 2021-04-18T09:12:53",
|
|
1634
|
-
ctor: Date
|
|
1635
|
-
})
|
|
1636
|
-
], TimestampType);
|
|
1637
|
-
|
|
1638
1705
|
// ../../build/common/esm/document/data-type/builtin/date.type.js
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
this
|
|
1706
|
+
import { isDate, isDateString } from "valgen";
|
|
1707
|
+
var DateType = class DateType2 {
|
|
1708
|
+
static {
|
|
1709
|
+
__name(this, "DateType");
|
|
1643
1710
|
}
|
|
1644
|
-
}
|
|
1711
|
+
};
|
|
1645
1712
|
DateType = __decorate([
|
|
1646
1713
|
SimpleType2({
|
|
1647
|
-
description: "
|
|
1714
|
+
description: "Date only string, for example, 2021-04-18",
|
|
1715
|
+
decoder: isDate({
|
|
1716
|
+
format: [
|
|
1717
|
+
"YYYY-MM-DD",
|
|
1718
|
+
"YYYY",
|
|
1719
|
+
"YYYY-MM-DDTHH:mm:ss",
|
|
1720
|
+
"YYYY-MM-DDTHH:mm",
|
|
1721
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
1722
|
+
"YYYY-MM-DD HH:mm"
|
|
1723
|
+
]
|
|
1724
|
+
}),
|
|
1725
|
+
encoder: isDateString({ format: "YYYY-MM-DD" })
|
|
1648
1726
|
})
|
|
1649
1727
|
], DateType);
|
|
1650
1728
|
|
|
1651
|
-
// ../../build/common/esm/document/data-type/builtin/
|
|
1652
|
-
import {
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
var StringType = /* @__PURE__ */ __name(class StringType2 {
|
|
1657
|
-
decode(v) {
|
|
1658
|
-
return toString(v);
|
|
1659
|
-
}
|
|
1660
|
-
encode(v) {
|
|
1661
|
-
return toString(v);
|
|
1662
|
-
}
|
|
1663
|
-
coerce(v) {
|
|
1664
|
-
return this.decode(v);
|
|
1729
|
+
// ../../build/common/esm/document/data-type/builtin/uuid.type.js
|
|
1730
|
+
import { isUUID } from "valgen";
|
|
1731
|
+
var UuidType = class UuidType2 {
|
|
1732
|
+
static {
|
|
1733
|
+
__name(this, "UuidType");
|
|
1665
1734
|
}
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1735
|
+
};
|
|
1736
|
+
UuidType = __decorate([
|
|
1668
1737
|
SimpleType2({
|
|
1669
|
-
description: "A
|
|
1670
|
-
|
|
1738
|
+
description: "A Universal Unique Identifier (UUID) value",
|
|
1739
|
+
decoder: isUUID(),
|
|
1740
|
+
encoder: isUUID()
|
|
1671
1741
|
})
|
|
1672
|
-
],
|
|
1742
|
+
], UuidType);
|
|
1673
1743
|
|
|
1674
|
-
// ../../build/common/esm/document/data-type/builtin/
|
|
1675
|
-
|
|
1676
|
-
var
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
return v;
|
|
1680
|
-
const s = toString2(v);
|
|
1681
|
-
if (s)
|
|
1682
|
-
this.validate(s);
|
|
1683
|
-
return s;
|
|
1684
|
-
}
|
|
1685
|
-
encode(v) {
|
|
1686
|
-
return this.decode(v);
|
|
1687
|
-
}
|
|
1688
|
-
coerce(v) {
|
|
1689
|
-
return this.decode(v);
|
|
1690
|
-
}
|
|
1691
|
-
validate(v) {
|
|
1692
|
-
if (typeof v === "string" && !GUID_PATTERN.test(v))
|
|
1693
|
-
throw new TypeError(`Invalid GUID value "${v}"`);
|
|
1744
|
+
// ../../build/common/esm/document/data-type/builtin/integer.type.js
|
|
1745
|
+
import { isInteger } from "valgen";
|
|
1746
|
+
var IntegerType = class IntegerType2 {
|
|
1747
|
+
static {
|
|
1748
|
+
__name(this, "IntegerType");
|
|
1694
1749
|
}
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1750
|
+
};
|
|
1751
|
+
IntegerType = __decorate([
|
|
1697
1752
|
SimpleType2({
|
|
1698
|
-
description: "
|
|
1753
|
+
description: "An integer number",
|
|
1754
|
+
decoder: isInteger(),
|
|
1755
|
+
encoder: isInteger()
|
|
1699
1756
|
})
|
|
1700
|
-
],
|
|
1701
|
-
|
|
1702
|
-
// ../../build/common/esm/document/data-type/builtin/integer.type.js
|
|
1703
|
-
import { toInt } from "putil-varhelpers";
|
|
1757
|
+
], IntegerType);
|
|
1704
1758
|
|
|
1705
1759
|
// ../../build/common/esm/document/data-type/builtin/number.type.js
|
|
1706
|
-
import {
|
|
1707
|
-
var NumberType =
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
return v;
|
|
1711
|
-
const x = toNumber(v);
|
|
1712
|
-
if (x)
|
|
1713
|
-
this.validate(x);
|
|
1714
|
-
return x;
|
|
1715
|
-
}
|
|
1716
|
-
encode(v) {
|
|
1717
|
-
return this.decode(v);
|
|
1718
|
-
}
|
|
1719
|
-
coerce(v) {
|
|
1720
|
-
return this.decode(v);
|
|
1721
|
-
}
|
|
1722
|
-
validate(v) {
|
|
1723
|
-
if (typeof v !== "number" || isNaN(v))
|
|
1724
|
-
throw new TypeError(`Invalid number value "${v}"`);
|
|
1760
|
+
import { isNumber } from "valgen";
|
|
1761
|
+
var NumberType = class NumberType2 {
|
|
1762
|
+
static {
|
|
1763
|
+
__name(this, "NumberType");
|
|
1725
1764
|
}
|
|
1726
|
-
}
|
|
1765
|
+
};
|
|
1727
1766
|
NumberType = __decorate([
|
|
1728
1767
|
SimpleType2({
|
|
1729
1768
|
description: "Both Integer as well as Floating-Point numbers",
|
|
1730
|
-
|
|
1769
|
+
decoder: isNumber(),
|
|
1770
|
+
encoder: isNumber()
|
|
1731
1771
|
})
|
|
1732
1772
|
], NumberType);
|
|
1733
1773
|
|
|
1734
|
-
// ../../build/common/esm/document/data-type/builtin/
|
|
1735
|
-
var
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
return v;
|
|
1739
|
-
return toInt(super.decode(v));
|
|
1774
|
+
// ../../build/common/esm/document/data-type/builtin/object.type.js
|
|
1775
|
+
var ObjectType = class ObjectType2 {
|
|
1776
|
+
static {
|
|
1777
|
+
__name(this, "ObjectType");
|
|
1740
1778
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1779
|
+
};
|
|
1780
|
+
ObjectType = __decorate([
|
|
1781
|
+
ComplexType2({
|
|
1782
|
+
name: "object",
|
|
1783
|
+
description: "A non modelled object",
|
|
1784
|
+
additionalFields: true,
|
|
1785
|
+
ctor: Object
|
|
1786
|
+
})
|
|
1787
|
+
], ObjectType);
|
|
1788
|
+
|
|
1789
|
+
// ../../build/common/esm/document/data-type/builtin/string.type.js
|
|
1790
|
+
import { isString as isString2 } from "valgen";
|
|
1791
|
+
var StringType = class StringType2 {
|
|
1792
|
+
static {
|
|
1793
|
+
__name(this, "StringType");
|
|
1745
1794
|
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1795
|
+
};
|
|
1796
|
+
StringType = __decorate([
|
|
1797
|
+
SimpleType2({
|
|
1798
|
+
description: "A sequence of characters",
|
|
1799
|
+
decoder: isString2(),
|
|
1800
|
+
encoder: isString2()
|
|
1801
|
+
})
|
|
1802
|
+
], StringType);
|
|
1803
|
+
|
|
1804
|
+
// ../../build/common/esm/document/data-type/builtin/time.type.js
|
|
1805
|
+
import { isDateString as isDateString2 } from "valgen";
|
|
1806
|
+
var TimeType = class TimeType2 {
|
|
1807
|
+
static {
|
|
1808
|
+
__name(this, "TimeType");
|
|
1748
1809
|
}
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1810
|
+
};
|
|
1811
|
+
TimeType = __decorate([
|
|
1751
1812
|
SimpleType2({
|
|
1752
|
-
description: "
|
|
1813
|
+
description: "Time string in 24h format, for example, 18:23:00",
|
|
1814
|
+
decoder: isDateString2({
|
|
1815
|
+
format: ["HH:mm:ss", "HH:mm"],
|
|
1816
|
+
onFail: () => "{{label}} is not a valid time"
|
|
1817
|
+
}),
|
|
1818
|
+
encoder: isDateString2({
|
|
1819
|
+
format: ["HH:mm:ss", "HH:mm"],
|
|
1820
|
+
onFail: () => "{{label}} is not a valid time"
|
|
1821
|
+
})
|
|
1753
1822
|
})
|
|
1754
|
-
],
|
|
1823
|
+
], TimeType);
|
|
1755
1824
|
|
|
1756
|
-
// ../../build/common/esm/document/data-type/builtin/
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
return typeof v === "object" ? v : {};
|
|
1825
|
+
// ../../build/common/esm/document/data-type/builtin/timestamp.type.js
|
|
1826
|
+
import { isDate as isDate2, isDateString as isDateString3 } from "valgen";
|
|
1827
|
+
var TimestampType = class TimestampType2 {
|
|
1828
|
+
static {
|
|
1829
|
+
__name(this, "TimestampType");
|
|
1762
1830
|
}
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1831
|
+
};
|
|
1832
|
+
TimestampType = __decorate([
|
|
1833
|
+
SimpleType2({
|
|
1834
|
+
description: "Timestamp, for example, 2021-04-18T09:12:53",
|
|
1835
|
+
decoder: isDate2({
|
|
1836
|
+
format: ["YYYY-MM-DDTHH:mm:ss", "YYYY-MM-DD HH:mm:ss", "YYYY-MM-DD", "YYYY"]
|
|
1837
|
+
}),
|
|
1838
|
+
encoder: isDateString3({ format: "YYYY-MM-DDTHH:mm:ss" })
|
|
1769
1839
|
})
|
|
1770
|
-
],
|
|
1840
|
+
], TimestampType);
|
|
1771
1841
|
|
|
1772
1842
|
// ../../build/common/esm/document/factory/create-document.js
|
|
1773
1843
|
async function createDocument(init, options) {
|
|
@@ -1777,6 +1847,8 @@ async function createDocument(init, options) {
|
|
|
1777
1847
|
if (!options?.noBuiltinTypes) {
|
|
1778
1848
|
const builtinDocument = await this.createBuiltinTypeDocument();
|
|
1779
1849
|
this.document.references.set("Opra", builtinDocument);
|
|
1850
|
+
for (const [c, s] of Object.getPrototypeOf(this).constructor.designTypeMap.entries())
|
|
1851
|
+
this.document._designTypeMap.set(c, s);
|
|
1780
1852
|
}
|
|
1781
1853
|
if (init.references)
|
|
1782
1854
|
await this.addReferences(init.references);
|
|
@@ -1815,9 +1887,9 @@ async function createDocumentFromUrl(url) {
|
|
|
1815
1887
|
__name(createDocumentFromUrl, "createDocumentFromUrl");
|
|
1816
1888
|
async function createBuiltinTypeDocument() {
|
|
1817
1889
|
const init = {
|
|
1818
|
-
version:
|
|
1890
|
+
version: opra_schema_ns_exports.SpecVersion,
|
|
1819
1891
|
info: {
|
|
1820
|
-
version:
|
|
1892
|
+
version: opra_schema_ns_exports.SpecVersion,
|
|
1821
1893
|
title: "Opra built-in types",
|
|
1822
1894
|
contact: [
|
|
1823
1895
|
{
|
|
@@ -1832,14 +1904,16 @@ async function createBuiltinTypeDocument() {
|
|
|
1832
1904
|
types: [
|
|
1833
1905
|
AnyType,
|
|
1834
1906
|
Base64Type,
|
|
1835
|
-
|
|
1907
|
+
BigintType,
|
|
1836
1908
|
BooleanType,
|
|
1837
1909
|
DateType,
|
|
1838
|
-
|
|
1910
|
+
UuidType,
|
|
1839
1911
|
IntegerType,
|
|
1840
1912
|
NumberType,
|
|
1841
1913
|
ObjectType,
|
|
1842
|
-
StringType
|
|
1914
|
+
StringType,
|
|
1915
|
+
TimeType,
|
|
1916
|
+
TimestampType
|
|
1843
1917
|
]
|
|
1844
1918
|
};
|
|
1845
1919
|
const factoryClass = Object.getPrototypeOf(this).constructor;
|
|
@@ -1858,13 +1932,13 @@ async function importResourceClass(thunk) {
|
|
|
1858
1932
|
return cached;
|
|
1859
1933
|
const ctor = typeof thunk === "function" ? thunk : Object.getPrototypeOf(thunk).constructor;
|
|
1860
1934
|
let metadata = Reflect.getMetadata(METADATA_KEY, ctor);
|
|
1861
|
-
if (!metadata &&
|
|
1935
|
+
if (!metadata && opra_schema_ns_exports.isResource(metadata))
|
|
1862
1936
|
throw new TypeError(`Class "${ctor.name}" doesn't have a valid Resource metadata`);
|
|
1863
1937
|
metadata = cloneObject(metadata);
|
|
1864
1938
|
const schema = cloneObject(metadata);
|
|
1865
1939
|
schema.controller = controller;
|
|
1866
1940
|
cache.set(thunk, schema);
|
|
1867
|
-
if (
|
|
1941
|
+
if (opra_schema_ns_exports.isSingleton(schema) || opra_schema_ns_exports.isCollection(schema)) {
|
|
1868
1942
|
if (!document.getDataType(metadata.type, true) && typeof metadata.type === "function") {
|
|
1869
1943
|
await this.importTypeClass(metadata.type);
|
|
1870
1944
|
await this.processTypes();
|
|
@@ -1874,9 +1948,9 @@ async function importResourceClass(thunk) {
|
|
|
1874
1948
|
}
|
|
1875
1949
|
document.getComplexType(schema.type);
|
|
1876
1950
|
}
|
|
1877
|
-
if (
|
|
1951
|
+
if (opra_schema_ns_exports.isSingleton(schema))
|
|
1878
1952
|
await this.extractSingletonSchema(schema, ctor, metadata, controller);
|
|
1879
|
-
if (
|
|
1953
|
+
if (opra_schema_ns_exports.isCollection(schema))
|
|
1880
1954
|
await this.extractCollectionSchema(schema, ctor, metadata, controller);
|
|
1881
1955
|
resourceQueue.set(metadata.name, schema);
|
|
1882
1956
|
}
|
|
@@ -1889,6 +1963,7 @@ async function extractCollectionSchema(target, ctor, metadata, controller) {
|
|
|
1889
1963
|
__name(extractCollectionSchema, "extractCollectionSchema");
|
|
1890
1964
|
|
|
1891
1965
|
// ../../build/common/esm/document/factory/import-type-class.js
|
|
1966
|
+
import { validator } from "valgen";
|
|
1892
1967
|
async function importTypeClass(typeThunk) {
|
|
1893
1968
|
const { document, typeQueue, cache } = this;
|
|
1894
1969
|
const thunk = await resolveThunk(typeThunk);
|
|
@@ -1899,7 +1974,7 @@ async function importTypeClass(typeThunk) {
|
|
|
1899
1974
|
if (dt && dt.name)
|
|
1900
1975
|
return dt.name;
|
|
1901
1976
|
const metadata = Reflect.getMetadata(METADATA_KEY, thunk);
|
|
1902
|
-
if (!(metadata &&
|
|
1977
|
+
if (!(metadata && opra_schema_ns_exports.isDataType(metadata))) {
|
|
1903
1978
|
if (isConstructor(thunk))
|
|
1904
1979
|
throw new TypeError(`Class "${thunk.name}" doesn't have a valid DataType metadata`);
|
|
1905
1980
|
throw new TypeError(`No EnumType metadata found for object ${JSON.stringify(thunk).substring(0, 20)}...`);
|
|
@@ -1915,20 +1990,20 @@ async function importTypeClass(typeThunk) {
|
|
|
1915
1990
|
}
|
|
1916
1991
|
if (isConstructor(thunk)) {
|
|
1917
1992
|
const ctor = thunk;
|
|
1918
|
-
if (
|
|
1993
|
+
if (opra_schema_ns_exports.isSimpleType(schema))
|
|
1919
1994
|
await this.extractSimpleTypeSchema(schema, ctor, metadata);
|
|
1920
|
-
else if (
|
|
1995
|
+
else if (opra_schema_ns_exports.isComplexType(schema))
|
|
1921
1996
|
await this.extractComplexTypeSchema(schema, ctor, metadata);
|
|
1922
|
-
else if (
|
|
1997
|
+
else if (opra_schema_ns_exports.isMappedType(schema))
|
|
1923
1998
|
await this.extractMappedTypeSchema(schema, ctor, metadata);
|
|
1924
|
-
else if (
|
|
1999
|
+
else if (opra_schema_ns_exports.isUnionType(schema))
|
|
1925
2000
|
await this.extractUnionTypeSchema(schema, ctor, metadata);
|
|
1926
2001
|
else
|
|
1927
2002
|
throw new TypeError(`Class "${ctor.name}" doesn't have a valid DataType metadata`);
|
|
1928
2003
|
return result;
|
|
1929
2004
|
}
|
|
1930
2005
|
const enumObject = thunk;
|
|
1931
|
-
if (
|
|
2006
|
+
if (opra_schema_ns_exports.isEnumType(schema)) {
|
|
1932
2007
|
let baseType;
|
|
1933
2008
|
if (metadata.base && Reflect.hasMetadata(METADATA_KEY, metadata.base)) {
|
|
1934
2009
|
baseType = await this.importTypeClass(metadata.base);
|
|
@@ -1944,14 +2019,17 @@ async function extractSimpleTypeSchema(target, ctor, metadata) {
|
|
|
1944
2019
|
const baseClass = Object.getPrototypeOf(ctor.prototype).constructor;
|
|
1945
2020
|
if (Reflect.hasMetadata(METADATA_KEY, baseClass))
|
|
1946
2021
|
target.base = await this.importTypeClass(baseClass);
|
|
1947
|
-
|
|
2022
|
+
if (typeof ctor.prototype.decode === "function")
|
|
2023
|
+
target.decoder = validator(metadata.name, ctor.prototype.decode);
|
|
2024
|
+
if (typeof ctor.prototype.encode === "function")
|
|
2025
|
+
target.encoder = validator(metadata.name, ctor.prototype.encode);
|
|
1948
2026
|
}
|
|
1949
2027
|
__name(extractSimpleTypeSchema, "extractSimpleTypeSchema");
|
|
1950
2028
|
async function extractComplexTypeSchema(target, ctor, metadata) {
|
|
1951
2029
|
const baseClass = Object.getPrototypeOf(ctor.prototype).constructor;
|
|
1952
2030
|
if (Reflect.hasMetadata(METADATA_KEY, baseClass))
|
|
1953
2031
|
target.base = await this.importTypeClass(baseClass);
|
|
1954
|
-
target.ctor = ctor;
|
|
2032
|
+
target.ctor = target.ctor || ctor;
|
|
1955
2033
|
if (metadata.fields) {
|
|
1956
2034
|
const fields = target.fields = {};
|
|
1957
2035
|
for (const [elemName, elemMeta] of Object.entries(metadata.fields)) {
|
|
@@ -1964,8 +2042,13 @@ async function extractComplexTypeSchema(target, ctor, metadata) {
|
|
|
1964
2042
|
};
|
|
1965
2043
|
if (elemMeta.enum)
|
|
1966
2044
|
elemSchema.type = await this.importTypeClass(elemMeta.enum);
|
|
1967
|
-
if (!elemSchema.type && elemMeta.designType)
|
|
1968
|
-
|
|
2045
|
+
if (!elemSchema.type && elemMeta.designType) {
|
|
2046
|
+
const mappingType = this.document.getDataType(elemMeta.designType, true);
|
|
2047
|
+
if (mappingType)
|
|
2048
|
+
elemSchema.type = mappingType.name;
|
|
2049
|
+
else
|
|
2050
|
+
elemSchema.type = await this.importTypeClass(elemMeta.designType);
|
|
2051
|
+
}
|
|
1969
2052
|
await this.extractFieldSchema(elemSchema, ctor, elemMeta, elemName);
|
|
1970
2053
|
if (elemMeta.enum)
|
|
1971
2054
|
elemSchema.type = await this.importTypeClass(elemMeta.enum);
|
|
@@ -2002,7 +2085,7 @@ __name(extractFieldSchema, "extractFieldSchema");
|
|
|
2002
2085
|
|
|
2003
2086
|
// ../../build/common/esm/document/resource/collection.js
|
|
2004
2087
|
import omit4 from "lodash.omit";
|
|
2005
|
-
import
|
|
2088
|
+
import merge5 from "putil-merge";
|
|
2006
2089
|
|
|
2007
2090
|
// ../../build/common/esm/filter/opra-filter.ns.js
|
|
2008
2091
|
var opra_filter_ns_exports = {};
|
|
@@ -2053,24 +2136,33 @@ __export(opra_filter_ns_exports, {
|
|
|
2053
2136
|
|
|
2054
2137
|
// ../../build/common/esm/filter/ast/abstract/ast.js
|
|
2055
2138
|
var Ast = class {
|
|
2139
|
+
static {
|
|
2140
|
+
__name(this, "Ast");
|
|
2141
|
+
}
|
|
2056
2142
|
constructor() {
|
|
2057
2143
|
this.kind = Object.getPrototypeOf(this).constructor.name;
|
|
2058
2144
|
}
|
|
2059
2145
|
};
|
|
2060
|
-
__name(Ast, "Ast");
|
|
2061
2146
|
|
|
2062
2147
|
// ../../build/common/esm/filter/ast/abstract/expression.js
|
|
2063
2148
|
var Expression = class extends Ast {
|
|
2149
|
+
static {
|
|
2150
|
+
__name(this, "Expression");
|
|
2151
|
+
}
|
|
2064
2152
|
};
|
|
2065
|
-
__name(Expression, "Expression");
|
|
2066
2153
|
|
|
2067
2154
|
// ../../build/common/esm/filter/ast/abstract/term.js
|
|
2068
2155
|
var Term = class extends Expression {
|
|
2156
|
+
static {
|
|
2157
|
+
__name(this, "Term");
|
|
2158
|
+
}
|
|
2069
2159
|
};
|
|
2070
|
-
__name(Term, "Term");
|
|
2071
2160
|
|
|
2072
2161
|
// ../../build/common/esm/filter/ast/abstract/literal.js
|
|
2073
2162
|
var Literal = class extends Term {
|
|
2163
|
+
static {
|
|
2164
|
+
__name(this, "Literal");
|
|
2165
|
+
}
|
|
2074
2166
|
constructor(value) {
|
|
2075
2167
|
super();
|
|
2076
2168
|
this.value = value;
|
|
@@ -2079,10 +2171,12 @@ var Literal = class extends Term {
|
|
|
2079
2171
|
return "" + this.value;
|
|
2080
2172
|
}
|
|
2081
2173
|
};
|
|
2082
|
-
__name(Literal, "Literal");
|
|
2083
2174
|
|
|
2084
2175
|
// ../../build/common/esm/filter/ast/expressions/arithmetic-expression.js
|
|
2085
2176
|
var ArithmeticExpression = class extends Expression {
|
|
2177
|
+
static {
|
|
2178
|
+
__name(this, "ArithmeticExpression");
|
|
2179
|
+
}
|
|
2086
2180
|
constructor() {
|
|
2087
2181
|
super();
|
|
2088
2182
|
this.items = [];
|
|
@@ -2098,16 +2192,20 @@ var ArithmeticExpression = class extends Expression {
|
|
|
2098
2192
|
return this.items.map((child, i) => (i > 0 ? child.op : "") + child.expression).join("");
|
|
2099
2193
|
}
|
|
2100
2194
|
};
|
|
2101
|
-
__name(ArithmeticExpression, "ArithmeticExpression");
|
|
2102
2195
|
var ArithmeticExpressionItem = class {
|
|
2196
|
+
static {
|
|
2197
|
+
__name(this, "ArithmeticExpressionItem");
|
|
2198
|
+
}
|
|
2103
2199
|
constructor(o) {
|
|
2104
2200
|
Object.assign(this, o);
|
|
2105
2201
|
}
|
|
2106
2202
|
};
|
|
2107
|
-
__name(ArithmeticExpressionItem, "ArithmeticExpressionItem");
|
|
2108
2203
|
|
|
2109
2204
|
// ../../build/common/esm/filter/ast/expressions/array-expression.js
|
|
2110
2205
|
var ArrayExpression = class extends Term {
|
|
2206
|
+
static {
|
|
2207
|
+
__name(this, "ArrayExpression");
|
|
2208
|
+
}
|
|
2111
2209
|
constructor(items) {
|
|
2112
2210
|
super();
|
|
2113
2211
|
this.items = items;
|
|
@@ -2116,11 +2214,13 @@ var ArrayExpression = class extends Term {
|
|
|
2116
2214
|
return "[" + this.items.map((child) => "" + child).join(",") + "]";
|
|
2117
2215
|
}
|
|
2118
2216
|
};
|
|
2119
|
-
__name(ArrayExpression, "ArrayExpression");
|
|
2120
2217
|
|
|
2121
2218
|
// ../../build/common/esm/filter/ast/expressions/comparison-expression.js
|
|
2122
2219
|
var WORD_PATTERN = /\w/;
|
|
2123
2220
|
var ComparisonExpression = class extends Expression {
|
|
2221
|
+
static {
|
|
2222
|
+
__name(this, "ComparisonExpression");
|
|
2223
|
+
}
|
|
2124
2224
|
constructor(o) {
|
|
2125
2225
|
super();
|
|
2126
2226
|
Object.assign(this, o);
|
|
@@ -2129,10 +2229,12 @@ var ComparisonExpression = class extends Expression {
|
|
|
2129
2229
|
return `${this.left}${WORD_PATTERN.test(this.op) ? " " + this.op + " " : this.op}${this.right}`;
|
|
2130
2230
|
}
|
|
2131
2231
|
};
|
|
2132
|
-
__name(ComparisonExpression, "ComparisonExpression");
|
|
2133
2232
|
|
|
2134
2233
|
// ../../build/common/esm/filter/ast/expressions/logical-expression.js
|
|
2135
2234
|
var LogicalExpression = class extends Expression {
|
|
2235
|
+
static {
|
|
2236
|
+
__name(this, "LogicalExpression");
|
|
2237
|
+
}
|
|
2136
2238
|
constructor(o) {
|
|
2137
2239
|
super();
|
|
2138
2240
|
Object.assign(this, o);
|
|
@@ -2145,10 +2247,12 @@ var LogicalExpression = class extends Expression {
|
|
|
2145
2247
|
return this.items.map((child) => "" + child).join(" " + this.op + " ");
|
|
2146
2248
|
}
|
|
2147
2249
|
};
|
|
2148
|
-
__name(LogicalExpression, "LogicalExpression");
|
|
2149
2250
|
|
|
2150
2251
|
// ../../build/common/esm/filter/ast/expressions/parenthesized-expression.js
|
|
2151
2252
|
var ParenthesizedExpression = class extends Expression {
|
|
2253
|
+
static {
|
|
2254
|
+
__name(this, "ParenthesizedExpression");
|
|
2255
|
+
}
|
|
2152
2256
|
constructor(expression) {
|
|
2153
2257
|
super();
|
|
2154
2258
|
this.expression = expression;
|
|
@@ -2157,10 +2261,12 @@ var ParenthesizedExpression = class extends Expression {
|
|
|
2157
2261
|
return `(${this.expression})`;
|
|
2158
2262
|
}
|
|
2159
2263
|
};
|
|
2160
|
-
__name(ParenthesizedExpression, "ParenthesizedExpression");
|
|
2161
2264
|
|
|
2162
2265
|
// ../../build/common/esm/filter/ast/expressions/negative-expression.js
|
|
2163
2266
|
var NegativeExpression = class extends Expression {
|
|
2267
|
+
static {
|
|
2268
|
+
__name(this, "NegativeExpression");
|
|
2269
|
+
}
|
|
2164
2270
|
constructor(expression) {
|
|
2165
2271
|
super();
|
|
2166
2272
|
this.expression = expression;
|
|
@@ -2169,33 +2275,45 @@ var NegativeExpression = class extends Expression {
|
|
|
2169
2275
|
return `(${this.expression})`;
|
|
2170
2276
|
}
|
|
2171
2277
|
};
|
|
2172
|
-
__name(NegativeExpression, "NegativeExpression");
|
|
2173
2278
|
|
|
2174
2279
|
// ../../build/common/esm/filter/ast/terms/boolean-literal.js
|
|
2175
2280
|
var BooleanLiteral = class extends Literal {
|
|
2281
|
+
static {
|
|
2282
|
+
__name(this, "BooleanLiteral");
|
|
2283
|
+
}
|
|
2176
2284
|
constructor(value) {
|
|
2177
2285
|
super(value);
|
|
2178
2286
|
}
|
|
2179
2287
|
};
|
|
2180
|
-
__name(BooleanLiteral, "BooleanLiteral");
|
|
2181
2288
|
|
|
2182
2289
|
// ../../build/common/esm/filter/ast/terms/date-literal.js
|
|
2183
2290
|
import { toDateDef } from "putil-varhelpers";
|
|
2184
2291
|
|
|
2185
2292
|
// ../../build/common/esm/filter/errors.js
|
|
2186
2293
|
var SyntaxError = class extends TypeError {
|
|
2294
|
+
static {
|
|
2295
|
+
__name(this, "SyntaxError");
|
|
2296
|
+
}
|
|
2187
2297
|
};
|
|
2188
|
-
|
|
2189
|
-
|
|
2298
|
+
var ValidationError2 = class extends TypeError {
|
|
2299
|
+
static {
|
|
2300
|
+
__name(this, "ValidationError");
|
|
2301
|
+
}
|
|
2302
|
+
constructor(message) {
|
|
2303
|
+
super(typeof message === "string" ? message : message?.message);
|
|
2304
|
+
if (typeof message === "object")
|
|
2305
|
+
Object.assign(this, message);
|
|
2306
|
+
}
|
|
2190
2307
|
};
|
|
2191
|
-
__name(ValidationError, "ValidationError");
|
|
2192
2308
|
var FilterParseError = class extends Error {
|
|
2309
|
+
static {
|
|
2310
|
+
__name(this, "FilterParseError");
|
|
2311
|
+
}
|
|
2193
2312
|
constructor(message, args) {
|
|
2194
2313
|
super(message);
|
|
2195
2314
|
Object.assign(this, args);
|
|
2196
2315
|
}
|
|
2197
2316
|
};
|
|
2198
|
-
__name(FilterParseError, "FilterParseError");
|
|
2199
2317
|
|
|
2200
2318
|
// ../../build/common/esm/filter/utils.js
|
|
2201
2319
|
var quotesRegEx = /'/g;
|
|
@@ -2224,6 +2342,9 @@ __name(unquoteFilterString, "unquoteFilterString");
|
|
|
2224
2342
|
// ../../build/common/esm/filter/ast/terms/date-literal.js
|
|
2225
2343
|
var NullDate = /* @__PURE__ */ new Date(0);
|
|
2226
2344
|
var DateLiteral = class extends Literal {
|
|
2345
|
+
static {
|
|
2346
|
+
__name(this, "DateLiteral");
|
|
2347
|
+
}
|
|
2227
2348
|
constructor(value) {
|
|
2228
2349
|
super("");
|
|
2229
2350
|
if (value instanceof Date) {
|
|
@@ -2234,25 +2355,29 @@ var DateLiteral = class extends Literal {
|
|
|
2234
2355
|
this.value = value;
|
|
2235
2356
|
return;
|
|
2236
2357
|
}
|
|
2237
|
-
throw new
|
|
2358
|
+
throw new ValidationError2(`Invalid date value "${value}"`);
|
|
2238
2359
|
}
|
|
2239
2360
|
toString() {
|
|
2240
2361
|
return quoteFilterString(this.value);
|
|
2241
2362
|
}
|
|
2242
2363
|
};
|
|
2243
|
-
__name(DateLiteral, "DateLiteral");
|
|
2244
2364
|
|
|
2245
2365
|
// ../../build/common/esm/filter/ast/terms/null-literal.js
|
|
2246
2366
|
var NullLiteral = class extends Literal {
|
|
2367
|
+
static {
|
|
2368
|
+
__name(this, "NullLiteral");
|
|
2369
|
+
}
|
|
2247
2370
|
constructor() {
|
|
2248
2371
|
super(null);
|
|
2249
2372
|
this.value = null;
|
|
2250
2373
|
}
|
|
2251
2374
|
};
|
|
2252
|
-
__name(NullLiteral, "NullLiteral");
|
|
2253
2375
|
|
|
2254
2376
|
// ../../build/common/esm/filter/ast/terms/number-literal.js
|
|
2255
2377
|
var NumberLiteral = class extends Literal {
|
|
2378
|
+
static {
|
|
2379
|
+
__name(this, "NumberLiteral");
|
|
2380
|
+
}
|
|
2256
2381
|
constructor(value) {
|
|
2257
2382
|
super(0);
|
|
2258
2383
|
if (typeof value === "number" || typeof value === "bigint") {
|
|
@@ -2274,24 +2399,28 @@ var NumberLiteral = class extends Literal {
|
|
|
2274
2399
|
}
|
|
2275
2400
|
} catch {
|
|
2276
2401
|
}
|
|
2277
|
-
throw new
|
|
2402
|
+
throw new ValidationError2(`Invalid number literal ${value}`);
|
|
2278
2403
|
}
|
|
2279
2404
|
toString() {
|
|
2280
2405
|
return typeof this.value === "bigint" ? ("" + this.value).replace(/n$/, "") : "" + this.value;
|
|
2281
2406
|
}
|
|
2282
2407
|
};
|
|
2283
|
-
__name(NumberLiteral, "NumberLiteral");
|
|
2284
2408
|
|
|
2285
2409
|
// ../../build/common/esm/filter/ast/terms/qualified-identifier.js
|
|
2286
2410
|
var QualifiedIdentifier = class extends Literal {
|
|
2411
|
+
static {
|
|
2412
|
+
__name(this, "QualifiedIdentifier");
|
|
2413
|
+
}
|
|
2287
2414
|
constructor(value) {
|
|
2288
2415
|
super("" + value);
|
|
2289
2416
|
}
|
|
2290
2417
|
};
|
|
2291
|
-
__name(QualifiedIdentifier, "QualifiedIdentifier");
|
|
2292
2418
|
|
|
2293
2419
|
// ../../build/common/esm/filter/ast/terms/string-literal.js
|
|
2294
2420
|
var StringLiteral = class extends Literal {
|
|
2421
|
+
static {
|
|
2422
|
+
__name(this, "StringLiteral");
|
|
2423
|
+
}
|
|
2295
2424
|
constructor(value) {
|
|
2296
2425
|
super("" + value);
|
|
2297
2426
|
}
|
|
@@ -2299,11 +2428,13 @@ var StringLiteral = class extends Literal {
|
|
|
2299
2428
|
return quoteFilterString(this.value);
|
|
2300
2429
|
}
|
|
2301
2430
|
};
|
|
2302
|
-
__name(StringLiteral, "StringLiteral");
|
|
2303
2431
|
|
|
2304
2432
|
// ../../build/common/esm/filter/ast/terms/time-literal.js
|
|
2305
2433
|
var TIME_PATTERN = /^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/;
|
|
2306
2434
|
var TimeLiteral = class extends Literal {
|
|
2435
|
+
static {
|
|
2436
|
+
__name(this, "TimeLiteral");
|
|
2437
|
+
}
|
|
2307
2438
|
constructor(value) {
|
|
2308
2439
|
super("");
|
|
2309
2440
|
if (value instanceof Date) {
|
|
@@ -2314,13 +2445,12 @@ var TimeLiteral = class extends Literal {
|
|
|
2314
2445
|
this.value = value;
|
|
2315
2446
|
return;
|
|
2316
2447
|
}
|
|
2317
|
-
throw new
|
|
2448
|
+
throw new ValidationError2(`Invalid time value "${value}"`);
|
|
2318
2449
|
}
|
|
2319
2450
|
toString() {
|
|
2320
2451
|
return quoteFilterString(this.value);
|
|
2321
2452
|
}
|
|
2322
2453
|
};
|
|
2323
|
-
__name(TimeLiteral, "TimeLiteral");
|
|
2324
2454
|
function pad(n) {
|
|
2325
2455
|
return n <= 9 ? "0" + n : "" + n;
|
|
2326
2456
|
}
|
|
@@ -2331,40 +2461,42 @@ import { CharStream, CommonTokenStream } from "@browsery/antlr4";
|
|
|
2331
2461
|
|
|
2332
2462
|
// ../../build/common/esm/filter/antlr/OpraFilterLexer.js
|
|
2333
2463
|
import { ATNDeserializer, DFA, Lexer, LexerATNSimulator, PredictionContextCache, Token } from "@browsery/antlr4";
|
|
2334
|
-
var OpraFilterLexer = class extends Lexer {
|
|
2464
|
+
var OpraFilterLexer = class _OpraFilterLexer extends Lexer {
|
|
2465
|
+
static {
|
|
2466
|
+
__name(this, "OpraFilterLexer");
|
|
2467
|
+
}
|
|
2335
2468
|
constructor(input) {
|
|
2336
2469
|
super(input);
|
|
2337
|
-
this._interp = new LexerATNSimulator(this,
|
|
2470
|
+
this._interp = new LexerATNSimulator(this, _OpraFilterLexer._ATN, _OpraFilterLexer.DecisionsToDFA, new PredictionContextCache());
|
|
2338
2471
|
}
|
|
2339
2472
|
get grammarFileName() {
|
|
2340
2473
|
return "OpraFilter.g4";
|
|
2341
2474
|
}
|
|
2342
2475
|
get literalNames() {
|
|
2343
|
-
return
|
|
2476
|
+
return _OpraFilterLexer.literalNames;
|
|
2344
2477
|
}
|
|
2345
2478
|
get symbolicNames() {
|
|
2346
|
-
return
|
|
2479
|
+
return _OpraFilterLexer.symbolicNames;
|
|
2347
2480
|
}
|
|
2348
2481
|
get ruleNames() {
|
|
2349
|
-
return
|
|
2482
|
+
return _OpraFilterLexer.ruleNames;
|
|
2350
2483
|
}
|
|
2351
2484
|
get serializedATN() {
|
|
2352
|
-
return
|
|
2485
|
+
return _OpraFilterLexer._serializedATN;
|
|
2353
2486
|
}
|
|
2354
2487
|
get channelNames() {
|
|
2355
|
-
return
|
|
2488
|
+
return _OpraFilterLexer.channelNames;
|
|
2356
2489
|
}
|
|
2357
2490
|
get modeNames() {
|
|
2358
|
-
return
|
|
2491
|
+
return _OpraFilterLexer.modeNames;
|
|
2359
2492
|
}
|
|
2360
2493
|
static get _ATN() {
|
|
2361
|
-
if (!
|
|
2362
|
-
|
|
2494
|
+
if (!_OpraFilterLexer.__ATN) {
|
|
2495
|
+
_OpraFilterLexer.__ATN = new ATNDeserializer().deserialize(_OpraFilterLexer._serializedATN);
|
|
2363
2496
|
}
|
|
2364
|
-
return
|
|
2497
|
+
return _OpraFilterLexer.__ATN;
|
|
2365
2498
|
}
|
|
2366
2499
|
};
|
|
2367
|
-
__name(OpraFilterLexer, "OpraFilterLexer");
|
|
2368
2500
|
OpraFilterLexer.T__0 = 1;
|
|
2369
2501
|
OpraFilterLexer.T__1 = 2;
|
|
2370
2502
|
OpraFilterLexer.T__2 = 3;
|
|
@@ -6401,43 +6533,47 @@ OpraFilterLexer._serializedATN = [
|
|
|
6401
6533
|
0
|
|
6402
6534
|
];
|
|
6403
6535
|
OpraFilterLexer.DecisionsToDFA = OpraFilterLexer._ATN.decisionToState.map((ds, index) => new DFA(ds, index));
|
|
6536
|
+
var OpraFilterLexer_default = OpraFilterLexer;
|
|
6404
6537
|
|
|
6405
6538
|
// ../../build/common/esm/filter/antlr/OpraFilterParser.js
|
|
6406
6539
|
import { ATN, ATNDeserializer as ATNDeserializer2, DFA as DFA2, FailedPredicateException, NoViableAltException, Parser, ParserATNSimulator, ParserRuleContext, PredictionContextCache as PredictionContextCache2, RecognitionException, Token as Token2 } from "@browsery/antlr4";
|
|
6407
|
-
var OpraFilterParser = class extends Parser {
|
|
6540
|
+
var OpraFilterParser = class _OpraFilterParser extends Parser {
|
|
6541
|
+
static {
|
|
6542
|
+
__name(this, "OpraFilterParser");
|
|
6543
|
+
}
|
|
6408
6544
|
get grammarFileName() {
|
|
6409
6545
|
return "OpraFilter.g4";
|
|
6410
6546
|
}
|
|
6411
6547
|
get literalNames() {
|
|
6412
|
-
return
|
|
6548
|
+
return _OpraFilterParser.literalNames;
|
|
6413
6549
|
}
|
|
6414
6550
|
get symbolicNames() {
|
|
6415
|
-
return
|
|
6551
|
+
return _OpraFilterParser.symbolicNames;
|
|
6416
6552
|
}
|
|
6417
6553
|
get ruleNames() {
|
|
6418
|
-
return
|
|
6554
|
+
return _OpraFilterParser.ruleNames;
|
|
6419
6555
|
}
|
|
6420
6556
|
get serializedATN() {
|
|
6421
|
-
return
|
|
6557
|
+
return _OpraFilterParser._serializedATN;
|
|
6422
6558
|
}
|
|
6423
6559
|
createFailedPredicateException(predicate, message) {
|
|
6424
6560
|
return new FailedPredicateException(this, predicate, message);
|
|
6425
6561
|
}
|
|
6426
6562
|
constructor(input) {
|
|
6427
6563
|
super(input);
|
|
6428
|
-
this._interp = new ParserATNSimulator(this,
|
|
6564
|
+
this._interp = new ParserATNSimulator(this, _OpraFilterParser._ATN, _OpraFilterParser.DecisionsToDFA, new PredictionContextCache2());
|
|
6429
6565
|
}
|
|
6430
6566
|
// @RuleVersion(0)
|
|
6431
6567
|
root() {
|
|
6432
6568
|
const localctx = new RootContext(this, this._ctx, this.state);
|
|
6433
|
-
this.enterRule(localctx, 0,
|
|
6569
|
+
this.enterRule(localctx, 0, _OpraFilterParser.RULE_root);
|
|
6434
6570
|
try {
|
|
6435
6571
|
this.enterOuterAlt(localctx, 1);
|
|
6436
6572
|
{
|
|
6437
6573
|
this.state = 34;
|
|
6438
6574
|
this.expression(0);
|
|
6439
6575
|
this.state = 35;
|
|
6440
|
-
this.match(
|
|
6576
|
+
this.match(_OpraFilterParser.EOF);
|
|
6441
6577
|
}
|
|
6442
6578
|
} catch (re) {
|
|
6443
6579
|
if (re instanceof RecognitionException) {
|
|
@@ -6462,7 +6598,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6462
6598
|
let localctx = new ExpressionContext(this, this._ctx, _parentState);
|
|
6463
6599
|
let _prevctx = localctx;
|
|
6464
6600
|
const _startState = 2;
|
|
6465
|
-
this.enterRecursionRule(localctx, 2,
|
|
6601
|
+
this.enterRecursionRule(localctx, 2, _OpraFilterParser.RULE_expression, _p);
|
|
6466
6602
|
let _la;
|
|
6467
6603
|
try {
|
|
6468
6604
|
let _alt;
|
|
@@ -6490,11 +6626,11 @@ var OpraFilterParser = class extends Parser {
|
|
|
6490
6626
|
this._ctx = localctx;
|
|
6491
6627
|
_prevctx = localctx;
|
|
6492
6628
|
this.state = 42;
|
|
6493
|
-
this.match(
|
|
6629
|
+
this.match(_OpraFilterParser.T__0);
|
|
6494
6630
|
this.state = 43;
|
|
6495
6631
|
this.parenthesizedItem();
|
|
6496
6632
|
this.state = 44;
|
|
6497
|
-
this.match(
|
|
6633
|
+
this.match(_OpraFilterParser.T__1);
|
|
6498
6634
|
}
|
|
6499
6635
|
break;
|
|
6500
6636
|
case 3:
|
|
@@ -6531,7 +6667,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6531
6667
|
{
|
|
6532
6668
|
{
|
|
6533
6669
|
localctx = new LogicalExpressionContext(this, new ExpressionContext(this, _parentctx, _parentState));
|
|
6534
|
-
this.pushNewRecursionContext(localctx, _startState,
|
|
6670
|
+
this.pushNewRecursionContext(localctx, _startState, _OpraFilterParser.RULE_expression);
|
|
6535
6671
|
this.state = 50;
|
|
6536
6672
|
if (!this.precpred(this._ctx, 3)) {
|
|
6537
6673
|
throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");
|
|
@@ -6564,7 +6700,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6564
6700
|
// @RuleVersion(0)
|
|
6565
6701
|
comparisonLeft() {
|
|
6566
6702
|
const localctx = new ComparisonLeftContext(this, this._ctx, this.state);
|
|
6567
|
-
this.enterRule(localctx, 4,
|
|
6703
|
+
this.enterRule(localctx, 4, _OpraFilterParser.RULE_comparisonLeft);
|
|
6568
6704
|
try {
|
|
6569
6705
|
this.enterOuterAlt(localctx, 1);
|
|
6570
6706
|
{
|
|
@@ -6587,7 +6723,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6587
6723
|
// @RuleVersion(0)
|
|
6588
6724
|
comparisonRight() {
|
|
6589
6725
|
const localctx = new ComparisonRightContext(this, this._ctx, this.state);
|
|
6590
|
-
this.enterRule(localctx, 6,
|
|
6726
|
+
this.enterRule(localctx, 6, _OpraFilterParser.RULE_comparisonRight);
|
|
6591
6727
|
try {
|
|
6592
6728
|
this.state = 65;
|
|
6593
6729
|
this._errHandler.sync(this);
|
|
@@ -6648,7 +6784,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6648
6784
|
// @RuleVersion(0)
|
|
6649
6785
|
parenthesizedItem() {
|
|
6650
6786
|
const localctx = new ParenthesizedItemContext(this, this._ctx, this.state);
|
|
6651
|
-
this.enterRule(localctx, 8,
|
|
6787
|
+
this.enterRule(localctx, 8, _OpraFilterParser.RULE_parenthesizedItem);
|
|
6652
6788
|
try {
|
|
6653
6789
|
this.enterOuterAlt(localctx, 1);
|
|
6654
6790
|
{
|
|
@@ -6671,7 +6807,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6671
6807
|
// @RuleVersion(0)
|
|
6672
6808
|
value() {
|
|
6673
6809
|
let localctx = new ValueContext(this, this._ctx, this.state);
|
|
6674
|
-
this.enterRule(localctx, 10,
|
|
6810
|
+
this.enterRule(localctx, 10, _OpraFilterParser.RULE_value);
|
|
6675
6811
|
try {
|
|
6676
6812
|
this.state = 77;
|
|
6677
6813
|
this._errHandler.sync(this);
|
|
@@ -6681,7 +6817,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6681
6817
|
this.enterOuterAlt(localctx, 1);
|
|
6682
6818
|
{
|
|
6683
6819
|
this.state = 69;
|
|
6684
|
-
this.match(
|
|
6820
|
+
this.match(_OpraFilterParser.NUMBER);
|
|
6685
6821
|
}
|
|
6686
6822
|
break;
|
|
6687
6823
|
case 13:
|
|
@@ -6715,7 +6851,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6715
6851
|
this.enterOuterAlt(localctx, 5);
|
|
6716
6852
|
{
|
|
6717
6853
|
this.state = 73;
|
|
6718
|
-
this.match(
|
|
6854
|
+
this.match(_OpraFilterParser.DATE);
|
|
6719
6855
|
}
|
|
6720
6856
|
break;
|
|
6721
6857
|
case 38:
|
|
@@ -6723,7 +6859,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6723
6859
|
this.enterOuterAlt(localctx, 6);
|
|
6724
6860
|
{
|
|
6725
6861
|
this.state = 74;
|
|
6726
|
-
this.match(
|
|
6862
|
+
this.match(_OpraFilterParser.DATETIME);
|
|
6727
6863
|
}
|
|
6728
6864
|
break;
|
|
6729
6865
|
case 39:
|
|
@@ -6731,7 +6867,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6731
6867
|
this.enterOuterAlt(localctx, 7);
|
|
6732
6868
|
{
|
|
6733
6869
|
this.state = 75;
|
|
6734
|
-
this.match(
|
|
6870
|
+
this.match(_OpraFilterParser.TIME);
|
|
6735
6871
|
}
|
|
6736
6872
|
break;
|
|
6737
6873
|
case 42:
|
|
@@ -6739,7 +6875,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6739
6875
|
this.enterOuterAlt(localctx, 8);
|
|
6740
6876
|
{
|
|
6741
6877
|
this.state = 76;
|
|
6742
|
-
this.match(
|
|
6878
|
+
this.match(_OpraFilterParser.STRING);
|
|
6743
6879
|
}
|
|
6744
6880
|
break;
|
|
6745
6881
|
default:
|
|
@@ -6761,7 +6897,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6761
6897
|
// @RuleVersion(0)
|
|
6762
6898
|
qualifiedIdentifier() {
|
|
6763
6899
|
const localctx = new QualifiedIdentifierContext(this, this._ctx, this.state);
|
|
6764
|
-
this.enterRule(localctx, 12,
|
|
6900
|
+
this.enterRule(localctx, 12, _OpraFilterParser.RULE_qualifiedIdentifier);
|
|
6765
6901
|
try {
|
|
6766
6902
|
let _alt;
|
|
6767
6903
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -6776,7 +6912,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6776
6912
|
this.state = 79;
|
|
6777
6913
|
this.identifier();
|
|
6778
6914
|
this.state = 80;
|
|
6779
|
-
this.match(
|
|
6915
|
+
this.match(_OpraFilterParser.T__4);
|
|
6780
6916
|
}
|
|
6781
6917
|
}
|
|
6782
6918
|
}
|
|
@@ -6803,12 +6939,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
6803
6939
|
// @RuleVersion(0)
|
|
6804
6940
|
externalConstant() {
|
|
6805
6941
|
const localctx = new ExternalConstantContext(this, this._ctx, this.state);
|
|
6806
|
-
this.enterRule(localctx, 14,
|
|
6942
|
+
this.enterRule(localctx, 14, _OpraFilterParser.RULE_externalConstant);
|
|
6807
6943
|
try {
|
|
6808
6944
|
this.enterOuterAlt(localctx, 1);
|
|
6809
6945
|
{
|
|
6810
6946
|
this.state = 89;
|
|
6811
|
-
this.match(
|
|
6947
|
+
this.match(_OpraFilterParser.T__5);
|
|
6812
6948
|
this.state = 90;
|
|
6813
6949
|
this.identifier();
|
|
6814
6950
|
}
|
|
@@ -6828,12 +6964,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
6828
6964
|
// @RuleVersion(0)
|
|
6829
6965
|
identifier() {
|
|
6830
6966
|
const localctx = new IdentifierContext(this, this._ctx, this.state);
|
|
6831
|
-
this.enterRule(localctx, 16,
|
|
6967
|
+
this.enterRule(localctx, 16, _OpraFilterParser.RULE_identifier);
|
|
6832
6968
|
try {
|
|
6833
6969
|
this.enterOuterAlt(localctx, 1);
|
|
6834
6970
|
{
|
|
6835
6971
|
this.state = 92;
|
|
6836
|
-
this.match(
|
|
6972
|
+
this.match(_OpraFilterParser.IDENTIFIER);
|
|
6837
6973
|
}
|
|
6838
6974
|
} catch (re) {
|
|
6839
6975
|
if (re instanceof RecognitionException) {
|
|
@@ -6851,13 +6987,13 @@ var OpraFilterParser = class extends Parser {
|
|
|
6851
6987
|
// @RuleVersion(0)
|
|
6852
6988
|
arrayValue() {
|
|
6853
6989
|
const localctx = new ArrayValueContext(this, this._ctx, this.state);
|
|
6854
|
-
this.enterRule(localctx, 18,
|
|
6990
|
+
this.enterRule(localctx, 18, _OpraFilterParser.RULE_arrayValue);
|
|
6855
6991
|
let _la;
|
|
6856
6992
|
try {
|
|
6857
6993
|
this.enterOuterAlt(localctx, 1);
|
|
6858
6994
|
{
|
|
6859
6995
|
this.state = 94;
|
|
6860
|
-
this.match(
|
|
6996
|
+
this.match(_OpraFilterParser.T__6);
|
|
6861
6997
|
this.state = 95;
|
|
6862
6998
|
this.value();
|
|
6863
6999
|
this.state = 100;
|
|
@@ -6867,7 +7003,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6867
7003
|
{
|
|
6868
7004
|
{
|
|
6869
7005
|
this.state = 96;
|
|
6870
|
-
this.match(
|
|
7006
|
+
this.match(_OpraFilterParser.T__7);
|
|
6871
7007
|
this.state = 97;
|
|
6872
7008
|
this.value();
|
|
6873
7009
|
}
|
|
@@ -6877,7 +7013,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6877
7013
|
_la = this._input.LA(1);
|
|
6878
7014
|
}
|
|
6879
7015
|
this.state = 103;
|
|
6880
|
-
this.match(
|
|
7016
|
+
this.match(_OpraFilterParser.T__8);
|
|
6881
7017
|
}
|
|
6882
7018
|
} catch (re) {
|
|
6883
7019
|
if (re instanceof RecognitionException) {
|
|
@@ -6895,7 +7031,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6895
7031
|
// @RuleVersion(0)
|
|
6896
7032
|
boolean_() {
|
|
6897
7033
|
const localctx = new BooleanContext(this, this._ctx, this.state);
|
|
6898
|
-
this.enterRule(localctx, 20,
|
|
7034
|
+
this.enterRule(localctx, 20, _OpraFilterParser.RULE_boolean);
|
|
6899
7035
|
let _la;
|
|
6900
7036
|
try {
|
|
6901
7037
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -6925,12 +7061,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
6925
7061
|
// @RuleVersion(0)
|
|
6926
7062
|
null_() {
|
|
6927
7063
|
const localctx = new NullContext(this, this._ctx, this.state);
|
|
6928
|
-
this.enterRule(localctx, 22,
|
|
7064
|
+
this.enterRule(localctx, 22, _OpraFilterParser.RULE_null);
|
|
6929
7065
|
try {
|
|
6930
7066
|
this.enterOuterAlt(localctx, 1);
|
|
6931
7067
|
{
|
|
6932
7068
|
this.state = 107;
|
|
6933
|
-
this.match(
|
|
7069
|
+
this.match(_OpraFilterParser.T__11);
|
|
6934
7070
|
}
|
|
6935
7071
|
} catch (re) {
|
|
6936
7072
|
if (re instanceof RecognitionException) {
|
|
@@ -6948,7 +7084,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6948
7084
|
// @RuleVersion(0)
|
|
6949
7085
|
infinity() {
|
|
6950
7086
|
const localctx = new InfinityContext(this, this._ctx, this.state);
|
|
6951
|
-
this.enterRule(localctx, 24,
|
|
7087
|
+
this.enterRule(localctx, 24, _OpraFilterParser.RULE_infinity);
|
|
6952
7088
|
let _la;
|
|
6953
7089
|
try {
|
|
6954
7090
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -6978,7 +7114,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6978
7114
|
// @RuleVersion(0)
|
|
6979
7115
|
arithmeticOperator() {
|
|
6980
7116
|
const localctx = new ArithmeticOperatorContext(this, this._ctx, this.state);
|
|
6981
|
-
this.enterRule(localctx, 26,
|
|
7117
|
+
this.enterRule(localctx, 26, _OpraFilterParser.RULE_arithmeticOperator);
|
|
6982
7118
|
let _la;
|
|
6983
7119
|
try {
|
|
6984
7120
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -7008,7 +7144,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
7008
7144
|
// @RuleVersion(0)
|
|
7009
7145
|
comparisonOperator() {
|
|
7010
7146
|
const localctx = new ComparisonOperatorContext(this, this._ctx, this.state);
|
|
7011
|
-
this.enterRule(localctx, 28,
|
|
7147
|
+
this.enterRule(localctx, 28, _OpraFilterParser.RULE_comparisonOperator);
|
|
7012
7148
|
let _la;
|
|
7013
7149
|
try {
|
|
7014
7150
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -7038,7 +7174,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
7038
7174
|
// @RuleVersion(0)
|
|
7039
7175
|
logicalOperator() {
|
|
7040
7176
|
const localctx = new LogicalOperatorContext(this, this._ctx, this.state);
|
|
7041
|
-
this.enterRule(localctx, 30,
|
|
7177
|
+
this.enterRule(localctx, 30, _OpraFilterParser.RULE_logicalOperator);
|
|
7042
7178
|
let _la;
|
|
7043
7179
|
try {
|
|
7044
7180
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -7068,12 +7204,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
7068
7204
|
// @RuleVersion(0)
|
|
7069
7205
|
polarityOperator() {
|
|
7070
7206
|
const localctx = new PolarityOperatorContext(this, this._ctx, this.state);
|
|
7071
|
-
this.enterRule(localctx, 32,
|
|
7207
|
+
this.enterRule(localctx, 32, _OpraFilterParser.RULE_polarityOperator);
|
|
7072
7208
|
try {
|
|
7073
7209
|
this.enterOuterAlt(localctx, 1);
|
|
7074
7210
|
{
|
|
7075
7211
|
this.state = 117;
|
|
7076
|
-
this.match(
|
|
7212
|
+
this.match(_OpraFilterParser.POLAR_OP);
|
|
7077
7213
|
}
|
|
7078
7214
|
} catch (re) {
|
|
7079
7215
|
if (re instanceof RecognitionException) {
|
|
@@ -7103,13 +7239,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
7103
7239
|
return true;
|
|
7104
7240
|
}
|
|
7105
7241
|
static get _ATN() {
|
|
7106
|
-
if (!
|
|
7107
|
-
|
|
7242
|
+
if (!_OpraFilterParser.__ATN) {
|
|
7243
|
+
_OpraFilterParser.__ATN = new ATNDeserializer2().deserialize(_OpraFilterParser._serializedATN);
|
|
7108
7244
|
}
|
|
7109
|
-
return
|
|
7245
|
+
return _OpraFilterParser.__ATN;
|
|
7110
7246
|
}
|
|
7111
7247
|
};
|
|
7112
|
-
__name(OpraFilterParser, "OpraFilterParser");
|
|
7113
7248
|
OpraFilterParser.T__0 = 1;
|
|
7114
7249
|
OpraFilterParser.T__1 = 2;
|
|
7115
7250
|
OpraFilterParser.T__2 = 3;
|
|
@@ -8286,7 +8421,11 @@ OpraFilterParser._serializedATN = [
|
|
|
8286
8421
|
100
|
|
8287
8422
|
];
|
|
8288
8423
|
OpraFilterParser.DecisionsToDFA = OpraFilterParser._ATN.decisionToState.map((ds, index) => new DFA2(ds, index));
|
|
8424
|
+
var OpraFilterParser_default = OpraFilterParser;
|
|
8289
8425
|
var RootContext = class extends ParserRuleContext {
|
|
8426
|
+
static {
|
|
8427
|
+
__name(this, "RootContext");
|
|
8428
|
+
}
|
|
8290
8429
|
constructor(parser, parent, invokingState) {
|
|
8291
8430
|
super(parent, invokingState);
|
|
8292
8431
|
this.parser = parser;
|
|
@@ -8319,8 +8458,10 @@ var RootContext = class extends ParserRuleContext {
|
|
|
8319
8458
|
}
|
|
8320
8459
|
}
|
|
8321
8460
|
};
|
|
8322
|
-
__name(RootContext, "RootContext");
|
|
8323
8461
|
var ExpressionContext = class extends ParserRuleContext {
|
|
8462
|
+
static {
|
|
8463
|
+
__name(this, "ExpressionContext");
|
|
8464
|
+
}
|
|
8324
8465
|
constructor(parser, parent, invokingState) {
|
|
8325
8466
|
super(parent, invokingState);
|
|
8326
8467
|
this.parser = parser;
|
|
@@ -8332,8 +8473,10 @@ var ExpressionContext = class extends ParserRuleContext {
|
|
|
8332
8473
|
super.copyFrom(ctx);
|
|
8333
8474
|
}
|
|
8334
8475
|
};
|
|
8335
|
-
__name(ExpressionContext, "ExpressionContext");
|
|
8336
8476
|
var ParenthesizedExpressionContext = class extends ExpressionContext {
|
|
8477
|
+
static {
|
|
8478
|
+
__name(this, "ParenthesizedExpressionContext");
|
|
8479
|
+
}
|
|
8337
8480
|
constructor(parser, ctx) {
|
|
8338
8481
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8339
8482
|
super.copyFrom(ctx);
|
|
@@ -8360,8 +8503,10 @@ var ParenthesizedExpressionContext = class extends ExpressionContext {
|
|
|
8360
8503
|
}
|
|
8361
8504
|
}
|
|
8362
8505
|
};
|
|
8363
|
-
__name(ParenthesizedExpressionContext, "ParenthesizedExpressionContext");
|
|
8364
8506
|
var NegativeExpressionContext = class extends ExpressionContext {
|
|
8507
|
+
static {
|
|
8508
|
+
__name(this, "NegativeExpressionContext");
|
|
8509
|
+
}
|
|
8365
8510
|
constructor(parser, ctx) {
|
|
8366
8511
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8367
8512
|
super.copyFrom(ctx);
|
|
@@ -8388,8 +8533,10 @@ var NegativeExpressionContext = class extends ExpressionContext {
|
|
|
8388
8533
|
}
|
|
8389
8534
|
}
|
|
8390
8535
|
};
|
|
8391
|
-
__name(NegativeExpressionContext, "NegativeExpressionContext");
|
|
8392
8536
|
var ComparisonExpressionContext = class extends ExpressionContext {
|
|
8537
|
+
static {
|
|
8538
|
+
__name(this, "ComparisonExpressionContext");
|
|
8539
|
+
}
|
|
8393
8540
|
constructor(parser, ctx) {
|
|
8394
8541
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8395
8542
|
super.copyFrom(ctx);
|
|
@@ -8422,8 +8569,10 @@ var ComparisonExpressionContext = class extends ExpressionContext {
|
|
|
8422
8569
|
}
|
|
8423
8570
|
}
|
|
8424
8571
|
};
|
|
8425
|
-
__name(ComparisonExpressionContext, "ComparisonExpressionContext");
|
|
8426
8572
|
var LogicalExpressionContext = class extends ExpressionContext {
|
|
8573
|
+
static {
|
|
8574
|
+
__name(this, "LogicalExpressionContext");
|
|
8575
|
+
}
|
|
8427
8576
|
constructor(parser, ctx) {
|
|
8428
8577
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8429
8578
|
super.copyFrom(ctx);
|
|
@@ -8456,8 +8605,10 @@ var LogicalExpressionContext = class extends ExpressionContext {
|
|
|
8456
8605
|
}
|
|
8457
8606
|
}
|
|
8458
8607
|
};
|
|
8459
|
-
__name(LogicalExpressionContext, "LogicalExpressionContext");
|
|
8460
8608
|
var ComparisonLeftContext = class extends ParserRuleContext {
|
|
8609
|
+
static {
|
|
8610
|
+
__name(this, "ComparisonLeftContext");
|
|
8611
|
+
}
|
|
8461
8612
|
constructor(parser, parent, invokingState) {
|
|
8462
8613
|
super(parent, invokingState);
|
|
8463
8614
|
this.parser = parser;
|
|
@@ -8487,8 +8638,10 @@ var ComparisonLeftContext = class extends ParserRuleContext {
|
|
|
8487
8638
|
}
|
|
8488
8639
|
}
|
|
8489
8640
|
};
|
|
8490
|
-
__name(ComparisonLeftContext, "ComparisonLeftContext");
|
|
8491
8641
|
var ComparisonRightContext = class extends ParserRuleContext {
|
|
8642
|
+
static {
|
|
8643
|
+
__name(this, "ComparisonRightContext");
|
|
8644
|
+
}
|
|
8492
8645
|
constructor(parser, parent, invokingState) {
|
|
8493
8646
|
super(parent, invokingState);
|
|
8494
8647
|
this.parser = parser;
|
|
@@ -8527,8 +8680,10 @@ var ComparisonRightContext = class extends ParserRuleContext {
|
|
|
8527
8680
|
}
|
|
8528
8681
|
}
|
|
8529
8682
|
};
|
|
8530
|
-
__name(ComparisonRightContext, "ComparisonRightContext");
|
|
8531
8683
|
var ParenthesizedItemContext = class extends ParserRuleContext {
|
|
8684
|
+
static {
|
|
8685
|
+
__name(this, "ParenthesizedItemContext");
|
|
8686
|
+
}
|
|
8532
8687
|
constructor(parser, parent, invokingState) {
|
|
8533
8688
|
super(parent, invokingState);
|
|
8534
8689
|
this.parser = parser;
|
|
@@ -8558,8 +8713,10 @@ var ParenthesizedItemContext = class extends ParserRuleContext {
|
|
|
8558
8713
|
}
|
|
8559
8714
|
}
|
|
8560
8715
|
};
|
|
8561
|
-
__name(ParenthesizedItemContext, "ParenthesizedItemContext");
|
|
8562
8716
|
var ValueContext = class extends ParserRuleContext {
|
|
8717
|
+
static {
|
|
8718
|
+
__name(this, "ValueContext");
|
|
8719
|
+
}
|
|
8563
8720
|
constructor(parser, parent, invokingState) {
|
|
8564
8721
|
super(parent, invokingState);
|
|
8565
8722
|
this.parser = parser;
|
|
@@ -8571,8 +8728,10 @@ var ValueContext = class extends ParserRuleContext {
|
|
|
8571
8728
|
super.copyFrom(ctx);
|
|
8572
8729
|
}
|
|
8573
8730
|
};
|
|
8574
|
-
__name(ValueContext, "ValueContext");
|
|
8575
8731
|
var TimeLiteralContext = class extends ValueContext {
|
|
8732
|
+
static {
|
|
8733
|
+
__name(this, "TimeLiteralContext");
|
|
8734
|
+
}
|
|
8576
8735
|
constructor(parser, ctx) {
|
|
8577
8736
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8578
8737
|
super.copyFrom(ctx);
|
|
@@ -8599,8 +8758,10 @@ var TimeLiteralContext = class extends ValueContext {
|
|
|
8599
8758
|
}
|
|
8600
8759
|
}
|
|
8601
8760
|
};
|
|
8602
|
-
__name(TimeLiteralContext, "TimeLiteralContext");
|
|
8603
8761
|
var NullLiteralContext = class extends ValueContext {
|
|
8762
|
+
static {
|
|
8763
|
+
__name(this, "NullLiteralContext");
|
|
8764
|
+
}
|
|
8604
8765
|
constructor(parser, ctx) {
|
|
8605
8766
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8606
8767
|
super.copyFrom(ctx);
|
|
@@ -8627,8 +8788,10 @@ var NullLiteralContext = class extends ValueContext {
|
|
|
8627
8788
|
}
|
|
8628
8789
|
}
|
|
8629
8790
|
};
|
|
8630
|
-
__name(NullLiteralContext, "NullLiteralContext");
|
|
8631
8791
|
var DateTimeLiteralContext = class extends ValueContext {
|
|
8792
|
+
static {
|
|
8793
|
+
__name(this, "DateTimeLiteralContext");
|
|
8794
|
+
}
|
|
8632
8795
|
constructor(parser, ctx) {
|
|
8633
8796
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8634
8797
|
super.copyFrom(ctx);
|
|
@@ -8655,8 +8818,10 @@ var DateTimeLiteralContext = class extends ValueContext {
|
|
|
8655
8818
|
}
|
|
8656
8819
|
}
|
|
8657
8820
|
};
|
|
8658
|
-
__name(DateTimeLiteralContext, "DateTimeLiteralContext");
|
|
8659
8821
|
var StringLiteralContext = class extends ValueContext {
|
|
8822
|
+
static {
|
|
8823
|
+
__name(this, "StringLiteralContext");
|
|
8824
|
+
}
|
|
8660
8825
|
constructor(parser, ctx) {
|
|
8661
8826
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8662
8827
|
super.copyFrom(ctx);
|
|
@@ -8683,8 +8848,10 @@ var StringLiteralContext = class extends ValueContext {
|
|
|
8683
8848
|
}
|
|
8684
8849
|
}
|
|
8685
8850
|
};
|
|
8686
|
-
__name(StringLiteralContext, "StringLiteralContext");
|
|
8687
8851
|
var DateLiteralContext = class extends ValueContext {
|
|
8852
|
+
static {
|
|
8853
|
+
__name(this, "DateLiteralContext");
|
|
8854
|
+
}
|
|
8688
8855
|
constructor(parser, ctx) {
|
|
8689
8856
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8690
8857
|
super.copyFrom(ctx);
|
|
@@ -8711,8 +8878,10 @@ var DateLiteralContext = class extends ValueContext {
|
|
|
8711
8878
|
}
|
|
8712
8879
|
}
|
|
8713
8880
|
};
|
|
8714
|
-
__name(DateLiteralContext, "DateLiteralContext");
|
|
8715
8881
|
var InfinityLiteralContext = class extends ValueContext {
|
|
8882
|
+
static {
|
|
8883
|
+
__name(this, "InfinityLiteralContext");
|
|
8884
|
+
}
|
|
8716
8885
|
constructor(parser, ctx) {
|
|
8717
8886
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8718
8887
|
super.copyFrom(ctx);
|
|
@@ -8739,8 +8908,10 @@ var InfinityLiteralContext = class extends ValueContext {
|
|
|
8739
8908
|
}
|
|
8740
8909
|
}
|
|
8741
8910
|
};
|
|
8742
|
-
__name(InfinityLiteralContext, "InfinityLiteralContext");
|
|
8743
8911
|
var BooleanLiteralContext = class extends ValueContext {
|
|
8912
|
+
static {
|
|
8913
|
+
__name(this, "BooleanLiteralContext");
|
|
8914
|
+
}
|
|
8744
8915
|
constructor(parser, ctx) {
|
|
8745
8916
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8746
8917
|
super.copyFrom(ctx);
|
|
@@ -8767,8 +8938,10 @@ var BooleanLiteralContext = class extends ValueContext {
|
|
|
8767
8938
|
}
|
|
8768
8939
|
}
|
|
8769
8940
|
};
|
|
8770
|
-
__name(BooleanLiteralContext, "BooleanLiteralContext");
|
|
8771
8941
|
var NumberLiteralContext = class extends ValueContext {
|
|
8942
|
+
static {
|
|
8943
|
+
__name(this, "NumberLiteralContext");
|
|
8944
|
+
}
|
|
8772
8945
|
constructor(parser, ctx) {
|
|
8773
8946
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8774
8947
|
super.copyFrom(ctx);
|
|
@@ -8795,8 +8968,10 @@ var NumberLiteralContext = class extends ValueContext {
|
|
|
8795
8968
|
}
|
|
8796
8969
|
}
|
|
8797
8970
|
};
|
|
8798
|
-
__name(NumberLiteralContext, "NumberLiteralContext");
|
|
8799
8971
|
var QualifiedIdentifierContext = class extends ParserRuleContext {
|
|
8972
|
+
static {
|
|
8973
|
+
__name(this, "QualifiedIdentifierContext");
|
|
8974
|
+
}
|
|
8800
8975
|
constructor(parser, parent, invokingState) {
|
|
8801
8976
|
super(parent, invokingState);
|
|
8802
8977
|
this.parser = parser;
|
|
@@ -8829,8 +9004,10 @@ var QualifiedIdentifierContext = class extends ParserRuleContext {
|
|
|
8829
9004
|
}
|
|
8830
9005
|
}
|
|
8831
9006
|
};
|
|
8832
|
-
__name(QualifiedIdentifierContext, "QualifiedIdentifierContext");
|
|
8833
9007
|
var ExternalConstantContext = class extends ParserRuleContext {
|
|
9008
|
+
static {
|
|
9009
|
+
__name(this, "ExternalConstantContext");
|
|
9010
|
+
}
|
|
8834
9011
|
constructor(parser, parent, invokingState) {
|
|
8835
9012
|
super(parent, invokingState);
|
|
8836
9013
|
this.parser = parser;
|
|
@@ -8860,8 +9037,10 @@ var ExternalConstantContext = class extends ParserRuleContext {
|
|
|
8860
9037
|
}
|
|
8861
9038
|
}
|
|
8862
9039
|
};
|
|
8863
|
-
__name(ExternalConstantContext, "ExternalConstantContext");
|
|
8864
9040
|
var IdentifierContext = class extends ParserRuleContext {
|
|
9041
|
+
static {
|
|
9042
|
+
__name(this, "IdentifierContext");
|
|
9043
|
+
}
|
|
8865
9044
|
constructor(parser, parent, invokingState) {
|
|
8866
9045
|
super(parent, invokingState);
|
|
8867
9046
|
this.parser = parser;
|
|
@@ -8891,8 +9070,10 @@ var IdentifierContext = class extends ParserRuleContext {
|
|
|
8891
9070
|
}
|
|
8892
9071
|
}
|
|
8893
9072
|
};
|
|
8894
|
-
__name(IdentifierContext, "IdentifierContext");
|
|
8895
9073
|
var ArrayValueContext = class extends ParserRuleContext {
|
|
9074
|
+
static {
|
|
9075
|
+
__name(this, "ArrayValueContext");
|
|
9076
|
+
}
|
|
8896
9077
|
constructor(parser, parent, invokingState) {
|
|
8897
9078
|
super(parent, invokingState);
|
|
8898
9079
|
this.parser = parser;
|
|
@@ -8925,8 +9106,10 @@ var ArrayValueContext = class extends ParserRuleContext {
|
|
|
8925
9106
|
}
|
|
8926
9107
|
}
|
|
8927
9108
|
};
|
|
8928
|
-
__name(ArrayValueContext, "ArrayValueContext");
|
|
8929
9109
|
var BooleanContext = class extends ParserRuleContext {
|
|
9110
|
+
static {
|
|
9111
|
+
__name(this, "BooleanContext");
|
|
9112
|
+
}
|
|
8930
9113
|
constructor(parser, parent, invokingState) {
|
|
8931
9114
|
super(parent, invokingState);
|
|
8932
9115
|
this.parser = parser;
|
|
@@ -8953,8 +9136,10 @@ var BooleanContext = class extends ParserRuleContext {
|
|
|
8953
9136
|
}
|
|
8954
9137
|
}
|
|
8955
9138
|
};
|
|
8956
|
-
__name(BooleanContext, "BooleanContext");
|
|
8957
9139
|
var NullContext = class extends ParserRuleContext {
|
|
9140
|
+
static {
|
|
9141
|
+
__name(this, "NullContext");
|
|
9142
|
+
}
|
|
8958
9143
|
constructor(parser, parent, invokingState) {
|
|
8959
9144
|
super(parent, invokingState);
|
|
8960
9145
|
this.parser = parser;
|
|
@@ -8981,8 +9166,10 @@ var NullContext = class extends ParserRuleContext {
|
|
|
8981
9166
|
}
|
|
8982
9167
|
}
|
|
8983
9168
|
};
|
|
8984
|
-
__name(NullContext, "NullContext");
|
|
8985
9169
|
var InfinityContext = class extends ParserRuleContext {
|
|
9170
|
+
static {
|
|
9171
|
+
__name(this, "InfinityContext");
|
|
9172
|
+
}
|
|
8986
9173
|
constructor(parser, parent, invokingState) {
|
|
8987
9174
|
super(parent, invokingState);
|
|
8988
9175
|
this.parser = parser;
|
|
@@ -9009,8 +9196,10 @@ var InfinityContext = class extends ParserRuleContext {
|
|
|
9009
9196
|
}
|
|
9010
9197
|
}
|
|
9011
9198
|
};
|
|
9012
|
-
__name(InfinityContext, "InfinityContext");
|
|
9013
9199
|
var ArithmeticOperatorContext = class extends ParserRuleContext {
|
|
9200
|
+
static {
|
|
9201
|
+
__name(this, "ArithmeticOperatorContext");
|
|
9202
|
+
}
|
|
9014
9203
|
constructor(parser, parent, invokingState) {
|
|
9015
9204
|
super(parent, invokingState);
|
|
9016
9205
|
this.parser = parser;
|
|
@@ -9037,8 +9226,10 @@ var ArithmeticOperatorContext = class extends ParserRuleContext {
|
|
|
9037
9226
|
}
|
|
9038
9227
|
}
|
|
9039
9228
|
};
|
|
9040
|
-
__name(ArithmeticOperatorContext, "ArithmeticOperatorContext");
|
|
9041
9229
|
var ComparisonOperatorContext = class extends ParserRuleContext {
|
|
9230
|
+
static {
|
|
9231
|
+
__name(this, "ComparisonOperatorContext");
|
|
9232
|
+
}
|
|
9042
9233
|
constructor(parser, parent, invokingState) {
|
|
9043
9234
|
super(parent, invokingState);
|
|
9044
9235
|
this.parser = parser;
|
|
@@ -9065,8 +9256,10 @@ var ComparisonOperatorContext = class extends ParserRuleContext {
|
|
|
9065
9256
|
}
|
|
9066
9257
|
}
|
|
9067
9258
|
};
|
|
9068
|
-
__name(ComparisonOperatorContext, "ComparisonOperatorContext");
|
|
9069
9259
|
var LogicalOperatorContext = class extends ParserRuleContext {
|
|
9260
|
+
static {
|
|
9261
|
+
__name(this, "LogicalOperatorContext");
|
|
9262
|
+
}
|
|
9070
9263
|
constructor(parser, parent, invokingState) {
|
|
9071
9264
|
super(parent, invokingState);
|
|
9072
9265
|
this.parser = parser;
|
|
@@ -9093,8 +9286,10 @@ var LogicalOperatorContext = class extends ParserRuleContext {
|
|
|
9093
9286
|
}
|
|
9094
9287
|
}
|
|
9095
9288
|
};
|
|
9096
|
-
__name(LogicalOperatorContext, "LogicalOperatorContext");
|
|
9097
9289
|
var PolarityOperatorContext = class extends ParserRuleContext {
|
|
9290
|
+
static {
|
|
9291
|
+
__name(this, "PolarityOperatorContext");
|
|
9292
|
+
}
|
|
9098
9293
|
constructor(parser, parent, invokingState) {
|
|
9099
9294
|
super(parent, invokingState);
|
|
9100
9295
|
this.parser = parser;
|
|
@@ -9124,13 +9319,15 @@ var PolarityOperatorContext = class extends ParserRuleContext {
|
|
|
9124
9319
|
}
|
|
9125
9320
|
}
|
|
9126
9321
|
};
|
|
9127
|
-
__name(PolarityOperatorContext, "PolarityOperatorContext");
|
|
9128
9322
|
|
|
9129
9323
|
// ../../build/common/esm/filter/filter-tree-visitor.js
|
|
9130
9324
|
import antlr4 from "@browsery/antlr4";
|
|
9131
9325
|
|
|
9132
9326
|
// ../../build/common/esm/filter/ast/terms/external-constant.js
|
|
9133
9327
|
var ExternalConstant = class extends Literal {
|
|
9328
|
+
static {
|
|
9329
|
+
__name(this, "ExternalConstant");
|
|
9330
|
+
}
|
|
9134
9331
|
constructor(value) {
|
|
9135
9332
|
super("" + value);
|
|
9136
9333
|
}
|
|
@@ -9138,11 +9335,13 @@ var ExternalConstant = class extends Literal {
|
|
|
9138
9335
|
return "@" + super.toString();
|
|
9139
9336
|
}
|
|
9140
9337
|
};
|
|
9141
|
-
__name(ExternalConstant, "ExternalConstant");
|
|
9142
9338
|
|
|
9143
9339
|
// ../../build/common/esm/filter/filter-tree-visitor.js
|
|
9144
9340
|
var ParseTreeVisitor = antlr4.tree.ParseTreeVisitor;
|
|
9145
9341
|
var FilterTreeVisitor = class extends ParseTreeVisitor {
|
|
9342
|
+
static {
|
|
9343
|
+
__name(this, "FilterTreeVisitor");
|
|
9344
|
+
}
|
|
9146
9345
|
constructor(options) {
|
|
9147
9346
|
super();
|
|
9148
9347
|
this._timeZone = options?.timeZone;
|
|
@@ -9229,11 +9428,13 @@ var FilterTreeVisitor = class extends ParseTreeVisitor {
|
|
|
9229
9428
|
return new ArrayExpression(ctx.value_list().map((child) => this.visit(child)));
|
|
9230
9429
|
}
|
|
9231
9430
|
};
|
|
9232
|
-
__name(FilterTreeVisitor, "FilterTreeVisitor");
|
|
9233
9431
|
|
|
9234
9432
|
// ../../build/common/esm/filter/opra-error-listener.js
|
|
9235
9433
|
import { ErrorListener } from "@browsery/antlr4";
|
|
9236
9434
|
var OpraErrorListener = class extends ErrorListener {
|
|
9435
|
+
static {
|
|
9436
|
+
__name(this, "OpraErrorListener");
|
|
9437
|
+
}
|
|
9237
9438
|
constructor(errors) {
|
|
9238
9439
|
super();
|
|
9239
9440
|
this.errors = errors;
|
|
@@ -9242,14 +9443,13 @@ var OpraErrorListener = class extends ErrorListener {
|
|
|
9242
9443
|
this.errors.push(new FilterParseError(msg, { recognizer, offendingSymbol, line, column, e }));
|
|
9243
9444
|
}
|
|
9244
9445
|
};
|
|
9245
|
-
__name(OpraErrorListener, "OpraErrorListener");
|
|
9246
9446
|
|
|
9247
9447
|
// ../../build/common/esm/filter/parse.js
|
|
9248
9448
|
function parse(text, visitor) {
|
|
9249
9449
|
const chars = new CharStream(text);
|
|
9250
|
-
const lexer = new
|
|
9450
|
+
const lexer = new OpraFilterLexer_default(chars);
|
|
9251
9451
|
const tokenStream = new CommonTokenStream(lexer);
|
|
9252
|
-
const parser = new
|
|
9452
|
+
const parser = new OpraFilterParser_default(tokenStream);
|
|
9253
9453
|
parser.buildParseTrees = true;
|
|
9254
9454
|
const errors = [];
|
|
9255
9455
|
const errorListener = new OpraErrorListener(errors);
|
|
@@ -9399,83 +9599,53 @@ var _wrapEntryValue = /* @__PURE__ */ __name((v) => {
|
|
|
9399
9599
|
}, "_wrapEntryValue");
|
|
9400
9600
|
|
|
9401
9601
|
// ../../build/common/esm/document/resource/resource.js
|
|
9402
|
-
var Resource =
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9602
|
+
var Resource = class {
|
|
9603
|
+
static {
|
|
9604
|
+
__name(this, "Resource");
|
|
9605
|
+
}
|
|
9606
|
+
constructor(document, init) {
|
|
9607
|
+
this.document = document;
|
|
9608
|
+
this.name = init.name;
|
|
9609
|
+
this.description = init.description;
|
|
9610
|
+
this.controller = init.controller;
|
|
9406
9611
|
}
|
|
9407
|
-
const _this = this;
|
|
9408
|
-
_this.document = document;
|
|
9409
|
-
_this.name = init.name;
|
|
9410
|
-
_this.description = init.description;
|
|
9411
|
-
_this.controller = init.controller;
|
|
9412
|
-
_this._construct(init);
|
|
9413
|
-
}, "Resource");
|
|
9414
|
-
var proto6 = {
|
|
9415
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9416
|
-
_construct(init) {
|
|
9417
|
-
},
|
|
9418
9612
|
exportSchema() {
|
|
9419
9613
|
return omitUndefined({
|
|
9420
9614
|
kind: this.kind,
|
|
9421
9615
|
description: this.description
|
|
9422
9616
|
});
|
|
9423
|
-
}
|
|
9617
|
+
}
|
|
9424
9618
|
toString() {
|
|
9425
9619
|
return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || "#anonymous"}]`;
|
|
9426
|
-
}
|
|
9620
|
+
}
|
|
9427
9621
|
[nodeInspectCustom]() {
|
|
9428
9622
|
return `[${colorFgYellow + Object.getPrototypeOf(this).constructor.name + colorReset} ${colorFgMagenta + this.name + colorReset}]`;
|
|
9429
9623
|
}
|
|
9430
9624
|
};
|
|
9431
|
-
Object.assign(Resource.prototype, proto6);
|
|
9432
9625
|
|
|
9433
9626
|
// ../../build/common/esm/document/resource/collection.js
|
|
9434
9627
|
var NESTJS_INJECTABLE_WATERMARK = "__injectable__";
|
|
9435
9628
|
var NAME_PATTERN = /^(.*)(Resource|Collection)$/;
|
|
9436
|
-
var
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
if (m && metadata !== m)
|
|
9451
|
-
Object.assign(metadata, omit4(m), Object.keys(metadata));
|
|
9452
|
-
if (options)
|
|
9453
|
-
Object.assign(metadata, omit4(options, ["kind", "name", "type", "controller"]));
|
|
9454
|
-
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
9455
|
-
Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK, true, target);
|
|
9456
|
-
};
|
|
9457
|
-
}
|
|
9458
|
-
const [document, init] = args;
|
|
9459
|
-
Resource.apply(this, [document, init]);
|
|
9460
|
-
}, "Collection");
|
|
9461
|
-
var proto7 = {
|
|
9462
|
-
_construct(init) {
|
|
9463
|
-
Resource.prototype._construct.call(this, init);
|
|
9464
|
-
const _this = this;
|
|
9465
|
-
_this.kind = OpraSchema.Collection.Kind;
|
|
9466
|
-
_this.controller = init.controller;
|
|
9467
|
-
const operations = _this.operations = init.operations || {};
|
|
9468
|
-
const dataType = _this.type = init.type;
|
|
9469
|
-
_this.primaryKey = init.primaryKey ? Array.isArray(init.primaryKey) ? init.primaryKey : [init.primaryKey] : [];
|
|
9470
|
-
if (!_this.primaryKey.length)
|
|
9471
|
-
throw new TypeError(`You must provide primaryKey for Collection resource ("${_this.name}")`);
|
|
9472
|
-
_this.primaryKey.forEach((f) => {
|
|
9629
|
+
var CollectionClass = class extends Resource {
|
|
9630
|
+
static {
|
|
9631
|
+
__name(this, "CollectionClass");
|
|
9632
|
+
}
|
|
9633
|
+
constructor(document, init) {
|
|
9634
|
+
super(document, init);
|
|
9635
|
+
this.kind = opra_schema_ns_exports.Collection.Kind;
|
|
9636
|
+
this.controller = init.controller;
|
|
9637
|
+
const operations = this.operations = init.operations || {};
|
|
9638
|
+
const dataType = this.type = init.type;
|
|
9639
|
+
this.primaryKey = init.primaryKey ? Array.isArray(init.primaryKey) ? init.primaryKey : [init.primaryKey] : [];
|
|
9640
|
+
if (!this.primaryKey.length)
|
|
9641
|
+
throw new TypeError(`You must provide primaryKey for Collection resource ("${this.name}")`);
|
|
9642
|
+
this.primaryKey.forEach((f) => {
|
|
9473
9643
|
const field = dataType.getField(f);
|
|
9474
9644
|
if (!(field?.type instanceof SimpleType2))
|
|
9475
9645
|
throw new TypeError(`Only Simple type allowed for primary keys but "${f}" is a ${field.type.kind}`);
|
|
9476
9646
|
});
|
|
9477
|
-
if (
|
|
9478
|
-
const instance = typeof
|
|
9647
|
+
if (this.controller) {
|
|
9648
|
+
const instance = typeof this.controller == "function" ? new this.controller() : this.controller;
|
|
9479
9649
|
for (const operation of Object.values(operations)) {
|
|
9480
9650
|
if (!operation.handler && operation.handlerName) {
|
|
9481
9651
|
const fn = instance[operation.handlerName];
|
|
@@ -9485,7 +9655,7 @@ var proto7 = {
|
|
|
9485
9655
|
}
|
|
9486
9656
|
}
|
|
9487
9657
|
}
|
|
9488
|
-
}
|
|
9658
|
+
}
|
|
9489
9659
|
exportSchema() {
|
|
9490
9660
|
const out = Resource.prototype.exportSchema.call(this);
|
|
9491
9661
|
Object.assign(out, omitUndefined({
|
|
@@ -9494,7 +9664,7 @@ var proto7 = {
|
|
|
9494
9664
|
primaryKey: this.primaryKey
|
|
9495
9665
|
}));
|
|
9496
9666
|
return out;
|
|
9497
|
-
}
|
|
9667
|
+
}
|
|
9498
9668
|
parseKeyValue(value) {
|
|
9499
9669
|
if (!this.primaryKey?.length)
|
|
9500
9670
|
return;
|
|
@@ -9520,22 +9690,22 @@ var proto7 = {
|
|
|
9520
9690
|
throw new TypeError(`You must provide value of primary field(s) (${primaryKey})`);
|
|
9521
9691
|
return result;
|
|
9522
9692
|
}
|
|
9523
|
-
}
|
|
9693
|
+
}
|
|
9524
9694
|
normalizeFieldPath(path3) {
|
|
9525
9695
|
return this.type.normalizeFieldPath(path3);
|
|
9526
|
-
}
|
|
9696
|
+
}
|
|
9527
9697
|
normalizeSortFields(fields) {
|
|
9528
9698
|
const normalized = this.type.normalizeFieldPath(fields);
|
|
9529
9699
|
const findManyEndpoint = this.operations.findMany;
|
|
9530
9700
|
const sortFields = findManyEndpoint && findManyEndpoint.sortFields;
|
|
9531
|
-
normalized.forEach((field) => {
|
|
9701
|
+
(Array.isArray(normalized) ? normalized : [normalized]).forEach((field) => {
|
|
9532
9702
|
if (!sortFields?.find((x) => x === field))
|
|
9533
9703
|
throw new BadRequestError({
|
|
9534
9704
|
message: translate("error:UNACCEPTED_SORT_FIELD", { field }, `Field '${field}' is not available for sort operation`)
|
|
9535
9705
|
});
|
|
9536
9706
|
});
|
|
9537
9707
|
return normalized;
|
|
9538
|
-
}
|
|
9708
|
+
}
|
|
9539
9709
|
normalizeFilter(filter) {
|
|
9540
9710
|
if (!filter)
|
|
9541
9711
|
return;
|
|
@@ -9561,8 +9731,32 @@ var proto7 = {
|
|
|
9561
9731
|
return ast;
|
|
9562
9732
|
}
|
|
9563
9733
|
};
|
|
9564
|
-
|
|
9565
|
-
|
|
9734
|
+
var Collection2 = /* @__PURE__ */ __name(function(...args) {
|
|
9735
|
+
if (!this) {
|
|
9736
|
+
const [type, options] = args;
|
|
9737
|
+
return function(target) {
|
|
9738
|
+
const name = options?.name || target.name.match(NAME_PATTERN)?.[1] || target.name;
|
|
9739
|
+
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target) || {};
|
|
9740
|
+
const baseMetadata = Reflect.getOwnMetadata(METADATA_KEY, Object.getPrototypeOf(target));
|
|
9741
|
+
if (baseMetadata) {
|
|
9742
|
+
merge5(metadata, baseMetadata, { deep: true });
|
|
9743
|
+
}
|
|
9744
|
+
metadata.kind = opra_schema_ns_exports.Collection.Kind;
|
|
9745
|
+
metadata.name = name;
|
|
9746
|
+
metadata.type = type;
|
|
9747
|
+
const m = Reflect.getMetadata(METADATA_KEY, target);
|
|
9748
|
+
if (m && metadata !== m)
|
|
9749
|
+
Object.assign(metadata, omit4(m), Object.keys(metadata));
|
|
9750
|
+
if (options)
|
|
9751
|
+
Object.assign(metadata, omit4(options, ["kind", "name", "type", "controller"]));
|
|
9752
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
9753
|
+
Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK, true, target);
|
|
9754
|
+
};
|
|
9755
|
+
}
|
|
9756
|
+
const [document, init] = args;
|
|
9757
|
+
merge5(this, new CollectionClass(document, init), { descriptor: true });
|
|
9758
|
+
}, "Collection");
|
|
9759
|
+
Collection2.prototype = CollectionClass.prototype;
|
|
9566
9760
|
function createOperationDecorator(operation) {
|
|
9567
9761
|
return (options) => (target, propertyKey) => {
|
|
9568
9762
|
const metadata = {
|
|
@@ -9586,39 +9780,21 @@ Collection2.UpdateMany = createOperationDecorator("updateMany");
|
|
|
9586
9780
|
|
|
9587
9781
|
// ../../build/common/esm/document/resource/singleton.js
|
|
9588
9782
|
import omit5 from "lodash.omit";
|
|
9783
|
+
import merge6 from "putil-merge";
|
|
9589
9784
|
var NESTJS_INJECTABLE_WATERMARK2 = "__injectable__";
|
|
9590
9785
|
var NAME_PATTERN2 = /^(.*)(Resource|Singleton)$/;
|
|
9591
|
-
var
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
if (options)
|
|
9604
|
-
Object.assign(metadata, omit5(options, ["kind", "name", "type", "controller"]));
|
|
9605
|
-
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
9606
|
-
Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK2, true, target);
|
|
9607
|
-
};
|
|
9608
|
-
}
|
|
9609
|
-
const [document, init] = args;
|
|
9610
|
-
Resource.apply(this, [document, init]);
|
|
9611
|
-
}, "Singleton");
|
|
9612
|
-
var proto8 = {
|
|
9613
|
-
_construct(init) {
|
|
9614
|
-
Resource.prototype._construct.call(this, init);
|
|
9615
|
-
const _this = this;
|
|
9616
|
-
_this.kind = OpraSchema.Singleton.Kind;
|
|
9617
|
-
_this.controller = init.controller;
|
|
9618
|
-
const operations = _this.operations = init.operations || {};
|
|
9619
|
-
_this.type = init.type;
|
|
9620
|
-
if (_this.controller) {
|
|
9621
|
-
const instance = typeof _this.controller == "function" ? new _this.controller() : _this.controller;
|
|
9786
|
+
var SingletonClass = class extends Resource {
|
|
9787
|
+
static {
|
|
9788
|
+
__name(this, "SingletonClass");
|
|
9789
|
+
}
|
|
9790
|
+
constructor(document, init) {
|
|
9791
|
+
super(document, init);
|
|
9792
|
+
this.kind = opra_schema_ns_exports.Singleton.Kind;
|
|
9793
|
+
this.controller = init.controller;
|
|
9794
|
+
const operations = this.operations = init.operations || {};
|
|
9795
|
+
this.type = init.type;
|
|
9796
|
+
if (this.controller) {
|
|
9797
|
+
const instance = typeof this.controller == "function" ? new this.controller() : this.controller;
|
|
9622
9798
|
for (const operation of Object.values(operations)) {
|
|
9623
9799
|
if (!operation.handler && operation.handlerName) {
|
|
9624
9800
|
const fn = instance[operation.handlerName];
|
|
@@ -9628,7 +9804,7 @@ var proto8 = {
|
|
|
9628
9804
|
}
|
|
9629
9805
|
}
|
|
9630
9806
|
}
|
|
9631
|
-
}
|
|
9807
|
+
}
|
|
9632
9808
|
exportSchema() {
|
|
9633
9809
|
const out = Resource.prototype.exportSchema.call(this);
|
|
9634
9810
|
Object.assign(out, omitUndefined({
|
|
@@ -9636,13 +9812,33 @@ var proto8 = {
|
|
|
9636
9812
|
operations: this.operations
|
|
9637
9813
|
}));
|
|
9638
9814
|
return out;
|
|
9639
|
-
}
|
|
9815
|
+
}
|
|
9640
9816
|
normalizeFieldPath(path3) {
|
|
9641
9817
|
return this.type.normalizeFieldPath(path3);
|
|
9642
9818
|
}
|
|
9643
9819
|
};
|
|
9644
|
-
|
|
9645
|
-
|
|
9820
|
+
var Singleton2 = /* @__PURE__ */ __name(function(...args) {
|
|
9821
|
+
if (!this) {
|
|
9822
|
+
const [type, options] = args;
|
|
9823
|
+
return function(target) {
|
|
9824
|
+
const name = options?.name || target.name.match(NAME_PATTERN2)?.[1] || target.name;
|
|
9825
|
+
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target) || {};
|
|
9826
|
+
metadata.kind = opra_schema_ns_exports.Singleton.Kind;
|
|
9827
|
+
metadata.name = name;
|
|
9828
|
+
metadata.type = type;
|
|
9829
|
+
const m = Reflect.getMetadata(METADATA_KEY, target);
|
|
9830
|
+
if (m && metadata !== m)
|
|
9831
|
+
Object.assign(metadata, omit5(m), Object.keys(metadata));
|
|
9832
|
+
if (options)
|
|
9833
|
+
Object.assign(metadata, omit5(options, ["kind", "name", "type", "controller"]));
|
|
9834
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
9835
|
+
Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK2, true, target);
|
|
9836
|
+
};
|
|
9837
|
+
}
|
|
9838
|
+
const [document, init] = args;
|
|
9839
|
+
merge6(this, new SingletonClass(document, init), { descriptor: true });
|
|
9840
|
+
}, "Singleton");
|
|
9841
|
+
Singleton2.prototype = SingletonClass.prototype;
|
|
9646
9842
|
function createOperationDecorator2(operation) {
|
|
9647
9843
|
return (options) => (target, propertyKey) => {
|
|
9648
9844
|
const metadata = {
|
|
@@ -9670,12 +9866,12 @@ async function processResourceQueue() {
|
|
|
9670
9866
|
if (!schema)
|
|
9671
9867
|
continue;
|
|
9672
9868
|
try {
|
|
9673
|
-
if (
|
|
9869
|
+
if (opra_schema_ns_exports.isCollection(schema)) {
|
|
9674
9870
|
const resource = await this.createCollection(name, schema);
|
|
9675
9871
|
document.resources.set(name, resource);
|
|
9676
9872
|
continue;
|
|
9677
9873
|
}
|
|
9678
|
-
if (
|
|
9874
|
+
if (opra_schema_ns_exports.isSingleton(schema)) {
|
|
9679
9875
|
const resource = await this.createSingleton(name, schema);
|
|
9680
9876
|
document.resources.set(name, resource);
|
|
9681
9877
|
continue;
|
|
@@ -9712,81 +9908,126 @@ async function createSingleton(name, schema) {
|
|
|
9712
9908
|
__name(createSingleton, "createSingleton");
|
|
9713
9909
|
|
|
9714
9910
|
// ../../build/common/esm/document/data-type/mapped-type.js
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9911
|
+
import merge7 from "putil-merge";
|
|
9912
|
+
import * as vg4 from "valgen";
|
|
9913
|
+
var MappedTypeClass = class extends DataType {
|
|
9914
|
+
static {
|
|
9915
|
+
__name(this, "MappedTypeClass");
|
|
9916
|
+
}
|
|
9917
|
+
constructor(document, init) {
|
|
9918
|
+
super(document, init);
|
|
9919
|
+
this.kind = opra_schema_ns_exports.MappedType.Kind;
|
|
9920
|
+
const own = this.own;
|
|
9921
|
+
own.pick = init.pick;
|
|
9922
|
+
own.omit = init.omit;
|
|
9923
|
+
this.kind = opra_schema_ns_exports.MappedType.Kind;
|
|
9924
|
+
this.type = init.type;
|
|
9925
|
+
this.pick = own.pick;
|
|
9926
|
+
this.omit = own.omit;
|
|
9927
|
+
this.fields = new ResponsiveMap();
|
|
9928
|
+
this.additionalFields = this.type.additionalFields;
|
|
9929
|
+
const isInheritedPredicate = getIsInheritedPredicateFn(init.pick, init.omit);
|
|
9930
|
+
for (const [elemName, elem] of this.type.fields.entries()) {
|
|
9931
|
+
if (isInheritedPredicate(elemName))
|
|
9932
|
+
this.fields.set(elemName, elem);
|
|
9733
9933
|
}
|
|
9734
|
-
__name(MappedClass, "MappedClass");
|
|
9735
|
-
applyMixins(MappedClass, source);
|
|
9736
|
-
const m = Reflect.getOwnMetadata(METADATA_KEY, source);
|
|
9737
|
-
if (!m)
|
|
9738
|
-
throw new TypeError(`Class "${source}" doesn't have datatype metadata information`);
|
|
9739
|
-
if (!(m.kind === OpraSchema.ComplexType.Kind))
|
|
9740
|
-
throw new TypeError(`Class "${source}" is not a ${OpraSchema.ComplexType.Kind}`);
|
|
9741
|
-
const metadata = {
|
|
9742
|
-
kind: "MappedType",
|
|
9743
|
-
type: source
|
|
9744
|
-
};
|
|
9745
|
-
if (options.pick)
|
|
9746
|
-
metadata.pick = options.pick;
|
|
9747
|
-
if (options.omit)
|
|
9748
|
-
metadata.omit = options.omit;
|
|
9749
|
-
Reflect.defineMetadata(METADATA_KEY, metadata, MappedClass);
|
|
9750
|
-
MappedType2._applyMixin(MappedClass, source, {
|
|
9751
|
-
...options,
|
|
9752
|
-
isInheritedPredicate
|
|
9753
|
-
});
|
|
9754
|
-
return MappedClass;
|
|
9755
|
-
}
|
|
9756
|
-
DataType.apply(this, args);
|
|
9757
|
-
const [, init] = args;
|
|
9758
|
-
pickKeys = init.pick && init.pick.map((x) => String(x).toLowerCase());
|
|
9759
|
-
omitKeys = init.omit && init.omit.map((x) => String(x).toLowerCase());
|
|
9760
|
-
const _this = this;
|
|
9761
|
-
const own = _this.own;
|
|
9762
|
-
own.type = init.type;
|
|
9763
|
-
own.pick = init.pick;
|
|
9764
|
-
own.omit = init.omit;
|
|
9765
|
-
_this.kind = OpraSchema.MappedType.Kind;
|
|
9766
|
-
_this.type = own.type;
|
|
9767
|
-
_this.pick = own.pick;
|
|
9768
|
-
_this.omit = own.omit;
|
|
9769
|
-
_this.fields = new ResponsiveMap();
|
|
9770
|
-
_this.additionalFields = _this.type.additionalFields;
|
|
9771
|
-
for (const [elemName, elem] of own.type.fields.entries()) {
|
|
9772
|
-
if (isInheritedPredicate(elemName))
|
|
9773
|
-
_this.fields.set(elemName, elem);
|
|
9774
9934
|
}
|
|
9775
|
-
}, "MappedType");
|
|
9776
|
-
MappedType2._applyMixin = () => void 0;
|
|
9777
|
-
var proto9 = {
|
|
9778
9935
|
exportSchema() {
|
|
9779
9936
|
const out = DataType.prototype.exportSchema.call(this);
|
|
9780
9937
|
Object.assign(out, omitUndefined({
|
|
9781
|
-
type: this.
|
|
9938
|
+
type: this.type.name ? this.type.name : this.type.exportSchema(),
|
|
9782
9939
|
pick: this.own.pick,
|
|
9783
9940
|
omit: this.own.omit
|
|
9784
9941
|
}));
|
|
9785
9942
|
return out;
|
|
9786
9943
|
}
|
|
9944
|
+
_getDecoder() {
|
|
9945
|
+
if (this._decoder)
|
|
9946
|
+
return this._decoder;
|
|
9947
|
+
const schema = {};
|
|
9948
|
+
for (const f of this.fields.values()) {
|
|
9949
|
+
let t = f.type.getDecoder();
|
|
9950
|
+
if (f.isArray)
|
|
9951
|
+
t = vg4.isArray(t);
|
|
9952
|
+
schema[f.name] = t;
|
|
9953
|
+
}
|
|
9954
|
+
this._decoder = vg4.isObject(schema, {
|
|
9955
|
+
additionalFields: this.additionalFields,
|
|
9956
|
+
name: this.name,
|
|
9957
|
+
caseInSensitive: true
|
|
9958
|
+
});
|
|
9959
|
+
return this._decoder;
|
|
9960
|
+
}
|
|
9961
|
+
_getEncoder() {
|
|
9962
|
+
if (this._encoder)
|
|
9963
|
+
return this._encoder;
|
|
9964
|
+
const schema = {};
|
|
9965
|
+
for (const f of this.fields.values()) {
|
|
9966
|
+
let t = f.type.getEncoder();
|
|
9967
|
+
if (f.isArray)
|
|
9968
|
+
t = vg4.isArray(t);
|
|
9969
|
+
schema[f.name] = t;
|
|
9970
|
+
}
|
|
9971
|
+
this._encoder = vg4.isObject(schema, {
|
|
9972
|
+
additionalFields: this.additionalFields,
|
|
9973
|
+
name: this.name,
|
|
9974
|
+
caseInSensitive: true,
|
|
9975
|
+
detectCircular: true
|
|
9976
|
+
});
|
|
9977
|
+
return this._encoder;
|
|
9978
|
+
}
|
|
9787
9979
|
};
|
|
9788
|
-
|
|
9789
|
-
|
|
9980
|
+
var MappedType2 = /* @__PURE__ */ __name(function(...args) {
|
|
9981
|
+
if (this) {
|
|
9982
|
+
const [document, init] = args;
|
|
9983
|
+
merge7(this, new MappedTypeClass(document, init), { descriptor: true });
|
|
9984
|
+
return;
|
|
9985
|
+
}
|
|
9986
|
+
const [source, options] = args;
|
|
9987
|
+
const isInheritedPredicate = getIsInheritedPredicateFn(options.pick, options.omit);
|
|
9988
|
+
class MappedClass {
|
|
9989
|
+
static {
|
|
9990
|
+
__name(this, "MappedClass");
|
|
9991
|
+
}
|
|
9992
|
+
constructor() {
|
|
9993
|
+
inheritPropertyInitializers(this, source, isInheritedPredicate);
|
|
9994
|
+
}
|
|
9995
|
+
}
|
|
9996
|
+
applyMixins(MappedClass, source);
|
|
9997
|
+
const m = Reflect.getOwnMetadata(METADATA_KEY, source);
|
|
9998
|
+
if (!m)
|
|
9999
|
+
throw new TypeError(`Class "${source}" doesn't have datatype metadata information`);
|
|
10000
|
+
if (!(m.kind === opra_schema_ns_exports.ComplexType.Kind))
|
|
10001
|
+
throw new TypeError(`Class "${source}" is not a ${opra_schema_ns_exports.ComplexType.Kind}`);
|
|
10002
|
+
const metadata = {
|
|
10003
|
+
kind: "MappedType",
|
|
10004
|
+
type: source
|
|
10005
|
+
};
|
|
10006
|
+
if (options.pick)
|
|
10007
|
+
metadata.pick = options.pick;
|
|
10008
|
+
if (options.omit)
|
|
10009
|
+
metadata.omit = options.omit;
|
|
10010
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, MappedClass);
|
|
10011
|
+
MappedType2._applyMixin(MappedClass, source, {
|
|
10012
|
+
...options,
|
|
10013
|
+
isInheritedPredicate
|
|
10014
|
+
});
|
|
10015
|
+
return MappedClass;
|
|
10016
|
+
}, "MappedType");
|
|
10017
|
+
MappedType2.prototype = MappedTypeClass.prototype;
|
|
10018
|
+
MappedType2._applyMixin = () => void 0;
|
|
10019
|
+
function getIsInheritedPredicateFn(pick, omit6) {
|
|
10020
|
+
const pickKeys = pick?.map((x) => String(x).toLowerCase());
|
|
10021
|
+
const omitKeys = omit6?.map((x) => String(x).toLowerCase());
|
|
10022
|
+
return (propertyName) => {
|
|
10023
|
+
if (omitKeys && omitKeys.includes(propertyName.toLowerCase()))
|
|
10024
|
+
return false;
|
|
10025
|
+
if (pickKeys)
|
|
10026
|
+
return pickKeys.includes(propertyName.toLowerCase());
|
|
10027
|
+
return true;
|
|
10028
|
+
};
|
|
10029
|
+
}
|
|
10030
|
+
__name(getIsInheritedPredicateFn, "getIsInheritedPredicateFn");
|
|
9790
10031
|
function PickType(classRef, keys) {
|
|
9791
10032
|
return MappedType2(classRef, { pick: keys });
|
|
9792
10033
|
}
|
|
@@ -9797,68 +10038,108 @@ function OmitType(classRef, keys) {
|
|
|
9797
10038
|
__name(OmitType, "OmitType");
|
|
9798
10039
|
|
|
9799
10040
|
// ../../build/common/esm/document/data-type/union-type.js
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
10041
|
+
import merge8 from "putil-merge";
|
|
10042
|
+
import * as vg5 from "valgen";
|
|
10043
|
+
var UnionTypeClass = class extends DataType {
|
|
10044
|
+
static {
|
|
10045
|
+
__name(this, "UnionTypeClass");
|
|
10046
|
+
}
|
|
10047
|
+
constructor(document, init) {
|
|
10048
|
+
super(document, init);
|
|
10049
|
+
this.kind = opra_schema_ns_exports.UnionType.Kind;
|
|
10050
|
+
this.fields = new ResponsiveMap();
|
|
10051
|
+
const own = this.own;
|
|
10052
|
+
own.types = [];
|
|
10053
|
+
for (const base of init.types) {
|
|
10054
|
+
if (!(base instanceof ComplexType2 || base instanceof UnionType2 || base instanceof MappedType2))
|
|
10055
|
+
throw new TypeError(`${opra_schema_ns_exports.UnionType.Kind} shall contain ${opra_schema_ns_exports.ComplexType.Kind}, ${opra_schema_ns_exports.UnionType.Kind} of ${opra_schema_ns_exports.MappedType.Kind} types.`);
|
|
10056
|
+
own.types.push(base);
|
|
10057
|
+
if (base.additionalFields)
|
|
10058
|
+
this.additionalFields = true;
|
|
10059
|
+
this.fields.setAll(base.fields);
|
|
10060
|
+
}
|
|
10061
|
+
this.types = [...own.types];
|
|
9803
10062
|
}
|
|
9804
|
-
DataType.apply(this, args);
|
|
9805
|
-
const [, init] = args;
|
|
9806
|
-
const _this = this;
|
|
9807
|
-
_this.fields = new ResponsiveMap();
|
|
9808
|
-
const own = _this.own;
|
|
9809
|
-
own.types = [];
|
|
9810
|
-
for (const base of init.types) {
|
|
9811
|
-
if (!(base instanceof ComplexType2 || base instanceof UnionType2 || base instanceof MappedType2))
|
|
9812
|
-
throw new TypeError(`${OpraSchema.UnionType.Kind} shall contain ${OpraSchema.ComplexType.Kind}, ${OpraSchema.UnionType.Kind} of ${OpraSchema.MappedType.Kind} types.`);
|
|
9813
|
-
own.types.push(base);
|
|
9814
|
-
if (base.additionalFields)
|
|
9815
|
-
_this.additionalFields = true;
|
|
9816
|
-
_this.fields.setAll(base.fields);
|
|
9817
|
-
}
|
|
9818
|
-
_this.kind = "UnionType";
|
|
9819
|
-
_this.types = [...own.types];
|
|
9820
|
-
}, "UnionType");
|
|
9821
|
-
UnionType2._applyMixin = () => void 0;
|
|
9822
|
-
var proto10 = {
|
|
9823
10063
|
exportSchema() {
|
|
9824
|
-
const out =
|
|
10064
|
+
const out = super.exportSchema();
|
|
9825
10065
|
Object.assign(out, omitUndefined({
|
|
9826
10066
|
types: this.own.types.map((t) => t.name ? t.name : t.exportSchema())
|
|
9827
10067
|
}));
|
|
9828
10068
|
return out;
|
|
9829
10069
|
}
|
|
10070
|
+
_getDecoder() {
|
|
10071
|
+
if (this._decoder)
|
|
10072
|
+
return this._decoder;
|
|
10073
|
+
const schema = {};
|
|
10074
|
+
for (const f of this.fields.values()) {
|
|
10075
|
+
let t = f.type.getDecoder();
|
|
10076
|
+
if (f.isArray)
|
|
10077
|
+
t = vg5.isArray(t);
|
|
10078
|
+
schema[f.name] = t;
|
|
10079
|
+
}
|
|
10080
|
+
this._decoder = vg5.isObject(schema, {
|
|
10081
|
+
additionalFields: this.additionalFields,
|
|
10082
|
+
name: this.name,
|
|
10083
|
+
caseInSensitive: true
|
|
10084
|
+
});
|
|
10085
|
+
return this._decoder;
|
|
10086
|
+
}
|
|
10087
|
+
_getEncoder() {
|
|
10088
|
+
if (this._encoder)
|
|
10089
|
+
return this._encoder;
|
|
10090
|
+
const schema = {};
|
|
10091
|
+
for (const f of this.fields.values()) {
|
|
10092
|
+
let t = f.type.getEncoder();
|
|
10093
|
+
if (f.isArray)
|
|
10094
|
+
t = vg5.isArray(t);
|
|
10095
|
+
schema[f.name] = t;
|
|
10096
|
+
}
|
|
10097
|
+
this._encoder = vg5.isObject(schema, {
|
|
10098
|
+
additionalFields: this.additionalFields,
|
|
10099
|
+
name: this.name,
|
|
10100
|
+
caseInSensitive: true,
|
|
10101
|
+
detectCircular: true
|
|
10102
|
+
});
|
|
10103
|
+
return this._encoder;
|
|
10104
|
+
}
|
|
9830
10105
|
};
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
10106
|
+
var UnionType2 = /* @__PURE__ */ __name(function(...args) {
|
|
10107
|
+
if (this) {
|
|
10108
|
+
const [document, init] = args;
|
|
10109
|
+
merge8(this, new UnionTypeClass(document, init), { descriptor: true });
|
|
10110
|
+
return;
|
|
10111
|
+
}
|
|
9834
10112
|
const clasRefs = [...args].filter((x) => !!x);
|
|
9835
10113
|
if (!clasRefs.length)
|
|
9836
10114
|
throw new TypeError("No Class has been provided");
|
|
9837
10115
|
if (clasRefs.length === 1)
|
|
9838
10116
|
return clasRefs[0];
|
|
9839
10117
|
class UnionClass {
|
|
10118
|
+
static {
|
|
10119
|
+
__name(this, "UnionClass");
|
|
10120
|
+
}
|
|
9840
10121
|
constructor() {
|
|
9841
10122
|
for (const c of clasRefs)
|
|
9842
10123
|
inheritPropertyInitializers(this, c);
|
|
9843
10124
|
}
|
|
9844
10125
|
}
|
|
9845
|
-
__name(UnionClass, "UnionClass");
|
|
9846
10126
|
const metadata = {
|
|
9847
|
-
kind:
|
|
10127
|
+
kind: opra_schema_ns_exports.UnionType.Kind,
|
|
9848
10128
|
types: []
|
|
9849
10129
|
};
|
|
9850
10130
|
Reflect.defineMetadata(METADATA_KEY, metadata, UnionClass);
|
|
9851
10131
|
for (const c of clasRefs) {
|
|
9852
10132
|
const itemMeta = Reflect.getMetadata(METADATA_KEY, c);
|
|
9853
|
-
if (!(itemMeta && (itemMeta.kind ===
|
|
9854
|
-
throw new TypeError(`Class "${c.name}" is not a ${
|
|
10133
|
+
if (!(itemMeta && (itemMeta.kind === opra_schema_ns_exports.ComplexType.Kind || itemMeta.kind === opra_schema_ns_exports.UnionType.Kind || itemMeta.kind === opra_schema_ns_exports.MappedType.Kind)))
|
|
10134
|
+
throw new TypeError(`Class "${c.name}" is not a ${opra_schema_ns_exports.ComplexType.Kind}, ${opra_schema_ns_exports.UnionType.Kind} or ${opra_schema_ns_exports.MappedType.Kind}`);
|
|
9855
10135
|
metadata.types.push(c);
|
|
9856
10136
|
applyMixins(UnionClass, c);
|
|
9857
10137
|
}
|
|
9858
10138
|
UnionType2._applyMixin(UnionClass, ...clasRefs);
|
|
9859
10139
|
return UnionClass;
|
|
9860
|
-
}
|
|
9861
|
-
|
|
10140
|
+
}, "UnionType");
|
|
10141
|
+
UnionType2.prototype = UnionTypeClass.prototype;
|
|
10142
|
+
UnionType2._applyMixin = () => void 0;
|
|
9862
10143
|
|
|
9863
10144
|
// ../../build/common/esm/document/factory/process-types.js
|
|
9864
10145
|
async function processTypes() {
|
|
@@ -9883,19 +10164,19 @@ function createDataTypeInstance(kind, name) {
|
|
|
9883
10164
|
name
|
|
9884
10165
|
};
|
|
9885
10166
|
switch (kind) {
|
|
9886
|
-
case
|
|
10167
|
+
case opra_schema_ns_exports.ComplexType.Kind:
|
|
9887
10168
|
Object.setPrototypeOf(dataType, ComplexType2.prototype);
|
|
9888
10169
|
break;
|
|
9889
|
-
case
|
|
10170
|
+
case opra_schema_ns_exports.EnumType.Kind:
|
|
9890
10171
|
Object.setPrototypeOf(dataType, EnumType2.prototype);
|
|
9891
10172
|
break;
|
|
9892
|
-
case
|
|
10173
|
+
case opra_schema_ns_exports.MappedType.Kind:
|
|
9893
10174
|
Object.setPrototypeOf(dataType, MappedType2.prototype);
|
|
9894
10175
|
break;
|
|
9895
|
-
case
|
|
10176
|
+
case opra_schema_ns_exports.SimpleType.Kind:
|
|
9896
10177
|
Object.setPrototypeOf(dataType, SimpleType2.prototype);
|
|
9897
10178
|
break;
|
|
9898
|
-
case
|
|
10179
|
+
case opra_schema_ns_exports.UnionType.Kind:
|
|
9899
10180
|
Object.setPrototypeOf(dataType, UnionType2.prototype);
|
|
9900
10181
|
break;
|
|
9901
10182
|
default:
|
|
@@ -9921,12 +10202,12 @@ function addDataType(schemaOrName) {
|
|
|
9921
10202
|
schema = schemaOrName;
|
|
9922
10203
|
try {
|
|
9923
10204
|
let base;
|
|
9924
|
-
if ((
|
|
10205
|
+
if ((opra_schema_ns_exports.isSimpleType(schema) || opra_schema_ns_exports.isComplexType(schema) || opra_schema_ns_exports.isEnumType(schema)) && schema.base) {
|
|
9925
10206
|
curPath.push(typeof schema.base === "string" ? schema.base : "[base]");
|
|
9926
10207
|
base = this.addDataType(schema.base);
|
|
9927
10208
|
curPath.pop();
|
|
9928
10209
|
}
|
|
9929
|
-
if (
|
|
10210
|
+
if (opra_schema_ns_exports.isSimpleType(schema)) {
|
|
9930
10211
|
const initArgs = {
|
|
9931
10212
|
...schema,
|
|
9932
10213
|
name,
|
|
@@ -9940,7 +10221,7 @@ function addDataType(schemaOrName) {
|
|
|
9940
10221
|
curPath.pop();
|
|
9941
10222
|
return dataType;
|
|
9942
10223
|
}
|
|
9943
|
-
if (
|
|
10224
|
+
if (opra_schema_ns_exports.isComplexType(schema)) {
|
|
9944
10225
|
const initArgs = {
|
|
9945
10226
|
...schema,
|
|
9946
10227
|
name,
|
|
@@ -9969,7 +10250,7 @@ function addDataType(schemaOrName) {
|
|
|
9969
10250
|
curPath.pop();
|
|
9970
10251
|
return dataType;
|
|
9971
10252
|
}
|
|
9972
|
-
if (
|
|
10253
|
+
if (opra_schema_ns_exports.isEnumType(schema)) {
|
|
9973
10254
|
const initArgs = {
|
|
9974
10255
|
...schema,
|
|
9975
10256
|
name,
|
|
@@ -9983,7 +10264,7 @@ function addDataType(schemaOrName) {
|
|
|
9983
10264
|
curPath.pop();
|
|
9984
10265
|
return dataType;
|
|
9985
10266
|
}
|
|
9986
|
-
if (
|
|
10267
|
+
if (opra_schema_ns_exports.isUnionType(schema)) {
|
|
9987
10268
|
const unionTypes = schema.types.map((t) => this.addDataType(t));
|
|
9988
10269
|
const initArgs = {
|
|
9989
10270
|
...schema,
|
|
@@ -9998,7 +10279,7 @@ function addDataType(schemaOrName) {
|
|
|
9998
10279
|
curPath.pop();
|
|
9999
10280
|
return dataType;
|
|
10000
10281
|
}
|
|
10001
|
-
if (
|
|
10282
|
+
if (opra_schema_ns_exports.isMappedType(schema)) {
|
|
10002
10283
|
const dt = this.addDataType(schema.type);
|
|
10003
10284
|
if (!(dt instanceof ComplexType2))
|
|
10004
10285
|
throw new TypeError(`MappedType requires a ComplexType`);
|
|
@@ -10030,7 +10311,11 @@ function addDataType(schemaOrName) {
|
|
|
10030
10311
|
__name(addDataType, "addDataType");
|
|
10031
10312
|
|
|
10032
10313
|
// ../../build/common/esm/document/factory/factory.js
|
|
10033
|
-
var
|
|
10314
|
+
var _a2;
|
|
10315
|
+
var DocumentFactory = class _DocumentFactory {
|
|
10316
|
+
static {
|
|
10317
|
+
__name(this, "DocumentFactory");
|
|
10318
|
+
}
|
|
10034
10319
|
constructor() {
|
|
10035
10320
|
this.document = new ApiDocument();
|
|
10036
10321
|
this.typeQueue = new ResponsiveMap();
|
|
@@ -10044,39 +10329,40 @@ var DocumentFactory = class {
|
|
|
10044
10329
|
* @param init
|
|
10045
10330
|
*/
|
|
10046
10331
|
static async createDocument(init) {
|
|
10047
|
-
const factory = new
|
|
10332
|
+
const factory = new _DocumentFactory();
|
|
10048
10333
|
return factory.createDocument(init);
|
|
10049
10334
|
}
|
|
10050
10335
|
/**
|
|
10051
10336
|
* Downloads schema from the given URL and creates the document instance * @param url
|
|
10052
10337
|
*/
|
|
10053
10338
|
static async createDocumentFromUrl(url) {
|
|
10054
|
-
const factory = new
|
|
10339
|
+
const factory = new _DocumentFactory();
|
|
10055
10340
|
return factory.createDocumentFromUrl(url);
|
|
10056
10341
|
}
|
|
10057
10342
|
};
|
|
10058
|
-
|
|
10343
|
+
_a2 = DocumentFactory;
|
|
10344
|
+
DocumentFactory.designTypeMap = /* @__PURE__ */ new Map();
|
|
10059
10345
|
(() => {
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10346
|
+
_a2.prototype.createDocument = createDocument;
|
|
10347
|
+
_a2.prototype.createDocumentFromUrl = createDocumentFromUrl;
|
|
10348
|
+
_a2.prototype.createBuiltinTypeDocument = createBuiltinTypeDocument;
|
|
10349
|
+
_a2.prototype.addReferences = addReferences;
|
|
10350
|
+
_a2.prototype.importTypeClass = importTypeClass;
|
|
10351
|
+
_a2.prototype.extractSimpleTypeSchema = extractSimpleTypeSchema;
|
|
10352
|
+
_a2.prototype.extractComplexTypeSchema = extractComplexTypeSchema;
|
|
10353
|
+
_a2.prototype.extractMappedTypeSchema = extractMappedTypeSchema;
|
|
10354
|
+
_a2.prototype.extractUnionTypeSchema = extractUnionTypeSchema;
|
|
10355
|
+
_a2.prototype.extractEnumTypeSchema = extractEnumTypeSchema;
|
|
10356
|
+
_a2.prototype.extractFieldSchema = extractFieldSchema;
|
|
10357
|
+
_a2.prototype.processTypes = processTypes;
|
|
10358
|
+
_a2.prototype.createDataTypeInstance = createDataTypeInstance;
|
|
10359
|
+
_a2.prototype.addDataType = addDataType;
|
|
10360
|
+
_a2.prototype.importResourceClass = importResourceClass;
|
|
10361
|
+
_a2.prototype.extractSingletonSchema = extractSingletonSchema;
|
|
10362
|
+
_a2.prototype.extractCollectionSchema = extractCollectionSchema;
|
|
10363
|
+
_a2.prototype.processResourceQueue = processResourceQueue;
|
|
10364
|
+
_a2.prototype.createCollection = createCollection;
|
|
10365
|
+
_a2.prototype.createSingleton = createSingleton;
|
|
10080
10366
|
})();
|
|
10081
10367
|
|
|
10082
10368
|
// ../../build/common/esm/http/enums/http-headers-codes.enum.js
|
|
@@ -10177,15 +10463,18 @@ var HttpHeaderCodes;
|
|
|
10177
10463
|
})(HttpHeaderCodes || (HttpHeaderCodes = {}));
|
|
10178
10464
|
|
|
10179
10465
|
// ../../build/common/esm/http/http-headers.js
|
|
10180
|
-
var
|
|
10466
|
+
var _a3;
|
|
10181
10467
|
var knownKeys = Object.values(HttpHeaderCodes);
|
|
10182
10468
|
var knownKeysLower = knownKeys.map((x) => x.toLowerCase());
|
|
10183
10469
|
var nodeInspectCustom2 = Symbol.for("nodejs.util.inspect.custom");
|
|
10184
10470
|
var kEntries = Symbol("kEntries");
|
|
10185
10471
|
var kOptions2 = Symbol("kOptions");
|
|
10186
|
-
var HttpHeaders = class {
|
|
10472
|
+
var HttpHeaders = class _HttpHeaders {
|
|
10473
|
+
static {
|
|
10474
|
+
__name(this, "HttpHeaders");
|
|
10475
|
+
}
|
|
10187
10476
|
constructor(init, options) {
|
|
10188
|
-
this[
|
|
10477
|
+
this[_a3] = new ResponsiveMap();
|
|
10189
10478
|
this[kOptions2] = { ...options, onChange: void 0 };
|
|
10190
10479
|
if (init) {
|
|
10191
10480
|
if (typeof init === "string")
|
|
@@ -10241,9 +10530,9 @@ var HttpHeaders = class {
|
|
|
10241
10530
|
if (index > 0) {
|
|
10242
10531
|
const name = line.slice(0, index);
|
|
10243
10532
|
const value = line.slice(index + 1).trim();
|
|
10244
|
-
if (
|
|
10533
|
+
if (_HttpHeaders.NON_DELIMITED_HEADERS[name])
|
|
10245
10534
|
this._append(name, value);
|
|
10246
|
-
else if (
|
|
10535
|
+
else if (_HttpHeaders.SEMICOLON_DELIMITED_HEADERS[name]) {
|
|
10247
10536
|
const a = value.split(";");
|
|
10248
10537
|
this._append(name, a.length > 1 ? a : value);
|
|
10249
10538
|
} else {
|
|
@@ -10326,7 +10615,7 @@ var HttpHeaders = class {
|
|
|
10326
10615
|
}
|
|
10327
10616
|
});
|
|
10328
10617
|
}
|
|
10329
|
-
[(
|
|
10618
|
+
[(_a3 = kEntries, nodeInspectCustom2)]() {
|
|
10330
10619
|
return this[kEntries];
|
|
10331
10620
|
}
|
|
10332
10621
|
[Symbol.iterator]() {
|
|
@@ -10340,12 +10629,12 @@ var HttpHeaders = class {
|
|
|
10340
10629
|
const normalizedName = knownKeys[i] || name;
|
|
10341
10630
|
name = name.toLowerCase();
|
|
10342
10631
|
let stored = this[kEntries].get(normalizedName);
|
|
10343
|
-
if (
|
|
10632
|
+
if (_HttpHeaders.NON_DELIMITED_HEADERS[name]) {
|
|
10344
10633
|
value = String(Array.isArray(value) ? value[0] : value);
|
|
10345
10634
|
this[kEntries].set(normalizedName, value);
|
|
10346
10635
|
return;
|
|
10347
10636
|
}
|
|
10348
|
-
if (
|
|
10637
|
+
if (_HttpHeaders.ARRAY_HEADERS[name]) {
|
|
10349
10638
|
stored = (stored ? [stored, value] : [value]).flat().map(String);
|
|
10350
10639
|
this[kEntries].set(normalizedName, stored);
|
|
10351
10640
|
return;
|
|
@@ -10355,7 +10644,7 @@ var HttpHeaders = class {
|
|
|
10355
10644
|
arr.push(...value);
|
|
10356
10645
|
else
|
|
10357
10646
|
arr.push(value);
|
|
10358
|
-
this[kEntries].set(normalizedName, arr.join(
|
|
10647
|
+
this[kEntries].set(normalizedName, arr.join(_HttpHeaders.SEMICOLON_DELIMITED_HEADERS[name] ? "; " : ", "));
|
|
10359
10648
|
}
|
|
10360
10649
|
_set(name, value) {
|
|
10361
10650
|
this[kEntries].delete(name);
|
|
@@ -10368,7 +10657,6 @@ var HttpHeaders = class {
|
|
|
10368
10657
|
this[kOptions2].onChange();
|
|
10369
10658
|
}
|
|
10370
10659
|
};
|
|
10371
|
-
__name(HttpHeaders, "HttpHeaders");
|
|
10372
10660
|
HttpHeaders.kEntries = kEntries;
|
|
10373
10661
|
HttpHeaders.kOptions = kOptions2;
|
|
10374
10662
|
HttpHeaders.NON_DELIMITED_HEADERS = {
|
|
@@ -10400,6 +10688,9 @@ import { splitString as splitString2, tokenize as tokenize2 } from "fast-tokeniz
|
|
|
10400
10688
|
var trueValues = ["true", "t", "yes", "y", "1"];
|
|
10401
10689
|
var falseValues = ["false", "f", "no", "n", "0"];
|
|
10402
10690
|
var BooleanCodec = class {
|
|
10691
|
+
static {
|
|
10692
|
+
__name(this, "BooleanCodec");
|
|
10693
|
+
}
|
|
10403
10694
|
decode(value) {
|
|
10404
10695
|
if (value === "")
|
|
10405
10696
|
return true;
|
|
@@ -10415,11 +10706,13 @@ var BooleanCodec = class {
|
|
|
10415
10706
|
return typeof value === "boolean" ? value ? "true" : "false" : "";
|
|
10416
10707
|
}
|
|
10417
10708
|
};
|
|
10418
|
-
__name(BooleanCodec, "BooleanCodec");
|
|
10419
10709
|
|
|
10420
10710
|
// ../../build/common/esm/http/codecs/date-codec.js
|
|
10421
10711
|
var DATE_FORMAT_PATTERN = /^(\d{4})(?:-?(0[1-9]|1[012])(?:-?([123]0|[012][1-9]|31))?)?(?:[T ]?([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?)?$/;
|
|
10422
10712
|
var DateCodec = class {
|
|
10713
|
+
static {
|
|
10714
|
+
__name(this, "DateCodec");
|
|
10715
|
+
}
|
|
10423
10716
|
constructor(options) {
|
|
10424
10717
|
this.max = options?.max ? coerceToDateString(options.max) : void 0;
|
|
10425
10718
|
this.min = options?.min ? coerceToDateString(options.min) : void 0;
|
|
@@ -10438,7 +10731,6 @@ var DateCodec = class {
|
|
|
10438
10731
|
return coerceToDateString(value, this.time, this.timeZone);
|
|
10439
10732
|
}
|
|
10440
10733
|
};
|
|
10441
|
-
__name(DateCodec, "DateCodec");
|
|
10442
10734
|
function coerceToDateString(value, time, timeZone) {
|
|
10443
10735
|
if (value === "" || value == null)
|
|
10444
10736
|
return "";
|
|
@@ -10457,6 +10749,9 @@ __name(coerceToDateString, "coerceToDateString");
|
|
|
10457
10749
|
|
|
10458
10750
|
// ../../build/common/esm/http/codecs/filter-codec.js
|
|
10459
10751
|
var FilterCodec = class {
|
|
10752
|
+
static {
|
|
10753
|
+
__name(this, "FilterCodec");
|
|
10754
|
+
}
|
|
10460
10755
|
decode(value) {
|
|
10461
10756
|
if (value instanceof Expression)
|
|
10462
10757
|
return value;
|
|
@@ -10466,10 +10761,12 @@ var FilterCodec = class {
|
|
|
10466
10761
|
return value ? "" + value : "";
|
|
10467
10762
|
}
|
|
10468
10763
|
};
|
|
10469
|
-
__name(FilterCodec, "FilterCodec");
|
|
10470
10764
|
|
|
10471
10765
|
// ../../build/common/esm/http/codecs/number-codec.js
|
|
10472
10766
|
var NumberCodec = class {
|
|
10767
|
+
static {
|
|
10768
|
+
__name(this, "NumberCodec");
|
|
10769
|
+
}
|
|
10473
10770
|
constructor(options) {
|
|
10474
10771
|
this.max = options?.max;
|
|
10475
10772
|
this.min = options?.min;
|
|
@@ -10488,10 +10785,12 @@ var NumberCodec = class {
|
|
|
10488
10785
|
return typeof value === "number" ? "" + value : "";
|
|
10489
10786
|
}
|
|
10490
10787
|
};
|
|
10491
|
-
__name(NumberCodec, "NumberCodec");
|
|
10492
10788
|
|
|
10493
10789
|
// ../../build/common/esm/http/codecs/integer-codec.js
|
|
10494
10790
|
var IntegerCodec = class extends NumberCodec {
|
|
10791
|
+
static {
|
|
10792
|
+
__name(this, "IntegerCodec");
|
|
10793
|
+
}
|
|
10495
10794
|
constructor(options) {
|
|
10496
10795
|
super(options);
|
|
10497
10796
|
this.enum = options?.enum;
|
|
@@ -10505,10 +10804,12 @@ var IntegerCodec = class extends NumberCodec {
|
|
|
10505
10804
|
return v;
|
|
10506
10805
|
}
|
|
10507
10806
|
};
|
|
10508
|
-
__name(IntegerCodec, "IntegerCodec");
|
|
10509
10807
|
|
|
10510
10808
|
// ../../build/common/esm/http/codecs/string-codec.js
|
|
10511
10809
|
var StringCodec = class {
|
|
10810
|
+
static {
|
|
10811
|
+
__name(this, "StringCodec");
|
|
10812
|
+
}
|
|
10512
10813
|
constructor(options) {
|
|
10513
10814
|
this.maxLength = options?.maxLength;
|
|
10514
10815
|
this.minLength = options?.minLength;
|
|
@@ -10527,19 +10828,21 @@ var StringCodec = class {
|
|
|
10527
10828
|
return value == null ? "" : "" + value;
|
|
10528
10829
|
}
|
|
10529
10830
|
};
|
|
10530
|
-
__name(StringCodec, "StringCodec");
|
|
10531
10831
|
|
|
10532
10832
|
// ../../build/common/esm/http/http-params.js
|
|
10533
|
-
var
|
|
10833
|
+
var _a4;
|
|
10534
10834
|
var _b2;
|
|
10535
10835
|
var _c2;
|
|
10536
10836
|
var kEntries2 = Symbol("kEntries");
|
|
10537
10837
|
var kSize = Symbol("kSize");
|
|
10538
10838
|
var kParamDefs = Symbol("kParamDefs");
|
|
10539
10839
|
var kOptions3 = Symbol("kOptions");
|
|
10540
|
-
var HttpParams = class {
|
|
10840
|
+
var HttpParams = class _HttpParams {
|
|
10841
|
+
static {
|
|
10842
|
+
__name(this, "HttpParams");
|
|
10843
|
+
}
|
|
10541
10844
|
constructor(init, options) {
|
|
10542
|
-
this[
|
|
10845
|
+
this[_a4] = new ResponsiveMap();
|
|
10543
10846
|
this[_b2] = 0;
|
|
10544
10847
|
this[_c2] = /* @__PURE__ */ new Map();
|
|
10545
10848
|
this[kOptions3] = { ...options, onChange: void 0 };
|
|
@@ -10735,9 +11038,9 @@ var HttpParams = class {
|
|
|
10735
11038
|
throw new Error('"name" argument required');
|
|
10736
11039
|
if (!options)
|
|
10737
11040
|
throw new Error('"options" argument required');
|
|
10738
|
-
if (typeof options.codec === "string" && !
|
|
11041
|
+
if (typeof options.codec === "string" && !_HttpParams.codecs[options.codec])
|
|
10739
11042
|
throw new Error(`Unknown url parameter format name "${options.codec}"`);
|
|
10740
|
-
const codec = (typeof options?.codec === "string" ?
|
|
11043
|
+
const codec = (typeof options?.codec === "string" ? _HttpParams.codecs[options.codec] : options?.codec) || _HttpParams.codecs.string;
|
|
10741
11044
|
const meta = {
|
|
10742
11045
|
...options,
|
|
10743
11046
|
codec
|
|
@@ -10783,7 +11086,7 @@ var HttpParams = class {
|
|
|
10783
11086
|
}
|
|
10784
11087
|
return decodeURIComponent(value);
|
|
10785
11088
|
}
|
|
10786
|
-
[(
|
|
11089
|
+
[(_a4 = kEntries2, _b2 = kSize, _c2 = kParamDefs, Symbol.iterator)]() {
|
|
10787
11090
|
return this.entries();
|
|
10788
11091
|
}
|
|
10789
11092
|
get [Symbol.toStringTag]() {
|
|
@@ -10834,7 +11137,6 @@ var HttpParams = class {
|
|
|
10834
11137
|
this[kSize] += -oldLen + values.length;
|
|
10835
11138
|
}
|
|
10836
11139
|
};
|
|
10837
|
-
__name(HttpParams, "HttpParams");
|
|
10838
11140
|
HttpParams.kEntries = kEntries2;
|
|
10839
11141
|
HttpParams.kSize = kSize;
|
|
10840
11142
|
HttpParams.kParamDefs = kParamDefs;
|
|
@@ -10953,6 +11255,9 @@ var kOnReadComplete = Symbol("kOnReadComplete");
|
|
|
10953
11255
|
var crlfBuffer = Buffer.from("\r\n");
|
|
10954
11256
|
var HTTP_VERSION_PATTERN = /^(\d)\.(\d)$/;
|
|
10955
11257
|
var HttpMessageHost = class {
|
|
11258
|
+
static {
|
|
11259
|
+
__name(this, "HttpMessageHost");
|
|
11260
|
+
}
|
|
10956
11261
|
constructor() {
|
|
10957
11262
|
this.complete = false;
|
|
10958
11263
|
stream.Duplex.apply(this);
|
|
@@ -11166,7 +11471,6 @@ var HttpMessageHost = class {
|
|
|
11166
11471
|
}
|
|
11167
11472
|
}
|
|
11168
11473
|
};
|
|
11169
|
-
__name(HttpMessageHost, "HttpMessageHost");
|
|
11170
11474
|
HttpMessageHost.kHeaders = kHeaders;
|
|
11171
11475
|
HttpMessageHost.kHeadersProxy = kHeadersProxy;
|
|
11172
11476
|
HttpMessageHost.kTrailers = kTrailers;
|
|
@@ -11179,7 +11483,7 @@ Object.assign(HttpMessageHost.prototype, stream.Duplex.prototype);
|
|
|
11179
11483
|
|
|
11180
11484
|
// ../../build/common/esm/http/http-response-message.js
|
|
11181
11485
|
var HttpResponseMessage;
|
|
11182
|
-
(function(HttpResponseMessage2) {
|
|
11486
|
+
/* @__PURE__ */ (function(HttpResponseMessage2) {
|
|
11183
11487
|
function create(init) {
|
|
11184
11488
|
return HttpResponseMessageHost.create(init);
|
|
11185
11489
|
}
|
|
@@ -11196,7 +11500,10 @@ var HttpResponseMessage;
|
|
|
11196
11500
|
__name(fromStream, "fromStream");
|
|
11197
11501
|
HttpResponseMessage2.fromStream = fromStream;
|
|
11198
11502
|
})(HttpResponseMessage || (HttpResponseMessage = {}));
|
|
11199
|
-
var HttpResponseMessageHost = class extends HttpMessageHost {
|
|
11503
|
+
var HttpResponseMessageHost = class _HttpResponseMessageHost extends HttpMessageHost {
|
|
11504
|
+
static {
|
|
11505
|
+
__name(this, "HttpResponseMessageHost");
|
|
11506
|
+
}
|
|
11200
11507
|
constructor() {
|
|
11201
11508
|
super();
|
|
11202
11509
|
}
|
|
@@ -11374,12 +11681,12 @@ var HttpResponseMessageHost = class extends HttpMessageHost {
|
|
|
11374
11681
|
this.statusMessage = info.statusMessage;
|
|
11375
11682
|
}
|
|
11376
11683
|
static create(init) {
|
|
11377
|
-
const msg = new
|
|
11684
|
+
const msg = new _HttpResponseMessageHost();
|
|
11378
11685
|
msg._init(init);
|
|
11379
11686
|
return msg;
|
|
11380
11687
|
}
|
|
11381
11688
|
static fromBuffer(buffer) {
|
|
11382
|
-
const msg = new
|
|
11689
|
+
const msg = new _HttpResponseMessageHost();
|
|
11383
11690
|
msg._parseBuffer(buffer, HTTPParser2.RESPONSE);
|
|
11384
11691
|
return msg;
|
|
11385
11692
|
}
|
|
@@ -11388,7 +11695,6 @@ var HttpResponseMessageHost = class extends HttpMessageHost {
|
|
|
11388
11695
|
throw new Error("fromStream is not implemented yet");
|
|
11389
11696
|
}
|
|
11390
11697
|
};
|
|
11391
|
-
__name(HttpResponseMessageHost, "HttpResponseMessageHost");
|
|
11392
11698
|
|
|
11393
11699
|
// ../../build/common/esm/http/http-request-message.js
|
|
11394
11700
|
import accepts from "accepts";
|
|
@@ -11396,7 +11702,7 @@ import typeIs from "type-is";
|
|
|
11396
11702
|
import { HTTPParser as HTTPParser3 } from "@browsery/http-parser";
|
|
11397
11703
|
var HTTP_VERSION_PATTERN2 = /^(\d)\.(\d)$/;
|
|
11398
11704
|
var HttpRequestMessage;
|
|
11399
|
-
(function(HttpRequestMessage2) {
|
|
11705
|
+
/* @__PURE__ */ (function(HttpRequestMessage2) {
|
|
11400
11706
|
function create(init) {
|
|
11401
11707
|
return HttpRequestMessageHost.create(init);
|
|
11402
11708
|
}
|
|
@@ -11416,7 +11722,10 @@ var HttpRequestMessage;
|
|
|
11416
11722
|
var kQuery = Symbol("kQuery");
|
|
11417
11723
|
var kQueryProxy = Symbol("kQueryProxy");
|
|
11418
11724
|
var kProtocol = Symbol("kProtocol");
|
|
11419
|
-
var HttpRequestMessageHost = class extends HttpMessageHost {
|
|
11725
|
+
var HttpRequestMessageHost = class _HttpRequestMessageHost extends HttpMessageHost {
|
|
11726
|
+
static {
|
|
11727
|
+
__name(this, "HttpRequestMessageHost");
|
|
11728
|
+
}
|
|
11420
11729
|
constructor() {
|
|
11421
11730
|
super();
|
|
11422
11731
|
this.httpVersionMajor = 1;
|
|
@@ -11508,12 +11817,12 @@ var HttpRequestMessageHost = class extends HttpMessageHost {
|
|
|
11508
11817
|
this.baseUrl = info.url;
|
|
11509
11818
|
}
|
|
11510
11819
|
static create(init) {
|
|
11511
|
-
const msg = new
|
|
11820
|
+
const msg = new _HttpRequestMessageHost();
|
|
11512
11821
|
msg._init(init);
|
|
11513
11822
|
return msg;
|
|
11514
11823
|
}
|
|
11515
11824
|
static fromBuffer(buffer) {
|
|
11516
|
-
const msg = new
|
|
11825
|
+
const msg = new _HttpRequestMessageHost();
|
|
11517
11826
|
msg._parseBuffer(buffer, HTTPParser3.REQUEST);
|
|
11518
11827
|
return msg;
|
|
11519
11828
|
}
|
|
@@ -11522,7 +11831,6 @@ var HttpRequestMessageHost = class extends HttpMessageHost {
|
|
|
11522
11831
|
throw new Error("fromStream is not implemented yet");
|
|
11523
11832
|
}
|
|
11524
11833
|
};
|
|
11525
|
-
__name(HttpRequestMessageHost, "HttpRequestMessageHost");
|
|
11526
11834
|
HttpRequestMessageHost.kQuery = kQuery;
|
|
11527
11835
|
|
|
11528
11836
|
// ../../build/common/esm/http/enums/http-status-codes.enum.js
|
|
@@ -11639,7 +11947,10 @@ __name(encodePathComponent, "encodePathComponent");
|
|
|
11639
11947
|
|
|
11640
11948
|
// ../../build/common/esm/url/opra-url-path-component.js
|
|
11641
11949
|
var nodeInspectCustom3 = Symbol.for("nodejs.util.inspect.custom");
|
|
11642
|
-
var OpraURLPathComponent = class {
|
|
11950
|
+
var OpraURLPathComponent = class _OpraURLPathComponent {
|
|
11951
|
+
static {
|
|
11952
|
+
__name(this, "OpraURLPathComponent");
|
|
11953
|
+
}
|
|
11643
11954
|
constructor(init) {
|
|
11644
11955
|
this.resource = init.resource;
|
|
11645
11956
|
this.key = init.key;
|
|
@@ -11648,7 +11959,7 @@ var OpraURLPathComponent = class {
|
|
|
11648
11959
|
toString() {
|
|
11649
11960
|
const obj = encodePathComponent(this.resource, this.key, this.typeCast);
|
|
11650
11961
|
if (obj)
|
|
11651
|
-
Object.setPrototypeOf(obj,
|
|
11962
|
+
Object.setPrototypeOf(obj, _OpraURLPathComponent.prototype);
|
|
11652
11963
|
return obj;
|
|
11653
11964
|
}
|
|
11654
11965
|
/* istanbul ignore next */
|
|
@@ -11663,7 +11974,6 @@ var OpraURLPathComponent = class {
|
|
|
11663
11974
|
return out;
|
|
11664
11975
|
}
|
|
11665
11976
|
};
|
|
11666
|
-
__name(OpraURLPathComponent, "OpraURLPathComponent");
|
|
11667
11977
|
|
|
11668
11978
|
// ../../build/common/esm/url/utils/decode-path-component.js
|
|
11669
11979
|
import { splitString as splitString3 } from "fast-tokenizer";
|
|
@@ -11702,13 +12012,16 @@ function decodePathComponent(input) {
|
|
|
11702
12012
|
__name(decodePathComponent, "decodePathComponent");
|
|
11703
12013
|
|
|
11704
12014
|
// ../../build/common/esm/url/opra-url-path.js
|
|
11705
|
-
var
|
|
12015
|
+
var _a5;
|
|
11706
12016
|
var nodeInspectCustom4 = Symbol.for("nodejs.util.inspect.custom");
|
|
11707
12017
|
var kEntries3 = Symbol("kEntries");
|
|
11708
12018
|
var kOptions4 = Symbol("kOptions");
|
|
11709
|
-
var OpraURLPath = class {
|
|
12019
|
+
var OpraURLPath = class _OpraURLPath {
|
|
12020
|
+
static {
|
|
12021
|
+
__name(this, "OpraURLPath");
|
|
12022
|
+
}
|
|
11710
12023
|
constructor(init, options) {
|
|
11711
|
-
this[
|
|
12024
|
+
this[_a5] = [];
|
|
11712
12025
|
this[kOptions4] = { ...options, onChange: void 0 };
|
|
11713
12026
|
if (Array.isArray(init))
|
|
11714
12027
|
this.join(...init);
|
|
@@ -11775,7 +12088,7 @@ var OpraURLPath = class {
|
|
|
11775
12088
|
return out;
|
|
11776
12089
|
}
|
|
11777
12090
|
slice(start, end) {
|
|
11778
|
-
return new
|
|
12091
|
+
return new _OpraURLPath(this[kEntries3].slice(start, end));
|
|
11779
12092
|
}
|
|
11780
12093
|
splice(start, deleteCount, join) {
|
|
11781
12094
|
const items = join ? this._join([], join) : [];
|
|
@@ -11817,11 +12130,11 @@ var OpraURLPath = class {
|
|
|
11817
12130
|
}
|
|
11818
12131
|
return;
|
|
11819
12132
|
}
|
|
11820
|
-
if (source instanceof
|
|
12133
|
+
if (source instanceof _OpraURLPath) {
|
|
11821
12134
|
target.push(...source[kEntries3].map((x) => new OpraURLPathComponent(x)));
|
|
11822
12135
|
return;
|
|
11823
12136
|
}
|
|
11824
|
-
if (typeof source === "object" && source.path instanceof
|
|
12137
|
+
if (typeof source === "object" && source.path instanceof _OpraURLPath) {
|
|
11825
12138
|
this._join(target, source.path);
|
|
11826
12139
|
return;
|
|
11827
12140
|
}
|
|
@@ -11836,7 +12149,7 @@ var OpraURLPath = class {
|
|
|
11836
12149
|
target.push(new OpraURLPathComponent(source));
|
|
11837
12150
|
}
|
|
11838
12151
|
/* istanbul ignore next */
|
|
11839
|
-
[(
|
|
12152
|
+
[(_a5 = kEntries3, nodeInspectCustom4)]() {
|
|
11840
12153
|
return this[kEntries3];
|
|
11841
12154
|
}
|
|
11842
12155
|
[Symbol.iterator]() {
|
|
@@ -11846,12 +12159,11 @@ var OpraURLPath = class {
|
|
|
11846
12159
|
return "OpraURLPath";
|
|
11847
12160
|
}
|
|
11848
12161
|
};
|
|
11849
|
-
__name(OpraURLPath, "OpraURLPath");
|
|
11850
12162
|
OpraURLPath.kEntries = kEntries3;
|
|
11851
12163
|
OpraURLPath.kOptions = kOptions4;
|
|
11852
12164
|
|
|
11853
12165
|
// ../../build/common/esm/url/opra-url.js
|
|
11854
|
-
var
|
|
12166
|
+
var _a6;
|
|
11855
12167
|
var nodeInspectCustom5 = Symbol.for("nodejs.util.inspect.custom");
|
|
11856
12168
|
var urlRegEx = /^(?:((?:[A-Z][A-Z+-.]+:)+)\/\/([^/?]+))?(.*)?$/i;
|
|
11857
12169
|
var schemeRegEx = /^([A-Z][A-Z+-.]+:?)+$/i;
|
|
@@ -11860,9 +12172,12 @@ var hostnameRegEx = /^([^/:]+)$/;
|
|
|
11860
12172
|
var kContext = Symbol("kContext");
|
|
11861
12173
|
var kPath = Symbol("kPath");
|
|
11862
12174
|
var kParams = Symbol("kParams");
|
|
11863
|
-
var OpraURL = class {
|
|
12175
|
+
var OpraURL = class _OpraURL {
|
|
12176
|
+
static {
|
|
12177
|
+
__name(this, "OpraURL");
|
|
12178
|
+
}
|
|
11864
12179
|
constructor(input, base) {
|
|
11865
|
-
this[
|
|
12180
|
+
this[_a6] = {
|
|
11866
12181
|
protocol: "",
|
|
11867
12182
|
username: "",
|
|
11868
12183
|
prefix: "",
|
|
@@ -11885,7 +12200,7 @@ var OpraURL = class {
|
|
|
11885
12200
|
if (input)
|
|
11886
12201
|
this.parse(typeof input === "object" ? input.toString() : input);
|
|
11887
12202
|
if (base) {
|
|
11888
|
-
const baseUrl = base instanceof
|
|
12203
|
+
const baseUrl = base instanceof _OpraURL ? base : new _OpraURL(base);
|
|
11889
12204
|
this[kContext].protocol = baseUrl.protocol;
|
|
11890
12205
|
this[kContext].hostname = baseUrl.hostname;
|
|
11891
12206
|
this[kContext].port = baseUrl.port;
|
|
@@ -11965,7 +12280,7 @@ var OpraURL = class {
|
|
|
11965
12280
|
}
|
|
11966
12281
|
set prefix(value) {
|
|
11967
12282
|
if (value) {
|
|
11968
|
-
const url = new
|
|
12283
|
+
const url = new _OpraURL(value);
|
|
11969
12284
|
this[kContext].prefix = url.pathname;
|
|
11970
12285
|
} else
|
|
11971
12286
|
this[kContext].prefix = "";
|
|
@@ -12069,7 +12384,7 @@ var OpraURL = class {
|
|
|
12069
12384
|
return this.href;
|
|
12070
12385
|
}
|
|
12071
12386
|
/* istanbul ignore next */
|
|
12072
|
-
[(
|
|
12387
|
+
[(_a6 = kContext, nodeInspectCustom5)]() {
|
|
12073
12388
|
return {
|
|
12074
12389
|
protocol: this.protocol,
|
|
12075
12390
|
username: this.username,
|
|
@@ -12134,7 +12449,6 @@ var OpraURL = class {
|
|
|
12134
12449
|
}
|
|
12135
12450
|
}
|
|
12136
12451
|
};
|
|
12137
|
-
__name(OpraURL, "OpraURL");
|
|
12138
12452
|
OpraURL.kContext = kContext;
|
|
12139
12453
|
OpraURL.kPath = kPath;
|
|
12140
12454
|
OpraURL.kParams = kParams;
|
|
@@ -12177,7 +12491,7 @@ export {
|
|
|
12177
12491
|
OmitType,
|
|
12178
12492
|
OpraException,
|
|
12179
12493
|
opra_filter_ns_exports as OpraFilter,
|
|
12180
|
-
OpraSchema,
|
|
12494
|
+
opra_schema_ns_exports as OpraSchema,
|
|
12181
12495
|
OpraURL,
|
|
12182
12496
|
OpraURLPath,
|
|
12183
12497
|
OpraURLPathComponent,
|
|
@@ -12193,6 +12507,7 @@ export {
|
|
|
12193
12507
|
UnauthorizedError,
|
|
12194
12508
|
UnionType2 as UnionType,
|
|
12195
12509
|
UnprocessableEntityError,
|
|
12510
|
+
ValidationError,
|
|
12196
12511
|
applyMixins,
|
|
12197
12512
|
cloneObject,
|
|
12198
12513
|
decodePathComponent,
|