@opra/common 0.18.4 → 0.20.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 +1327 -1578
- 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 +5 -1
- package/cjs/document/data-type/builtin/integer.type.js +5 -18
- package/cjs/document/data-type/builtin/null.type.js +15 -0
- package/cjs/document/data-type/builtin/number.type.js +5 -23
- package/cjs/document/data-type/builtin/object-id.type.js +15 -0
- 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 +152 -92
- package/cjs/document/data-type/data-type.js +32 -31
- package/cjs/document/data-type/enum-type.js +50 -43
- package/cjs/document/data-type/mapped-type.js +116 -70
- package/cjs/document/data-type/simple-type.js +47 -45
- package/cjs/document/data-type/union-type.js +70 -36
- package/cjs/document/factory/create-document.js +6 -4
- 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/index.js +1 -2
- 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 +5 -1
- package/esm/document/data-type/builtin/integer.type.js +4 -17
- package/esm/document/data-type/builtin/null.type.js +12 -0
- package/esm/document/data-type/builtin/number.type.js +4 -22
- package/esm/document/data-type/builtin/object-id.type.js +12 -0
- 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 +152 -92
- package/esm/document/data-type/data-type.js +31 -31
- package/esm/document/data-type/enum-type.js +50 -43
- package/esm/document/data-type/mapped-type.js +115 -70
- package/esm/document/data-type/simple-type.js +46 -44
- package/esm/document/data-type/union-type.js +69 -36
- package/esm/document/factory/create-document.js +7 -5
- 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/http/index.js +1 -2
- package/esm/schema/index.js +2 -41
- package/esm/schema/opra-schema.ns.js +15 -0
- package/package.json +10 -23
- 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 +5 -1
- package/types/document/data-type/builtin/integer.type.d.ts +1 -5
- package/types/document/data-type/builtin/null.type.d.ts +2 -0
- package/types/document/data-type/builtin/number.type.d.ts +0 -4
- package/types/document/data-type/builtin/object-id.type.d.ts +2 -0
- 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 +30 -16
- package/types/document/data-type/data-type.d.ts +19 -15
- package/types/document/data-type/enum-type.d.ts +16 -5
- package/types/document/data-type/mapped-type.d.ts +28 -5
- package/types/document/data-type/simple-type.d.ts +27 -12
- package/types/document/data-type/union-type.d.ts +21 -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/http/index.d.ts +1 -2
- 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/cjs/http/http-message.host.js +0 -251
- package/cjs/http/http-request-message.js +0 -152
- package/cjs/http/http-response-message.js +0 -238
- package/cjs/http/interfaces/cookie-options.interface.js +0 -2
- package/esm/document/data-type/builtin/guid.type.js +0 -32
- package/esm/http/http-message.host.js +0 -246
- package/esm/http/http-request-message.js +0 -148
- package/esm/http/http-response-message.js +0 -233
- package/esm/http/interfaces/cookie-options.interface.js +0 -1
- package/types/document/data-type/builtin/guid.type.d.ts +0 -7
- package/types/http/http-message.host.d.ts +0 -122
- package/types/http/http-request-message.d.ts +0 -213
- package/types/http/http-response-message.d.ts +0 -318
- package/types/http/interfaces/cookie-options.interface.d.ts +0 -4
- /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
|
@@ -32,8 +32,8 @@ function isConstructor(fn) {
|
|
|
32
32
|
return typeof fn === "function" && fn.prototype && fn.prototype.constructor === fn && fn.prototype.constructor.name !== "Function" && fn.prototype.constructor.name !== "anonymous";
|
|
33
33
|
}
|
|
34
34
|
__name(isConstructor, "isConstructor");
|
|
35
|
-
function isStream(
|
|
36
|
-
return
|
|
35
|
+
function isStream(stream) {
|
|
36
|
+
return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
|
|
37
37
|
}
|
|
38
38
|
__name(isStream, "isStream");
|
|
39
39
|
function isReadable(x) {
|
|
@@ -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,17 @@ 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
|
|
971
|
+
import "reflect-metadata";
|
|
932
972
|
import omit2 from "lodash.omit";
|
|
973
|
+
import merge3 from "putil-merge";
|
|
974
|
+
import * as vg2 from "valgen";
|
|
933
975
|
|
|
934
976
|
// ../../build/common/esm/document/data-type/enum-type.js
|
|
977
|
+
import "reflect-metadata";
|
|
935
978
|
import omit from "lodash.omit";
|
|
979
|
+
import merge2 from "putil-merge";
|
|
980
|
+
import * as vg from "valgen";
|
|
936
981
|
|
|
937
982
|
// ../../build/common/esm/document/utils/inspect.util.js
|
|
938
983
|
var nodeInspectCustom = Symbol.for("nodejs.util.inspect.custom");
|
|
@@ -941,91 +986,103 @@ var colorFgYellow = "\x1B[33m";
|
|
|
941
986
|
var colorFgMagenta = "\x1B[35m";
|
|
942
987
|
|
|
943
988
|
// ../../build/common/esm/document/data-type/data-type.js
|
|
944
|
-
var DataType =
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
989
|
+
var DataType = class _DataType {
|
|
990
|
+
static {
|
|
991
|
+
__name(this, "DataType");
|
|
992
|
+
}
|
|
993
|
+
constructor(document, init) {
|
|
994
|
+
this.document = document;
|
|
995
|
+
this.name = init?.name;
|
|
996
|
+
this.own = {};
|
|
997
|
+
this.description = init?.description;
|
|
998
|
+
this.isAnonymous = !this.name;
|
|
999
|
+
}
|
|
1000
|
+
decode(v) {
|
|
1001
|
+
return this._getDecoder()(v, { coerce: true });
|
|
1002
|
+
}
|
|
1003
|
+
encode(v) {
|
|
1004
|
+
return this._getEncoder()(v, { coerce: true });
|
|
1005
|
+
}
|
|
1006
|
+
validate(v) {
|
|
1007
|
+
return this._getEncoder()(v);
|
|
948
1008
|
}
|
|
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
1009
|
exportSchema() {
|
|
970
1010
|
return omitUndefined({
|
|
971
1011
|
kind: this.kind,
|
|
972
|
-
description: this.
|
|
1012
|
+
description: this.description
|
|
973
1013
|
});
|
|
974
|
-
}
|
|
1014
|
+
}
|
|
1015
|
+
extendsFrom(type) {
|
|
1016
|
+
const dataType = type instanceof _DataType ? type : this.document.getDataType(type);
|
|
1017
|
+
let t = this.base;
|
|
1018
|
+
while (t) {
|
|
1019
|
+
if (t === dataType)
|
|
1020
|
+
return true;
|
|
1021
|
+
t = t.base;
|
|
1022
|
+
}
|
|
1023
|
+
return false;
|
|
1024
|
+
}
|
|
975
1025
|
toString() {
|
|
976
1026
|
return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || "#anonymous"}]`;
|
|
977
|
-
}
|
|
1027
|
+
}
|
|
978
1028
|
[nodeInspectCustom]() {
|
|
979
1029
|
return `[${colorFgYellow + Object.getPrototypeOf(this).constructor.name + colorReset} ${colorFgMagenta + this.name + colorReset}]`;
|
|
980
1030
|
}
|
|
981
1031
|
};
|
|
982
|
-
Object.assign(DataType.prototype, proto);
|
|
983
1032
|
|
|
984
1033
|
// ../../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;
|
|
1034
|
+
var EnumTypeClass = class extends DataType {
|
|
1035
|
+
static {
|
|
1036
|
+
__name(this, "EnumTypeClass");
|
|
1037
|
+
}
|
|
1038
|
+
constructor(document, init) {
|
|
1039
|
+
super(document, init);
|
|
1040
|
+
this.kind = opra_schema_ns_exports.EnumType.Kind;
|
|
1041
|
+
this.base = init.base;
|
|
1042
|
+
this.ownValues = init.values;
|
|
1043
|
+
this.ownMeanings = init.meanings || {};
|
|
1044
|
+
this.values = { ...this.base?.values, ...this.ownValues };
|
|
1045
|
+
this.meanings = { ...this.base?.meanings, ...this.ownMeanings };
|
|
1000
1046
|
}
|
|
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
1047
|
exportSchema() {
|
|
1014
1048
|
const out = DataType.prototype.exportSchema.call(this);
|
|
1015
1049
|
Object.assign(out, omitUndefined({
|
|
1016
1050
|
base: this.base ? this.base.name ? this.base.name : this.base.exportSchema() : void 0,
|
|
1017
|
-
values: this.
|
|
1018
|
-
meanings: this.
|
|
1051
|
+
values: this.ownValues,
|
|
1052
|
+
meanings: this.ownMeanings
|
|
1019
1053
|
}));
|
|
1020
1054
|
return out;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
if (!this.
|
|
1024
|
-
|
|
1055
|
+
}
|
|
1056
|
+
_getDecoder() {
|
|
1057
|
+
if (!this._decoder)
|
|
1058
|
+
this._decoder = vg.isEnum(Object.values(this.values), { enumName: this.name });
|
|
1059
|
+
return this._decoder;
|
|
1060
|
+
}
|
|
1061
|
+
_getEncoder() {
|
|
1062
|
+
return this._getDecoder();
|
|
1025
1063
|
}
|
|
1026
1064
|
};
|
|
1027
|
-
|
|
1028
|
-
|
|
1065
|
+
var EnumType2 = /* @__PURE__ */ __name(function(...args) {
|
|
1066
|
+
if (this) {
|
|
1067
|
+
const [document, init] = args;
|
|
1068
|
+
merge2(this, new EnumTypeClass(document, init), { descriptor: true });
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
const [source, options] = args;
|
|
1072
|
+
const values = Array.isArray(source) ? source.reduce((obj, v) => {
|
|
1073
|
+
obj[v] = v;
|
|
1074
|
+
return obj;
|
|
1075
|
+
}, {}) : source;
|
|
1076
|
+
const metadata = {
|
|
1077
|
+
kind: opra_schema_ns_exports.EnumType.Kind,
|
|
1078
|
+
values
|
|
1079
|
+
};
|
|
1080
|
+
if (options)
|
|
1081
|
+
Object.assign(metadata, omit(options, ["kind", "values"]));
|
|
1082
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, source);
|
|
1083
|
+
return values;
|
|
1084
|
+
}, "EnumType");
|
|
1085
|
+
EnumType2.prototype = EnumTypeClass.prototype;
|
|
1029
1086
|
|
|
1030
1087
|
// ../../build/common/esm/document/data-type/api-field.js
|
|
1031
1088
|
var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
@@ -1035,17 +1092,18 @@ var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
|
1035
1092
|
if (typeof propertyKey !== "string")
|
|
1036
1093
|
throw new TypeError(`Symbol properties can't be used as a field`);
|
|
1037
1094
|
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target.constructor) || {};
|
|
1038
|
-
metadata.kind =
|
|
1095
|
+
metadata.kind = opra_schema_ns_exports.ComplexType.Kind;
|
|
1039
1096
|
metadata.fields = metadata.fields || {};
|
|
1040
1097
|
const designType = Reflect.getMetadata("design:type", target, propertyKey);
|
|
1041
|
-
const isArray = designType === Array;
|
|
1042
1098
|
const elemMeta = metadata.fields[propertyKey] = {
|
|
1043
1099
|
...options,
|
|
1044
1100
|
enum: void 0,
|
|
1045
|
-
designType
|
|
1101
|
+
designType
|
|
1046
1102
|
};
|
|
1047
|
-
if (designType === Array)
|
|
1103
|
+
if (designType === Array) {
|
|
1048
1104
|
elemMeta.isArray = true;
|
|
1105
|
+
delete elemMeta.designType;
|
|
1106
|
+
}
|
|
1049
1107
|
if (options?.enum) {
|
|
1050
1108
|
elemMeta.type = void 0;
|
|
1051
1109
|
if (Array.isArray(options.enum)) {
|
|
@@ -1057,7 +1115,7 @@ var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
|
1057
1115
|
elemMeta.enum = enumObj;
|
|
1058
1116
|
} else {
|
|
1059
1117
|
const m = Reflect.getOwnMetadata(METADATA_KEY, options?.enum);
|
|
1060
|
-
if (!
|
|
1118
|
+
if (!opra_schema_ns_exports.isEnumType(m))
|
|
1061
1119
|
throw new TypeError(`Invalid "enum" value. Did you forget to set metadata using EnumType() method?`);
|
|
1062
1120
|
elemMeta.enum = options.enum;
|
|
1063
1121
|
}
|
|
@@ -1084,9 +1142,9 @@ var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
|
1084
1142
|
if (init?.required != null)
|
|
1085
1143
|
this.required = init?.required;
|
|
1086
1144
|
}, "ApiField");
|
|
1087
|
-
var
|
|
1145
|
+
var proto = {
|
|
1088
1146
|
exportSchema() {
|
|
1089
|
-
|
|
1147
|
+
return {
|
|
1090
1148
|
type: this.type.name ? this.type.name : this.type.exportSchema(),
|
|
1091
1149
|
description: this.description,
|
|
1092
1150
|
isArray: this.isArray,
|
|
@@ -1094,108 +1152,73 @@ var proto3 = {
|
|
|
1094
1152
|
fixed: this.fixed,
|
|
1095
1153
|
required: this.required
|
|
1096
1154
|
};
|
|
1097
|
-
return out;
|
|
1098
1155
|
}
|
|
1099
1156
|
};
|
|
1100
|
-
Object.assign(ApiField.prototype,
|
|
1157
|
+
Object.assign(ApiField.prototype, proto);
|
|
1101
1158
|
|
|
1102
1159
|
// ../../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);
|
|
1160
|
+
var ComplexTypeClass = class extends DataType {
|
|
1161
|
+
static {
|
|
1162
|
+
__name(this, "ComplexTypeClass");
|
|
1163
|
+
}
|
|
1164
|
+
constructor(document, init) {
|
|
1165
|
+
super(document, init);
|
|
1166
|
+
this.kind = opra_schema_ns_exports.ComplexType.Kind;
|
|
1167
|
+
const own = this.own = {};
|
|
1168
|
+
own.ctor = init?.ctor;
|
|
1169
|
+
own.abstract = init?.abstract;
|
|
1170
|
+
own.additionalFields = init?.additionalFields;
|
|
1171
|
+
own.fields = new ResponsiveMap();
|
|
1172
|
+
this.kind = opra_schema_ns_exports.ComplexType.Kind;
|
|
1173
|
+
this.base = init?.base;
|
|
1174
|
+
this.ctor = own.ctor || Object;
|
|
1175
|
+
this.abstract = own.abstract;
|
|
1176
|
+
this.additionalFields = own.additionalFields;
|
|
1177
|
+
this.fields = new ResponsiveMap();
|
|
1149
1178
|
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
|
-
}
|
|
1179
|
+
if (this.additionalFields == null)
|
|
1180
|
+
this.additionalFields = this.base.additionalFields;
|
|
1181
|
+
if (own.ctor == null && this.base instanceof ComplexType2)
|
|
1182
|
+
this.ctor = this.base.ctor;
|
|
1183
|
+
if (this.base.fields)
|
|
1184
|
+
for (const [k, el] of this.base.fields.entries()) {
|
|
1185
|
+
const newEl = new ApiField(this, el);
|
|
1186
|
+
this.fields.set(k, newEl);
|
|
1187
|
+
}
|
|
1168
1188
|
}
|
|
1169
|
-
|
|
1170
|
-
},
|
|
1189
|
+
}
|
|
1171
1190
|
addField(init) {
|
|
1172
1191
|
const field = new ApiField(this, init);
|
|
1173
1192
|
this.own.fields.set(field.name, field);
|
|
1174
1193
|
this.fields.set(field.name, field);
|
|
1175
1194
|
return field;
|
|
1176
|
-
}
|
|
1195
|
+
}
|
|
1177
1196
|
findField(nameOrPath) {
|
|
1178
1197
|
let field;
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1198
|
+
if (nameOrPath.includes(".")) {
|
|
1199
|
+
for (const [, f] of this.iteratePath(nameOrPath, true)) {
|
|
1200
|
+
if (!f)
|
|
1201
|
+
return;
|
|
1202
|
+
field = f;
|
|
1203
|
+
}
|
|
1204
|
+
return field;
|
|
1183
1205
|
}
|
|
1184
|
-
return
|
|
1185
|
-
}
|
|
1206
|
+
return this.fields.get(nameOrPath);
|
|
1207
|
+
}
|
|
1186
1208
|
getField(nameOrPath) {
|
|
1187
1209
|
let field;
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
}
|
|
1210
|
+
if (nameOrPath.includes(".")) {
|
|
1211
|
+
for (const [, f] of this.iteratePath(nameOrPath)) {
|
|
1212
|
+
field = f;
|
|
1213
|
+
}
|
|
1214
|
+
} else
|
|
1215
|
+
field = this.fields.get(nameOrPath);
|
|
1193
1216
|
if (!field)
|
|
1194
|
-
throw new Error(`
|
|
1217
|
+
throw new Error(`Unknown field "${nameOrPath}"`);
|
|
1195
1218
|
return field;
|
|
1196
|
-
}
|
|
1197
|
-
iteratePath(
|
|
1198
|
-
const arr =
|
|
1219
|
+
}
|
|
1220
|
+
iteratePath(path2, silent) {
|
|
1221
|
+
const arr = path2.split(".");
|
|
1199
1222
|
const len = arr.length;
|
|
1200
1223
|
let dataType = this;
|
|
1201
1224
|
let field;
|
|
@@ -1234,70 +1257,119 @@ var proto4 = {
|
|
|
1234
1257
|
};
|
|
1235
1258
|
}
|
|
1236
1259
|
};
|
|
1237
|
-
}
|
|
1238
|
-
normalizeFieldPath(
|
|
1239
|
-
if (Array.isArray(
|
|
1240
|
-
return
|
|
1260
|
+
}
|
|
1261
|
+
normalizeFieldPath(fieldPaths) {
|
|
1262
|
+
if (Array.isArray(fieldPaths))
|
|
1263
|
+
return fieldPaths.map((s) => this.normalizeFieldPath(s));
|
|
1241
1264
|
let curPath = "";
|
|
1242
|
-
for (const [, , p] of this.iteratePath(
|
|
1265
|
+
for (const [, , p] of this.iteratePath(fieldPaths)) {
|
|
1243
1266
|
curPath = p;
|
|
1244
1267
|
}
|
|
1245
1268
|
return curPath;
|
|
1246
1269
|
}
|
|
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
1270
|
exportSchema() {
|
|
1287
|
-
const out =
|
|
1271
|
+
const out = super.exportSchema();
|
|
1288
1272
|
Object.assign(out, omitUndefined({
|
|
1289
1273
|
base: this.base ? this.base.name ? this.base.name : this.base.exportSchema() : void 0,
|
|
1290
|
-
|
|
1274
|
+
abstract: this.own.abstract,
|
|
1275
|
+
additionalFields: this.own.additionalFields
|
|
1291
1276
|
}));
|
|
1292
|
-
|
|
1277
|
+
if (this.own.fields.size) {
|
|
1278
|
+
const fields = out.fields = {};
|
|
1279
|
+
for (const field of this.own.fields.values()) {
|
|
1280
|
+
fields[field.name] = field.exportSchema();
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
return omitUndefined(out);
|
|
1284
|
+
}
|
|
1285
|
+
isTypeOf(t) {
|
|
1286
|
+
return t === this.own.ctor;
|
|
1287
|
+
}
|
|
1288
|
+
extendsFrom(t) {
|
|
1289
|
+
const base = t instanceof DataType ? t : this.document.getDataType(t);
|
|
1290
|
+
if (this.base) {
|
|
1291
|
+
if (this.base === base)
|
|
1292
|
+
return true;
|
|
1293
|
+
return this.base.extendsFrom(base);
|
|
1294
|
+
}
|
|
1295
|
+
return false;
|
|
1296
|
+
}
|
|
1297
|
+
decode(v) {
|
|
1298
|
+
return this._getDecoder()(v, { coerce: true });
|
|
1299
|
+
}
|
|
1300
|
+
encode(v) {
|
|
1301
|
+
return this._getEncoder()(v, { coerce: true });
|
|
1302
|
+
}
|
|
1303
|
+
validate(v) {
|
|
1304
|
+
return this._getEncoder()(v);
|
|
1305
|
+
}
|
|
1306
|
+
_getDecoder() {
|
|
1307
|
+
if (this._decoder)
|
|
1308
|
+
return this._decoder;
|
|
1309
|
+
const schema = {};
|
|
1310
|
+
for (const f of this.fields.values()) {
|
|
1311
|
+
let t = f.type._getDecoder();
|
|
1312
|
+
if (f.isArray)
|
|
1313
|
+
t = vg2.isArray(t);
|
|
1314
|
+
schema[f.name] = f.required ? vg2.required(t) : vg2.optional(t);
|
|
1315
|
+
}
|
|
1316
|
+
this._decoder = vg2.isObject(schema, {
|
|
1317
|
+
ctor: this.ctor,
|
|
1318
|
+
additionalFields: this.additionalFields ?? "ignore",
|
|
1319
|
+
name: this.name,
|
|
1320
|
+
caseInSensitive: true
|
|
1321
|
+
});
|
|
1322
|
+
return this._decoder;
|
|
1323
|
+
}
|
|
1324
|
+
_getEncoder() {
|
|
1325
|
+
if (this._encoder)
|
|
1326
|
+
return this._encoder;
|
|
1327
|
+
const schema = {};
|
|
1328
|
+
for (const f of this.fields.values()) {
|
|
1329
|
+
let t = f.type._getEncoder();
|
|
1330
|
+
if (f.isArray)
|
|
1331
|
+
t = vg2.isArray(t);
|
|
1332
|
+
schema[f.name] = t;
|
|
1333
|
+
}
|
|
1334
|
+
this._encoder = vg2.isObject(schema, {
|
|
1335
|
+
ctor: this.ctor,
|
|
1336
|
+
additionalFields: this.additionalFields,
|
|
1337
|
+
name: this.name,
|
|
1338
|
+
caseInSensitive: true,
|
|
1339
|
+
detectCircular: true
|
|
1340
|
+
});
|
|
1341
|
+
return this._encoder;
|
|
1293
1342
|
}
|
|
1294
1343
|
};
|
|
1295
|
-
|
|
1296
|
-
|
|
1344
|
+
var ComplexType2 = /* @__PURE__ */ __name(function(...args) {
|
|
1345
|
+
if (this) {
|
|
1346
|
+
const [document, init] = args;
|
|
1347
|
+
merge3(this, new ComplexTypeClass(document, init), { descriptor: true });
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1350
|
+
const [options] = args;
|
|
1351
|
+
return function(target) {
|
|
1352
|
+
const name = options?.name || target.name.match(TYPENAME_PATTERN)?.[1] || target.name;
|
|
1353
|
+
let metadata = Reflect.getOwnMetadata(METADATA_KEY, target);
|
|
1354
|
+
if (!metadata) {
|
|
1355
|
+
metadata = {};
|
|
1356
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
1357
|
+
}
|
|
1358
|
+
metadata.kind = opra_schema_ns_exports.ComplexType.Kind;
|
|
1359
|
+
metadata.name = name;
|
|
1360
|
+
if (options)
|
|
1361
|
+
Object.assign(metadata, omit2(options, ["kind", "name", "base", "fields"]));
|
|
1362
|
+
};
|
|
1363
|
+
}, "ComplexType");
|
|
1364
|
+
ComplexType2.prototype = ComplexTypeClass.prototype;
|
|
1297
1365
|
|
|
1298
1366
|
// ../../build/common/esm/document/api-document.js
|
|
1299
1367
|
var ApiDocument = class {
|
|
1368
|
+
static {
|
|
1369
|
+
__name(this, "ApiDocument");
|
|
1370
|
+
}
|
|
1300
1371
|
constructor() {
|
|
1372
|
+
this._designCtorMap = /* @__PURE__ */ new Map();
|
|
1301
1373
|
this._typeCache = new ResponsiveMap();
|
|
1302
1374
|
this._typesCacheByCtor = /* @__PURE__ */ new Map();
|
|
1303
1375
|
this.references = new ResponsiveMap();
|
|
@@ -1307,51 +1379,72 @@ var ApiDocument = class {
|
|
|
1307
1379
|
version: "",
|
|
1308
1380
|
title: ""
|
|
1309
1381
|
};
|
|
1382
|
+
const BigIntConstructor = Object.getPrototypeOf(BigInt(0)).constructor;
|
|
1383
|
+
const BufferConstructor = Object.getPrototypeOf(Buffer.from([]));
|
|
1384
|
+
this._designCtorMap.set(String, "string");
|
|
1385
|
+
this._designCtorMap.set(Number, "number");
|
|
1386
|
+
this._designCtorMap.set(Boolean, "boolean");
|
|
1387
|
+
this._designCtorMap.set(Object, "any");
|
|
1388
|
+
this._designCtorMap.set(Date, "timestamp");
|
|
1389
|
+
this._designCtorMap.set(BigIntConstructor, "bigint");
|
|
1390
|
+
this._designCtorMap.set(ArrayBuffer, "base64");
|
|
1391
|
+
this._designCtorMap.set(SharedArrayBuffer, "base64");
|
|
1392
|
+
this._designCtorMap.set(BufferConstructor, "base64");
|
|
1310
1393
|
}
|
|
1311
|
-
|
|
1394
|
+
/**
|
|
1395
|
+
*
|
|
1396
|
+
*/
|
|
1397
|
+
getDataType(arg0, silent) {
|
|
1312
1398
|
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);
|
|
1399
|
+
const name = typeof arg0 === "function" ? arg0.name : arg0;
|
|
1400
|
+
const t = typeof arg0 === "string" ? this._typeCache.get(arg0) : this._typesCacheByCtor.get(arg0);
|
|
1317
1401
|
if (t)
|
|
1318
1402
|
return t;
|
|
1319
1403
|
if (t === null) {
|
|
1320
1404
|
if (silent)
|
|
1321
1405
|
return;
|
|
1322
|
-
throw new
|
|
1406
|
+
throw new Error(`Data type "${name}" does not exists`);
|
|
1323
1407
|
}
|
|
1324
|
-
if (typeof
|
|
1325
|
-
const
|
|
1408
|
+
if (typeof arg0 === "function") {
|
|
1409
|
+
const x = this._designCtorMap.get(arg0);
|
|
1410
|
+
if (x)
|
|
1411
|
+
arg0 = x;
|
|
1412
|
+
}
|
|
1413
|
+
if (typeof arg0 === "string") {
|
|
1414
|
+
const m = NAMESPACE_PATTERN.exec(arg0);
|
|
1326
1415
|
if (!m)
|
|
1327
|
-
throw new
|
|
1416
|
+
throw new TypeError(`Invalid data type name "${name}"`);
|
|
1328
1417
|
if (m[2]) {
|
|
1329
1418
|
const ref = this.references.get(m[1]);
|
|
1330
1419
|
if (!ref) {
|
|
1331
1420
|
if (silent)
|
|
1332
1421
|
return;
|
|
1333
|
-
throw new
|
|
1422
|
+
throw new Error(`No referenced document found for given namespace "${m[1]}"`);
|
|
1334
1423
|
}
|
|
1335
|
-
dataType = ref.getDataType(m[2]);
|
|
1336
|
-
this._typeCache.set(nameOrCtor, dataType);
|
|
1424
|
+
dataType = ref.getDataType(m[2], silent);
|
|
1337
1425
|
} else {
|
|
1338
|
-
|
|
1339
|
-
dataType = this.types.get(name);
|
|
1426
|
+
dataType = this.types.get(arg0);
|
|
1340
1427
|
if (!dataType) {
|
|
1341
1428
|
const references = Array.from(this.references.values()).reverse();
|
|
1342
1429
|
for (const ref of references) {
|
|
1343
|
-
dataType = ref.getDataType(name);
|
|
1430
|
+
dataType = ref.getDataType(name, true);
|
|
1344
1431
|
if (dataType)
|
|
1345
1432
|
break;
|
|
1346
1433
|
}
|
|
1347
1434
|
}
|
|
1348
|
-
if (dataType)
|
|
1349
|
-
this._typeCache.set(dataType.name || name, dataType);
|
|
1350
1435
|
}
|
|
1351
|
-
|
|
1436
|
+
if (dataType) {
|
|
1437
|
+
this._typeCache.set(arg0, dataType);
|
|
1438
|
+
return dataType;
|
|
1439
|
+
}
|
|
1440
|
+
if (!silent)
|
|
1441
|
+
throw new NotFoundError(`Data type "${arg0}" does not exists`);
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
if (typeof arg0 === "function") {
|
|
1352
1445
|
const types = Array.from(this.types.values()).reverse();
|
|
1353
1446
|
for (const dt of types) {
|
|
1354
|
-
if (
|
|
1447
|
+
if (dt instanceof ComplexType2 && dt.isTypeOf(arg0)) {
|
|
1355
1448
|
dataType = dt;
|
|
1356
1449
|
break;
|
|
1357
1450
|
}
|
|
@@ -1359,25 +1452,21 @@ var ApiDocument = class {
|
|
|
1359
1452
|
if (!dataType) {
|
|
1360
1453
|
const references = Array.from(this.references.values()).reverse();
|
|
1361
1454
|
for (const ref of references) {
|
|
1362
|
-
dataType = ref.getDataType(
|
|
1455
|
+
dataType = ref.getDataType(arg0, true);
|
|
1363
1456
|
if (dataType)
|
|
1364
1457
|
break;
|
|
1365
1458
|
}
|
|
1366
1459
|
}
|
|
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)
|
|
1460
|
+
if (dataType)
|
|
1461
|
+
this._typesCacheByCtor.set(arg0, dataType);
|
|
1462
|
+
if (dataType)
|
|
1463
|
+
return dataType;
|
|
1464
|
+
if (!silent)
|
|
1465
|
+
throw new NotFoundError(`No data type mapping found for class "${name}"`);
|
|
1379
1466
|
return;
|
|
1380
|
-
|
|
1467
|
+
}
|
|
1468
|
+
if (!silent)
|
|
1469
|
+
throw new TypeError("Invalid argument");
|
|
1381
1470
|
}
|
|
1382
1471
|
getComplexType(nameOrCtor, silent) {
|
|
1383
1472
|
if (nameOrCtor === Object)
|
|
@@ -1385,7 +1474,7 @@ var ApiDocument = class {
|
|
|
1385
1474
|
const t = this.getDataType(nameOrCtor);
|
|
1386
1475
|
if (!t && silent)
|
|
1387
1476
|
return;
|
|
1388
|
-
if (t && t.kind ===
|
|
1477
|
+
if (t && t.kind === opra_schema_ns_exports.ComplexType.Kind)
|
|
1389
1478
|
return t;
|
|
1390
1479
|
throw new NotAcceptableError(`Data type "${t.name}" is not a ComplexType`);
|
|
1391
1480
|
}
|
|
@@ -1393,15 +1482,15 @@ var ApiDocument = class {
|
|
|
1393
1482
|
const t = this.getDataType(nameOrCtor);
|
|
1394
1483
|
if (!t && silent)
|
|
1395
1484
|
return;
|
|
1396
|
-
if (t && t.kind ===
|
|
1485
|
+
if (t && t.kind === opra_schema_ns_exports.SimpleType.Kind)
|
|
1397
1486
|
return t;
|
|
1398
1487
|
throw new NotAcceptableError(`Data type "${t.name || t}" is not a SimpleType`);
|
|
1399
1488
|
}
|
|
1400
|
-
getResource(
|
|
1489
|
+
getResource(path2, silent) {
|
|
1401
1490
|
let resource;
|
|
1402
|
-
const m = NAMESPACE_PATTERN.exec(
|
|
1491
|
+
const m = NAMESPACE_PATTERN.exec(path2);
|
|
1403
1492
|
if (!m)
|
|
1404
|
-
throw new NotFoundError(`Invalid resource path "${
|
|
1493
|
+
throw new NotFoundError(`Invalid resource path "${path2}"`);
|
|
1405
1494
|
if (m[2]) {
|
|
1406
1495
|
const ref = this.references.get(m[1]);
|
|
1407
1496
|
if (!ref) {
|
|
@@ -1424,21 +1513,21 @@ var ApiDocument = class {
|
|
|
1424
1513
|
}
|
|
1425
1514
|
if (silent)
|
|
1426
1515
|
return;
|
|
1427
|
-
throw new NotFoundError(`Resource not found (${
|
|
1516
|
+
throw new NotFoundError(`Resource not found (${path2})`);
|
|
1428
1517
|
}
|
|
1429
|
-
getCollection(
|
|
1430
|
-
const t = this.getResource(
|
|
1518
|
+
getCollection(path2, silent) {
|
|
1519
|
+
const t = this.getResource(path2);
|
|
1431
1520
|
if (!t && silent)
|
|
1432
1521
|
return;
|
|
1433
|
-
if (t && t.kind ===
|
|
1522
|
+
if (t && t.kind === opra_schema_ns_exports.Collection.Kind)
|
|
1434
1523
|
return t;
|
|
1435
1524
|
throw new NotAcceptableError(`Resource type "${t.name}" is not a Collection`);
|
|
1436
1525
|
}
|
|
1437
|
-
getSingleton(
|
|
1438
|
-
const t = this.getResource(
|
|
1526
|
+
getSingleton(path2, silent) {
|
|
1527
|
+
const t = this.getResource(path2);
|
|
1439
1528
|
if (!t && silent)
|
|
1440
1529
|
return;
|
|
1441
|
-
if (t && t.kind ===
|
|
1530
|
+
if (t && t.kind === opra_schema_ns_exports.Singleton.Kind)
|
|
1442
1531
|
return t;
|
|
1443
1532
|
throw new NotAcceptableError(`Resource type "${t.name}" is not a Singleton`);
|
|
1444
1533
|
}
|
|
@@ -1447,7 +1536,7 @@ var ApiDocument = class {
|
|
|
1447
1536
|
*/
|
|
1448
1537
|
exportSchema() {
|
|
1449
1538
|
const schema = {
|
|
1450
|
-
version:
|
|
1539
|
+
version: opra_schema_ns_exports.SpecVersion,
|
|
1451
1540
|
url: this.url,
|
|
1452
1541
|
info: cloneObject(this.info)
|
|
1453
1542
|
};
|
|
@@ -1482,7 +1571,6 @@ var ApiDocument = class {
|
|
|
1482
1571
|
this._typesCacheByCtor.clear();
|
|
1483
1572
|
}
|
|
1484
1573
|
};
|
|
1485
|
-
__name(ApiDocument, "ApiDocument");
|
|
1486
1574
|
|
|
1487
1575
|
// ../../build/common/esm/document/factory/add-references.js
|
|
1488
1576
|
async function addReferences(references) {
|
|
@@ -1500,7 +1588,7 @@ async function addReferences(references) {
|
|
|
1500
1588
|
}
|
|
1501
1589
|
__name(addReferences, "addReferences");
|
|
1502
1590
|
|
|
1503
|
-
// ../../node_modules/tslib/tslib.es6.
|
|
1591
|
+
// ../../node_modules/tslib/tslib.es6.mjs
|
|
1504
1592
|
function __decorate(decorators, target, key, desc) {
|
|
1505
1593
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1506
1594
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1513,262 +1601,277 @@ function __decorate(decorators, target, key, desc) {
|
|
|
1513
1601
|
}
|
|
1514
1602
|
__name(__decorate, "__decorate");
|
|
1515
1603
|
|
|
1604
|
+
// ../../build/common/esm/document/data-type/simple-type.js
|
|
1605
|
+
import "reflect-metadata";
|
|
1606
|
+
import omit3 from "lodash.omit";
|
|
1607
|
+
import merge4 from "putil-merge";
|
|
1608
|
+
import * as vg3 from "valgen";
|
|
1609
|
+
var SimpleTypeClass = class extends DataType {
|
|
1610
|
+
static {
|
|
1611
|
+
__name(this, "SimpleTypeClass");
|
|
1612
|
+
}
|
|
1613
|
+
constructor(document, init) {
|
|
1614
|
+
super(document, init);
|
|
1615
|
+
this.kind = opra_schema_ns_exports.SimpleType.Kind;
|
|
1616
|
+
this.base = init.base;
|
|
1617
|
+
this._decoder = init.decoder || init.base?._decoder || vg3.isAny();
|
|
1618
|
+
this._encoder = init.encoder || init.base?._encoder || vg3.isAny();
|
|
1619
|
+
}
|
|
1620
|
+
_getDecoder() {
|
|
1621
|
+
return this._decoder;
|
|
1622
|
+
}
|
|
1623
|
+
_getEncoder() {
|
|
1624
|
+
return this._encoder;
|
|
1625
|
+
}
|
|
1626
|
+
exportSchema() {
|
|
1627
|
+
const out = super.exportSchema();
|
|
1628
|
+
return out;
|
|
1629
|
+
}
|
|
1630
|
+
};
|
|
1631
|
+
var SimpleType2 = /* @__PURE__ */ __name(function(...args) {
|
|
1632
|
+
if (this) {
|
|
1633
|
+
const [document, init] = args;
|
|
1634
|
+
merge4(this, new SimpleTypeClass(document, init), { descriptor: true });
|
|
1635
|
+
return;
|
|
1636
|
+
}
|
|
1637
|
+
const [options] = args;
|
|
1638
|
+
return function(target) {
|
|
1639
|
+
let name = options?.name || target.name.match(TYPENAME_PATTERN)?.[1] || target.name;
|
|
1640
|
+
name = name.charAt(0).toLowerCase() + name.substring(1);
|
|
1641
|
+
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target) || {};
|
|
1642
|
+
metadata.kind = opra_schema_ns_exports.SimpleType.Kind;
|
|
1643
|
+
metadata.name = name;
|
|
1644
|
+
if (options)
|
|
1645
|
+
Object.assign(metadata, omit3(options, ["kind", "name"]));
|
|
1646
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
1647
|
+
};
|
|
1648
|
+
}, "SimpleType");
|
|
1649
|
+
SimpleType2.prototype = SimpleTypeClass.prototype;
|
|
1650
|
+
|
|
1516
1651
|
// ../../build/common/esm/document/data-type/builtin/any.type.js
|
|
1517
|
-
var AnyType =
|
|
1518
|
-
|
|
1652
|
+
var AnyType = class AnyType2 {
|
|
1653
|
+
static {
|
|
1654
|
+
__name(this, "AnyType");
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1519
1657
|
AnyType = __decorate([
|
|
1520
1658
|
SimpleType2({
|
|
1521
|
-
description: "
|
|
1522
|
-
ctor: Object
|
|
1659
|
+
description: "Represents any value"
|
|
1523
1660
|
})
|
|
1524
1661
|
], AnyType);
|
|
1525
1662
|
|
|
1526
1663
|
// ../../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");
|
|
1542
|
-
}
|
|
1543
|
-
coerce(v) {
|
|
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)}..."`);
|
|
1664
|
+
import { isBase64 } from "valgen";
|
|
1665
|
+
var Base64Type = class Base64Type2 {
|
|
1666
|
+
static {
|
|
1667
|
+
__name(this, "Base64Type");
|
|
1551
1668
|
}
|
|
1552
|
-
}
|
|
1669
|
+
};
|
|
1553
1670
|
Base64Type = __decorate([
|
|
1554
1671
|
SimpleType2({
|
|
1555
1672
|
description: "A stream of bytes, base64 encoded",
|
|
1556
|
-
|
|
1673
|
+
decoder: isBase64(),
|
|
1674
|
+
encoder: isBase64()
|
|
1557
1675
|
})
|
|
1558
1676
|
], Base64Type);
|
|
1559
1677
|
|
|
1560
1678
|
// ../../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;
|
|
1679
|
+
import { isBigint, isString, pipe } from "valgen";
|
|
1680
|
+
var BigintType = class BigintType2 {
|
|
1681
|
+
static {
|
|
1682
|
+
__name(this, "BigintType");
|
|
1572
1683
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
}
|
|
1576
|
-
validate(v) {
|
|
1577
|
-
if (!(typeof v === "number" && !isNaN(v) || typeof v === "bigint"))
|
|
1578
|
-
throw new TypeError(`Invalid number value "${v}"`);
|
|
1579
|
-
}
|
|
1580
|
-
}, "BigIntType");
|
|
1581
|
-
BigIntType = __decorate([
|
|
1684
|
+
};
|
|
1685
|
+
BigintType = __decorate([
|
|
1582
1686
|
SimpleType2({
|
|
1583
|
-
name: "bigint",
|
|
1584
1687
|
description: "BigInt number",
|
|
1585
|
-
|
|
1688
|
+
decoder: isBigint(),
|
|
1689
|
+
encoder: pipe(isBigint(), isString())
|
|
1586
1690
|
})
|
|
1587
|
-
],
|
|
1691
|
+
], BigintType);
|
|
1588
1692
|
|
|
1589
1693
|
// ../../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);
|
|
1601
|
-
}
|
|
1602
|
-
coerce(v) {
|
|
1603
|
-
return this.decode(v);
|
|
1694
|
+
import { isBoolean } from "valgen";
|
|
1695
|
+
var BooleanType = class BooleanType2 {
|
|
1696
|
+
static {
|
|
1697
|
+
__name(this, "BooleanType");
|
|
1604
1698
|
}
|
|
1605
|
-
}
|
|
1699
|
+
};
|
|
1606
1700
|
BooleanType = __decorate([
|
|
1607
1701
|
SimpleType2({
|
|
1608
1702
|
description: "Simple true/false value",
|
|
1609
|
-
|
|
1703
|
+
decoder: isBoolean(),
|
|
1704
|
+
encoder: isBoolean()
|
|
1610
1705
|
})
|
|
1611
1706
|
], BooleanType);
|
|
1612
1707
|
|
|
1613
|
-
// ../../build/common/esm/document/data-type/builtin/
|
|
1614
|
-
import
|
|
1615
|
-
var
|
|
1616
|
-
|
|
1617
|
-
this
|
|
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);
|
|
1708
|
+
// ../../build/common/esm/document/data-type/builtin/date.type.js
|
|
1709
|
+
import { isDate, isDateString } from "valgen";
|
|
1710
|
+
var DateType = class DateType2 {
|
|
1711
|
+
static {
|
|
1712
|
+
__name(this, "DateType");
|
|
1629
1713
|
}
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1714
|
+
};
|
|
1715
|
+
DateType = __decorate([
|
|
1632
1716
|
SimpleType2({
|
|
1633
|
-
description: "
|
|
1634
|
-
|
|
1717
|
+
description: "Date only string, for example, 2021-04-18",
|
|
1718
|
+
decoder: isDate({
|
|
1719
|
+
format: [
|
|
1720
|
+
"YYYY-MM-DD",
|
|
1721
|
+
"YYYY",
|
|
1722
|
+
"YYYY-MM-DDTHH:mm:ss",
|
|
1723
|
+
"YYYY-MM-DDTHH:mm",
|
|
1724
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
1725
|
+
"YYYY-MM-DD HH:mm"
|
|
1726
|
+
]
|
|
1727
|
+
}),
|
|
1728
|
+
encoder: isDateString({ format: "YYYY-MM-DD" })
|
|
1635
1729
|
})
|
|
1636
|
-
],
|
|
1730
|
+
], DateType);
|
|
1637
1731
|
|
|
1638
|
-
// ../../build/common/esm/document/data-type/builtin/
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
this
|
|
1732
|
+
// ../../build/common/esm/document/data-type/builtin/uuid.type.js
|
|
1733
|
+
import { isUUID } from "valgen";
|
|
1734
|
+
var UuidType = class UuidType2 {
|
|
1735
|
+
static {
|
|
1736
|
+
__name(this, "UuidType");
|
|
1643
1737
|
}
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1738
|
+
};
|
|
1739
|
+
UuidType = __decorate([
|
|
1646
1740
|
SimpleType2({
|
|
1647
|
-
description: "
|
|
1741
|
+
description: "A Universal Unique Identifier (UUID) value",
|
|
1742
|
+
decoder: isUUID(),
|
|
1743
|
+
encoder: isUUID()
|
|
1648
1744
|
})
|
|
1649
|
-
],
|
|
1745
|
+
], UuidType);
|
|
1650
1746
|
|
|
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);
|
|
1747
|
+
// ../../build/common/esm/document/data-type/builtin/integer.type.js
|
|
1748
|
+
import { isInteger } from "valgen";
|
|
1749
|
+
var IntegerType = class IntegerType2 {
|
|
1750
|
+
static {
|
|
1751
|
+
__name(this, "IntegerType");
|
|
1665
1752
|
}
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1753
|
+
};
|
|
1754
|
+
IntegerType = __decorate([
|
|
1668
1755
|
SimpleType2({
|
|
1669
|
-
description: "
|
|
1670
|
-
|
|
1756
|
+
description: "An integer number",
|
|
1757
|
+
decoder: isInteger(),
|
|
1758
|
+
encoder: isInteger()
|
|
1671
1759
|
})
|
|
1672
|
-
],
|
|
1760
|
+
], IntegerType);
|
|
1673
1761
|
|
|
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}"`);
|
|
1762
|
+
// ../../build/common/esm/document/data-type/builtin/null.type.js
|
|
1763
|
+
import { isNull } from "valgen";
|
|
1764
|
+
var NullType = class NullType2 {
|
|
1765
|
+
static {
|
|
1766
|
+
__name(this, "NullType");
|
|
1694
1767
|
}
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1768
|
+
};
|
|
1769
|
+
NullType = __decorate([
|
|
1697
1770
|
SimpleType2({
|
|
1698
|
-
description: "A
|
|
1771
|
+
description: "A Null value",
|
|
1772
|
+
decoder: isNull(),
|
|
1773
|
+
encoder: isNull()
|
|
1699
1774
|
})
|
|
1700
|
-
],
|
|
1701
|
-
|
|
1702
|
-
// ../../build/common/esm/document/data-type/builtin/integer.type.js
|
|
1703
|
-
import { toInt } from "putil-varhelpers";
|
|
1775
|
+
], NullType);
|
|
1704
1776
|
|
|
1705
1777
|
// ../../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}"`);
|
|
1778
|
+
import { isNumber } from "valgen";
|
|
1779
|
+
var NumberType = class NumberType2 {
|
|
1780
|
+
static {
|
|
1781
|
+
__name(this, "NumberType");
|
|
1725
1782
|
}
|
|
1726
|
-
}
|
|
1783
|
+
};
|
|
1727
1784
|
NumberType = __decorate([
|
|
1728
1785
|
SimpleType2({
|
|
1729
1786
|
description: "Both Integer as well as Floating-Point numbers",
|
|
1730
|
-
|
|
1787
|
+
decoder: isNumber(),
|
|
1788
|
+
encoder: isNumber()
|
|
1731
1789
|
})
|
|
1732
1790
|
], NumberType);
|
|
1733
1791
|
|
|
1734
|
-
// ../../build/common/esm/document/data-type/builtin/integer.type.js
|
|
1735
|
-
var IntegerType = /* @__PURE__ */ __name(class IntegerType2 extends NumberType {
|
|
1736
|
-
decode(v) {
|
|
1737
|
-
if (v == null)
|
|
1738
|
-
return v;
|
|
1739
|
-
return toInt(super.decode(v));
|
|
1740
|
-
}
|
|
1741
|
-
encode(v) {
|
|
1742
|
-
if (v == null)
|
|
1743
|
-
return v;
|
|
1744
|
-
return toInt(super.encode(v));
|
|
1745
|
-
}
|
|
1746
|
-
coerce(v) {
|
|
1747
|
-
return this.decode(v);
|
|
1748
|
-
}
|
|
1749
|
-
}, "IntegerType");
|
|
1750
|
-
IntegerType = __decorate([
|
|
1751
|
-
SimpleType2({
|
|
1752
|
-
description: "An integer number"
|
|
1753
|
-
})
|
|
1754
|
-
], IntegerType);
|
|
1755
|
-
|
|
1756
1792
|
// ../../build/common/esm/document/data-type/builtin/object.type.js
|
|
1757
|
-
var ObjectType =
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
return v;
|
|
1761
|
-
return typeof v === "object" ? v : {};
|
|
1793
|
+
var ObjectType = class ObjectType2 {
|
|
1794
|
+
static {
|
|
1795
|
+
__name(this, "ObjectType");
|
|
1762
1796
|
}
|
|
1763
|
-
}
|
|
1797
|
+
};
|
|
1764
1798
|
ObjectType = __decorate([
|
|
1765
1799
|
ComplexType2({
|
|
1766
1800
|
name: "object",
|
|
1767
1801
|
description: "A non modelled object",
|
|
1768
|
-
additionalFields: true
|
|
1802
|
+
additionalFields: true,
|
|
1803
|
+
ctor: Object
|
|
1769
1804
|
})
|
|
1770
1805
|
], ObjectType);
|
|
1771
1806
|
|
|
1807
|
+
// ../../build/common/esm/document/data-type/builtin/object-id.type.js
|
|
1808
|
+
import { isObjectId, isString as isString2, pipe as pipe2 } from "valgen";
|
|
1809
|
+
var ObjectIdType = class ObjectIdType2 {
|
|
1810
|
+
static {
|
|
1811
|
+
__name(this, "ObjectIdType");
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1814
|
+
ObjectIdType = __decorate([
|
|
1815
|
+
SimpleType2({
|
|
1816
|
+
description: "A MongoDB ObjectID value",
|
|
1817
|
+
decoder: isObjectId(),
|
|
1818
|
+
encoder: pipe2(isObjectId(), isString2())
|
|
1819
|
+
})
|
|
1820
|
+
], ObjectIdType);
|
|
1821
|
+
|
|
1822
|
+
// ../../build/common/esm/document/data-type/builtin/string.type.js
|
|
1823
|
+
import { isString as isString3 } from "valgen";
|
|
1824
|
+
var StringType = class StringType2 {
|
|
1825
|
+
static {
|
|
1826
|
+
__name(this, "StringType");
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1829
|
+
StringType = __decorate([
|
|
1830
|
+
SimpleType2({
|
|
1831
|
+
description: "A sequence of characters",
|
|
1832
|
+
decoder: isString3(),
|
|
1833
|
+
encoder: isString3()
|
|
1834
|
+
})
|
|
1835
|
+
], StringType);
|
|
1836
|
+
|
|
1837
|
+
// ../../build/common/esm/document/data-type/builtin/time.type.js
|
|
1838
|
+
import { isDateString as isDateString2 } from "valgen";
|
|
1839
|
+
var TimeType = class TimeType2 {
|
|
1840
|
+
static {
|
|
1841
|
+
__name(this, "TimeType");
|
|
1842
|
+
}
|
|
1843
|
+
};
|
|
1844
|
+
TimeType = __decorate([
|
|
1845
|
+
SimpleType2({
|
|
1846
|
+
description: "Time string in 24h format, for example, 18:23:00",
|
|
1847
|
+
decoder: isDateString2({
|
|
1848
|
+
format: ["HH:mm:ss", "HH:mm"],
|
|
1849
|
+
onFail: () => "{{label}} is not a valid time"
|
|
1850
|
+
}),
|
|
1851
|
+
encoder: isDateString2({
|
|
1852
|
+
format: ["HH:mm:ss", "HH:mm"],
|
|
1853
|
+
onFail: () => "{{label}} is not a valid time"
|
|
1854
|
+
})
|
|
1855
|
+
})
|
|
1856
|
+
], TimeType);
|
|
1857
|
+
|
|
1858
|
+
// ../../build/common/esm/document/data-type/builtin/timestamp.type.js
|
|
1859
|
+
import { isDate as isDate2, isDateString as isDateString3 } from "valgen";
|
|
1860
|
+
var TimestampType = class TimestampType2 {
|
|
1861
|
+
static {
|
|
1862
|
+
__name(this, "TimestampType");
|
|
1863
|
+
}
|
|
1864
|
+
};
|
|
1865
|
+
TimestampType = __decorate([
|
|
1866
|
+
SimpleType2({
|
|
1867
|
+
description: "Timestamp, for example, 2021-04-18T09:12:53",
|
|
1868
|
+
decoder: isDate2({
|
|
1869
|
+
format: ["YYYY-MM-DDTHH:mm:ss", "YYYY-MM-DD HH:mm:ss", "YYYY-MM-DD", "YYYY"]
|
|
1870
|
+
}),
|
|
1871
|
+
encoder: isDateString3({ format: "YYYY-MM-DDTHH:mm:ss" })
|
|
1872
|
+
})
|
|
1873
|
+
], TimestampType);
|
|
1874
|
+
|
|
1772
1875
|
// ../../build/common/esm/document/factory/create-document.js
|
|
1773
1876
|
async function createDocument(init, options) {
|
|
1774
1877
|
this.document.url = init.url;
|
|
@@ -1777,6 +1880,8 @@ async function createDocument(init, options) {
|
|
|
1777
1880
|
if (!options?.noBuiltinTypes) {
|
|
1778
1881
|
const builtinDocument = await this.createBuiltinTypeDocument();
|
|
1779
1882
|
this.document.references.set("Opra", builtinDocument);
|
|
1883
|
+
for (const [c, s] of Object.getPrototypeOf(this).constructor.designTypeMap.entries())
|
|
1884
|
+
this.document._designTypeMap.set(c, s);
|
|
1780
1885
|
}
|
|
1781
1886
|
if (init.references)
|
|
1782
1887
|
await this.addReferences(init.references);
|
|
@@ -1815,9 +1920,9 @@ async function createDocumentFromUrl(url) {
|
|
|
1815
1920
|
__name(createDocumentFromUrl, "createDocumentFromUrl");
|
|
1816
1921
|
async function createBuiltinTypeDocument() {
|
|
1817
1922
|
const init = {
|
|
1818
|
-
version:
|
|
1923
|
+
version: opra_schema_ns_exports.SpecVersion,
|
|
1819
1924
|
info: {
|
|
1820
|
-
version:
|
|
1925
|
+
version: opra_schema_ns_exports.SpecVersion,
|
|
1821
1926
|
title: "Opra built-in types",
|
|
1822
1927
|
contact: [
|
|
1823
1928
|
{
|
|
@@ -1832,14 +1937,18 @@ async function createBuiltinTypeDocument() {
|
|
|
1832
1937
|
types: [
|
|
1833
1938
|
AnyType,
|
|
1834
1939
|
Base64Type,
|
|
1835
|
-
|
|
1940
|
+
BigintType,
|
|
1836
1941
|
BooleanType,
|
|
1837
1942
|
DateType,
|
|
1838
|
-
|
|
1943
|
+
UuidType,
|
|
1839
1944
|
IntegerType,
|
|
1945
|
+
NullType,
|
|
1840
1946
|
NumberType,
|
|
1841
1947
|
ObjectType,
|
|
1842
|
-
|
|
1948
|
+
ObjectIdType,
|
|
1949
|
+
StringType,
|
|
1950
|
+
TimeType,
|
|
1951
|
+
TimestampType
|
|
1843
1952
|
]
|
|
1844
1953
|
};
|
|
1845
1954
|
const factoryClass = Object.getPrototypeOf(this).constructor;
|
|
@@ -1858,13 +1967,13 @@ async function importResourceClass(thunk) {
|
|
|
1858
1967
|
return cached;
|
|
1859
1968
|
const ctor = typeof thunk === "function" ? thunk : Object.getPrototypeOf(thunk).constructor;
|
|
1860
1969
|
let metadata = Reflect.getMetadata(METADATA_KEY, ctor);
|
|
1861
|
-
if (!metadata &&
|
|
1970
|
+
if (!metadata && opra_schema_ns_exports.isResource(metadata))
|
|
1862
1971
|
throw new TypeError(`Class "${ctor.name}" doesn't have a valid Resource metadata`);
|
|
1863
1972
|
metadata = cloneObject(metadata);
|
|
1864
1973
|
const schema = cloneObject(metadata);
|
|
1865
1974
|
schema.controller = controller;
|
|
1866
1975
|
cache.set(thunk, schema);
|
|
1867
|
-
if (
|
|
1976
|
+
if (opra_schema_ns_exports.isSingleton(schema) || opra_schema_ns_exports.isCollection(schema)) {
|
|
1868
1977
|
if (!document.getDataType(metadata.type, true) && typeof metadata.type === "function") {
|
|
1869
1978
|
await this.importTypeClass(metadata.type);
|
|
1870
1979
|
await this.processTypes();
|
|
@@ -1874,9 +1983,9 @@ async function importResourceClass(thunk) {
|
|
|
1874
1983
|
}
|
|
1875
1984
|
document.getComplexType(schema.type);
|
|
1876
1985
|
}
|
|
1877
|
-
if (
|
|
1986
|
+
if (opra_schema_ns_exports.isSingleton(schema))
|
|
1878
1987
|
await this.extractSingletonSchema(schema, ctor, metadata, controller);
|
|
1879
|
-
if (
|
|
1988
|
+
if (opra_schema_ns_exports.isCollection(schema))
|
|
1880
1989
|
await this.extractCollectionSchema(schema, ctor, metadata, controller);
|
|
1881
1990
|
resourceQueue.set(metadata.name, schema);
|
|
1882
1991
|
}
|
|
@@ -1889,6 +1998,7 @@ async function extractCollectionSchema(target, ctor, metadata, controller) {
|
|
|
1889
1998
|
__name(extractCollectionSchema, "extractCollectionSchema");
|
|
1890
1999
|
|
|
1891
2000
|
// ../../build/common/esm/document/factory/import-type-class.js
|
|
2001
|
+
import { validator } from "valgen";
|
|
1892
2002
|
async function importTypeClass(typeThunk) {
|
|
1893
2003
|
const { document, typeQueue, cache } = this;
|
|
1894
2004
|
const thunk = await resolveThunk(typeThunk);
|
|
@@ -1899,7 +2009,7 @@ async function importTypeClass(typeThunk) {
|
|
|
1899
2009
|
if (dt && dt.name)
|
|
1900
2010
|
return dt.name;
|
|
1901
2011
|
const metadata = Reflect.getMetadata(METADATA_KEY, thunk);
|
|
1902
|
-
if (!(metadata &&
|
|
2012
|
+
if (!(metadata && opra_schema_ns_exports.isDataType(metadata))) {
|
|
1903
2013
|
if (isConstructor(thunk))
|
|
1904
2014
|
throw new TypeError(`Class "${thunk.name}" doesn't have a valid DataType metadata`);
|
|
1905
2015
|
throw new TypeError(`No EnumType metadata found for object ${JSON.stringify(thunk).substring(0, 20)}...`);
|
|
@@ -1915,20 +2025,20 @@ async function importTypeClass(typeThunk) {
|
|
|
1915
2025
|
}
|
|
1916
2026
|
if (isConstructor(thunk)) {
|
|
1917
2027
|
const ctor = thunk;
|
|
1918
|
-
if (
|
|
2028
|
+
if (opra_schema_ns_exports.isSimpleType(schema))
|
|
1919
2029
|
await this.extractSimpleTypeSchema(schema, ctor, metadata);
|
|
1920
|
-
else if (
|
|
2030
|
+
else if (opra_schema_ns_exports.isComplexType(schema))
|
|
1921
2031
|
await this.extractComplexTypeSchema(schema, ctor, metadata);
|
|
1922
|
-
else if (
|
|
2032
|
+
else if (opra_schema_ns_exports.isMappedType(schema))
|
|
1923
2033
|
await this.extractMappedTypeSchema(schema, ctor, metadata);
|
|
1924
|
-
else if (
|
|
2034
|
+
else if (opra_schema_ns_exports.isUnionType(schema))
|
|
1925
2035
|
await this.extractUnionTypeSchema(schema, ctor, metadata);
|
|
1926
2036
|
else
|
|
1927
2037
|
throw new TypeError(`Class "${ctor.name}" doesn't have a valid DataType metadata`);
|
|
1928
2038
|
return result;
|
|
1929
2039
|
}
|
|
1930
2040
|
const enumObject = thunk;
|
|
1931
|
-
if (
|
|
2041
|
+
if (opra_schema_ns_exports.isEnumType(schema)) {
|
|
1932
2042
|
let baseType;
|
|
1933
2043
|
if (metadata.base && Reflect.hasMetadata(METADATA_KEY, metadata.base)) {
|
|
1934
2044
|
baseType = await this.importTypeClass(metadata.base);
|
|
@@ -1944,14 +2054,17 @@ async function extractSimpleTypeSchema(target, ctor, metadata) {
|
|
|
1944
2054
|
const baseClass = Object.getPrototypeOf(ctor.prototype).constructor;
|
|
1945
2055
|
if (Reflect.hasMetadata(METADATA_KEY, baseClass))
|
|
1946
2056
|
target.base = await this.importTypeClass(baseClass);
|
|
1947
|
-
|
|
2057
|
+
if (typeof ctor.prototype.decode === "function")
|
|
2058
|
+
target.decoder = validator(metadata.name, ctor.prototype.decode);
|
|
2059
|
+
if (typeof ctor.prototype.encode === "function")
|
|
2060
|
+
target.encoder = validator(metadata.name, ctor.prototype.encode);
|
|
1948
2061
|
}
|
|
1949
2062
|
__name(extractSimpleTypeSchema, "extractSimpleTypeSchema");
|
|
1950
2063
|
async function extractComplexTypeSchema(target, ctor, metadata) {
|
|
1951
2064
|
const baseClass = Object.getPrototypeOf(ctor.prototype).constructor;
|
|
1952
2065
|
if (Reflect.hasMetadata(METADATA_KEY, baseClass))
|
|
1953
2066
|
target.base = await this.importTypeClass(baseClass);
|
|
1954
|
-
target.ctor = ctor;
|
|
2067
|
+
target.ctor = target.ctor || ctor;
|
|
1955
2068
|
if (metadata.fields) {
|
|
1956
2069
|
const fields = target.fields = {};
|
|
1957
2070
|
for (const [elemName, elemMeta] of Object.entries(metadata.fields)) {
|
|
@@ -1964,8 +2077,13 @@ async function extractComplexTypeSchema(target, ctor, metadata) {
|
|
|
1964
2077
|
};
|
|
1965
2078
|
if (elemMeta.enum)
|
|
1966
2079
|
elemSchema.type = await this.importTypeClass(elemMeta.enum);
|
|
1967
|
-
if (!elemSchema.type && elemMeta.designType)
|
|
1968
|
-
|
|
2080
|
+
if (!elemSchema.type && elemMeta.designType) {
|
|
2081
|
+
const mappingType = this.document.getDataType(elemMeta.designType, true);
|
|
2082
|
+
if (mappingType)
|
|
2083
|
+
elemSchema.type = mappingType.name;
|
|
2084
|
+
else
|
|
2085
|
+
elemSchema.type = await this.importTypeClass(elemMeta.designType);
|
|
2086
|
+
}
|
|
1969
2087
|
await this.extractFieldSchema(elemSchema, ctor, elemMeta, elemName);
|
|
1970
2088
|
if (elemMeta.enum)
|
|
1971
2089
|
elemSchema.type = await this.importTypeClass(elemMeta.enum);
|
|
@@ -2002,7 +2120,7 @@ __name(extractFieldSchema, "extractFieldSchema");
|
|
|
2002
2120
|
|
|
2003
2121
|
// ../../build/common/esm/document/resource/collection.js
|
|
2004
2122
|
import omit4 from "lodash.omit";
|
|
2005
|
-
import
|
|
2123
|
+
import merge5 from "putil-merge";
|
|
2006
2124
|
|
|
2007
2125
|
// ../../build/common/esm/filter/opra-filter.ns.js
|
|
2008
2126
|
var opra_filter_ns_exports = {};
|
|
@@ -2053,24 +2171,33 @@ __export(opra_filter_ns_exports, {
|
|
|
2053
2171
|
|
|
2054
2172
|
// ../../build/common/esm/filter/ast/abstract/ast.js
|
|
2055
2173
|
var Ast = class {
|
|
2174
|
+
static {
|
|
2175
|
+
__name(this, "Ast");
|
|
2176
|
+
}
|
|
2056
2177
|
constructor() {
|
|
2057
2178
|
this.kind = Object.getPrototypeOf(this).constructor.name;
|
|
2058
2179
|
}
|
|
2059
2180
|
};
|
|
2060
|
-
__name(Ast, "Ast");
|
|
2061
2181
|
|
|
2062
2182
|
// ../../build/common/esm/filter/ast/abstract/expression.js
|
|
2063
2183
|
var Expression = class extends Ast {
|
|
2184
|
+
static {
|
|
2185
|
+
__name(this, "Expression");
|
|
2186
|
+
}
|
|
2064
2187
|
};
|
|
2065
|
-
__name(Expression, "Expression");
|
|
2066
2188
|
|
|
2067
2189
|
// ../../build/common/esm/filter/ast/abstract/term.js
|
|
2068
2190
|
var Term = class extends Expression {
|
|
2191
|
+
static {
|
|
2192
|
+
__name(this, "Term");
|
|
2193
|
+
}
|
|
2069
2194
|
};
|
|
2070
|
-
__name(Term, "Term");
|
|
2071
2195
|
|
|
2072
2196
|
// ../../build/common/esm/filter/ast/abstract/literal.js
|
|
2073
2197
|
var Literal = class extends Term {
|
|
2198
|
+
static {
|
|
2199
|
+
__name(this, "Literal");
|
|
2200
|
+
}
|
|
2074
2201
|
constructor(value) {
|
|
2075
2202
|
super();
|
|
2076
2203
|
this.value = value;
|
|
@@ -2079,10 +2206,12 @@ var Literal = class extends Term {
|
|
|
2079
2206
|
return "" + this.value;
|
|
2080
2207
|
}
|
|
2081
2208
|
};
|
|
2082
|
-
__name(Literal, "Literal");
|
|
2083
2209
|
|
|
2084
2210
|
// ../../build/common/esm/filter/ast/expressions/arithmetic-expression.js
|
|
2085
2211
|
var ArithmeticExpression = class extends Expression {
|
|
2212
|
+
static {
|
|
2213
|
+
__name(this, "ArithmeticExpression");
|
|
2214
|
+
}
|
|
2086
2215
|
constructor() {
|
|
2087
2216
|
super();
|
|
2088
2217
|
this.items = [];
|
|
@@ -2098,16 +2227,20 @@ var ArithmeticExpression = class extends Expression {
|
|
|
2098
2227
|
return this.items.map((child, i) => (i > 0 ? child.op : "") + child.expression).join("");
|
|
2099
2228
|
}
|
|
2100
2229
|
};
|
|
2101
|
-
__name(ArithmeticExpression, "ArithmeticExpression");
|
|
2102
2230
|
var ArithmeticExpressionItem = class {
|
|
2231
|
+
static {
|
|
2232
|
+
__name(this, "ArithmeticExpressionItem");
|
|
2233
|
+
}
|
|
2103
2234
|
constructor(o) {
|
|
2104
2235
|
Object.assign(this, o);
|
|
2105
2236
|
}
|
|
2106
2237
|
};
|
|
2107
|
-
__name(ArithmeticExpressionItem, "ArithmeticExpressionItem");
|
|
2108
2238
|
|
|
2109
2239
|
// ../../build/common/esm/filter/ast/expressions/array-expression.js
|
|
2110
2240
|
var ArrayExpression = class extends Term {
|
|
2241
|
+
static {
|
|
2242
|
+
__name(this, "ArrayExpression");
|
|
2243
|
+
}
|
|
2111
2244
|
constructor(items) {
|
|
2112
2245
|
super();
|
|
2113
2246
|
this.items = items;
|
|
@@ -2116,11 +2249,13 @@ var ArrayExpression = class extends Term {
|
|
|
2116
2249
|
return "[" + this.items.map((child) => "" + child).join(",") + "]";
|
|
2117
2250
|
}
|
|
2118
2251
|
};
|
|
2119
|
-
__name(ArrayExpression, "ArrayExpression");
|
|
2120
2252
|
|
|
2121
2253
|
// ../../build/common/esm/filter/ast/expressions/comparison-expression.js
|
|
2122
2254
|
var WORD_PATTERN = /\w/;
|
|
2123
2255
|
var ComparisonExpression = class extends Expression {
|
|
2256
|
+
static {
|
|
2257
|
+
__name(this, "ComparisonExpression");
|
|
2258
|
+
}
|
|
2124
2259
|
constructor(o) {
|
|
2125
2260
|
super();
|
|
2126
2261
|
Object.assign(this, o);
|
|
@@ -2129,10 +2264,12 @@ var ComparisonExpression = class extends Expression {
|
|
|
2129
2264
|
return `${this.left}${WORD_PATTERN.test(this.op) ? " " + this.op + " " : this.op}${this.right}`;
|
|
2130
2265
|
}
|
|
2131
2266
|
};
|
|
2132
|
-
__name(ComparisonExpression, "ComparisonExpression");
|
|
2133
2267
|
|
|
2134
2268
|
// ../../build/common/esm/filter/ast/expressions/logical-expression.js
|
|
2135
2269
|
var LogicalExpression = class extends Expression {
|
|
2270
|
+
static {
|
|
2271
|
+
__name(this, "LogicalExpression");
|
|
2272
|
+
}
|
|
2136
2273
|
constructor(o) {
|
|
2137
2274
|
super();
|
|
2138
2275
|
Object.assign(this, o);
|
|
@@ -2145,10 +2282,12 @@ var LogicalExpression = class extends Expression {
|
|
|
2145
2282
|
return this.items.map((child) => "" + child).join(" " + this.op + " ");
|
|
2146
2283
|
}
|
|
2147
2284
|
};
|
|
2148
|
-
__name(LogicalExpression, "LogicalExpression");
|
|
2149
2285
|
|
|
2150
2286
|
// ../../build/common/esm/filter/ast/expressions/parenthesized-expression.js
|
|
2151
2287
|
var ParenthesizedExpression = class extends Expression {
|
|
2288
|
+
static {
|
|
2289
|
+
__name(this, "ParenthesizedExpression");
|
|
2290
|
+
}
|
|
2152
2291
|
constructor(expression) {
|
|
2153
2292
|
super();
|
|
2154
2293
|
this.expression = expression;
|
|
@@ -2157,10 +2296,12 @@ var ParenthesizedExpression = class extends Expression {
|
|
|
2157
2296
|
return `(${this.expression})`;
|
|
2158
2297
|
}
|
|
2159
2298
|
};
|
|
2160
|
-
__name(ParenthesizedExpression, "ParenthesizedExpression");
|
|
2161
2299
|
|
|
2162
2300
|
// ../../build/common/esm/filter/ast/expressions/negative-expression.js
|
|
2163
2301
|
var NegativeExpression = class extends Expression {
|
|
2302
|
+
static {
|
|
2303
|
+
__name(this, "NegativeExpression");
|
|
2304
|
+
}
|
|
2164
2305
|
constructor(expression) {
|
|
2165
2306
|
super();
|
|
2166
2307
|
this.expression = expression;
|
|
@@ -2169,33 +2310,45 @@ var NegativeExpression = class extends Expression {
|
|
|
2169
2310
|
return `(${this.expression})`;
|
|
2170
2311
|
}
|
|
2171
2312
|
};
|
|
2172
|
-
__name(NegativeExpression, "NegativeExpression");
|
|
2173
2313
|
|
|
2174
2314
|
// ../../build/common/esm/filter/ast/terms/boolean-literal.js
|
|
2175
2315
|
var BooleanLiteral = class extends Literal {
|
|
2316
|
+
static {
|
|
2317
|
+
__name(this, "BooleanLiteral");
|
|
2318
|
+
}
|
|
2176
2319
|
constructor(value) {
|
|
2177
2320
|
super(value);
|
|
2178
2321
|
}
|
|
2179
2322
|
};
|
|
2180
|
-
__name(BooleanLiteral, "BooleanLiteral");
|
|
2181
2323
|
|
|
2182
2324
|
// ../../build/common/esm/filter/ast/terms/date-literal.js
|
|
2183
2325
|
import { toDateDef } from "putil-varhelpers";
|
|
2184
2326
|
|
|
2185
2327
|
// ../../build/common/esm/filter/errors.js
|
|
2186
2328
|
var SyntaxError = class extends TypeError {
|
|
2329
|
+
static {
|
|
2330
|
+
__name(this, "SyntaxError");
|
|
2331
|
+
}
|
|
2187
2332
|
};
|
|
2188
|
-
|
|
2189
|
-
|
|
2333
|
+
var ValidationError2 = class extends TypeError {
|
|
2334
|
+
static {
|
|
2335
|
+
__name(this, "ValidationError");
|
|
2336
|
+
}
|
|
2337
|
+
constructor(message) {
|
|
2338
|
+
super(typeof message === "string" ? message : message?.message);
|
|
2339
|
+
if (typeof message === "object")
|
|
2340
|
+
Object.assign(this, message);
|
|
2341
|
+
}
|
|
2190
2342
|
};
|
|
2191
|
-
__name(ValidationError, "ValidationError");
|
|
2192
2343
|
var FilterParseError = class extends Error {
|
|
2344
|
+
static {
|
|
2345
|
+
__name(this, "FilterParseError");
|
|
2346
|
+
}
|
|
2193
2347
|
constructor(message, args) {
|
|
2194
2348
|
super(message);
|
|
2195
2349
|
Object.assign(this, args);
|
|
2196
2350
|
}
|
|
2197
2351
|
};
|
|
2198
|
-
__name(FilterParseError, "FilterParseError");
|
|
2199
2352
|
|
|
2200
2353
|
// ../../build/common/esm/filter/utils.js
|
|
2201
2354
|
var quotesRegEx = /'/g;
|
|
@@ -2224,6 +2377,9 @@ __name(unquoteFilterString, "unquoteFilterString");
|
|
|
2224
2377
|
// ../../build/common/esm/filter/ast/terms/date-literal.js
|
|
2225
2378
|
var NullDate = /* @__PURE__ */ new Date(0);
|
|
2226
2379
|
var DateLiteral = class extends Literal {
|
|
2380
|
+
static {
|
|
2381
|
+
__name(this, "DateLiteral");
|
|
2382
|
+
}
|
|
2227
2383
|
constructor(value) {
|
|
2228
2384
|
super("");
|
|
2229
2385
|
if (value instanceof Date) {
|
|
@@ -2234,25 +2390,29 @@ var DateLiteral = class extends Literal {
|
|
|
2234
2390
|
this.value = value;
|
|
2235
2391
|
return;
|
|
2236
2392
|
}
|
|
2237
|
-
throw new
|
|
2393
|
+
throw new ValidationError2(`Invalid date value "${value}"`);
|
|
2238
2394
|
}
|
|
2239
2395
|
toString() {
|
|
2240
2396
|
return quoteFilterString(this.value);
|
|
2241
2397
|
}
|
|
2242
2398
|
};
|
|
2243
|
-
__name(DateLiteral, "DateLiteral");
|
|
2244
2399
|
|
|
2245
2400
|
// ../../build/common/esm/filter/ast/terms/null-literal.js
|
|
2246
2401
|
var NullLiteral = class extends Literal {
|
|
2402
|
+
static {
|
|
2403
|
+
__name(this, "NullLiteral");
|
|
2404
|
+
}
|
|
2247
2405
|
constructor() {
|
|
2248
2406
|
super(null);
|
|
2249
2407
|
this.value = null;
|
|
2250
2408
|
}
|
|
2251
2409
|
};
|
|
2252
|
-
__name(NullLiteral, "NullLiteral");
|
|
2253
2410
|
|
|
2254
2411
|
// ../../build/common/esm/filter/ast/terms/number-literal.js
|
|
2255
2412
|
var NumberLiteral = class extends Literal {
|
|
2413
|
+
static {
|
|
2414
|
+
__name(this, "NumberLiteral");
|
|
2415
|
+
}
|
|
2256
2416
|
constructor(value) {
|
|
2257
2417
|
super(0);
|
|
2258
2418
|
if (typeof value === "number" || typeof value === "bigint") {
|
|
@@ -2274,24 +2434,28 @@ var NumberLiteral = class extends Literal {
|
|
|
2274
2434
|
}
|
|
2275
2435
|
} catch {
|
|
2276
2436
|
}
|
|
2277
|
-
throw new
|
|
2437
|
+
throw new ValidationError2(`Invalid number literal ${value}`);
|
|
2278
2438
|
}
|
|
2279
2439
|
toString() {
|
|
2280
2440
|
return typeof this.value === "bigint" ? ("" + this.value).replace(/n$/, "") : "" + this.value;
|
|
2281
2441
|
}
|
|
2282
2442
|
};
|
|
2283
|
-
__name(NumberLiteral, "NumberLiteral");
|
|
2284
2443
|
|
|
2285
2444
|
// ../../build/common/esm/filter/ast/terms/qualified-identifier.js
|
|
2286
2445
|
var QualifiedIdentifier = class extends Literal {
|
|
2446
|
+
static {
|
|
2447
|
+
__name(this, "QualifiedIdentifier");
|
|
2448
|
+
}
|
|
2287
2449
|
constructor(value) {
|
|
2288
2450
|
super("" + value);
|
|
2289
2451
|
}
|
|
2290
2452
|
};
|
|
2291
|
-
__name(QualifiedIdentifier, "QualifiedIdentifier");
|
|
2292
2453
|
|
|
2293
2454
|
// ../../build/common/esm/filter/ast/terms/string-literal.js
|
|
2294
2455
|
var StringLiteral = class extends Literal {
|
|
2456
|
+
static {
|
|
2457
|
+
__name(this, "StringLiteral");
|
|
2458
|
+
}
|
|
2295
2459
|
constructor(value) {
|
|
2296
2460
|
super("" + value);
|
|
2297
2461
|
}
|
|
@@ -2299,11 +2463,13 @@ var StringLiteral = class extends Literal {
|
|
|
2299
2463
|
return quoteFilterString(this.value);
|
|
2300
2464
|
}
|
|
2301
2465
|
};
|
|
2302
|
-
__name(StringLiteral, "StringLiteral");
|
|
2303
2466
|
|
|
2304
2467
|
// ../../build/common/esm/filter/ast/terms/time-literal.js
|
|
2305
2468
|
var TIME_PATTERN = /^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/;
|
|
2306
2469
|
var TimeLiteral = class extends Literal {
|
|
2470
|
+
static {
|
|
2471
|
+
__name(this, "TimeLiteral");
|
|
2472
|
+
}
|
|
2307
2473
|
constructor(value) {
|
|
2308
2474
|
super("");
|
|
2309
2475
|
if (value instanceof Date) {
|
|
@@ -2314,13 +2480,12 @@ var TimeLiteral = class extends Literal {
|
|
|
2314
2480
|
this.value = value;
|
|
2315
2481
|
return;
|
|
2316
2482
|
}
|
|
2317
|
-
throw new
|
|
2483
|
+
throw new ValidationError2(`Invalid time value "${value}"`);
|
|
2318
2484
|
}
|
|
2319
2485
|
toString() {
|
|
2320
2486
|
return quoteFilterString(this.value);
|
|
2321
2487
|
}
|
|
2322
2488
|
};
|
|
2323
|
-
__name(TimeLiteral, "TimeLiteral");
|
|
2324
2489
|
function pad(n) {
|
|
2325
2490
|
return n <= 9 ? "0" + n : "" + n;
|
|
2326
2491
|
}
|
|
@@ -2331,40 +2496,42 @@ import { CharStream, CommonTokenStream } from "@browsery/antlr4";
|
|
|
2331
2496
|
|
|
2332
2497
|
// ../../build/common/esm/filter/antlr/OpraFilterLexer.js
|
|
2333
2498
|
import { ATNDeserializer, DFA, Lexer, LexerATNSimulator, PredictionContextCache, Token } from "@browsery/antlr4";
|
|
2334
|
-
var OpraFilterLexer = class extends Lexer {
|
|
2499
|
+
var OpraFilterLexer = class _OpraFilterLexer extends Lexer {
|
|
2500
|
+
static {
|
|
2501
|
+
__name(this, "OpraFilterLexer");
|
|
2502
|
+
}
|
|
2335
2503
|
constructor(input) {
|
|
2336
2504
|
super(input);
|
|
2337
|
-
this._interp = new LexerATNSimulator(this,
|
|
2505
|
+
this._interp = new LexerATNSimulator(this, _OpraFilterLexer._ATN, _OpraFilterLexer.DecisionsToDFA, new PredictionContextCache());
|
|
2338
2506
|
}
|
|
2339
2507
|
get grammarFileName() {
|
|
2340
2508
|
return "OpraFilter.g4";
|
|
2341
2509
|
}
|
|
2342
2510
|
get literalNames() {
|
|
2343
|
-
return
|
|
2511
|
+
return _OpraFilterLexer.literalNames;
|
|
2344
2512
|
}
|
|
2345
2513
|
get symbolicNames() {
|
|
2346
|
-
return
|
|
2514
|
+
return _OpraFilterLexer.symbolicNames;
|
|
2347
2515
|
}
|
|
2348
2516
|
get ruleNames() {
|
|
2349
|
-
return
|
|
2517
|
+
return _OpraFilterLexer.ruleNames;
|
|
2350
2518
|
}
|
|
2351
2519
|
get serializedATN() {
|
|
2352
|
-
return
|
|
2520
|
+
return _OpraFilterLexer._serializedATN;
|
|
2353
2521
|
}
|
|
2354
2522
|
get channelNames() {
|
|
2355
|
-
return
|
|
2523
|
+
return _OpraFilterLexer.channelNames;
|
|
2356
2524
|
}
|
|
2357
2525
|
get modeNames() {
|
|
2358
|
-
return
|
|
2526
|
+
return _OpraFilterLexer.modeNames;
|
|
2359
2527
|
}
|
|
2360
2528
|
static get _ATN() {
|
|
2361
|
-
if (!
|
|
2362
|
-
|
|
2529
|
+
if (!_OpraFilterLexer.__ATN) {
|
|
2530
|
+
_OpraFilterLexer.__ATN = new ATNDeserializer().deserialize(_OpraFilterLexer._serializedATN);
|
|
2363
2531
|
}
|
|
2364
|
-
return
|
|
2532
|
+
return _OpraFilterLexer.__ATN;
|
|
2365
2533
|
}
|
|
2366
2534
|
};
|
|
2367
|
-
__name(OpraFilterLexer, "OpraFilterLexer");
|
|
2368
2535
|
OpraFilterLexer.T__0 = 1;
|
|
2369
2536
|
OpraFilterLexer.T__1 = 2;
|
|
2370
2537
|
OpraFilterLexer.T__2 = 3;
|
|
@@ -6401,43 +6568,47 @@ OpraFilterLexer._serializedATN = [
|
|
|
6401
6568
|
0
|
|
6402
6569
|
];
|
|
6403
6570
|
OpraFilterLexer.DecisionsToDFA = OpraFilterLexer._ATN.decisionToState.map((ds, index) => new DFA(ds, index));
|
|
6571
|
+
var OpraFilterLexer_default = OpraFilterLexer;
|
|
6404
6572
|
|
|
6405
6573
|
// ../../build/common/esm/filter/antlr/OpraFilterParser.js
|
|
6406
6574
|
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 {
|
|
6575
|
+
var OpraFilterParser = class _OpraFilterParser extends Parser {
|
|
6576
|
+
static {
|
|
6577
|
+
__name(this, "OpraFilterParser");
|
|
6578
|
+
}
|
|
6408
6579
|
get grammarFileName() {
|
|
6409
6580
|
return "OpraFilter.g4";
|
|
6410
6581
|
}
|
|
6411
6582
|
get literalNames() {
|
|
6412
|
-
return
|
|
6583
|
+
return _OpraFilterParser.literalNames;
|
|
6413
6584
|
}
|
|
6414
6585
|
get symbolicNames() {
|
|
6415
|
-
return
|
|
6586
|
+
return _OpraFilterParser.symbolicNames;
|
|
6416
6587
|
}
|
|
6417
6588
|
get ruleNames() {
|
|
6418
|
-
return
|
|
6589
|
+
return _OpraFilterParser.ruleNames;
|
|
6419
6590
|
}
|
|
6420
6591
|
get serializedATN() {
|
|
6421
|
-
return
|
|
6592
|
+
return _OpraFilterParser._serializedATN;
|
|
6422
6593
|
}
|
|
6423
6594
|
createFailedPredicateException(predicate, message) {
|
|
6424
6595
|
return new FailedPredicateException(this, predicate, message);
|
|
6425
6596
|
}
|
|
6426
6597
|
constructor(input) {
|
|
6427
6598
|
super(input);
|
|
6428
|
-
this._interp = new ParserATNSimulator(this,
|
|
6599
|
+
this._interp = new ParserATNSimulator(this, _OpraFilterParser._ATN, _OpraFilterParser.DecisionsToDFA, new PredictionContextCache2());
|
|
6429
6600
|
}
|
|
6430
6601
|
// @RuleVersion(0)
|
|
6431
6602
|
root() {
|
|
6432
6603
|
const localctx = new RootContext(this, this._ctx, this.state);
|
|
6433
|
-
this.enterRule(localctx, 0,
|
|
6604
|
+
this.enterRule(localctx, 0, _OpraFilterParser.RULE_root);
|
|
6434
6605
|
try {
|
|
6435
6606
|
this.enterOuterAlt(localctx, 1);
|
|
6436
6607
|
{
|
|
6437
6608
|
this.state = 34;
|
|
6438
6609
|
this.expression(0);
|
|
6439
6610
|
this.state = 35;
|
|
6440
|
-
this.match(
|
|
6611
|
+
this.match(_OpraFilterParser.EOF);
|
|
6441
6612
|
}
|
|
6442
6613
|
} catch (re) {
|
|
6443
6614
|
if (re instanceof RecognitionException) {
|
|
@@ -6462,7 +6633,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6462
6633
|
let localctx = new ExpressionContext(this, this._ctx, _parentState);
|
|
6463
6634
|
let _prevctx = localctx;
|
|
6464
6635
|
const _startState = 2;
|
|
6465
|
-
this.enterRecursionRule(localctx, 2,
|
|
6636
|
+
this.enterRecursionRule(localctx, 2, _OpraFilterParser.RULE_expression, _p);
|
|
6466
6637
|
let _la;
|
|
6467
6638
|
try {
|
|
6468
6639
|
let _alt;
|
|
@@ -6490,11 +6661,11 @@ var OpraFilterParser = class extends Parser {
|
|
|
6490
6661
|
this._ctx = localctx;
|
|
6491
6662
|
_prevctx = localctx;
|
|
6492
6663
|
this.state = 42;
|
|
6493
|
-
this.match(
|
|
6664
|
+
this.match(_OpraFilterParser.T__0);
|
|
6494
6665
|
this.state = 43;
|
|
6495
6666
|
this.parenthesizedItem();
|
|
6496
6667
|
this.state = 44;
|
|
6497
|
-
this.match(
|
|
6668
|
+
this.match(_OpraFilterParser.T__1);
|
|
6498
6669
|
}
|
|
6499
6670
|
break;
|
|
6500
6671
|
case 3:
|
|
@@ -6531,7 +6702,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6531
6702
|
{
|
|
6532
6703
|
{
|
|
6533
6704
|
localctx = new LogicalExpressionContext(this, new ExpressionContext(this, _parentctx, _parentState));
|
|
6534
|
-
this.pushNewRecursionContext(localctx, _startState,
|
|
6705
|
+
this.pushNewRecursionContext(localctx, _startState, _OpraFilterParser.RULE_expression);
|
|
6535
6706
|
this.state = 50;
|
|
6536
6707
|
if (!this.precpred(this._ctx, 3)) {
|
|
6537
6708
|
throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");
|
|
@@ -6564,7 +6735,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6564
6735
|
// @RuleVersion(0)
|
|
6565
6736
|
comparisonLeft() {
|
|
6566
6737
|
const localctx = new ComparisonLeftContext(this, this._ctx, this.state);
|
|
6567
|
-
this.enterRule(localctx, 4,
|
|
6738
|
+
this.enterRule(localctx, 4, _OpraFilterParser.RULE_comparisonLeft);
|
|
6568
6739
|
try {
|
|
6569
6740
|
this.enterOuterAlt(localctx, 1);
|
|
6570
6741
|
{
|
|
@@ -6587,7 +6758,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6587
6758
|
// @RuleVersion(0)
|
|
6588
6759
|
comparisonRight() {
|
|
6589
6760
|
const localctx = new ComparisonRightContext(this, this._ctx, this.state);
|
|
6590
|
-
this.enterRule(localctx, 6,
|
|
6761
|
+
this.enterRule(localctx, 6, _OpraFilterParser.RULE_comparisonRight);
|
|
6591
6762
|
try {
|
|
6592
6763
|
this.state = 65;
|
|
6593
6764
|
this._errHandler.sync(this);
|
|
@@ -6648,7 +6819,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6648
6819
|
// @RuleVersion(0)
|
|
6649
6820
|
parenthesizedItem() {
|
|
6650
6821
|
const localctx = new ParenthesizedItemContext(this, this._ctx, this.state);
|
|
6651
|
-
this.enterRule(localctx, 8,
|
|
6822
|
+
this.enterRule(localctx, 8, _OpraFilterParser.RULE_parenthesizedItem);
|
|
6652
6823
|
try {
|
|
6653
6824
|
this.enterOuterAlt(localctx, 1);
|
|
6654
6825
|
{
|
|
@@ -6671,7 +6842,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6671
6842
|
// @RuleVersion(0)
|
|
6672
6843
|
value() {
|
|
6673
6844
|
let localctx = new ValueContext(this, this._ctx, this.state);
|
|
6674
|
-
this.enterRule(localctx, 10,
|
|
6845
|
+
this.enterRule(localctx, 10, _OpraFilterParser.RULE_value);
|
|
6675
6846
|
try {
|
|
6676
6847
|
this.state = 77;
|
|
6677
6848
|
this._errHandler.sync(this);
|
|
@@ -6681,7 +6852,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6681
6852
|
this.enterOuterAlt(localctx, 1);
|
|
6682
6853
|
{
|
|
6683
6854
|
this.state = 69;
|
|
6684
|
-
this.match(
|
|
6855
|
+
this.match(_OpraFilterParser.NUMBER);
|
|
6685
6856
|
}
|
|
6686
6857
|
break;
|
|
6687
6858
|
case 13:
|
|
@@ -6715,7 +6886,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6715
6886
|
this.enterOuterAlt(localctx, 5);
|
|
6716
6887
|
{
|
|
6717
6888
|
this.state = 73;
|
|
6718
|
-
this.match(
|
|
6889
|
+
this.match(_OpraFilterParser.DATE);
|
|
6719
6890
|
}
|
|
6720
6891
|
break;
|
|
6721
6892
|
case 38:
|
|
@@ -6723,7 +6894,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6723
6894
|
this.enterOuterAlt(localctx, 6);
|
|
6724
6895
|
{
|
|
6725
6896
|
this.state = 74;
|
|
6726
|
-
this.match(
|
|
6897
|
+
this.match(_OpraFilterParser.DATETIME);
|
|
6727
6898
|
}
|
|
6728
6899
|
break;
|
|
6729
6900
|
case 39:
|
|
@@ -6731,7 +6902,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6731
6902
|
this.enterOuterAlt(localctx, 7);
|
|
6732
6903
|
{
|
|
6733
6904
|
this.state = 75;
|
|
6734
|
-
this.match(
|
|
6905
|
+
this.match(_OpraFilterParser.TIME);
|
|
6735
6906
|
}
|
|
6736
6907
|
break;
|
|
6737
6908
|
case 42:
|
|
@@ -6739,7 +6910,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6739
6910
|
this.enterOuterAlt(localctx, 8);
|
|
6740
6911
|
{
|
|
6741
6912
|
this.state = 76;
|
|
6742
|
-
this.match(
|
|
6913
|
+
this.match(_OpraFilterParser.STRING);
|
|
6743
6914
|
}
|
|
6744
6915
|
break;
|
|
6745
6916
|
default:
|
|
@@ -6761,7 +6932,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6761
6932
|
// @RuleVersion(0)
|
|
6762
6933
|
qualifiedIdentifier() {
|
|
6763
6934
|
const localctx = new QualifiedIdentifierContext(this, this._ctx, this.state);
|
|
6764
|
-
this.enterRule(localctx, 12,
|
|
6935
|
+
this.enterRule(localctx, 12, _OpraFilterParser.RULE_qualifiedIdentifier);
|
|
6765
6936
|
try {
|
|
6766
6937
|
let _alt;
|
|
6767
6938
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -6776,7 +6947,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6776
6947
|
this.state = 79;
|
|
6777
6948
|
this.identifier();
|
|
6778
6949
|
this.state = 80;
|
|
6779
|
-
this.match(
|
|
6950
|
+
this.match(_OpraFilterParser.T__4);
|
|
6780
6951
|
}
|
|
6781
6952
|
}
|
|
6782
6953
|
}
|
|
@@ -6803,12 +6974,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
6803
6974
|
// @RuleVersion(0)
|
|
6804
6975
|
externalConstant() {
|
|
6805
6976
|
const localctx = new ExternalConstantContext(this, this._ctx, this.state);
|
|
6806
|
-
this.enterRule(localctx, 14,
|
|
6977
|
+
this.enterRule(localctx, 14, _OpraFilterParser.RULE_externalConstant);
|
|
6807
6978
|
try {
|
|
6808
6979
|
this.enterOuterAlt(localctx, 1);
|
|
6809
6980
|
{
|
|
6810
6981
|
this.state = 89;
|
|
6811
|
-
this.match(
|
|
6982
|
+
this.match(_OpraFilterParser.T__5);
|
|
6812
6983
|
this.state = 90;
|
|
6813
6984
|
this.identifier();
|
|
6814
6985
|
}
|
|
@@ -6828,12 +6999,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
6828
6999
|
// @RuleVersion(0)
|
|
6829
7000
|
identifier() {
|
|
6830
7001
|
const localctx = new IdentifierContext(this, this._ctx, this.state);
|
|
6831
|
-
this.enterRule(localctx, 16,
|
|
7002
|
+
this.enterRule(localctx, 16, _OpraFilterParser.RULE_identifier);
|
|
6832
7003
|
try {
|
|
6833
7004
|
this.enterOuterAlt(localctx, 1);
|
|
6834
7005
|
{
|
|
6835
7006
|
this.state = 92;
|
|
6836
|
-
this.match(
|
|
7007
|
+
this.match(_OpraFilterParser.IDENTIFIER);
|
|
6837
7008
|
}
|
|
6838
7009
|
} catch (re) {
|
|
6839
7010
|
if (re instanceof RecognitionException) {
|
|
@@ -6851,13 +7022,13 @@ var OpraFilterParser = class extends Parser {
|
|
|
6851
7022
|
// @RuleVersion(0)
|
|
6852
7023
|
arrayValue() {
|
|
6853
7024
|
const localctx = new ArrayValueContext(this, this._ctx, this.state);
|
|
6854
|
-
this.enterRule(localctx, 18,
|
|
7025
|
+
this.enterRule(localctx, 18, _OpraFilterParser.RULE_arrayValue);
|
|
6855
7026
|
let _la;
|
|
6856
7027
|
try {
|
|
6857
7028
|
this.enterOuterAlt(localctx, 1);
|
|
6858
7029
|
{
|
|
6859
7030
|
this.state = 94;
|
|
6860
|
-
this.match(
|
|
7031
|
+
this.match(_OpraFilterParser.T__6);
|
|
6861
7032
|
this.state = 95;
|
|
6862
7033
|
this.value();
|
|
6863
7034
|
this.state = 100;
|
|
@@ -6867,7 +7038,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6867
7038
|
{
|
|
6868
7039
|
{
|
|
6869
7040
|
this.state = 96;
|
|
6870
|
-
this.match(
|
|
7041
|
+
this.match(_OpraFilterParser.T__7);
|
|
6871
7042
|
this.state = 97;
|
|
6872
7043
|
this.value();
|
|
6873
7044
|
}
|
|
@@ -6877,7 +7048,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6877
7048
|
_la = this._input.LA(1);
|
|
6878
7049
|
}
|
|
6879
7050
|
this.state = 103;
|
|
6880
|
-
this.match(
|
|
7051
|
+
this.match(_OpraFilterParser.T__8);
|
|
6881
7052
|
}
|
|
6882
7053
|
} catch (re) {
|
|
6883
7054
|
if (re instanceof RecognitionException) {
|
|
@@ -6895,7 +7066,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6895
7066
|
// @RuleVersion(0)
|
|
6896
7067
|
boolean_() {
|
|
6897
7068
|
const localctx = new BooleanContext(this, this._ctx, this.state);
|
|
6898
|
-
this.enterRule(localctx, 20,
|
|
7069
|
+
this.enterRule(localctx, 20, _OpraFilterParser.RULE_boolean);
|
|
6899
7070
|
let _la;
|
|
6900
7071
|
try {
|
|
6901
7072
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -6925,12 +7096,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
6925
7096
|
// @RuleVersion(0)
|
|
6926
7097
|
null_() {
|
|
6927
7098
|
const localctx = new NullContext(this, this._ctx, this.state);
|
|
6928
|
-
this.enterRule(localctx, 22,
|
|
7099
|
+
this.enterRule(localctx, 22, _OpraFilterParser.RULE_null);
|
|
6929
7100
|
try {
|
|
6930
7101
|
this.enterOuterAlt(localctx, 1);
|
|
6931
7102
|
{
|
|
6932
7103
|
this.state = 107;
|
|
6933
|
-
this.match(
|
|
7104
|
+
this.match(_OpraFilterParser.T__11);
|
|
6934
7105
|
}
|
|
6935
7106
|
} catch (re) {
|
|
6936
7107
|
if (re instanceof RecognitionException) {
|
|
@@ -6948,7 +7119,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6948
7119
|
// @RuleVersion(0)
|
|
6949
7120
|
infinity() {
|
|
6950
7121
|
const localctx = new InfinityContext(this, this._ctx, this.state);
|
|
6951
|
-
this.enterRule(localctx, 24,
|
|
7122
|
+
this.enterRule(localctx, 24, _OpraFilterParser.RULE_infinity);
|
|
6952
7123
|
let _la;
|
|
6953
7124
|
try {
|
|
6954
7125
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -6978,7 +7149,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
6978
7149
|
// @RuleVersion(0)
|
|
6979
7150
|
arithmeticOperator() {
|
|
6980
7151
|
const localctx = new ArithmeticOperatorContext(this, this._ctx, this.state);
|
|
6981
|
-
this.enterRule(localctx, 26,
|
|
7152
|
+
this.enterRule(localctx, 26, _OpraFilterParser.RULE_arithmeticOperator);
|
|
6982
7153
|
let _la;
|
|
6983
7154
|
try {
|
|
6984
7155
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -7008,7 +7179,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
7008
7179
|
// @RuleVersion(0)
|
|
7009
7180
|
comparisonOperator() {
|
|
7010
7181
|
const localctx = new ComparisonOperatorContext(this, this._ctx, this.state);
|
|
7011
|
-
this.enterRule(localctx, 28,
|
|
7182
|
+
this.enterRule(localctx, 28, _OpraFilterParser.RULE_comparisonOperator);
|
|
7012
7183
|
let _la;
|
|
7013
7184
|
try {
|
|
7014
7185
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -7038,7 +7209,7 @@ var OpraFilterParser = class extends Parser {
|
|
|
7038
7209
|
// @RuleVersion(0)
|
|
7039
7210
|
logicalOperator() {
|
|
7040
7211
|
const localctx = new LogicalOperatorContext(this, this._ctx, this.state);
|
|
7041
|
-
this.enterRule(localctx, 30,
|
|
7212
|
+
this.enterRule(localctx, 30, _OpraFilterParser.RULE_logicalOperator);
|
|
7042
7213
|
let _la;
|
|
7043
7214
|
try {
|
|
7044
7215
|
this.enterOuterAlt(localctx, 1);
|
|
@@ -7068,12 +7239,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
7068
7239
|
// @RuleVersion(0)
|
|
7069
7240
|
polarityOperator() {
|
|
7070
7241
|
const localctx = new PolarityOperatorContext(this, this._ctx, this.state);
|
|
7071
|
-
this.enterRule(localctx, 32,
|
|
7242
|
+
this.enterRule(localctx, 32, _OpraFilterParser.RULE_polarityOperator);
|
|
7072
7243
|
try {
|
|
7073
7244
|
this.enterOuterAlt(localctx, 1);
|
|
7074
7245
|
{
|
|
7075
7246
|
this.state = 117;
|
|
7076
|
-
this.match(
|
|
7247
|
+
this.match(_OpraFilterParser.POLAR_OP);
|
|
7077
7248
|
}
|
|
7078
7249
|
} catch (re) {
|
|
7079
7250
|
if (re instanceof RecognitionException) {
|
|
@@ -7103,13 +7274,12 @@ var OpraFilterParser = class extends Parser {
|
|
|
7103
7274
|
return true;
|
|
7104
7275
|
}
|
|
7105
7276
|
static get _ATN() {
|
|
7106
|
-
if (!
|
|
7107
|
-
|
|
7277
|
+
if (!_OpraFilterParser.__ATN) {
|
|
7278
|
+
_OpraFilterParser.__ATN = new ATNDeserializer2().deserialize(_OpraFilterParser._serializedATN);
|
|
7108
7279
|
}
|
|
7109
|
-
return
|
|
7280
|
+
return _OpraFilterParser.__ATN;
|
|
7110
7281
|
}
|
|
7111
7282
|
};
|
|
7112
|
-
__name(OpraFilterParser, "OpraFilterParser");
|
|
7113
7283
|
OpraFilterParser.T__0 = 1;
|
|
7114
7284
|
OpraFilterParser.T__1 = 2;
|
|
7115
7285
|
OpraFilterParser.T__2 = 3;
|
|
@@ -8286,7 +8456,11 @@ OpraFilterParser._serializedATN = [
|
|
|
8286
8456
|
100
|
|
8287
8457
|
];
|
|
8288
8458
|
OpraFilterParser.DecisionsToDFA = OpraFilterParser._ATN.decisionToState.map((ds, index) => new DFA2(ds, index));
|
|
8459
|
+
var OpraFilterParser_default = OpraFilterParser;
|
|
8289
8460
|
var RootContext = class extends ParserRuleContext {
|
|
8461
|
+
static {
|
|
8462
|
+
__name(this, "RootContext");
|
|
8463
|
+
}
|
|
8290
8464
|
constructor(parser, parent, invokingState) {
|
|
8291
8465
|
super(parent, invokingState);
|
|
8292
8466
|
this.parser = parser;
|
|
@@ -8319,8 +8493,10 @@ var RootContext = class extends ParserRuleContext {
|
|
|
8319
8493
|
}
|
|
8320
8494
|
}
|
|
8321
8495
|
};
|
|
8322
|
-
__name(RootContext, "RootContext");
|
|
8323
8496
|
var ExpressionContext = class extends ParserRuleContext {
|
|
8497
|
+
static {
|
|
8498
|
+
__name(this, "ExpressionContext");
|
|
8499
|
+
}
|
|
8324
8500
|
constructor(parser, parent, invokingState) {
|
|
8325
8501
|
super(parent, invokingState);
|
|
8326
8502
|
this.parser = parser;
|
|
@@ -8332,8 +8508,10 @@ var ExpressionContext = class extends ParserRuleContext {
|
|
|
8332
8508
|
super.copyFrom(ctx);
|
|
8333
8509
|
}
|
|
8334
8510
|
};
|
|
8335
|
-
__name(ExpressionContext, "ExpressionContext");
|
|
8336
8511
|
var ParenthesizedExpressionContext = class extends ExpressionContext {
|
|
8512
|
+
static {
|
|
8513
|
+
__name(this, "ParenthesizedExpressionContext");
|
|
8514
|
+
}
|
|
8337
8515
|
constructor(parser, ctx) {
|
|
8338
8516
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8339
8517
|
super.copyFrom(ctx);
|
|
@@ -8360,8 +8538,10 @@ var ParenthesizedExpressionContext = class extends ExpressionContext {
|
|
|
8360
8538
|
}
|
|
8361
8539
|
}
|
|
8362
8540
|
};
|
|
8363
|
-
__name(ParenthesizedExpressionContext, "ParenthesizedExpressionContext");
|
|
8364
8541
|
var NegativeExpressionContext = class extends ExpressionContext {
|
|
8542
|
+
static {
|
|
8543
|
+
__name(this, "NegativeExpressionContext");
|
|
8544
|
+
}
|
|
8365
8545
|
constructor(parser, ctx) {
|
|
8366
8546
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8367
8547
|
super.copyFrom(ctx);
|
|
@@ -8388,8 +8568,10 @@ var NegativeExpressionContext = class extends ExpressionContext {
|
|
|
8388
8568
|
}
|
|
8389
8569
|
}
|
|
8390
8570
|
};
|
|
8391
|
-
__name(NegativeExpressionContext, "NegativeExpressionContext");
|
|
8392
8571
|
var ComparisonExpressionContext = class extends ExpressionContext {
|
|
8572
|
+
static {
|
|
8573
|
+
__name(this, "ComparisonExpressionContext");
|
|
8574
|
+
}
|
|
8393
8575
|
constructor(parser, ctx) {
|
|
8394
8576
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8395
8577
|
super.copyFrom(ctx);
|
|
@@ -8422,8 +8604,10 @@ var ComparisonExpressionContext = class extends ExpressionContext {
|
|
|
8422
8604
|
}
|
|
8423
8605
|
}
|
|
8424
8606
|
};
|
|
8425
|
-
__name(ComparisonExpressionContext, "ComparisonExpressionContext");
|
|
8426
8607
|
var LogicalExpressionContext = class extends ExpressionContext {
|
|
8608
|
+
static {
|
|
8609
|
+
__name(this, "LogicalExpressionContext");
|
|
8610
|
+
}
|
|
8427
8611
|
constructor(parser, ctx) {
|
|
8428
8612
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8429
8613
|
super.copyFrom(ctx);
|
|
@@ -8456,8 +8640,10 @@ var LogicalExpressionContext = class extends ExpressionContext {
|
|
|
8456
8640
|
}
|
|
8457
8641
|
}
|
|
8458
8642
|
};
|
|
8459
|
-
__name(LogicalExpressionContext, "LogicalExpressionContext");
|
|
8460
8643
|
var ComparisonLeftContext = class extends ParserRuleContext {
|
|
8644
|
+
static {
|
|
8645
|
+
__name(this, "ComparisonLeftContext");
|
|
8646
|
+
}
|
|
8461
8647
|
constructor(parser, parent, invokingState) {
|
|
8462
8648
|
super(parent, invokingState);
|
|
8463
8649
|
this.parser = parser;
|
|
@@ -8487,8 +8673,10 @@ var ComparisonLeftContext = class extends ParserRuleContext {
|
|
|
8487
8673
|
}
|
|
8488
8674
|
}
|
|
8489
8675
|
};
|
|
8490
|
-
__name(ComparisonLeftContext, "ComparisonLeftContext");
|
|
8491
8676
|
var ComparisonRightContext = class extends ParserRuleContext {
|
|
8677
|
+
static {
|
|
8678
|
+
__name(this, "ComparisonRightContext");
|
|
8679
|
+
}
|
|
8492
8680
|
constructor(parser, parent, invokingState) {
|
|
8493
8681
|
super(parent, invokingState);
|
|
8494
8682
|
this.parser = parser;
|
|
@@ -8527,8 +8715,10 @@ var ComparisonRightContext = class extends ParserRuleContext {
|
|
|
8527
8715
|
}
|
|
8528
8716
|
}
|
|
8529
8717
|
};
|
|
8530
|
-
__name(ComparisonRightContext, "ComparisonRightContext");
|
|
8531
8718
|
var ParenthesizedItemContext = class extends ParserRuleContext {
|
|
8719
|
+
static {
|
|
8720
|
+
__name(this, "ParenthesizedItemContext");
|
|
8721
|
+
}
|
|
8532
8722
|
constructor(parser, parent, invokingState) {
|
|
8533
8723
|
super(parent, invokingState);
|
|
8534
8724
|
this.parser = parser;
|
|
@@ -8558,8 +8748,10 @@ var ParenthesizedItemContext = class extends ParserRuleContext {
|
|
|
8558
8748
|
}
|
|
8559
8749
|
}
|
|
8560
8750
|
};
|
|
8561
|
-
__name(ParenthesizedItemContext, "ParenthesizedItemContext");
|
|
8562
8751
|
var ValueContext = class extends ParserRuleContext {
|
|
8752
|
+
static {
|
|
8753
|
+
__name(this, "ValueContext");
|
|
8754
|
+
}
|
|
8563
8755
|
constructor(parser, parent, invokingState) {
|
|
8564
8756
|
super(parent, invokingState);
|
|
8565
8757
|
this.parser = parser;
|
|
@@ -8571,8 +8763,10 @@ var ValueContext = class extends ParserRuleContext {
|
|
|
8571
8763
|
super.copyFrom(ctx);
|
|
8572
8764
|
}
|
|
8573
8765
|
};
|
|
8574
|
-
__name(ValueContext, "ValueContext");
|
|
8575
8766
|
var TimeLiteralContext = class extends ValueContext {
|
|
8767
|
+
static {
|
|
8768
|
+
__name(this, "TimeLiteralContext");
|
|
8769
|
+
}
|
|
8576
8770
|
constructor(parser, ctx) {
|
|
8577
8771
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8578
8772
|
super.copyFrom(ctx);
|
|
@@ -8599,8 +8793,10 @@ var TimeLiteralContext = class extends ValueContext {
|
|
|
8599
8793
|
}
|
|
8600
8794
|
}
|
|
8601
8795
|
};
|
|
8602
|
-
__name(TimeLiteralContext, "TimeLiteralContext");
|
|
8603
8796
|
var NullLiteralContext = class extends ValueContext {
|
|
8797
|
+
static {
|
|
8798
|
+
__name(this, "NullLiteralContext");
|
|
8799
|
+
}
|
|
8604
8800
|
constructor(parser, ctx) {
|
|
8605
8801
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8606
8802
|
super.copyFrom(ctx);
|
|
@@ -8627,8 +8823,10 @@ var NullLiteralContext = class extends ValueContext {
|
|
|
8627
8823
|
}
|
|
8628
8824
|
}
|
|
8629
8825
|
};
|
|
8630
|
-
__name(NullLiteralContext, "NullLiteralContext");
|
|
8631
8826
|
var DateTimeLiteralContext = class extends ValueContext {
|
|
8827
|
+
static {
|
|
8828
|
+
__name(this, "DateTimeLiteralContext");
|
|
8829
|
+
}
|
|
8632
8830
|
constructor(parser, ctx) {
|
|
8633
8831
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8634
8832
|
super.copyFrom(ctx);
|
|
@@ -8655,8 +8853,10 @@ var DateTimeLiteralContext = class extends ValueContext {
|
|
|
8655
8853
|
}
|
|
8656
8854
|
}
|
|
8657
8855
|
};
|
|
8658
|
-
__name(DateTimeLiteralContext, "DateTimeLiteralContext");
|
|
8659
8856
|
var StringLiteralContext = class extends ValueContext {
|
|
8857
|
+
static {
|
|
8858
|
+
__name(this, "StringLiteralContext");
|
|
8859
|
+
}
|
|
8660
8860
|
constructor(parser, ctx) {
|
|
8661
8861
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8662
8862
|
super.copyFrom(ctx);
|
|
@@ -8683,8 +8883,10 @@ var StringLiteralContext = class extends ValueContext {
|
|
|
8683
8883
|
}
|
|
8684
8884
|
}
|
|
8685
8885
|
};
|
|
8686
|
-
__name(StringLiteralContext, "StringLiteralContext");
|
|
8687
8886
|
var DateLiteralContext = class extends ValueContext {
|
|
8887
|
+
static {
|
|
8888
|
+
__name(this, "DateLiteralContext");
|
|
8889
|
+
}
|
|
8688
8890
|
constructor(parser, ctx) {
|
|
8689
8891
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8690
8892
|
super.copyFrom(ctx);
|
|
@@ -8711,8 +8913,10 @@ var DateLiteralContext = class extends ValueContext {
|
|
|
8711
8913
|
}
|
|
8712
8914
|
}
|
|
8713
8915
|
};
|
|
8714
|
-
__name(DateLiteralContext, "DateLiteralContext");
|
|
8715
8916
|
var InfinityLiteralContext = class extends ValueContext {
|
|
8917
|
+
static {
|
|
8918
|
+
__name(this, "InfinityLiteralContext");
|
|
8919
|
+
}
|
|
8716
8920
|
constructor(parser, ctx) {
|
|
8717
8921
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8718
8922
|
super.copyFrom(ctx);
|
|
@@ -8739,8 +8943,10 @@ var InfinityLiteralContext = class extends ValueContext {
|
|
|
8739
8943
|
}
|
|
8740
8944
|
}
|
|
8741
8945
|
};
|
|
8742
|
-
__name(InfinityLiteralContext, "InfinityLiteralContext");
|
|
8743
8946
|
var BooleanLiteralContext = class extends ValueContext {
|
|
8947
|
+
static {
|
|
8948
|
+
__name(this, "BooleanLiteralContext");
|
|
8949
|
+
}
|
|
8744
8950
|
constructor(parser, ctx) {
|
|
8745
8951
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8746
8952
|
super.copyFrom(ctx);
|
|
@@ -8767,8 +8973,10 @@ var BooleanLiteralContext = class extends ValueContext {
|
|
|
8767
8973
|
}
|
|
8768
8974
|
}
|
|
8769
8975
|
};
|
|
8770
|
-
__name(BooleanLiteralContext, "BooleanLiteralContext");
|
|
8771
8976
|
var NumberLiteralContext = class extends ValueContext {
|
|
8977
|
+
static {
|
|
8978
|
+
__name(this, "NumberLiteralContext");
|
|
8979
|
+
}
|
|
8772
8980
|
constructor(parser, ctx) {
|
|
8773
8981
|
super(parser, ctx.parentCtx, ctx.invokingState);
|
|
8774
8982
|
super.copyFrom(ctx);
|
|
@@ -8795,8 +9003,10 @@ var NumberLiteralContext = class extends ValueContext {
|
|
|
8795
9003
|
}
|
|
8796
9004
|
}
|
|
8797
9005
|
};
|
|
8798
|
-
__name(NumberLiteralContext, "NumberLiteralContext");
|
|
8799
9006
|
var QualifiedIdentifierContext = class extends ParserRuleContext {
|
|
9007
|
+
static {
|
|
9008
|
+
__name(this, "QualifiedIdentifierContext");
|
|
9009
|
+
}
|
|
8800
9010
|
constructor(parser, parent, invokingState) {
|
|
8801
9011
|
super(parent, invokingState);
|
|
8802
9012
|
this.parser = parser;
|
|
@@ -8829,8 +9039,10 @@ var QualifiedIdentifierContext = class extends ParserRuleContext {
|
|
|
8829
9039
|
}
|
|
8830
9040
|
}
|
|
8831
9041
|
};
|
|
8832
|
-
__name(QualifiedIdentifierContext, "QualifiedIdentifierContext");
|
|
8833
9042
|
var ExternalConstantContext = class extends ParserRuleContext {
|
|
9043
|
+
static {
|
|
9044
|
+
__name(this, "ExternalConstantContext");
|
|
9045
|
+
}
|
|
8834
9046
|
constructor(parser, parent, invokingState) {
|
|
8835
9047
|
super(parent, invokingState);
|
|
8836
9048
|
this.parser = parser;
|
|
@@ -8860,8 +9072,10 @@ var ExternalConstantContext = class extends ParserRuleContext {
|
|
|
8860
9072
|
}
|
|
8861
9073
|
}
|
|
8862
9074
|
};
|
|
8863
|
-
__name(ExternalConstantContext, "ExternalConstantContext");
|
|
8864
9075
|
var IdentifierContext = class extends ParserRuleContext {
|
|
9076
|
+
static {
|
|
9077
|
+
__name(this, "IdentifierContext");
|
|
9078
|
+
}
|
|
8865
9079
|
constructor(parser, parent, invokingState) {
|
|
8866
9080
|
super(parent, invokingState);
|
|
8867
9081
|
this.parser = parser;
|
|
@@ -8891,8 +9105,10 @@ var IdentifierContext = class extends ParserRuleContext {
|
|
|
8891
9105
|
}
|
|
8892
9106
|
}
|
|
8893
9107
|
};
|
|
8894
|
-
__name(IdentifierContext, "IdentifierContext");
|
|
8895
9108
|
var ArrayValueContext = class extends ParserRuleContext {
|
|
9109
|
+
static {
|
|
9110
|
+
__name(this, "ArrayValueContext");
|
|
9111
|
+
}
|
|
8896
9112
|
constructor(parser, parent, invokingState) {
|
|
8897
9113
|
super(parent, invokingState);
|
|
8898
9114
|
this.parser = parser;
|
|
@@ -8925,8 +9141,10 @@ var ArrayValueContext = class extends ParserRuleContext {
|
|
|
8925
9141
|
}
|
|
8926
9142
|
}
|
|
8927
9143
|
};
|
|
8928
|
-
__name(ArrayValueContext, "ArrayValueContext");
|
|
8929
9144
|
var BooleanContext = class extends ParserRuleContext {
|
|
9145
|
+
static {
|
|
9146
|
+
__name(this, "BooleanContext");
|
|
9147
|
+
}
|
|
8930
9148
|
constructor(parser, parent, invokingState) {
|
|
8931
9149
|
super(parent, invokingState);
|
|
8932
9150
|
this.parser = parser;
|
|
@@ -8953,8 +9171,10 @@ var BooleanContext = class extends ParserRuleContext {
|
|
|
8953
9171
|
}
|
|
8954
9172
|
}
|
|
8955
9173
|
};
|
|
8956
|
-
__name(BooleanContext, "BooleanContext");
|
|
8957
9174
|
var NullContext = class extends ParserRuleContext {
|
|
9175
|
+
static {
|
|
9176
|
+
__name(this, "NullContext");
|
|
9177
|
+
}
|
|
8958
9178
|
constructor(parser, parent, invokingState) {
|
|
8959
9179
|
super(parent, invokingState);
|
|
8960
9180
|
this.parser = parser;
|
|
@@ -8981,8 +9201,10 @@ var NullContext = class extends ParserRuleContext {
|
|
|
8981
9201
|
}
|
|
8982
9202
|
}
|
|
8983
9203
|
};
|
|
8984
|
-
__name(NullContext, "NullContext");
|
|
8985
9204
|
var InfinityContext = class extends ParserRuleContext {
|
|
9205
|
+
static {
|
|
9206
|
+
__name(this, "InfinityContext");
|
|
9207
|
+
}
|
|
8986
9208
|
constructor(parser, parent, invokingState) {
|
|
8987
9209
|
super(parent, invokingState);
|
|
8988
9210
|
this.parser = parser;
|
|
@@ -9009,8 +9231,10 @@ var InfinityContext = class extends ParserRuleContext {
|
|
|
9009
9231
|
}
|
|
9010
9232
|
}
|
|
9011
9233
|
};
|
|
9012
|
-
__name(InfinityContext, "InfinityContext");
|
|
9013
9234
|
var ArithmeticOperatorContext = class extends ParserRuleContext {
|
|
9235
|
+
static {
|
|
9236
|
+
__name(this, "ArithmeticOperatorContext");
|
|
9237
|
+
}
|
|
9014
9238
|
constructor(parser, parent, invokingState) {
|
|
9015
9239
|
super(parent, invokingState);
|
|
9016
9240
|
this.parser = parser;
|
|
@@ -9037,8 +9261,10 @@ var ArithmeticOperatorContext = class extends ParserRuleContext {
|
|
|
9037
9261
|
}
|
|
9038
9262
|
}
|
|
9039
9263
|
};
|
|
9040
|
-
__name(ArithmeticOperatorContext, "ArithmeticOperatorContext");
|
|
9041
9264
|
var ComparisonOperatorContext = class extends ParserRuleContext {
|
|
9265
|
+
static {
|
|
9266
|
+
__name(this, "ComparisonOperatorContext");
|
|
9267
|
+
}
|
|
9042
9268
|
constructor(parser, parent, invokingState) {
|
|
9043
9269
|
super(parent, invokingState);
|
|
9044
9270
|
this.parser = parser;
|
|
@@ -9065,8 +9291,10 @@ var ComparisonOperatorContext = class extends ParserRuleContext {
|
|
|
9065
9291
|
}
|
|
9066
9292
|
}
|
|
9067
9293
|
};
|
|
9068
|
-
__name(ComparisonOperatorContext, "ComparisonOperatorContext");
|
|
9069
9294
|
var LogicalOperatorContext = class extends ParserRuleContext {
|
|
9295
|
+
static {
|
|
9296
|
+
__name(this, "LogicalOperatorContext");
|
|
9297
|
+
}
|
|
9070
9298
|
constructor(parser, parent, invokingState) {
|
|
9071
9299
|
super(parent, invokingState);
|
|
9072
9300
|
this.parser = parser;
|
|
@@ -9093,8 +9321,10 @@ var LogicalOperatorContext = class extends ParserRuleContext {
|
|
|
9093
9321
|
}
|
|
9094
9322
|
}
|
|
9095
9323
|
};
|
|
9096
|
-
__name(LogicalOperatorContext, "LogicalOperatorContext");
|
|
9097
9324
|
var PolarityOperatorContext = class extends ParserRuleContext {
|
|
9325
|
+
static {
|
|
9326
|
+
__name(this, "PolarityOperatorContext");
|
|
9327
|
+
}
|
|
9098
9328
|
constructor(parser, parent, invokingState) {
|
|
9099
9329
|
super(parent, invokingState);
|
|
9100
9330
|
this.parser = parser;
|
|
@@ -9124,13 +9354,15 @@ var PolarityOperatorContext = class extends ParserRuleContext {
|
|
|
9124
9354
|
}
|
|
9125
9355
|
}
|
|
9126
9356
|
};
|
|
9127
|
-
__name(PolarityOperatorContext, "PolarityOperatorContext");
|
|
9128
9357
|
|
|
9129
9358
|
// ../../build/common/esm/filter/filter-tree-visitor.js
|
|
9130
9359
|
import antlr4 from "@browsery/antlr4";
|
|
9131
9360
|
|
|
9132
9361
|
// ../../build/common/esm/filter/ast/terms/external-constant.js
|
|
9133
9362
|
var ExternalConstant = class extends Literal {
|
|
9363
|
+
static {
|
|
9364
|
+
__name(this, "ExternalConstant");
|
|
9365
|
+
}
|
|
9134
9366
|
constructor(value) {
|
|
9135
9367
|
super("" + value);
|
|
9136
9368
|
}
|
|
@@ -9138,11 +9370,13 @@ var ExternalConstant = class extends Literal {
|
|
|
9138
9370
|
return "@" + super.toString();
|
|
9139
9371
|
}
|
|
9140
9372
|
};
|
|
9141
|
-
__name(ExternalConstant, "ExternalConstant");
|
|
9142
9373
|
|
|
9143
9374
|
// ../../build/common/esm/filter/filter-tree-visitor.js
|
|
9144
9375
|
var ParseTreeVisitor = antlr4.tree.ParseTreeVisitor;
|
|
9145
9376
|
var FilterTreeVisitor = class extends ParseTreeVisitor {
|
|
9377
|
+
static {
|
|
9378
|
+
__name(this, "FilterTreeVisitor");
|
|
9379
|
+
}
|
|
9146
9380
|
constructor(options) {
|
|
9147
9381
|
super();
|
|
9148
9382
|
this._timeZone = options?.timeZone;
|
|
@@ -9229,11 +9463,13 @@ var FilterTreeVisitor = class extends ParseTreeVisitor {
|
|
|
9229
9463
|
return new ArrayExpression(ctx.value_list().map((child) => this.visit(child)));
|
|
9230
9464
|
}
|
|
9231
9465
|
};
|
|
9232
|
-
__name(FilterTreeVisitor, "FilterTreeVisitor");
|
|
9233
9466
|
|
|
9234
9467
|
// ../../build/common/esm/filter/opra-error-listener.js
|
|
9235
9468
|
import { ErrorListener } from "@browsery/antlr4";
|
|
9236
9469
|
var OpraErrorListener = class extends ErrorListener {
|
|
9470
|
+
static {
|
|
9471
|
+
__name(this, "OpraErrorListener");
|
|
9472
|
+
}
|
|
9237
9473
|
constructor(errors) {
|
|
9238
9474
|
super();
|
|
9239
9475
|
this.errors = errors;
|
|
@@ -9242,14 +9478,13 @@ var OpraErrorListener = class extends ErrorListener {
|
|
|
9242
9478
|
this.errors.push(new FilterParseError(msg, { recognizer, offendingSymbol, line, column, e }));
|
|
9243
9479
|
}
|
|
9244
9480
|
};
|
|
9245
|
-
__name(OpraErrorListener, "OpraErrorListener");
|
|
9246
9481
|
|
|
9247
9482
|
// ../../build/common/esm/filter/parse.js
|
|
9248
9483
|
function parse(text, visitor) {
|
|
9249
9484
|
const chars = new CharStream(text);
|
|
9250
|
-
const lexer = new
|
|
9485
|
+
const lexer = new OpraFilterLexer_default(chars);
|
|
9251
9486
|
const tokenStream = new CommonTokenStream(lexer);
|
|
9252
|
-
const parser = new
|
|
9487
|
+
const parser = new OpraFilterParser_default(tokenStream);
|
|
9253
9488
|
parser.buildParseTrees = true;
|
|
9254
9489
|
const errors = [];
|
|
9255
9490
|
const errorListener = new OpraErrorListener(errors);
|
|
@@ -9399,83 +9634,53 @@ var _wrapEntryValue = /* @__PURE__ */ __name((v) => {
|
|
|
9399
9634
|
}, "_wrapEntryValue");
|
|
9400
9635
|
|
|
9401
9636
|
// ../../build/common/esm/document/resource/resource.js
|
|
9402
|
-
var Resource =
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9637
|
+
var Resource = class {
|
|
9638
|
+
static {
|
|
9639
|
+
__name(this, "Resource");
|
|
9640
|
+
}
|
|
9641
|
+
constructor(document, init) {
|
|
9642
|
+
this.document = document;
|
|
9643
|
+
this.name = init.name;
|
|
9644
|
+
this.description = init.description;
|
|
9645
|
+
this.controller = init.controller;
|
|
9406
9646
|
}
|
|
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
9647
|
exportSchema() {
|
|
9419
9648
|
return omitUndefined({
|
|
9420
9649
|
kind: this.kind,
|
|
9421
9650
|
description: this.description
|
|
9422
9651
|
});
|
|
9423
|
-
}
|
|
9652
|
+
}
|
|
9424
9653
|
toString() {
|
|
9425
9654
|
return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || "#anonymous"}]`;
|
|
9426
|
-
}
|
|
9655
|
+
}
|
|
9427
9656
|
[nodeInspectCustom]() {
|
|
9428
9657
|
return `[${colorFgYellow + Object.getPrototypeOf(this).constructor.name + colorReset} ${colorFgMagenta + this.name + colorReset}]`;
|
|
9429
9658
|
}
|
|
9430
9659
|
};
|
|
9431
|
-
Object.assign(Resource.prototype, proto6);
|
|
9432
9660
|
|
|
9433
9661
|
// ../../build/common/esm/document/resource/collection.js
|
|
9434
9662
|
var NESTJS_INJECTABLE_WATERMARK = "__injectable__";
|
|
9435
9663
|
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) => {
|
|
9664
|
+
var CollectionClass = class extends Resource {
|
|
9665
|
+
static {
|
|
9666
|
+
__name(this, "CollectionClass");
|
|
9667
|
+
}
|
|
9668
|
+
constructor(document, init) {
|
|
9669
|
+
super(document, init);
|
|
9670
|
+
this.kind = opra_schema_ns_exports.Collection.Kind;
|
|
9671
|
+
this.controller = init.controller;
|
|
9672
|
+
const operations = this.operations = init.operations || {};
|
|
9673
|
+
const dataType = this.type = init.type;
|
|
9674
|
+
this.primaryKey = init.primaryKey ? Array.isArray(init.primaryKey) ? init.primaryKey : [init.primaryKey] : [];
|
|
9675
|
+
if (!this.primaryKey.length)
|
|
9676
|
+
throw new TypeError(`You must provide primaryKey for Collection resource ("${this.name}")`);
|
|
9677
|
+
this.primaryKey.forEach((f) => {
|
|
9473
9678
|
const field = dataType.getField(f);
|
|
9474
9679
|
if (!(field?.type instanceof SimpleType2))
|
|
9475
9680
|
throw new TypeError(`Only Simple type allowed for primary keys but "${f}" is a ${field.type.kind}`);
|
|
9476
9681
|
});
|
|
9477
|
-
if (
|
|
9478
|
-
const instance = typeof
|
|
9682
|
+
if (this.controller) {
|
|
9683
|
+
const instance = typeof this.controller == "function" ? new this.controller() : this.controller;
|
|
9479
9684
|
for (const operation of Object.values(operations)) {
|
|
9480
9685
|
if (!operation.handler && operation.handlerName) {
|
|
9481
9686
|
const fn = instance[operation.handlerName];
|
|
@@ -9485,7 +9690,7 @@ var proto7 = {
|
|
|
9485
9690
|
}
|
|
9486
9691
|
}
|
|
9487
9692
|
}
|
|
9488
|
-
}
|
|
9693
|
+
}
|
|
9489
9694
|
exportSchema() {
|
|
9490
9695
|
const out = Resource.prototype.exportSchema.call(this);
|
|
9491
9696
|
Object.assign(out, omitUndefined({
|
|
@@ -9494,7 +9699,7 @@ var proto7 = {
|
|
|
9494
9699
|
primaryKey: this.primaryKey
|
|
9495
9700
|
}));
|
|
9496
9701
|
return out;
|
|
9497
|
-
}
|
|
9702
|
+
}
|
|
9498
9703
|
parseKeyValue(value) {
|
|
9499
9704
|
if (!this.primaryKey?.length)
|
|
9500
9705
|
return;
|
|
@@ -9520,22 +9725,22 @@ var proto7 = {
|
|
|
9520
9725
|
throw new TypeError(`You must provide value of primary field(s) (${primaryKey})`);
|
|
9521
9726
|
return result;
|
|
9522
9727
|
}
|
|
9523
|
-
}
|
|
9524
|
-
normalizeFieldPath(
|
|
9525
|
-
return this.type.normalizeFieldPath(
|
|
9526
|
-
}
|
|
9728
|
+
}
|
|
9729
|
+
normalizeFieldPath(path2) {
|
|
9730
|
+
return this.type.normalizeFieldPath(path2);
|
|
9731
|
+
}
|
|
9527
9732
|
normalizeSortFields(fields) {
|
|
9528
9733
|
const normalized = this.type.normalizeFieldPath(fields);
|
|
9529
9734
|
const findManyEndpoint = this.operations.findMany;
|
|
9530
9735
|
const sortFields = findManyEndpoint && findManyEndpoint.sortFields;
|
|
9531
|
-
normalized.forEach((field) => {
|
|
9736
|
+
(Array.isArray(normalized) ? normalized : [normalized]).forEach((field) => {
|
|
9532
9737
|
if (!sortFields?.find((x) => x === field))
|
|
9533
9738
|
throw new BadRequestError({
|
|
9534
9739
|
message: translate("error:UNACCEPTED_SORT_FIELD", { field }, `Field '${field}' is not available for sort operation`)
|
|
9535
9740
|
});
|
|
9536
9741
|
});
|
|
9537
9742
|
return normalized;
|
|
9538
|
-
}
|
|
9743
|
+
}
|
|
9539
9744
|
normalizeFilter(filter) {
|
|
9540
9745
|
if (!filter)
|
|
9541
9746
|
return;
|
|
@@ -9561,8 +9766,32 @@ var proto7 = {
|
|
|
9561
9766
|
return ast;
|
|
9562
9767
|
}
|
|
9563
9768
|
};
|
|
9564
|
-
|
|
9565
|
-
|
|
9769
|
+
var Collection2 = /* @__PURE__ */ __name(function(...args) {
|
|
9770
|
+
if (!this) {
|
|
9771
|
+
const [type, options] = args;
|
|
9772
|
+
return function(target) {
|
|
9773
|
+
const name = options?.name || target.name.match(NAME_PATTERN)?.[1] || target.name;
|
|
9774
|
+
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target) || {};
|
|
9775
|
+
const baseMetadata = Reflect.getOwnMetadata(METADATA_KEY, Object.getPrototypeOf(target));
|
|
9776
|
+
if (baseMetadata) {
|
|
9777
|
+
merge5(metadata, baseMetadata, { deep: true });
|
|
9778
|
+
}
|
|
9779
|
+
metadata.kind = opra_schema_ns_exports.Collection.Kind;
|
|
9780
|
+
metadata.name = name;
|
|
9781
|
+
metadata.type = type;
|
|
9782
|
+
const m = Reflect.getMetadata(METADATA_KEY, target);
|
|
9783
|
+
if (m && metadata !== m)
|
|
9784
|
+
Object.assign(metadata, omit4(m), Object.keys(metadata));
|
|
9785
|
+
if (options)
|
|
9786
|
+
Object.assign(metadata, omit4(options, ["kind", "name", "type", "controller"]));
|
|
9787
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
9788
|
+
Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK, true, target);
|
|
9789
|
+
};
|
|
9790
|
+
}
|
|
9791
|
+
const [document, init] = args;
|
|
9792
|
+
merge5(this, new CollectionClass(document, init), { descriptor: true });
|
|
9793
|
+
}, "Collection");
|
|
9794
|
+
Collection2.prototype = CollectionClass.prototype;
|
|
9566
9795
|
function createOperationDecorator(operation) {
|
|
9567
9796
|
return (options) => (target, propertyKey) => {
|
|
9568
9797
|
const metadata = {
|
|
@@ -9586,15 +9815,50 @@ Collection2.UpdateMany = createOperationDecorator("updateMany");
|
|
|
9586
9815
|
|
|
9587
9816
|
// ../../build/common/esm/document/resource/singleton.js
|
|
9588
9817
|
import omit5 from "lodash.omit";
|
|
9818
|
+
import merge6 from "putil-merge";
|
|
9589
9819
|
var NESTJS_INJECTABLE_WATERMARK2 = "__injectable__";
|
|
9590
9820
|
var NAME_PATTERN2 = /^(.*)(Resource|Singleton)$/;
|
|
9821
|
+
var SingletonClass = class extends Resource {
|
|
9822
|
+
static {
|
|
9823
|
+
__name(this, "SingletonClass");
|
|
9824
|
+
}
|
|
9825
|
+
constructor(document, init) {
|
|
9826
|
+
super(document, init);
|
|
9827
|
+
this.kind = opra_schema_ns_exports.Singleton.Kind;
|
|
9828
|
+
this.controller = init.controller;
|
|
9829
|
+
const operations = this.operations = init.operations || {};
|
|
9830
|
+
this.type = init.type;
|
|
9831
|
+
if (this.controller) {
|
|
9832
|
+
const instance = typeof this.controller == "function" ? new this.controller() : this.controller;
|
|
9833
|
+
for (const operation of Object.values(operations)) {
|
|
9834
|
+
if (!operation.handler && operation.handlerName) {
|
|
9835
|
+
const fn = instance[operation.handlerName];
|
|
9836
|
+
if (!fn)
|
|
9837
|
+
throw new TypeError(`No such operation handler (${operation.handlerName}) found`);
|
|
9838
|
+
operation.handler = fn.bind(instance);
|
|
9839
|
+
}
|
|
9840
|
+
}
|
|
9841
|
+
}
|
|
9842
|
+
}
|
|
9843
|
+
exportSchema() {
|
|
9844
|
+
const out = Resource.prototype.exportSchema.call(this);
|
|
9845
|
+
Object.assign(out, omitUndefined({
|
|
9846
|
+
type: this.type.name,
|
|
9847
|
+
operations: this.operations
|
|
9848
|
+
}));
|
|
9849
|
+
return out;
|
|
9850
|
+
}
|
|
9851
|
+
normalizeFieldPath(path2) {
|
|
9852
|
+
return this.type.normalizeFieldPath(path2);
|
|
9853
|
+
}
|
|
9854
|
+
};
|
|
9591
9855
|
var Singleton2 = /* @__PURE__ */ __name(function(...args) {
|
|
9592
9856
|
if (!this) {
|
|
9593
9857
|
const [type, options] = args;
|
|
9594
9858
|
return function(target) {
|
|
9595
9859
|
const name = options?.name || target.name.match(NAME_PATTERN2)?.[1] || target.name;
|
|
9596
9860
|
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target) || {};
|
|
9597
|
-
metadata.kind =
|
|
9861
|
+
metadata.kind = opra_schema_ns_exports.Singleton.Kind;
|
|
9598
9862
|
metadata.name = name;
|
|
9599
9863
|
metadata.type = type;
|
|
9600
9864
|
const m = Reflect.getMetadata(METADATA_KEY, target);
|
|
@@ -9607,42 +9871,9 @@ var Singleton2 = /* @__PURE__ */ __name(function(...args) {
|
|
|
9607
9871
|
};
|
|
9608
9872
|
}
|
|
9609
9873
|
const [document, init] = args;
|
|
9610
|
-
|
|
9874
|
+
merge6(this, new SingletonClass(document, init), { descriptor: true });
|
|
9611
9875
|
}, "Singleton");
|
|
9612
|
-
|
|
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;
|
|
9622
|
-
for (const operation of Object.values(operations)) {
|
|
9623
|
-
if (!operation.handler && operation.handlerName) {
|
|
9624
|
-
const fn = instance[operation.handlerName];
|
|
9625
|
-
if (!fn)
|
|
9626
|
-
throw new TypeError(`No such operation handler (${operation.handlerName}) found`);
|
|
9627
|
-
operation.handler = fn.bind(instance);
|
|
9628
|
-
}
|
|
9629
|
-
}
|
|
9630
|
-
}
|
|
9631
|
-
},
|
|
9632
|
-
exportSchema() {
|
|
9633
|
-
const out = Resource.prototype.exportSchema.call(this);
|
|
9634
|
-
Object.assign(out, omitUndefined({
|
|
9635
|
-
type: this.type.name,
|
|
9636
|
-
operations: this.operations
|
|
9637
|
-
}));
|
|
9638
|
-
return out;
|
|
9639
|
-
},
|
|
9640
|
-
normalizeFieldPath(path3) {
|
|
9641
|
-
return this.type.normalizeFieldPath(path3);
|
|
9642
|
-
}
|
|
9643
|
-
};
|
|
9644
|
-
Object.assign(Singleton2.prototype, proto8);
|
|
9645
|
-
Object.setPrototypeOf(Singleton2.prototype, Resource.prototype);
|
|
9876
|
+
Singleton2.prototype = SingletonClass.prototype;
|
|
9646
9877
|
function createOperationDecorator2(operation) {
|
|
9647
9878
|
return (options) => (target, propertyKey) => {
|
|
9648
9879
|
const metadata = {
|
|
@@ -9670,12 +9901,12 @@ async function processResourceQueue() {
|
|
|
9670
9901
|
if (!schema)
|
|
9671
9902
|
continue;
|
|
9672
9903
|
try {
|
|
9673
|
-
if (
|
|
9904
|
+
if (opra_schema_ns_exports.isCollection(schema)) {
|
|
9674
9905
|
const resource = await this.createCollection(name, schema);
|
|
9675
9906
|
document.resources.set(name, resource);
|
|
9676
9907
|
continue;
|
|
9677
9908
|
}
|
|
9678
|
-
if (
|
|
9909
|
+
if (opra_schema_ns_exports.isSingleton(schema)) {
|
|
9679
9910
|
const resource = await this.createSingleton(name, schema);
|
|
9680
9911
|
document.resources.set(name, resource);
|
|
9681
9912
|
continue;
|
|
@@ -9712,153 +9943,240 @@ async function createSingleton(name, schema) {
|
|
|
9712
9943
|
__name(createSingleton, "createSingleton");
|
|
9713
9944
|
|
|
9714
9945
|
// ../../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
|
-
|
|
9946
|
+
import "reflect-metadata";
|
|
9947
|
+
import merge7 from "putil-merge";
|
|
9948
|
+
import * as vg4 from "valgen";
|
|
9949
|
+
var MappedTypeClass = class extends DataType {
|
|
9950
|
+
static {
|
|
9951
|
+
__name(this, "MappedTypeClass");
|
|
9952
|
+
}
|
|
9953
|
+
constructor(document, init) {
|
|
9954
|
+
super(document, init);
|
|
9955
|
+
this.kind = opra_schema_ns_exports.MappedType.Kind;
|
|
9956
|
+
const own = this.own;
|
|
9957
|
+
own.pick = init.pick;
|
|
9958
|
+
own.omit = init.omit;
|
|
9959
|
+
this.kind = opra_schema_ns_exports.MappedType.Kind;
|
|
9960
|
+
this.type = init.type;
|
|
9961
|
+
this.pick = own.pick;
|
|
9962
|
+
this.omit = own.omit;
|
|
9963
|
+
this.fields = new ResponsiveMap();
|
|
9964
|
+
this.additionalFields = this.type.additionalFields;
|
|
9965
|
+
const isInheritedPredicate = getIsInheritedPredicateFn(init.pick, init.omit);
|
|
9966
|
+
for (const [elemName, elem] of this.type.fields.entries()) {
|
|
9967
|
+
if (isInheritedPredicate(elemName))
|
|
9968
|
+
this.fields.set(elemName, elem);
|
|
9733
9969
|
}
|
|
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
9970
|
}
|
|
9775
|
-
}, "MappedType");
|
|
9776
|
-
MappedType2._applyMixin = () => void 0;
|
|
9777
|
-
var proto9 = {
|
|
9778
9971
|
exportSchema() {
|
|
9779
9972
|
const out = DataType.prototype.exportSchema.call(this);
|
|
9780
9973
|
Object.assign(out, omitUndefined({
|
|
9781
|
-
type: this.
|
|
9974
|
+
type: this.type.name ? this.type.name : this.type.exportSchema(),
|
|
9782
9975
|
pick: this.own.pick,
|
|
9783
9976
|
omit: this.own.omit
|
|
9784
9977
|
}));
|
|
9785
9978
|
return out;
|
|
9786
9979
|
}
|
|
9980
|
+
_getDecoder() {
|
|
9981
|
+
if (this._decoder)
|
|
9982
|
+
return this._decoder;
|
|
9983
|
+
const schema = {};
|
|
9984
|
+
for (const f of this.fields.values()) {
|
|
9985
|
+
let t = f.type.getDecoder();
|
|
9986
|
+
if (f.isArray)
|
|
9987
|
+
t = vg4.isArray(t);
|
|
9988
|
+
schema[f.name] = t;
|
|
9989
|
+
}
|
|
9990
|
+
this._decoder = vg4.isObject(schema, {
|
|
9991
|
+
additionalFields: this.additionalFields,
|
|
9992
|
+
name: this.name,
|
|
9993
|
+
caseInSensitive: true
|
|
9994
|
+
});
|
|
9995
|
+
return this._decoder;
|
|
9996
|
+
}
|
|
9997
|
+
_getEncoder() {
|
|
9998
|
+
if (this._encoder)
|
|
9999
|
+
return this._encoder;
|
|
10000
|
+
const schema = {};
|
|
10001
|
+
for (const f of this.fields.values()) {
|
|
10002
|
+
let t = f.type.getEncoder();
|
|
10003
|
+
if (f.isArray)
|
|
10004
|
+
t = vg4.isArray(t);
|
|
10005
|
+
schema[f.name] = t;
|
|
10006
|
+
}
|
|
10007
|
+
this._encoder = vg4.isObject(schema, {
|
|
10008
|
+
additionalFields: this.additionalFields,
|
|
10009
|
+
name: this.name,
|
|
10010
|
+
caseInSensitive: true,
|
|
10011
|
+
detectCircular: true
|
|
10012
|
+
});
|
|
10013
|
+
return this._encoder;
|
|
10014
|
+
}
|
|
9787
10015
|
};
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
10016
|
+
var MappedType2 = /* @__PURE__ */ __name(function(...args) {
|
|
10017
|
+
if (this) {
|
|
10018
|
+
const [document, init] = args;
|
|
10019
|
+
merge7(this, new MappedTypeClass(document, init), { descriptor: true });
|
|
10020
|
+
return;
|
|
10021
|
+
}
|
|
10022
|
+
const [source, options] = args;
|
|
10023
|
+
const isInheritedPredicate = getIsInheritedPredicateFn(options.pick, options.omit);
|
|
10024
|
+
class MappedClass {
|
|
10025
|
+
static {
|
|
10026
|
+
__name(this, "MappedClass");
|
|
10027
|
+
}
|
|
10028
|
+
constructor() {
|
|
10029
|
+
inheritPropertyInitializers(this, source, isInheritedPredicate);
|
|
10030
|
+
}
|
|
10031
|
+
}
|
|
10032
|
+
applyMixins(MappedClass, source);
|
|
10033
|
+
const m = Reflect.getOwnMetadata(METADATA_KEY, source);
|
|
10034
|
+
if (!m)
|
|
10035
|
+
throw new TypeError(`Class "${source}" doesn't have datatype metadata information`);
|
|
10036
|
+
if (!(m.kind === opra_schema_ns_exports.ComplexType.Kind))
|
|
10037
|
+
throw new TypeError(`Class "${source}" is not a ${opra_schema_ns_exports.ComplexType.Kind}`);
|
|
10038
|
+
const metadata = {
|
|
10039
|
+
kind: "MappedType",
|
|
10040
|
+
type: source
|
|
10041
|
+
};
|
|
10042
|
+
if (options.pick)
|
|
10043
|
+
metadata.pick = options.pick;
|
|
10044
|
+
if (options.omit)
|
|
10045
|
+
metadata.omit = options.omit;
|
|
10046
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, MappedClass);
|
|
10047
|
+
MappedType2._applyMixin(MappedClass, source, {
|
|
10048
|
+
...options,
|
|
10049
|
+
isInheritedPredicate
|
|
10050
|
+
});
|
|
10051
|
+
return MappedClass;
|
|
10052
|
+
}, "MappedType");
|
|
10053
|
+
MappedType2.prototype = MappedTypeClass.prototype;
|
|
10054
|
+
MappedType2._applyMixin = () => void 0;
|
|
10055
|
+
function getIsInheritedPredicateFn(pick, omit6) {
|
|
10056
|
+
const pickKeys = pick?.map((x) => String(x).toLowerCase());
|
|
10057
|
+
const omitKeys = omit6?.map((x) => String(x).toLowerCase());
|
|
10058
|
+
return (propertyName) => {
|
|
10059
|
+
if (omitKeys && omitKeys.includes(propertyName.toLowerCase()))
|
|
10060
|
+
return false;
|
|
10061
|
+
if (pickKeys)
|
|
10062
|
+
return pickKeys.includes(propertyName.toLowerCase());
|
|
10063
|
+
return true;
|
|
10064
|
+
};
|
|
10065
|
+
}
|
|
10066
|
+
__name(getIsInheritedPredicateFn, "getIsInheritedPredicateFn");
|
|
10067
|
+
function PickType(classRef, keys) {
|
|
10068
|
+
return MappedType2(classRef, { pick: keys });
|
|
10069
|
+
}
|
|
10070
|
+
__name(PickType, "PickType");
|
|
10071
|
+
function OmitType(classRef, keys) {
|
|
10072
|
+
return MappedType2(classRef, { omit: keys });
|
|
10073
|
+
}
|
|
9797
10074
|
__name(OmitType, "OmitType");
|
|
9798
10075
|
|
|
9799
10076
|
// ../../build/common/esm/document/data-type/union-type.js
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
10077
|
+
import "reflect-metadata";
|
|
10078
|
+
import merge8 from "putil-merge";
|
|
10079
|
+
import * as vg5 from "valgen";
|
|
10080
|
+
var UnionTypeClass = class extends DataType {
|
|
10081
|
+
static {
|
|
10082
|
+
__name(this, "UnionTypeClass");
|
|
10083
|
+
}
|
|
10084
|
+
constructor(document, init) {
|
|
10085
|
+
super(document, init);
|
|
10086
|
+
this.kind = opra_schema_ns_exports.UnionType.Kind;
|
|
10087
|
+
this.fields = new ResponsiveMap();
|
|
10088
|
+
const own = this.own;
|
|
10089
|
+
own.types = [];
|
|
10090
|
+
for (const base of init.types) {
|
|
10091
|
+
if (!(base instanceof ComplexType2 || base instanceof UnionType2 || base instanceof MappedType2))
|
|
10092
|
+
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.`);
|
|
10093
|
+
own.types.push(base);
|
|
10094
|
+
if (base.additionalFields)
|
|
10095
|
+
this.additionalFields = true;
|
|
10096
|
+
this.fields.setAll(base.fields);
|
|
10097
|
+
}
|
|
10098
|
+
this.types = [...own.types];
|
|
9803
10099
|
}
|
|
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
10100
|
exportSchema() {
|
|
9824
|
-
const out =
|
|
10101
|
+
const out = super.exportSchema();
|
|
9825
10102
|
Object.assign(out, omitUndefined({
|
|
9826
10103
|
types: this.own.types.map((t) => t.name ? t.name : t.exportSchema())
|
|
9827
10104
|
}));
|
|
9828
10105
|
return out;
|
|
9829
10106
|
}
|
|
10107
|
+
_getDecoder() {
|
|
10108
|
+
if (this._decoder)
|
|
10109
|
+
return this._decoder;
|
|
10110
|
+
const schema = {};
|
|
10111
|
+
for (const f of this.fields.values()) {
|
|
10112
|
+
let t = f.type.getDecoder();
|
|
10113
|
+
if (f.isArray)
|
|
10114
|
+
t = vg5.isArray(t);
|
|
10115
|
+
schema[f.name] = t;
|
|
10116
|
+
}
|
|
10117
|
+
this._decoder = vg5.isObject(schema, {
|
|
10118
|
+
additionalFields: this.additionalFields,
|
|
10119
|
+
name: this.name,
|
|
10120
|
+
caseInSensitive: true
|
|
10121
|
+
});
|
|
10122
|
+
return this._decoder;
|
|
10123
|
+
}
|
|
10124
|
+
_getEncoder() {
|
|
10125
|
+
if (this._encoder)
|
|
10126
|
+
return this._encoder;
|
|
10127
|
+
const schema = {};
|
|
10128
|
+
for (const f of this.fields.values()) {
|
|
10129
|
+
let t = f.type.getEncoder();
|
|
10130
|
+
if (f.isArray)
|
|
10131
|
+
t = vg5.isArray(t);
|
|
10132
|
+
schema[f.name] = t;
|
|
10133
|
+
}
|
|
10134
|
+
this._encoder = vg5.isObject(schema, {
|
|
10135
|
+
additionalFields: this.additionalFields,
|
|
10136
|
+
name: this.name,
|
|
10137
|
+
caseInSensitive: true,
|
|
10138
|
+
detectCircular: true
|
|
10139
|
+
});
|
|
10140
|
+
return this._encoder;
|
|
10141
|
+
}
|
|
9830
10142
|
};
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
10143
|
+
var UnionType2 = /* @__PURE__ */ __name(function(...args) {
|
|
10144
|
+
if (this) {
|
|
10145
|
+
const [document, init] = args;
|
|
10146
|
+
merge8(this, new UnionTypeClass(document, init), { descriptor: true });
|
|
10147
|
+
return;
|
|
10148
|
+
}
|
|
9834
10149
|
const clasRefs = [...args].filter((x) => !!x);
|
|
9835
10150
|
if (!clasRefs.length)
|
|
9836
10151
|
throw new TypeError("No Class has been provided");
|
|
9837
10152
|
if (clasRefs.length === 1)
|
|
9838
10153
|
return clasRefs[0];
|
|
9839
10154
|
class UnionClass {
|
|
10155
|
+
static {
|
|
10156
|
+
__name(this, "UnionClass");
|
|
10157
|
+
}
|
|
9840
10158
|
constructor() {
|
|
9841
10159
|
for (const c of clasRefs)
|
|
9842
10160
|
inheritPropertyInitializers(this, c);
|
|
9843
10161
|
}
|
|
9844
10162
|
}
|
|
9845
|
-
__name(UnionClass, "UnionClass");
|
|
9846
10163
|
const metadata = {
|
|
9847
|
-
kind:
|
|
10164
|
+
kind: opra_schema_ns_exports.UnionType.Kind,
|
|
9848
10165
|
types: []
|
|
9849
10166
|
};
|
|
9850
10167
|
Reflect.defineMetadata(METADATA_KEY, metadata, UnionClass);
|
|
9851
10168
|
for (const c of clasRefs) {
|
|
9852
10169
|
const itemMeta = Reflect.getMetadata(METADATA_KEY, c);
|
|
9853
|
-
if (!(itemMeta && (itemMeta.kind ===
|
|
9854
|
-
throw new TypeError(`Class "${c.name}" is not a ${
|
|
10170
|
+
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)))
|
|
10171
|
+
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
10172
|
metadata.types.push(c);
|
|
9856
10173
|
applyMixins(UnionClass, c);
|
|
9857
10174
|
}
|
|
9858
10175
|
UnionType2._applyMixin(UnionClass, ...clasRefs);
|
|
9859
10176
|
return UnionClass;
|
|
9860
|
-
}
|
|
9861
|
-
|
|
10177
|
+
}, "UnionType");
|
|
10178
|
+
UnionType2.prototype = UnionTypeClass.prototype;
|
|
10179
|
+
UnionType2._applyMixin = () => void 0;
|
|
9862
10180
|
|
|
9863
10181
|
// ../../build/common/esm/document/factory/process-types.js
|
|
9864
10182
|
async function processTypes() {
|
|
@@ -9883,19 +10201,19 @@ function createDataTypeInstance(kind, name) {
|
|
|
9883
10201
|
name
|
|
9884
10202
|
};
|
|
9885
10203
|
switch (kind) {
|
|
9886
|
-
case
|
|
10204
|
+
case opra_schema_ns_exports.ComplexType.Kind:
|
|
9887
10205
|
Object.setPrototypeOf(dataType, ComplexType2.prototype);
|
|
9888
10206
|
break;
|
|
9889
|
-
case
|
|
10207
|
+
case opra_schema_ns_exports.EnumType.Kind:
|
|
9890
10208
|
Object.setPrototypeOf(dataType, EnumType2.prototype);
|
|
9891
10209
|
break;
|
|
9892
|
-
case
|
|
10210
|
+
case opra_schema_ns_exports.MappedType.Kind:
|
|
9893
10211
|
Object.setPrototypeOf(dataType, MappedType2.prototype);
|
|
9894
10212
|
break;
|
|
9895
|
-
case
|
|
10213
|
+
case opra_schema_ns_exports.SimpleType.Kind:
|
|
9896
10214
|
Object.setPrototypeOf(dataType, SimpleType2.prototype);
|
|
9897
10215
|
break;
|
|
9898
|
-
case
|
|
10216
|
+
case opra_schema_ns_exports.UnionType.Kind:
|
|
9899
10217
|
Object.setPrototypeOf(dataType, UnionType2.prototype);
|
|
9900
10218
|
break;
|
|
9901
10219
|
default:
|
|
@@ -9921,12 +10239,12 @@ function addDataType(schemaOrName) {
|
|
|
9921
10239
|
schema = schemaOrName;
|
|
9922
10240
|
try {
|
|
9923
10241
|
let base;
|
|
9924
|
-
if ((
|
|
10242
|
+
if ((opra_schema_ns_exports.isSimpleType(schema) || opra_schema_ns_exports.isComplexType(schema) || opra_schema_ns_exports.isEnumType(schema)) && schema.base) {
|
|
9925
10243
|
curPath.push(typeof schema.base === "string" ? schema.base : "[base]");
|
|
9926
10244
|
base = this.addDataType(schema.base);
|
|
9927
10245
|
curPath.pop();
|
|
9928
10246
|
}
|
|
9929
|
-
if (
|
|
10247
|
+
if (opra_schema_ns_exports.isSimpleType(schema)) {
|
|
9930
10248
|
const initArgs = {
|
|
9931
10249
|
...schema,
|
|
9932
10250
|
name,
|
|
@@ -9940,7 +10258,7 @@ function addDataType(schemaOrName) {
|
|
|
9940
10258
|
curPath.pop();
|
|
9941
10259
|
return dataType;
|
|
9942
10260
|
}
|
|
9943
|
-
if (
|
|
10261
|
+
if (opra_schema_ns_exports.isComplexType(schema)) {
|
|
9944
10262
|
const initArgs = {
|
|
9945
10263
|
...schema,
|
|
9946
10264
|
name,
|
|
@@ -9969,7 +10287,7 @@ function addDataType(schemaOrName) {
|
|
|
9969
10287
|
curPath.pop();
|
|
9970
10288
|
return dataType;
|
|
9971
10289
|
}
|
|
9972
|
-
if (
|
|
10290
|
+
if (opra_schema_ns_exports.isEnumType(schema)) {
|
|
9973
10291
|
const initArgs = {
|
|
9974
10292
|
...schema,
|
|
9975
10293
|
name,
|
|
@@ -9983,7 +10301,7 @@ function addDataType(schemaOrName) {
|
|
|
9983
10301
|
curPath.pop();
|
|
9984
10302
|
return dataType;
|
|
9985
10303
|
}
|
|
9986
|
-
if (
|
|
10304
|
+
if (opra_schema_ns_exports.isUnionType(schema)) {
|
|
9987
10305
|
const unionTypes = schema.types.map((t) => this.addDataType(t));
|
|
9988
10306
|
const initArgs = {
|
|
9989
10307
|
...schema,
|
|
@@ -9998,7 +10316,7 @@ function addDataType(schemaOrName) {
|
|
|
9998
10316
|
curPath.pop();
|
|
9999
10317
|
return dataType;
|
|
10000
10318
|
}
|
|
10001
|
-
if (
|
|
10319
|
+
if (opra_schema_ns_exports.isMappedType(schema)) {
|
|
10002
10320
|
const dt = this.addDataType(schema.type);
|
|
10003
10321
|
if (!(dt instanceof ComplexType2))
|
|
10004
10322
|
throw new TypeError(`MappedType requires a ComplexType`);
|
|
@@ -10030,7 +10348,11 @@ function addDataType(schemaOrName) {
|
|
|
10030
10348
|
__name(addDataType, "addDataType");
|
|
10031
10349
|
|
|
10032
10350
|
// ../../build/common/esm/document/factory/factory.js
|
|
10033
|
-
var
|
|
10351
|
+
var _a2;
|
|
10352
|
+
var DocumentFactory = class _DocumentFactory {
|
|
10353
|
+
static {
|
|
10354
|
+
__name(this, "DocumentFactory");
|
|
10355
|
+
}
|
|
10034
10356
|
constructor() {
|
|
10035
10357
|
this.document = new ApiDocument();
|
|
10036
10358
|
this.typeQueue = new ResponsiveMap();
|
|
@@ -10044,39 +10366,40 @@ var DocumentFactory = class {
|
|
|
10044
10366
|
* @param init
|
|
10045
10367
|
*/
|
|
10046
10368
|
static async createDocument(init) {
|
|
10047
|
-
const factory = new
|
|
10369
|
+
const factory = new _DocumentFactory();
|
|
10048
10370
|
return factory.createDocument(init);
|
|
10049
10371
|
}
|
|
10050
10372
|
/**
|
|
10051
10373
|
* Downloads schema from the given URL and creates the document instance * @param url
|
|
10052
10374
|
*/
|
|
10053
10375
|
static async createDocumentFromUrl(url) {
|
|
10054
|
-
const factory = new
|
|
10376
|
+
const factory = new _DocumentFactory();
|
|
10055
10377
|
return factory.createDocumentFromUrl(url);
|
|
10056
10378
|
}
|
|
10057
10379
|
};
|
|
10058
|
-
|
|
10380
|
+
_a2 = DocumentFactory;
|
|
10381
|
+
DocumentFactory.designTypeMap = /* @__PURE__ */ new Map();
|
|
10059
10382
|
(() => {
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10383
|
+
_a2.prototype.createDocument = createDocument;
|
|
10384
|
+
_a2.prototype.createDocumentFromUrl = createDocumentFromUrl;
|
|
10385
|
+
_a2.prototype.createBuiltinTypeDocument = createBuiltinTypeDocument;
|
|
10386
|
+
_a2.prototype.addReferences = addReferences;
|
|
10387
|
+
_a2.prototype.importTypeClass = importTypeClass;
|
|
10388
|
+
_a2.prototype.extractSimpleTypeSchema = extractSimpleTypeSchema;
|
|
10389
|
+
_a2.prototype.extractComplexTypeSchema = extractComplexTypeSchema;
|
|
10390
|
+
_a2.prototype.extractMappedTypeSchema = extractMappedTypeSchema;
|
|
10391
|
+
_a2.prototype.extractUnionTypeSchema = extractUnionTypeSchema;
|
|
10392
|
+
_a2.prototype.extractEnumTypeSchema = extractEnumTypeSchema;
|
|
10393
|
+
_a2.prototype.extractFieldSchema = extractFieldSchema;
|
|
10394
|
+
_a2.prototype.processTypes = processTypes;
|
|
10395
|
+
_a2.prototype.createDataTypeInstance = createDataTypeInstance;
|
|
10396
|
+
_a2.prototype.addDataType = addDataType;
|
|
10397
|
+
_a2.prototype.importResourceClass = importResourceClass;
|
|
10398
|
+
_a2.prototype.extractSingletonSchema = extractSingletonSchema;
|
|
10399
|
+
_a2.prototype.extractCollectionSchema = extractCollectionSchema;
|
|
10400
|
+
_a2.prototype.processResourceQueue = processResourceQueue;
|
|
10401
|
+
_a2.prototype.createCollection = createCollection;
|
|
10402
|
+
_a2.prototype.createSingleton = createSingleton;
|
|
10080
10403
|
})();
|
|
10081
10404
|
|
|
10082
10405
|
// ../../build/common/esm/http/enums/http-headers-codes.enum.js
|
|
@@ -10177,15 +10500,18 @@ var HttpHeaderCodes;
|
|
|
10177
10500
|
})(HttpHeaderCodes || (HttpHeaderCodes = {}));
|
|
10178
10501
|
|
|
10179
10502
|
// ../../build/common/esm/http/http-headers.js
|
|
10180
|
-
var
|
|
10503
|
+
var _a3;
|
|
10181
10504
|
var knownKeys = Object.values(HttpHeaderCodes);
|
|
10182
10505
|
var knownKeysLower = knownKeys.map((x) => x.toLowerCase());
|
|
10183
10506
|
var nodeInspectCustom2 = Symbol.for("nodejs.util.inspect.custom");
|
|
10184
10507
|
var kEntries = Symbol("kEntries");
|
|
10185
10508
|
var kOptions2 = Symbol("kOptions");
|
|
10186
|
-
var HttpHeaders = class {
|
|
10509
|
+
var HttpHeaders = class _HttpHeaders {
|
|
10510
|
+
static {
|
|
10511
|
+
__name(this, "HttpHeaders");
|
|
10512
|
+
}
|
|
10187
10513
|
constructor(init, options) {
|
|
10188
|
-
this[
|
|
10514
|
+
this[_a3] = new ResponsiveMap();
|
|
10189
10515
|
this[kOptions2] = { ...options, onChange: void 0 };
|
|
10190
10516
|
if (init) {
|
|
10191
10517
|
if (typeof init === "string")
|
|
@@ -10241,9 +10567,9 @@ var HttpHeaders = class {
|
|
|
10241
10567
|
if (index > 0) {
|
|
10242
10568
|
const name = line.slice(0, index);
|
|
10243
10569
|
const value = line.slice(index + 1).trim();
|
|
10244
|
-
if (
|
|
10570
|
+
if (_HttpHeaders.NON_DELIMITED_HEADERS[name])
|
|
10245
10571
|
this._append(name, value);
|
|
10246
|
-
else if (
|
|
10572
|
+
else if (_HttpHeaders.SEMICOLON_DELIMITED_HEADERS[name]) {
|
|
10247
10573
|
const a = value.split(";");
|
|
10248
10574
|
this._append(name, a.length > 1 ? a : value);
|
|
10249
10575
|
} else {
|
|
@@ -10326,7 +10652,7 @@ var HttpHeaders = class {
|
|
|
10326
10652
|
}
|
|
10327
10653
|
});
|
|
10328
10654
|
}
|
|
10329
|
-
[(
|
|
10655
|
+
[(_a3 = kEntries, nodeInspectCustom2)]() {
|
|
10330
10656
|
return this[kEntries];
|
|
10331
10657
|
}
|
|
10332
10658
|
[Symbol.iterator]() {
|
|
@@ -10340,12 +10666,12 @@ var HttpHeaders = class {
|
|
|
10340
10666
|
const normalizedName = knownKeys[i] || name;
|
|
10341
10667
|
name = name.toLowerCase();
|
|
10342
10668
|
let stored = this[kEntries].get(normalizedName);
|
|
10343
|
-
if (
|
|
10669
|
+
if (_HttpHeaders.NON_DELIMITED_HEADERS[name]) {
|
|
10344
10670
|
value = String(Array.isArray(value) ? value[0] : value);
|
|
10345
10671
|
this[kEntries].set(normalizedName, value);
|
|
10346
10672
|
return;
|
|
10347
10673
|
}
|
|
10348
|
-
if (
|
|
10674
|
+
if (_HttpHeaders.ARRAY_HEADERS[name]) {
|
|
10349
10675
|
stored = (stored ? [stored, value] : [value]).flat().map(String);
|
|
10350
10676
|
this[kEntries].set(normalizedName, stored);
|
|
10351
10677
|
return;
|
|
@@ -10355,7 +10681,7 @@ var HttpHeaders = class {
|
|
|
10355
10681
|
arr.push(...value);
|
|
10356
10682
|
else
|
|
10357
10683
|
arr.push(value);
|
|
10358
|
-
this[kEntries].set(normalizedName, arr.join(
|
|
10684
|
+
this[kEntries].set(normalizedName, arr.join(_HttpHeaders.SEMICOLON_DELIMITED_HEADERS[name] ? "; " : ", "));
|
|
10359
10685
|
}
|
|
10360
10686
|
_set(name, value) {
|
|
10361
10687
|
this[kEntries].delete(name);
|
|
@@ -10368,7 +10694,6 @@ var HttpHeaders = class {
|
|
|
10368
10694
|
this[kOptions2].onChange();
|
|
10369
10695
|
}
|
|
10370
10696
|
};
|
|
10371
|
-
__name(HttpHeaders, "HttpHeaders");
|
|
10372
10697
|
HttpHeaders.kEntries = kEntries;
|
|
10373
10698
|
HttpHeaders.kOptions = kOptions2;
|
|
10374
10699
|
HttpHeaders.NON_DELIMITED_HEADERS = {
|
|
@@ -10400,6 +10725,9 @@ import { splitString as splitString2, tokenize as tokenize2 } from "fast-tokeniz
|
|
|
10400
10725
|
var trueValues = ["true", "t", "yes", "y", "1"];
|
|
10401
10726
|
var falseValues = ["false", "f", "no", "n", "0"];
|
|
10402
10727
|
var BooleanCodec = class {
|
|
10728
|
+
static {
|
|
10729
|
+
__name(this, "BooleanCodec");
|
|
10730
|
+
}
|
|
10403
10731
|
decode(value) {
|
|
10404
10732
|
if (value === "")
|
|
10405
10733
|
return true;
|
|
@@ -10415,11 +10743,13 @@ var BooleanCodec = class {
|
|
|
10415
10743
|
return typeof value === "boolean" ? value ? "true" : "false" : "";
|
|
10416
10744
|
}
|
|
10417
10745
|
};
|
|
10418
|
-
__name(BooleanCodec, "BooleanCodec");
|
|
10419
10746
|
|
|
10420
10747
|
// ../../build/common/esm/http/codecs/date-codec.js
|
|
10421
10748
|
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
10749
|
var DateCodec = class {
|
|
10750
|
+
static {
|
|
10751
|
+
__name(this, "DateCodec");
|
|
10752
|
+
}
|
|
10423
10753
|
constructor(options) {
|
|
10424
10754
|
this.max = options?.max ? coerceToDateString(options.max) : void 0;
|
|
10425
10755
|
this.min = options?.min ? coerceToDateString(options.min) : void 0;
|
|
@@ -10438,7 +10768,6 @@ var DateCodec = class {
|
|
|
10438
10768
|
return coerceToDateString(value, this.time, this.timeZone);
|
|
10439
10769
|
}
|
|
10440
10770
|
};
|
|
10441
|
-
__name(DateCodec, "DateCodec");
|
|
10442
10771
|
function coerceToDateString(value, time, timeZone) {
|
|
10443
10772
|
if (value === "" || value == null)
|
|
10444
10773
|
return "";
|
|
@@ -10457,6 +10786,9 @@ __name(coerceToDateString, "coerceToDateString");
|
|
|
10457
10786
|
|
|
10458
10787
|
// ../../build/common/esm/http/codecs/filter-codec.js
|
|
10459
10788
|
var FilterCodec = class {
|
|
10789
|
+
static {
|
|
10790
|
+
__name(this, "FilterCodec");
|
|
10791
|
+
}
|
|
10460
10792
|
decode(value) {
|
|
10461
10793
|
if (value instanceof Expression)
|
|
10462
10794
|
return value;
|
|
@@ -10466,10 +10798,12 @@ var FilterCodec = class {
|
|
|
10466
10798
|
return value ? "" + value : "";
|
|
10467
10799
|
}
|
|
10468
10800
|
};
|
|
10469
|
-
__name(FilterCodec, "FilterCodec");
|
|
10470
10801
|
|
|
10471
10802
|
// ../../build/common/esm/http/codecs/number-codec.js
|
|
10472
10803
|
var NumberCodec = class {
|
|
10804
|
+
static {
|
|
10805
|
+
__name(this, "NumberCodec");
|
|
10806
|
+
}
|
|
10473
10807
|
constructor(options) {
|
|
10474
10808
|
this.max = options?.max;
|
|
10475
10809
|
this.min = options?.min;
|
|
@@ -10488,10 +10822,12 @@ var NumberCodec = class {
|
|
|
10488
10822
|
return typeof value === "number" ? "" + value : "";
|
|
10489
10823
|
}
|
|
10490
10824
|
};
|
|
10491
|
-
__name(NumberCodec, "NumberCodec");
|
|
10492
10825
|
|
|
10493
10826
|
// ../../build/common/esm/http/codecs/integer-codec.js
|
|
10494
10827
|
var IntegerCodec = class extends NumberCodec {
|
|
10828
|
+
static {
|
|
10829
|
+
__name(this, "IntegerCodec");
|
|
10830
|
+
}
|
|
10495
10831
|
constructor(options) {
|
|
10496
10832
|
super(options);
|
|
10497
10833
|
this.enum = options?.enum;
|
|
@@ -10505,10 +10841,12 @@ var IntegerCodec = class extends NumberCodec {
|
|
|
10505
10841
|
return v;
|
|
10506
10842
|
}
|
|
10507
10843
|
};
|
|
10508
|
-
__name(IntegerCodec, "IntegerCodec");
|
|
10509
10844
|
|
|
10510
10845
|
// ../../build/common/esm/http/codecs/string-codec.js
|
|
10511
10846
|
var StringCodec = class {
|
|
10847
|
+
static {
|
|
10848
|
+
__name(this, "StringCodec");
|
|
10849
|
+
}
|
|
10512
10850
|
constructor(options) {
|
|
10513
10851
|
this.maxLength = options?.maxLength;
|
|
10514
10852
|
this.minLength = options?.minLength;
|
|
@@ -10527,19 +10865,21 @@ var StringCodec = class {
|
|
|
10527
10865
|
return value == null ? "" : "" + value;
|
|
10528
10866
|
}
|
|
10529
10867
|
};
|
|
10530
|
-
__name(StringCodec, "StringCodec");
|
|
10531
10868
|
|
|
10532
10869
|
// ../../build/common/esm/http/http-params.js
|
|
10533
|
-
var
|
|
10870
|
+
var _a4;
|
|
10534
10871
|
var _b2;
|
|
10535
10872
|
var _c2;
|
|
10536
10873
|
var kEntries2 = Symbol("kEntries");
|
|
10537
10874
|
var kSize = Symbol("kSize");
|
|
10538
10875
|
var kParamDefs = Symbol("kParamDefs");
|
|
10539
10876
|
var kOptions3 = Symbol("kOptions");
|
|
10540
|
-
var HttpParams = class {
|
|
10877
|
+
var HttpParams = class _HttpParams {
|
|
10878
|
+
static {
|
|
10879
|
+
__name(this, "HttpParams");
|
|
10880
|
+
}
|
|
10541
10881
|
constructor(init, options) {
|
|
10542
|
-
this[
|
|
10882
|
+
this[_a4] = new ResponsiveMap();
|
|
10543
10883
|
this[_b2] = 0;
|
|
10544
10884
|
this[_c2] = /* @__PURE__ */ new Map();
|
|
10545
10885
|
this[kOptions3] = { ...options, onChange: void 0 };
|
|
@@ -10735,9 +11075,9 @@ var HttpParams = class {
|
|
|
10735
11075
|
throw new Error('"name" argument required');
|
|
10736
11076
|
if (!options)
|
|
10737
11077
|
throw new Error('"options" argument required');
|
|
10738
|
-
if (typeof options.codec === "string" && !
|
|
11078
|
+
if (typeof options.codec === "string" && !_HttpParams.codecs[options.codec])
|
|
10739
11079
|
throw new Error(`Unknown url parameter format name "${options.codec}"`);
|
|
10740
|
-
const codec = (typeof options?.codec === "string" ?
|
|
11080
|
+
const codec = (typeof options?.codec === "string" ? _HttpParams.codecs[options.codec] : options?.codec) || _HttpParams.codecs.string;
|
|
10741
11081
|
const meta = {
|
|
10742
11082
|
...options,
|
|
10743
11083
|
codec
|
|
@@ -10783,7 +11123,7 @@ var HttpParams = class {
|
|
|
10783
11123
|
}
|
|
10784
11124
|
return decodeURIComponent(value);
|
|
10785
11125
|
}
|
|
10786
|
-
[(
|
|
11126
|
+
[(_a4 = kEntries2, _b2 = kSize, _c2 = kParamDefs, Symbol.iterator)]() {
|
|
10787
11127
|
return this.entries();
|
|
10788
11128
|
}
|
|
10789
11129
|
get [Symbol.toStringTag]() {
|
|
@@ -10834,7 +11174,6 @@ var HttpParams = class {
|
|
|
10834
11174
|
this[kSize] += -oldLen + values.length;
|
|
10835
11175
|
}
|
|
10836
11176
|
};
|
|
10837
|
-
__name(HttpParams, "HttpParams");
|
|
10838
11177
|
HttpParams.kEntries = kEntries2;
|
|
10839
11178
|
HttpParams.kSize = kSize;
|
|
10840
11179
|
HttpParams.kParamDefs = kParamDefs;
|
|
@@ -10863,14 +11202,66 @@ function encodeURIParam(v) {
|
|
|
10863
11202
|
}
|
|
10864
11203
|
__name(encodeURIParam, "encodeURIParam");
|
|
10865
11204
|
|
|
10866
|
-
// ../../build/common/esm/http/http-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
11205
|
+
// ../../build/common/esm/http/enums/http-status-codes.enum.js
|
|
11206
|
+
var HttpStatusCodes;
|
|
11207
|
+
(function(HttpStatusCodes2) {
|
|
11208
|
+
HttpStatusCodes2[HttpStatusCodes2["CONTINUE"] = 100] = "CONTINUE";
|
|
11209
|
+
HttpStatusCodes2[HttpStatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
11210
|
+
HttpStatusCodes2[HttpStatusCodes2["PROCESSING"] = 102] = "PROCESSING";
|
|
11211
|
+
HttpStatusCodes2[HttpStatusCodes2["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
11212
|
+
HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
|
|
11213
|
+
HttpStatusCodes2[HttpStatusCodes2["CREATED"] = 201] = "CREATED";
|
|
11214
|
+
HttpStatusCodes2[HttpStatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
11215
|
+
HttpStatusCodes2[HttpStatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
11216
|
+
HttpStatusCodes2[HttpStatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
11217
|
+
HttpStatusCodes2[HttpStatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
11218
|
+
HttpStatusCodes2[HttpStatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
11219
|
+
HttpStatusCodes2[HttpStatusCodes2["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
11220
|
+
HttpStatusCodes2[HttpStatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
11221
|
+
HttpStatusCodes2[HttpStatusCodes2["FOUND"] = 302] = "FOUND";
|
|
11222
|
+
HttpStatusCodes2[HttpStatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
11223
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
11224
|
+
HttpStatusCodes2[HttpStatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
11225
|
+
HttpStatusCodes2[HttpStatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
11226
|
+
HttpStatusCodes2[HttpStatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
11227
|
+
HttpStatusCodes2[HttpStatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
11228
|
+
HttpStatusCodes2[HttpStatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
11229
|
+
HttpStatusCodes2[HttpStatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
11230
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
11231
|
+
HttpStatusCodes2[HttpStatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
11232
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
11233
|
+
HttpStatusCodes2[HttpStatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
11234
|
+
HttpStatusCodes2[HttpStatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
11235
|
+
HttpStatusCodes2[HttpStatusCodes2["CONFLICT"] = 409] = "CONFLICT";
|
|
11236
|
+
HttpStatusCodes2[HttpStatusCodes2["GONE"] = 410] = "GONE";
|
|
11237
|
+
HttpStatusCodes2[HttpStatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
11238
|
+
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
11239
|
+
HttpStatusCodes2[HttpStatusCodes2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
11240
|
+
HttpStatusCodes2[HttpStatusCodes2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
11241
|
+
HttpStatusCodes2[HttpStatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
11242
|
+
HttpStatusCodes2[HttpStatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
11243
|
+
HttpStatusCodes2[HttpStatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
11244
|
+
HttpStatusCodes2[HttpStatusCodes2["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
11245
|
+
HttpStatusCodes2[HttpStatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
11246
|
+
HttpStatusCodes2[HttpStatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
11247
|
+
HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
|
|
11248
|
+
HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
11249
|
+
HttpStatusCodes2[HttpStatusCodes2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
11250
|
+
HttpStatusCodes2[HttpStatusCodes2["UPGRADE_REQUIRED"] = 428] = "UPGRADE_REQUIRED";
|
|
11251
|
+
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
11252
|
+
HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
11253
|
+
HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
11254
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
11255
|
+
HttpStatusCodes2[HttpStatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
11256
|
+
HttpStatusCodes2[HttpStatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
11257
|
+
HttpStatusCodes2[HttpStatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
11258
|
+
HttpStatusCodes2[HttpStatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
11259
|
+
HttpStatusCodes2[HttpStatusCodes2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
11260
|
+
HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
11261
|
+
HttpStatusCodes2[HttpStatusCodes2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
11262
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
11263
|
+
HttpStatusCodes2[HttpStatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
11264
|
+
})(HttpStatusCodes || (HttpStatusCodes = {}));
|
|
10874
11265
|
|
|
10875
11266
|
// ../../build/common/esm/http/enums/http-status-messages.js
|
|
10876
11267
|
var HttpStatusMessages = {
|
|
@@ -10939,653 +11330,6 @@ var HttpStatusMessages = {
|
|
|
10939
11330
|
"511": "Network Authentication Required"
|
|
10940
11331
|
};
|
|
10941
11332
|
|
|
10942
|
-
// ../../build/common/esm/http/http-message.host.js
|
|
10943
|
-
import stream from "@browsery/stream";
|
|
10944
|
-
import { HTTPParser } from "@browsery/http-parser";
|
|
10945
|
-
var kHeaders = Symbol("kHeaders");
|
|
10946
|
-
var kHeadersProxy = Symbol("kHeadersProxy");
|
|
10947
|
-
var kTrailers = Symbol("kTrailers");
|
|
10948
|
-
var kTrailersProxy = Symbol("kTrailersProxy");
|
|
10949
|
-
var kOnHeaderReceived = Symbol("kOnHeaderReceived");
|
|
10950
|
-
var kOnTrailersReceived = Symbol("kOnTrailersReceived");
|
|
10951
|
-
var kOnBodyChunk = Symbol("kOnBodyChunk");
|
|
10952
|
-
var kOnReadComplete = Symbol("kOnReadComplete");
|
|
10953
|
-
var crlfBuffer = Buffer.from("\r\n");
|
|
10954
|
-
var HTTP_VERSION_PATTERN = /^(\d)\.(\d)$/;
|
|
10955
|
-
var HttpMessageHost = class {
|
|
10956
|
-
constructor() {
|
|
10957
|
-
this.complete = false;
|
|
10958
|
-
stream.Duplex.apply(this);
|
|
10959
|
-
this[kHeaders] = new HttpHeaders(void 0, {
|
|
10960
|
-
onChange: () => this._headersChanged = true
|
|
10961
|
-
});
|
|
10962
|
-
this[kTrailers] = new HttpHeaders(void 0, {
|
|
10963
|
-
onChange: () => this._trailersChanged = true
|
|
10964
|
-
});
|
|
10965
|
-
}
|
|
10966
|
-
get httpVersion() {
|
|
10967
|
-
return this.httpVersionMajor ? this.httpVersionMajor + "." + (this.httpVersionMinor || 0) : void 0;
|
|
10968
|
-
}
|
|
10969
|
-
set httpVersion(value) {
|
|
10970
|
-
if (value) {
|
|
10971
|
-
const m = HTTP_VERSION_PATTERN.exec(value);
|
|
10972
|
-
if (!m)
|
|
10973
|
-
throw new TypeError(`Invalid http version string (${value})`);
|
|
10974
|
-
this.httpVersionMajor = parseInt(m[1], 10);
|
|
10975
|
-
this.httpVersionMinor = parseInt(m[2], 10);
|
|
10976
|
-
} else {
|
|
10977
|
-
this.httpVersionMajor = void 0;
|
|
10978
|
-
this.httpVersionMinor = void 0;
|
|
10979
|
-
}
|
|
10980
|
-
}
|
|
10981
|
-
get headers() {
|
|
10982
|
-
this._initHeaders();
|
|
10983
|
-
return this[kHeadersProxy];
|
|
10984
|
-
}
|
|
10985
|
-
set headers(headers) {
|
|
10986
|
-
this[kHeaders].clear();
|
|
10987
|
-
this[kHeaders].set(headers);
|
|
10988
|
-
}
|
|
10989
|
-
get trailers() {
|
|
10990
|
-
this._initTrailers();
|
|
10991
|
-
return this[kTrailersProxy];
|
|
10992
|
-
}
|
|
10993
|
-
set trailers(trailers) {
|
|
10994
|
-
this[kTrailers].clear();
|
|
10995
|
-
this[kTrailers].set(trailers);
|
|
10996
|
-
}
|
|
10997
|
-
get rawHeaders() {
|
|
10998
|
-
this._buildRawHeaders();
|
|
10999
|
-
return this._rawHeaders;
|
|
11000
|
-
}
|
|
11001
|
-
set rawHeaders(headers) {
|
|
11002
|
-
this[kHeadersProxy] = void 0;
|
|
11003
|
-
this._headersChanged = false;
|
|
11004
|
-
this._rawHeaders = headers;
|
|
11005
|
-
}
|
|
11006
|
-
get rawTrailers() {
|
|
11007
|
-
this._buildRawTrailers();
|
|
11008
|
-
return this._rawTrailers;
|
|
11009
|
-
}
|
|
11010
|
-
set rawTrailers(trailers) {
|
|
11011
|
-
this[kTrailersProxy] = void 0;
|
|
11012
|
-
this._trailersChanged = false;
|
|
11013
|
-
this._rawTrailers = trailers;
|
|
11014
|
-
}
|
|
11015
|
-
getHeader(name) {
|
|
11016
|
-
if (!name)
|
|
11017
|
-
return;
|
|
11018
|
-
this._initHeaders();
|
|
11019
|
-
switch (name.toLowerCase()) {
|
|
11020
|
-
case "referer":
|
|
11021
|
-
case "referrer":
|
|
11022
|
-
return this[kHeaders].get(name) || this[kHeaders].get("referrer") || this[kHeaders].get("referer");
|
|
11023
|
-
default:
|
|
11024
|
-
return this[kHeaders].get(name);
|
|
11025
|
-
}
|
|
11026
|
-
}
|
|
11027
|
-
get(name) {
|
|
11028
|
-
this._initHeaders();
|
|
11029
|
-
return this[kHeaders].get(name);
|
|
11030
|
-
}
|
|
11031
|
-
setHeader(arg0, arg1) {
|
|
11032
|
-
this._initHeaders();
|
|
11033
|
-
if (typeof arg0 === "object")
|
|
11034
|
-
this[kHeaders].set(arg0);
|
|
11035
|
-
else
|
|
11036
|
-
this[kHeaders].set(arg0, arg1);
|
|
11037
|
-
return this;
|
|
11038
|
-
}
|
|
11039
|
-
set(arg0, arg1) {
|
|
11040
|
-
return this.setHeader(arg0, arg1);
|
|
11041
|
-
}
|
|
11042
|
-
getHeaders() {
|
|
11043
|
-
this._initHeaders();
|
|
11044
|
-
return this[kHeaders].toObject();
|
|
11045
|
-
}
|
|
11046
|
-
getHeaderNames() {
|
|
11047
|
-
this._initHeaders();
|
|
11048
|
-
return Array.from(this[kHeaders].keys());
|
|
11049
|
-
}
|
|
11050
|
-
hasHeader(name) {
|
|
11051
|
-
this._initHeaders();
|
|
11052
|
-
return this[kHeaders].has(name);
|
|
11053
|
-
}
|
|
11054
|
-
removeHeader(name) {
|
|
11055
|
-
this._initHeaders();
|
|
11056
|
-
this[kHeaders].delete(name);
|
|
11057
|
-
}
|
|
11058
|
-
send(body) {
|
|
11059
|
-
this.body = body;
|
|
11060
|
-
return this;
|
|
11061
|
-
}
|
|
11062
|
-
end(body) {
|
|
11063
|
-
if (body)
|
|
11064
|
-
this.body = body;
|
|
11065
|
-
return this;
|
|
11066
|
-
}
|
|
11067
|
-
setTimeout() {
|
|
11068
|
-
return this;
|
|
11069
|
-
}
|
|
11070
|
-
_init(args) {
|
|
11071
|
-
this.complete = true;
|
|
11072
|
-
this.httpVersionMajor = args?.httpVersionMajor;
|
|
11073
|
-
this.httpVersionMinor = args?.httpVersionMinor;
|
|
11074
|
-
this._rawHeaders = args.rawHeaders;
|
|
11075
|
-
this._rawTrailers = args.rawTrailers;
|
|
11076
|
-
if (args.headers)
|
|
11077
|
-
this[kHeaders].set(args.headers);
|
|
11078
|
-
if (args.trailers)
|
|
11079
|
-
this[kTrailers].set(args.trailers);
|
|
11080
|
-
this.body = args.body;
|
|
11081
|
-
}
|
|
11082
|
-
_parseBuffer(buf, parserType) {
|
|
11083
|
-
const parser = new HTTPParser(parserType);
|
|
11084
|
-
parser[HTTPParser.kOnHeadersComplete] = this[kOnHeaderReceived].bind(this);
|
|
11085
|
-
parser[HTTPParser.kOnBody] = this[kOnBodyChunk].bind(this);
|
|
11086
|
-
parser[HTTPParser.kOnHeaders] = this[kOnTrailersReceived].bind(this);
|
|
11087
|
-
parser[HTTPParser.kOnMessageComplete] = this[kOnReadComplete].bind(this);
|
|
11088
|
-
const buffer = Buffer.from(buf);
|
|
11089
|
-
let x = parser.execute(buffer);
|
|
11090
|
-
if (typeof x === "object")
|
|
11091
|
-
throw x;
|
|
11092
|
-
if (!this.complete) {
|
|
11093
|
-
x = parser.execute(crlfBuffer);
|
|
11094
|
-
if (typeof x === "object")
|
|
11095
|
-
throw x;
|
|
11096
|
-
}
|
|
11097
|
-
parser.finish();
|
|
11098
|
-
}
|
|
11099
|
-
_initHeaders() {
|
|
11100
|
-
if (!this[kHeadersProxy]) {
|
|
11101
|
-
this[kHeadersProxy] = this[kHeaders].getProxy();
|
|
11102
|
-
if (this._rawHeaders) {
|
|
11103
|
-
const src = this._rawHeaders;
|
|
11104
|
-
const l = Math.floor(src.length / 2);
|
|
11105
|
-
for (let n = 0; n <= l; n += 2) {
|
|
11106
|
-
this[kHeaders].append(src[n], src[n + 1]);
|
|
11107
|
-
}
|
|
11108
|
-
}
|
|
11109
|
-
}
|
|
11110
|
-
}
|
|
11111
|
-
_initTrailers() {
|
|
11112
|
-
if (!this[kTrailersProxy]) {
|
|
11113
|
-
this[kTrailersProxy] = this[kTrailers].getProxy();
|
|
11114
|
-
if (this._rawTrailers) {
|
|
11115
|
-
const src = this._rawTrailers;
|
|
11116
|
-
const l = Math.floor(src.length / 2);
|
|
11117
|
-
for (let n = 0; n <= l; n += 2) {
|
|
11118
|
-
this[kTrailers].append(src[n], src[n + 1]);
|
|
11119
|
-
}
|
|
11120
|
-
}
|
|
11121
|
-
}
|
|
11122
|
-
}
|
|
11123
|
-
_buildRawHeaders() {
|
|
11124
|
-
if (this._headersChanged || !this._rawHeaders) {
|
|
11125
|
-
this._headersChanged = false;
|
|
11126
|
-
this._rawHeaders = Object.entries(this.headers).reduce((a, [k, v]) => {
|
|
11127
|
-
if (Array.isArray(v))
|
|
11128
|
-
v.forEach((x) => a.push(k, String(x)));
|
|
11129
|
-
else
|
|
11130
|
-
a.push(k, String(v));
|
|
11131
|
-
return a;
|
|
11132
|
-
}, []);
|
|
11133
|
-
}
|
|
11134
|
-
}
|
|
11135
|
-
_buildRawTrailers() {
|
|
11136
|
-
if (this._trailersChanged || !this._rawTrailers) {
|
|
11137
|
-
this._trailersChanged = false;
|
|
11138
|
-
this._rawTrailers = Object.entries(this.trailers).reduce((a, [k, v]) => {
|
|
11139
|
-
if (Array.isArray(v))
|
|
11140
|
-
v.forEach((x) => a.push(k, String(x)));
|
|
11141
|
-
else
|
|
11142
|
-
a.push(k, String(v));
|
|
11143
|
-
return a;
|
|
11144
|
-
}, []);
|
|
11145
|
-
}
|
|
11146
|
-
}
|
|
11147
|
-
[kOnHeaderReceived](info) {
|
|
11148
|
-
this.httpVersionMajor = info.versionMajor;
|
|
11149
|
-
this.httpVersionMinor = info.versionMinor;
|
|
11150
|
-
this._rawHeaders = info.headers;
|
|
11151
|
-
this.shouldKeepAlive = info.shouldKeepAlive;
|
|
11152
|
-
this.upgrade = info.upgrade;
|
|
11153
|
-
}
|
|
11154
|
-
[kOnTrailersReceived](trailers) {
|
|
11155
|
-
this._rawTrailers = trailers;
|
|
11156
|
-
}
|
|
11157
|
-
[kOnBodyChunk](chunk, offset, length) {
|
|
11158
|
-
this._bodyChunks = this._bodyChunks || [];
|
|
11159
|
-
this._bodyChunks.push(chunk.subarray(offset, offset + length));
|
|
11160
|
-
}
|
|
11161
|
-
[kOnReadComplete]() {
|
|
11162
|
-
this.complete = true;
|
|
11163
|
-
if (this._bodyChunks) {
|
|
11164
|
-
this.body = Buffer.concat(this._bodyChunks);
|
|
11165
|
-
this._bodyChunks = void 0;
|
|
11166
|
-
}
|
|
11167
|
-
}
|
|
11168
|
-
};
|
|
11169
|
-
__name(HttpMessageHost, "HttpMessageHost");
|
|
11170
|
-
HttpMessageHost.kHeaders = kHeaders;
|
|
11171
|
-
HttpMessageHost.kHeadersProxy = kHeadersProxy;
|
|
11172
|
-
HttpMessageHost.kTrailers = kTrailers;
|
|
11173
|
-
HttpMessageHost.kTrailersProxy = kTrailersProxy;
|
|
11174
|
-
HttpMessageHost.kOnHeaderReceived = kOnHeaderReceived;
|
|
11175
|
-
HttpMessageHost.kOnTrailersReceived = kOnTrailersReceived;
|
|
11176
|
-
HttpMessageHost.kOnBodyChunk = kOnBodyChunk;
|
|
11177
|
-
HttpMessageHost.kOnReadComplete = kOnReadComplete;
|
|
11178
|
-
Object.assign(HttpMessageHost.prototype, stream.Duplex.prototype);
|
|
11179
|
-
|
|
11180
|
-
// ../../build/common/esm/http/http-response-message.js
|
|
11181
|
-
var HttpResponseMessage;
|
|
11182
|
-
(function(HttpResponseMessage2) {
|
|
11183
|
-
function create(init) {
|
|
11184
|
-
return HttpResponseMessageHost.create(init);
|
|
11185
|
-
}
|
|
11186
|
-
__name(create, "create");
|
|
11187
|
-
HttpResponseMessage2.create = create;
|
|
11188
|
-
function fromBuffer(buffer) {
|
|
11189
|
-
return HttpResponseMessageHost.fromBuffer(buffer);
|
|
11190
|
-
}
|
|
11191
|
-
__name(fromBuffer, "fromBuffer");
|
|
11192
|
-
HttpResponseMessage2.fromBuffer = fromBuffer;
|
|
11193
|
-
async function fromStream(readable) {
|
|
11194
|
-
return HttpResponseMessageHost.fromStream(readable);
|
|
11195
|
-
}
|
|
11196
|
-
__name(fromStream, "fromStream");
|
|
11197
|
-
HttpResponseMessage2.fromStream = fromStream;
|
|
11198
|
-
})(HttpResponseMessage || (HttpResponseMessage = {}));
|
|
11199
|
-
var HttpResponseMessageHost = class extends HttpMessageHost {
|
|
11200
|
-
constructor() {
|
|
11201
|
-
super();
|
|
11202
|
-
}
|
|
11203
|
-
header(arg0, arg1) {
|
|
11204
|
-
return this.set(arg0, arg1);
|
|
11205
|
-
}
|
|
11206
|
-
append(name, value) {
|
|
11207
|
-
this[HttpMessageHost.kHeaders].append(name, value);
|
|
11208
|
-
return this;
|
|
11209
|
-
}
|
|
11210
|
-
/**
|
|
11211
|
-
* Set "Content-Disposition" header to "attachment" with optional `filename`.
|
|
11212
|
-
*/
|
|
11213
|
-
attachment(filename) {
|
|
11214
|
-
if (filename)
|
|
11215
|
-
this.type(path2.extname(filename));
|
|
11216
|
-
this.set("Content-Disposition", contentDisposition(filename));
|
|
11217
|
-
return this;
|
|
11218
|
-
}
|
|
11219
|
-
/**
|
|
11220
|
-
* Alias for msg.type()
|
|
11221
|
-
*/
|
|
11222
|
-
contentType(type) {
|
|
11223
|
-
return this.type(type);
|
|
11224
|
-
}
|
|
11225
|
-
/**
|
|
11226
|
-
* Set _Content-Type_ response header with `type` through `mime.lookup()`
|
|
11227
|
-
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
11228
|
-
*
|
|
11229
|
-
* Examples:
|
|
11230
|
-
*
|
|
11231
|
-
* res.type('.html');
|
|
11232
|
-
* res.type('html');
|
|
11233
|
-
* res.type('json');
|
|
11234
|
-
* res.type('application/json');
|
|
11235
|
-
* res.type('png');
|
|
11236
|
-
*/
|
|
11237
|
-
type(type) {
|
|
11238
|
-
const ct = type.indexOf("/") === -1 ? mime.lookup(type) : type;
|
|
11239
|
-
if (ct)
|
|
11240
|
-
this.set("Content-Type", ct);
|
|
11241
|
-
return this;
|
|
11242
|
-
}
|
|
11243
|
-
/**
|
|
11244
|
-
* Set cookie `name` to `value`, with the given `options`.
|
|
11245
|
-
*
|
|
11246
|
-
* Options:
|
|
11247
|
-
*
|
|
11248
|
-
* - `maxAge` max-age in milliseconds, converted to `expires`
|
|
11249
|
-
* - `signed` sign the cookie
|
|
11250
|
-
* - `path` defaults to "/"
|
|
11251
|
-
*
|
|
11252
|
-
* Examples:
|
|
11253
|
-
*
|
|
11254
|
-
* // "Remember Me" for 15 minutes
|
|
11255
|
-
* res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
|
|
11256
|
-
*
|
|
11257
|
-
* // same as above
|
|
11258
|
-
* res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
|
|
11259
|
-
*
|
|
11260
|
-
*/
|
|
11261
|
-
cookie(name, value, options) {
|
|
11262
|
-
const opts = { ...options };
|
|
11263
|
-
const secret = this.req?.secret;
|
|
11264
|
-
const signed = opts.signed;
|
|
11265
|
-
if (signed && !secret) {
|
|
11266
|
-
throw new Error('cookieParser("secret") required for signed cookies');
|
|
11267
|
-
}
|
|
11268
|
-
let val = typeof value === "object" ? "j:" + JSON.stringify(value) : String(value);
|
|
11269
|
-
if (signed)
|
|
11270
|
-
val = "s:" + cookieSignature.sign(val, secret);
|
|
11271
|
-
if (opts.maxAge != null) {
|
|
11272
|
-
const maxAge = opts.maxAge - 0;
|
|
11273
|
-
if (!isNaN(maxAge)) {
|
|
11274
|
-
opts.expires = new Date(Date.now() + maxAge);
|
|
11275
|
-
opts.maxAge = Math.floor(maxAge / 1e3);
|
|
11276
|
-
}
|
|
11277
|
-
}
|
|
11278
|
-
if (opts.path == null)
|
|
11279
|
-
opts.path = "/";
|
|
11280
|
-
let a = this.get("Set-Cookie");
|
|
11281
|
-
if (a && Array.isArray(a)) {
|
|
11282
|
-
a = a.filter((x) => !x.startsWith(name + "="));
|
|
11283
|
-
this.set("Set-Cookie", a);
|
|
11284
|
-
}
|
|
11285
|
-
this.append("Set-Cookie", cookie.serialize(name, String(val), opts));
|
|
11286
|
-
return this;
|
|
11287
|
-
}
|
|
11288
|
-
/**
|
|
11289
|
-
* Clear cookie `name`.
|
|
11290
|
-
*/
|
|
11291
|
-
clearCookie(name, options) {
|
|
11292
|
-
return this.cookie(name, "", { expires: /* @__PURE__ */ new Date(1), path: "/", ...options });
|
|
11293
|
-
}
|
|
11294
|
-
/**
|
|
11295
|
-
* Set Link header field with the given `links`.
|
|
11296
|
-
*
|
|
11297
|
-
* Examples:
|
|
11298
|
-
*
|
|
11299
|
-
* res.links({
|
|
11300
|
-
* next: 'http://api.example.com/users?page=2',
|
|
11301
|
-
* last: 'http://api.example.com/users?page=5'
|
|
11302
|
-
* });
|
|
11303
|
-
*
|
|
11304
|
-
*/
|
|
11305
|
-
links(links) {
|
|
11306
|
-
let link = this.get("Link") || "";
|
|
11307
|
-
if (link)
|
|
11308
|
-
link += ", ";
|
|
11309
|
-
return this.set("Link", link + Object.keys(links).map((rel) => "<" + links[rel] + '>; rel="' + rel + '"').join(", "));
|
|
11310
|
-
}
|
|
11311
|
-
redirect(arg0, url) {
|
|
11312
|
-
let status = 302;
|
|
11313
|
-
if (typeof arg0 === "number") {
|
|
11314
|
-
status = arg0;
|
|
11315
|
-
} else
|
|
11316
|
-
url = arg0 || "";
|
|
11317
|
-
this.location(url || "/");
|
|
11318
|
-
this.statusCode = status;
|
|
11319
|
-
}
|
|
11320
|
-
/**
|
|
11321
|
-
* Send JSON response.
|
|
11322
|
-
*
|
|
11323
|
-
* Examples:
|
|
11324
|
-
*
|
|
11325
|
-
* res.json(null);
|
|
11326
|
-
* res.json({ user: 'tj' });
|
|
11327
|
-
*/
|
|
11328
|
-
json(obj) {
|
|
11329
|
-
if (!this.get("Content-Type"))
|
|
11330
|
-
this.set("Content-Type", "application/json");
|
|
11331
|
-
const body = JSON.stringify(obj);
|
|
11332
|
-
return this.send(body);
|
|
11333
|
-
}
|
|
11334
|
-
location(url) {
|
|
11335
|
-
let loc = url;
|
|
11336
|
-
if (url === "back")
|
|
11337
|
-
loc = this.req?.get("Referrer") || "/";
|
|
11338
|
-
return this.set("Location", encodeUrl(loc));
|
|
11339
|
-
}
|
|
11340
|
-
/**
|
|
11341
|
-
* Set status `code`.
|
|
11342
|
-
*/
|
|
11343
|
-
status(code) {
|
|
11344
|
-
this.statusCode = code;
|
|
11345
|
-
return this;
|
|
11346
|
-
}
|
|
11347
|
-
/**
|
|
11348
|
-
* Set the response HTTP status code to `statusCode` and send its string representation as the response body.
|
|
11349
|
-
* @link http://expressjs.com/4x/api.html#res.sendStatus
|
|
11350
|
-
*
|
|
11351
|
-
* Examples:
|
|
11352
|
-
*
|
|
11353
|
-
* res.sendStatus(200); // equivalent to res.status(200).send('OK')
|
|
11354
|
-
* res.sendStatus(403); // equivalent to res.status(403).send('Forbidden')
|
|
11355
|
-
* res.sendStatus(404); // equivalent to res.status(404).send('Not Found')
|
|
11356
|
-
* res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error')
|
|
11357
|
-
*/
|
|
11358
|
-
sendStatus(statusCode) {
|
|
11359
|
-
const body = HttpStatusMessages[statusCode] || String(statusCode);
|
|
11360
|
-
this.statusCode = statusCode;
|
|
11361
|
-
this.type("txt");
|
|
11362
|
-
return this.send(body);
|
|
11363
|
-
}
|
|
11364
|
-
_init(init) {
|
|
11365
|
-
super._init(init);
|
|
11366
|
-
this.statusCode = init?.statusCode;
|
|
11367
|
-
this.statusMessage = init?.statusMessage;
|
|
11368
|
-
this.req = init?.req;
|
|
11369
|
-
this.chunkedEncoding = init?.chunkedEncoding;
|
|
11370
|
-
}
|
|
11371
|
-
[HttpMessageHost.kOnHeaderReceived](info) {
|
|
11372
|
-
super[HttpMessageHost.kOnHeaderReceived](info);
|
|
11373
|
-
this.statusCode = info.statusCode;
|
|
11374
|
-
this.statusMessage = info.statusMessage;
|
|
11375
|
-
}
|
|
11376
|
-
static create(init) {
|
|
11377
|
-
const msg = new HttpResponseMessageHost();
|
|
11378
|
-
msg._init(init);
|
|
11379
|
-
return msg;
|
|
11380
|
-
}
|
|
11381
|
-
static fromBuffer(buffer) {
|
|
11382
|
-
const msg = new HttpResponseMessageHost();
|
|
11383
|
-
msg._parseBuffer(buffer, HTTPParser2.RESPONSE);
|
|
11384
|
-
return msg;
|
|
11385
|
-
}
|
|
11386
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11387
|
-
static async fromStream(readable) {
|
|
11388
|
-
throw new Error("fromStream is not implemented yet");
|
|
11389
|
-
}
|
|
11390
|
-
};
|
|
11391
|
-
__name(HttpResponseMessageHost, "HttpResponseMessageHost");
|
|
11392
|
-
|
|
11393
|
-
// ../../build/common/esm/http/http-request-message.js
|
|
11394
|
-
import accepts from "accepts";
|
|
11395
|
-
import typeIs from "type-is";
|
|
11396
|
-
import { HTTPParser as HTTPParser3 } from "@browsery/http-parser";
|
|
11397
|
-
var HTTP_VERSION_PATTERN2 = /^(\d)\.(\d)$/;
|
|
11398
|
-
var HttpRequestMessage;
|
|
11399
|
-
(function(HttpRequestMessage2) {
|
|
11400
|
-
function create(init) {
|
|
11401
|
-
return HttpRequestMessageHost.create(init);
|
|
11402
|
-
}
|
|
11403
|
-
__name(create, "create");
|
|
11404
|
-
HttpRequestMessage2.create = create;
|
|
11405
|
-
function fromBuffer(buffer) {
|
|
11406
|
-
return HttpRequestMessageHost.fromBuffer(buffer);
|
|
11407
|
-
}
|
|
11408
|
-
__name(fromBuffer, "fromBuffer");
|
|
11409
|
-
HttpRequestMessage2.fromBuffer = fromBuffer;
|
|
11410
|
-
async function fromStream(readable) {
|
|
11411
|
-
return HttpRequestMessageHost.fromStream(readable);
|
|
11412
|
-
}
|
|
11413
|
-
__name(fromStream, "fromStream");
|
|
11414
|
-
HttpRequestMessage2.fromStream = fromStream;
|
|
11415
|
-
})(HttpRequestMessage || (HttpRequestMessage = {}));
|
|
11416
|
-
var kQuery = Symbol("kQuery");
|
|
11417
|
-
var kQueryProxy = Symbol("kQueryProxy");
|
|
11418
|
-
var kProtocol = Symbol("kProtocol");
|
|
11419
|
-
var HttpRequestMessageHost = class extends HttpMessageHost {
|
|
11420
|
-
constructor() {
|
|
11421
|
-
super();
|
|
11422
|
-
this.httpVersionMajor = 1;
|
|
11423
|
-
this.httpVersionMinor = 0;
|
|
11424
|
-
this[kQuery] = new HttpParams();
|
|
11425
|
-
this[kQueryProxy] = this[kQuery].getProxy();
|
|
11426
|
-
}
|
|
11427
|
-
get httpVersion() {
|
|
11428
|
-
return this.httpVersionMajor + "." + this.httpVersionMinor;
|
|
11429
|
-
}
|
|
11430
|
-
set httpVersion(value) {
|
|
11431
|
-
const m = HTTP_VERSION_PATTERN2.exec(value);
|
|
11432
|
-
if (!m)
|
|
11433
|
-
throw new TypeError(`Invalid http version string (${value})`);
|
|
11434
|
-
this.httpVersionMajor = parseInt(m[1], 10);
|
|
11435
|
-
this.httpVersionMinor = parseInt(m[2], 10);
|
|
11436
|
-
}
|
|
11437
|
-
get hostname() {
|
|
11438
|
-
let host = this.get("X-Forwarded-Host") || this.get("Host");
|
|
11439
|
-
if (host && host.indexOf(",") !== -1) {
|
|
11440
|
-
host = host.substring(0, host.indexOf(",")).trimEnd();
|
|
11441
|
-
}
|
|
11442
|
-
if (!host)
|
|
11443
|
-
return "";
|
|
11444
|
-
const offset = host[0] === "[" ? host.indexOf("]") + 1 : 0;
|
|
11445
|
-
const index = host.indexOf(":", offset);
|
|
11446
|
-
return index !== -1 ? host.substring(0, index) : host;
|
|
11447
|
-
}
|
|
11448
|
-
get protocol() {
|
|
11449
|
-
if (this[kProtocol])
|
|
11450
|
-
return this[kProtocol];
|
|
11451
|
-
const header = this.get("X-Forwarded-Proto");
|
|
11452
|
-
if (header) {
|
|
11453
|
-
const index = header.indexOf(",");
|
|
11454
|
-
return index !== -1 ? header.substring(0, index).trim() : header.trim();
|
|
11455
|
-
}
|
|
11456
|
-
return "http";
|
|
11457
|
-
}
|
|
11458
|
-
set protocol(v) {
|
|
11459
|
-
this[kProtocol] = v;
|
|
11460
|
-
}
|
|
11461
|
-
get secure() {
|
|
11462
|
-
return this.protocol === "https";
|
|
11463
|
-
}
|
|
11464
|
-
get query() {
|
|
11465
|
-
return this[kQueryProxy];
|
|
11466
|
-
}
|
|
11467
|
-
set query(value) {
|
|
11468
|
-
this[kQuery].clear();
|
|
11469
|
-
this[kQuery].appendAll(value);
|
|
11470
|
-
}
|
|
11471
|
-
header(name) {
|
|
11472
|
-
return this.getHeader(name);
|
|
11473
|
-
}
|
|
11474
|
-
accepts(...type) {
|
|
11475
|
-
const accept = accepts(this);
|
|
11476
|
-
return accept.types.apply(accept, type);
|
|
11477
|
-
}
|
|
11478
|
-
acceptsCharsets(...charset) {
|
|
11479
|
-
const accept = accepts(this);
|
|
11480
|
-
return accept.charsets.apply(accept, charset);
|
|
11481
|
-
}
|
|
11482
|
-
acceptsEncodings(...encoding) {
|
|
11483
|
-
const accept = accepts(this);
|
|
11484
|
-
return accept.encodings.apply(accept, encoding);
|
|
11485
|
-
}
|
|
11486
|
-
acceptsLanguages(...lang) {
|
|
11487
|
-
const accept = accepts(this);
|
|
11488
|
-
return accept.languages.apply(accept, lang);
|
|
11489
|
-
}
|
|
11490
|
-
is(type, ...otherTypes) {
|
|
11491
|
-
const types = Array.isArray(type) ? type : [type];
|
|
11492
|
-
if (otherTypes.length)
|
|
11493
|
-
types.push(...otherTypes);
|
|
11494
|
-
const contentType = this.getHeader("content-type");
|
|
11495
|
-
return contentType ? typeIs.is(contentType, types) : null;
|
|
11496
|
-
}
|
|
11497
|
-
_init(init) {
|
|
11498
|
-
super._init(init);
|
|
11499
|
-
this.method = init.method.toUpperCase();
|
|
11500
|
-
this.url = init.url;
|
|
11501
|
-
this.baseUrl = init.baseUrl || this.url;
|
|
11502
|
-
this.protocol = init.protocol;
|
|
11503
|
-
}
|
|
11504
|
-
[HttpMessageHost.kOnHeaderReceived](info) {
|
|
11505
|
-
super[HttpMessageHost.kOnHeaderReceived](info);
|
|
11506
|
-
this.method = HTTPParser3.methods[info.method];
|
|
11507
|
-
this.url = info.url;
|
|
11508
|
-
this.baseUrl = info.url;
|
|
11509
|
-
}
|
|
11510
|
-
static create(init) {
|
|
11511
|
-
const msg = new HttpRequestMessageHost();
|
|
11512
|
-
msg._init(init);
|
|
11513
|
-
return msg;
|
|
11514
|
-
}
|
|
11515
|
-
static fromBuffer(buffer) {
|
|
11516
|
-
const msg = new HttpRequestMessageHost();
|
|
11517
|
-
msg._parseBuffer(buffer, HTTPParser3.REQUEST);
|
|
11518
|
-
return msg;
|
|
11519
|
-
}
|
|
11520
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11521
|
-
static async fromStream(readable) {
|
|
11522
|
-
throw new Error("fromStream is not implemented yet");
|
|
11523
|
-
}
|
|
11524
|
-
};
|
|
11525
|
-
__name(HttpRequestMessageHost, "HttpRequestMessageHost");
|
|
11526
|
-
HttpRequestMessageHost.kQuery = kQuery;
|
|
11527
|
-
|
|
11528
|
-
// ../../build/common/esm/http/enums/http-status-codes.enum.js
|
|
11529
|
-
var HttpStatusCodes;
|
|
11530
|
-
(function(HttpStatusCodes2) {
|
|
11531
|
-
HttpStatusCodes2[HttpStatusCodes2["CONTINUE"] = 100] = "CONTINUE";
|
|
11532
|
-
HttpStatusCodes2[HttpStatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
11533
|
-
HttpStatusCodes2[HttpStatusCodes2["PROCESSING"] = 102] = "PROCESSING";
|
|
11534
|
-
HttpStatusCodes2[HttpStatusCodes2["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
11535
|
-
HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
|
|
11536
|
-
HttpStatusCodes2[HttpStatusCodes2["CREATED"] = 201] = "CREATED";
|
|
11537
|
-
HttpStatusCodes2[HttpStatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
11538
|
-
HttpStatusCodes2[HttpStatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
11539
|
-
HttpStatusCodes2[HttpStatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
11540
|
-
HttpStatusCodes2[HttpStatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
11541
|
-
HttpStatusCodes2[HttpStatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
11542
|
-
HttpStatusCodes2[HttpStatusCodes2["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
11543
|
-
HttpStatusCodes2[HttpStatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
11544
|
-
HttpStatusCodes2[HttpStatusCodes2["FOUND"] = 302] = "FOUND";
|
|
11545
|
-
HttpStatusCodes2[HttpStatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
11546
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
11547
|
-
HttpStatusCodes2[HttpStatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
11548
|
-
HttpStatusCodes2[HttpStatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
11549
|
-
HttpStatusCodes2[HttpStatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
11550
|
-
HttpStatusCodes2[HttpStatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
11551
|
-
HttpStatusCodes2[HttpStatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
11552
|
-
HttpStatusCodes2[HttpStatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
11553
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
11554
|
-
HttpStatusCodes2[HttpStatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
11555
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
11556
|
-
HttpStatusCodes2[HttpStatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
11557
|
-
HttpStatusCodes2[HttpStatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
11558
|
-
HttpStatusCodes2[HttpStatusCodes2["CONFLICT"] = 409] = "CONFLICT";
|
|
11559
|
-
HttpStatusCodes2[HttpStatusCodes2["GONE"] = 410] = "GONE";
|
|
11560
|
-
HttpStatusCodes2[HttpStatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
11561
|
-
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
11562
|
-
HttpStatusCodes2[HttpStatusCodes2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
11563
|
-
HttpStatusCodes2[HttpStatusCodes2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
11564
|
-
HttpStatusCodes2[HttpStatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
11565
|
-
HttpStatusCodes2[HttpStatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
11566
|
-
HttpStatusCodes2[HttpStatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
11567
|
-
HttpStatusCodes2[HttpStatusCodes2["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
11568
|
-
HttpStatusCodes2[HttpStatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
11569
|
-
HttpStatusCodes2[HttpStatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
11570
|
-
HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
|
|
11571
|
-
HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
11572
|
-
HttpStatusCodes2[HttpStatusCodes2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
11573
|
-
HttpStatusCodes2[HttpStatusCodes2["UPGRADE_REQUIRED"] = 428] = "UPGRADE_REQUIRED";
|
|
11574
|
-
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
11575
|
-
HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
11576
|
-
HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
11577
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
11578
|
-
HttpStatusCodes2[HttpStatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
11579
|
-
HttpStatusCodes2[HttpStatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
11580
|
-
HttpStatusCodes2[HttpStatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
11581
|
-
HttpStatusCodes2[HttpStatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
11582
|
-
HttpStatusCodes2[HttpStatusCodes2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
11583
|
-
HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
11584
|
-
HttpStatusCodes2[HttpStatusCodes2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
11585
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
11586
|
-
HttpStatusCodes2[HttpStatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
11587
|
-
})(HttpStatusCodes || (HttpStatusCodes = {}));
|
|
11588
|
-
|
|
11589
11333
|
// ../../build/common/esm/url/opra-url.js
|
|
11590
11334
|
import { splitString as splitString4, tokenize as tokenize4 } from "fast-tokenizer";
|
|
11591
11335
|
|
|
@@ -11639,7 +11383,10 @@ __name(encodePathComponent, "encodePathComponent");
|
|
|
11639
11383
|
|
|
11640
11384
|
// ../../build/common/esm/url/opra-url-path-component.js
|
|
11641
11385
|
var nodeInspectCustom3 = Symbol.for("nodejs.util.inspect.custom");
|
|
11642
|
-
var OpraURLPathComponent = class {
|
|
11386
|
+
var OpraURLPathComponent = class _OpraURLPathComponent {
|
|
11387
|
+
static {
|
|
11388
|
+
__name(this, "OpraURLPathComponent");
|
|
11389
|
+
}
|
|
11643
11390
|
constructor(init) {
|
|
11644
11391
|
this.resource = init.resource;
|
|
11645
11392
|
this.key = init.key;
|
|
@@ -11648,7 +11395,7 @@ var OpraURLPathComponent = class {
|
|
|
11648
11395
|
toString() {
|
|
11649
11396
|
const obj = encodePathComponent(this.resource, this.key, this.typeCast);
|
|
11650
11397
|
if (obj)
|
|
11651
|
-
Object.setPrototypeOf(obj,
|
|
11398
|
+
Object.setPrototypeOf(obj, _OpraURLPathComponent.prototype);
|
|
11652
11399
|
return obj;
|
|
11653
11400
|
}
|
|
11654
11401
|
/* istanbul ignore next */
|
|
@@ -11663,7 +11410,6 @@ var OpraURLPathComponent = class {
|
|
|
11663
11410
|
return out;
|
|
11664
11411
|
}
|
|
11665
11412
|
};
|
|
11666
|
-
__name(OpraURLPathComponent, "OpraURLPathComponent");
|
|
11667
11413
|
|
|
11668
11414
|
// ../../build/common/esm/url/utils/decode-path-component.js
|
|
11669
11415
|
import { splitString as splitString3 } from "fast-tokenizer";
|
|
@@ -11702,13 +11448,16 @@ function decodePathComponent(input) {
|
|
|
11702
11448
|
__name(decodePathComponent, "decodePathComponent");
|
|
11703
11449
|
|
|
11704
11450
|
// ../../build/common/esm/url/opra-url-path.js
|
|
11705
|
-
var
|
|
11451
|
+
var _a5;
|
|
11706
11452
|
var nodeInspectCustom4 = Symbol.for("nodejs.util.inspect.custom");
|
|
11707
11453
|
var kEntries3 = Symbol("kEntries");
|
|
11708
11454
|
var kOptions4 = Symbol("kOptions");
|
|
11709
|
-
var OpraURLPath = class {
|
|
11455
|
+
var OpraURLPath = class _OpraURLPath {
|
|
11456
|
+
static {
|
|
11457
|
+
__name(this, "OpraURLPath");
|
|
11458
|
+
}
|
|
11710
11459
|
constructor(init, options) {
|
|
11711
|
-
this[
|
|
11460
|
+
this[_a5] = [];
|
|
11712
11461
|
this[kOptions4] = { ...options, onChange: void 0 };
|
|
11713
11462
|
if (Array.isArray(init))
|
|
11714
11463
|
this.join(...init);
|
|
@@ -11775,7 +11524,7 @@ var OpraURLPath = class {
|
|
|
11775
11524
|
return out;
|
|
11776
11525
|
}
|
|
11777
11526
|
slice(start, end) {
|
|
11778
|
-
return new
|
|
11527
|
+
return new _OpraURLPath(this[kEntries3].slice(start, end));
|
|
11779
11528
|
}
|
|
11780
11529
|
splice(start, deleteCount, join) {
|
|
11781
11530
|
const items = join ? this._join([], join) : [];
|
|
@@ -11817,11 +11566,11 @@ var OpraURLPath = class {
|
|
|
11817
11566
|
}
|
|
11818
11567
|
return;
|
|
11819
11568
|
}
|
|
11820
|
-
if (source instanceof
|
|
11569
|
+
if (source instanceof _OpraURLPath) {
|
|
11821
11570
|
target.push(...source[kEntries3].map((x) => new OpraURLPathComponent(x)));
|
|
11822
11571
|
return;
|
|
11823
11572
|
}
|
|
11824
|
-
if (typeof source === "object" && source.path instanceof
|
|
11573
|
+
if (typeof source === "object" && source.path instanceof _OpraURLPath) {
|
|
11825
11574
|
this._join(target, source.path);
|
|
11826
11575
|
return;
|
|
11827
11576
|
}
|
|
@@ -11836,7 +11585,7 @@ var OpraURLPath = class {
|
|
|
11836
11585
|
target.push(new OpraURLPathComponent(source));
|
|
11837
11586
|
}
|
|
11838
11587
|
/* istanbul ignore next */
|
|
11839
|
-
[(
|
|
11588
|
+
[(_a5 = kEntries3, nodeInspectCustom4)]() {
|
|
11840
11589
|
return this[kEntries3];
|
|
11841
11590
|
}
|
|
11842
11591
|
[Symbol.iterator]() {
|
|
@@ -11846,12 +11595,11 @@ var OpraURLPath = class {
|
|
|
11846
11595
|
return "OpraURLPath";
|
|
11847
11596
|
}
|
|
11848
11597
|
};
|
|
11849
|
-
__name(OpraURLPath, "OpraURLPath");
|
|
11850
11598
|
OpraURLPath.kEntries = kEntries3;
|
|
11851
11599
|
OpraURLPath.kOptions = kOptions4;
|
|
11852
11600
|
|
|
11853
11601
|
// ../../build/common/esm/url/opra-url.js
|
|
11854
|
-
var
|
|
11602
|
+
var _a6;
|
|
11855
11603
|
var nodeInspectCustom5 = Symbol.for("nodejs.util.inspect.custom");
|
|
11856
11604
|
var urlRegEx = /^(?:((?:[A-Z][A-Z+-.]+:)+)\/\/([^/?]+))?(.*)?$/i;
|
|
11857
11605
|
var schemeRegEx = /^([A-Z][A-Z+-.]+:?)+$/i;
|
|
@@ -11860,9 +11608,12 @@ var hostnameRegEx = /^([^/:]+)$/;
|
|
|
11860
11608
|
var kContext = Symbol("kContext");
|
|
11861
11609
|
var kPath = Symbol("kPath");
|
|
11862
11610
|
var kParams = Symbol("kParams");
|
|
11863
|
-
var OpraURL = class {
|
|
11611
|
+
var OpraURL = class _OpraURL {
|
|
11612
|
+
static {
|
|
11613
|
+
__name(this, "OpraURL");
|
|
11614
|
+
}
|
|
11864
11615
|
constructor(input, base) {
|
|
11865
|
-
this[
|
|
11616
|
+
this[_a6] = {
|
|
11866
11617
|
protocol: "",
|
|
11867
11618
|
username: "",
|
|
11868
11619
|
prefix: "",
|
|
@@ -11885,7 +11636,7 @@ var OpraURL = class {
|
|
|
11885
11636
|
if (input)
|
|
11886
11637
|
this.parse(typeof input === "object" ? input.toString() : input);
|
|
11887
11638
|
if (base) {
|
|
11888
|
-
const baseUrl = base instanceof
|
|
11639
|
+
const baseUrl = base instanceof _OpraURL ? base : new _OpraURL(base);
|
|
11889
11640
|
this[kContext].protocol = baseUrl.protocol;
|
|
11890
11641
|
this[kContext].hostname = baseUrl.hostname;
|
|
11891
11642
|
this[kContext].port = baseUrl.port;
|
|
@@ -11965,7 +11716,7 @@ var OpraURL = class {
|
|
|
11965
11716
|
}
|
|
11966
11717
|
set prefix(value) {
|
|
11967
11718
|
if (value) {
|
|
11968
|
-
const url = new
|
|
11719
|
+
const url = new _OpraURL(value);
|
|
11969
11720
|
this[kContext].prefix = url.pathname;
|
|
11970
11721
|
} else
|
|
11971
11722
|
this[kContext].prefix = "";
|
|
@@ -12069,7 +11820,7 @@ var OpraURL = class {
|
|
|
12069
11820
|
return this.href;
|
|
12070
11821
|
}
|
|
12071
11822
|
/* istanbul ignore next */
|
|
12072
|
-
[(
|
|
11823
|
+
[(_a6 = kContext, nodeInspectCustom5)]() {
|
|
12073
11824
|
return {
|
|
12074
11825
|
protocol: this.protocol,
|
|
12075
11826
|
username: this.username,
|
|
@@ -12134,7 +11885,6 @@ var OpraURL = class {
|
|
|
12134
11885
|
}
|
|
12135
11886
|
}
|
|
12136
11887
|
};
|
|
12137
|
-
__name(OpraURL, "OpraURL");
|
|
12138
11888
|
OpraURL.kContext = kContext;
|
|
12139
11889
|
OpraURL.kPath = kPath;
|
|
12140
11890
|
OpraURL.kParams = kParams;
|
|
@@ -12159,10 +11909,8 @@ export {
|
|
|
12159
11909
|
HttpHeaderCodes,
|
|
12160
11910
|
HttpHeaders,
|
|
12161
11911
|
HttpParams,
|
|
12162
|
-
HttpRequestMessage,
|
|
12163
|
-
HttpResponseMessage,
|
|
12164
|
-
HttpResponseMessageHost,
|
|
12165
11912
|
HttpStatusCodes,
|
|
11913
|
+
HttpStatusMessages,
|
|
12166
11914
|
I18n,
|
|
12167
11915
|
IntegerCodec,
|
|
12168
11916
|
InternalServerError,
|
|
@@ -12177,7 +11925,7 @@ export {
|
|
|
12177
11925
|
OmitType,
|
|
12178
11926
|
OpraException,
|
|
12179
11927
|
opra_filter_ns_exports as OpraFilter,
|
|
12180
|
-
OpraSchema,
|
|
11928
|
+
opra_schema_ns_exports as OpraSchema,
|
|
12181
11929
|
OpraURL,
|
|
12182
11930
|
OpraURLPath,
|
|
12183
11931
|
OpraURLPathComponent,
|
|
@@ -12193,6 +11941,7 @@ export {
|
|
|
12193
11941
|
UnauthorizedError,
|
|
12194
11942
|
UnionType2 as UnionType,
|
|
12195
11943
|
UnprocessableEntityError,
|
|
11944
|
+
ValidationError,
|
|
12196
11945
|
applyMixins,
|
|
12197
11946
|
cloneObject,
|
|
12198
11947
|
decodePathComponent,
|